/* Mini Casino V11 viewer: all styles.
   Colour tokens mirror MC.tokens in js/core.js one to one (same names); ui.js re-applies them at
   runtime so core.js stays the single source. One type scale, one 4/8 spacing scale, three radii. */

/* ------------------------------------------------------------------ tokens */
:root {
  color-scheme: dark;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  /* type scale */
  --t-xs: 11px; --t-s: 12px; --t-m: 13px; --t-b: 14px; --t-l: 16px; --t-xl: 20px; --t-2xl: 28px;
  /* spacing (4/8) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px; --s12: 48px;
  /* radii (MC.tokens.radius) */
  --r-s: 8px; --r-m: 12px; --r-l: 18px; --r-pill: 999px;
  /* motion */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --d1: 150ms; --d2: 200ms; --d3: 250ms;
  /* layout */
  --panel-w: 420px; --bar-h: 56px; --foot-h: 34px; --touch: 32px;

  /* MC.tokens.dark */
  --bg: #0B0D10; --bg2: #11141A; --surface: #14181E; --surface2: #1B2027; --surface3: #232932;
  --line: rgba(255,255,255,0.08); --line2: rgba(255,255,255,0.14);
  --ink: #E9ECF1; --ink2: #B4BCC8; --muted: #7D8794;
  --accent: #3DD68C; --accentInk: #06140D; --accentSoft: rgba(61,214,140,0.14);
  --warn: #F5A524; --danger: #F2555A; --info: #5B9DFF;
  --stageTop: #1A1F27; --stageBottom: #07080A;
  /* MC.tokens.game */
  --game-black: #1F2329; --game-red: #E5484D; --game-green: #30A46C;

  /* derived, per theme */
  --glass: rgba(18, 22, 28, 0.74);
  --glass-strong: rgba(16, 19, 24, 0.9);
  --glass-line: rgba(255,255,255,0.09);
  --card: rgba(255,255,255,0.028);
  --card-line: rgba(255,255,255,0.07);
  --hover: rgba(255,255,255,0.05);
  --press: rgba(255,255,255,0.08);
  --field: rgba(0,0,0,0.28);
  --hi: rgba(255,255,255,0.05);
  --stage-glow: rgba(150,170,200,0.10);
  --shadow-1: 0 1px 2px rgba(0,0,0,0.45);
  --shadow-2: 0 18px 48px -12px rgba(0,0,0,0.65), 0 2px 8px rgba(0,0,0,0.35);
  --shadow-pop: 0 12px 32px -6px rgba(0,0,0,0.6), 0 2px 6px rgba(0,0,0,0.35);
  --ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
  --monitor-bg: #07090C;
  --dangerSoft: rgba(242,85,90,0.13);
  --warnSoft: rgba(245,165,36,0.14);
  --infoSoft: rgba(91,157,255,0.14);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F5F6F8; --bg2: #ECEEF2; --surface: #FFFFFF; --surface2: #F3F5F8; --surface3: #E7EAEF;
  --line: rgba(15,17,21,0.08); --line2: rgba(15,17,21,0.14);
  --ink: #0F1115; --ink2: #3A4250; --muted: #6B7480;
  --accent: #0E9F6E; --accentInk: #FFFFFF; --accentSoft: rgba(14,159,110,0.10);
  --warn: #B7791F; --danger: #D93036; --info: #2F6FEB;
  --stageTop: #F4F5F7; --stageBottom: #D9DDE3;

  --glass: rgba(255,255,255,0.78);
  --glass-strong: rgba(255,255,255,0.94);
  --glass-line: rgba(15,17,21,0.08);
  --card: rgba(255,255,255,0.72);
  --card-line: rgba(15,17,21,0.07);
  --hover: rgba(15,17,21,0.045);
  --press: rgba(15,17,21,0.08);
  --field: rgba(255,255,255,0.9);
  --hi: rgba(255,255,255,0.7);
  --stage-glow: rgba(255,255,255,0.75);
  --shadow-1: 0 1px 2px rgba(15,17,21,0.08);
  --shadow-2: 0 18px 48px -16px rgba(30,40,60,0.28), 0 2px 8px rgba(30,40,60,0.07);
  --shadow-pop: 0 12px 32px -8px rgba(30,40,60,0.28), 0 2px 6px rgba(30,40,60,0.08);
  --monitor-bg: #0E1116;
  --dangerSoft: rgba(217,48,54,0.09);
  --warnSoft: rgba(183,121,31,0.12);
  --infoSoft: rgba(47,111,235,0.10);
}

@media (pointer: coarse) {
  :root { --touch: 44px; }
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--stageBottom);
  color: var(--ink);
  font: 400 var(--t-b)/1.5 var(--font);
  font-feature-settings: "cv11", "ss01", "tnum" 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
button:disabled, [aria-disabled="true"] { cursor: not-allowed; opacity: 0.45; }
a { color: inherit; }
h1, h2, h3, p, dl, dd, figure, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
code, kbd, .mono { font-family: var(--mono); font-feature-settings: normal; }
code { font-size: 0.92em; padding: 1px 5px; border-radius: 5px; background: var(--hover); color: var(--ink2); }
kbd {
  display: inline-block; min-width: 18px; padding: 0 5px; font-size: var(--t-xs); line-height: 17px; text-align: center;
  color: var(--ink2); background: var(--card); border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 5px;
}
::selection { background: var(--accentSoft); color: var(--ink); }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--ring); }
[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ico-s { width: 14px; height: 14px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.skip {
  position: fixed; left: var(--s3); top: var(--s3); z-index: 100; padding: var(--s2) var(--s3);
  background: var(--surface); border-radius: var(--r-s); transform: translateY(-200%); transition: transform var(--d2) var(--ease);
}
.skip:focus { transform: none; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------------ app grid */
.app {
  display: grid;
  height: 100vh;
  height: 100dvh;
  grid-template-columns: minmax(0, 1fr) var(--panel-w);
  grid-template-rows: var(--bar-h) minmax(0, 1fr) var(--foot-h);
  grid-template-areas: "bar bar" "stage panel" "foot foot";
  background:
    radial-gradient(1200px 600px at 32% -10%, var(--stage-glow), transparent 70%),
    linear-gradient(180deg, var(--stageTop) 0%, var(--stageBottom) 100%);
  transition: background-color var(--d3) var(--ease);
}

/* ------------------------------------------------------------------ top bar */
.topbar {
  grid-area: bar;
  display: flex; align-items: center; gap: var(--s4);
  padding: 0 var(--s4) 0 var(--s5);
  min-width: 0;
  position: relative; z-index: 5;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; border-radius: var(--r-s); padding: 4px 6px 4px 2px; margin-left: -2px; }
.brand-mark { width: 24px; height: 24px; color: var(--ink); }
.brand-word { font-size: var(--t-l); font-weight: 650; letter-spacing: -0.015em; color: var(--ink); }
.badge-version {
  font: 600 var(--t-xs)/1 var(--mono); letter-spacing: 0.02em;
  padding: 4px 6px; border-radius: 6px;
  color: var(--accent); background: var(--accentSoft); border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
}
.topbar-sub { font-size: var(--t-s); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; padding-left: var(--s4); border-left: 1px solid var(--line); line-height: 20px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: var(--s1); }
.topbar-divider { width: 1px; height: 20px; background: var(--line2); margin: 0 var(--s2); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; min-width: var(--touch); min-height: var(--touch);
  border-radius: 10px; color: var(--ink2);
  transition: background-color var(--d1) var(--ease), color var(--d1) var(--ease), transform var(--d1) var(--ease);
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn:active { background: var(--press); transform: scale(0.95); }
.icon-btn-s { width: 30px; height: 30px; border-radius: var(--r-s); }
.icon-btn-s .ico { width: 16px; height: 16px; }

.btn-pill {
  display: inline-flex; align-items: center; gap: var(--s2);
  height: 32px; min-height: var(--touch); padding: 0 var(--s3) 0 10px;
  border-radius: var(--r-pill); border: 1px solid var(--line2);
  font-size: var(--t-m); font-weight: 500; color: var(--ink2); text-decoration: none;
  transition: background-color var(--d1) var(--ease), border-color var(--d1) var(--ease), color var(--d1) var(--ease);
}
.btn-pill .ico { width: 16px; height: 16px; }
.btn-pill:hover { background: var(--hover); color: var(--ink); border-color: var(--line2); }

/* ------------------------------------------------------------------ stage */
.stage {
  grid-area: stage;
  position: relative; overflow: hidden; min-width: 0; min-height: 0;
  background: radial-gradient(70% 62% at 50% 46%, var(--stage-glow) 0%, transparent 72%);
  isolation: isolate;
}
.stage::after {
  /* soft studio floor: barely visible horizon where the gradient meets the ground */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 38%; pointer-events: none; z-index: -1;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--stageBottom) 55%, transparent));
}
.stage-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; touch-action: none; cursor: grab; outline: none;
}
.stage-canvas:active { cursor: grabbing; }
.stage-canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.stage[data-hover="true"] .stage-canvas { cursor: pointer; }

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--glass-line);
  box-shadow: var(--shadow-pop), inset 0 1px 0 var(--hi);
}

/* hint */
.stage-hint {
  position: absolute; left: 50%; top: var(--s4); transform: translateX(-50%);
  padding: 6px var(--s3); border-radius: var(--r-pill);
  font-size: var(--t-s); color: var(--ink2); white-space: nowrap; pointer-events: none;
  background: var(--glass); border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  transition: opacity var(--d3) var(--ease), transform var(--d3) var(--ease);
}
.stage-hint.is-out { opacity: 0; transform: translate(-50%, -6px); }

/* focus chips (pinned net, isolated part, build step) */
.stage-chips { position: absolute; left: var(--s4); top: var(--s4); display: flex; flex-direction: column; align-items: flex-start; gap: var(--s2); z-index: 2; }
.chip {
  display: inline-flex; align-items: center; gap: var(--s2);
  height: 32px; padding: 0 4px 0 var(--s3); border-radius: var(--r-pill);
  font-size: var(--t-s); color: var(--ink);
  background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--shadow-1);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  animation: chip-in var(--d2) var(--ease);
}
.chip .chip-kind { color: var(--muted); }
.chip .chip-x { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: var(--muted); transition: background-color var(--d1), color var(--d1); }
.chip .chip-x:hover { background: var(--hover); color: var(--ink); }
.chip .chip-x .ico { width: 14px; height: 14px; }
@keyframes chip-in { from { opacity: 0; transform: translateY(-4px); } }

/* wire swatch: a short piece of insulated wire */
.wire {
  --wire: #888;
  display: inline-block; flex: none; width: 22px; height: 6px; border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0.08) 38%, rgba(0,0,0,0) 55%, rgba(0,0,0,0.28) 100%),
    var(--wire);
  box-shadow: inset 0 0 0 0.5px rgba(0,0,0,0.35);
}
.wire-dot { width: 10px; height: 10px; border-radius: 50%; }

/* tooltip */
.tooltip {
  position: absolute; left: 0; top: 0; z-index: 6; width: max-content; max-width: 300px;
  padding: var(--s3) 14px; border-radius: var(--r-m);
  background: var(--glass-strong); border: 1px solid var(--glass-line); box-shadow: var(--shadow-pop);
  -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%);
  pointer-events: none; opacity: 0; transform: translateY(4px);
  transition: opacity var(--d1) var(--ease), transform var(--d1) var(--ease);
}
.tooltip.is-on { opacity: 1; transform: none; }
.tt-head { display: flex; align-items: center; gap: var(--s2); }
.tt-kind { font-size: var(--t-xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.tt-title { font-size: var(--t-b); font-weight: 600; letter-spacing: -0.005em; }
.tt-desc { margin-top: var(--s1); font-size: var(--t-s); color: var(--ink2); line-height: 1.45; }
.tt-pins { margin-top: var(--s2); padding-top: var(--s2); border-top: 1px solid var(--line); font: var(--t-xs)/1.55 var(--mono); color: var(--ink2); }
.tt-pins div { white-space: nowrap; }
.tt-pins .tt-wrap { white-space: normal; }
.tt-pins b { color: var(--ink); font-weight: 500; }

.tt-desc b { color: var(--ink); font-weight: 600; font-family: var(--mono); font-size: var(--t-xs); }

/* camera dock */
.dock {
  position: absolute; left: 50%; bottom: var(--s5); transform: translateX(-50%);
  display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 14px; z-index: 3;
  background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--shadow-pop), inset 0 1px 0 var(--hi);
  -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%);
  max-width: calc(100% - 2 * var(--s4));
}
.dock-presets { display: flex; gap: 2px; }
.dock-btn {
  height: 32px; min-height: var(--touch); padding: 0 var(--s3); border-radius: 10px;
  font-size: var(--t-m); font-weight: 500; color: var(--ink2); white-space: nowrap;
  transition: background-color var(--d1) var(--ease), color var(--d1) var(--ease), box-shadow var(--d1) var(--ease);
}
.dock-btn:hover { background: var(--hover); color: var(--ink); }
.dock-btn[aria-pressed="true"] { background: var(--surface3); color: var(--ink); box-shadow: var(--shadow-1), inset 0 1px 0 var(--hi); }
:root[data-theme="light"] .dock-btn[aria-pressed="true"] { background: #FFFFFF; }
.dock-icon { width: 36px; padding: 0; display: grid; place-items: center; }
.dock-icon[aria-pressed="true"] { color: var(--accent); }
.dock-sep { width: 1px; height: 18px; background: var(--line2); margin: 0 4px; }

/* camera flash for screenshots */
.flash { position: absolute; inset: 0; background: #FFFFFF; opacity: 0; pointer-events: none; z-index: 7; }
.flash.is-on { animation: flash 420ms var(--ease) both; }
@keyframes flash { 0% { opacity: 0.55; } 100% { opacity: 0; } }

/* loader */
.loader {
  position: absolute; inset: 0; z-index: 8; display: grid; place-items: center;
  background:
    radial-gradient(70% 62% at 50% 46%, var(--stage-glow) 0%, transparent 72%),
    linear-gradient(180deg, var(--stageTop), var(--stageBottom));
  transition: opacity 420ms var(--ease), visibility 0s linear 420ms;
}
.loader.is-done { opacity: 0; visibility: hidden; }
.loader-inner { display: grid; justify-items: center; gap: var(--s3); width: 240px; }
.loader-mark { width: 44px; height: 44px; color: var(--ink); animation: spin-slow 2.8s linear infinite; }
@keyframes spin-slow { to { transform: rotate(360deg); } }
.loader-title { font-size: var(--t-l); font-weight: 600; letter-spacing: -0.01em; margin-top: var(--s1); }
.loader-title span { font: 600 var(--t-xs) var(--mono); color: var(--accent); margin-left: 4px; vertical-align: 2px; }
.loader-bar { width: 100%; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: var(--s2); }
.loader-bar span { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); transition: transform var(--d3) var(--ease); border-radius: 3px; }
.loader-meta { width: 100%; display: flex; justify-content: space-between; font-size: var(--t-s); color: var(--muted); }
.loader-meta span:last-child { font-family: var(--mono); font-size: var(--t-xs); }

/* fallback when webgl is missing */
.fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: var(--s6); z-index: 4; overflow: auto; }
.fallback-inner { display: grid; justify-items: center; gap: var(--s6); max-width: 520px; text-align: center; }
.fallback-oled { width: 100%; display: grid; justify-items: center; }
.fallback-title { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 600; }
.fallback-title .ico { color: var(--warn); }
.fallback-msg { margin-top: var(--s2); color: var(--ink2); font-size: var(--t-m); max-width: 420px; }

/* ------------------------------------------------------------------ panel */
.panel { grid-area: panel; min-height: 0; min-width: 0; display: flex; padding: 0 var(--s3) var(--s1) 0; position: relative; z-index: 4; }
.panel-card {
  flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column;
  border-radius: var(--r-l); overflow: hidden;
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(150%); backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid var(--glass-line);
  box-shadow: var(--shadow-2), inset 0 1px 0 var(--hi);
}

/* tabs: segmented control with a sliding indicator */
.tabs {
  position: relative; flex: none;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px;
  margin: var(--s3) var(--s3) var(--s1); padding: 3px; border-radius: 12px;
  background: var(--field); border: 1px solid var(--line);
}
.tab {
  position: relative; z-index: 1;
  height: 32px; min-height: var(--touch); border-radius: 9px;
  font-size: var(--t-m); font-weight: 500; color: var(--muted); white-space: nowrap;
  transition: color var(--d2) var(--ease);
}
.tab:hover { color: var(--ink2); }
.tab[aria-selected="true"] { color: var(--ink); }
.tab:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.tabs-ink {
  position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 0; width: 0; border-radius: 9px;
  background: var(--surface3); box-shadow: var(--shadow-1), inset 0 1px 0 var(--hi);
  transition: transform var(--d3) var(--ease), width var(--d3) var(--ease);
}
:root[data-theme="light"] .tabs-ink { background: #FFFFFF; box-shadow: 0 1px 3px rgba(15,17,21,0.12), 0 0 0 0.5px rgba(15,17,21,0.06); }

.panel-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: var(--s2) var(--s5) var(--s8); scrollbar-gutter: stable; outline: none; }
.view { animation: view-in var(--d3) var(--ease); }
@keyframes view-in { from { opacity: 0; transform: translateY(4px); } }

/* sections */
.sec { margin-top: var(--s8); }
.sec-first, .view > .sec:first-child { margin-top: var(--s3); }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 28px; margin-bottom: var(--s3); }
.sec-title { font-size: var(--t-xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.sec-aside { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-s); color: var(--muted); text-align: right; }
.sec-aside kbd { margin: 0 1px; }
.sec-tools { display: inline-flex; align-items: center; gap: var(--s1); }
.note { margin-top: var(--s3); font-size: var(--t-s); line-height: 1.55; color: var(--muted); }
.note code { font-size: var(--t-xs); }
.text-btn {
  font-size: var(--t-s); font-weight: 500; color: var(--ink2); padding: 4px var(--s2); border-radius: 6px; min-height: var(--touch);
  transition: background-color var(--d1), color var(--d1);
}
.text-btn:hover { background: var(--hover); color: var(--ink); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; min-height: var(--touch); padding: 0 14px; border-radius: 10px;
  font-size: var(--t-m); font-weight: 550; white-space: nowrap;
  transition: background-color var(--d1) var(--ease), border-color var(--d1) var(--ease), color var(--d1) var(--ease), transform var(--d1) var(--ease), box-shadow var(--d1) var(--ease);
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn .ico { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: var(--accentInk); box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 1px 2px rgba(0,0,0,0.25); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-quiet { background: var(--card); color: var(--ink); border: 1px solid var(--line2); }
.btn-quiet:hover { background: var(--hover); }
.btn-danger { background: var(--danger); color: #FFFFFF; }
.btn-danger:hover { filter: brightness(1.07); }
.btn-danger-quiet { color: var(--danger); border: 1px solid var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: transparent; }
.btn-danger-quiet:hover { background: var(--dangerSoft); }
.btn-icon-text { padding: 0 12px 0 10px; }

/* cards */
.card { background: var(--card); border: 1px solid var(--card-line); border-radius: var(--r-m); }

/* ------------------------------------------------------------------ play: oled module */
.device { display: grid; justify-items: center; padding: var(--s2) 0 0; }
.oled { display: grid; justify-items: center; gap: var(--s2); width: 100%; }
.oled-module {
  position: relative; width: 300px; aspect-ratio: 354 / 335;
  filter: drop-shadow(0 14px 22px rgba(0,0,0,0.42)) drop-shadow(0 2px 3px rgba(0,0,0,0.3));
}
:root[data-theme="light"] .oled-module { filter: drop-shadow(0 14px 20px rgba(20,30,50,0.22)) drop-shadow(0 2px 3px rgba(20,30,50,0.18)); }
.oled-pcb { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.oled-canvas {
  position: absolute; display: block; background: #000;
  image-rendering: pixelated; image-rendering: crisp-edges;
}
.oled-glare {
  position: absolute; pointer-events: none; border-radius: 1px;
  background:
    linear-gradient(118deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0.035) 32%, rgba(255,255,255,0) 33%, rgba(255,255,255,0) 100%),
    linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0) 40%);
  mix-blend-mode: screen;
}
.oled-caption { font: var(--t-xs)/1 var(--mono); color: var(--muted); letter-spacing: 0.02em; }

/* PCB drawing parts (classes inside the inline svg) */
.oled { --pcb: #16418F; --pcb-hi: #1F51AE; --silk: rgba(238,243,255,0.9); --tin: #D7DBE0; }
.oled-pcb .pcb { fill: var(--pcb); }
.oled-pcb .pcb-edge { fill: none; stroke: rgba(0,0,0,0.35); stroke-width: 2; }
.oled-pcb .trace { fill: none; stroke: var(--pcb-hi); stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; opacity: 0.55; }
.oled-pcb .silk { fill: var(--silk); font: 700 9.5px Arial, Helvetica, sans-serif; }
.oled-pcb .silk-s { fill: var(--silk); font: 700 8.5px Arial, Helvetica, sans-serif; letter-spacing: 0.3px; opacity: 0.85; }
.oled-pcb .silk-line { fill: none; stroke: var(--silk); stroke-width: 1.2; opacity: 0.75; }
.oled-pcb .hole { fill: var(--bg2); }
.oled-pcb .ring { fill: var(--tin); }
.oled-pcb .glass-outer { fill: #16181C; stroke: rgba(255,255,255,0.10); stroke-width: 1; }
.oled-pcb .glass-view { fill: #050506; }
.oled-pcb .fpc { fill: #C88A2C; }
.oled-pcb .cog { fill: #2A2D33; }

/* ------------------------------------------------------------------ play: session strip */
.session {
  margin-top: var(--s5);
  display: grid; grid-template-columns: 52px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 14px; row-gap: 10px; align-items: center;
  padding: 14px var(--s4) 14px 14px;
  background: var(--card); border: 1px solid var(--card-line); border-radius: var(--r-m);
  transition: border-color var(--d3) var(--ease), background-color var(--d3) var(--ease);
}
.session[data-live="true"] { border-color: color-mix(in srgb, var(--accent) 32%, transparent); }
.session[data-busy="true"] .ring-fill { stroke: var(--info); }
.session-ring { grid-row: 1 / span 2; position: relative; width: 52px; height: 52px; }
.session-ring svg { width: 52px; height: 52px; transform: rotate(-90deg); display: block; }
.ring-track { fill: none; stroke: var(--line2); stroke-width: 3; }
.ring-fill { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 100 100; stroke-dashoffset: 100; transition: stroke-dashoffset 1000ms linear, stroke var(--d3) var(--ease); }
.session[data-left="low"] .ring-fill { stroke: var(--warn); }
.session[data-left="crit"] .ring-fill { stroke: var(--danger); }
.ring-num { position: absolute; inset: 0; display: grid; place-items: center; font: 600 var(--t-b)/1 var(--mono); color: var(--ink); }
.session[data-live="false"] .ring-num { color: var(--muted); }
.session-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); min-width: 0; }
.session-title { font-size: var(--t-m); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-sub { font: var(--t-xs)/1.4 var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.session-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding-top: 10px; border-top: 1px solid var(--line); }
.stat { position: relative; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.stat + .stat { padding-left: var(--s3); border-left: 1px solid var(--line); }
.stat-label { font-size: var(--t-xs); font-weight: 500; color: var(--muted); letter-spacing: 0.02em; }
.stat-value { font-size: var(--t-l); font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color var(--d3) var(--ease); }
.stat-value.is-up { color: var(--accent); }
.stat-value.is-down { color: var(--danger); }
.stat-delta {
  position: absolute; right: 4px; top: 0; font: 600 var(--t-xs) var(--mono); color: var(--accent);
  opacity: 0; transform: translateY(4px); pointer-events: none;
}
.stat-delta.is-on { animation: delta 1800ms var(--ease) both; }
.stat-delta.is-loss { color: var(--danger); }
.session.is-jackpot { animation: jackpot 2400ms var(--ease) both; }
@keyframes jackpot {
  0% { box-shadow: 0 0 0 0 rgba(48,164,108,0); }
  18% { box-shadow: 0 0 0 3px rgba(48,164,108,0.55), 0 0 36px rgba(48,164,108,0.35); border-color: var(--game-green); }
  100% { box-shadow: 0 0 0 0 rgba(48,164,108,0); }
}
@keyframes delta { 0% { opacity: 0; transform: translateY(6px); } 15% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-4px); } }

/* ------------------------------------------------------------------ play: transponders */
.tags { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
.tag {
  position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 2px 10px;
  min-height: 56px; padding: 10px var(--s3) 10px 10px; text-align: left;
  background: var(--card); border: 1px solid var(--card-line); border-radius: var(--r-m);
  transition: border-color var(--d1) var(--ease), background-color var(--d1) var(--ease), transform var(--d1) var(--ease), box-shadow var(--d1) var(--ease);
}
.tag:hover { background: var(--hover); border-color: var(--line2); }
.tag:active { transform: scale(0.98); }
.tag[data-live="true"] { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: var(--accentSoft); }
.tag-icon { grid-row: 1 / span 2; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--field); border: 1px solid var(--line); }
.tag-icon svg { width: 26px; height: 26px; }
.tag-name { font-size: var(--t-m); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag-uid { grid-column: 2 / span 2; font: var(--t-xs)/1.3 var(--mono); color: var(--muted); letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag-bal { font-size: var(--t-s); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink2); white-space: nowrap; }
.tag-bal.is-new { color: var(--muted); font-weight: 500; }
.tag[data-tapping="true"]::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  border: 1.5px solid var(--info); animation: tapping 900ms var(--ease) infinite;
}
@keyframes tapping { 0% { opacity: 0.9; } 100% { opacity: 0; transform: scale(1.04); } }

/* status badges (shared with the admin table) */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: var(--r-pill);
  font-size: var(--t-xs); font-weight: 600; white-space: nowrap; letter-spacing: 0.01em;
  color: var(--ink2); background: var(--hover); border: 1px solid var(--line);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.badge-ok { color: var(--accent); background: var(--accentSoft); border-color: transparent; }
.badge-ban { color: var(--danger); background: var(--dangerSoft); border-color: transparent; }
.badge-admin { color: var(--info); background: var(--infoSoft); border-color: transparent; }
.badge-warn { color: var(--warn); background: var(--warnSoft); border-color: transparent; }
.badge-plain::before { display: none; }

/* ------------------------------------------------------------------ play: keypad */
/* Same part as the 3D one (parts_misc.js): 69.2 x 76.9 mm overlay #0F1013, 13 mm keys on a
   16.6 x 17.4 mm grid, blue digits #2C66D3, red A-D * # #D63A41, white legends; clear tail with
   eight printed silver conductors at 2.54 mm. --u is one millimetre. */
.keypad-wrap { display: grid; justify-items: center; }
.keypad {
  --kp-w: 300px; --u: calc(var(--kp-w) / 69.2);
  position: relative; width: var(--kp-w); height: calc(var(--u) * 76.9);
  display: grid; grid-template-columns: repeat(4, calc(var(--u) * 13)); grid-template-rows: repeat(4, calc(var(--u) * 13));
  column-gap: calc(var(--u) * 3.6); row-gap: calc(var(--u) * 4.4);
  justify-content: center; align-content: center;
  border-radius: calc(var(--u) * 1.6);
  background:
    radial-gradient(130% 80% at 18% -8%, rgba(255,255,255,0.09), rgba(255,255,255,0) 58%),
    linear-gradient(180deg, #16171B, #0F1013 60%, #0C0D10);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.07), 0 0 0 1px rgba(0,0,0,0.6), 0 18px 30px -12px rgba(0,0,0,0.6), 0 2px 4px rgba(0,0,0,0.3);
}
:root[data-theme="light"] .keypad { box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 0 0 1px rgba(0,0,0,0.55), 0 18px 28px -14px rgba(20,30,50,0.42), 0 2px 4px rgba(20,30,50,0.18); }
.keypad::before {
  /* faint printed frame around the key matrix */
  content: ""; position: absolute; inset: calc(var(--u) * 1.6); border-radius: calc(var(--u) * 1.2); pointer-events: none;
  border: 1px solid rgba(255,255,255,0.05);
}
.key {
  --key: #2C66D3;
  position: relative; display: grid; place-items: center;
  width: 100%; height: 100%; border-radius: calc(var(--u) * 1.7);
  font: 700 calc(var(--u) * 6.6)/1 "Helvetica Neue", Arial, "Segoe UI", sans-serif; color: #F7F8FA;
  background: var(--key);
  background: linear-gradient(180deg, color-mix(in srgb, var(--key) 92%, #FFFFFF) 0%, color-mix(in srgb, var(--key) 94%, #000000) 100%);
  box-shadow:
    0 0 0 calc(var(--u) * 0.25) rgba(0,0,0,0.38),
    inset 0 0 0 calc(var(--u) * 0.55) var(--key), inset 0 0 0 calc(var(--u) * 0.67) rgba(255,255,255,0.17),
    inset 0 calc(var(--u) * 0.4) calc(var(--u) * 0.6) rgba(255,255,255,0.10),
    0 calc(var(--u) * 0.3) calc(var(--u) * 0.6) rgba(0,0,0,0.5);
  transition: transform 90ms var(--ease), box-shadow 90ms var(--ease), filter 90ms var(--ease);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.key::after {
  /* satin sheen of the printed polyester, catches the light at the top left */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(120% 90% at 18% 0%, rgba(255,255,255,0.16), rgba(255,255,255,0) 55%);
}
.key-fn, .key-sym { --key: #D63A41; }
.key[data-key="*"] { font-size: calc(var(--u) * 9.6); padding-top: calc(var(--u) * 2); }
.key[data-key="#"] { font-size: calc(var(--u) * 6.4); }
.key:hover { filter: brightness(1.07); }
.key.is-down, .key:active {
  transform: translateY(1px) scale(0.965);
  box-shadow: 0 0 0 calc(var(--u) * 0.25) rgba(0,0,0,0.35), inset 0 2px 5px rgba(0,0,0,0.4), inset 0 0 0 calc(var(--u) * 0.67) rgba(255,255,255,0.08);
  filter: brightness(0.86);
}
.key:focus-visible { box-shadow: 0 0 0 2px #0F1013, 0 0 0 4px var(--accent); }
.keypad-tail {
  --u: calc(300px / 69.2);
  position: relative; width: calc(var(--u) * 20.3); height: 30px; margin-top: -1px;
  display: flex; justify-content: center; gap: calc(var(--u) * 1.34); padding-top: 2px;
  background: linear-gradient(90deg, rgba(232,236,240,0.5) 0 calc(var(--u) * 0.5), rgba(214,220,226,0.26) calc(var(--u) * 0.5) calc(100% - var(--u) * 0.5), rgba(232,236,240,0.5) calc(100% - var(--u) * 0.5));
  -webkit-mask-image: linear-gradient(180deg, #000 20%, transparent);
  mask-image: linear-gradient(180deg, #000 20%, transparent);
}
.keypad-tail span { width: calc(var(--u) * 1.2); height: 100%; background: linear-gradient(90deg, #9EA5AD, #D7DBDF 50%, #A9AFB6); opacity: 0.85; }

/* key legend */
.legend { margin-top: var(--s4); border: 1px solid var(--card-line); border-radius: var(--r-m); background: var(--card); }
.legend summary, .more summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s2);
  min-height: 40px; padding: 0 var(--s3) 0 14px; cursor: pointer; list-style: none;
  font-size: var(--t-m); font-weight: 500; color: var(--ink2); border-radius: var(--r-m);
}
.legend summary::-webkit-details-marker, .more summary::-webkit-details-marker { display: none; }
.legend summary:hover, .more summary:hover { color: var(--ink); }
.chev { transition: transform var(--d2) var(--ease); color: var(--muted); }
details[open] > summary .chev { transform: rotate(90deg); }
.legend-list { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px var(--s3); padding: 2px 14px 14px; font-size: var(--t-s); }
.legend-list dt { display: flex; gap: 3px; }
.legend-list dd { color: var(--ink2); align-self: center; }
.legend-list .k {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 5px;
  font: 700 var(--t-s)/1 "Helvetica Neue", Arial, sans-serif; background: #2C66D3; color: #F7F8FA; box-shadow: inset 0 -1px 0 rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.18);
}
.legend-list .k-fn, .legend-list .k-sym { background: #D63A41; }
.legend-list .dot-game { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 0; box-shadow: 0 0 0 1px var(--muted); }

/* ------------------------------------------------------------------ monitor (serial + admin console) */
.monitor {
  height: 196px; overflow-y: auto; overflow-x: hidden; padding: 10px 0;
  background: var(--monitor-bg); border: 1px solid var(--card-line); border-radius: var(--r-m);
  font: var(--t-xs)/1.6 var(--mono); color: #AEB6C2;
  box-shadow: inset 0 1px 6px rgba(0,0,0,0.35);
}
.monitor:focus-visible { box-shadow: var(--ring); }
.ln { display: grid; grid-template-columns: 62px 14px minmax(0, 1fr); padding: 0 var(--s3) 0 10px; }
.ln:hover { background: rgba(255,255,255,0.03); }
.ln-t { color: #4F5866; }
.ln-d { color: #4F5866; }
.ln-x { white-space: pre-wrap; word-break: break-word; }
.ln-tx .ln-d, .ln-tx .ln-x { color: #7FB0FF; }
.ln-ok .ln-x { color: #66E0A3; }
.ln-row .ln-x { color: #C3CBD6; }
.ln-err .ln-x { color: #FF8A8E; }
.ln-log .ln-x { color: #8A94A3; }
.ln-sys .ln-x { color: #5E6876; font-style: italic; }
.monitor-empty { padding: 0 var(--s3); color: #4F5866; }

/* mini switch (monitor header) */
.mini-switch { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-s); color: var(--ink2); cursor: pointer; min-height: var(--touch); }
.mini-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mini-switch-ui { position: relative; width: 26px; height: 16px; border-radius: 16px; background: var(--line2); transition: background-color var(--d2) var(--ease); }
.mini-switch-ui::after { content: ""; position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 2px rgba(0,0,0,0.3); transition: transform var(--d2) var(--ease); }
.mini-switch input:checked + .mini-switch-ui { background: var(--accent); }
.mini-switch input:checked + .mini-switch-ui::after { transform: translateX(10px); }
.mini-switch input:focus-visible + .mini-switch-ui { box-shadow: var(--ring); }

/* ------------------------------------------------------------------ explore */
.explode { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--s3); }
.range {
  --p: 0%;
  -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; margin: 0;
}
.range::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--accent) var(--p), var(--line2) var(--p)); }
.range::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line2); }
.range::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
.range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%;
  background: #FFFFFF; border: 0; box-shadow: 0 0 0 1px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.35);
  transition: transform var(--d1) var(--ease);
}
.range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #FFFFFF; border: 0; box-shadow: 0 0 0 1px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.35); }
.range:active::-webkit-slider-thumb { transform: scale(1.12); }
.range:focus-visible { box-shadow: none; }
.range:focus-visible::-webkit-slider-thumb { box-shadow: var(--ring); }

.switches { margin-top: var(--s3); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s2);
  min-height: 44px; padding: 0 var(--s3) 0 14px; border-radius: 10px; cursor: pointer;
  font-size: var(--t-m); font-weight: 500; color: var(--ink2);
  background: var(--card); border: 1px solid var(--card-line);
  transition: background-color var(--d1) var(--ease), color var(--d1) var(--ease), border-color var(--d1) var(--ease);
}
.switch-row:hover { background: var(--hover); color: var(--ink); }
.switches .switch-row:last-child:nth-child(odd) { grid-column: 1 / -1; }
.switch-row:has(.switch:checked) { color: var(--ink); }
.switch-row[aria-disabled="true"] { pointer-events: none; }
.switch {
  -webkit-appearance: none; appearance: none; flex: none; position: relative; margin: 0;
  width: 34px; height: 20px; border-radius: 20px; background: var(--line2); cursor: pointer;
  transition: background-color var(--d2) var(--ease);
}
.switch::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 3px rgba(0,0,0,0.35); transition: transform var(--d2) var(--ease); }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(14px); }

.seg { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--field); border: 1px solid var(--line); }
.seg-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.seg-btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; min-height: var(--touch); padding: 0 var(--s2); border-radius: 9px;
  font-size: var(--t-m); font-weight: 500; color: var(--muted); white-space: nowrap;
  transition: background-color var(--d1) var(--ease), color var(--d1) var(--ease), box-shadow var(--d1) var(--ease);
}
.seg-btn:hover { color: var(--ink); }
.seg-btn[aria-pressed="true"], .seg-btn[aria-checked="true"] { background: var(--surface3); color: var(--ink); box-shadow: var(--shadow-1), inset 0 1px 0 var(--hi); }
:root[data-theme="light"] .seg-btn[aria-pressed="true"], :root[data-theme="light"] .seg-btn[aria-checked="true"] { background: #FFFFFF; box-shadow: 0 1px 3px rgba(15,17,21,0.12), 0 0 0 0.5px rgba(15,17,21,0.06); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1px rgba(0,0,0,0.25); }
.dot-white { background: #F2F6FF; box-shadow: 0 0 0 1px rgba(0,0,0,0.2), 0 0 6px rgba(240,246,255,0.6); }
.dot-blue { background: #39B4FF; box-shadow: 0 0 0 1px rgba(0,0,0,0.2), 0 0 6px rgba(57,180,255,0.6); }
.dot-yb { background: linear-gradient(180deg, #FFD43B 0 40%, #39B4FF 40%); }

.field { margin-top: var(--s4); display: grid; gap: var(--s2); }
.field:first-of-type { margin-top: 0; }
.field-row { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: var(--s4); }
.field-label { font-size: var(--t-s); font-weight: 500; color: var(--ink2); display: flex; align-items: baseline; justify-content: space-between; gap: var(--s2); }
.field-meta { font: var(--t-xs) var(--mono); color: var(--muted); }

.swatches { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s2); }
.swatch {
  display: grid; justify-items: center; gap: 6px; padding: 10px 4px 8px; border-radius: 10px;
  font-size: var(--t-xs); color: var(--muted); background: var(--card); border: 1px solid var(--card-line);
  transition: border-color var(--d1) var(--ease), color var(--d1) var(--ease), background-color var(--d1) var(--ease);
}
.swatch:hover { background: var(--hover); color: var(--ink2); }
.swatch-chip {
  width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,0.55), rgba(255,255,255,0) 46%), var(--sw);
  box-shadow: inset 0 -3px 6px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.18), 0 2px 4px rgba(0,0,0,0.2);
  transition: box-shadow var(--d2) var(--ease);
}
.swatch[aria-checked="true"] { border-color: var(--accent); color: var(--ink); }
.swatch[aria-checked="true"] .swatch-chip { box-shadow: inset 0 -3px 6px rgba(0,0,0,0.25), 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }

/* lists (parts, nets) */
.list { display: grid; gap: 2px; }
.row-btn {
  width: 100%; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 2px var(--s3);
  min-height: 48px; padding: 6px 10px; border-radius: 10px; text-align: left;
  transition: background-color var(--d1) var(--ease);
}
.row-btn:hover { background: var(--hover); }
.row-btn[aria-pressed="true"] { background: var(--accentSoft); }
.row-icon { grid-row: 1 / span 2; width: 28px; height: 28px; display: grid; place-items: center; border-radius: var(--r-s); background: var(--field); border: 1px solid var(--line); color: var(--ink2); }
.row-icon .ico { width: 15px; height: 15px; }
.row-title { font-size: var(--t-m); font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { grid-column: 2; font-size: var(--t-s); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-end { grid-row: 1 / span 2; grid-column: 3; display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-xs); color: var(--muted); }
.row-end .ico { width: 15px; height: 15px; opacity: 0; transition: opacity var(--d1); }
.row-btn:hover .row-end .ico, .row-btn[aria-pressed="true"] .row-end .ico { opacity: 1; }
.row-btn[aria-pressed="true"] .row-end { color: var(--accent); }

.net-group + .net-group { margin-top: var(--s3); }
.net-group-title { font-size: var(--t-xs); color: var(--muted); padding: 0 10px 4px; display: flex; justify-content: space-between; }
.net-btn { grid-template-columns: 28px minmax(0, 1fr) auto; min-height: 40px; }
.net-btn .row-icon { background: none; border: 0; }
.net-btn .wire { width: 24px; height: 7px; }
.net-btn .row-title { font-family: var(--mono); font-size: var(--t-s); font-weight: 500; }

/* ------------------------------------------------------------------ schematic */
.schem-home { position: relative; }
.schem {
  position: relative; height: 340px; overflow: hidden; touch-action: none; cursor: grab;
  background:
    radial-gradient(circle at 1px 1px, var(--line) 1px, transparent 1.2px) 0 0 / 16px 16px,
    var(--card);
  border: 1px solid var(--card-line); border-radius: var(--r-m);
}
.schem.is-panning { cursor: grabbing; }
.schem-svg, .schem-svg > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.schem-svg [data-net], .schem-svg [data-part] { cursor: pointer; transition: opacity var(--d2) var(--ease); }
.schem-svg svg.has-hot [data-net]:not(.is-hot), .schem-svg svg.has-hot [data-part]:not(.is-hot):not(:has(.is-hot)) { opacity: 0.22; }
.schem-svg [data-net].is-hot { filter: drop-shadow(0 0 2px currentColor); }
.schem-zoom {
  position: absolute; right: var(--s2); bottom: var(--s2); padding: 2px 6px; border-radius: 6px;
  font: var(--t-xs) var(--mono); color: var(--muted); background: var(--glass); border: 1px solid var(--glass-line); pointer-events: none;
}
.schem-info { margin-top: var(--s3); min-height: 40px; display: flex; align-items: flex-start; gap: var(--s2); font-size: var(--t-s); color: var(--ink2); line-height: 1.5; }
.schem-info .wire { margin-top: 6px; }
.schem-info b { color: var(--ink); font-weight: 600; }
.schem-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: var(--s6); color: var(--muted); font-size: var(--t-s); cursor: default; }
.schem-empty .ico { width: 22px; height: 22px; margin: 0 auto var(--s2); color: var(--warn); display: block; }
.schem-empty b { display: block; color: var(--ink); font-size: var(--t-m); margin-bottom: 4px; }

/* tables */
.table-wrap { position: relative; border: 1px solid var(--card-line); border-radius: var(--r-m); background: var(--card); overflow-x: auto; overflow-y: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: var(--t-s); font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-size: var(--t-xs); font-weight: 600; color: var(--muted); letter-spacing: 0.04em; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--hover); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .c-num { text-align: right; }
.table .num { text-align: right; font-family: var(--mono); font-size: var(--t-s); }
.netlist td { padding: 7px 10px; }
.netlist tbody tr { cursor: pointer; transition: background-color var(--d1); }
.netlist tbody tr:hover, .netlist tbody tr.is-hot { background: var(--hover); }
.netlist .net-cell { display: flex; align-items: center; gap: var(--s2); white-space: nowrap; font-family: var(--mono); }
.netlist .end { font-family: var(--mono); color: var(--ink2); white-space: nowrap; }
.netlist .end b { color: var(--ink); font-weight: 500; }
.netlist .arrow { color: var(--muted); padding: 0 2px; }
.bom td:first-child { width: 44px; text-align: right; font-family: var(--mono); color: var(--ink); font-weight: 600; }
.bom .item { color: var(--ink); font-weight: 500; }
.bom .note-cell { display: block; color: var(--muted); font-size: var(--t-xs); margin-top: 1px; }

/* ------------------------------------------------------------------ build */
.steps-track { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: var(--s3); }
.step-dot {
  width: 100%; display: grid; justify-items: center; gap: 6px; padding: 6px 0 4px; border-radius: var(--r-s);
  font: 600 var(--t-xs) var(--mono); color: var(--muted);
  transition: color var(--d2) var(--ease), background-color var(--d1);
}
.step-dot:hover { background: var(--hover); color: var(--ink2); }
.step-dot::before { content: ""; width: 100%; height: 3px; border-radius: 3px; background: var(--line2); transition: background-color var(--d3) var(--ease); }
.step-dot.is-done::before { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.step-dot[aria-current="step"] { color: var(--ink); }
.step-dot[aria-current="step"]::before { background: var(--accent); }
.step-card {
  position: relative; padding: var(--s4) var(--s4) var(--s4); min-height: 168px;
  background: var(--card); border: 1px solid var(--card-line); border-radius: var(--r-m);
}
.step-kicker { font: 600 var(--t-xs) var(--mono); color: var(--accent); letter-spacing: 0.04em; }
.step-title { margin-top: 4px; font-size: var(--t-l); font-weight: 650; letter-spacing: -0.01em; }
.step-text { margin-top: var(--s2); font-size: var(--t-m); line-height: 1.6; color: var(--ink2); }
.step-parts { margin-top: var(--s3); display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: var(--r-pill); font-size: var(--t-xs); font-weight: 500; color: var(--ink2); background: var(--hover); border: 1px solid var(--line); }
.step-card.is-anim { animation: view-in var(--d3) var(--ease); }
.step-nav { margin-top: var(--s3); display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.step-count { font: var(--t-xs) var(--mono); color: var(--muted); }

.specs { display: grid; grid-template-columns: minmax(0, 1fr) auto; background: var(--card); border: 1px solid var(--card-line); border-radius: var(--r-m); overflow: hidden; }
.specs dt, .specs dd { padding: 9px 14px; border-bottom: 1px solid var(--line); font-size: var(--t-s); }
.specs dt { color: var(--ink2); }
.specs dd { text-align: right; font-family: var(--mono); color: var(--ink); white-space: nowrap; }
.specs dt:nth-last-of-type(1), .specs dd:nth-last-of-type(1) { border-bottom: 0; }
.specs-mono dt { font-family: var(--mono); font-size: var(--t-xs); }
.more { margin-top: var(--s2); border-radius: var(--r-m); }
.more[open] .specs { margin-top: var(--s1); }
.more summary { padding-left: 4px; color: var(--muted); }

.files { display: grid; gap: var(--s2); }
.file {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 2px var(--s3);
  padding: 10px var(--s3) 10px 10px; border-radius: var(--r-m); text-decoration: none;
  background: var(--card); border: 1px solid var(--card-line);
  transition: background-color var(--d1) var(--ease), border-color var(--d1) var(--ease);
}
.file:hover { background: var(--hover); border-color: var(--line2); }
.file-icon { grid-row: 1 / span 2; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--field); border: 1px solid var(--line); color: var(--ink2); position: relative; }
.file-icon span { position: absolute; bottom: 5px; font: 700 7px var(--mono); color: var(--accent); letter-spacing: 0.04em; }
.file-icon .ico { width: 20px; height: 20px; margin-top: -4px; }
.file-name { font: 600 var(--t-m) var(--mono); color: var(--ink); }
.file-desc { grid-column: 2; font-size: var(--t-s); color: var(--muted); }
.file-dl { grid-row: 1 / span 2; grid-column: 3; display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-s); color: var(--ink2); }
.file:hover .file-dl { color: var(--accent); }

/* ------------------------------------------------------------------ admin */
.admin-head { background: var(--card); border: 1px solid var(--card-line); border-radius: var(--r-m); overflow: hidden; }
.admin-conn { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s3); padding: var(--s3) var(--s2) var(--s3) 14px; }
.admin-title { font-size: var(--t-m); font-weight: 600; }
.admin-title .mono { font-size: var(--t-s); font-weight: 500; margin-left: 4px; }
.admin-sub { font-size: var(--t-xs); color: var(--muted); }
.live-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.live-dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; animation: pulse 2.4s var(--ease) infinite; }
.live-dot-s { width: 6px; height: 6px; }
.live-dot-s::after { inset: -3px; border-width: 1.5px; }
.live-dot.is-off { background: var(--muted); }
.live-dot.is-off::after, .live-dot.is-warn::after { animation: none; }
.live-dot.is-warn { background: var(--warn); }
@keyframes pulse { 0% { opacity: 0.6; transform: scale(0.6); } 70%, 100% { opacity: 0; transform: scale(1.5); } }
.admin-kpis { display: grid; grid-template-columns: 1.3fr 1fr 1fr; border-top: 1px solid var(--line); }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px 12px; min-width: 0; }
.kpi + .kpi { border-left: 1px solid var(--line); }
.kpi-value { font-size: var(--t-b); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter { display: block; height: 3px; border-radius: 3px; background: var(--line2); margin-top: 4px; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width var(--d3) var(--ease); }

.accounts th.c-slot, .accounts td.c-slot { width: 30px; padding-right: 2px; }
.accounts th.c-act, .accounts td.c-act { width: 1%; white-space: nowrap; padding-left: 4px; }
.accounts td { padding: 8px 5px; }
.accounts th { padding-left: 6px; padding-right: 6px; }
.accounts tr { transition: background-color var(--d2) var(--ease); }
.accounts tr.is-live { background: var(--accentSoft); box-shadow: inset 2px 0 0 var(--accent); }
.accounts tr.is-banned .acc-uid { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--danger) 60%, transparent); color: var(--muted); }
.accounts tr.is-flash { animation: row-flash 900ms var(--ease); }
@keyframes row-flash { 0% { background: var(--accentSoft); } 100% { background: transparent; } }
.accounts tr.is-err { animation: row-err 900ms var(--ease); }
@keyframes row-err { 0% { background: var(--dangerSoft); } 100% { background: transparent; } }
.acc-slot { font: 600 var(--t-xs) var(--mono); color: var(--muted); }
.acc-card { display: grid; gap: 3px; min-width: 0; }
.acc-uid { font: 500 var(--t-xs)/1.2 var(--mono); color: var(--ink); letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 104px; }
.acc-meta { display: flex; align-items: center; gap: 5px; flex-wrap: nowrap; white-space: nowrap; }
.acc-kind { font-size: var(--t-xs); color: var(--muted); }
.cell-inf { display: inline-grid; place-items: center end; width: 58px; height: 28px; padding: 0 6px; font: 600 var(--t-s) var(--mono); color: var(--info); }
.cell-input {
  width: 58px; height: 28px; padding: 0 6px; text-align: right; border-radius: 7px;
  font: 500 var(--t-s) var(--mono); font-variant-numeric: tabular-nums; color: var(--ink);
  background: transparent; border: 1px solid transparent;
  background-image: linear-gradient(90deg, var(--line2) 50%, transparent 50%); background-size: 4px 1px; background-repeat: repeat-x; background-position: 6px calc(100% - 4px);
  transition: border-color var(--d1) var(--ease), background-color var(--d1) var(--ease);
  -moz-appearance: textfield; appearance: textfield;
}
.cell-input.is-stake { width: 46px; }
.cell-input::-webkit-outer-spin-button, .cell-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cell-input:hover { border-color: var(--line2); background-color: var(--field); background-image: none; }
.cell-input:focus { border-color: var(--accent); background-color: var(--field); background-image: none; box-shadow: 0 0 0 3px var(--accentSoft); }
.cell-input:disabled { opacity: 1; color: var(--accent); cursor: default; border-color: transparent; background: transparent; }
.acc-actions { display: inline-flex; gap: 0; }
.act {
  display: grid; place-items: center; width: 24px; height: 28px; border-radius: 7px; color: var(--muted);
  transition: background-color var(--d1), color var(--d1);
}
.act .ico { width: 15px; height: 15px; }
.act:hover { background: var(--hover); color: var(--ink); }
.act[aria-pressed="true"].act-ban { color: var(--danger); }
.act[aria-pressed="true"].act-admin { color: var(--info); }
.act-free:hover { color: var(--danger); background: var(--dangerSoft); }
.act.is-confirm { width: auto; padding: 0 8px; font-size: var(--t-xs); font-weight: 600; color: #FFFFFF; background: var(--danger); }
.empty { display: grid; justify-items: center; gap: var(--s2); padding: var(--s6) var(--s4); text-align: center; color: var(--muted); font-size: var(--t-s); }
.empty .ico { width: 22px; height: 22px; }

.add-form { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: var(--s2) var(--s2); align-items: end; }
.input-group { display: grid; gap: 6px; min-width: 0; }
.input {
  width: 100%; height: 38px; min-height: var(--touch); padding: 0 var(--s3); border-radius: 10px;
  font-size: var(--t-m); color: var(--ink); background: var(--field); border: 1px solid var(--line2);
  transition: border-color var(--d1) var(--ease), box-shadow var(--d1) var(--ease);
}
.input::placeholder { color: var(--muted); opacity: 0.7; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accentSoft); }
.input.mono { font-family: var(--mono); font-size: var(--t-s); letter-spacing: 0.02em; }
#add-uid { text-transform: uppercase; }
#add-uid::placeholder { text-transform: none; }
.input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px var(--dangerSoft); }
.input-affix { position: relative; }
.input-affix .input { padding-right: 26px; text-align: right; -moz-appearance: textfield; appearance: textfield; }
.input-affix .input::-webkit-outer-spin-button, .input-affix .input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.input-affix span { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: var(--t-s); pointer-events: none; }
.add-actions { grid-column: 1 / -1; display: flex; gap: var(--s2); }
.add-actions .btn { flex: 1; }
.help { grid-column: 1 / -1; font-size: var(--t-xs); color: var(--muted); }
.help.is-ok { color: var(--accent); }
.help.is-err { color: var(--danger); }

.danger-zone {
  margin-top: var(--s4); display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s3) var(--s3) 14px; border-radius: var(--r-m);
  border: 1px solid var(--dangerSoft); border-color: color-mix(in srgb, var(--danger) 28%, transparent); background: color-mix(in srgb, var(--danger) 4%, transparent);
}
.danger-title { font-size: var(--t-m); font-weight: 600; }
.danger-sub { font-size: var(--t-xs); color: var(--muted); }
.wipe-confirm { grid-column: 1 / -1; padding-top: var(--s3); border-top: 1px solid color-mix(in srgb, var(--danger) 22%, transparent); font-size: var(--t-s); color: var(--ink2); animation: view-in var(--d2) var(--ease); }
.wipe-actions { margin-top: var(--s3); display: flex; justify-content: flex-end; gap: var(--s2); }
.danger-zone.is-confirm #wipe-start { display: none; }

.console { display: grid; gap: var(--s2); }
.monitor-console { height: 180px; }
.console-input {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s2);
  height: 40px; min-height: var(--touch); padding: 0 4px 0 var(--s3); border-radius: 10px;
  background: var(--monitor-bg); border: 1px solid var(--card-line);
  transition: border-color var(--d1), box-shadow var(--d1);
}
.console-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accentSoft); }
.console-prompt { font: 600 var(--t-m) var(--mono); color: var(--accent); }
.console-input input { min-width: 0; height: 100%; border: 0; background: transparent; color: #E6EAF0; font-size: var(--t-s); text-transform: uppercase; }
.console-input input::placeholder { color: #4F5866; text-transform: none; }
.console-input .icon-btn { color: #9AA4B2; }
.console-input .icon-btn:hover { background: rgba(255,255,255,0.06); color: #FFFFFF; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-cmd {
  height: 26px; min-height: var(--touch); padding: 0 9px; border-radius: 7px; font: 500 var(--t-xs) var(--mono); color: var(--ink2);
  background: var(--card); border: 1px solid var(--line);
  transition: background-color var(--d1), color var(--d1), border-color var(--d1);
}
.chip-cmd:hover { background: var(--hover); color: var(--ink); border-color: var(--line2); }

/* ------------------------------------------------------------------ status bar */
.statusbar {
  grid-area: foot; display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  padding: 0 var(--s5); font-size: var(--t-xs); color: var(--muted); min-width: 0;
}
.credits { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-right { display: inline-flex; align-items: center; gap: var(--s4); white-space: nowrap; }
.status-item { display: inline-flex; align-items: center; gap: 6px; }
.status-item.mono { font-size: var(--t-xs); }

/* ------------------------------------------------------------------ toasts */
.toasts {
  position: fixed; z-index: 60; right: calc(var(--panel-w) + var(--s6)); bottom: calc(var(--foot-h) + var(--s5));
  display: grid; gap: var(--s2); justify-items: end; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: var(--s2); max-width: 360px;
  padding: 10px 14px 10px var(--s3); border-radius: var(--r-m);
  font-size: var(--t-m); color: var(--ink);
  background: var(--glass-strong); border: 1px solid var(--glass-line); box-shadow: var(--shadow-pop);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  animation: toast-in var(--d3) var(--ease) both;
}
.toast .ico { width: 16px; height: 16px; color: var(--info); }
.toast-ok .ico { color: var(--accent); }
.toast-err .ico { color: var(--danger); }
.toast-warn .ico { color: var(--warn); }
.toast.is-out { animation: toast-out var(--d2) var(--ease) both; }
.toast .mono { font-size: var(--t-s); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(4px); } }

/* ------------------------------------------------------------------ modal (large schematic) */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: var(--s6); }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4,6,9,0.62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade-in var(--d3) var(--ease); }
:root[data-theme="light"] .modal-backdrop { background: rgba(200,206,215,0.55); }
.modal-card {
  position: relative; width: min(1400px, 100%); height: min(900px, 100%); display: flex; flex-direction: column;
  border-radius: var(--r-l); overflow: hidden; background: var(--surface); border: 1px solid var(--line2); box-shadow: var(--shadow-2);
  animation: modal-in var(--d3) var(--ease);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: 10px 10px 10px var(--s5); border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: var(--t-b); font-weight: 600; }
.modal-body { flex: 1; min-height: 0; padding: var(--s3); display: flex; }
.modal-body .schem { flex: 1; height: auto; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(0.985); } }

/* ------------------------------------------------------------------ medium widths */
@media (max-width: 1100px) {
  .topbar-sub { display: none; }
  :root { --panel-w: 400px; }
}

/* ------------------------------------------------------------------ phone */
@media (max-width: 760px) {
  body { overflow-x: hidden; overflow-y: auto; }
  .app {
    height: auto; min-height: 100vh; min-height: 100dvh;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    grid-template-areas: "bar" "stage" "panel" "foot";
  }
  .topbar { height: 52px; padding: 0 var(--s2) 0 var(--s4); gap: var(--s2); }
  .topbar-actions { gap: 0; }
  .topbar-divider { margin: 0 var(--s1); }
  .gh-text { display: none; }
  .btn-pill { width: var(--touch); padding: 0; justify-content: center; border: 0; }
  .brand-word { font-size: var(--t-b); }
  .stage { height: 52vh; height: 52svh; min-height: 300px; }
  .stage-chips { left: var(--s3); top: var(--s3); }
  .stage-hint { top: var(--s3); font-size: var(--t-xs); }
  .dock { bottom: var(--s3); padding: 3px; gap: 0; border-radius: 13px; }
  .dock-btn { padding: 0 9px; font-size: var(--t-s); }
  .dock-icon { width: var(--touch); padding: 0; }
  .panel { padding: 0; }
  .panel-card { overflow: visible; border-radius: var(--r-l) var(--r-l) 0 0; border-left: 0; border-right: 0; border-bottom: 0; margin-top: -12px; box-shadow: 0 -10px 30px -12px rgba(0,0,0,0.45); background: var(--bg2); -webkit-backdrop-filter: none; backdrop-filter: none; }
  :root[data-theme="light"] .panel-card { background: var(--bg); box-shadow: 0 -10px 30px -16px rgba(30,40,60,0.25); }
  .tabs {
    position: sticky; top: 0; z-index: 20; margin: 0; padding: var(--s2) var(--s3);
    border: 0; border-bottom: 1px solid var(--line); border-radius: var(--r-l) var(--r-l) 0 0;
    background: var(--bg2);
    background: color-mix(in srgb, var(--bg2) 86%, transparent);
    -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%);
  }
  :root[data-theme="light"] .tabs { background: var(--bg); background: color-mix(in srgb, var(--bg) 86%, transparent); }
  .tabs::before { content: ""; position: absolute; inset: var(--s2) var(--s3); border-radius: 12px; background: var(--field); border: 1px solid var(--line); pointer-events: none; z-index: 0; }
  .tabs-ink { top: calc(var(--s2) + 3px); bottom: calc(var(--s2) + 3px); }
  .tab { height: 44px; font-size: var(--t-s); }
  .panel-body { overflow: visible; padding: var(--s2) var(--s4) var(--s8); }
  .statusbar { flex-direction: column; align-items: flex-start; gap: var(--s2); padding: var(--s5) var(--s4) calc(var(--s6) + env(safe-area-inset-bottom)); background: var(--bg2); border-top: 1px solid var(--line); }
  :root[data-theme="light"] .statusbar { background: var(--bg); }
  .credits { white-space: normal; }
  .status-right { flex-wrap: wrap; gap: var(--s3); }
  .toasts { left: var(--s4); right: var(--s4); bottom: calc(var(--s4) + env(safe-area-inset-bottom)); justify-items: center; }
  .modal { padding: 0; }
  .modal-card { width: 100%; height: 100%; border-radius: 0; }
  .schem { height: 300px; }
  .switches { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .accounts thead { display: none; }
  .accounts, .accounts tbody { display: block; }
  .accounts tr { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto; grid-template-areas: "slot card bal stake" "slot act act act"; align-items: center; column-gap: 6px; border-bottom: 1px solid var(--line); padding: 6px 4px; }
  .accounts tr:last-child { border-bottom: 0; }
  .accounts td { border: 0; padding: 2px 4px; }
  .accounts td.c-slot { grid-area: slot; align-self: start; padding-top: 8px; }
  .accounts td.c-card { grid-area: card; }
  .accounts td.c-bal { grid-area: bal; }
  .accounts td.c-stake { grid-area: stake; }
  .accounts td.c-act { grid-area: act; width: auto; justify-self: end; }
  .act { width: 40px; height: 40px; }
  .cell-input { height: 36px; }
}

@media (max-width: 380px) {
  .tags { grid-template-columns: minmax(0, 1fr); }
  .dock-btn { padding: 0 7px; }
}

/* phone landscape: stage and panel side by side again */
@media (max-width: 960px) and (max-height: 500px) and (orientation: landscape) {
  body { overflow: hidden; }
  .app { height: 100vh; height: 100dvh; grid-template-columns: minmax(0, 1fr) 360px; grid-template-rows: 48px minmax(0, 1fr); grid-template-areas: "bar bar" "stage panel"; }
  .statusbar { display: none; }
  .topbar { height: 48px; }
  .stage { height: auto; min-height: 0; }
  .panel { padding: 0 var(--s2) var(--s2) 0; }
  .panel-card { margin: 0; overflow: hidden; border-radius: var(--r-l); border: 1px solid var(--glass-line); background: var(--glass); }
  .tabs { position: relative; margin: var(--s2); padding: 3px; border-radius: 12px; border: 1px solid var(--line); background: var(--field); }
  .tabs::before { display: none; }
  .tabs-ink { top: 3px; bottom: 3px; }
  .tab { height: 36px; }
  .panel-body { overflow-y: auto; }
  .toasts { right: calc(360px + var(--s4)); left: auto; bottom: var(--s4); }
}

/* ------------------------------------------------------------------ motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
  .loader-mark { animation: none; }
  .live-dot::after { display: none; }
}

/* ------------------------------------------------------------------ print: just the panel content */
@media print {
  body { overflow: visible; background: #FFFFFF; }
  .topbar, .stage, .tabs, .statusbar, .toasts { display: none !important; }
  .app { display: block; height: auto; background: none; }
  .panel-card { box-shadow: none; border: 0; background: none; }
  .panel-body { overflow: visible; }
}

.credits a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.credits a:hover { color: var(--ink, inherit); }
