/* ============================================================
   Shared chrome for the nuclear-quantum-effects apps.
   Palette and control layout follow apps/euler_demo.html;
   type is scaled up for projection at 1024x768 (body >= 16px).
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  display: flex;
  height: 100vh;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  background: #0d1117;
  color: #c9d1d9;
}

#left {
  width: 400px;
  min-width: 340px;
  height: 100vh;
  overflow-y: auto;
  background: #161b22;
  border-right: 1px solid #21262d;
  padding: 16px 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

#right {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: #0d1117;
  overflow: hidden;
  padding: 12px 14px 14px;
  gap: 10px;
  min-width: 0;
}

.panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.panel-title {
  font-size: 13px;
  font-weight: 700;
  color: #388bfd;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 4px;
  flex-shrink: 0;
}
.panel canvas { flex: 1; min-height: 0; width: 100%; display: block; }

#back-link {
  display: inline-flex; align-items: center; gap: 4px;
  color: #6e7681; font-size: 14px; font-weight: 500;
  text-decoration: none; padding: 2px 0 4px; flex-shrink: 0;
  transition: color 0.15s;
}
#back-link:hover { color: #c9d1d9; }

h1 { font-size: 18px; font-weight: 700; color: #79c0ff; line-height: 1.35; }
h1 .sub { display: block; font-size: 14px; font-weight: 500; color: #8b949e; margin-top: 3px; }

.card {
  background: #1c2128;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 12px 14px;
}
.card.hero { border-color: #388bfd; background: rgba(56,139,253,0.08); }

.card-label {
  font-size: 12px;
  font-weight: 700;
  color: #388bfd;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  display: block;
  margin-bottom: 9px;
}

/* ── sliders ───────────────────────────────────────────────── */
.sl-row + .sl-row { margin-top: 12px; }
/* preset and sliders live in separate boxes, so the rule above can't reach across */
#preset-box + #slider-box { margin-top: 22px; }
.sl-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 14.5px; color: #8b949e; margin-bottom: 2px; cursor: pointer;
}
.sl-lab { padding-right: 8px; }
.sl-val {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 15px; font-weight: 600; color: #e6edf3;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.sl-val .sl-unit { color: #6e7681; font-size: 13px; }

input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 5px;
  background: #30363d; border-radius: 3px;
  outline: none; cursor: pointer; margin: 6px 0 0;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: #388bfd; cursor: pointer;
}
input[type=range]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: #388bfd; cursor: pointer; border: none;
}

.preset-sel {
  width: 100%; margin-top: 4px; padding: 8px 10px;
  background: #21262d; color: #c9d1d9;
  border: 1px solid #30363d; border-radius: 6px;
  font-size: 15px; font-family: inherit; cursor: pointer;
}
.preset-sel:hover { border-color: #388bfd; }

/* ── segmented buttons ─────────────────────────────────────── */
.mode-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.mode-lbl { font-size: 14px; color: #6e7681; flex-shrink: 0; }
.mode-btns { display: flex; gap: 5px; flex: 1; }
.mode-btn {
  flex: 1; min-height: 38px; padding: 7px 4px;
  background: #21262d; border: 1px solid #30363d; border-radius: 6px;
  color: #8b949e; font-size: 14.5px; font-weight: 600;
  font-family: inherit; cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.mode-btn:hover { border-color: #58a6ff; color: #c9d1d9; }
.mode-btn.active { border-color: #388bfd; color: #79c0ff; background: rgba(56,139,253,0.12); }
.mode-btn.active.m-h { border-color: #58a6ff; color: #58a6ff; background: rgba(88,166,255,0.14); }
.mode-btn.active.m-d { border-color: #f0883e; color: #f0883e; background: rgba(240,136,62,0.14); }
.mode-btn.active.m-t { border-color: #3fb950; color: #3fb950; background: rgba(63,185,80,0.14); }
.mode-btn.active.m-q { border-color: #79c0ff; color: #79c0ff; background: rgba(121,192,255,0.16); }
.mode-btn.active.m-c { border-color: #e3b341; color: #e3b341; background: rgba(227,179,65,0.16); }

/* hero toggle: the primary control, given weight above the sliders */
.hero-btns { display: flex; gap: 8px; }
.hero-btns .mode-btn { min-height: 48px; font-size: 16px; }

/* ── readouts ──────────────────────────────────────────────── */
.r-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 6px 0; border-bottom: 1px solid #21262d;
}
.r-row:last-child { border-bottom: none; }
.r-row.hi { background: rgba(227,179,65,0.08); border-radius: 4px; margin: 0 -5px; padding: 6px 5px; border-bottom: none; }
.r-key { color: #6e7681; font-size: 14.5px; }
.r-val {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 15.5px; font-weight: 600; color: #e6edf3;
  text-align: right; flex: 1; padding-left: 10px;
  font-variant-numeric: tabular-nums;
}
.r-val.h    { color: #58a6ff; }
.r-val.d    { color: #f0883e; }
.r-val.gold { color: #e3b341; }
.r-val.pos  { color: #3fb950; }
.r-val.neg  { color: #f85149; }

/* ── legend ────────────────────────────────────────────────── */
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; color: #8b949e; flex-shrink: 0; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 22px; height: 0; border-top-width: 3px; border-top-style: solid; display: inline-block; }

/* ── notes and warnings ────────────────────────────────────── */
.callout {
  background: rgba(56,139,253,0.07);
  border: 1px solid rgba(56,139,253,0.2);
  border-left: 3px solid #388bfd;
  border-radius: 6px; padding: 10px 12px;
  font-size: 14px; color: #8b949e; line-height: 1.6;
}
.callout em { color: #79c0ff; font-style: normal; }

.warn {
  display: none;
  background: rgba(248,81,73,0.09);
  border: 1px solid rgba(248,81,73,0.35);
  border-left: 3px solid #f85149;
  border-radius: 6px; padding: 10px 12px;
  font-size: 14px; color: #ffa198; line-height: 1.6;
}
.warn.vis { display: block; }

.note {
  font-size: 13px; color: #6e7681; line-height: 1.55;
  border-left: 2px solid #30363d; padding-left: 10px;
}

/* ── rate-equation cards ───────────────────────────────────── */
.eq-row { display: flex; align-items: baseline; gap: 9px; padding: 5px 0; }
.eq-swatch { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; transform: translateY(-1px); }
.eq-name { width: 66px; flex-shrink: 0; color: #8b949e; font-size: 12.5px; }
.eq-formula {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12.5px; color: #e6edf3; line-height: 1.5;
}
.eq-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 12px; }
.eq-table th, .eq-table td { padding: 5px 4px; text-align: center; border-bottom: 1px solid #21262d; }
.eq-table th { color: #6e7681; font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; }
.eq-table td:first-child, .eq-table th:first-child { text-align: left; font-weight: 600; }
.eq-table td.yes { color: #3fb950; font-weight: 700; }
.eq-table td.no  { color: #30363d; }

/* Native MathML: browsers pick a serif math font automatically and honour
   color/font-size, but not automatically from an ancestor in every engine. */
math.eq-math { color: #e6edf3; font-size: 17px; margin: 8px 0 4px; }
.eq-table math { color: #e6edf3; font-size: 13px; }

/* ── accessibility ─────────────────────────────────────────── */
*:focus-visible { outline: 2px solid #388bfd; outline-offset: 2px; }
input[type=range]:focus-visible { outline-offset: 5px; }
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
