/* ============================================================
   De novo gene birth — shared stylesheet
   Palette: dataviz reference instance (validated light + dark)
   ============================================================ */

:root {
  color-scheme: light dark;

  --plane:   #f9f9f7;
  --surface: #fcfcfb;
  --sunken:  #f2f1ed;
  --ink:     #0b0b0b;
  --ink2:    #52514e;
  --muted:   #898781;
  --grid:    #e1e0d9;
  --rule:    #c3c2b7;
  --border:  rgba(11, 11, 11, 0.10);

  --s1: #2a78d6;   /* blue    — HAP1 / DNA / "old" */
  --s2: #eb6834;   /* orange  — HAP2 / RNA / "new" */
  --s3: #1baf7a;   /* aqua    — protein / accepted */
  --s4: #4a3aa7;   /* violet  — accent */

  --good:     #0ca30c;
  --warning:  #fab219;
  --serious:  #ec835a;
  --critical: #d03b3b;

  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  --maxw: 62rem;
  --r: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    --plane:   #0d0d0d;
    --surface: #1a1a19;
    --sunken:  #232322;
    --ink:     #ffffff;
    --ink2:    #c3c2b7;
    --muted:   #898781;
    --grid:    #2c2c2a;
    --rule:    #383835;
    --border:  rgba(255, 255, 255, 0.10);
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s4: #9085e9;
  }
}
:root[data-theme="dark"] {
  --plane:   #0d0d0d;
  --surface: #1a1a19;
  --sunken:  #232322;
  --ink:     #ffffff;
  --ink2:    #c3c2b7;
  --muted:   #898781;
  --grid:    #2c2c2a;
  --rule:    #383835;
  --border:  rgba(255, 255, 255, 0.10);
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --s4: #9085e9;
}

* { box-sizing: border-box; }

/* The hidden attribute must beat any author display rule. Without this,
   `.g-overlay { display: grid }` kept the end-of-run panel painted over the
   game from page load and swallowed every click, Start included. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.62;
  color: var(--ink);
  background: var(--plane);
  -webkit-font-smoothing: antialiased;
}

/* ---------- nav ---------- */

.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--plane) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-in {
  max-width: var(--maxw); margin: 0 auto;
  padding: 0.6rem 1.25rem;
  display: flex; align-items: center; gap: 1.1rem;
}
.brand {
  font-weight: 650; letter-spacing: -0.015em;
  color: var(--ink); text-decoration: none;
  margin-right: auto; font-size: 0.95rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--s1);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--s2) 22%, transparent);
}
.nav a.nl {
  color: var(--ink2); text-decoration: none;
  font-size: 0.87rem; padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}
.nav a.nl:hover { color: var(--ink); }
.nav a.nl[aria-current="page"] { color: var(--ink); border-bottom-color: var(--s2); }

.theme-btn {
  border: 1px solid var(--border); background: var(--surface);
  color: var(--ink2); border-radius: 7px; cursor: pointer;
  width: 30px; height: 30px; display: grid; place-items: center;
  font-size: 0.9rem; line-height: 1; padding: 0;
}
.theme-btn:hover { color: var(--ink); }

/* ---------- layout ---------- */

main { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem 6rem; }

section { padding-top: 3.2rem; }

h1 {
  font-size: clamp(2rem, 5.2vw, 3rem);
  line-height: 1.1; letter-spacing: -0.03em;
  margin: 0 0 0.6rem; font-weight: 680;
}
h2 {
  font-size: clamp(1.3rem, 3vw, 1.65rem);
  letter-spacing: -0.02em; margin: 0 0 0.5rem; font-weight: 640;
}
h3 { font-size: 1.03rem; margin: 1.8rem 0 0.4rem; font-weight: 620; letter-spacing: -0.01em; }
h4 { font-size: 0.93rem; margin: 1.2rem 0 0.3rem; font-weight: 620; }
p { margin: 0 0 0.95rem; color: var(--ink2); }
p.lead { font-size: 1.1rem; color: var(--ink2); max-width: 46rem; }
strong { color: var(--ink); font-weight: 620; }
a { color: var(--s1); text-underline-offset: 2px; }

.eyebrow {
  font-size: 0.72rem; font-weight: 660; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 0.5rem;
}

.hero { padding: 3.5rem 0 0.5rem; border-bottom: 1px solid var(--border); padding-bottom: 2.5rem; }

code, .mono { font-family: var(--mono); font-size: 0.86em; }
code:not(pre code) {
  background: var(--sunken); padding: 0.1em 0.35em;
  border-radius: 4px; color: var(--ink);
}
pre {
  background: var(--sunken); border: 1px solid var(--border);
  border-radius: var(--r); padding: 0.9rem 1rem; overflow-x: auto;
  font-size: 0.82rem; line-height: 1.5;
}

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 1.15rem 1.3rem;
}
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: 1rem; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.85rem; }

.note {
  border-left: 3px solid var(--s4); background: var(--surface);
  padding: 0.85rem 1.1rem; border-radius: 0 var(--r) var(--r) 0;
  margin: 1.4rem 0; font-size: 0.94rem;
}
.note.warn { border-left-color: var(--warning); }
.note.crit { border-left-color: var(--critical); }
.note p:last-child { margin-bottom: 0; }
.note .tag {
  display: inline-block; font-size: 0.7rem; font-weight: 680;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 0.25rem;
}

/* ---------- tables ---------- */

.tw { overflow-x: auto; margin: 1.1rem 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
th, td {
  text-align: left; padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--grid); vertical-align: top;
}
th { color: var(--muted); font-weight: 620; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em; }
td { color: var(--ink2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: var(--surface); }

/* ---------- stat tiles ---------- */

.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 0.9rem 1rem;
}
.stat .v {
  font-size: 1.9rem; font-weight: 620; letter-spacing: -0.03em;
  color: var(--ink); line-height: 1.1; display: block;
}
.stat .k { font-size: 0.78rem; color: var(--muted); margin-top: 0.2rem; display: block; }

/* ============================================================
   SCENE PLAYER
   ============================================================ */

.scene {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden; margin: 1.5rem 0 1.8rem;
}
.scene-head {
  padding: 0.75rem 1.1rem 0.55rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: baseline; gap: 0.7rem; flex-wrap: wrap;
}
.scene-head .t { font-weight: 620; font-size: 0.95rem; letter-spacing: -0.01em; }
.scene-head .n { font-size: 0.75rem; color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }

.scene-stage { background: var(--sunken); padding: 0.5rem; }
.scene-svg { display: block; width: 100%; height: auto; }

.scene-caption {
  padding: 0.85rem 1.1rem; min-height: 4.6rem;
  border-top: 1px solid var(--border); font-size: 0.92rem; color: var(--ink2);
}
.scene-caption b { color: var(--ink); font-weight: 620; }
.scene-caption .lbl {
  display: block; font-size: 0.7rem; font-weight: 680; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--s2); margin-bottom: 0.2rem;
}

.scene-ctrl {
  display: flex; align-items: center; gap: 0.45rem;
  padding: 0.55rem 1.1rem 0.75rem;
}
.scene-ctrl button {
  border: 1px solid var(--border); background: var(--surface);
  color: var(--ink2); border-radius: 7px; cursor: pointer;
  height: 30px; min-width: 30px; padding: 0 0.55rem;
  font-size: 0.8rem; font-family: var(--sans); display: grid; place-items: center;
}
.scene-ctrl button:hover:not(:disabled) { color: var(--ink); border-color: var(--rule); }
.scene-ctrl button:disabled { opacity: 0.35; cursor: default; }
.scene-ctrl .dots { display: flex; gap: 5px; margin-left: 0.35rem; }
.scene-ctrl .dots i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--rule);
  cursor: pointer; transition: background 0.2s, transform 0.2s;
}
.scene-ctrl .dots i.on { background: var(--s2); transform: scale(1.35); }

/* scene element reveal */
.scene-svg [data-from] {
  opacity: 0;
  transition: opacity 0.55s ease, transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}
.scene-svg [data-from].on { opacity: 1; }
.scene-svg [data-slide].on  { transform: none; }
.scene-svg [data-slide]     { transform: translateY(14px); }
.scene-svg .pulse.on { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: 0.35 } }

.scene-svg .flow {
  stroke-dasharray: 6 7; animation: flow 1.1s linear infinite;
}
@keyframes flow { to { stroke-dashoffset: -13; } }

.scene-svg .rib { animation: rib 4.5s linear infinite; }
@keyframes rib { from { transform: translateX(0) } to { transform: translateX(232px) } }

.scene-svg text { font-family: var(--sans); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scene-svg [data-from] { transition: none; }
  .scene-svg .pulse.on, .scene-svg .flow, .scene-svg .rib { animation: none; }
}

/* ============================================================
   SCENARIO CARDS (looping micro-animations)
   ============================================================ */

.scn {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden;
  display: flex; flex-direction: column;
}
.scn-top { padding: 0.9rem 1.05rem 0.4rem; }
.scn-top .kind {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; display: inline-block;
  padding: 0.12rem 0.45rem; border-radius: 4px; margin-bottom: 0.4rem;
}
.kind.real { color: var(--s3); background: color-mix(in srgb, var(--s3) 14%, transparent); }
.kind.fake { color: var(--critical); background: color-mix(in srgb, var(--critical) 14%, transparent); }
.scn-top h3 { margin: 0 0 0.25rem; font-size: 1rem; }
.scn-top p { font-size: 0.88rem; margin: 0 0 0.6rem; }
.scn-art { background: var(--sunken); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.scn-art svg { display: block; width: 100%; height: auto; }
.scn-foot { padding: 0.7rem 1.05rem 0.9rem; font-size: 0.82rem; color: var(--muted); margin-top: auto; }
.scn-foot b { color: var(--ink2); font-weight: 620; }

/* looping animation primitives used by scenario art */
@keyframes fadecycle { 0%, 12% { opacity: 0 } 28%, 88% { opacity: 1 } 100% { opacity: 0 } }
@keyframes fadecycle2 { 0%, 42% { opacity: 0 } 58%, 88% { opacity: 1 } 100% { opacity: 0 } }
@keyframes fadecycle3 { 0%, 66% { opacity: 0 } 80%, 90% { opacity: 1 } 100% { opacity: 0 } }
@keyframes sweep { 0% { transform: scaleX(0) } 30%, 100% { transform: scaleX(1) } }
@keyframes drift { 0%, 100% { transform: translateX(0) } 50% { transform: translateX(9px) } }
@keyframes blink { 0%, 45% { opacity: 0.18 } 55%, 100% { opacity: 1 } }

.scn-art .a1 { animation: fadecycle 6s ease-in-out infinite; }
.scn-art .a2 { animation: fadecycle2 6s ease-in-out infinite; }
.scn-art .a3 { animation: fadecycle3 6s ease-in-out infinite; }
.scn-art .sweep { animation: sweep 6s ease-in-out infinite; transform-origin: left center; }
.scn-art .drift { animation: drift 3.4s ease-in-out infinite; }
.scn-art .blink { animation: blink 2.2s ease-in-out infinite alternate; }
.scn-art text { font-family: var(--sans); }

@media (prefers-reduced-motion: reduce) {
  .scn-art .a1, .scn-art .a2, .scn-art .a3,
  .scn-art .sweep, .scn-art .drift, .scn-art .blink { animation: none; opacity: 1; transform: none; }
}

/* ============================================================
   CHARTS
   ============================================================ */

.chart {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 1.1rem 1.2rem 0.9rem; margin: 1.4rem 0;
}
.chart h3 { margin: 0 0 0.1rem; font-size: 0.98rem; }
.chart .sub { font-size: 0.83rem; color: var(--muted); margin: 0 0 0.85rem; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart svg text { font-family: var(--sans); }

.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.82rem; color: var(--ink2); margin-bottom: 0.7rem; }
.legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

.chart-foot { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.6rem; }
.chart-foot button {
  border: 1px solid var(--border); background: var(--surface); color: var(--ink2);
  border-radius: 7px; cursor: pointer; height: 27px; padding: 0 0.6rem;
  font-size: 0.76rem; font-family: var(--sans);
}
.chart-foot button:hover { color: var(--ink); }

.tip {
  position: fixed; pointer-events: none; z-index: 90; opacity: 0;
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: 7px; padding: 0.45rem 0.6rem; font-size: 0.8rem;
  color: var(--ink); box-shadow: 0 6px 22px rgba(0,0,0,0.16);
  transition: opacity 0.12s; max-width: 16rem;
}
.tip.on { opacity: 1; }
.tip .r { display: flex; align-items: center; gap: 0.45rem; justify-content: space-between; }
.tip .r i { width: 9px; height: 9px; border-radius: 2px; }
.tip .r b { font-variant-numeric: tabular-nums; margin-left: 0.6rem; }
.tip .h { font-weight: 620; margin-bottom: 0.25rem; }

/* ---------- misc ---------- */

.steps { counter-reset: st; list-style: none; padding: 0; margin: 1.2rem 0; }
.steps li {
  counter-increment: st; position: relative; padding: 0 0 1rem 2.6rem;
  border-left: 1px solid var(--grid); margin-left: 0.85rem;
  color: var(--ink2); font-size: 0.94rem;
}
.steps li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps li::before {
  content: counter(st); position: absolute; left: -0.85rem; top: -0.1rem;
  width: 1.7rem; height: 1.7rem; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--rule);
  display: grid; place-items: center; font-size: 0.76rem;
  font-weight: 660; color: var(--ink2);
}
.steps li b { display: block; color: var(--ink); }

.pagenav {
  display: flex; gap: 1rem; margin-top: 3.5rem; padding-top: 1.5rem;
  border-top: 1px solid var(--border); flex-wrap: wrap;
}
.pagenav a {
  flex: 1 1 14rem; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 0.85rem 1rem;
}
.pagenav a:hover { border-color: var(--rule); }
.pagenav a span { display: block; font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

footer.site {
  border-top: 1px solid var(--border); margin-top: 3rem;
  padding: 1.6rem 1.25rem 3rem; color: var(--muted); font-size: 0.82rem;
}
footer.site .in { max-width: var(--maxw); margin: 0 auto; }

/* ============================================================
   GAME — shared panel / button chrome
   ============================================================ */

.g-overlay { display: grid }` kept the end-of-run panel painted over the
   game from page load and swallowed every click, Start included. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.62;
  color: var(--ink);
  background: var(--plane);
  -webkit-font-smoothing: antialiased;
}

/* ---------- nav ---------- */

.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--plane) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-in {
  max-width: var(--maxw); margin: 0 auto;
  padding: 0.6rem 1.25rem;
  display: flex; align-items: center; gap: 1.1rem;
}
.brand {
  font-weight: 650; letter-spacing: -0.015em;
  color: var(--ink); text-decoration: none;
  margin-right: auto; font-size: 0.95rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--s1);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--s2) 22%, transparent);
}
.nav a.nl {
  color: var(--ink2); text-decoration: none;
  font-size: 0.87rem; padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}
.nav a.nl:hover { color: var(--ink); }
.nav a.nl[aria-current="page"] { color: var(--ink); border-bottom-color: var(--s2); }

.theme-btn {
  border: 1px solid var(--border); background: var(--surface);
  color: var(--ink2); border-radius: 7px; cursor: pointer;
  width: 30px; height: 30px; display: grid; place-items: center;
  font-size: 0.9rem; line-height: 1; padding: 0;
}
.theme-btn:hover { color: var(--ink); }

/* ---------- layout ---------- */

main { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem 6rem; }

section { padding-top: 3.2rem; }

h1 {
  font-size: clamp(2rem, 5.2vw, 3rem);
  line-height: 1.1; letter-spacing: -0.03em;
  margin: 0 0 0.6rem; font-weight: 680;
}
h2 {
  font-size: clamp(1.3rem, 3vw, 1.65rem);
  letter-spacing: -0.02em; margin: 0 0 0.5rem; font-weight: 640;
}
h3 { font-size: 1.03rem; margin: 1.8rem 0 0.4rem; font-weight: 620; letter-spacing: -0.01em; }
h4 { font-size: 0.93rem; margin: 1.2rem 0 0.3rem; font-weight: 620; }
p { margin: 0 0 0.95rem; color: var(--ink2); }
p.lead { font-size: 1.1rem; color: var(--ink2); max-width: 46rem; }
strong { color: var(--ink); font-weight: 620; }
a { color: var(--s1); text-underline-offset: 2px; }

.eyebrow {
  font-size: 0.72rem; font-weight: 660; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 0.5rem;
}

.hero { padding: 3.5rem 0 0.5rem; border-bottom: 1px solid var(--border); padding-bottom: 2.5rem; }

code, .mono { font-family: var(--mono); font-size: 0.86em; }
code:not(pre code) {
  background: var(--sunken); padding: 0.1em 0.35em;
  border-radius: 4px; color: var(--ink);
}
pre {
  background: var(--sunken); border: 1px solid var(--border);
  border-radius: var(--r); padding: 0.9rem 1rem; overflow-x: auto;
  font-size: 0.82rem; line-height: 1.5;
}

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 1.15rem 1.3rem;
}
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: 1rem; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.85rem; }

.note {
  border-left: 3px solid var(--s4); background: var(--surface);
  padding: 0.85rem 1.1rem; border-radius: 0 var(--r) var(--r) 0;
  margin: 1.4rem 0; font-size: 0.94rem;
}
.note.warn { border-left-color: var(--warning); }
.note.crit { border-left-color: var(--critical); }
.note p:last-child { margin-bottom: 0; }
.note .tag {
  display: inline-block; font-size: 0.7rem; font-weight: 680;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 0.25rem;
}

/* ---------- tables ---------- */

.tw { overflow-x: auto; margin: 1.1rem 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
th, td {
  text-align: left; padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--grid); vertical-align: top;
}
th { color: var(--muted); font-weight: 620; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em; }
td { color: var(--ink2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: var(--surface); }

/* ---------- stat tiles ---------- */

.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 0.9rem 1rem;
}
.stat .v {
  font-size: 1.9rem; font-weight: 620; letter-spacing: -0.03em;
  color: var(--ink); line-height: 1.1; display: block;
}
.stat .k { font-size: 0.78rem; color: var(--muted); margin-top: 0.2rem; display: block; }

/* ============================================================
   SCENE PLAYER
   ============================================================ */

.scene {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden; margin: 1.5rem 0 1.8rem;
}
.scene-head {
  padding: 0.75rem 1.1rem 0.55rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: baseline; gap: 0.7rem; flex-wrap: wrap;
}
.scene-head .t { font-weight: 620; font-size: 0.95rem; letter-spacing: -0.01em; }
.scene-head .n { font-size: 0.75rem; color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }

.scene-stage { background: var(--sunken); padding: 0.5rem; }
.scene-svg { display: block; width: 100%; height: auto; }

.scene-caption {
  padding: 0.85rem 1.1rem; min-height: 4.6rem;
  border-top: 1px solid var(--border); font-size: 0.92rem; color: var(--ink2);
}
.scene-caption b { color: var(--ink); font-weight: 620; }
.scene-caption .lbl {
  display: block; font-size: 0.7rem; font-weight: 680; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--s2); margin-bottom: 0.2rem;
}

.scene-ctrl {
  display: flex; align-items: center; gap: 0.45rem;
  padding: 0.55rem 1.1rem 0.75rem;
}
.scene-ctrl button {
  border: 1px solid var(--border); background: var(--surface);
  color: var(--ink2); border-radius: 7px; cursor: pointer;
  height: 30px; min-width: 30px; padding: 0 0.55rem;
  font-size: 0.8rem; font-family: var(--sans); display: grid; place-items: center;
}
.scene-ctrl button:hover:not(:disabled) { color: var(--ink); border-color: var(--rule); }
.scene-ctrl button:disabled { opacity: 0.35; cursor: default; }
.scene-ctrl .dots { display: flex; gap: 5px; margin-left: 0.35rem; }
.scene-ctrl .dots i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--rule);
  cursor: pointer; transition: background 0.2s, transform 0.2s;
}
.scene-ctrl .dots i.on { background: var(--s2); transform: scale(1.35); }

/* scene element reveal */
.scene-svg [data-from] {
  opacity: 0;
  transition: opacity 0.55s ease, transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}
.scene-svg [data-from].on { opacity: 1; }
.scene-svg [data-slide].on  { transform: none; }
.scene-svg [data-slide]     { transform: translateY(14px); }
.scene-svg .pulse.on { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: 0.35 } }

.scene-svg .flow {
  stroke-dasharray: 6 7; animation: flow 1.1s linear infinite;
}
@keyframes flow { to { stroke-dashoffset: -13; } }

.scene-svg .rib { animation: rib 4.5s linear infinite; }
@keyframes rib { from { transform: translateX(0) } to { transform: translateX(232px) } }

.scene-svg text { font-family: var(--sans); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scene-svg [data-from] { transition: none; }
  .scene-svg .pulse.on, .scene-svg .flow, .scene-svg .rib { animation: none; }
}

/* ============================================================
   SCENARIO CARDS (looping micro-animations)
   ============================================================ */

.scn {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden;
  display: flex; flex-direction: column;
}
.scn-top { padding: 0.9rem 1.05rem 0.4rem; }
.scn-top .kind {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; display: inline-block;
  padding: 0.12rem 0.45rem; border-radius: 4px; margin-bottom: 0.4rem;
}
.kind.real { color: var(--s3); background: color-mix(in srgb, var(--s3) 14%, transparent); }
.kind.fake { color: var(--critical); background: color-mix(in srgb, var(--critical) 14%, transparent); }
.scn-top h3 { margin: 0 0 0.25rem; font-size: 1rem; }
.scn-top p { font-size: 0.88rem; margin: 0 0 0.6rem; }
.scn-art { background: var(--sunken); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.scn-art svg { display: block; width: 100%; height: auto; }
.scn-foot { padding: 0.7rem 1.05rem 0.9rem; font-size: 0.82rem; color: var(--muted); margin-top: auto; }
.scn-foot b { color: var(--ink2); font-weight: 620; }

/* looping animation primitives used by scenario art */
@keyframes fadecycle { 0%, 12% { opacity: 0 } 28%, 88% { opacity: 1 } 100% { opacity: 0 } }
@keyframes fadecycle2 { 0%, 42% { opacity: 0 } 58%, 88% { opacity: 1 } 100% { opacity: 0 } }
@keyframes fadecycle3 { 0%, 66% { opacity: 0 } 80%, 90% { opacity: 1 } 100% { opacity: 0 } }
@keyframes sweep { 0% { transform: scaleX(0) } 30%, 100% { transform: scaleX(1) } }
@keyframes drift { 0%, 100% { transform: translateX(0) } 50% { transform: translateX(9px) } }
@keyframes blink { 0%, 45% { opacity: 0.18 } 55%, 100% { opacity: 1 } }

.scn-art .a1 { animation: fadecycle 6s ease-in-out infinite; }
.scn-art .a2 { animation: fadecycle2 6s ease-in-out infinite; }
.scn-art .a3 { animation: fadecycle3 6s ease-in-out infinite; }
.scn-art .sweep { animation: sweep 6s ease-in-out infinite; transform-origin: left center; }
.scn-art .drift { animation: drift 3.4s ease-in-out infinite; }
.scn-art .blink { animation: blink 2.2s ease-in-out infinite alternate; }
.scn-art text { font-family: var(--sans); }

@media (prefers-reduced-motion: reduce) {
  .scn-art .a1, .scn-art .a2, .scn-art .a3,
  .scn-art .sweep, .scn-art .drift, .scn-art .blink { animation: none; opacity: 1; transform: none; }
}

/* ============================================================
   CHARTS
   ============================================================ */

.chart {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 1.1rem 1.2rem 0.9rem; margin: 1.4rem 0;
}
.chart h3 { margin: 0 0 0.1rem; font-size: 0.98rem; }
.chart .sub { font-size: 0.83rem; color: var(--muted); margin: 0 0 0.85rem; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart svg text { font-family: var(--sans); }

.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.82rem; color: var(--ink2); margin-bottom: 0.7rem; }
.legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

.chart-foot { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.6rem; }
.chart-foot button {
  border: 1px solid var(--border); background: var(--surface); color: var(--ink2);
  border-radius: 7px; cursor: pointer; height: 27px; padding: 0 0.6rem;
  font-size: 0.76rem; font-family: var(--sans);
}
.chart-foot button:hover { color: var(--ink); }

.tip {
  position: fixed; pointer-events: none; z-index: 90; opacity: 0;
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: 7px; padding: 0.45rem 0.6rem; font-size: 0.8rem;
  color: var(--ink); box-shadow: 0 6px 22px rgba(0,0,0,0.16);
  transition: opacity 0.12s; max-width: 16rem;
}
.tip.on { opacity: 1; }
.tip .r { display: flex; align-items: center; gap: 0.45rem; justify-content: space-between; }
.tip .r i { width: 9px; height: 9px; border-radius: 2px; }
.tip .r b { font-variant-numeric: tabular-nums; margin-left: 0.6rem; }
.tip .h { font-weight: 620; margin-bottom: 0.25rem; }

/* ---------- misc ---------- */

.steps { counter-reset: st; list-style: none; padding: 0; margin: 1.2rem 0; }
.steps li {
  counter-increment: st; position: relative; padding: 0 0 1rem 2.6rem;
  border-left: 1px solid var(--grid); margin-left: 0.85rem;
  color: var(--ink2); font-size: 0.94rem;
}
.steps li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps li::before {
  content: counter(st); position: absolute; left: -0.85rem; top: -0.1rem;
  width: 1.7rem; height: 1.7rem; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--rule);
  display: grid; place-items: center; font-size: 0.76rem;
  font-weight: 660; color: var(--ink2);
}
.steps li b { display: block; color: var(--ink); }

.pagenav {
  display: flex; gap: 1rem; margin-top: 3.5rem; padding-top: 1.5rem;
  border-top: 1px solid var(--border); flex-wrap: wrap;
}
.pagenav a {
  flex: 1 1 14rem; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 0.85rem 1rem;
}
.pagenav a:hover { border-color: var(--rule); }
.pagenav a span { display: block; font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

footer.site {
  border-top: 1px solid var(--border); margin-top: 3rem;
  padding: 1.6rem 1.25rem 3rem; color: var(--muted); font-size: 0.82rem;
}
footer.site .in { max-width: var(--maxw); margin: 0 auto; }

/* ============================================================
   GAME — shared panel / button chrome
   ============================================================ */

.game-wrap { position: relative; margin: 1.4rem 0 1.2rem; }

.game {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden;
}

.g-hud {
  display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 1rem;
  align-items: end; padding: 0.9rem 1.1rem 0.7rem; border-bottom: 1px solid var(--border);
}
.g-score { line-height: 1.05; }
.g-score .v {
  font-size: 2.6rem; font-weight: 660; letter-spacing: -0.035em; color: var(--ink);
  display: block; font-variant-numeric: tabular-nums;
}
.g-score .u { font-size: 0.78rem; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.g-rung { text-align: right; }
.g-rung .r { font-size: 1rem; font-weight: 640; color: var(--s3); display: inline-block; }
.g-rung .n { font-size: 0.78rem; color: var(--muted); display: block; }

.g-meters { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; padding: 0.75rem 1.1rem; }
.g-meter .lab {
  display: flex; align-items: baseline; gap: 0.4rem;
  font-size: 0.78rem; color: var(--ink2); margin-bottom: 0.28rem;
}
.g-meter .lab .k { font-weight: 640; color: var(--ink); }
.g-meter .lab .keys { color: var(--muted); font-family: var(--mono); font-size: 0.72rem; }
.g-meter .lab .v { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 620; }
.g-track { height: 10px; border-radius: 5px; background: var(--sunken); overflow: hidden; position: relative; }
.g-track > i { display: block; height: 100%; border-radius: 5px; transition: width 0.09s linear; }
.g-track .flash {
  position: absolute; top: 0; bottom: 0; left: 0; width: 0;
  border-radius: 5px; opacity: 0;
  background: var(--critical); transition: opacity 0.2s;
}
.g-meter.tx .g-track > i { background: var(--s2); }
.g-meter.orf .g-track > i { background: var(--s3); }
.g-meter .why { font-size: 0.72rem; color: var(--muted); margin-top: 0.25rem; }

.g-body { display: grid; grid-template-columns: minmax(0,1fr) 190px; gap: 0; }
.g-stagewrap { background: var(--sunken); border-top: 1px solid var(--border); padding: 0.4rem; }
#gstage { display: block; width: 100%; height: auto; }
#gstage text { font-family: var(--sans); }

.g-ladder {
  border-left: 1px solid var(--border); border-top: 1px solid var(--border);
  padding: 0.5rem 0.6rem; font-size: 0.74rem;
}
.g-ladder .lr {
  display: flex; align-items: center; gap: 0.4rem; padding: 0.16rem 0.25rem;
  border-radius: 4px; color: var(--muted);
}
.g-ladder .lr b {
  width: 7px; height: 7px; border-radius: 50%; background: var(--rule); flex: none;
}
.g-ladder .lr em { margin-left: auto; font-style: normal; font-variant-numeric: tabular-nums; opacity: 0.75; }
.g-ladder .lr.done { color: var(--ink2); }
.g-ladder .lr.done b { background: var(--s3); }
.g-ladder .lr.now { color: var(--ink); background: var(--sunken); font-weight: 620; }
.g-ladder .lr.now b { background: var(--s2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--s2) 25%, transparent); }

.g-sel { padding: 0.5rem 1.1rem 0; }
.g-sel .lab { font-size: 0.76rem; color: var(--critical); font-weight: 640; margin-bottom: 0.22rem; }
.g-sel .bar { height: 7px; background: var(--sunken); border-radius: 4px; overflow: hidden; }
.g-sel .bar > i { display: block; height: 100%; background: var(--critical); }

.g-keys {
  display: flex; gap: 0.55rem; padding: 0.85rem 1.1rem;
  align-items: center; flex-wrap: wrap;
}
.g-keys .pair { display: flex; gap: 0.4rem; align-items: center; }
.g-keys .pair .cap { font-size: 0.72rem; color: var(--muted); margin-right: 0.2rem; }
.gkey {
  width: 52px; height: 46px; border-radius: 9px; cursor: pointer;
  border: 2px solid var(--rule); background: var(--surface); color: var(--ink2);
  font-family: var(--sans); font-size: 1.1rem; font-weight: 660;
  display: grid; place-items: center; position: relative;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
  transition: transform 0.07s, background 0.12s, border-color 0.12s, color 0.12s;
}
.gkey.next {
  border-color: var(--s2); background: var(--s2); color: var(--surface);
}
.gkey.next::after {
  content: '▸'; position: absolute; left: -0.72rem; color: var(--s2); font-size: 0.8rem;
}
.gkey.hit { transform: translateY(2px) scale(0.96); }
.gkey.off { opacity: 0.3; cursor: default; }
.g-keys .hint { font-size: 0.8rem; color: var(--muted); margin-left: auto; max-width: 22rem; text-align: right; }

.g-overlay {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: color-mix(in srgb, var(--plane) 82%, transparent);
  backdrop-filter: blur(3px); border-radius: var(--r); z-index: 5; padding: 1rem;
}
.g-panel {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r);
  padding: 1.3rem 1.5rem; max-width: 30rem; box-shadow: 0 18px 50px rgba(0,0,0,0.22);
}
.g-panel h3 { margin: 0 0 0.4rem; font-size: 1.25rem; }
.g-panel p { font-size: 0.9rem; margin-bottom: 0.7rem; }
.g-panel p.big { font-size: 1rem; color: var(--ink2); }
.g-panel p.big b { font-size: 1.5rem; }
.g-panel p.mut { font-size: 0.78rem; color: var(--muted); }
.g-panel p.scn-tag {
  background: var(--sunken); border-radius: 7px; padding: 0.6rem 0.75rem; font-size: 0.88rem;
}
.g-btns { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.9rem; }
.g-btn {
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink);
  border-radius: 8px; padding: 0.45rem 0.9rem; cursor: pointer;
  font-family: var(--sans); font-size: 0.86rem; font-weight: 600;
}
.g-btn:hover { border-color: var(--s2); }
.g-btn.primary { background: var(--s2); border-color: var(--s2); color: #fff; }
.g-btn small { display: block; font-weight: 400; font-size: 0.72rem; opacity: 0.8; }

kbd {
  font-family: var(--mono); font-size: 0.8em; background: var(--sunken);
  border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 4px; padding: 0.05em 0.35em; color: var(--ink);
}



/* ============================================================
   FORKING PATHS
   ============================================================ */

.fwrap { margin: 1.5rem 0 1.2rem; }
.fgame {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden;
}

/* study card */
.fcard { padding: 0.85rem 1.1rem; border-bottom: 1px solid var(--border); background: var(--sunken); }
.fc-row { display: flex; gap: 0.8rem; font-size: 0.82rem; padding: 0.12rem 0; }
.fc-row span { color: var(--muted); width: 5.2rem; flex: none; }
.fc-row b { color: var(--ink2); font-weight: 550; }

/* meters */
.fmeters {
  display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center;
  padding: 0.7rem 1.1rem; border-bottom: 1px solid var(--border);
}
.fm-lab { font-size: 0.76rem; color: var(--muted); display: flex; gap: 0.5rem; align-items: baseline; }
.fm-lab .v { color: var(--ink); font-weight: 640; font-variant-numeric: tabular-nums; }
.fm-track { height: 8px; border-radius: 4px; background: var(--sunken); overflow: hidden; margin-top: 0.25rem; }
.fm-track > i { display: block; height: 100%; background: var(--s3); border-radius: 4px; transition: width 0.3s; }
.fm-fp { text-align: right; }
.fm-fp .v { font-size: 1.5rem; font-weight: 640; display: block; line-height: 1.1; font-variant-numeric: tabular-nums; }
.fm-fp .v.good { color: var(--good); }
.fm-fp .v.warn { color: var(--warning); }
.fm-fp .v.bad  { color: var(--critical); }
.fm-fp .k { font-size: 0.72rem; color: var(--muted); }

/* question + options */
.fbody { padding: 1.1rem 1.2rem 1.3rem; }
.fstep { font-size: 0.72rem; font-weight: 680; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
#fq { font-size: 1.2rem; font-weight: 640; letter-spacing: -0.02em; margin: 0.2rem 0 0.15rem; }
#fwhy { font-size: 0.88rem; color: var(--ink2); margin: 0 0 1rem; }

.fopts { display: grid; gap: 0.55rem; }
.fopt {
  display: flex; gap: 0.75rem; align-items: flex-start; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 9px;
  padding: 0.7rem 0.9rem; cursor: pointer; font-family: var(--sans); color: var(--ink);
  transition: border-color 0.14s, background 0.14s, opacity 0.14s;
}
.fopt:hover:not(:disabled) { border-color: var(--s1); background: var(--sunken); }
.fopt:disabled { cursor: default; opacity: 0.42; }
.fopt.picked { opacity: 1; border-color: var(--s1); border-width: 2px; background: var(--sunken); }
.fopt .k {
  width: 20px; height: 20px; border-radius: 5px; flex: none; margin-top: 1px;
  background: var(--sunken); border: 1px solid var(--border);
  display: grid; place-items: center; font-size: 0.72rem; color: var(--muted); font-weight: 640;
}
.fopt.picked .k { background: var(--s1); border-color: var(--s1); color: #fff; }
.fopt .t b { display: block; font-size: 0.92rem; font-weight: 620; margin-bottom: 0.1rem; }
.fopt .t em { display: block; font-style: normal; font-size: 0.82rem; color: var(--ink2); }

/* feedback */
.ffeedback { margin-top: 0.9rem; padding: 0.85rem 1rem; border-radius: 9px; border-left: 3px solid var(--muted); background: var(--sunken); }
.ffeedback.ok   { border-left-color: var(--good); }
.ffeedback.warn { border-left-color: var(--warning); }
.ffeedback.bad  { border-left-color: var(--critical); }
.ffeedback.haz  { border-left-width: 5px; }
.ffeedback p { font-size: 0.9rem; margin: 0 0 0.6rem; color: var(--ink2); }
.ffeedback p.lk { font-size: 0.82rem; margin-bottom: 0.7rem; }
.ffeedback .tag {
  display: inline-block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--critical); margin-bottom: 0.35rem;
}

/* result */
.fres { display: flex; align-items: baseline; gap: 0.7rem; margin-bottom: 0.5rem; }
.fres .n { font-size: 3.4rem; font-weight: 660; letter-spacing: -0.04em; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.fres .u { font-size: 0.82rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; }
.fver { font-size: 0.98rem; color: var(--ink2); margin-bottom: 0.7rem; }
.fver b { color: var(--ink); }
.fcomp { display: flex; gap: 1.4rem; flex-wrap: wrap; font-size: 0.86rem; color: var(--ink2); margin-bottom: 1.1rem; }
.fcomp b { color: var(--ink); font-size: 1.05rem; }
.frecap { width: 100%; font-size: 0.82rem; border-collapse: collapse; margin-bottom: 0.9rem; }
.frecap th, .frecap td { text-align: left; padding: 0.4rem 0.55rem; border-bottom: 1px solid var(--grid); }
.frecap th { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 620; }
.frecap td { color: var(--ink2); }
.frecap .num { text-align: right; font-variant-numeric: tabular-nums; }
.frecap tr.haz td { background: color-mix(in srgb, var(--critical) 10%, transparent); color: var(--ink); }
.fstudies { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0.7rem; margin-top: 0.9rem; }
.fstudy {
  text-align: left; background: var(--surface); border: 1px solid var(--rule);
  border-radius: 9px; padding: 0.8rem 0.95rem; cursor: pointer; font-family: var(--sans); color: var(--ink);
}
.fstudy:hover { border-color: var(--s1); }
.fstudy b { display: block; font-size: 0.92rem; margin-bottom: 0.2rem; }
.fstudy span { display: block; font-size: 0.8rem; color: var(--ink2); }

/* ============================================================
   ARCADE — hub, shell, and the six games
   ============================================================ */

/* ---- kind badge (text is the channel; colour reinforces) ---- */
.gm-kind {
  display: inline-block; font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase;
  padding: 0.14rem 0.48rem; border-radius: 4px; margin-bottom: 0.45rem;
}
.gm-kind.arcade   { color: var(--s2); background: color-mix(in srgb, var(--s2) 15%, transparent); }
.gm-kind.decision { color: var(--s1); background: color-mix(in srgb, var(--s1) 15%, transparent); }
.gm-kind.puzzle   { color: var(--s4); background: color-mix(in srgb, var(--s4) 17%, transparent); }

/* ---- hub ---- */
.hub-sec { padding-top: 2.4rem; }
.hub-sec h2 { margin-bottom: 0.8rem; }
.hub-note { color: var(--muted); font-weight: 400; font-size: 0.9rem; letter-spacing: 0; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: 0.9rem; }
.hub-card {
  display: block; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 1rem 1.15rem 1.1rem;
  transition: border-color 0.14s, transform 0.14s;
}
.hub-card:hover { border-color: var(--s1); transform: translateY(-2px); }
.hub-card h3 { margin: 0 0 0.35rem; font-size: 1.08rem; }
.hub-card p { font-size: 0.87rem; margin-bottom: 0.7rem; }
.hub-meta { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 0.15rem; }
.hub-meta b { color: var(--ink2); font-weight: 620; margin-right: 0.35rem; }

/* ---- game shell ---- */
.gm { margin-top: 0.5rem; }
.gm-head { padding-bottom: 0.4rem; }
.gm-head h1 { margin: 0 0 0.5rem; }
.gm-controls {
  font-size: 0.85rem; color: var(--muted);
  border-top: 1px solid var(--border); padding-top: 0.7rem; margin-top: 0.9rem;
}
.gm-stage {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden; margin: 1.1rem 0;
}
.gm-result {
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--r); padding: 1.2rem 1.35rem;
}
.gm-result .mut { font-size: 0.85rem; color: var(--muted); }
.gm-result a.g-btn { text-decoration: none; display: inline-flex; align-items: center; }

/* ---- 2 · merge gate ---- */
.mg-hud {
  display: flex; gap: 1.6rem; flex-wrap: wrap;
  padding: 0.85rem 1.1rem; border-bottom: 1px solid var(--border); background: var(--sunken);
}
.mg-hud .k { display: block; font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; }
.mg-hud b { font-size: 1.05rem; font-weight: 640; font-variant-numeric: tabular-nums; }
.mg-hud .mg-score { margin-left: auto; text-align: right; }
.mg-hud .mg-score b { color: var(--s3); font-size: 1.35rem; }
.mg-svg { display: block; width: 100%; height: auto; padding: 0.6rem 0; }
.mg-svg text { font-family: var(--sans); }
.mg-foot { display: flex; align-items: center; gap: 0.8rem; padding: 0.4rem 1.1rem 1rem; flex-wrap: wrap; }
.mg-hint { font-size: 0.82rem; color: var(--muted); }

/* ---- 3 · chimera hunter ---- */
.ch-parents { padding: 0.85rem 1.1rem; border-bottom: 1px solid var(--border); background: var(--sunken); }
.ch-parents > div { display: flex; align-items: center; gap: 0.7rem; padding: 0.15rem 0; }
.ch-parents .k { font-size: 0.74rem; color: var(--muted); width: 4.6rem; flex: none; }
.ch-seq { display: inline-flex; gap: 2px; }
.ch-seq i {
  width: 18px; height: 20px; border-radius: 3px; display: grid; place-items: center;
  font-style: normal; font-family: var(--mono); font-size: 0.68rem; font-weight: 700; color: #fff;
}
.ch-seq.big i { width: 34px; height: 40px; font-size: 1rem; border-radius: 5px; }
.ch-seq .b0 { background: var(--s1); }
.ch-seq .b1 { background: var(--s2); }
.ch-seq .b2 { background: var(--s3); }
.ch-seq .b3 { background: var(--s4); }
.ch-hud { display: flex; gap: 1.6rem; padding: 0.7rem 1.1rem 0.4rem; }
.ch-hud .k { display: block; font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; }
.ch-hud b { font-size: 1.05rem; font-weight: 640; font-variant-numeric: tabular-nums; }
.ch-hud b.bad { color: var(--critical); }
.ch-timer { height: 5px; background: var(--sunken); margin: 0 1.1rem; border-radius: 3px; overflow: hidden; }
.ch-timer > i { display: block; height: 100%; width: 100%; background: var(--s2); }
.ch-stage { display: grid; place-items: center; min-height: 84px; padding: 1.1rem; }
.ch-msg { min-height: 2.6rem; padding: 0 1.1rem; font-size: 0.9rem; color: var(--ink2); text-align: center; }
.ch-msg.ok  { color: var(--good); font-weight: 620; }
.ch-msg.bad { color: var(--critical); font-weight: 620; }
.ch-btns { display: flex; gap: 0.55rem; padding: 0.4rem 1.1rem 1.1rem; justify-content: center; flex-wrap: wrap; }

/* ---- 4 · peer review ---- */
.pr-hud { display: flex; gap: 1.6rem; padding: 0.8rem 1.1rem; border-bottom: 1px solid var(--border); background: var(--sunken); }
.pr-hud .k { display: block; font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; }
.pr-hud b { font-size: 1.05rem; font-weight: 640; font-variant-numeric: tabular-nums; }
.pr-body { padding: 1.1rem 1.2rem 1.3rem; }
.pr-claim {
  margin: 0 0 0.9rem; padding: 0.75rem 1rem; border-left: 3px solid var(--s1);
  background: var(--sunken); border-radius: 0 8px 8px 0;
  font-size: 1.02rem; color: var(--ink); font-style: italic;
}
.pr-methods { margin-bottom: 1rem; }
.pr-methods .k { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.pr-methods p { font-size: 0.9rem; margin: 0.2rem 0 0; }
.fopt.answer { border-color: var(--good); opacity: 1; }
.fopt.answer .k { background: var(--good); border-color: var(--good); color: #fff; }

/* ---- 5 · pipeline order ---- */
.po { padding: 1rem 1.1rem 1.2rem; }
.po-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.po-item {
  display: flex; align-items: center; gap: 0.7rem;
  background: var(--sunken); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.5rem 0.6rem 0.5rem 0.75rem;
}
.po-item .n {
  width: 22px; height: 22px; border-radius: 5px; flex: none; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 0.74rem; font-weight: 640; color: var(--muted); font-variant-numeric: tabular-nums;
}
.po-item .t { flex: 1; font-size: 0.9rem; }
.po-item .t em { display: block; font-style: normal; font-size: 0.8rem; color: var(--muted); margin-top: 0.15rem; }
.po-item .mv { display: flex; gap: 3px; flex: none; }
.po-item .mv button {
  width: 26px; height: 26px; border-radius: 5px; cursor: pointer;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink2); font-size: 0.7rem;
}
.po-item .mv button:hover:not(:disabled) { border-color: var(--s1); color: var(--ink); }
.po-item .mv button:disabled { opacity: 0.3; cursor: default; }
.po-item .mk { flex: none; font-weight: 700; font-size: 0.95rem; width: 1.2rem; text-align: center; }
.po-item.ok { border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.po-item.ok .mk { color: var(--good); }
.po-item.no { border-color: color-mix(in srgb, var(--critical) 45%, transparent); }
.po-item.no .mk { color: var(--critical); }
.po-foot { display: flex; align-items: center; gap: 0.8rem; margin-top: 0.9rem; flex-wrap: wrap; }

/* ---- 6 · metric match ---- */
.mm { padding: 0 0 1.1rem; }
.mm-hud { display: flex; gap: 1.6rem; padding: 0.8rem 1.1rem; border-bottom: 1px solid var(--border); background: var(--sunken); }
.mm-hud .k { display: block; font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; }
.mm-hud b { font-size: 1.05rem; font-weight: 640; font-variant-numeric: tabular-nums; }
.mm-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 0.9rem; padding: 1rem 1.1rem 0; }
.mm-col h4 { margin: 0 0 0.4rem; font-size: 0.74rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.mm-c {
  display: block; width: 100%; text-align: left; margin-bottom: 0.35rem; cursor: pointer;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 8px;
  padding: 0.5rem 0.7rem; font-family: var(--sans); font-size: 0.86rem; color: var(--ink);
  transition: border-color 0.14s, background 0.14s;
}
.mm-c:hover:not(:disabled) { border-color: var(--s1); background: var(--sunken); }
.mm-c.sel { border-color: var(--s1); border-width: 2px; background: var(--sunken); }
.mm-c.done { opacity: 0.4; cursor: default; border-style: dashed; }
.mm-c.m { font-weight: 620; }
.mm-msg { padding: 0.9rem 1.1rem 0; font-size: 0.88rem; color: var(--ink2); min-height: 3.2rem; }
.mm-msg.ok  { color: var(--good); }
.mm-msg.bad { color: var(--critical); }
.mm-msg b { color: inherit; }

@media (max-width: 640px) {
  .mm-grid { grid-template-columns: 1fr; }
  .ch-seq.big i { width: 24px; height: 32px; font-size: 0.85rem; }
  .mg-hud { gap: 1rem; }
}
