:root {
  color-scheme: dark;
  --bg: #071018;
  --bg-deep: #03080d;
  --surface: rgba(15, 29, 40, 0.82);
  --surface-strong: #112332;
  --surface-soft: rgba(25, 43, 57, 0.66);
  --line: rgba(172, 214, 226, 0.16);
  --line-strong: rgba(172, 214, 226, 0.32);
  --text: #eef8f5;
  --muted: #9fb5bc;
  --accent: #75f0c5;
  --accent-strong: #35d5a1;
  --accent-blue: #78b9ff;
  --accent-violet: #b39aff;
  --warning: #ffd180;
  --danger: #ff8e9b;
  --success: #71e6a2;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
  --radius: 22px;
  --radius-small: 13px;
  --shell: 1180px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 5%, rgba(49, 172, 149, 0.15), transparent 26rem),
    radial-gradient(circle at 90% 20%, rgba(80, 126, 202, 0.14), transparent 32rem),
    linear-gradient(180deg, var(--bg-deep), var(--bg) 28%, #08131b);
  line-height: 1.6;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: #a2ffe1;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(117, 240, 197, 0.58);
  outline-offset: 3px;
}

h1,
h2,
h3,
h4,
p,
dl,
ol,
ul {
  margin-top: 0;
}

h1,
h2,
h3,
h4 {
  letter-spacing: -0.035em;
  line-height: 1.08;
}

h1 {
  max-width: 820px;
  margin-bottom: 22px;
  font-size: clamp(3rem, 7vw, 6.8rem);
  font-weight: 760;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(2.2rem, 5vw, 4.4rem);
}

h3 {
  margin-bottom: 10px;
  font-size: clamp(1.25rem, 2.4vw, 1.7rem);
}

h4 {
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.shell {
  width: min(calc(100% - 40px), var(--shell));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  color: #04110d;
  background: var(--accent);
  border-radius: 8px;
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
  min-height: 76px;
  padding: 0 max(20px, calc((100vw - var(--shell)) / 2));
  background: rgba(3, 8, 13, 0.78);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--text);
  font-size: 1.18rem;
  font-weight: 760;
  letter-spacing: -0.04em;
}

.brand span {
  color: var(--accent);
  animation: blink 1.2s steps(2, jump-none) infinite;
}

@keyframes blink {
  50% { opacity: 0.2; }
}

.site-header nav {
  display: flex;
  gap: 21px;
  justify-content: center;
}

.site-header nav a,
.header-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 650;
}

.site-header nav a:hover,
.header-link:hover {
  color: var(--text);
}

.header-actions {
  display: flex;
  gap: 14px;
  align-items: center;
}

.backend-chip {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 8px 11px;
  color: var(--muted);
  font-size: 0.76rem;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--warning);
  border-radius: 50%;
  box-shadow: 0 0 14px currentColor;
}

.backend-chip.online {
  color: var(--success);
}

.backend-chip.online .status-dot {
  background: var(--success);
}

.backend-chip.offline {
  color: var(--danger);
}

.backend-chip.offline .status-dot {
  background: var(--danger);
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(250px, 0.5fr);
  gap: 50px;
  align-items: center;
  min-height: calc(100vh - 76px);
  padding-block: 92px 70px;
}

.hero-copy-block {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 760;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero-subtitle {
  max-width: 760px;
  margin-bottom: 25px;
  color: #c0d1d5;
  font-size: clamp(1.08rem, 2vw, 1.35rem);
}

.scope-note {
  max-width: 760px;
  padding: 17px 19px;
  color: var(--muted);
  background: rgba(117, 240, 197, 0.055);
  border: 1px solid rgba(117, 240, 197, 0.2);
  border-radius: var(--radius-small);
}

.scope-note strong {
  display: block;
  margin-bottom: 3px;
  color: var(--text);
}

.hero-actions,
.control-actions,
.story-actions,
.evidence-links {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
  margin-top: 25px;
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 17px;
  color: var(--text);
  font-weight: 730;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  cursor: pointer;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background 150ms ease,
    opacity 150ms ease;
}

.button:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  color: var(--text);
  border-color: rgba(117, 240, 197, 0.65);
  transform: translateY(-1px);
}

.button.primary {
  color: #03110d;
  background: linear-gradient(135deg, var(--accent), #5dcfe1);
  border-color: transparent;
  box-shadow: 0 12px 30px rgba(53, 213, 161, 0.16);
}

.button.secondary {
  background: rgba(255, 255, 255, 0.055);
}

.button.danger {
  color: #ffd9df;
  border-color: rgba(255, 142, 155, 0.38);
}

.button.quiet {
  min-height: 38px;
  padding: 7px 12px;
  font-size: 0.82rem;
}

.button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
  transform: none;
}

.hero-orbit {
  position: relative;
  width: min(34vw, 360px);
  aspect-ratio: 1;
  margin-inline: auto;
}

.orbit-ring,
.orbit-core,
.orbit-node {
  position: absolute;
  border-radius: 50%;
}

.orbit-ring {
  inset: 8%;
  border: 1px solid rgba(117, 240, 197, 0.23);
  animation: orbit-rotate 18s linear infinite;
}

.orbit-two {
  inset: 23%;
  border-color: rgba(120, 185, 255, 0.24);
  animation-direction: reverse;
  animation-duration: 13s;
}

.orbit-one::before,
.orbit-two::after {
  position: absolute;
  width: 9px;
  height: 9px;
  content: "";
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 25px var(--accent);
}

.orbit-one::before { top: 10%; left: 16%; }
.orbit-two::after { right: 10%; bottom: 14%; background: var(--accent-blue); }

@keyframes orbit-rotate {
  to { transform: rotate(360deg); }
}

.orbit-core {
  inset: 35%;
  display: grid;
  place-items: center;
  color: #03110d;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 900;
  background: radial-gradient(circle at 30% 25%, #e6fff6, var(--accent));
  box-shadow: 0 0 60px rgba(117, 240, 197, 0.25);
}

.orbit-node {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  font-weight: 800;
  background: var(--surface-strong);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}

.node-a { top: 2%; left: 46%; }
.node-b { right: 0; bottom: 16%; }
.node-c { bottom: 7%; left: 4%; }

.hero-facts {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  margin: 58px 0 0;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.hero-facts div {
  min-height: 92px;
  padding: 17px;
  background: rgba(6, 17, 24, 0.94);
}

.hero-facts dt,
.metric-grid dt,
.branch-metrics dt {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 730;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-facts dd,
.metric-grid dd,
.branch-metrics dd {
  margin: 7px 0 0;
  font-size: 0.94rem;
  font-weight: 680;
}

.section {
  padding-block: 105px;
  border-top: 1px solid var(--line);
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(300px, 0.65fr);
  gap: 50px;
  align-items: end;
  margin-bottom: 40px;
}

.section-summary,
.branch-heading-row > p {
  max-width: 590px;
  margin-bottom: 0;
  color: var(--muted);
}

.card,
.branch-card,
.live-strip {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.035), transparent 38%),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.offline-banner {
  margin-bottom: 22px;
  padding: 16px 18px;
  color: #ffdce1;
  background: rgba(255, 142, 155, 0.08);
  border: 1px solid rgba(255, 142, 155, 0.28);
  border-radius: var(--radius-small);
}

.offline-banner strong {
  display: block;
}

.forge-layout,
.lab-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(320px, 0.72fr);
  gap: 24px;
  align-items: start;
}

.forge-controls,
.story-canvas,
.prediction-controls,
.distribution-card,
.replay-card,
.surprisal-card {
  padding: 27px;
}

.step-heading,
.story-canvas-heading,
.output-heading,
.replay-heading,
.branch-heading-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
}

.step-heading > span {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #03110d;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 900;
  background: var(--accent);
  border-radius: 10px;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend,
.field-group > label {
  display: block;
  margin-bottom: 9px;
  color: #d8e7e8;
  font-size: 0.84rem;
  font-weight: 730;
}

label span,
.field-group > label span {
  color: var(--muted);
  font-weight: 500;
}

.world-fieldset {
  margin-top: 19px;
}

.world-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.world-card {
  position: relative;
  display: flex;
  min-height: 160px;
  flex-direction: column;
  gap: 3px;
  padding: 13px;
  overflow: hidden;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: border-color 150ms ease, transform 150ms ease, background 150ms ease;
}

.world-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

.world-card:has(input:checked) {
  background: rgba(117, 240, 197, 0.08);
  border-color: rgba(117, 240, 197, 0.62);
  box-shadow: inset 0 0 0 1px rgba(117, 240, 197, 0.12);
}

.world-card input {
  position: absolute;
  opacity: 0;
}

.world-card strong {
  font-size: 0.91rem;
}

.world-card small {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.world-illustration {
  position: relative;
  height: 74px;
  margin-bottom: 5px;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(120, 185, 255, 0.17), rgba(179, 154, 255, 0.06));
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
}

.world-illustration::before,
.world-illustration::after,
.world-illustration i,
.world-illustration b {
  position: absolute;
  content: "";
}

.world-space .world-illustration::before {
  width: 31px;
  height: 31px;
  top: 12px;
  left: 16px;
  background: #9abaff;
  border-radius: 50%;
  box-shadow: 0 0 22px rgba(154, 186, 255, 0.55);
}

.world-space .world-illustration::after {
  right: 13px;
  bottom: 15px;
  width: 38px;
  height: 12px;
  background: var(--accent);
  border-radius: 50% 50% 35% 35%;
  transform: rotate(-17deg);
}

.world-space .world-illustration i {
  right: 26px;
  bottom: 7px;
  width: 3px;
  height: 23px;
  background: var(--accent);
  transform: rotate(-17deg);
}

.world-forest .world-illustration::before,
.world-forest .world-illustration::after,
.world-forest .world-illustration i {
  bottom: 12px;
  width: 27px;
  height: 48px;
  background: linear-gradient(145deg, #75f0c5, #238967);
  clip-path: polygon(50% 0, 100% 72%, 68% 72%, 88% 100%, 12% 100%, 32% 72%, 0 72%);
}

.world-forest .world-illustration::before { left: 12px; }
.world-forest .world-illustration::after { left: 39px; height: 60px; }
.world-forest .world-illustration i { right: 8px; height: 39px; opacity: 0.75; }

.world-robot .world-illustration::before {
  top: 17px;
  left: 26px;
  width: 45px;
  height: 39px;
  background: #8fd8e8;
  border: 4px solid #143644;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(117, 240, 197, 0.22);
}

.world-robot .world-illustration::after {
  top: 33px;
  left: 37px;
  width: 7px;
  height: 7px;
  background: #071018;
  border-radius: 50%;
  box-shadow: 17px 0 #071018;
}

.world-robot .world-illustration i {
  top: 6px;
  left: 48px;
  width: 3px;
  height: 13px;
  background: var(--accent);
}

.world-robot .world-illustration b {
  top: 3px;
  left: 44px;
  width: 11px;
  height: 11px;
  background: var(--accent);
  border-radius: 50%;
}

.world-mystery .world-illustration::before {
  top: 13px;
  left: 20px;
  width: 39px;
  height: 39px;
  border: 5px solid #d7c5ff;
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(179, 154, 255, 0.3);
}

.world-mystery .world-illustration::after {
  top: 49px;
  left: 55px;
  width: 30px;
  height: 6px;
  background: #d7c5ff;
  border-radius: 5px;
  transform: rotate(43deg);
}

.control-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 24px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip-row label {
  position: relative;
  cursor: pointer;
}

.chip-row input {
  position: absolute;
  opacity: 0;
}

.chip-row span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 7px 10px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.chip-row input:checked + span {
  color: var(--text);
  background: rgba(117, 240, 197, 0.1);
  border-color: rgba(117, 240, 197, 0.55);
}

.field-group {
  margin-top: 20px;
}

input,
textarea,
select {
  width: 100%;
  color: var(--text);
  background: rgba(2, 9, 14, 0.66);
  border: 1px solid var(--line-strong);
  border-radius: 11px;
}

input,
select {
  min-height: 44px;
  padding: 9px 11px;
}

textarea {
  min-height: 96px;
  padding: 12px;
  resize: vertical;
}

select {
  cursor: pointer;
}

.field-help,
.request-status,
.history-warning,
.lab-disclaimer,
.empty-result,
.empty-history {
  color: var(--muted);
  font-size: 0.78rem;
}

.field-help {
  margin: 7px 0 0;
}

.request-status {
  min-height: 1.4em;
  margin: 13px 0 0;
}

.request-status.error {
  color: var(--danger);
}

.advanced-controls {
  margin-top: 20px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.advanced-controls summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.parameter-grid,
.compact-control-grid,
.guess-row {
  display: grid;
  gap: 12px;
}

.parameter-grid {
  grid-template-columns: 1fr 1fr;
  align-items: end;
}

.toggle-field {
  display: flex;
  grid-column: 1 / -1;
  gap: 9px;
  align-items: center;
}

.toggle-field input {
  width: 17px;
  min-height: auto;
  height: 17px;
}

.toggle-field label {
  color: var(--muted);
  font-size: 0.78rem;
}

.story-canvas {
  position: sticky;
  top: 98px;
  min-height: 480px;
}

.mode-badge,
.verified-badge {
  display: inline-flex;
  padding: 6px 9px;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.69rem;
  font-style: normal;
  font-weight: 750;
  background: rgba(117, 240, 197, 0.075);
  border: 1px solid rgba(117, 240, 197, 0.2);
  border-radius: 999px;
}

.story-history {
  display: grid;
  gap: 14px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.story-history li:not(.empty-history) {
  position: relative;
  padding: 15px 15px 15px 45px;
  white-space: pre-wrap;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.story-history li:not(.empty-history)::before {
  position: absolute;
  top: 14px;
  left: 14px;
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  content: attr(data-round);
  color: #03110d;
  font-size: 0.67rem;
  font-weight: 800;
  background: var(--accent);
  border-radius: 50%;
}

.history-warning {
  margin-top: 16px;
  padding: 11px;
  color: var(--warning);
  background: rgba(255, 209, 128, 0.07);
  border: 1px solid rgba(255, 209, 128, 0.22);
  border-radius: 9px;
}

.branch-section,
.temperature-section {
  margin-top: 48px;
}

.branch-heading-row {
  align-items: end;
  margin-bottom: 18px;
}

.branch-grid,
.temperature-grid,
.evidence-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 17px;
}

.branch-card {
  display: flex;
  min-height: 310px;
  flex-direction: column;
  padding: 20px;
  transition: border-color 180ms ease, transform 180ms ease;
}

.branch-card.ready {
  border-color: rgba(117, 240, 197, 0.35);
}

.branch-card.selected {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.branch-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.branch-card-heading span {
  font-weight: 800;
}

.branch-card-heading em {
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
}

.branch-text {
  flex: 1;
  margin: 17px 0;
  color: #d8e5e5;
  white-space: pre-wrap;
}

.branch-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 15px;
}

.branch-metrics div {
  min-width: 0;
}

.branch-metrics dd {
  overflow: hidden;
  font-size: 0.78rem;
  text-overflow: ellipsis;
}

.live-strip {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 20px;
  align-items: center;
  margin-top: 24px;
  padding: 20px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  overflow: hidden;
  background: var(--line);
  border-radius: 11px;
}

.metric-grid div {
  min-height: 70px;
  padding: 10px;
  background: #0b1821;
}

.compact-control-grid {
  grid-template-columns: repeat(3, 1fr);
}

.guess-row {
  grid-template-columns: 1fr 150px;
}

.distribution-card {
  min-height: 460px;
}

.candidate-list,
.mini-distribution {
  display: grid;
  gap: 9px;
  margin-top: 22px;
}

.candidate-row,
.mini-row {
  display: grid;
  grid-template-columns: minmax(75px, auto) 1fr 58px;
  gap: 9px;
  align-items: center;
}

.candidate-label,
.mini-label {
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.probability-track {
  height: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 999px;
}

.probability-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-blue));
  border-radius: inherit;
  transform-origin: left;
}

.probability-value {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.7rem;
  text-align: right;
}

.temperature-grid article {
  padding: 20px;
}

.surprisal-card {
  margin-top: 24px;
}

.lab-disclaimer {
  max-width: 820px;
}

.surprisal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 20px 0;
}

.surprisal-token {
  display: inline-flex;
  padding: 5px 7px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  background: color-mix(in srgb, var(--danger) calc(var(--surprise) * 1%), rgba(117, 240, 197, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

caption {
  padding: 6px 0;
  color: var(--muted);
  text-align: left;
}

th,
td {
  padding: 9px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.systems-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.scenario-panel {
  display: grid;
  gap: 7px;
  padding: 11px;
}

.scenario-button {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 2px 9px;
  min-height: 58px;
  padding: 13px;
  color: var(--text);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
}

.scenario-button > span {
  grid-row: 1 / 3;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.73rem;
}

.scenario-button strong {
  font-size: 0.86rem;
}

.scenario-button small {
  color: var(--muted);
}

.scenario-button:hover,
.scenario-button.active {
  background: rgba(117, 240, 197, 0.07);
  border-color: rgba(117, 240, 197, 0.25);
}

.replay-heading {
  gap: 20px;
}

.replay-heading p {
  max-width: 640px;
  margin: 8px 0 0;
  color: var(--muted);
}

.verified-badge {
  margin-bottom: 10px;
}

.replay-controls {
  display: flex;
  gap: 9px;
  align-items: center;
  margin: 24px 0 18px;
  padding: 11px;
  background: rgba(255, 255, 255, 0.026);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.icon-button {
  width: 42px;
  min-height: 42px;
  padding: 0;
}

#replay-progress {
  margin-left: auto;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.76rem;
}

.systems-stage {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
}

.lane-panel,
.resource-panel,
.event-inspector,
.invariant-panel {
  padding: 16px;
  background: rgba(3, 10, 15, 0.5);
  border: 1px solid var(--line);
  border-radius: 13px;
}

.request-lanes {
  display: grid;
  gap: 8px;
  min-height: 160px;
}

.request-lane {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 8px;
  align-items: center;
}

.lane-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.74rem;
  text-overflow: ellipsis;
}

.lane-track {
  position: relative;
  height: 13px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}

.lane-progress {
  height: 100%;
  min-width: 4px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent));
  border-radius: inherit;
  transition: width 240ms ease;
}

.lane-state {
  color: var(--muted);
  font-size: 0.67rem;
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 5px;
  min-height: 160px;
  align-content: start;
}

.resource-block {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.62rem;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.resource-block.active { color: #04110d; background: var(--accent); }
.resource-block.shared { color: #06121c; background: var(--accent-blue); }
.resource-block.pressure { color: #241906; background: var(--warning); }
.resource-block.released { opacity: 0.32; }

.event-inspector {
  margin-top: 14px;
}

.event-inspector p:not(.eyebrow) {
  color: var(--muted);
}

.event-inspector pre {
  max-height: 180px;
  margin: 13px 0 0;
  padding: 12px;
  overflow: auto;
  color: #bfe7dd;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  background: #03090d;
  border-radius: 9px;
}

.invariant-panel {
  margin-top: 14px;
}

.invariant-panel ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.invariant-panel li {
  color: var(--muted);
  font-size: 0.78rem;
}

.invariant-panel li::before {
  margin-right: 7px;
  color: var(--success);
  content: "✓";
}

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

.evidence-grid article {
  padding: 22px;
}

.evidence-number {
  display: block;
  margin-bottom: 20px;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 2rem;
  font-weight: 860;
}

.evidence-grid p,
.limits-grid p {
  margin-bottom: 0;
  color: var(--muted);
}

.evidence-links {
  justify-content: center;
  margin-top: 28px;
}

.evidence-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 9px 12px;
  font-size: 0.82rem;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.limits-section {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 50px;
}

.limits-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.limits-grid p {
  padding: 16px;
  border-left: 2px solid var(--line-strong);
}

.limits-grid strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}

.site-footer {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  padding-block: 28px;
  color: var(--muted);
  font-size: 0.75rem;
  border-top: 1px solid var(--line);
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

@media (max-width: 1040px) {
  .site-header nav { display: none; }
  .site-header { grid-template-columns: auto 1fr; }
  .header-actions { justify-content: end; }
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .hero-orbit { position: absolute; top: 80px; right: 0; z-index: 0; opacity: 0.32; }
  .hero-facts { grid-template-columns: repeat(3, 1fr); }
  .world-grid { grid-template-columns: 1fr 1fr; }
  .forge-layout, .lab-grid { grid-template-columns: 1fr; }
  .story-canvas { position: static; min-height: auto; }
  .systems-layout { grid-template-columns: 1fr; }
  .scenario-panel { grid-template-columns: repeat(2, 1fr); }
  .evidence-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .shell { width: min(calc(100% - 24px), var(--shell)); }
  .site-header { min-height: 66px; padding-inline: 12px; }
  .header-link { display: none; }
  .backend-chip { max-width: 180px; }
  .backend-chip strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hero { padding-block: 65px 50px; }
  .hero-orbit { width: 250px; top: 45px; }
  .hero-facts { grid-template-columns: 1fr 1fr; margin-top: 30px; }
  .section { padding-block: 72px; }
  .section-heading, .limits-section { grid-template-columns: 1fr; gap: 18px; }
  .world-grid { grid-template-columns: 1fr 1fr; }
  .control-pair, .compact-control-grid, .guess-row { grid-template-columns: 1fr; }
  .branch-grid, .temperature-grid { grid-template-columns: 1fr; }
  .live-strip { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .systems-stage { grid-template-columns: 1fr; }
  .scenario-panel { grid-template-columns: 1fr; }
  .evidence-grid, .limits-grid { grid-template-columns: 1fr; }
  .site-footer { flex-direction: column; }
}

@media (max-width: 480px) {
  h1 { font-size: 2.7rem; }
  .world-grid { grid-template-columns: 1fr; }
  .world-card { min-height: 142px; }
  .forge-controls, .story-canvas, .prediction-controls, .distribution-card, .replay-card, .surprisal-card { padding: 18px; }
  .hero-facts { grid-template-columns: 1fr; }
  .parameter-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr; }
  .branch-metrics { grid-template-columns: 1fr 1fr 1fr; }
  .replay-heading, .branch-heading-row { flex-direction: column; }
  .invariant-panel ul { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #edf5f2;
    --bg-deep: #f8fbfa;
    --surface: rgba(255, 255, 255, 0.9);
    --surface-strong: #ffffff;
    --surface-soft: rgba(231, 242, 239, 0.86);
    --line: rgba(17, 58, 61, 0.13);
    --line-strong: rgba(17, 58, 61, 0.25);
    --text: #102b2c;
    --muted: #526c70;
    --accent: #087f66;
    --accent-strong: #076a57;
    --accent-blue: #2b6fbd;
    --accent-violet: #6747b0;
    --warning: #94620d;
    --danger: #b63649;
    --success: #147648;
    --shadow: 0 24px 70px rgba(37, 69, 65, 0.12);
  }

  body {
    background:
      radial-gradient(circle at 15% 5%, rgba(49, 172, 149, 0.12), transparent 26rem),
      radial-gradient(circle at 90% 20%, rgba(80, 126, 202, 0.1), transparent 32rem),
      linear-gradient(180deg, var(--bg-deep), var(--bg));
  }

  .site-header { background: rgba(248, 251, 250, 0.82); }
  .hero-facts div, .metric-grid div { background: rgba(255, 255, 255, 0.96); }
  input, textarea, select { background: rgba(255, 255, 255, 0.86); }
  .event-inspector pre { color: #205c52; background: #eef6f4; }
  .orbit-core { color: #052a21; }
  .button.primary { color: #ffffff; }
  .resource-block.active, .step-heading > span { color: #ffffff; }
}
