/* ============================================================
   PLANT CELL EXPLORER — holo-bench design system
   palette: deep bench navy · holo cyan-teal · chlorophyll green
   ============================================================ */
:root {
  --bg0: #03070c;
  --bg1: #071019;
  --panel: rgba(9, 20, 30, 0.72);
  --panel-edge: rgba(94, 234, 212, 0.22);
  --holo: #57e6c9;
  --holo-dim: #2b8fa8;
  --cy: #7dd3fc;
  --grn: #4ade80;
  --amber: #fbbf24;
  --ink: #d7f0ee;
  --ink-dim: #7ba3ad;
  --ink-faint: #4a6a74;
  --disp: 'Chakra Petch', 'Segoe UI', sans-serif;
  --body: 'Inter', 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --edge-glow: 0 0 0 1px rgba(94, 234, 212, 0.16), 0 0 22px rgba(94, 234, 212, 0.07), inset 0 0 34px rgba(20, 80, 90, 0.16);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  color: var(--ink);
  background:
    radial-gradient(1100px 700px at 72% -10%, rgba(45, 140, 130, 0.14), transparent 60%),
    radial-gradient(900px 600px at 8% 110%, rgba(40, 90, 140, 0.16), transparent 55%),
    linear-gradient(160deg, var(--bg1), var(--bg0) 70%);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* faint scanline shimmer over everything */
body::after {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: 60;
  background: repeating-linear-gradient(0deg, rgba(160, 255, 235, 0.022) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}

/* ============================ top bar ============================ */
#topbar {
  height: 58px;
  display: flex; align-items: center; gap: 22px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(94, 234, 212, 0.14);
  background: linear-gradient(180deg, rgba(10, 24, 34, 0.9), rgba(7, 16, 25, 0.65));
  backdrop-filter: blur(10px);
  position: relative; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand .mark {
  font-size: 26px; color: var(--holo);
  text-shadow: 0 0 14px rgba(87, 230, 201, 0.8);
  animation: markPulse 3.2s ease-in-out infinite;
}
@keyframes markPulse { 50% { text-shadow: 0 0 26px rgba(87, 230, 201, 1); transform: rotate(14deg); } }
.b-txt b { font-family: var(--disp); font-size: 15px; letter-spacing: 0.14em; display: block; line-height: 1.05; }
.b-txt i { font-family: var(--mono); font-style: normal; font-size: 9.5px; letter-spacing: 0.22em; color: var(--ink-dim); }

.tabs { display: flex; gap: 6px; margin-left: 8px; }
.tab {
  font-family: var(--disp); font-size: 12.5px; letter-spacing: 0.12em;
  color: var(--ink-dim); background: transparent;
  border: 1px solid transparent; border-radius: 8px;
  padding: 9px 16px; cursor: pointer;
  display: flex; align-items: baseline; gap: 8px;
  transition: color .2s, border-color .25s, background .25s, box-shadow .25s;
}
.tab b { font-family: var(--mono); font-size: 9px; color: var(--ink-faint); }
.tab:hover { color: var(--ink); border-color: rgba(94, 234, 212, 0.25); }
.tab.on {
  color: var(--holo);
  background: linear-gradient(180deg, rgba(87, 230, 201, 0.12), rgba(87, 230, 201, 0.04));
  border-color: rgba(94, 234, 212, 0.4);
  box-shadow: 0 0 18px rgba(87, 230, 201, 0.12), inset 0 0 14px rgba(87, 230, 201, 0.06);
}
.tab.on b { color: var(--holo); }

.spec-chip {
  margin-left: auto;
  display: flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em;
  color: var(--ink-dim);
  border: 1px solid rgba(125, 211, 252, 0.22);
  border-radius: 999px; padding: 7px 14px;
  background: rgba(12, 30, 42, 0.5);
  white-space: nowrap;
}
.spec-chip b { color: var(--cy); font-style: italic; font-weight: 500; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--grn); box-shadow: 0 0 9px var(--grn); animation: dotPulse 2.1s infinite; }
@keyframes dotPulse { 50% { opacity: 0.4; } }

/* ============================ layout ============================ */
#app { height: calc(100vh - 58px - 26px); position: relative; }
.view {
  position: absolute; inset: 0;
  display: grid; gap: 12px; padding: 12px;
  min-width: 0; overflow: hidden;
  opacity: 0; pointer-events: none;
  transform: translateY(10px) scale(0.995);
  transition: opacity .38s ease, transform .42s cubic-bezier(.2,.9,.25,1);
}
.view.active { opacity: 1; pointer-events: auto; transform: none; }
#view-structure { grid-template-columns: 300px 1fr 300px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  box-shadow: var(--edge-glow);
  backdrop-filter: blur(12px);
  overflow: hidden auto;
  position: relative;
  scrollbar-width: thin; scrollbar-color: rgba(94,234,212,.25) transparent;
}
.panel::-webkit-scrollbar { width: 6px; }
.panel::-webkit-scrollbar-thumb { background: rgba(94,234,212,.2); border-radius: 3px; }

.ph {
  position: sticky; top: 0; z-index: 3; min-width: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 13px 16px 11px;
  background: linear-gradient(180deg, rgba(9,20,30,0.95), rgba(9,20,30,0.75));
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(94, 234, 212, 0.12);
}
.ph-k {
  font-family: var(--disp); font-size: 11px; letter-spacing: 0.26em; color: var(--holo);
  text-shadow: 0 0 10px rgba(87, 230, 201, 0.4);
}
.ph input {
  font-family: var(--mono); font-size: 11px;
  background: rgba(6, 14, 20, 0.8); color: var(--ink);
  border: 1px solid rgba(94, 234, 212, 0.2); border-radius: 7px;
  padding: 5px 9px; width: 92px; min-width: 0; flex: 0 1 auto; outline: none;
  transition: border-color .2s, width .25s;
}
.ph input:focus { border-color: rgba(94, 234, 212, 0.55); }
.ph-k { flex: none; }
.ph { flex-wrap: nowrap; }
.ph input::placeholder { color: var(--ink-faint); }

/* dossier */
.dossier { padding: 14px 16px 20px; }
.d-name { font-family: var(--disp); font-size: 21px; font-weight: 600; letter-spacing: 0.02em; }
.d-latin { font-family: var(--body); font-style: italic; color: var(--cy); font-size: 14px; margin-top: 2px; }
.d-fam { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.16em; color: var(--ink-faint); margin: 5px 0 14px; }
.d-sec { margin-bottom: 14px; }
.d-sec > b { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.22em; color: var(--holo-dim); display: block; margin-bottom: 5px; }
.d-sec p { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--ink); opacity: 0.88; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.stat {
  border: 1px solid rgba(125, 211, 252, 0.14); border-radius: 9px;
  padding: 8px 9px; background: rgba(10, 26, 36, 0.5);
  transition: border-color .2s, transform .2s;
}
.stat:hover { border-color: rgba(125, 211, 252, 0.4); transform: translateY(-1px); }
.stat i { display: block; font-family: var(--mono); font-style: normal; font-size: 8.5px; letter-spacing: 0.14em; color: var(--ink-faint); }
.stat b { font-family: var(--mono); font-weight: 500; font-size: 12px; color: var(--cy); }
.d-live {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.18em; color: var(--grn);
  border-top: 1px dashed rgba(94, 234, 212, 0.18); padding-top: 12px;
}

/* library */
#panel-library { display: flex; flex-direction: column; }
.lib-list { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.lib-items { overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 7px; scrollbar-width: thin; }
.lib-item {
  display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 10px;
  text-align: left; padding: 10px 11px;
  background: rgba(10, 26, 36, 0.45);
  border: 1px solid rgba(94, 234, 212, 0.1); border-radius: 10px;
  cursor: pointer; color: var(--ink);
  transition: border-color .18s, background .18s, transform .18s, box-shadow .18s;
}
.lib-item:hover {
  border-color: var(--hue, var(--holo));
  background: rgba(16, 36, 48, 0.7);
  transform: translateX(3px);
  box-shadow: -3px 0 14px -4px var(--hue, var(--holo));
}
.lib-item > i {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--hue); box-shadow: 0 0 9px var(--hue);
}
.li-name { font-family: var(--body); font-size: 13px; font-weight: 500; }
.li-name em { display: block; font-style: normal; font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.14em; color: var(--ink-faint); margin-top: 2px; }
.li-size { font-family: var(--mono); font-size: 9.5px; color: var(--ink-dim); text-align: right; max-width: 74px; }
.lib-empty { padding: 22px 14px; text-align: center; color: var(--ink-dim); }
.lib-empty b { color: var(--ink); font-weight: 500; display: block; margin-bottom: 6px; }
.lib-empty p { font-size: 12px; line-height: 1.5; margin: 0; }

/* detail card */
.lib-detail {
  position: absolute; inset: 0; background: #071019;
  transform: translateY(12px); opacity: 0; pointer-events: none;
  transition: opacity .28s, transform .32s cubic-bezier(.2,.9,.3,1);
  overflow-y: auto; z-index: 4;
}
.lib-detail.show { transform: none; opacity: 1; pointer-events: auto; }
.ld-card { padding: 16px; }
.ld-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ld-swatch {
  width: 14px; height: 14px; border-radius: 4px; flex: none;
  background: var(--hue); box-shadow: 0 0 14px var(--hue);
}
.ld-top b { font-family: var(--disp); font-size: 17px; font-weight: 600; display: block; }
.ld-top em { font-style: normal; font-family: var(--mono); font-size: 9px; letter-spacing: 0.2em; color: var(--ink-faint); }
.ld-close {
  margin-left: auto; width: 28px; height: 28px; border-radius: 8px;
  background: rgba(20, 40, 52, 0.8); color: var(--ink-dim);
  border: 1px solid rgba(94, 234, 212, 0.2); cursor: pointer; font-size: 12px;
  transition: color .2s, border-color .2s;
}
.ld-close:hover { color: var(--ink); border-color: var(--holo); }
.ld-short { font-size: 13px; line-height: 1.5; color: var(--holo); margin: 0 0 10px; }
.ld-desc { font-size: 12.5px; line-height: 1.65; color: var(--ink); opacity: 0.9; margin: 0 0 14px; }
.ld-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip {
  display: inline-flex; align-items: baseline; gap: 6px;
  font-family: var(--mono); font-size: 10.5px; color: var(--cy);
  border: 1px solid rgba(125, 211, 252, 0.22); border-radius: 7px;
  padding: 4px 8px; background: rgba(10, 26, 36, 0.6);
}
.chip i { font-style: normal; font-size: 8px; letter-spacing: 0.14em; color: var(--ink-faint); }
.ld-row { margin-bottom: 14px; }
.ld-actions { display: flex; gap: 8px; }
.btn {
  font-family: var(--disp); font-size: 11px; letter-spacing: 0.16em;
  color: var(--ink); background: rgba(14, 30, 42, 0.8);
  border: 1px solid rgba(94, 234, 212, 0.3); border-radius: 9px;
  padding: 9px 14px; cursor: pointer;
  transition: all .2s;
}
.btn:hover { border-color: var(--holo); box-shadow: 0 0 14px rgba(87, 230, 201, 0.18); }
.btn.pri {
  color: #052018; background: linear-gradient(180deg, #63eccf, #3cc9ab);
  border-color: transparent; font-weight: 600;
}
.btn.pri:hover { box-shadow: 0 0 22px rgba(87, 230, 201, 0.45); }

/* ============================ stage ============================ */
#stage {
  position: relative; border-radius: 14px; overflow: hidden;
  border: 1px solid rgba(94, 234, 212, 0.16);
  background:
    radial-gradient(140% 90% at 50% -20%, rgba(50, 150, 140, 0.12), transparent 55%),
    radial-gradient(80% 60% at 50% 115%, rgba(30, 90, 130, 0.18), transparent 60%),
    linear-gradient(180deg, #050d16, #03070c);
  box-shadow: var(--edge-glow);
  min-width: 0; min-height: 0;
}
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
#gl:active { cursor: grabbing; }
#leaders { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
#labels { position: absolute; inset: 0; pointer-events: none; z-index: 4; }

.leader {
  fill: none; stroke: rgba(125, 211, 252, 0.55); stroke-width: 1;
  stroke-dasharray: 3 3; opacity: 0; transition: opacity .25s;
}
.leader.show { opacity: 0.8; }
.leader-dot { fill: #a9f5e2; opacity: 0; transition: opacity .25s; filter: drop-shadow(0 0 4px rgba(140,255,225,.9)); }
.leader-dot.show { opacity: 1; }

.lbl {
  position: absolute; top: 0; left: 0;
  display: flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em;
  color: var(--ink); white-space: nowrap;
  background: rgba(8, 18, 27, 0.82);
  border: 1px solid var(--hue, rgba(94, 234, 212, 0.4));
  border-radius: 7px; padding: 5px 8px;
  pointer-events: none; cursor: pointer;
  opacity: 0; transition: opacity .22s, border-color .2s, box-shadow .2s;
  backdrop-filter: blur(4px);
}
.lbl i { width: 6px; height: 6px; border-radius: 50%; background: var(--hue); box-shadow: 0 0 7px var(--hue); }
.lbl.show { opacity: 1; pointer-events: auto; }
.lbl.dim.show { opacity: 0.28; }
.lbl:hover { box-shadow: 0 0 16px -2px var(--hue); z-index: 5; }
.lbl.right { flex-direction: row-reverse; }

/* stage toolbar */
#stage-toolbar {
  position: absolute; top: 12px; left: 12px; z-index: 6;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.seg {
  display: flex; border: 1px solid rgba(94, 234, 212, 0.25); border-radius: 9px;
  overflow: hidden; background: rgba(8, 18, 27, 0.8); backdrop-filter: blur(6px);
}
.seg button, .tool {
  font-family: var(--disp); font-size: 10px; letter-spacing: 0.14em;
  color: var(--ink-dim); background: transparent; border: 0;
  padding: 8px 11px; cursor: pointer; transition: all .2s;
}
.seg button + button { border-left: 1px solid rgba(94, 234, 212, 0.15); }
.seg button:hover, .tool:hover { color: var(--ink); }
.seg button.on { color: #052018; background: var(--holo); font-weight: 600; }
.tool {
  border: 1px solid rgba(94, 234, 212, 0.25); border-radius: 9px;
  background: rgba(8, 18, 27, 0.8); backdrop-filter: blur(6px);
}
.tool.on {
  color: #052018; background: linear-gradient(180deg, #63eccf, #3cc9ab);
  border-color: transparent; font-weight: 600;
  box-shadow: 0 0 18px rgba(87, 230, 201, 0.35);
}

/* control cluster */
#control-cluster {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 7px; z-index: 6;
}
#control-cluster button {
  width: 52px; min-height: 44px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-family: var(--disp); font-size: 8px; letter-spacing: 0.14em; color: var(--ink-dim);
  background: rgba(8, 18, 27, 0.82); border: 1px solid rgba(94, 234, 212, 0.25);
  border-radius: 10px; cursor: pointer; backdrop-filter: blur(6px);
  transition: all .18s;
}
#control-cluster button span { font-size: 16px; color: var(--holo); }
#control-cluster button:hover { border-color: var(--holo); color: var(--ink); box-shadow: 0 0 14px rgba(87,230,201,.2); }
#control-cluster button.on { border-color: var(--holo); color: var(--holo); box-shadow: 0 0 16px rgba(87,230,201,.3) inset; }

#hint-chip {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.1em;
  color: var(--ink-dim); white-space: nowrap;
  background: rgba(8, 18, 27, 0.7); border: 1px solid rgba(94, 234, 212, 0.15);
  border-radius: 999px; padding: 6px 14px; z-index: 5; pointer-events: none;
}
#hint-chip b { color: var(--cy); }

/* compare tray */
#compare-tray {
  position: absolute; left: 12px; bottom: 12px; z-index: 6;
  width: min(430px, calc(100% - 90px));
  background: rgba(7, 16, 25, 0.92); border: 1px solid rgba(125, 211, 252, 0.3);
  border-radius: 12px; padding: 10px 12px;
  backdrop-filter: blur(10px);
  transform: translateY(14px); opacity: 0; pointer-events: none;
  transition: all .35s cubic-bezier(.2,.9,.3,1);
  max-height: 46%; overflow-y: auto;
}
#compare-tray.show { transform: none; opacity: 1; pointer-events: auto; }
.tray-title { font-family: var(--mono); font-size: 9px; letter-spacing: 0.22em; color: var(--cy); margin-bottom: 8px; }
.cmp-row {
  display: grid; grid-template-columns: 108px 1fr 1fr; gap: 8px; align-items: center;
  padding: 5px 7px; border-radius: 7px; margin-bottom: 3px;
  font-size: 10.5px; font-family: var(--body);
  border: 1px solid transparent;
}
.cmp-row.po { background: rgba(74, 222, 128, 0.07); border-color: rgba(74, 222, 128, 0.18); }
.cmp-row.ao { background: rgba(125, 211, 252, 0.07); border-color: rgba(125, 211, 252, 0.18); }
.cmp-f { font-family: var(--mono); font-size: 9.5px; color: var(--ink); }
.cmp-p, .cmp-a { color: var(--ink-dim); line-height: 1.25; }
.cmp-p i, .cmp-a i { display: block; font-style: normal; font-family: var(--mono); font-size: 7.5px; letter-spacing: 0.16em; color: var(--ink-faint); }
.cmp-row.po .cmp-p { color: #86efac; }
.cmp-row.ao .cmp-a { color: var(--cy); }
.cmp-row.both { opacity: 0.7; }

#gl-fallback {
  position: absolute; inset: 0; z-index: 20; display: none;
  align-items: center; justify-content: center; flex-direction: column;
  text-align: center; padding: 40px; background: rgba(5, 10, 16, 0.9);
}
#gl-fallback.show { display: flex; }
#gl-fallback b { font-family: var(--disp); color: var(--holo); font-size: 18px; }
#gl-fallback p { color: var(--ink-dim); max-width: 380px; }

/* ============================ processes view ============================ */
.proc-wrap { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 12px; min-height: 0; min-width: 0; }
.proc-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; padding: 4px 6px 0; flex-wrap: wrap; min-width: 0; }
.proc-head h2, .exp-head h2 {
  font-family: var(--disp); font-size: 22px; font-weight: 600; margin: 0;
  letter-spacing: 0.04em; color: var(--ink);
}
.proc-sub { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-dim); }
.net-eq {
  font-family: var(--mono); font-size: 12.5px; color: var(--grn);
  border: 1px solid rgba(74, 222, 128, 0.3); border-radius: 10px;
  padding: 10px 16px; background: rgba(10, 30, 20, 0.5); white-space: nowrap;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.net-eq i { font-style: normal; font-size: 8.5px; letter-spacing: 0.2em; color: var(--ink-faint); margin-right: 10px; }

.proc-stage {
  flex: 1; min-height: 0; min-width: 0; display: grid; grid-template-rows: minmax(0,1fr) auto auto;
  background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 14px;
  box-shadow: var(--edge-glow); overflow: hidden; position: relative;
}
#psvg { width: 100%; height: 100%; min-height: 0; max-width: 100%; display: block; overflow: hidden; }
.zlabel { font-family: var(--mono); font-size: 10px; letter-spacing: 0.24em; fill: #4a8a99; }
.ilabel { font-family: var(--disp); font-size: 12px; letter-spacing: 0.08em; fill: #bfe8e2; }
.ilabel.sm { font-size: 10px; }
.ilabel.xs { font-size: 8.5px; }
.ilabel.dim { fill: #5e939e; }
.wlabel { font-family: var(--disp); font-size: 15px; fill: #7dd3fc; }
.olabel { font-family: var(--mono); font-size: 10px; fill: #b9f6ca; letter-spacing: 0.1em; }
.photon { filter: drop-shadow(0 0 4px #ffe27a); }
.electron { filter: drop-shadow(0 0 5px #fff59d); }
.flow { animation: flowDash 1.1s linear infinite; }
@keyframes flowDash { to { stroke-dashoffset: -8; } }

.proc-caption {
  border-top: 1px solid rgba(94, 234, 212, 0.12);
  padding: 14px 22px 6px; min-height: 108px; min-width: 0;
}
.pc-title { font-family: var(--disp); font-size: 16px; color: var(--holo); letter-spacing: 0.06em; margin-bottom: 5px; }
#pc-text { margin: 0; font-size: 13px; line-height: 1.6; color: var(--ink); opacity: 0.9; max-width: 900px; overflow-wrap: break-word; }
.pc-chips { display: flex; gap: 8px; margin-top: 9px; flex-wrap: wrap; }

.proc-controls {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 22px 16px; flex-wrap: wrap; min-width: 0;
}
.pc-btn {
  font-family: var(--disp); font-size: 11px; letter-spacing: 0.14em;
  color: var(--ink); background: rgba(14, 30, 42, 0.8);
  border: 1px solid rgba(94, 234, 212, 0.3); border-radius: 9px;
  padding: 8px 14px; cursor: pointer; transition: all .2s; min-width: 40px;
}
.pc-btn:hover { border-color: var(--holo); }
.pc-btn.pri { min-width: 76px; }
.pc-btn.on, .pc-btn.pri.on { background: var(--holo); color: #052018; font-weight: 600; }
.pc-dots { display: flex; gap: 7px; margin-left: 8px; }
.pc-dot {
  width: 26px; height: 6px; border-radius: 3px; border: 0; cursor: pointer;
  background: rgba(94, 234, 212, 0.18); transition: all .25s;
}
.pc-dot.on { background: var(--holo); box-shadow: 0 0 10px rgba(87, 230, 201, 0.6); }
#pc-restart { margin-left: auto; }

/* ============================ experiments view ============================ */
.exp-wrap { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 12px; min-height: 0; min-width: 0; overflow-y: auto; }
.exp-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 12px; flex: 1; min-height: 480px; align-items: stretch; }
.exp-card {
  background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 14px;
  box-shadow: var(--edge-glow); padding: 16px 18px; display: flex; flex-direction: column; min-height: 0;
}
.ec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ec-head b { font-family: var(--disp); font-size: 16px; font-weight: 600; letter-spacing: 0.04em; }
.ec-tag { font-family: var(--mono); font-size: 9px; letter-spacing: 0.2em; color: var(--holo-dim); }
.ec-sub { font-size: 12px; color: var(--ink-dim); margin: 6px 0 12px; }
.ec-body { display: grid; grid-template-columns: 240px 1fr; gap: 14px; flex: 1; min-height: 0; }
#exp-tonic .ec-body { grid-template-columns: 1fr 240px; }
.ec-controls { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ec-viz { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; }

.sld { display: block; }
.sld-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.sld-top b { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.18em; color: var(--ink-dim); }
.sld-top output { font-family: var(--mono); font-size: 12px; color: var(--holo); }
input[type="range"] {
  width: 100%; appearance: none; height: 26px; background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, var(--holo-dim), var(--holo));
  box-shadow: 0 0 8px rgba(87, 230, 201, 0.3);
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: #0a1e28; border: 2px solid var(--holo); margin-top: -6px;
  box-shadow: 0 0 12px rgba(87, 230, 201, 0.7); transition: transform .15s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.25); }
input[type="range"]::-moz-range-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, var(--holo-dim), var(--holo));
}
input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: #0a1e28; border: 2px solid var(--holo);
  box-shadow: 0 0 12px rgba(87, 230, 201, 0.7);
}

.rate-read {
  border: 1px solid rgba(94, 234, 212, 0.25); border-radius: 11px;
  padding: 12px; background: rgba(8, 20, 30, 0.7);
}
.rr-num { display: flex; align-items: baseline; gap: 8px; }
.rr-num b { font-family: var(--mono); font-size: 30px; font-weight: 500; color: var(--holo); text-shadow: 0 0 16px rgba(87,230,201,.4); }
.rr-num i { font-family: var(--mono); font-style: normal; font-size: 9px; letter-spacing: 0.1em; color: var(--ink-faint); }
.rr-lim { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.16em; color: var(--ink-dim); margin-top: 7px; }
.rr-lim b { color: var(--amber); margin-left: 6px; }

#rate-chart { width: 100%; height: auto; border: 1px solid rgba(94,234,212,.14); border-radius: 10px; background: rgba(6,14,20,.6); }
.bubble-cell #bubble-cv { width: 100%; height: 96px; border: 1px solid rgba(94,234,212,.14); border-radius: 10px; background: rgba(6,14,20,.6); }

.tonic-viz #tonic-gl { width: 100%; flex: 1; min-height: 300px; border-radius: 10px; display: block; }
.turgor-gauge {
  border: 1px solid rgba(94, 234, 212, 0.2); border-radius: 10px;
  padding: 10px 12px; background: rgba(8, 20, 30, 0.7);
}
.tg-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.tg-top b { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.18em; color: var(--ink-dim); }
.tg-top output { font-family: var(--mono); font-size: 13px; color: var(--grn); }
.tg-bar { height: 8px; border-radius: 4px; background: rgba(94, 234, 212, 0.1); position: relative; overflow: hidden; }
.tg-bar i {
  position: absolute; inset: 0 auto 0 0; width: 80%;
  background: linear-gradient(90deg, #f87171, #fbbf24 40%, #4ade80 75%, #57e6c9);
  border-radius: 4px; transition: width .5s cubic-bezier(.2,.9,.3,1);
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.5);
}
.tg-ends { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 8.5px; color: var(--ink-faint); margin-top: 5px; }

.tonic-btns { display: flex; flex-direction: column; gap: 7px; }
.tonic-btn {
  text-align: left; padding: 10px 12px; cursor: pointer;
  background: rgba(10, 26, 36, 0.5); color: var(--ink);
  border: 1px solid rgba(94, 234, 212, 0.15); border-radius: 10px;
  transition: all .2s;
}
.tonic-btn b { font-family: var(--disp); font-size: 13px; display: block; letter-spacing: 0.06em; }
.tonic-btn i { font-family: var(--mono); font-style: normal; font-size: 8.5px; letter-spacing: 0.08em; color: var(--ink-faint); }
.tonic-btn:hover { border-color: rgba(94, 234, 212, 0.45); }
.tonic-btn.on { border-color: var(--holo); background: rgba(87, 230, 201, 0.12); box-shadow: 0 0 16px rgba(87, 230, 201, 0.15); }
.tonic-btn.on b { color: var(--holo); }

.tonic-read {
  border: 1px solid rgba(94, 234, 212, 0.2); border-radius: 11px;
  padding: 12px 14px; background: rgba(8, 20, 30, 0.7); flex: 1;
}
.tonic-read > b { font-family: var(--disp); font-size: 13.5px; color: var(--cy); letter-spacing: 0.04em; }
.tonic-read p { font-size: 11.5px; line-height: 1.6; color: var(--ink); opacity: 0.88; margin: 8px 0; }
.tonic-note {
  font-family: var(--mono); font-size: 9.5px; line-height: 1.5;
  color: var(--grn); border-top: 1px dashed rgba(94, 234, 212, 0.2); padding-top: 9px;
}

/* ============================ status bar / loader ============================ */
#statusbar {
  height: 26px; display: flex; align-items: center; gap: 22px; padding: 0 18px;
  border-top: 1px solid rgba(94, 234, 212, 0.1);
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.14em; color: var(--ink-faint);
}
.st { display: flex; align-items: center; gap: 7px; }
.st b { color: var(--ink-dim); font-weight: 500; }
.st .dot { width: 5px; height: 5px; }
.dot.g { background: var(--grn); box-shadow: 0 0 7px var(--grn); }
.st.dim { margin-left: auto; }

#loader {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(60% 60% at 50% 40%, #0a1a26, #03070c);
  transition: opacity .7s ease;
}
#loader.done { opacity: 0; pointer-events: none; }
.ld-inner { text-align: center; }
.ld-mark { font-size: 54px; color: var(--holo); text-shadow: 0 0 30px rgba(87,230,201,.8); animation: markPulse 1.6s infinite; }
.ld-title { font-family: var(--disp); font-size: 19px; letter-spacing: 0.3em; margin-top: 18px; }
.ld-sub { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.3em; color: var(--ink-dim); margin-top: 8px; }
.ld-bar { width: 210px; height: 3px; border-radius: 2px; background: rgba(94,234,212,.12); margin: 22px auto 0; overflow: hidden; }
.ld-bar i { display: block; height: 100%; width: 40%; background: var(--holo); border-radius: 2px; animation: ldScan 1.1s ease-in-out infinite; box-shadow: 0 0 12px var(--holo); }
@keyframes ldScan { 0% { transform: translateX(-100%);} 100% { transform: translateX(520%);} }

/* ============================ responsive ============================ */
@media (max-width: 1180px) {
  #view-structure { grid-template-columns: 250px 1fr 250px; }
  .d-name { font-size: 18px; }
}
@media (max-width: 940px) {
  #view-structure { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  #stage { grid-row: 1; min-height: 42vh; }
  .panel.left, .panel.right {
    grid-row: 2; max-height: 34vh; min-height: 150px;
  }
  #view-structure { grid-template-areas: 'stage' 'panels'; }
  #stage { grid-area: stage; }
  /* panels sit side-by-side on medium widths */
  .panel.left { position: absolute; left: 12px; bottom: 12px; width: min(46%, 340px); z-index: 8; }
  .panel.right { position: absolute; right: 12px; bottom: 12px; width: min(46%, 340px); z-index: 8; max-height: 46%; }
  .exp-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
    align-items: start;
    flex: none;
    min-height: 0;
  }
  .exp-card { min-height: 0; }
  .ec-body { grid-template-columns: 1fr; }
  #exp-tonic .ec-body { grid-template-columns: 1fr; }
  .ec-viz { min-height: 320px; }
  .tonic-viz #tonic-gl { min-height: 320px; }
}
@media (max-width: 480px) {
  .b-txt { display: none; }
}
@media (max-width: 640px) {
  #topbar { gap: 10px; padding: 0 10px; height: 52px; }
  .b-txt i { display: none; }
  .b-txt b { font-size: 11px; letter-spacing: 0.08em; white-space: nowrap; }
  #statusbar { display: none; }
  #app { height: calc(100vh - 52px); }
  .proc-head h2, .exp-head h2 { font-size: 16px; }
  .net-eq { font-size: 10.5px; padding: 7px 10px; }
  .proc-caption { padding: 10px 14px 4px; }
  .proc-controls { padding: 8px 14px 12px; }
  .ph { flex-wrap: wrap; }
  .ph-k { letter-spacing: 0.14em; font-size: 10px; }
  .ph input { flex: 1 1 100%; width: auto; }
  .exp-card { padding: 12px; }
  .tab { padding: 8px 9px; font-size: 10.5px; }
  .tab b { display: none; }
  .spec-chip { display: none; }
  #app { height: calc(100vh - 52px - 22px); }
  .panel.left, .panel.right { width: calc(50% - 18px); max-height: 40%; }
  .lbl { font-size: 9px; padding: 4px 6px; }
  #hint-chip { display: none; }
  #control-cluster { right: 8px; }
  #control-cluster button { width: 44px; min-height: 40px; }
  #stage-toolbar { top: 8px; left: 8px; }
  .proc-head { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .view, .lib-detail, #compare-tray { transition: none; }
  .brand .mark, .dot, .ld-bar i { animation: none; }
}
