/* EnCode DeCodex · styles
   Deep laboratory navy, one colour per base.
   Controls: Material 3 style round icon buttons on frosted glass. */
:root {
  --bg: #060a14;
  --bg2: #0b1120;
  --panel: #0d1426;
  --card: #111a30;
  --line: #1d2a47;
  --line-hi: #2c3d66;
  --ink: #e6ecf8;
  --mid: #9aa8c4;
  --dim: #66769a;

  --coding: #8fa7ff;
  --template: #5eead4;
  --mrna: #c084fc;
  --A: #22c55e;
  --T: #ef4444;
  --G: #f59e0b;
  --C: #3b82f6;
  --U: #f472b6;
  --accent: #7c9cff;

  --r: 14px;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Sans', system-ui, sans-serif; /* one family everywhere */
}
* { box-sizing: border-box; min-width: 0; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent); }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px clamp(12px, 2vw, 24px);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #0b1122, #080d1a);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 38px; height: 38px; flex: none; }
.brand h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.brand p { margin: 0; font-size: 13px; color: var(--mid); }

.model-switch {
  display: flex; gap: 4px; padding: 4px; border-radius: 12px;
  background: var(--bg2); border: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
}
.model-switch button {
  border: 0; background: transparent; color: var(--mid);
  padding: 9px 14px; border-radius: 9px; font-weight: 500; font-size: 14px;
  white-space: nowrap; min-height: 40px; transition: background .2s, color .2s;
}
.model-switch button:hover { color: var(--ink); background: #141f39; }
.model-switch button.on { background: #1b2a52; color: #fff; box-shadow: inset 0 0 0 1px var(--line-hi); }
.model-switch button:focus-visible, .tool:focus-visible, .tab:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ---------- layout ---------- */
.layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 390px;
  height: calc(100vh - 61px); min-height: 560px;
}
.stage {
  position: relative; overflow: hidden;
  background:
    radial-gradient(ellipse 60% 55% at 50% 45%, rgba(124,156,255,.10), transparent 70%),
    radial-gradient(ellipse 90% 80% at 50% 120%, rgba(94,234,212,.06), transparent 60%),
    var(--bg);
}
#canvas-host { position: absolute; inset: 0; touch-action: none; }
#canvas-host canvas { display: block; }
.label-layer { position: absolute; inset: 0; pointer-events: none; }

.stage-head { position: absolute; top: 14px; left: 16px; pointer-events: none; }
.view-name { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; }
.view-name .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--template); box-shadow: 0 0 10px var(--template); }
.view-sub { font-size: 13px; color: var(--mid); margin-top: 2px; }

/* ---------- toolbar ---------- */
.toolbar {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  display: flex; gap: 4px; padding: 5px; border-radius: 14px;
  background: rgba(11,17,32,.86); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  max-width: calc(100% - 20px); overflow-x: auto; scrollbar-width: none;
}
.tool {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-width: 62px; min-height: 52px; padding: 6px 8px;
  border: 0; border-radius: 10px; background: transparent; color: var(--mid);
  font-size: 12px; font-weight: 500; transition: background .2s, color .2s;
}
.tool svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool:hover { background: #16213d; color: var(--ink); }
.tool.on { background: #1b2a52; color: #fff; }
.tool.accent { color: #d8b4fe; }
.tool.accent.on { background: linear-gradient(135deg, #7c3aed, #a855f7); color: #fff; }
.tool[disabled] { opacity: .3; pointer-events: none; }

/* ---------- overlays ---------- */
.legend {
  position: absolute; left: 16px; bottom: 86px;
  display: grid; gap: 5px; padding: 10px 12px; border-radius: 12px;
  background: rgba(11,17,32,.78); border: 1px solid var(--line);
  font-size: 12.5px; color: var(--mid); pointer-events: none;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  max-width: 240px;
}
.legend .row { display: flex; align-items: center; gap: 8px; }
.legend .sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.legend .ln { width: 18px; height: 4px; border-radius: 2px; flex: none; }
.legend .ball { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.legend .ttl { font-weight: 600; color: var(--ink); font-size: 12px; }
.legend .note { font-size: 11.5px; color: var(--dim); max-width: 210px; }

.tooltip {
  position: absolute; pointer-events: none; z-index: 20;
  padding: 7px 10px; border-radius: 9px; font-size: 13px;
  background: #16213d; border: 1px solid var(--line-hi);
  box-shadow: 0 8px 24px rgba(0,0,0,.4); opacity: 0; transition: opacity .12s;
  white-space: nowrap;
}
.tooltip.show { opacity: 1; }
.status {
  position: absolute; top: 60px; left: 50%; transform: translateX(-50%);
  padding: 7px 14px; border-radius: 20px; font-size: 13px; font-weight: 500;
  background: rgba(46,16,101,.85); border: 1px solid rgba(192,132,252,.45); color: #ead5ff;
  opacity: 0; transition: opacity .3s; pointer-events: none; white-space: nowrap;
  max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis;
}
.status.show { opacity: 1; }
.loader {
  position: absolute; inset: 0; display: grid; place-content: center; gap: 10px;
  background: rgba(6,10,20,.55); z-index: 15; text-align: center;
}
.loader[hidden] { display: none; }
.loader-bar { width: 220px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.loader-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--coding), var(--template)); transition: width .2s; }
.loader-text { font-size: 13px; color: var(--mid); }

/* CSS2D labels */
.lbl-base {
  font: 600 12px var(--mono); color: #fff; padding: 1px 5px; border-radius: 5px;
  background: rgba(6,10,20,.72); border: 1px solid rgba(255,255,255,.15);
}
.lbl-end { font: 600 13px var(--mono); padding: 2px 7px; border-radius: 6px; background: rgba(6,10,20,.8); }
.lbl-dim {
  font: 500 12px var(--sans); color: #fde68a; padding: 3px 8px; border-radius: 6px;
  background: rgba(6,10,20,.85); border: 1px solid rgba(253,230,138,.35); white-space: nowrap;
}
.lbl-pol { font: 600 12px var(--sans); color: #ead5ff; padding: 3px 8px; border-radius: 6px; background: rgba(46,16,101,.85); }

/* ---------- panel ---------- */
.panel {
  display: flex; flex-direction: column; border-left: 1px solid var(--line);
  background: var(--panel); overflow: hidden;
}
.tabs { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.tab {
  flex: 1; border: 0; background: transparent; color: var(--mid);
  padding: 12px 4px; font-size: 13.5px; font-weight: 500; min-height: 46px;
  border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--ink); }
.tab.on { color: #fff; border-bottom-color: var(--accent); }
.pane { display: none; flex: 1; overflow-y: auto; padding: 14px; }
.pane.on { display: block; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 12px; }
.card-h { font-weight: 600; font-size: 14px; margin-bottom: 10px; }
.muted { color: var(--dim); font-weight: 400; }
.small { font-size: 13px; }
.credit { flex: none; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--dim); text-align: center; }

/* pair card */
.pair-card .empty { color: var(--mid); font-size: 14px; }
.pair-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.pair-top .pos { font: 500 12.5px var(--mono); color: var(--dim); }
.pair-vis { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 6px 0 12px; }
.pair-vis .bl { font: 700 30px var(--mono); width: 54px; height: 54px; display: grid; place-items: center; border-radius: 12px; color: #fff; }
.pair-vis .hb { display: flex; flex-direction: column; gap: 5px; }
.pair-vis .hb i { display: block; width: 34px; border-top: 2px dashed #e2e8f0; opacity: .8; }
.pair-meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13.5px; }
.pair-meta dt { color: var(--dim); }
.pair-meta dd { margin: 0; }

/* sequence */
.strands { font: 500 13px/1.7 var(--mono); background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 12px; overflow-x: auto; white-space: nowrap; }
.strands .tag { color: var(--dim); display: inline-block; width: 26px; }
.strands b { font-weight: 600; padding: 0 1px; border-radius: 3px; }
.strands b.sel { background: rgba(255,255,255,.18); outline: 1px solid rgba(255,255,255,.5); }
.b-A { color: var(--A); } .b-T { color: var(--T); } .b-G { color: var(--G); } .b-C { color: var(--C); } .b-U { color: var(--U); }
.field-l { display: block; font-size: 13px; color: var(--mid); margin-bottom: 6px; }
.seq-row { display: flex; gap: 8px; margin-bottom: 8px; }
.seq-row.two > * { flex: 1; }
#seq-in {
  flex: 1; font: 500 16px var(--mono); letter-spacing: .04em; text-transform: uppercase;
  background: var(--bg2); color: var(--ink); border: 1px solid var(--line-hi); border-radius: 10px;
  padding: 9px 10px; min-height: 44px;
}
#seq-in:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn {
  border: 1px solid #3b4f8a; background: #22336a; color: #fff; border-radius: 10px;
  padding: 9px 14px; font-weight: 600; font-size: 14px; min-height: 44px;
}
.btn:hover { background: #2a3e80; }
.btn.ghost { background: transparent; border-color: var(--line-hi); color: var(--mid); }
.btn.ghost:hover { color: var(--ink); background: #141f39; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.seq-err { color: #fca5a5; font-size: 13px; min-height: 1em; }

/* composition */
.bar-row { display: grid; grid-template-columns: 74px minmax(0,1fr) 48px; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 6px; }
.bar { height: 8px; border-radius: 4px; background: var(--bg2); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 4px; transition: width .4s; }
.bar-row .v { text-align: right; font-family: var(--mono); font-size: 12.5px; color: var(--mid); }
.chargaff { margin-top: 10px; font-size: 13px; color: var(--mid); border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 3px; }
.chargaff .ok { color: #86efac; }

/* structure */
.fact { padding: 4px 2px 14px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.fact:last-child { border-bottom: 0; }
.fact h3 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.fact p { margin: 0; color: var(--mid); font-size: 14px; }
.pairs { display: grid; gap: 6px; margin: 4px 0 8px; }
.pair-row { display: grid; grid-template-columns: 26px auto 26px 1fr; gap: 8px; align-items: center; font-size: 13.5px; color: var(--mid); background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; }
.pair-row b { font: 700 16px var(--mono); }
.pair-row em { font-style: normal; text-align: right; color: var(--dim); font-size: 12.5px; }
.rings { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rings figure { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; font-size: 13px; color: var(--mid); }
.rings svg { width: 100%; height: 56px; }
.dims { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-bottom: 6px; }
.dims td { padding: 5px 0; border-bottom: 1px solid var(--line); color: var(--mid); }
.dims td:last-child { text-align: right; color: var(--ink); font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }

/* transcription */
.steps { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 6px; font-size: 13.5px; color: var(--mid); }
.steps li b { color: var(--ink); display: block; font-weight: 600; }
.steps li.now { color: #ead5ff; }
.steps li.now b { color: #d8b4fe; }
.steps li.done b { color: #86efac; }
.tx-lines { font: 500 13px/1.8 var(--mono); background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; overflow-x: auto; white-space: nowrap; margin-bottom: 8px; }
.tx-lines .tag { color: var(--dim); display: inline-block; width: 74px; font-family: var(--sans); font-size: 12px; }
.tx-lines .ph { color: #334155; }
.codons { display: flex; flex-wrap: wrap; gap: 6px; }
.codon { background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; padding: 5px 8px; text-align: center; min-width: 62px; }
.codon .c { font: 600 13px var(--mono); }
.codon .aa { font-size: 12px; color: var(--mid); }
.codon.start { border-color: #22c55e; } .codon.stop { border-color: #ef4444; }
.codon.pending { opacity: .35; }

/* models */
.intro { margin: 0 0 10px; }
.model-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin-bottom: 10px; cursor: pointer; transition: border-color .2s; }
.model-card:hover { border-color: var(--line-hi); }
.model-card.on { border-color: var(--accent); }
.model-card h3 { margin: 0 0 4px; font-size: 15px; }
.model-card p { margin: 0 0 6px; color: var(--mid); font-size: 13.5px; }
.model-card .by { font-size: 12px; color: var(--dim); }
.keys { margin-top: 14px; }
.key-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13px; color: var(--mid); align-items: center; }
kbd { font: 500 12px var(--mono); background: var(--bg2); border: 1px solid var(--line-hi); border-radius: 6px; padding: 2px 7px; color: var(--ink); justify-self: start; }

/* full screen */
.stage:fullscreen { width: 100vw; height: 100vh; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .layout { grid-template-columns: minmax(0,1fr) 340px; } }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .stage { height: 68vh; min-height: 420px; }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
  .pane { overflow: visible; }
}
@media (max-width: 600px) {
  .topbar { padding: 8px 10px; gap: 8px; }
  .brand h1 { font-size: 19px; }
  .model-switch { width: 100%; }
  .model-switch button { flex: 1; padding: 8px 6px; font-size: 13px; }
  .tool { min-width: 48px; min-height: 48px; font-size: 11px; padding: 5px 4px; }
  .tool span { display: none; }
  .legend { bottom: 76px; left: 10px; font-size: 12px; padding: 8px 10px; }
  .legend .note { display: none; }
  .stage-head { left: 12px; top: 10px; }
  .status { top: 54px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- builder ---------- */
.tray {
  position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%);
  display: none; flex-direction: column; align-items: center; gap: 8px;
  width: min(560px, calc(100% - 20px));
}
body[data-view="builder"] .tray { display: flex; }
.tray-prompt {
  font-size: 14px; font-weight: 500; text-align: center; padding: 6px 14px; border-radius: 20px;
  background: rgba(11,17,32,.86); border: 1px solid var(--line); max-width: 100%;
}
.tray-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; width: 100%; }
.nuc {
  display: grid; justify-items: center; gap: 0; padding: 8px 4px; min-height: 64px;
  border-radius: 12px; border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
  background: color-mix(in srgb, var(--c) 14%, rgba(11,17,32,.9));
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: transform .12s, background .2s;
}
.nuc b { font: 700 22px/1.1 var(--mono); color: var(--c); }
.nuc span { font-size: 12.5px; color: var(--ink); }
.nuc em { font-style: normal; font-size: 11px; color: var(--mid); }
.nuc:hover { background: color-mix(in srgb, var(--c) 26%, rgba(11,17,32,.9)); }
.nuc:active { transform: scale(.96); }
.nuc[disabled] { opacity: .35; pointer-events: none; }
.nuc:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }

.build-card { display: none; }
body[data-view="builder"] .build-card { display: block; }
body[data-view="builder"] .pair-card, body[data-view="builder"] .normal-card { display: none; }
.b-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 10px; }
.b-stats div { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 6px; text-align: center; }
.b-stats b { display: block; font: 600 18px var(--mono); }
.b-stats span { font-size: 11.5px; color: var(--dim); }
.b-log { font-size: 13.5px; color: var(--mid); min-height: 3em; margin: 0 0 10px; }
.btn.wide { width: 100%; margin-bottom: 6px; }
#b-auto.on { background: #1b2a52; color: #fff; border-color: var(--accent); }

@media (max-width: 600px) {
  .tray { bottom: 66px; gap: 5px; }
  .tray-prompt { font-size: 12px; padding: 4px 10px; }
  .nuc { min-height: 52px; padding: 5px 2px; }
  .nuc b { font-size: 18px; }
  .nuc em { display: none; }
}

/* =========================================================
   MINIMAL LAYER · Material 3 shapes on frosted glass
   ========================================================= */
:root {
  --glass: rgba(255,255,255,.06);
  --glass-hi: rgba(255,255,255,.12);
  --glass-line: rgba(255,255,255,.12);
  --tonal: rgba(124,156,255,.26);
  --blur: blur(18px) saturate(150%);
}
.toolbar { display: none; }

/* round icon buttons */
.fab {
  position: relative; display: grid; place-items: center;
  width: 52px; height: 52px; padding: 0; border-radius: 50%;
  border: 1px solid var(--glass-line); background: var(--glass); color: var(--mid);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: 0 6px 20px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.08);
  transition: background .2s, color .2s, transform .12s, box-shadow .2s;
}
.fab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fab:hover { background: var(--glass-hi); color: var(--ink); }
.fab:active { transform: scale(.92); }
.fab.on { background: var(--tonal); color: #fff; border-color: rgba(124,156,255,.55); }
.fab.accent.on { background: rgba(168,85,247,.45); border-color: rgba(216,180,254,.6); }
.rail .fab[disabled] { display: none; }
.fab[disabled] { opacity: .3; pointer-events: none; }
.fab:focus-visible, .nuc:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.fab.sm { width: 46px; height: 46px; box-shadow: none; }

/* side rail */
.rail {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 10px; z-index: 12;
}
.rail-gap { height: 6px; }

/* tooltips replace text labels (pointer devices only) */
@media (hover: hover) {
  [data-tip]:hover::after {
    content: attr(data-tip); position: absolute; white-space: nowrap; pointer-events: none;
    font: 500 12.5px var(--sans); color: var(--ink); padding: 5px 10px; border-radius: 8px;
    background: rgba(20,28,50,.95); border: 1px solid var(--glass-line); z-index: 30;
    bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  }
  .rail [data-tip]:hover::after { bottom: auto; top: 50%; left: auto; right: calc(100% + 10px); transform: translateY(-50%); }
}

/* header and view switch */
.topbar { background: rgba(8,13,26,.8); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border-bottom-color: rgba(255,255,255,.06); }
.model-switch { border-radius: 999px; background: var(--glass); border-color: var(--glass-line); padding: 4px; }
.model-switch button { border-radius: 999px; padding: 9px 18px; }
.model-switch button.on { background: var(--tonal); box-shadow: none; }
.stage-head { top: 16px; left: 18px; }
.view-name { font-size: 15px; color: var(--mid); font-weight: 500; }

/* colour key, status, loader: glass */
.legend { display: none; background: rgba(13,20,38,.6); border-color: var(--glass-line); border-radius: 18px; backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); bottom: 18px; }
.legend.show { display: grid; }
.status { background: rgba(46,16,101,.55); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border-radius: 999px; top: 18px; }
.lbl-end { background: transparent; font-size: 12px; opacity: .8; }

/* builder: round base buttons */
.tray { bottom: 22px; gap: 12px; width: auto; }
.tray-prompt { border-radius: 999px; background: var(--glass); border-color: var(--glass-line); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); font-size: 13.5px; padding: 7px 16px; }
.tray-row { display: flex; gap: 14px; width: auto; }
.nuc {
  position: relative; display: grid; place-items: center;
  width: 64px; height: 64px; min-height: 0; padding: 0; border-radius: 50%;
  font: 700 24px var(--mono); color: var(--c);
  border: 1.5px solid color-mix(in srgb, var(--c) 60%, transparent);
  background: color-mix(in srgb, var(--c) 16%, rgba(255,255,255,.04));
  box-shadow: 0 8px 24px rgba(0,0,0,.3), 0 0 0 0 var(--c);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.nuc:hover { background: color-mix(in srgb, var(--c) 30%, rgba(255,255,255,.04)); box-shadow: 0 8px 24px rgba(0,0,0,.3), 0 0 18px -2px var(--c); }
.fab-row { display: flex; gap: 10px; justify-content: center; margin-bottom: 12px; }

/* panel: tonal surfaces, pill buttons */
.panel { background: #0a1020; border-left-color: rgba(255,255,255,.06); }
.tabs { padding: 8px; gap: 4px; border-bottom: 0; }
.tab { border-radius: 999px; border-bottom: 0; min-height: 40px; padding: 8px 4px; }
.tab.on { background: var(--tonal); color: #fff; }
.card { background: rgba(255,255,255,.035); border-color: rgba(255,255,255,.06); border-radius: 20px; }
.btn { border-radius: 999px; background: var(--tonal); border-color: rgba(124,156,255,.45); }
.btn:hover { background: rgba(124,156,255,.36); }
.btn.ghost { background: var(--glass); border-color: var(--glass-line); }
#seq-in { border-radius: 14px; background: rgba(255,255,255,.04); border-color: var(--glass-line); }
.strands, .tx-lines { background: rgba(0,0,0,.2); border-color: rgba(255,255,255,.05); border-radius: 14px; }
.b-stats div { background: rgba(0,0,0,.2); border-color: rgba(255,255,255,.05); border-radius: 14px; }
.credit { border-top-color: rgba(255,255,255,.05); font-size: 11.5px; }

@media (max-width: 860px) {
  .rail { top: auto; bottom: 14px; left: 50%; right: auto; transform: translateX(-50%); flex-direction: row; gap: 8px; }
  .rail-gap { display: none; }
  .tray { bottom: 76px; }
}
@media (max-width: 600px) {
  .fab { width: 42px; height: 42px; }
  .fab svg { width: 19px; height: 19px; }
  .rail { gap: 5px; bottom: 10px; }
  #t-key { display: none; }
  .nuc { width: 54px; height: 54px; font-size: 20px; }
  .tray-row { gap: 10px; }
  .tray { bottom: 62px; }
  .legend { bottom: 62px; }
}

/* =========================================================
   LESSON, FOCUS, MUTATION, PROCESSES
   ========================================================= */
.fab { width: 48px; height: 48px; }
.rail { gap: 8px; }
.fab.xs { width: 34px; height: 34px; box-shadow: none; }
.fab.xs svg { width: 16px; height: 16px; }
.lesson-fab { color: #fde68a; border-color: rgba(253,230,138,.35); }
.lesson-fab.on { background: rgba(245,158,11,.35); color: #fff; border-color: rgba(253,230,138,.6); }

.lesson {
  position: absolute; left: 16px; top: 50px; width: min(340px, calc(100% - 96px)); z-index: 14;
  padding: 14px 16px 12px; border-radius: 22px;
  background: rgba(13,20,38,.62); border: 1px solid var(--glass-line);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: 0 12px 36px rgba(0,0,0,.35);
}
.lesson[hidden] { display: none; }
.ls-top { display: flex; justify-content: space-between; align-items: center; font: 500 12.5px var(--mono); color: var(--dim); }
.lesson h3 { margin: 4px 0 4px; font-size: 18px; line-height: 1.25; }
.lesson p { margin: 0 0 12px; font-size: 14.5px; color: var(--mid); }
.ls-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ls-dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.ls-dots .dot { width: 9px; height: 9px; padding: 0; border-radius: 50%; border: 0; background: rgba(255,255,255,.18); }
.ls-dots .dot.on { background: #fde68a; width: 20px; border-radius: 5px; }

.lbl-tag { font: 600 12px var(--sans); color: #fff; padding: 3px 9px; border-radius: 999px; background: rgba(13,20,38,.8); border: 1px solid var(--glass-line); white-space: nowrap; }
.lbl-aa { font: 600 11px var(--mono); color: #e0e7ff; padding: 1px 6px; border-radius: 6px; background: rgba(13,20,38,.75); }

/* mutation tool */
.mut-box { margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.06); }
.mut-h { font-size: 13px; color: var(--mid); margin-bottom: 8px; }
.mut-row { display: flex; gap: 10px; margin-bottom: 10px; }
.nuc.sm { width: 44px; height: 44px; font-size: 17px; box-shadow: none; }
.nuc.on { background: color-mix(in srgb, var(--c) 45%, rgba(255,255,255,.04)); color: #fff; box-shadow: 0 0 14px -3px var(--c); }
.mut-fx { display: grid; gap: 3px; padding: 10px 12px; border-radius: 14px; font-size: 13.5px; color: var(--mid); background: rgba(0,0,0,.2); border: 1px solid rgba(255,255,255,.06); margin-bottom: 8px; }
.mut-fx b { color: var(--ink); font-size: 14px; }
.mut-fx .mono { font-family: var(--mono); font-size: 12.5px; color: var(--ink); }
.mut-fx.ok { border-color: rgba(134,239,172,.35); } .mut-fx.ok b { color: #86efac; }
.mut-fx.warn { border-color: rgba(253,230,138,.35); } .mut-fx.warn b { color: #fde68a; }
.mut-fx.bad { border-color: rgba(252,165,165,.4); } .mut-fx.bad b { color: #fca5a5; }
.strands b.mut { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }

/* processes */
.codon .ac { font: 500 11px var(--mono); color: #fda4af; }
.codon.now { outline: 2px solid #5eead4; outline-offset: 1px; }
.protein { margin: 4px 0 12px; padding: 10px 12px; border-radius: 14px; background: rgba(0,0,0,.2); }
#protein { font: 600 13.5px/1.6 var(--mono); color: #c7d2fe; word-break: break-word; }
.steps { margin-bottom: 12px; }
#tx-lines { margin-bottom: 12px; }

@media (max-width: 860px) {
  .rail { max-width: calc(100% - 16px); overflow-x: auto; scrollbar-width: none; padding: 2px; }
  .lesson { top: 44px; left: 10px; right: 10px; width: auto; }
}
@media (max-width: 600px) {
  .fab { width: 40px; height: 40px; flex: none; }
  .lesson h3 { font-size: 16px; }
  .lesson p { font-size: 13.5px; }
}

/* =========================================================
   QUIET LABELS · plain text with a soft shadow, no boxes
   ========================================================= */
.lbl-base, .lbl-end, .lbl-dim, .lbl-pol, .lbl-tag, .lbl-aa {
  background: none !important; border: 0 !important; padding: 0 !important;
  text-shadow: 0 0 3px rgba(4,7,15,.95), 0 0 8px rgba(4,7,15,.8);
  pointer-events: none; transition: opacity .15s;
}
.lbl-base { font: 600 11px var(--mono); }
.lbl-end { font: 500 10.5px var(--mono); opacity: .55; }
.lbl-dim { font: 500 11.5px var(--sans); color: #fde68a; opacity: .85; }
.lbl-pol { font: 500 11.5px var(--sans); color: #e9d5ff; opacity: .9; }
.lbl-tag { font: 500 11.5px var(--sans); color: #cbd5e1; opacity: .85; }
.lbl-aa { font: 500 10px var(--mono); color: #c7d2fe; opacity: .85; }

/* sequence labels beside the helix */
.lbl-pair, .lbl-seq {
  font: 600 11px var(--mono); letter-spacing: .02em; pointer-events: none;
  text-shadow: 0 0 3px rgba(4,7,15,.95), 0 0 8px rgba(4,7,15,.8);
}
.lbl-pair { opacity: .8; white-space: nowrap; }
.lbl-pair i { font-style: normal; color: var(--dim); margin: 0 1px; }
.lbl-pair .q { color: var(--dim); }
.lbl-pair.sel { opacity: 1; font-size: 13px; }
.lbl-seq { opacity: .8; }

/* =========================================================
   MODES, STRAND SELECTOR, SEQUENCE COLUMNS
   ========================================================= */
.model-switch button { padding: 9px 14px; }
.strand-seg {
  position: absolute; top: 44px; left: 16px; z-index: 12; display: none; gap: 2px; padding: 3px;
  border-radius: 999px; background: var(--glass); border: 1px solid var(--glass-line);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
body[data-mode="helix"] .strand-seg { display: flex; }
.strand-seg button { border: 0; background: transparent; color: var(--mid); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 500; min-height: 34px; }
.strand-seg button.on { background: var(--tonal); color: #fff; }
.strand-seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body[data-mode="helix"] .lesson { top: 92px; }

/* Process tab only in Replication and Transcription */
body[data-mode="helix"] .tab[data-tab="transcribe"], body[data-mode="builder"] .tab[data-tab="transcribe"] { display: none; }
body[data-mode="replication"] #pane-transcribe .card[data-mode="transcription"],
body[data-mode="transcription"] #pane-transcribe .card[data-mode="replication"] { display: none; }

.lbl-head {
  font: 600 10.5px var(--sans); letter-spacing: .02em; opacity: .75; white-space: nowrap;
  text-shadow: 0 0 3px rgba(4,7,15,.95), 0 0 8px rgba(4,7,15,.8); pointer-events: none;
}
.lbl-seq.sel { opacity: 1; font-size: 13px; }

@media (max-width: 600px) {
  .model-switch button { padding: 8px 4px; font-size: 12px; }
  .strand-seg { top: 38px; left: 10px; }
  .strand-seg button { padding: 5px 10px; font-size: 12px; min-height: 30px; }
}

/* =========================================================
   LETTERS ON BASES · one small chip per base, in the base's colour
   ========================================================= */
.lbl-base {
  font: 700 10.5px var(--mono) !important; min-width: 15px; height: 15px; line-height: 15px; text-align: center;
  border-radius: 999px; background: rgba(6,10,20,.78) !important; padding: 0 2px !important;
  border: 1px solid currentColor !important; text-shadow: none;
}
.lbl-base.sel { font-size: 12.5px !important; min-width: 19px; height: 19px; line-height: 19px; box-shadow: 0 0 0 2px rgba(255,255,255,.35); }
.lbl-end { font: 600 11px var(--sans) !important; opacity: .9; white-space: nowrap; }

/* Full screen fallback: stage fills the window */
body.pseudo-full { overflow: hidden; }
body.pseudo-full .stage { position: fixed !important; inset: 0; width: 100vw; height: 100vh; height: 100dvh; z-index: 1000; border-radius: 0; margin: 0; }
.stage:-webkit-full-screen { width: 100vw; height: 100vh; }

/* Structure pane: short bullet lists */
.fact ul.pts { margin: 6px 0 0; padding-left: 18px; }
.fact ul.pts li { margin: 3px 0; line-height: 1.45; }
.fact ul.pts li::marker { color: var(--accent); }
@media (max-width: 440px) {
  .rail { gap: 4px; }
  .rail .fab { width: 37px; height: 37px; }
  .rail .fab svg { width: 17px; height: 17px; }
}

/* Status card: collapsible */
.status { display: flex; align-items: flex-start; gap: 6px; }
.status.show { pointer-events: auto; cursor: default; }
.status .st-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status .st-more { display: none; flex: none; width: 16px; height: 16px; margin-top: 1px; opacity: .8; transition: transform .2s; }
.status.long { cursor: pointer; }
.status.long .st-more { display: block; }
.status.open { white-space: normal; border-radius: 16px; width: calc(100% - 24px); }
.status.open .st-text { white-space: normal; overflow: visible; line-height: 1.45; }
.status.open .st-more { transform: rotate(180deg); }
.status:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* IBM Plex Sans everywhere; aligned digits where numbers line up */
html, body, button, input, select, textarea, kbd, code, table { font-family: 'IBM Plex Sans', system-ui, sans-serif; }
.strands, .tx-lines, .dims td, .bar-row .v, .b-stats b, .codon .c { font-variant-numeric: tabular-nums; }

/* =========================================================
   CREDITS · © beside the title opens a glass card
   ========================================================= */
.brand h1 { display: flex; align-items: center; gap: 8px; }
.copy-btn {
  font: 600 13px/1 'IBM Plex Sans', sans-serif; width: 24px; height: 24px; border-radius: 999px; padding: 0;
  display: inline-grid; place-items: center; cursor: pointer; color: var(--mid);
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: color .2s, background .2s, transform .2s;
}
.copy-btn:hover, .copy-btn:focus-visible { color: #fff; background: rgba(124,156,255,.22); transform: scale(1.06); outline: none; }
.credits-wrap {
  position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 16px;
  background: rgba(3,6,14,.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: crFade .2s ease;
}
.credits-wrap[hidden] { display: none; }
.credits-card {
  position: relative; width: min(560px, 100%); max-height: min(86vh, 760px); overflow-y: auto;
  padding: 22px 20px 18px; border-radius: 26px; color: var(--ink);
  background: linear-gradient(160deg, rgba(40,52,92,.55), rgba(14,20,40,.62));
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 24px 60px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.12);
  backdrop-filter: blur(22px) saturate(140%); -webkit-backdrop-filter: blur(22px) saturate(140%);
  animation: crRise .25s cubic-bezier(.2,.8,.2,1);
}
.credits-card h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.cr-sub { margin: 2px 0 14px; color: var(--mid); font-size: 13px; }
.credits-card section { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.1); }
.credits-card h3 { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #9fb4ff; }
.cr-team { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: 13.5px; }
.cr-team dt { color: var(--mid); }
.cr-team dd { margin: 0; font-weight: 500; }
.cr-scroll { overflow-x: auto; }
.cr-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cr-table th { text-align: left; font-weight: 600; color: var(--mid); padding: 4px 6px; border-bottom: 1px solid rgba(255,255,255,.12); }
.cr-table td { padding: 6px; border-bottom: 1px solid rgba(255,255,255,.06); vertical-align: top; }
.cr-table td:last-child { white-space: nowrap; color: var(--mid); }
.credits-card a { color: #c7d4ff; text-decoration: none; border-bottom: 1px solid rgba(199,212,255,.3); }
.credits-card a:hover { color: #fff; border-color: #fff; }
.cr-note, .cr-foot { font-size: 12px; color: var(--dim); margin: 8px 0 0; line-height: 1.5; }
.cr-foot { text-align: center; margin-top: 16px; }
.cr-close {
  position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 999px; cursor: pointer;
  font: 400 22px/1 'IBM Plex Sans', sans-serif; color: var(--ink);
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
}
.cr-close:hover { background: rgba(255,255,255,.16); }
@keyframes crFade { from { opacity: 0; } }
@keyframes crRise { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@media (max-width: 440px) { .cr-team { grid-template-columns: 1fr; gap: 0 0; } .cr-team dd { margin-bottom: 8px; } }
