/* How life works: same tokens as the rest of the Explorer (teal accent, IBM Plex, light and dark).
   data-theme on <html> overrides the system setting. */
:root {
  --page: #eef3f2; --panel: #f7faf9; --raised: #ffffff;
  --ink: #13201e; --muted: #4c5e5b; --line: #9aa9a6; --line-soft: #cad5d2;
  --accent: #0b7469; --accent-soft: rgba(11, 116, 105, 0.12); --on-accent: #ffffff;
  --stage-a: #f4f8f7; --stage-b: #d3dfdb;
  --shadow: 0 10px 30px rgba(17, 36, 33, 0.12);
  --bU: #e7a33e; --bC: #4f9a5a; --bA: #d0574a; --bG: #4a76c9; --wheel-aa: #ffffff;
  --font-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-name: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-data: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  --top: env(safe-area-inset-top, 0px); --bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0e1514; --panel: #141e1d; --raised: #1b2826;
    --ink: #e4eeeb; --muted: #9db0ac; --line: #5d7672; --line-soft: #283a38;
    --accent: #39b9ab; --accent-soft: rgba(57, 185, 171, 0.16); --on-accent: #04201c;
    --stage-a: #1c2826; --stage-b: #0a100f;
    --shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
    --bU: #b97a1c; --bC: #2f7a3b; --bA: #a8392e; --bG: #2f569e; --wheel-aa: #1b2826;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #0e1514; --panel: #141e1d; --raised: #1b2826;
  --ink: #e4eeeb; --muted: #9db0ac; --line: #5d7672; --line-soft: #283a38;
  --accent: #39b9ab; --accent-soft: rgba(57, 185, 171, 0.16); --on-accent: #04201c;
  --stage-a: #1c2826; --stage-b: #0a100f;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
  --bU: #b97a1c; --bC: #2f7a3b; --bA: #a8392e; --bG: #2f569e; --wheel-aa: #1b2826;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--font-ui); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: var(--accent); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
main:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 50; background: var(--accent); color: var(--on-accent); padding: 8px 12px; border-radius: 8px; }
.skip:focus { top: calc(8px + var(--top)); }
.small { font-size: 14px; color: var(--muted); }
.eyebrow { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

/* top bar */
.topbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: calc(10px + var(--top)) 16px 10px; border-bottom: 1px solid var(--line-soft); background: var(--panel); }
.brand { display: flex; flex-direction: column; line-height: 1.1; text-decoration: none; color: var(--ink); margin-right: auto; min-height: 44px; justify-content: center; }
.brand-name { font-family: var(--font-name); font-style: italic; font-weight: 600; font-size: 21px; letter-spacing: -0.01em; }
.brand-sub { font-family: var(--font-data); font-size: 11px; color: var(--muted); }
.topnav { display: flex; gap: 4px; flex-wrap: wrap; }
.navlink { display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; font-size: 14px; font-weight: 500; border-radius: 8px; text-decoration: none; }
.navlink:hover { background: var(--accent-soft); }
.icon-btn { border: 1px solid var(--line); background: var(--raised); border-radius: 8px; padding: 8px 12px; min-height: 44px; font-size: 14px; font-weight: 500; }
.icon-btn:hover { border-color: var(--accent); }
@media (max-width: 480px) { .icon-btn { font-size: 13px; padding: 6px 10px; } .navlink { padding: 0 6px; font-size: 13px; } }

.wrap { max-width: 1180px; margin: 0 auto; padding: 20px 16px; }
h1 { margin: 2px 0 6px; font-size: 28px; line-height: 1.2; letter-spacing: -0.015em; }
.lede { margin: 0 0 20px; font-size: 18px; color: var(--muted); max-width: 62ch; }
.note { padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); margin: 0 0 16px; }
.loadfail { color: var(--ink); }

/* hub */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.pcard { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line-soft); background: var(--raised); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.pcard:hover { border-color: var(--accent); }
@media (prefers-reduced-motion: no-preference) { .pcard:hover { transform: translateY(-2px); } }
.pcard canvas { display: block; width: 100%; aspect-ratio: 8 / 5; background: radial-gradient(85% 75% at 50% 42%, var(--stage-a) 0%, var(--stage-b) 100%); }
.pcard .pbody { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.pcard h2 { margin: 0; font-size: 19px; line-height: 1.25; }
.pcard h2 a { color: var(--ink); text-decoration: none; }
.pcard h2 a::after { content: ""; position: absolute; inset: 0; }
.pcard h2 a:focus-visible { outline: none; }
.pcard:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.pcard p { margin: 0; color: var(--muted); font-size: 15px; }
.pcard .meta { font-family: var(--font-data); font-size: 12px; color: var(--muted); margin-top: auto; padding-top: 4px; }

/* explainer layout */
.ex-grid { max-width: 1440px; margin: 0 auto; padding: 14px 16px 24px; display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) {
  .ex-grid { grid-template-columns: minmax(0, 1.55fr) minmax(340px, 1fr); align-items: start; padding: 20px 22px 32px; }
  .ex-left { position: sticky; top: 10px; }
}
.ex-head h1 { font-size: 26px; }
.ex-head h1:focus { outline: none; }
.summary { margin: 0 0 12px; color: var(--muted); max-width: 62ch; }
.stage { position: relative; margin: 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--line-soft); background: radial-gradient(85% 75% at 50% 42%, var(--stage-a) 0%, var(--stage-b) 100%); aspect-ratio: 8 / 5; min-height: 220px; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; }
.badge { position: absolute; right: 8px; bottom: 8px; z-index: 2; font-size: 12px; font-weight: 500; padding: 2px 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); opacity: 0.92; }
.nocanvas { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; padding: 20px; text-align: center; }
.stage.off { aspect-ratio: auto; min-height: 0; }
.stage.off .nocanvas { position: static; }
.stage.off .badge { display: none; }

/* controls */
.controls { margin-top: 10px; }
.ctl-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cbtn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--raised); font-weight: 500; font-size: 15px; }
.cbtn:hover:not(:disabled) { border-color: var(--accent); }
.cbtn:disabled { opacity: 0.45; cursor: default; }
.cbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.cbtn.play { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; min-width: 108px; justify-content: center; }
.cbtn.play svg { fill: currentColor; stroke: none; }
.cbtn.play .ic-pause { display: none; }
.cbtn.play[aria-pressed="true"] .ic-pause { display: block; }
.cbtn.play[aria-pressed="true"] .ic-play { display: none; }
.pos { font-family: var(--font-data); font-size: 13px; color: var(--muted); margin-left: auto; }
@media (max-width: 480px) { .cbtn-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } .cbtn { padding: 8px 12px; } }
.tl { position: relative; margin-top: 8px; }
.tl input[type="range"] { width: 100%; height: 44px; margin: 0; accent-color: var(--accent); cursor: pointer; background: transparent; }
.markers { display: flex; gap: 4px; margin-top: 2px; }
.markers button { flex: 1 1 0; min-width: 0; min-height: 30px; padding: 2px 4px; border: 1px solid var(--line-soft); background: var(--raised); border-radius: 6px; font-family: var(--font-data); font-size: 12px; color: var(--muted); }
.markers button:hover { border-color: var(--accent); }
.markers button[aria-current="step"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.markers button.done { border-color: var(--accent); color: var(--ink); }
.keys { margin: 6px 0 0; }
.reduced { margin: 4px 0 0; padding: 6px 10px; background: var(--accent-soft); border-radius: 8px; color: var(--ink); }

/* cards */
.card { border: 1px solid var(--line-soft); background: var(--raised); border-radius: 12px; padding: 12px 14px; margin: 0 0 12px; }
.ex-left .card { margin-top: 12px; }
.card h2 { margin: 0 0 8px; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
details.card > summary { cursor: pointer; font-weight: 600; min-height: 28px; }
details.card[open] > summary { margin-bottom: 6px; }
details.card p { margin: 0; }
.legend-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 12px; font-size: 14px; }
.legend-list li { display: flex; align-items: center; gap: 8px; min-height: 26px; }
.sw { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.3); }
.stepcard { border: 2px solid var(--accent); box-shadow: var(--shadow); }
.steppos { margin: 0; font-family: var(--font-data); font-size: 12px; color: var(--muted); }
.steptitle { margin: 2px 0 6px !important; font-size: 21px !important; letter-spacing: -0.01em !important; text-transform: none !important; color: var(--ink) !important; }
.steptext { margin: 0 0 8px; font-size: 17px; line-height: 1.55; }
sup.ref { font-family: var(--font-data); font-size: 11px; margin-left: 1px; }
sup.ref a { text-decoration: none; padding: 0 1px; }
.steplinks { display: flex; flex-wrap: wrap; gap: 8px; }
.steplinks:empty { display: none; }
.golink { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 14px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 14px; text-decoration: none; }
.golink::after { content: "\2192"; }
.golink:hover { filter: brightness(1.08); }
.steplist { margin: 0; padding-left: 0; list-style: none; counter-reset: st; display: grid; gap: 8px; }
.steplist li { counter-increment: st; border: 1px solid var(--line-soft); border-radius: 10px; padding: 8px 10px 8px 42px; position: relative; }
.steplist li::before { content: counter(st); position: absolute; left: 10px; top: 9px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-family: var(--font-data); font-size: 12px; font-weight: 700; }
.steplist li.cur { border-color: var(--accent); background: var(--accent-soft); }
.steplist li.cur::before { background: var(--accent); color: var(--on-accent); }
.steplist h3 { margin: 0 0 2px; font-size: 16px; }
.steplist p { margin: 0 0 4px; font-size: 15px; }
.steplist .sl-row { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 14px; }
.steplist .sl-go { min-height: 36px; padding: 4px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--raised); font-size: 14px; }
.steplist .sl-go:hover { border-color: var(--accent); }
.steplist .cur-tag { font-size: 12px; font-weight: 600; color: var(--accent); }
.sources { margin: 0; padding-left: 22px; font-size: 13.5px; color: var(--muted); }
.sources li { margin: 0 0 6px; }
.sources li:target { background: var(--accent-soft); border-radius: 6px; }
.sources a { overflow-wrap: anywhere; }

/* extras: shared */
.extra h2 { margin-bottom: 4px; }
.extra .intro { margin: 0 0 10px; font-size: 15px; }
.feedback { min-height: 1.5em; margin: 8px 0; font-weight: 500; }
.feedback.ok { color: var(--accent); }
.choice { min-height: 44px; padding: 6px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--raised); font-weight: 500; }
.choice:hover:not(:disabled) { border-color: var(--accent); }
.choice:disabled { opacity: 0.5; cursor: default; }
.choice.picked { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* codon puzzle */
.mrna-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; font-family: var(--font-data); font-weight: 600; }
.mrna-row .cd { padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line-soft); letter-spacing: 0.08em; }
.mrna-row .cd.now { border: 2px solid var(--accent); background: var(--accent-soft); }
.mrna-row .cd.done { color: var(--muted); }
.wheelwrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-items: start; }
@media (min-width: 520px) and (max-width: 959px), (min-width: 1280px) { .wheelwrap { grid-template-columns: minmax(0, 260px) minmax(0, 1fr); } }
.wheel { width: 100%; max-width: 300px; height: auto; display: block; margin: 0 auto; color: var(--ink); }
.wheel text { font-family: var(--font-data); pointer-events: none; }
.wheel .seg { stroke: var(--raised); stroke-width: 0.8; }
.wheel .bU { fill: var(--bU); } .wheel .bC { fill: var(--bC); } .wheel .bA { fill: var(--bA); } .wheel .bG { fill: var(--bG); }
.wheel .dimmed { opacity: 0.22; }
.wheel .hl { stroke: var(--ink); stroke-width: 2.2; }
.wheel .blet { fill: #fff; font-weight: 700; }
.wheel .aa { fill: var(--ink); font-size: 8.5px; }
.wheel .aa.hl-aa { font-weight: 700; fill: var(--accent); font-size: 10px; }
.wheel .aaband { fill: var(--wheel-aa); stroke: var(--line-soft); stroke-width: 0.6; }
.pickers { display: grid; gap: 6px; }
.pickers fieldset { border: 0; margin: 0; padding: 0; }
.pickers legend { font-size: 13px; color: var(--muted); padding: 0; margin-bottom: 2px; }
.pickers .bset { display: flex; gap: 6px; }
.pickers .bset button { flex: 1; min-height: 44px; border-radius: 10px; border: 2px solid transparent; font-family: var(--font-data); font-weight: 700; font-size: 17px; color: #fff; }
.pickers .bset button[data-b="U"] { background: var(--bU); } .pickers .bset button[data-b="C"] { background: var(--bC); }
.pickers .bset button[data-b="A"] { background: var(--bA); } .pickers .bset button[data-b="G"] { background: var(--bG); }
.pickers .bset button[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--raised) inset; }
.pickers .bset button:disabled { opacity: 0.35; cursor: default; }
.answers { display: flex; flex-wrap: wrap; gap: 6px; }
.chain { font-family: var(--font-data); font-size: 14px; margin: 6px 0; overflow-wrap: anywhere; }
.codetable { width: 100%; border-collapse: collapse; font-size: 12px; font-family: var(--font-data); margin-top: 6px; }
.codetable caption { text-align: left; font-family: var(--font-ui); font-size: 13px; color: var(--muted); padding-bottom: 4px; }
.codetable th, .codetable td { border: 1px solid var(--line-soft); padding: 3px 4px; vertical-align: top; text-align: left; }
.codetable th { background: var(--accent-soft); }
.tablewrap { overflow-x: auto; }

/* light slider */
.lightrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lightrow input { flex: 1 1 200px; height: 44px; accent-color: #d6a400; }
.lightrow .lend { font-size: 13px; color: var(--muted); }
.gauge { height: 14px; border-radius: 999px; background: var(--line-soft); overflow: hidden; margin: 6px 0 4px; }
.gauge span { display: block; height: 100%; background: linear-gradient(90deg, #d6a400, var(--accent)); border-radius: 999px; transition: width .2s; }
@media (prefers-reduced-motion: reduce) { .gauge span { transition: none; } }

/* lab */
.labgrid { display: grid; gap: 10px; }
.slider { display: grid; gap: 2px; }
.slider label { font-size: 14px; font-weight: 500; display: flex; justify-content: space-between; gap: 8px; }
.slider output { font-family: var(--font-data); color: var(--muted); }
.slider input { width: 100%; height: 40px; accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }
.readout { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; font-size: 14px; margin: 0; }
.readout dt { color: var(--muted); }
.readout dd { margin: 0; font-family: var(--font-data); text-align: right; }
.tonicity { font-weight: 600; margin: 0; }
.burst { color: #c63b2e; font-weight: 600; margin: 0; }
:root[data-theme="dark"] .burst { color: #ff8070; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .burst { color: #ff8070; } }

.foot { font-size: 13px; color: var(--muted); padding-top: 0; padding-bottom: calc(24px + var(--bottom)); }
.foot p { margin: 0 0 4px; }

/* ---------- app shell (integration phase 2): the shell bar brings the brand, home link and theme button, so our
   header keeps only the "All processes" link, as a plain row under the bar ---------- */
body.cme-shell .topbar { border-bottom: 0; background: none; padding: 6px 16px 0; min-height: 0; }
body.cme-shell .ex-left { top: calc(var(--cme-bar-h, 52px) + var(--cme-top, 0px) + 10px); }