:root {
  --paper:    #FFFFFF;
  --card:     #FFFFFF;
  --well:     #F4F5F7;
  --sunk:     #EAECEF;

  --ink:      #1A1D21;
  --ink-2:    #414750;
  --muted:    #6B7280;
  --faint:    #9AA1AB;
  --hair:     #E1E4E8;
  --hair-2:   #EEF0F3;

  --accent:   #2563C9;
  --accent-2: #1D4FA8;
  --accent-w: #EDF3FC;

  /* progress uses the same blue at increasing strength */
  --gold:     #2563C9;
  --gold-2:   #1D4FA8;
  --gold-w:   #EDF3FC;

  --good:     #17794C;
  --good-2:   #1E9160;
  --good-w:   #EAF5EF;

  --bad:      #C23B2E;
  --bad-w:    #FCEDEB;

  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: var(--font-body);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --r: 5px;
  --shadow: 0 1px 2px rgba(20,24,30,.05);
  --lift: 0 1px 3px rgba(20,24,30,.08), 0 6px 16px rgba(20,24,30,.06);
}

:root[data-theme="dark"] {
  --paper:    #16181C;
  --card:     #1D2025;
  --well:     #24282E;
  --sunk:     #101216;

  --ink:      #E8EAED;
  --ink-2:    #C2C7CE;
  --muted:    #9099A4;
  --faint:    #6C757F;
  --hair:     #333840;
  --hair-2:   #272B31;

  --accent:   #6BA1F0;
  --accent-2: #8FBAF6;
  --accent-w: #1B2838;

  --gold:     #6BA1F0;
  --gold-2:   #8FBAF6;
  --gold-w:   #1B2838;

  --good:     #4FB585;
  --good-2:   #6DCB9E;
  --good-w:   #14291F;

  --bad:      #E4695A;
  --bad-w:    #2E1815;

  --shadow: 0 1px 2px rgba(0,0,0,.3);
  --lift: 0 1px 3px rgba(0,0,0,.35), 0 6px 16px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; }

h1, h2, h3, h4 {
  font-weight: 650; margin: 0;
  letter-spacing: -.015em; line-height: 1.2;
}

.legend {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }

/* ==================================================================
   Chassis
   ================================================================== */

.chassis {
  position: sticky; top: 0; z-index: 40;
  background: var(--paper);
  border-bottom: 1px solid var(--hair);
}

.chassis-in {
  max-width: 1060px; margin: 0 auto;
  padding: 0 22px; height: 60px;
  display: flex; align-items: center; gap: 18px;
}

.brand {
  display: flex; align-items: center; gap: 9px;
  font-size: 15px; font-weight: 650;
  background: none; border: 0; padding: 0; cursor: pointer;
  letter-spacing: -.01em;
}
.brand:hover { color: var(--accent); }

.brand-mark {
  width: 15px; height: 15px; flex: none;
  border: 1.5px solid var(--accent); border-radius: 50%;
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 3.5px;
  background: var(--accent); border-radius: 50%;
}

.tabs { display: flex; gap: 3px; margin-left: auto; }

.tab {
  background: none; border: 0; cursor: pointer;
  padding: 7px 13px; border-radius: var(--r);
  font-size: 14px; color: var(--muted);
}
.tab:hover { color: var(--ink); background: var(--well); }
.tab[aria-current="true"] { color: var(--accent); background: var(--accent-w); font-weight: 600; }

.readout { font-size: 13px; color: var(--muted); display: flex; align-items: baseline; gap: 5px; }
.readout b { color: var(--ink); font-size: 15px; font-weight: 650; }

.themebtn {
  background: none; border: 1px solid var(--hair); border-radius: 100px;
  width: 30px; height: 30px; cursor: pointer; padding: 0;
  display: grid; place-items: center; font-size: 13px; color: var(--muted);
}
.themebtn:hover { border-color: var(--accent); color: var(--accent); }

/* ==================================================================
   Layout
   ================================================================== */

main { max-width: 1060px; margin: 0 auto; padding: 34px 22px 100px; }

.view { animation: rise .28s cubic-bezier(.2,.7,.3,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.eyebrow {
  font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 8px;
}

.lede { color: var(--ink-2); max-width: 60ch; margin: 10px 0 0; }

.rule { height: 1px; background: var(--hair); border: 0; margin: 34px 0; }

/* ==================================================================
   Console
   ================================================================== */

.console-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 26px; flex-wrap: wrap; margin-bottom: 28px;
}
.console-head h1 { font-size: 30px; max-width: 22ch; }
.console-head > div:first-child { flex: 1 1 400px; }

.bigmeter { text-align: right; }
.bigmeter .n {
  font-size: 32px; font-weight: 650;
  line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums;
}
.bigmeter .n small { font-size: 17px; color: var(--faint); font-weight: 400; }
.bigmeter .legend { margin-top: 4px; }

.rails { display: grid; gap: 4px; }

.rail {
  display: grid; grid-template-columns: 156px 1fr auto;
  gap: 16px; align-items: center;
  padding: 13px 16px;
  background: var(--card);
  border: 1px solid var(--hair-2);
  border-radius: var(--r);
  cursor: pointer; text-align: left; width: 100%;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.rail:hover { border-color: var(--accent); background: var(--accent-w); }
.rail:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.rail-name { font-size: 15px; font-weight: 600; }
.rail-name span { display: block; }
.rail-name .legend { margin-top: 2px; font-weight: 500; }

.nodes { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

.node {
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--well);
  border: 1px solid var(--hair);
  flex: none;
}
.node[data-heat="1"] { background: var(--well); border-color: var(--gold); }
.node[data-heat="2"] { background: var(--accent-w); border-color: var(--accent); }
.node[data-heat="3"] { background: var(--accent); border-color: var(--accent); }

.arrowlink { width: 9px; height: 1px; background: var(--hair); flex: none; position: relative; }
.arrowlink::after {
  content: ""; position: absolute; right: -1px; top: -2px;
  border-left: 4px solid var(--hair);
  border-top: 2.5px solid transparent; border-bottom: 2.5px solid transparent;
}
.arrowlink.rev::before {
  content: ""; position: absolute; left: -1px; top: -2px;
  border-right: 4px solid var(--hair);
  border-top: 2.5px solid transparent; border-bottom: 2.5px solid transparent;
}

.rail-pct {
  font-size: 14px;
  color: var(--muted); font-variant-numeric: tabular-nums;
  min-width: 38px; text-align: right;
}

.aagrid { display: flex; flex-wrap: wrap; gap: 6px; }

.aacell {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 600;
  background: var(--card); color: var(--faint);
  border: 1px solid var(--hair-2); border-radius: var(--r);
  cursor: pointer; padding: 0;
  transition: transform .13s, border-color .13s;
}
.aacell:hover { border-color: var(--accent); color: var(--ink); }
.aacell[data-heat="1"] { color: var(--ink); border-color: var(--gold); }
.aacell[data-heat="2"] { color: var(--ink); background: var(--gold-w); border-color: var(--gold); }
.aacell[data-heat="3"] { color: #fff; background: var(--accent); border-color: var(--accent); }

/* ==================================================================
   Buttons
   ================================================================== */

.start {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--accent); color: #fff;
  border: 1px solid var(--accent); border-radius: var(--r);
  padding: 11px 18px; cursor: pointer;
  font-size: 15px; font-weight: 550;
  transition: background .12s;
}
.start:hover { background: var(--accent-2); border-color: var(--accent-2); }
.start:active { transform: translateY(1px); }
.start:disabled { opacity: .4; cursor: default; transform: none; }
.start kbd {
  font-family: var(--font-mono); font-size: 10px;
  border: 1px solid currentColor; border-radius: 3px;
  padding: 1px 5px; opacity: .65;
}

.start.ghost { background: none; color: var(--ink); border-color: var(--hair); }
.start.ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-w); }

.startrow { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.panelcard {
  background: var(--card); border: 1px solid var(--hair-2);
  border-radius: var(--r); padding: 22px;
  text-align: left; cursor: default;
}

kbd.kb {
  font-family: var(--font-mono); font-size: 10.5px;
  border: 1px solid var(--hair); border-radius: 3px;
  padding: 1px 5px; margin-left: 3px; color: var(--faint);
}

/* --- activity cards on a pathway page --- */

.acts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.act {
  display: grid; gap: 6px; align-content: start;
  background: var(--card); border: 1px solid var(--hair);
  border-radius: var(--r); padding: 20px; cursor: pointer; text-align: left;
  transition: border-color .14s, transform .14s, background .14s;
}
.act:hover { border-color: var(--accent); background: var(--accent-w); }
.act:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.act-k { font-size: 17px; font-weight: 600; }
.act-d { color: var(--muted); font-size: 14px; line-height: 1.45; }
.act-go { color: var(--accent); font-size: 14px; font-weight: 600; margin-top: 4px; }

.act.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.act.primary .act-d { color: rgba(255,255,255,.8); }
.act.primary .act-go { color: #fff; }
.act.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }

/* --- fill-in-the-blanks toolbar --- */

.filltools {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding-bottom: 16px; margin-bottom: 22px;
  border-bottom: 1px solid var(--hair);
}
.filltools-r { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.seg {
  display: inline-flex; background: var(--well);
  border: 1px solid var(--hair); border-radius: 100px; padding: 3px;
}
.seg-b {
  background: none; border: 0; cursor: pointer;
  padding: 6px 14px; border-radius: 100px;
  font-size: 13.5px; color: var(--muted); white-space: nowrap;
}
.seg-b:hover { color: var(--ink); }
.seg-b[aria-pressed="true"] {
  background: var(--card); color: var(--accent); font-weight: 600;
  box-shadow: var(--shadow);
}
.seg-b:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.start.sm { padding: 9px 16px; font-size: 14px; }

.trayhead {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 14px; margin-bottom: 9px; flex-wrap: wrap;
}
.traystat { font-size: 13px; color: var(--muted); }
.traystat b { font-size: 15px; font-weight: 650; color: var(--ink); }
.traystat i { color: var(--bad); font-style: normal; }

.shakeit { animation: shake .42s cubic-bezier(.36,.07,.19,.97); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

button.panelcard { transition: border-color .13s, transform .13s; cursor: pointer; }
button.panelcard:hover { border-color: var(--accent); background: var(--accent-w); }

/* ==================================================================
   Drill
   ================================================================== */

.drillbar { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }

.flux { flex: 1; height: 5px; background: var(--well); border-radius: 3px; overflow: hidden; }
.flux i {
  display: block; height: 100%; width: 0%;
  background: var(--accent); border-radius: 3px;
  transition: width .36s cubic-bezier(.2,.7,.3,1);
}

.combo { font-size: 13px; color: var(--muted); display: flex; align-items: baseline; gap: 6px; }
.combo b { font-size: 17px; font-weight: 650; color: var(--ink); }
.combo.hot b { color: var(--gold); }
.combo.hot { animation: pop .32s cubic-bezier(.2,.9,.3,1); }
@keyframes pop { 40% { transform: scale(1.15); } }

.qcard {
  background: var(--card); border: 1px solid var(--hair-2);
  border-radius: var(--r); padding: 30px; box-shadow: var(--shadow);
}

.qprompt { font-size: 20px; font-weight: 550; line-height: 1.4; margin: 0 0 22px; }
.qprompt b { font-weight: 600; color: var(--accent); }

.qstage {
  background: var(--well); border-radius: var(--r);
  padding: 20px; margin-bottom: 20px;
  display: grid; place-items: center; min-height: 190px;
}

.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.opts.one { grid-template-columns: 1fr; }

.opt {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--hair); border-radius: var(--r);
  padding: 14px 16px; cursor: pointer; text-align: left;
  transition: border-color .12s, background .12s, transform .1s;
  min-height: 52px;
}
.opt:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-w); }
.opt:active:not(:disabled) { transform: scale(.99); }
.opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.opt:disabled { cursor: default; }

.opt kbd {
  font-family: var(--font-mono); font-size: 10.5px;
  width: 20px; height: 20px; flex: none;
  display: grid; place-items: center;
  background: var(--well); border-radius: 3px; color: var(--muted);
}
.opt .sub { color: var(--muted); font-size: 13.5px; margin-left: 5px; }

.opts.mols .opt { align-items: stretch; padding: 11px 13px; min-height: 136px; }
.opts.mols .opt > span { flex: 1; display: grid; place-items: center; min-width: 0; }
.opts.mols .mol { max-height: 118px; max-width: 190px; }

.opt.right {
  border-color: var(--good); background: var(--good-w);
  animation: snap .32s cubic-bezier(.2,.9,.3,1);
}
.opt.right kbd { background: var(--good); color: #fff; }
@keyframes snap { 40% { transform: scale(1.02); } }

.opt.wrong { border-color: var(--bad); background: var(--bad-w); animation: shake .34s; }
.opt.wrong kbd { background: var(--bad); color: #fff; }
@keyframes shake {
  20% { transform: translateX(-5px); } 45% { transform: translateX(4px); }
  70% { transform: translateX(-2px); } 100% { transform: translateX(0); }
}
.opt.dim { opacity: .4; }

.fb {
  margin-top: 18px; padding: 18px 20px;
  border-left: 3px solid var(--good);
  background: var(--good-w); border-radius: 0 var(--r) var(--r) 0;
  animation: slidein .22s cubic-bezier(.2,.7,.3,1) both;
}
.fb.bad { border-left-color: var(--bad); background: var(--bad-w); }
@keyframes slidein { from { opacity: 0; transform: translateY(-5px); } }

.fb-head {
  font-size: 13px; color: var(--good); margin-bottom: 8px; font-weight: 600;
}
.fb.bad .fb-head { color: var(--bad); }
.fb p { margin: 0 0 9px; }
.fb p:last-child { margin-bottom: 0; }
.fb .tell { font-size: 14.5px; color: var(--ink-2); }

.facts {
  display: flex; flex-wrap: wrap; gap: 4px 28px;
  margin: 14px 0 0; padding-top: 14px;
  border-top: 1px solid rgba(130,120,105,.22);
}
.fact .legend { display: block; font-weight: 500; }
.fact b { font-size: 15px; font-weight: 600; }

.next {
  width: 100%; margin-top: 18px;
  background: var(--accent); color: #fff;
  border: 0; border-radius: var(--r); padding: 13px;
  font-size: 15px; font-weight: 550; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.next:hover { background: var(--accent-2); }
.next kbd {
  font-family: var(--font-mono); font-size: 10px; opacity: .6;
  border: 1px solid currentColor; border-radius: 3px; padding: 1px 5px;
}

.summary { text-align: center; padding: 40px 20px; }
.summary .score {
  font-size: 52px; font-weight: 650;
  color: var(--ink); line-height: 1; font-variant-numeric: tabular-nums;
}
.summary .score small { font-size: 22px; color: var(--faint); }
.summary h2 { font-size: 28px; margin: 16px 0 6px; }

.deltas { display: grid; gap: 6px; max-width: 470px; margin: 26px auto 0; text-align: left; }
.delta {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px; background: var(--card);
  border: 1px solid var(--hair-2); border-radius: var(--r); font-size: 14.5px;
}
.delta .up { color: var(--good); font-size: 12.5px; margin-left: auto; font-weight: 600; }
.delta .down { color: var(--bad); font-size: 12.5px; margin-left: auto; font-weight: 600; }

/* ==================================================================
   State Board
   ================================================================== */

.brief {
  background: var(--card); border: 1px solid var(--hair-2);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--r) var(--r) 0;
  padding: 22px 24px; margin-bottom: 24px;
}
.brief h2 { font-size: 25px; margin-bottom: 7px; }
.brief .vitals { font-size: 13.5px; color: var(--muted); margin: 8px 0 11px; }
.brief p { margin: 0; color: var(--ink-2); }

.tissue {
  display: inline-block; margin-left: 9px; font-size: 12px; font-weight: 500;
  background: var(--well); color: var(--muted);
  padding: 2px 8px; border-radius: var(--r); vertical-align: middle;
}

.switchgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.sw {
  display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center;
  background: var(--card); border: 1px solid var(--hair);
  border-radius: var(--r); padding: 13px 16px;
  cursor: pointer; text-align: left; width: 100%;
  transition: border-color .12s, background .12s;
}
.sw:hover { border-color: var(--accent); }
.sw:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.led {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--well); border: 1px solid var(--hair);
  flex: none; transition: background .16s, box-shadow .16s;
}
.sw[aria-pressed="true"] { border-color: var(--gold); background: var(--gold-w); }
.sw[aria-pressed="true"] .led {
  background: var(--gold-2); border-color: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}

.sw-name { font-size: 15px; font-weight: 600; }
.sw-does { color: var(--muted); font-size: 13px; }

.swgroup { margin: 20px 0 8px; }
.swgroup:first-child { margin-top: 0; }

.meters { display: grid; gap: 16px; }
.meter-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.meter-val { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.meter-bar { height: 8px; background: var(--well); border-radius: 5px; overflow: hidden; }
.meter-bar i { display: block; height: 100%; border-radius: 5px; transition: width .5s cubic-bezier(.2,.7,.3,1); }
.meter-bar i.good { background: var(--good); }
.meter-bar i.warn { background: var(--gold); }
.meter-bar i.bad  { background: var(--bad); }

.trace { width: 100%; height: auto; display: block; }
.trace .band { fill: var(--good-w); }
.trace .line { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.trace .axis { stroke: var(--hair); stroke-width: 1; }
.trace .danger { stroke: var(--bad); stroke-width: 1; stroke-dasharray: 3 4; opacity: .6; }
.trace text { font-family: var(--font-body); font-size: 9.5px; fill: var(--faint); }
.trace text.dngr { fill: var(--bad); }
.trace .dot { fill: var(--accent); }

.verdict {
  padding: 14px 18px; border-radius: var(--r);
  font-size: 16px; font-weight: 600;
  margin-bottom: 20px;
}
.verdict.good { background: var(--good-w); color: var(--good); }
.verdict.warn { background: var(--gold-w); color: var(--gold); }
.verdict.bad  { background: var(--bad-w); color: var(--bad); }

.event {
  padding: 15px 18px; margin-bottom: 8px;
  border-left: 3px solid var(--bad);
  background: var(--bad-w); border-radius: 0 var(--r) var(--r) 0;
}
.event.warn { border-left-color: var(--gold); background: var(--gold-w); }
.event h4 { font-size: 16px; margin: 0 0 5px; }
.event p { margin: 0; font-size: 14px; color: var(--ink-2); }

.teaches { background: var(--well); border-radius: var(--r); padding: 20px 22px; margin-top: 20px; }
.teaches p { margin: 0; font-size: 15px; }

.scnlist { display: grid; gap: 8px; }
.scnrow {
  display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center;
  background: var(--card); border: 1px solid var(--hair-2);
  border-radius: var(--r); padding: 16px 18px;
  cursor: pointer; text-align: left; width: 100%;
  transition: border-color .13s, transform .13s;
}
.scnrow:hover { border-color: var(--accent); }
.scnrow h3 { font-size: 18px; margin-bottom: 4px; }
.scnrow .vitals { font-size: 13px; color: var(--muted); }
.scnrow .done { font-size: 13px; color: var(--good); font-weight: 600; }

/* ==================================================================
   Build mode
   ================================================================== */

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

.pill {
  background: var(--card); border: 1px solid var(--hair);
  border-radius: 100px; padding: 8px 16px; cursor: pointer;
  font-size: 14px; transition: border-color .12s, background .12s, color .12s;
}
.pill:hover { border-color: var(--accent); }
.pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pill[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.bchain { display: grid; gap: 0; justify-items: start; }

.bcell {
  background: var(--card); border: 1px solid var(--hair-2);
  border-radius: var(--r); padding: 10px 16px;
  font-size: 15.5px; min-width: 230px;
}

.bstep { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; padding: 8px 0 8px 24px; position: relative; }
.barrow { position: absolute; left: 9px; top: 0; bottom: 0; width: 1px; background: var(--hair); }
.barrow::after {
  content: ""; position: absolute; left: -3px; bottom: 0;
  border-top: 5px solid var(--hair);
  border-left: 3.5px solid transparent; border-right: 3.5px solid transparent;
}
.barrow.rev::before {
  content: ""; position: absolute; left: -3px; top: 0;
  border-bottom: 5px solid var(--hair);
  border-left: 3.5px solid transparent; border-right: 3.5px solid transparent;
}

.benz { font-size: 14px; color: var(--accent); display: inline-block; font-weight: 500; }

.bout {
  display: inline-block; font-size: 12.5px; font-weight: 600;
  letter-spacing: .02em; color: var(--gold);
  background: var(--gold-w); border: 1px solid var(--gold-w);
  border-radius: 100px; padding: 4px 11px;
}
.bout.slot {
  border: 1px dashed var(--faint); background: var(--well);
  color: var(--muted); min-width: 150px; padding: 5px 12px;
}
.bout.slot.filled { border-style: solid; border-color: var(--gold); background: var(--gold-w); color: var(--gold); }
.bout.slot.ok { border-style: solid; border-color: var(--good); background: var(--good-w); color: var(--good); }
.bout.slot.no { border-style: solid; border-color: var(--bad); background: var(--bad-w); color: var(--bad); }
.bout.slot input, .bout.slot select { font-size: 12.5px; min-width: 130px; }

/* molecules drawn instead of named */
.molface { display: block; }
.molface .mol { max-height: 96px; max-width: 150px; }
.bcell .molface .mol { max-height: 104px; }
.tile.struct { padding: 6px 10px; }
.tile.struct .mol { max-height: 74px; max-width: 110px; }
.tile.out { color: var(--gold); border-color: var(--gold-w); background: var(--gold-w); }
.tile.enz { color: var(--accent); }

.traytools {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--hair);
}

.slot { position: relative; }
.bcell.slot, .benz.slot { border: 1px dashed var(--faint); background: var(--well); }
.benz.slot { padding: 8px 14px; border-radius: var(--r); min-width: 200px; }

.slot .ph { color: var(--faint); font-style: italic; font-size: 13.5px; }
.slot.filled { border-style: solid; border-color: var(--accent); background: var(--accent-w); }
.bcell.slot.drop, .benz.slot.drop { cursor: pointer; }
.slot.over { border-color: var(--gold); background: var(--gold-w); }
.slot.ok { border-style: solid; border-color: var(--good); background: var(--good-w); }
.slot.no { border-style: solid; border-color: var(--bad); background: var(--bad-w); }

.slot .reveal {
  display: block; font-style: normal; font-size: 14px;
  color: var(--bad); font-weight: 600; margin-top: 2px;
}

.slot input, .slot select {
  font: inherit; background: none; border: 0; color: var(--ink);
  width: 100%; min-width: 190px; padding: 0; outline: none;
}
.slot input::placeholder { color: var(--faint); font-style: italic; font-size: 13.5px; }
.slot select { cursor: pointer; }
.benz.slot input, .benz.slot select { font-size: 14px; color: var(--accent); }

.tray {
  position: sticky; bottom: 0; z-index: 20;
  background: var(--card); border: 1px solid var(--hair);
  border-radius: var(--r); padding: 16px 18px; box-shadow: var(--lift);
}
.tiles { display: flex; flex-wrap: wrap; gap: 7px; }

.tile {
  background: var(--paper); border: 1px solid var(--hair);
  border-radius: var(--r); padding: 8px 14px; cursor: grab;
  font-size: 14px; transition: transform .1s, border-color .12s;
}
.tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.tile:active { cursor: grabbing; }
.tile.armed { border-color: var(--gold); background: var(--gold-w); box-shadow: 0 0 0 3px var(--gold-w); }
.tile.used { opacity: .28; cursor: default; text-decoration: line-through; }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sortsource {
  display: flex; flex-wrap: wrap; gap: 8px;
  background: var(--well); border-radius: var(--r);
  padding: 14px; margin-bottom: 22px; min-height: 92px;
}
.structile {
  background: var(--card); border: 1px solid var(--hair);
  border-radius: var(--r); padding: 7px; cursor: grab;
  display: grid; justify-items: center; gap: 3px; width: 106px;
}
.structile:hover { border-color: var(--accent); }
.structile.armed { border-color: var(--gold); background: var(--gold-w); }
.structile .mol { max-height: 76px; max-width: 88px; }

.buckets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; }
.bucket {
  background: var(--card); border: 1px dashed var(--hair);
  border-radius: var(--r); padding: 13px; min-height: 136px;
}
.bucket.over { border-color: var(--gold); background: var(--gold-w); }
.bucket-in { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }

.chiptile {
  background: var(--well); border: 1px solid var(--hair);
  border-radius: var(--r); padding: 5px 9px; cursor: pointer; font-size: 13px;
}
.chiptile.ok { border-color: var(--good); background: var(--good-w); color: var(--good); }
.chiptile.no { border-color: var(--bad); background: var(--bad-w); color: var(--bad); }
.chiptile em { font-style: normal; font-size: 11px; opacity: .85; }

/* ==================================================================
   Reference
   ================================================================== */

.stepr { display: grid; grid-template-columns: 28px 1fr; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--hair-2); }
.stepn { font-size: 13px; color: var(--faint); padding-top: 3px; }

.rxn { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mol-name { font-size: 16px; }
.arrow { position: relative; width: 44px; height: 12px; flex: none; color: var(--muted); }
.arrow::before { content: ""; position: absolute; top: 5px; left: 0; right: 0; height: 1px; background: currentColor; }
.arrow::after {
  content: ""; position: absolute; right: 0; top: 2px;
  border-left: 6px solid currentColor;
  border-top: 3.5px solid transparent; border-bottom: 3.5px solid transparent;
}
.arrow.rev::before { top: 3px; }
.arrow.rev i { position: absolute; left: 0; top: 6px; right: 0; height: 1px; background: currentColor; }
.arrow.rev i::after {
  content: ""; position: absolute; left: 0; top: -3px;
  border-right: 6px solid currentColor;
  border-top: 3.5px solid transparent; border-bottom: 3.5px solid transparent;
}

.enz { font-size: 14.5px; color: var(--accent); font-weight: 600; }

.chip {
  font-size: 11.5px; font-weight: 500;
  padding: 2px 8px; border-radius: var(--r); vertical-align: middle;
}
.chip.rls { background: var(--bad); color: #fff; }
.chip.reg { background: var(--gold-w); color: var(--gold); border: 1px solid var(--gold); }
.chip.x2  { background: var(--good-w); color: var(--good); border: 1px solid var(--good); }
.chip.yield { background: var(--well); color: var(--muted); }

.stepnote { color: var(--muted); font-size: 14px; margin: 7px 0 0; max-width: 72ch; }

.mnem { display: inline-block; font-size: 13px; color: var(--muted); }

.mnembar { background: var(--well); border-radius: var(--r); padding: 14px 16px; margin: 14px 0 20px; }
.mnembar .phrase { font-size: 17px; color: var(--ink); font-weight: 600; margin-top: 3px; }

table.ref { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.ref th {
  text-align: left; padding: 9px 14px 9px 0;
  font-size: 12.5px; color: var(--muted);
  border-bottom: 1px solid var(--hair); font-weight: 600;
}
table.ref td { padding: 11px 14px 11px 0; border-bottom: 1px solid var(--hair-2); vertical-align: top; }
table.ref tr:hover td { background: var(--card); }
.tblwrap { overflow-x: auto; }

.aadetail { display: grid; grid-template-columns: 230px 1fr; gap: 28px; align-items: start; }
.aadetail .qstage { min-height: 220px; margin: 0; }

.tag {
  display: inline-block; font-size: 12.5px; font-weight: 500;
  padding: 3px 9px; border-radius: var(--r); margin: 0 5px 5px 0;
  background: var(--well); color: var(--muted);
}
.tag.on { background: var(--good); color: #fff; }

/* ==================================================================
   Molecules
   ================================================================== */

.mol { width: 100%; max-width: 250px; height: auto; max-height: 224px; overflow: visible; }
.mol line { stroke-linecap: round; }
.mol .bb { stroke: var(--faint); stroke-width: .055; }
.mol .sc { stroke: var(--accent); stroke-width: .075; }
.mol .lbl { font-family: var(--font-body); font-size: .38px; text-anchor: middle; dominant-baseline: central; }
.mol .bb-lbl { fill: var(--faint); }
.mol .sc-lbl { fill: var(--accent); font-weight: 600; }
.mol.plain .sc { stroke: var(--ink-2); }
.mol.plain .sc-lbl { fill: var(--ink-2); }

/* ==================================================================
   Misc
   ================================================================== */

.empty { text-align: center; padding: 54px 20px; color: var(--muted); }

.linkish {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--accent); font: inherit; text-decoration: underline;
  text-underline-offset: 3px;
}

.kbdhint { font-size: 13px; color: var(--faint); text-align: center; margin-top: 18px; }
.kbdhint kbd {
  font-family: var(--font-mono); font-size: 11px;
  border: 1px solid var(--hair); border-radius: 3px; padding: 1px 5px; margin: 0 1px;
}

.backlink {
  background: none; border: 0; cursor: pointer; padding: 0;
  font-size: 13px; color: var(--muted); margin-bottom: 20px;
}
.backlink:hover { color: var(--accent); }

/* ==================================================================
   Responsive
   ================================================================== */

@media (max-width: 820px) {
  .grid2, .grid3, .switchgrid, .aadetail, .acts { grid-template-columns: 1fr; }
  .opts { grid-template-columns: 1fr; }
  .buckets { grid-template-columns: repeat(2, 1fr); }
  .rail { grid-template-columns: 1fr auto; }
  .rail .nodes { grid-column: 1 / -1; }
  .console-head h1 { font-size: 30px; }
  .chassis-in { gap: 10px; padding: 0 15px; }
  .tab { padding: 7px 9px; font-size: 13px; }
  main { padding: 24px 15px 80px; }
  .qcard { padding: 20px; }
  .qprompt { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* --- node key, clock, quiz options -------------------------------- */

.nodekey {
  display: flex; gap: 18px; margin-top: 14px;
  font-size: 13px; color: var(--muted);
}
.nodekey span { display: inline-flex; align-items: center; gap: 6px; }

.clock {
  font-size: 15px; font-weight: 600;
  color: var(--muted); font-variant-numeric: tabular-nums; min-width: 40px; text-align: right;
}
.clock.low { color: var(--bad); }

.ptools {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  justify-content: center; margin-top: 26px;
  padding-top: 18px; border-top: 1px solid var(--hair);
}

.reviewlist { display: grid; gap: 8px; max-width: 720px; margin: 26px auto 0; text-align: left; }
.reviewq {
  background: var(--card); border: 1px solid var(--hair-2);
  border-left: 3px solid var(--good); border-radius: 0 var(--r) var(--r) 0;
  padding: 14px 16px;
}
.reviewq.bad { border-left-color: var(--bad); }
.reviewq h4 { font-size: 15px; margin: 0 0 6px; font-weight: 600; }
.reviewq p { margin: 0; font-size: 14px; color: var(--ink-2); }
.reviewq .yours { color: var(--bad); font-size: 13.5px; margin-top: 5px; }
.reviewq .theirs { color: var(--good); font-size: 13.5px; font-weight: 600; }

.traytools-r { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
@media (max-width: 820px) { .traytools-r { margin-left: 0; } }

.catrow {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  justify-content: center; margin-top: 24px;
  padding-top: 18px; border-top: 1px solid var(--hair);
}
.pill.sm { padding: 5px 12px; font-size: 13px; }
.ptools { border-top: 0; padding-top: 10px; margin-top: 10px; }

/* --- daily quiz --------------------------------------------------- */

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

.dcard {
  display: grid; gap: 3px; align-content: start; text-align: left;
  background: var(--card); border: 1px solid var(--hair);
  border-radius: var(--r); padding: 16px 18px; min-height: 104px;
}
button.dcard { cursor: pointer; transition: border-color .13s, background .13s; }
button.dcard:hover { border-color: var(--accent); background: var(--accent-w); }
button.dcard:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.dcard-t { font-size: 15px; font-weight: 600; }
.dcard-s { font-size: 27px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.15; }
.dcard-s.open { color: var(--accent); }
.dcard-n { font-size: 13px; color: var(--muted); }

.dcard.done { background: var(--well); }
.dcard.done.good .dcard-s { color: var(--good); }
.dcard.done.warn .dcard-s { color: var(--gold); }
.dcard.done.bad  .dcard-s { color: var(--bad); }

.dtotal {
  margin-top: 18px; padding: 15px 18px;
  background: var(--well); border-radius: var(--r); font-size: 15px;
}

@media (max-width: 820px) { .dgrid { grid-template-columns: repeat(2, 1fr); } }

/* ==================================================================
   Mobile
   ================================================================== */

.refnav { margin: 0 0 22px; }
.reftabs { margin: 0; flex-wrap: wrap; }
.refselect { display: none; }
.refselect select {
  width: 100%; margin-top: 5px; padding: 11px 12px;
  font: inherit; color: var(--ink);
  background: var(--card); border: 1px solid var(--hair);
  border-radius: var(--r);
}

@media (max-width: 820px) {
  /* --- header: never wrap or overflow --- */
  .chassis-in { height: auto; min-height: 54px; padding: 9px 13px; gap: 10px; }
  .brand { font-size: 15px; white-space: nowrap; flex: none; }
  .readout { display: none; }
  .tabs { margin-left: auto; gap: 1px; }
  .tab { padding: 7px 9px; font-size: 13px; white-space: nowrap; }
  .themebtn { flex: none; }

  /* --- reference: tabs become a dropdown --- */
  .reftabs { display: none; }
  .refselect { display: block; }

  /* --- fill in the blanks: keep the pathway visible --- */
  .tray { padding: 12px 13px; }
  .tiles { max-height: 30vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .tile { padding: 9px 12px; font-size: 13.5px; }
  /* the toggles live on the setup page on small screens, so the tray
     stays short enough to see the pathway above it */
  .traytools { gap: 8px; padding-top: 10px; margin-top: 10px; }
  .traytools .seg { display: none; }
  .traytools-r { width: 100%; margin-left: 0; }
  .traytools-r .start { flex: 1 1 auto; justify-content: center; padding: 9px 12px; }
  .bchain { justify-items: stretch; }
  .bcell, .benz, .bout { max-width: 100%; }
  .bcell { min-width: 0; width: 100%; }
  .benz.slot, .bout.slot { min-width: 0; width: 100%; }
  .slot input, .slot select { min-width: 0; }
  .bstep { padding-left: 18px; gap: 8px; }
  .structile { width: calc(33.333% - 6px); }
  .structile .mol { max-height: 62px; }

  /* --- quiz --- */
  .drillbar { gap: 10px; }
  .qcard { padding: 16px 15px; }
  .qprompt { font-size: 18px; }
  .ptools, .catrow { gap: 8px; }
  .ptools .seg { flex: 1 1 100%; justify-content: center; }
  .qstage { padding: 14px; min-height: 150px; }

  /* --- pathway + daily --- */
  .console-head { gap: 14px; }
  .console-head h1 { font-size: 26px; }
  .bigmeter { text-align: left; }
  .acts { gap: 8px; }
  .act { padding: 16px; }
  .facts { gap: 4px 20px; }
}

@media (max-width: 430px) {
  main { padding: 18px 12px 70px; }
  .brand { font-size: 0; gap: 0; }          /* mark only, name is redundant with the tab bar */
  .brand-mark { width: 18px; height: 18px; }
  .tab { padding: 7px 7px; font-size: 12px; }
  .dgrid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .dcard { padding: 13px 14px; min-height: 92px; }
  .dcard-s { font-size: 23px; }
  .opt { padding: 13px 13px; min-height: 48px; }
  .structile { width: calc(50% - 5px); }
}

/* ==================================================================
   Cycle layout (TCA)
   ================================================================== */

.cycwrap { margin-bottom: 30px; }

.cyc {
  position: relative;
  width: 100%; max-width: 620px; margin: 0 auto;
  aspect-ratio: 1 / 1;
}

.cyc-ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.cyc-circle { fill: none; stroke: var(--hair); stroke-width: 1.6; }
.cyc-head { fill: var(--faint); }

.cyc-hub {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 30%; text-align: center; display: grid; gap: 5px;
}
.cyc-hub b { font-size: 13px; color: var(--accent); }
.cyc-hub span { font-size: 12.5px; color: var(--muted); line-height: 1.35; }

.cyc-node {
  position: absolute; transform: translate(-50%, -50%);
  width: 140px; display: grid; gap: 4px; justify-items: center;
  background: var(--paper); padding: 4px; border-radius: var(--r);
}
.cyc-node .bcell { min-width: 0; width: 100%; text-align: center; padding: 7px 8px; font-size: 13px; }
.cyc-enz { display: grid; gap: 3px; justify-items: center; width: 100%; }
.cyc-enz .benz { font-size: 11.5px; text-align: center; line-height: 1.3; }
.cyc-enz .benz.slot { min-width: 0; width: 100%; padding: 5px 7px; }
.cyc-enz .bout { font-size: 11px; padding: 2px 8px; }
.cyc-enz .bout.slot { min-width: 0; width: 100%; }
.cyc-node .chip { font-size: 10.5px; padding: 1px 6px; }
.cyc-node .slot .reveal { font-size: 12px; }

.cyc-fallback { display: none; }

@media (max-width: 900px) {
  .cyc { display: none; }
  .cyc-fallback { display: grid; }
}

/* --- draggable tile panel ----------------------------------------- */

.tray-grip {
  height: 20px; margin: -8px 0 4px; cursor: ns-resize;
  display: grid; place-items: center; touch-action: none;
}
.tray-grip::before {
  content: ""; width: 44px; height: 4px; border-radius: 3px;
  background: var(--hair); transition: background .12s;
}
.tray-grip:hover::before, .tray-grip:active::before { background: var(--accent); }

.confetti-layer {
  position: fixed; inset: 0; z-index: 60;
  pointer-events: none;
}
