/* ============ theme tokens ============ */
/* light theme only (user asked to remove dark mode) */
:root {
  --mono: "JetBrains Mono", ui-monospace, monospace;
  /* black, white and grey only. Colour (green / orange / red) is used ONLY to show component states. */
  --bg: #f5f5f6; --bg2: #ffffff; --panel: #ffffff; --panel2: #fafafa; --raise: #f0f0f2;
  --line: #e9e9ec; --line2: #d9d9de;
  --text: #3d3d43; --muted: #74747c; --bright: #0a0a0b;
  --accent: #0a0a0b; --accent2: #6a6a72; --accent-soft: rgba(10,10,11,.05);
  --flow: #4a4a52;
  --ok: #16a36a; --warn: #e08a1e; --hot: #e5484d; --dead: #d93a46; --boot: #8a8a93; --idle: #c6c6cc;
  --ok-soft: rgba(22,163,106,.10); --dead-soft: rgba(217,58,70,.08); --warn-soft: rgba(224,138,30,.12);
  --node: #ffffff; --node-hover: #fafafa;
  --shadow: 0 1px 2px rgba(10,10,11,.04), 0 4px 12px rgba(10,10,11,.04), 0 16px 40px rgba(10,10,11,.05);
  --grid: rgba(10,10,11,.07);
  --t1: #fafafa; --t2: #fafafa; --t3: #fafafa; --t4: #fafafa; --t5: #fafafa; --t6: #fafafa;
  color-scheme: light;
}

/* ============ base ============ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 Inter, system-ui, -apple-system, sans-serif; }
body { transition: background .3s, color .3s; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.node, .node:focus, .pool-item { outline: none; }
.node:focus-visible .n-box { stroke: var(--accent); stroke-opacity: 1; stroke-width: 2.4; }
svg:focus, canvas:focus { outline: none; }
button svg, .icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h3, h4, h5 { font-weight: 500; color: var(--bright); margin: 0; }
p { margin: 0 0 10px; }
b, strong { font-weight: 500; color: var(--bright); }
.eyebrow { font: 500 12px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 20px 0 8px; }
.muted { color: var(--muted); }

/* ============ layout ============ */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr) 372px; height: 100vh; height: 100dvh; }
.nav-col, .side-col { background: var(--bg2); overflow-y: auto; transition: background .3s; scrollbar-width: thin; }
.nav-col { border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.side-col { border-left: 1px solid var(--line); }
.main-col { overflow-y: auto; padding: 22px 26px 40px; min-width: 0; position: relative; scrollbar-width: thin;
  background: var(--bg); }
.main-col.swap > * { animation: rise .45s cubic-bezier(.2,.8,.2,1) backwards; }
.main-col.swap > *:nth-child(2) { animation-delay: .04s; } .main-col.swap > *:nth-child(3) { animation-delay: .08s; } .main-col.swap > *:nth-child(4) { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ============ nav ============ */
.brand { display: flex; gap: 12px; align-items: center; padding: 20px 16px 18px 18px; }
.brand-text { flex: 1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; min-width: 0; }
.b2 { font-size: 17px; color: var(--bright); line-height: 1.25; font-weight: 500; letter-spacing: -.01em; }
.logo { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: #fff; flex: none;
  background: #0a0a0b; box-shadow: 0 2px 6px rgba(10,10,11,.18), 0 10px 24px rgba(10,10,11,.12); }
.logo svg { width: 20px; height: 20px; fill: currentColor; stroke: currentColor; stroke-width: 1.6; }
.nav-group { font: 500 12px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 14px 12px 6px; }
.nav-group:first-child { padding-top: 4px; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); transition: .2s; flex: none; }
.icon-btn:hover { color: var(--bright); border-color: var(--line2); }
#nav { display: flex; flex-direction: column; gap: 2px; padding: 4px 10px; }
.nav-item { display: flex; gap: 12px; align-items: flex-start; text-align: left; background: none; border: 1px solid transparent; border-radius: 10px; padding: 10px 12px; position: relative; transition: background .2s, border-color .2s; }
.nav-item:hover { background: var(--panel); }
.nav-item.active { background: #fff; border-color: var(--line2); box-shadow: 0 2px 8px rgba(10,10,11,.05); }
.nav-item.active::before { content: ""; position: absolute; left: -10px; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-item.active .nav-num { color: var(--accent); }
.nav-num { font: 500 12px var(--mono); color: var(--muted); padding-top: 3px; }
.nav-text { display: flex; flex-direction: column; gap: 3px; }
.nav-title { color: var(--bright); font-size: 14px; line-height: 1.35; }
.nav-level, .level { font: 500 12px var(--mono); letter-spacing: .04em; }
.lvl-medium { color: var(--warn); } .lvl-hard { color: var(--hot); }
.nav-foot { color: var(--muted); font-size: 13px; padding: 4px 18px 20px; margin-top: auto; border-top: 1px solid var(--line); }
.nav-foot p { margin-bottom: 10px; }
.keys { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.kbd { font: 12px var(--mono); border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 5px; padding: 0 6px; color: var(--text); background: var(--panel); }

/* ============ top bar ============ */
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.top-eyebrow { margin: 0 0 6px; display: flex; gap: 12px; }
h1 { font-size: 27px; letter-spacing: -.015em; line-height: 1.2; }
.tag { color: var(--muted); margin: 4px 0 0; max-width: 680px; }
.time { display: flex; gap: 10px; align-items: center; }
.clock-wrap { display: inline-flex; align-items: center; gap: 8px; font: 13px var(--mono); color: var(--muted); min-width: 78px; justify-content: flex-end; }
.clock-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); animation: blink 1.6s infinite; }
body.paused .clock-dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); animation: none; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { background: none; border: 0; border-radius: 7px; padding: 6px 11px; font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .2s, color .2s; min-height: 34px; }
.seg button:hover { color: var(--bright); }
.seg button.on { background: var(--raise); color: var(--bright); box-shadow: inset 0 0 0 1px var(--line2); }
.ghost { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; min-height: 40px; transition: .2s; }
.ghost:hover { color: var(--bright); border-color: var(--line2); }

/* ============ stage ============ */
.stage-wrap { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); transition: background .3s, border-color .3s; }
.stage-scroll { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
.stage-inner { position: relative; }
#stage { display: block; width: 100%; height: auto; }
#fx { position: absolute; left: 0; top: 0; pointer-events: none; }
.grid-dot { fill: var(--grid); }
.edge { fill: none; stroke: var(--line2); stroke-width: 1.8; transition: stroke .4s; }
.edge.live { stroke: color-mix(in srgb, var(--flow) 45%, transparent); }
.edge.failing { stroke: color-mix(in srgb, var(--dead) 65%, transparent); }
.edge.dashed { stroke-dasharray: 5 6; }
.elabel rect { fill: var(--bg2); stroke: var(--line); transition: fill .3s, stroke .3s; }
.elabel text { font: 500 13px var(--mono); fill: var(--muted); text-anchor: middle; }
.elabel.failing rect { stroke: color-mix(in srgb, var(--dead) 55%, transparent); } .elabel.failing text { fill: var(--dead); }

.node { --c: var(--idle); transition: opacity .35s; }
.node.enter { opacity: 0; }
.node.st-ok { --c: var(--ok); } .node.st-warn { --c: var(--warn); } .node.st-hot { --c: var(--hot); } .node.st-dead { --c: var(--dead); } .node.st-boot { --c: var(--boot); } .node.st-idle { --c: var(--idle); }
.n-box { fill: var(--node); stroke: var(--c); stroke-opacity: .45; stroke-width: 1.4; transition: stroke .4s, fill .3s, stroke-opacity .3s; }
.n-box { filter: drop-shadow(0 1px 2px rgba(10,10,11,.05)) drop-shadow(0 6px 14px rgba(10,10,11,.06)); }
.node.st-hot .n-box { stroke-opacity: 1; stroke-width: 2; animation: hotglow 1.4s ease-in-out infinite; }
@keyframes hotglow { 50% { stroke-width: 3.2; } }
.node.st-dead .n-box { fill: var(--dead-soft); stroke-opacity: 1; stroke-dasharray: 5 4; }
.node.st-dead text { opacity: .6; }
.node.focus .n-box { stroke: var(--accent); stroke-opacity: 1; stroke-width: 2.4; }
.node.clickable { cursor: pointer; }
.node.clickable:hover .n-box { fill: var(--node-hover); stroke-opacity: 1; }
.n-dot { fill: var(--c); transition: fill .4s; }
.node.st-hot .n-dot, .node.st-boot .n-dot { animation: blink 1s infinite; }
.n-kind { font: 500 12px var(--mono); letter-spacing: .07em; fill: var(--muted); }
.n-badge { font: 500 13px var(--mono); fill: var(--muted); }
.n-label { font: 500 18px Inter, sans-serif; fill: var(--bright); }
.n-sub { font: 13px var(--mono); fill: var(--muted); }
.ubar-bg { fill: var(--line); }
.ubar { fill: var(--c); transform-box: fill-box; transform-origin: left center; transition: transform .45s cubic-bezier(.2,.8,.2,1), fill .4s; }
.x { stroke: var(--dead); stroke-width: 2.2; stroke-linecap: round; fill: none; }
.pool-item { transition: fill .45s, opacity .45s; fill: var(--idle); }
.pool-item.ps-ok { fill: var(--ok); } .pool-item.ps-warn { fill: var(--warn); } .pool-item.ps-hot { fill: var(--hot); }
.pool-item.ps-dead { fill: var(--dead); } .pool-item.ps-boot { fill: var(--boot); opacity: .55; animation: bootpulse 1.2s ease-in-out infinite; } .pool-item.ps-idle { fill: var(--idle); }
@keyframes bootpulse { 50% { opacity: .9; } }
.pool-item.clickable { cursor: pointer; } .pool-item.clickable:hover { stroke: var(--bright); stroke-width: 2; }
@keyframes blink { 50% { opacity: .3; } }

.legend { display: flex; gap: 6px 16px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw.ok { background: var(--ok); } .sw.warn { background: var(--warn); } .sw.hot { background: var(--hot); } .sw.boot { background: var(--boot); } .sw.dead { background: var(--dead); }
.dotl { width: 8px; height: 8px; border-radius: 50%; background: var(--flow); box-shadow: 0 0 0 3px color-mix(in srgb, var(--flow) 20%, transparent); }
.dotl.bad { background: var(--dead); box-shadow: 0 0 0 3px var(--dead-soft); }
.paused-badge { position: absolute; top: 12px; left: 50%; transform: translate(-50%, -6px); opacity: 0; pointer-events: none; transition: .25s;
  font: 500 12px var(--mono); letter-spacing: .08em; color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); background: var(--warn-soft); padding: 5px 12px; border-radius: 8px; }
.is-paused .paused-badge { opacity: 1; transform: translate(-50%, 0); }
.portrait .n-sub, .portrait .elabel text { font-size: 14px; }
.portrait .n-kind { font-size: 12.5px; }
.ripple { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; border: 2px solid var(--dead); pointer-events: none; animation: rip .6s ease-out forwards; }
@keyframes rip { to { transform: scale(5); opacity: 0; } }

/* ============ popover + tooltip ============ */
.pop { display: none; position: absolute; z-index: 6; width: 268px; background: var(--bg2); border: 1px solid var(--line2); border-radius: 12px; padding: 14px;
  box-shadow: 0 16px 44px rgba(0,0,0,.28); opacity: 0; transform: translateY(4px) scale(.98); transition: opacity .18s, transform .18s; }
.pop.show { opacity: 1; transform: none; }
.tip { pointer-events: none; width: 240px; opacity: 1; transform: none; padding: 12px; }
.pop-x { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border: 0; background: none; color: var(--muted); font-size: 20px; border-radius: 6px; }
.pop-x:hover { background: var(--raise); color: var(--bright); }
.pop-kind { font: 500 12px var(--mono); color: var(--muted); letter-spacing: .08em; }
.pop h4 { font-size: 16px; margin: 2px 0 8px; }
.pop-line { font: 12.5px var(--mono); color: var(--text); padding: 2px 0; }
.pop-acts { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.tip-hint { font-size: 12px; color: var(--accent); margin-top: 8px; }

/* ============ buttons ============ */
.act { position: relative; overflow: hidden; background: var(--panel2); border: 1px solid var(--line2); border-radius: 10px; padding: 10px 13px; font-size: 14px; color: var(--bright); text-align: left; min-height: 44px; transition: border-color .2s, background .2s, transform .12s; }
.act:hover { border-color: var(--accent); }
.act:active { transform: scale(.985); }
.act.tone-danger { border-color: color-mix(in srgb, var(--dead) 35%, transparent); background: var(--dead-soft); }
.act.tone-danger:hover { border-color: var(--dead); }
.act.tone-good { border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: var(--ok-soft); }
.act.tone-good:hover { border-color: var(--ok); }
.act.pulse::after, .presets button.pulse::after { content: ""; position: absolute; inset: 0; background: currentColor; opacity: .14; animation: flash .5s ease-out forwards; }
@keyframes flash { to { opacity: 0; } }

/* ============ metrics ============ */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; margin-top: 14px; }
.metric { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px 6px; position: relative; overflow: hidden; transition: border-color .4s, background .3s; box-shadow: var(--shadow); }
.m-label { font: 12px var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-val { font-size: 25px; color: var(--bright); font-variant-numeric: tabular-nums; margin: 3px 0 2px; letter-spacing: -.01em; transition: color .4s; }
.spark { width: 100%; height: 30px; display: block; }
.spark .line { fill: none; stroke: var(--accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; transition: stroke .4s; }
.spark .area { fill: var(--accent-soft); transition: fill .4s; }
.metric.tone-bad { border-color: color-mix(in srgb, var(--dead) 45%, transparent); background: linear-gradient(180deg, var(--dead-soft), var(--panel) 70%); }
.metric.tone-bad .m-val { color: var(--hot); }
.metric.tone-bad .spark .line { stroke: var(--hot); } .metric.tone-bad .spark .area { fill: var(--dead-soft); }
.metric.tone-good .m-val { color: var(--ok); }

/* ============ lower cards ============ */
.lower { display: grid; grid-template-columns: 1.15fr 1fr; gap: 12px; margin-top: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px 18px 16px; min-width: 0; box-shadow: var(--shadow); transition: background .3s, border-color .3s; }
.story.flash { animation: storyflash 1.2s ease-out; }
@keyframes storyflash { 0% { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); } }
.story h3 { font-size: 17px; margin-bottom: 10px; line-height: 1.35; }
.st-t { text-transform: none; letter-spacing: 0; float: right; }
.steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.steps li { display: grid; grid-template-columns: 62px 1fr; gap: 10px; font-size: 14px; padding: 8px 10px; border-radius: 8px; border-left: 2px solid var(--line2); transition: background .4s, color .4s, border-color .4s; }
.steps li.done { border-left-color: var(--accent); background: var(--accent-soft); color: var(--bright); }
.steps li.wait { color: var(--muted); }
.steps li.just { animation: rise .45s cubic-bezier(.2,.8,.2,1); }
.when { font: 12px var(--mono); color: var(--muted); padding-top: 2px; }
.steps li.done .when { color: var(--accent); }
.log { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; scrollbar-width: thin; }
.log li { display: grid; grid-template-columns: 54px 1fr; gap: 10px; font-size: 13.5px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.log li.enter { animation: logIn .35s ease-out; }
@keyframes logIn { from { opacity: 0; transform: translateX(-6px); } }
.log li.tone-bad span:last-child { color: var(--hot); } .log li.tone-good span:last-child { color: var(--ok); } .log li.tone-warn span:last-child { color: var(--warn); }

/* ============ side panel ============ */
.tabs { display: flex; gap: 4px; padding: 12px 18px 0; position: sticky; top: 0; background: var(--bg2); z-index: 3; border-bottom: 1px solid var(--line); transition: background .3s; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 12px; color: var(--muted); display: inline-flex; gap: 8px; align-items: center; transition: color .2s, border-color .2s; min-height: 44px; }
.tabs button.on { color: var(--bright); border-bottom-color: var(--accent); }
.mini { font: 12px var(--mono); color: var(--accent); background: var(--accent-soft); padding: 0 6px; border-radius: 5px; }
.tab { padding: 4px 20px 36px; }
.missions { background: linear-gradient(180deg, var(--accent-soft), transparent 80%); border: 1px solid var(--line2); border-radius: 12px; padding: 14px 16px; margin-top: 16px; }
.m-head { display: flex; justify-content: space-between; color: var(--bright); font-weight: 500; }
.m-count { font: 13px var(--mono); color: var(--accent); }
.m-bar { height: 4px; background: var(--line); border-radius: 2px; margin: 10px 0 12px; overflow: hidden; }
.m-bar div { height: 100%; background: #0a0a0b; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.missions ol { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.missions li { display: grid; grid-template-columns: 18px 1fr; gap: 8px; font-size: 14px; line-height: 1.5; transition: color .3s; }
.missions li .dot { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--muted); margin-top: 5px; transition: .3s; }
.missions li.done { color: var(--muted); }
.missions li.done span:last-child { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.missions li.done .dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.missions li.just .dot { animation: pop .5s cubic-bezier(.3,1.6,.5,1); }
@keyframes pop { 0% { transform: scale(.3); } }

.ctl-group h4 { font: 500 12px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 26px 0 12px; display: flex; align-items: center; gap: 10px; }
.ctl-group h4::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.ctl { margin-bottom: 16px; }
.ctl label { font-size: 14px; color: var(--text); display: block; margin-bottom: 8px; }
.ctl-row { display: flex; justify-content: space-between; align-items: baseline; }
.ctl-row label { margin-bottom: 4px; }
.ctl-val { font: 500 15px var(--mono); color: var(--accent); }
input[type=range] { --p: 50%; -webkit-appearance: none; appearance: none; width: 100%; height: 30px; background: transparent; margin: 2px 0; touch-action: pan-y; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--accent) var(--p), var(--line2) var(--p)); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--accent) var(--p), var(--line2) var(--p)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--bg2); border: 3px solid var(--accent); margin-top: -8px; transition: transform .15s; }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--bg2); border: 3px solid var(--accent); }
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.15); }
.presets { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.presets button { position: relative; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 5px 11px; font: 13px var(--mono); color: var(--muted); min-height: 34px; transition: .2s; }
.presets button:hover { color: var(--bright); border-color: var(--accent); }
.presets button.on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.seg-ctl { display: flex; flex-wrap: wrap; width: 100%; }
.seg-ctl button { flex: 1 1 auto; }
.hint { font-size: 13px; color: var(--muted); margin: 7px 0 0; line-height: 1.5; }
.btns { display: flex; flex-direction: column; gap: 7px; }
.toggle { display: flex; align-items: center; gap: 12px; background: none; border: 0; padding: 4px 0; text-align: left; font-size: 14px; min-height: 40px; }
.knob { width: 40px; height: 24px; border-radius: 12px; background: var(--line2); position: relative; flex: none; transition: background .25s; }
.knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--bg2); box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .25s cubic-bezier(.3,1.4,.5,1); }
.toggle.on .knob { background: var(--accent); } .toggle.on .knob::after { transform: translateX(16px); }

/* ============ learn ============ */
.learn p { font-size: 14.5px; }
.analogy { margin-top: 18px; background: linear-gradient(180deg, var(--accent-soft), transparent); border: 1px solid var(--line2); border-radius: 12px; padding: 2px 16px 8px; }
.analogy .eyebrow { margin-top: 14px; }
.analogy h3 { font-size: 17px; margin-bottom: 6px; }
.q { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--panel); transition: border-color .2s; }
.q[open] { border-color: var(--line2); }
.q summary { cursor: pointer; padding: 11px 12px; font-size: 14px; color: var(--bright); list-style: none; display: flex; gap: 10px; }
.q summary::-webkit-details-marker { display: none; }
.qn { font: 500 12px var(--mono); color: var(--accent); padding-top: 2px; }
.q p { padding: 0 12px 6px 42px; color: var(--text); animation: rise .3s ease-out; }
.rw { border-left: 2px solid var(--accent); padding: 2px 0 2px 14px; margin-bottom: 14px; }
.rw h5 { font-size: 15px; margin-bottom: 4px; } .rw p { margin-bottom: 4px; }
.rw a { color: var(--accent); font-size: 13px; text-decoration: none; } .rw a:hover { text-decoration: underline; }
.note { color: var(--muted); font-size: 13px !important; }
.nums { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.nums td { padding: 7px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.nums td:last-child { text-align: right; font-family: var(--mono); font-size: 13px; color: var(--bright); padding-left: 10px; }
.learn code, .missions code { font: 13px var(--mono); color: var(--accent); }

/* ============ toast, dock, errors ============ */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 16px); opacity: 0; transition: .3s cubic-bezier(.2,.8,.2,1); z-index: 40;
  background: var(--bg2); border: 1px solid var(--accent); color: var(--bright); padding: 10px 18px; border-radius: 10px; font-size: 14px; pointer-events: none; box-shadow: 0 12px 30px rgba(0,0,0,.25); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.dock { display: none; }
.errors { display: none; position: fixed; bottom: 0; left: 0; right: 0; margin: 0; background: #3a0d14; color: #ffd0d6; font: 12px var(--mono); padding: 10px; z-index: 50; white-space: pre-wrap; }

/* ============ responsive ============ */
@media (max-width: 1280px) { .app { grid-template-columns: 212px minmax(0, 1fr) 336px; } .main-col { padding: 20px 20px 36px; } }
@media (max-width: 1060px) {
  .app { display: block; height: auto; }
  .nav-col { border: 0; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(10px); background: color-mix(in srgb, var(--bg2) 88%, transparent); }
  .brand { padding: 10px 14px 4px; }
  .logo { width: 30px; height: 30px; }
  #nav { flex-direction: row; overflow-x: auto; padding: 6px 16px 12px; gap: 8px; scroll-padding-inline: 16px; scrollbar-width: none; scroll-snap-type: x proximity; }
  #nav::-webkit-scrollbar { display: none; }
  .nav-group { display: none; }
  .b2 { white-space: nowrap; }
  .nav-item { flex: none; padding: 8px 12px; border-color: var(--line); scroll-snap-align: start; }
  .nav-item.active::before { display: none; }
  .nav-item.active { border-color: var(--accent); background: var(--t1); box-shadow: 0 4px 14px rgba(10,10,11,.08); }
  .nav-foot { display: none; }
  .main-col { display: contents; }
  .app { display: flex; flex-direction: column; }
  .nav-col { order: 0; } .top { order: 1; } .stage-wrap { order: 2; } .metrics { order: 3; } .side-col { order: 4; } .lower { order: 5; }
  .top, .stage-wrap, .metrics, .lower { margin-left: 16px; margin-right: 16px; }
  .top { margin-top: 16px; } .lower { margin-bottom: 24px; }
  .side-col { margin-top: 16px; background: transparent; }
  .side-col { border: 0; border-top: 0; padding-bottom: 0; scroll-margin-top: 110px; }
  .stage-wrap { scroll-margin-top: 120px; }
  .lower { grid-template-columns: 1fr; }
  .tabs { position: relative; }
  .dock { display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 30; justify-content: space-around;
    background: color-mix(in srgb, var(--bg2) 90%, transparent); backdrop-filter: blur(14px); border: 1px solid var(--line2); border-radius: 16px; padding: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
  .dock button { flex: 1; background: none; border: 0; color: var(--muted); font-size: 12px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 4px; border-radius: 10px; min-height: 48px; }
  .dock button:active { background: var(--raise); color: var(--bright); }
  .dock svg { width: 20px; height: 20px; }
  .toast { bottom: calc(92px + env(safe-area-inset-bottom)); }
  body { padding-bottom: 80px; }
}
@media (max-width: 720px) {
  h1 { font-size: 22px; }
  .tag { font-size: 14px; }
  .top { align-items: stretch; gap: 12px; }
  .time { width: 100%; justify-content: space-between; }
  .clock-wrap { justify-content: flex-start; min-width: 0; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .m-val { font-size: 22px; }
  .legend { gap: 6px 12px; padding: 9px 12px; }
  .pop { width: min(300px, calc(100% - 16px)); }
  #reset span { display: none; }
  .tab { padding: 4px 16px 30px; }
  .card { padding: 4px 14px 14px; }
}
@keyframes fadeHint { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ============ state colour coding (the only colour in the UI) ============ */
.metric.tone-bad { background: linear-gradient(180deg, var(--dead-soft), var(--panel) 70%); }
.metric.tone-good { background: linear-gradient(180deg, var(--ok-soft), var(--panel) 70%); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.steps li.done { background: var(--ok-soft); border-left-color: var(--ok); } .steps li.done .when { color: var(--ok); }
.missions li.done .dot { background: var(--ok); border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.lvl-medium { color: var(--warn); } .lvl-hard { color: var(--hot); }
.node.st-ok .n-box { fill: color-mix(in srgb, var(--ok) 4%, #fff); }
.node.st-warn .n-box { fill: color-mix(in srgb, var(--warn) 7%, #fff); stroke-opacity: .8; }
.node.st-hot .n-box { fill: color-mix(in srgb, var(--hot) 7%, #fff); }

/* ============ sidebar collapse (desktop only) ============ */
.nav-toggle { width: 34px; height: 34px; }
@media (min-width: 1061px) {
  .app.nav-collapsed { grid-template-columns: 64px minmax(0, 1fr) 372px; }
  .nav-collapsed .brand { flex-direction: column; padding: 16px 0 10px; gap: 10px; }
  .nav-collapsed .brand-text, .nav-collapsed .nav-text, .nav-collapsed .nav-foot, .nav-collapsed .nav-group { display: none; }
  .nav-collapsed #nav { padding: 4px 8px; align-items: stretch; }
  .nav-collapsed .nav-item { justify-content: center; padding: 10px 0; }
  .nav-collapsed .nav-item.active::before { left: -8px; }
  .nav-collapsed .nav-num { padding: 0; font-size: 13px; }
  .nav-collapsed .nav-item.active .nav-num { color: var(--bright); }
}
@media (min-width: 1061px) and (max-width: 1280px) { .app.nav-collapsed { grid-template-columns: 64px minmax(0, 1fr) 336px; } }
@media (max-width: 1060px) { .nav-toggle { display: none; } }
