:root {
  color-scheme: light;
  --bg: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --muted-light: #94a3b8;
  --line: #dde5e1;
  --panel: #ffffff;
  --soft: #f8faf9;
  --surface-muted: #f1f5f3;
  --green: #247a57;
  --green-soft: #e7f5ee;
  --amber: #b45309;
  --amber-soft: #fffbeb;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.07);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button {
  font: inherit;
}

.shell {
  width: min(1240px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 18px 0 48px;
}

.topbar,
.demo-mode,
.hero,
.actions,
.section-head,
.step-tabs {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.topbar > div:first-child {
  min-width: 0;
}

.label {
  margin: 0 0 6px;
  color: var(--green);
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(24px, 2.5vw, 32px);
  line-height: 1;
}

h2 {
  max-width: 760px;
  margin-bottom: 18px;
  font-size: clamp(42px, 6vw, 64px);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0;
  font-size: clamp(25px, 3vw, 40px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: 0;
}

.demo-mode {
  gap: 4px;
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 4px;
}

.mode-button {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
}

.mode-button.active {
  background: var(--ink);
  color: white;
}

.hero {
  min-height: 360px;
  justify-content: space-between;
  gap: 44px;
  padding: 52px 0 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  border-inline: 0;
  background: var(--bg);
}

.hero-copy p:not(.label) {
  max-width: 640px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.5;
}

.actions {
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 750;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button.primary {
  background: var(--green);
  color: white;
}

.button.secondary {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
}

.button.connected {
  border-color: rgba(47, 126, 91, 0.35);
  color: var(--green);
}

.button.ghost {
  background: var(--green-soft);
  color: var(--green);
}

.button.small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.mission-console {
  width: min(380px, 100%);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.mission-console > .label,
.mission-console > strong,
.mission-console > span {
  display: block;
  padding-inline: 20px;
}

.mission-console > .label {
  padding-top: 20px;
}

.mission-console strong {
  margin-bottom: 6px;
  font-size: 20px;
  line-height: 1.18;
}

.mission-console span {
  color: var(--muted);
  line-height: 1.45;
}

.mission-console dl {
  display: grid;
  margin: 20px 0 0;
  border-top: 1px solid var(--line);
}

.mission-console div {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

.mission-console dt,
.mission-console dd {
  margin: 0;
}

.mission-console dt {
  color: var(--green);
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.mission-console dd {
  color: var(--ink);
  font-weight: 750;
}

.wallet-diagnostic {
  display: block;
  margin-top: 0.9rem;
  padding: 0.7rem 0.75rem;
  border-radius: 8px;
  background: #f5f7f9;
  color: #526073;
  font-size: 0.78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

body[data-mode="story"] .technical-only,
body[data-mode="story"] .technical-evidence {
  display: none;
}

.proof-path {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin-top: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.proof-path .step-tab {
  position: relative;
  display: block;
  min-height: 64px;
  min-width: 0;
  border-right: 1px solid var(--line);
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 0;
  background: var(--panel);
  padding: 16px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 850;
  text-align: left;
  text-transform: uppercase;
}

.proof-path .step-tab.active {
  background: var(--green-soft);
  color: var(--green);
}

.proof-path small {
  display: block;
  width: auto;
  height: auto;
  margin: 0 0 8px;
  border-radius: 0;
  background: transparent;
  color: var(--green);
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.proof-path .step-tab:last-child {
  border-right: 0;
}

.step-tabs {
  margin-top: 14px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.step-tab {
  min-width: max-content;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  padding: 11px 15px;
  cursor: pointer;
  font-weight: 800;
}

.step-tab.active {
  border-color: rgba(4, 120, 87, 0.24);
  background: var(--green-soft);
  color: var(--green);
}

.step-panel,
.receipt-panel {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 24px;
}

.step-panel {
  display: none;
}

.step-panel.active {
  display: block;
}

.section-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 8px;
  background: var(--amber-soft);
  color: var(--amber);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.work-rows {
  display: grid;
  gap: 10px;
}

.work-row {
  display: grid;
  grid-template-columns: minmax(240px, 1.5fr) minmax(120px, 0.55fr) minmax(120px, 0.5fr) minmax(110px, 0.45fr);
  gap: 12px;
  align-items: center;
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px 16px;
}

.work-row.selected {
  border-color: rgba(4, 120, 87, 0.28);
  background: var(--green-soft);
}

.work-row strong,
.work-row span,
.work-row b {
  min-width: 0;
}

.work-row strong {
  display: block;
  font-size: 16px;
}

.work-row span {
  color: var(--muted);
  font-size: 14px;
}

.work-row b {
  color: var(--green);
  font-size: 13px;
  text-transform: capitalize;
}

.split-grid,
.focused-surface {
  display: grid;
  gap: 16px;
}

.split-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.panel h3 {
  margin-bottom: 18px;
}

.fact-grid,
.boundary-grid,
.packet-list,
.entity-grid {
  display: grid;
  gap: 10px;
}

.fact-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fact-grid span,
.boundary-grid span,
.packet-list span,
.entity-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 12px;
}

.fact-grid small,
.entity-card small {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.fact-grid strong,
.entity-card strong {
  display: block;
  font-size: 15px;
}

.boundary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.boundary-grid span:nth-child(even),
.packet-list span:nth-child(even) {
  background: var(--amber-soft);
}

.packet-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.run-trace {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.run-trace span {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  border: 1px solid rgba(36, 122, 87, 0.18);
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--ink);
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 800;
}

.run-trace small {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--green);
  color: white;
  font-size: 11px;
}

.entity-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.entity-card {
  min-height: 148px;
  position: relative;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
}

.entity-card:last-child {
  border-right: 0;
}

.entity-card em {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-bottom: 12px;
  border-radius: 999px;
  background: var(--green);
  color: white;
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
}

.entity-card span {
  display: block;
  min-height: 38px;
  margin: 8px 0;
  color: var(--muted);
  line-height: 1.35;
}

.entity-card code {
  display: block;
  margin-top: 8px;
  color: #58687a;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.compact-actions {
  margin-top: 18px;
}

.evidence-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.summary-card {
  min-height: 88px;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 14px;
}

.summary-card:last-child {
  border-right: 0;
}

.summary-card small {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.summary-card strong {
  display: block;
  font-size: 18px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.summary-card.accent {
  background: var(--green-soft);
  color: var(--green);
}

.summary-card.quiet {
  background: var(--soft);
}

.technical-evidence {
  margin-top: 14px;
}

.technical-evidence summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

pre {
  margin-top: 12px;
  max-height: 420px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #071923;
  color: #e7f8f1;
  padding: 18px;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal-block {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #071923;
  color: #e7f8f1;
  padding: 16px;
}

.terminal-block code {
  margin-bottom: 6px;
  color: #ffffff;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.terminal-block span {
  color: #baf7d6;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

  @media (max-width: 860px) {
  .shell {
    width: min(100% - 20px, 720px);
    padding-top: 16px;
  }

  .topbar,
  .hero,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .demo-mode {
    margin-left: 0;
    width: fit-content;
  }

  .hero {
    min-height: auto;
    padding: 32px 0;
  }

  h2 {
    font-size: 42px;
  }

  .mission-console {
    width: 100%;
  }

  .mission-console div {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .step-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
    overflow-x: visible;
  }

  .step-tab {
    min-width: 0;
    padding-inline: 10px;
  }

  .work-row,
  .split-grid,
  .proof-path,
  .fact-grid,
  .boundary-grid,
  .packet-list,
  .entity-grid,
  .evidence-summary {
    grid-template-columns: 1fr;
  }

  .proof-path .step-tab,
  .entity-card,
  .summary-card {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .proof-path .step-tab:last-child,
  .entity-card:last-child,
  .summary-card:last-child {
    border-bottom: 0;
  }

  .work-row {
    align-items: start;
  }
}
