/* ===== SpinDecks — retro-arcade theme ===== */
:root {
  --bg: #17131d;
  --bg-2: #1f1a28;
  --panel: #221c2c;
  --panel-2: #2b2436;
  --ink: #f4ecde;
  --ink-dim: #c3b8cf;
  --muted: #8d8299;
  --line: #3a3149;
  --accent: #ff5b52;         /* coral */
  --accent-press: #b93a34;   /* darker coral for the "press" shadow */
  --accent-ink: #2b0b09;     /* text on coral */
  --accent-2: #33d6c0;       /* teal */
  --accent-2-press: #1c968a;
  --accent-2-ink: #05231f;
  --gold: #ffc23c;
  --good: #33d6a0;
  --warn: #ffc23c;
  --danger: #ff5b52;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  --font: ui-sans-serif, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
}

:root[data-theme="light"] {
  --bg: #efe9df;
  --bg-2: #e7dfd2;
  --panel: #fbf7ef;
  --panel-2: #f1ebdf;
  --ink: #241d2b;
  --ink-dim: #4c4356;
  --muted: #877e91;
  --line: #d8cebd;
  --accent: #e5473e;
  --accent-press: #ad2f28;
  --accent-ink: #fff5f2;
  --accent-2: #16a594;
  --accent-2-press: #0f7568;
  --accent-2-ink: #f0fffb;
  --shadow: 0 16px 36px rgba(80, 60, 40, 0.18);
}

* { box-sizing: border-box; }
/* The hidden attribute must always win over component display rules. */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1100px 560px at 12% -12%, rgba(255, 91, 82, 0.10), transparent 60%),
    radial-gradient(1000px 620px at 112% 8%, rgba(51, 214, 192, 0.08), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
#app { min-height: 100%; display: flex; flex-direction: column; }

/* Green Screen mode — solid chroma-key green behind everything, for OBS colour
   keying. Panels/tools keep their own backgrounds so they stay visible; pair
   with fullscreen (F) to key out just the active tool. */
body:has(#app[data-greenscreen="true"]) { background: #00ff00 !important; }
#app[data-greenscreen="true"],
#app[data-greenscreen="true"] .topbar,
#app[data-greenscreen="true"] .view,
#app[data-greenscreen="true"] .stage { background: #00ff00 !important; }

/* ===== Top bar ===== */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px; border-bottom: 2px solid var(--line);
  background: var(--bg-2);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; margin: 0; font-weight: 400; }
.brand-mark { width: 26px; height: 26px; flex: none; display: block; }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-name {
  font-family: var(--mono); font-weight: 800; font-size: 19px;
  letter-spacing: 3px; text-transform: uppercase; color: var(--ink);
}
.brand-tag { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tabs { display: flex; gap: 18px; margin: 0 auto; align-items: center; flex-wrap: wrap; justify-content: center; }
.tab-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tab-group-label {
  font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--muted); margin-right: 2px; white-space: nowrap;
}
.tab {
  border: 2px solid transparent; background: transparent; color: var(--ink-dim);
  padding: 7px 14px; border-radius: 9px; cursor: pointer;
  font-family: var(--mono); font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  transition: background .12s, color .12s;
}
.tab:hover { color: var(--ink); background: var(--panel); }
.tab.is-active {
  color: var(--accent-ink); background: var(--accent);
  box-shadow: 0 3px 0 var(--accent-press);
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }
/* Top-bar tip CTA — gold "coin" pill with a hard pressable shadow. */
.tip-top {
  display: inline-flex; align-items: center; gap: 7px; text-decoration: none;
  height: 40px; padding: 0 14px; border-radius: 10px;
  background: var(--gold); color: #2b0b09; border: 2px solid var(--gold);
  font-family: var(--mono); font-weight: 700; font-size: 13px; letter-spacing: .5px;
  white-space: nowrap; box-shadow: 0 3px 0 #b8871f;
  transition: transform .08s, box-shadow .08s, filter .12s;
}
.tip-top:hover { filter: brightness(1.06); }
.tip-top:active { transform: translateY(3px); box-shadow: 0 0 0 #b8871f; }
.tip-top-emoji { font-size: 15px; line-height: 1; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 2px solid var(--line);
  background: var(--panel); color: var(--ink); cursor: pointer; font-size: 18px;
  display: grid; place-items: center; box-shadow: 0 3px 0 rgba(0,0,0,.4);
  transition: transform .08s, box-shadow .08s, border-color .12s;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn:active { transform: translateY(3px); box-shadow: 0 0 0 rgba(0,0,0,.4); }

.menu { position: relative; }
.menu-panel {
  position: absolute; right: 0; top: 50px; background: var(--panel); border: 2px solid var(--line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 6px; width: 250px; z-index: 40;
  display: flex; flex-direction: column;
}
.menu-panel button, .menu-panel a {
  text-align: left; background: transparent; border: 0; color: var(--ink); padding: 10px 12px;
  border-radius: 8px; cursor: pointer; font-size: 14px; text-decoration: none;
}
.menu-panel button:hover, .menu-panel a:hover { background: var(--panel-2); }

/* ===== Views / layout ===== */
.view { flex: 1; display: grid; gap: 16px; padding: 18px; }
.view-wheel { grid-template-columns: 320px 1fr 260px; }
.view-timer, .view-counter, .view-scores, .view-groups, .view-slots, .view-numbers, .view-dice, .view-firstplayer, .view-scorepad, .view-chessclock, .view-bracket { place-items: start center; }

.panel {
  background: var(--panel); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
h2 { font-family: var(--mono); text-transform: uppercase; letter-spacing: 2px; font-size: 17px; }

/* ===== Editor ===== */
.editor { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.wheel-switcher { display: flex; gap: 6px; flex-wrap: wrap; }
.wheel-switcher select {
  flex: 1 1 130px; min-width: 0; background: var(--panel-2); color: var(--ink); border: 2px solid var(--line);
  border-radius: var(--radius-sm); padding: 9px 10px; font-size: 14px; font-weight: 600;
}
.mini-btn {
  border: 2px solid var(--line); background: var(--panel-2); color: var(--ink); cursor: pointer;
  border-radius: 8px; padding: 7px 10px; font-size: 13px; line-height: 1;
  box-shadow: 0 2px 0 rgba(0,0,0,.4); transition: transform .08s, box-shadow .08s, border-color .12s;
}
.mini-btn:hover { border-color: var(--accent); }
.mini-btn:active { transform: translateY(2px); box-shadow: 0 0 0 rgba(0,0,0,.4); }

.editor-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.entry-count { color: var(--muted); font-size: 13px; font-family: var(--mono); white-space: nowrap; }
.editor-tools { display: flex; gap: 6px; flex-wrap: wrap; }

.entries {
  flex: 1; min-height: 220px; resize: vertical; background: var(--panel-2); color: var(--ink);
  border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 12px; font-size: 15px;
  line-height: 1.6; font-family: var(--font);
}
.entries:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.editor-options { display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-dim); cursor: pointer; }
.opt input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }
.slider-opt { flex-wrap: wrap; }
.slider-opt input[type="range"] { flex: 1; accent-color: var(--accent); }
.slider-opt output { color: var(--ink); font-weight: 700; margin-left: auto; font-family: var(--mono); }

/* ===== Stage / wheel ===== */
.stage { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.wheel-wrap { position: relative; width: min(62vh, 92vw, 620px); aspect-ratio: 1; }
#wheel { width: 100%; height: 100%; display: block; }
.pointer {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0; border-left: 18px solid transparent; border-right: 18px solid transparent;
  border-top: 30px solid var(--gold); filter: drop-shadow(0 3px 5px rgba(0,0,0,.5)); z-index: 5;
}
.spin-hub {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 22%; height: 22%; border-radius: 50%; cursor: pointer;
  border: 5px solid var(--ink); background: var(--accent);
  color: var(--accent-ink); font-family: var(--mono); font-weight: 800;
  font-size: clamp(13px, 2.3vh, 20px); letter-spacing: 1px;
  box-shadow: 0 6px 0 var(--accent-press), 0 10px 18px rgba(0,0,0,.4); transition: transform .08s, box-shadow .08s;
}
.spin-hub:hover { filter: brightness(1.05); }
.spin-hub:active { transform: translate(-50%, calc(-50% + 4px)); box-shadow: 0 2px 0 var(--accent-press), 0 6px 12px rgba(0,0,0,.4); }
.spin-hub:disabled { opacity: .6; cursor: not-allowed; }
.hint { color: var(--muted); font-size: 13px; }
.hint kbd {
  background: var(--panel-2); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 6px; padding: 1px 7px; font-size: 12px; font-family: var(--mono);
}

/* ===== Reel (horizontal) style ===== */
.style-toggle { margin-bottom: 2px; }
.reel-spin { display: none; padding: 12px 44px; font-size: 17px; letter-spacing: 2px; }
#app[data-wheelstyle="reel"] .wheel-wrap {
  width: 100%; max-width: 900px; height: clamp(120px, 20vh, 190px); aspect-ratio: auto;
  border-radius: 12px; overflow: hidden; border: 3px solid var(--line); box-shadow: inset 0 0 22px rgba(0,0,0,.5);
}
#app[data-wheelstyle="reel"] .pointer,
#app[data-wheelstyle="reel"] .spin-hub { display: none; }
#app[data-wheelstyle="reel"] .reel-spin { display: inline-block; }
#app[data-wheelstyle="reel"] .stage { justify-content: flex-start; padding-top: 8px; }
#app[data-present="true"][data-wheelstyle="reel"] .wheel-wrap { max-width: 96vw; height: min(40vh, 320px); }
#app[data-present="true"][data-wheelstyle="reel"] .style-toggle { display: none; }

/* ===== History ===== */
.history { display: flex; flex-direction: column; min-height: 0; }
.history-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.history-head h2 { margin: 0; font-size: 15px; }
.history-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.history-list li {
  display: flex; justify-content: space-between; gap: 8px; padding: 9px 10px; border-radius: 8px;
  font-size: 14px; border: 2px solid transparent;
}
.history-list li:nth-child(odd) { background: var(--panel-2); }
.history-list li.latest { border-color: var(--good); }
.history-list .h-time { color: var(--muted); font-size: 12px; white-space: nowrap; font-family: var(--mono); }

/* ===== Buttons (tactile) ===== */
.btn {
  border: 2px solid var(--line); background: var(--panel-2); color: var(--ink); cursor: pointer;
  padding: 11px 18px; border-radius: var(--radius-sm); font-size: 15px; font-weight: 700;
  box-shadow: 0 3px 0 rgba(0,0,0,.45); transition: transform .08s, box-shadow .08s, border-color .12s;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 rgba(0,0,0,.45); }
.btn.primary {
  background: var(--accent); color: var(--accent-ink); border-color: transparent;
  box-shadow: 0 4px 0 var(--accent-press);
  font-family: var(--mono); letter-spacing: 1px; text-transform: uppercase;
}
.btn.primary:active { transform: translateY(4px); box-shadow: 0 0 0 var(--accent-press); }

/* ===== Segmented toggle ===== */
.seg-toggle { display: inline-flex; background: var(--panel-2); border: 2px solid var(--line); border-radius: 10px; padding: 4px; gap: 4px; }
.seg { border: 0; background: transparent; color: var(--ink-dim); padding: 8px 18px; border-radius: 7px; cursor: pointer; font-family: var(--mono); font-weight: 700; font-size: 13px; letter-spacing: 1px; text-transform: uppercase; }
.seg.is-active { background: var(--accent-2); color: var(--accent-2-ink); box-shadow: 0 2px 0 var(--accent-2-press); }

/* ===== Timer ===== */
.tool-panel { width: min(560px, 94vw); }
.big-clock {
  font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 800; text-align: center;
  font-size: clamp(64px, 16vw, 150px); letter-spacing: 2px; margin: 18px 0; line-height: 1;
}
.big-clock.ending { color: var(--danger); }
.timer-setup { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.preset-row, .custom-time { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center; }
.chip { border: 2px solid var(--line); background: var(--panel-2); color: var(--ink); border-radius: 8px; padding: 8px 14px; cursor: pointer; font-weight: 700; font-family: var(--mono); box-shadow: 0 2px 0 rgba(0,0,0,.4); }
.chip:hover { border-color: var(--accent); }
.chip:active { transform: translateY(2px); box-shadow: 0 0 0 rgba(0,0,0,.4); }
.custom-time input { width: 70px; background: var(--panel-2); color: var(--ink); border: 2px solid var(--line); border-radius: 8px; padding: 8px; font-size: 16px; text-align: center; font-family: var(--mono); }
.timer-controls { display: flex; gap: 10px; justify-content: center; margin: 20px 0 12px; }

/* ===== Counters ===== */
.counter-panel { width: min(900px, 96vw); }
.counter-head { display: flex; align-items: center; justify-content: space-between; }
.counter-head h2 { margin: 0; }
.muted { color: var(--muted); font-size: 14px; }
/* auto-fit + a capped max keeps cards a sensible width and centres them, so a
   single counter (or a partial last row) sits in the middle, not hard-left. */
.counter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 220px)); gap: 14px; margin-top: 14px; justify-content: center; }
.counter-card { background: var(--panel-2); border: 2px solid var(--line); border-radius: var(--radius); padding: 16px; text-align: center; }
.counter-card input.c-name { width: 100%; background: transparent; border: 0; color: var(--ink-dim); text-align: center; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.counter-card input.c-name:focus { outline: 1px solid var(--line); border-radius: 6px; }
.counter-value { font-family: var(--mono); font-size: 52px; font-weight: 800; font-variant-numeric: tabular-nums; margin: 4px 0; }
.counter-btns { display: flex; gap: 8px; justify-content: center; align-items: center; }
.c-step { width: 46px; height: 46px; font-size: 24px; border-radius: 10px; border: 2px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; box-shadow: 0 3px 0 rgba(0,0,0,.4); }
.c-step:hover { border-color: var(--accent); }
.c-step:active { transform: translateY(3px); box-shadow: 0 0 0 rgba(0,0,0,.4); }
.c-step.big { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 3px 0 var(--accent-press); }
.counter-foot { display: flex; justify-content: space-between; margin-top: 12px; }
.link-btn { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; text-decoration: underline; }
.link-btn:hover { color: var(--danger); }

/* ===== Groups / team maker ===== */
.groups-panel { width: min(900px, 96vw); display: flex; flex-direction: column; gap: 14px; }
.groups-panel .entries { min-height: 150px; }
.groups-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.group-num { display: flex; align-items: center; gap: 8px; color: var(--ink-dim); font-size: 14px; }
.group-num input { width: 74px; background: var(--panel-2); color: var(--ink); border: 2px solid var(--line); border-radius: 8px; padding: 8px; font-size: 16px; text-align: center; font-family: var(--mono); }
.groups-controls .btn { margin-left: auto; }
.groups-result-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.group-card { text-align: left; }
.group-card .c-name { text-align: left; font-size: 16px; color: var(--ink); }
.group-count { font-size: 12px; margin-bottom: 8px; font-family: var(--mono); }
.group-members { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.group-members li { background: var(--panel); border: 2px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 14px; }

/* ===== Scoreboard ===== */
.scores-panel { width: min(1000px, 96vw); }
.scores-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.score-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-top: 14px; }
.score-card { background: var(--panel-2); border: 2px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; position: relative; }
.score-card.leader { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.score-head { display: flex; align-items: center; gap: 6px; }
.score-head .rank { font-family: var(--mono); font-weight: 800; font-size: 15px; min-width: 34px; text-align: left; color: var(--gold); }
.s-name { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--ink); text-align: center; font-weight: 700; font-size: 15px; }
.s-name:focus { outline: 1px solid var(--line); border-radius: 6px; }
.score-head .link-btn { font-size: 11px; }
.s-score { width: 100%; background: transparent; border: 0; color: var(--ink); text-align: center; font-family: var(--mono); font-size: 46px; font-weight: 800; font-variant-numeric: tabular-nums; margin: 2px 0 8px; -moz-appearance: textfield; }
.s-score:focus { outline: 1px solid var(--line); border-radius: 8px; }
.s-score::-webkit-outer-spin-button, .s-score::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.s-controls { display: flex; gap: 8px; justify-content: center; align-items: center; }
.s-step { width: 54px; background: var(--panel); color: var(--ink); border: 2px solid var(--line); border-radius: 8px; padding: 6px; text-align: center; font-family: var(--mono); }
.s-chips { display: flex; gap: 6px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.s-chip { border: 2px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; padding: 5px 11px; cursor: pointer; font-size: 13px; font-weight: 700; font-family: var(--mono); }
.s-chip:hover { border-color: var(--accent-2); }
.scores-mode { margin: 12px 0 4px; flex-wrap: wrap; }
.score-setup { margin: 8px 0; }
.score-setup-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.score-setup-item { display: flex; align-items: center; gap: 6px; color: var(--ink-dim); font-size: 14px; }
.setup-num { width: 78px; background: var(--panel-2); color: var(--ink); border: 2px solid var(--line); border-radius: 8px; padding: 7px; text-align: center; font-family: var(--mono); }
.score-card.reached { border-color: var(--good); box-shadow: 0 0 0 1px var(--good) inset; }
.score-card.reached .rank { color: var(--good); }
/* Darts */
.darts-card.active { border-color: var(--accent-2); box-shadow: 0 0 0 2px var(--accent-2) inset; }
.darts-card.winner { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.darts-rem { margin: 2px 0 2px; }
.darts-meta { color: var(--muted); font-size: 12px; font-family: var(--mono); }
.darts-turn { display: flex; gap: 6px; justify-content: center; margin-top: 10px; }
.darts-input { width: 92px; background: var(--panel); color: var(--ink); border: 2px solid var(--line); border-radius: 8px; padding: 8px; text-align: center; font-family: var(--mono); font-size: 18px; -moz-appearance: textfield; }
.darts-input::-webkit-outer-spin-button, .darts-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.darts-turn .btn { padding: 8px 14px; }
.darts-badge { margin-top: 10px; font-family: var(--mono); font-weight: 800; letter-spacing: 1px; color: var(--gold); }
/* Cricket */
.cricket-wrap { overflow-x: auto; margin-top: 12px; }
.cricket-table { border-collapse: separate; border-spacing: 6px; margin: 0 auto; }
.cricket-table th, .cricket-table td { text-align: center; }
.cricket-table thead th { padding: 0 4px; min-width: 84px; }
.cricket-table thead th.winner .cricket-name { color: var(--gold); }
.cricket-name { width: 100%; background: transparent; border: 0; color: var(--ink); text-align: center; font-weight: 700; font-family: var(--mono); font-size: 14px; }
.cricket-name:focus { outline: 1px solid var(--line); border-radius: 6px; }
.cricket-num { font-family: var(--mono); font-weight: 800; color: var(--ink-dim); padding-right: 6px; text-align: right; min-width: 44px; }
.cricket-cell {
  width: 84px; height: 46px; border-radius: 8px; border: 2px solid var(--line); background: var(--panel-2);
  color: var(--ink); font-family: var(--mono); font-weight: 800; font-size: 22px; cursor: pointer;
  box-shadow: 0 2px 0 rgba(0,0,0,.4); transition: transform .08s, box-shadow .08s, border-color .12s;
}
.cricket-cell:hover { border-color: var(--accent-2); }
.cricket-cell:active { transform: translateY(2px); box-shadow: 0 0 0 rgba(0,0,0,.4); }
.cricket-cell.closed { background: var(--accent-2); color: var(--accent-2-ink); border-color: transparent; }
.cricket-cell:disabled { opacity: .7; cursor: default; }
.cricket-points-row th { color: var(--ink-dim); font-family: var(--mono); text-align: right; padding-right: 6px; }
.cricket-points { font-family: var(--mono); font-weight: 800; font-size: 20px; color: var(--gold); }

/* ===== Random numbers ===== */
.numbers-panel { width: min(720px, 96vw); text-align: center; }
.numbers-panel .counter-head { justify-content: center; }
.numbers-controls { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; align-items: center; margin: 14px 0; }
.numbers-presets { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 16px; }
.numbers-go { padding: 13px 44px; font-size: 17px; letter-spacing: 2px; }
.numbers-result { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; align-items: center; min-height: 96px; margin: 18px 0 8px; }
.num-chip {
  font-family: var(--mono); font-weight: 800; font-variant-numeric: tabular-nums;
  background: var(--panel-2); border: 2px solid var(--line); border-radius: 12px;
  padding: 12px 18px; font-size: 34px; color: var(--accent); box-shadow: 0 4px 0 rgba(0,0,0,.4);
}
.num-chip.solo { font-size: clamp(64px, 15vw, 130px); padding: 10px 30px; color: var(--accent); border-color: var(--accent); }
.numbers-foot { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 24px; }

/* ===== Slots (multiple reels) ===== */
.slots-panel { width: min(1120px, 97vw); }
.slots-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.slots-controls { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 12px 0 4px; }
.slots-controls label { display: flex; align-items: center; gap: 8px; color: var(--ink-dim); font-size: 14px; }
.slots-controls select, .slot-source select {
  background: var(--panel-2); color: var(--ink); border: 2px solid var(--line);
  border-radius: 8px; padding: 7px 9px; font-size: 13px; font-weight: 600;
}
.slots-controls input[type="number"] { width: 62px; background: var(--panel-2); color: var(--ink); border: 2px solid var(--line); border-radius: 8px; padding: 7px; text-align: center; font-family: var(--mono); }
.slot-reels { display: flex; gap: 14px; justify-content: center; align-items: flex-start; flex-wrap: wrap; margin: 16px 0; }
.slot { display: flex; flex-direction: column; gap: 8px; align-items: center; width: 150px; }
.slot-frame {
  position: relative; width: 150px; height: 300px; border-radius: 12px; overflow: hidden; cursor: pointer;
  border: 4px solid var(--line); background: #0c0a10;
  box-shadow: inset 0 0 26px rgba(0,0,0,.7), 0 5px 0 rgba(0,0,0,.45);
  transition: border-color .12s;
}
.slot-frame:hover { border-color: var(--accent-2); }
.slot-spin-one { width: 100%; }
.slot-frame canvas { width: 100%; height: 100%; display: block; }
.slot-source { width: 100%; }
.slot-source select { width: 100%; }
.slot-result { font-family: var(--mono); font-weight: 700; font-size: 14px; color: var(--gold); min-height: 18px; text-align: center; word-break: break-word; }
.slots-spin { padding: 14px 52px; font-size: 18px; letter-spacing: 3px; }
.slots-footer { display: flex; justify-content: center; margin-top: 6px; }
.slots-results { max-width: 520px; margin: 24px auto 0; }
.slots-results .history-list { max-height: 220px; }

/* ===== Modal ===== */
.modal { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(8, 6, 12, .68); z-index: 60; backdrop-filter: blur(4px); }
.modal-card { background: var(--panel); border: 3px solid var(--line); border-radius: 18px; padding: 34px 44px; text-align: center; box-shadow: var(--shadow); max-width: 90vw; animation: pop .28s ease; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-eyebrow { font-family: var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 4px; font-size: 12px; margin: 0 0 6px; }
.modal-winner { font-family: var(--mono); font-size: clamp(30px, 6vw, 58px); font-weight: 800; margin: 0 0 22px; color: var(--accent); word-break: break-word; }
.modal-sub { color: var(--ink-dim); font-size: 15px; margin: -12px 0 22px; }
.modal-actions { display: flex; gap: 12px; justify-content: center; }
.modal-card.eliminated .modal-winner { color: var(--danger); }
.modal-card.eliminated .modal-eyebrow { color: var(--danger); }
.modal-card.champion .modal-winner { color: var(--gold); }
.modal-card.champion .modal-eyebrow { color: var(--gold); }
.opt-hint { color: var(--muted); font-size: 12px; }

/* ===== SpinDecks Pro & support modal ===== */
.support-card { text-align: left; width: 460px; max-width: 92vw; padding: 26px 28px; }
.pro-badge { color: var(--gold); }
.support-lead { margin: 6px 0 18px; font-size: 14px; line-height: 1.5; }
.pro-list { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 11px; }
.pro-list li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-dim); }
.pro-soon {
  flex: none; font-family: var(--mono); font-size: 10px; font-weight: 800;
  letter-spacing: 1px; text-transform: uppercase; color: #2b0b09; background: var(--gold);
  padding: 2px 7px; border-radius: 999px;
}
.wait-form { display: flex; gap: 8px; margin: 0; }
.wait-input {
  flex: 1; min-width: 0; background: var(--panel-2); color: var(--ink);
  border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 15px;
}
.wait-input:focus { outline: none; border-color: var(--accent); }
.wait-note { margin: 10px 0 0; font-size: 14px; }
.tip-block { margin-top: 20px; padding-top: 16px; border-top: 2px solid var(--line); }
.tip-block p { margin: 0 0 12px; font-size: 14px; }
.tip-btn { display: inline-block; text-decoration: none; text-align: center; }

/* ===== Slice images modal ===== */
.images-card { text-align: left; width: min(460px, 92vw); padding: 22px 24px; }
.images-head { display: flex; align-items: center; justify-content: space-between; }
.images-head h2 { margin: 0; font-size: 18px; }
.images-list { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; }
.image-row { display: flex; align-items: center; gap: 10px; padding: 8px; border: 2px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); }
.image-thumb { width: 44px; height: 44px; border-radius: 8px; overflow: hidden; flex: none; display: grid; place-items: center; background: var(--panel); border: 2px solid var(--line); font-size: 18px; color: var(--muted); }
.image-thumb img { width: 100%; height: 100%; object-fit: cover; }
.image-name { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-row .mini-btn:disabled { opacity: .4; cursor: default; }

/* ===== Confetti + toast ===== */
.confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 55; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--panel); border: 2px solid var(--accent); color: var(--ink); padding: 12px 20px; border-radius: 10px; box-shadow: var(--shadow); z-index: 70; font-size: 14px; }

/* ===== Fullscreen / focus mode (works on any tab) ===== */
#present-exit { position: fixed; top: 16px; right: 16px; z-index: 30; }
#app[data-present="true"] .topbar { display: none; }
/* Center the active tool, strip panel chrome, fill the screen. */
#app[data-present="true"] .view { padding: 0; min-height: 100vh; place-items: center; align-content: center; }
#app[data-present="true"] .panel { border: 0; box-shadow: none; background: transparent; width: 100%; max-width: 1100px; }
/* Hide descriptions / secondary headings across tools. */
#app[data-present="true"] .muted,
#app[data-present="true"] .hint,
#app[data-present="true"] .counter-head > h2,
#app[data-present="true"] .slots-head { display: none; }

/* Wheel */
#app[data-present="true"] .editor,
#app[data-present="true"] .history,
#app[data-present="true"] .style-toggle { display: none; }
#app[data-present="true"] .view-wheel { grid-template-columns: 1fr; }
#app[data-present="true"] .stage { min-height: 100vh; justify-content: center; }
#app[data-present="true"] .wheel-wrap { width: min(86vh, 92vw); }
#app[data-present="true"][data-wheelstyle="reel"] .wheel-wrap { width: 94vw; height: min(52vh, 420px); }

/* Slots — hide dropdowns, per-reel buttons, controls, results; big reels. */
#app[data-present="true"] .slots-controls,
#app[data-present="true"] .slot-source,
#app[data-present="true"] .slot-spin-one,
#app[data-present="true"] .slots-results { display: none; }
#app[data-present="true"] .slot { width: auto; }
#app[data-present="true"] .slot-frame { width: min(22vw, 190px); height: min(66vh, 620px); }

/* Numbers — huge result, keep controls + generate. */
#app[data-present="true"] .num-chip.solo { font-size: clamp(90px, 30vh, 320px); }
#app[data-present="true"] .num-chip { font-size: clamp(40px, 9vh, 90px); }

/* Counters — bigger tallies. */
#app[data-present="true"] .counter-value { font-size: clamp(64px, 13vh, 150px); }
#app[data-present="true"] .counter-grid { gap: 20px; }

/* Timer — the clock is already large; just let it breathe. */
#app[data-present="true"] .big-clock { font-size: clamp(90px, 26vh, 300px); }

/* ===== Responsive ===== */
@media (max-width: 1040px) {
  .view-wheel { grid-template-columns: 1fr; }
  .editor, .history { max-width: 640px; margin: 0 auto; width: 100%; }
  .stage { order: -1; }
}
/* The seven tabs plus the tip button stop fitting a single row before the brand
   would clip — drop the tabs onto their own centred row well before that. */
@media (max-width: 1240px) {
  .topbar { flex-wrap: wrap; row-gap: 10px; }
  .tabs { order: 3; flex-basis: 100%; margin: 0; justify-content: center; flex-wrap: wrap; }
  .topbar-actions { margin-left: auto; }
}
/* Hide the tagline before the (now seven) tabs would crowd it. */
@media (max-width: 1080px) { .brand-tag { display: none; } }
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; row-gap: 10px; padding: 10px 12px; gap: 10px; }
  .brand-tag { display: none; }
  .topbar-actions { margin-left: auto; }
  /* Collapse the tip CTA to just the emoji so it doesn't crowd the bar. */
  .tip-top-label { display: none; }
  .tip-top { padding: 0 11px; }
  .tabs { order: 3; flex-basis: 100%; margin: 0; flex-wrap: wrap; justify-content: center; gap: 10px; }
  /* Give each group its own centred row so the labels stay readable. */
  .tab-group { flex-basis: 100%; justify-content: center; gap: 4px; }
  .tab { padding: 7px 11px; font-size: 12px; }
  .view { padding: 12px; gap: 12px; }
  .panel { min-width: 0; }
  .wheel-wrap { width: min(62vh, 84vw, 620px); }
}
@media (max-width: 400px) {
  .tab { padding: 6px 8px; font-size: 11px; letter-spacing: .5px; }
  .icon-btn { width: 36px; height: 36px; font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .modal-card { animation: none; }
  * { scroll-behavior: auto; }
}

/* ===== Multi-page: links, tool prose, footer, hub, static pages ===== */

/* Brand and tabs are now real links */
.brand { text-decoration: none; color: inherit; }
.tab { text-decoration: none; }
a.tab { display: inline-flex; align-items: center; }
.topbar-simple { }
.tab[aria-current="page"], .tab.is-active {
  color: var(--accent-ink); background: var(--accent); box-shadow: 0 3px 0 var(--accent-press);
}

/* --- Tool page SEO prose (below the app) --- */
.tool-copy {
  max-width: 760px; margin: 8px auto 56px; padding: 8px 20px 0;
  color: var(--ink-dim); line-height: 1.6;
}
.tool-copy h1 {
  font-family: var(--mono); text-transform: none; letter-spacing: -.5px;
  font-size: clamp(24px, 4vw, 32px); color: var(--ink); margin: 0 0 12px;
}
.tool-copy h2 {
  font-size: 18px; color: var(--ink); margin: 26px 0 10px; text-transform: none; letter-spacing: 0;
}
.tool-copy .tool-intro { font-size: 17px; color: var(--ink-dim); margin: 0 0 8px; }
.tool-copy ol, .tool-copy ul { margin: 0; padding-left: 22px; }
.tool-copy li { margin: 6px 0; }
.tool-copy .tool-who { list-style: none; padding-left: 0; }
.tool-copy .tool-who li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.tool-copy code { font-family: var(--mono); background: var(--panel-2); padding: 1px 6px; border-radius: 6px; font-size: .92em; }
.tool-faq details {
  border: 2px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel); margin: 8px 0; overflow: hidden;
}
.tool-faq summary {
  cursor: pointer; padding: 12px 14px; font-weight: 700; color: var(--ink);
  list-style: none;
}
.tool-faq summary::-webkit-details-marker { display: none; }
.tool-faq summary::after { content: "+"; float: right; color: var(--muted); font-family: var(--mono); }
.tool-faq details[open] summary::after { content: "–"; }
.tool-faq p { margin: 0; padding: 0 14px 14px; }

/* --- Footer --- */
.site-footer {
  border-top: 2px solid var(--line); background: var(--bg-2);
  padding: 32px 20px 24px; margin-top: auto;
}
.footer-cols {
  max-width: 1000px; margin: 0 auto; display: grid; gap: 24px;
  grid-template-columns: 2fr 1fr 1fr;
}
.footer-col { display: flex; flex-direction: column; gap: 6px; }
.footer-brand { font-family: var(--mono); font-weight: 800; letter-spacing: 2px; text-transform: uppercase; color: var(--ink); margin: 0; }
.footer-head { font-family: var(--mono); font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin: 0 0 4px; }
.footer-col a { color: var(--ink-dim); text-decoration: none; font-size: 14px; }
.footer-col a:hover { color: var(--accent); }
.footer-legal { max-width: 1000px; margin: 24px auto 0; font-size: 12px; text-align: center; }

/* --- Static + hub pages --- */
.page-static { display: flex; flex-direction: column; min-height: 100vh; }
.static-main { max-width: 820px; margin: 0 auto; padding: 32px 20px 48px; flex: 1; width: 100%; }
.static-main h1 { font-family: var(--mono); font-size: clamp(26px, 5vw, 38px); color: var(--ink); margin: 0 0 16px; letter-spacing: -.5px; }
.prose { color: var(--ink-dim); line-height: 1.65; }
.prose h2 { color: var(--ink); font-size: 19px; margin: 26px 0 8px; text-transform: none; letter-spacing: 0; }
.prose a { color: var(--accent); }
.prose code { font-family: var(--mono); background: var(--panel-2); padding: 1px 6px; border-radius: 6px; }
.lede { font-size: 18px; color: var(--ink); margin: 0 0 20px; }

.hub-main { text-align: center; }
.hub-main .lede { max-width: 640px; margin: 0 auto 28px; color: var(--ink-dim); }
.hub-grid {
  display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  text-align: left; margin-top: 8px;
}
.hub-card {
  display: flex; flex-direction: column; gap: 6px; text-decoration: none;
  background: var(--panel); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: 0 3px 0 rgba(0,0,0,.35); transition: transform .08s, border-color .12s, box-shadow .08s;
}
.hub-card:hover { border-color: var(--accent); }
.hub-card:active { transform: translateY(3px); box-shadow: 0 0 0 rgba(0,0,0,.35); }
.hub-card-title { font-family: var(--mono); font-weight: 800; font-size: 17px; color: var(--ink); }
.hub-card-desc { font-size: 14px; color: var(--muted); line-height: 1.5; }
.notfound { text-align: center; }

@media (max-width: 640px) {
  .footer-cols { grid-template-columns: 1fr 1fr; }
  .footer-col:first-child { grid-column: 1 / -1; }
}

/* ===== Dice roller ===== */
.dice-panel { width: min(560px, 94vw); text-align: center; }
.dice-panel .counter-head { justify-content: center; }
.dice-input-row { display: flex; gap: 8px; margin: 12px 0 4px; }
.dice-input {
  flex: 1; min-width: 0; background: var(--panel-2); color: var(--ink);
  border: 2px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 18px; font-family: var(--mono); letter-spacing: 1px;
}
.dice-input:focus { outline: none; border-color: var(--accent); }
.dice-error { color: var(--danger); font-size: 13px; margin: 4px 0 0; min-height: 1em; }
.dice-quick, .dice-presets { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 12px 0; }
.dice-presets { margin-top: 4px; }
.dice-result { min-height: 120px; margin: 14px 0 6px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.dice-total {
  font-family: var(--mono); font-weight: 800; font-size: clamp(56px, 14vw, 96px);
  color: var(--accent); line-height: 1; font-variant-numeric: tabular-nums;
}
.dice-total.pop { animation: dice-pop .28s ease; }
@keyframes dice-pop { from { transform: scale(.7); opacity: .4; } to { transform: scale(1); opacity: 1; } }
.dice-breakdown { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
.dice-group { display: inline-flex; flex-wrap: wrap; gap: 5px; }
.die-chip {
  display: inline-grid; place-items: center; min-width: 38px; height: 38px; padding: 0 8px;
  background: var(--panel-2); border: 2px solid var(--line); border-radius: 9px;
  font-family: var(--mono); font-weight: 700; font-size: 17px; color: var(--ink);
}
.die-chip.dropped { color: var(--muted); text-decoration: line-through; opacity: .6; }
.dice-op { font-family: var(--mono); color: var(--muted); font-size: 20px; }
.dice-mod { font-family: var(--mono); font-weight: 700; font-size: 18px; color: var(--ink-dim); }
.dice-history-wrap { margin-top: 18px; text-align: left; }
.dice-history-wrap .history-head { justify-content: space-between; }

@media (prefers-reduced-motion: reduce) {
  .dice-total.pop { animation: none; }
}

/* Dice tumble while rolling (JS skips this for prefers-reduced-motion). */
.die-chip.rolling { animation: die-tumble .18s steps(2) infinite; border-color: var(--accent); color: var(--ink); }
@keyframes die-tumble {
  0%   { transform: translateY(0) rotate(-6deg); }
  100% { transform: translateY(-3px) rotate(6deg); }
}
@media (prefers-reduced-motion: reduce) {
  .die-chip.rolling { animation: none; }
}

/* ===== First player picker ===== */
.fp-panel { width: min(480px, 94vw); text-align: center; }
.fp-panel .seg-toggle { display: flex; justify-content: center; margin: 0 auto 16px; }
.fp-mode { margin-bottom: 12px; }
.fp-q { color: var(--ink-dim); font-size: 16px; margin: 8px 0 12px; }
.fp-step-row { display: flex; align-items: center; justify-content: center; gap: 20px; }
.fp-step-btn {
  width: 64px; height: 64px; border-radius: 16px; border: 2px solid var(--line);
  background: var(--panel-2); color: var(--ink); font-size: 34px; line-height: 1; cursor: pointer;
  box-shadow: 0 3px 0 rgba(0,0,0,.4); transition: transform .08s, box-shadow .08s, border-color .12s;
}
.fp-step-btn:hover { border-color: var(--accent); }
.fp-step-btn:active { transform: translateY(3px); box-shadow: 0 0 0 rgba(0,0,0,.4); }
.fp-num { font-family: var(--mono); font-weight: 800; font-size: 56px; min-width: 84px; font-variant-numeric: tabular-nums; }
#fpNames .entries { min-height: 150px; }
.fp-pick { display: block; width: 100%; padding: 16px; font-size: 18px; letter-spacing: 1px; margin-top: 4px; }
.fp-order-btn { margin-top: 10px; }
.fp-result { min-height: 60px; margin-top: 16px; }
.fp-winner {
  font-family: var(--mono); font-weight: 800; font-size: clamp(26px, 6vw, 42px);
  color: var(--accent); line-height: 1.1; word-break: break-word;
}
.fp-winner.pop { animation: dice-pop .3s ease; }
.fp-order-list { list-style: none; padding: 0; margin: 14px 0 0; text-align: left; }
.fp-order-list li { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius-sm); }
.fp-order-list li:nth-child(odd) { background: var(--panel-2); }
.fp-rank { font-family: var(--mono); font-weight: 800; color: var(--accent); min-width: 34px; }

/* Touch picker pad */
.fp-touchpad {
  position: relative; height: min(46vh, 360px); border: 3px dashed var(--line);
  border-radius: var(--radius); background: var(--panel-2); overflow: hidden;
  display: grid; place-items: center; touch-action: none; user-select: none;
}
.fp-touchpad.counting { border-style: solid; border-color: var(--accent); }
.fp-touch-hint { color: var(--muted); font-size: 15px; padding: 0 20px; text-align: center; pointer-events: none; }
.fp-ring {
  position: absolute; width: 84px; height: 84px; margin: -42px 0 0 -42px; border-radius: 50%;
  border: 6px solid var(--ring); background: color-mix(in srgb, var(--ring) 22%, transparent);
  pointer-events: none; transition: transform .25s ease, opacity .25s ease;
}
.fp-touchpad.counting .fp-ring { animation: fp-pulse .8s ease-in-out infinite; }
.fp-ring.chosen { transform: scale(1.5); box-shadow: 0 0 0 6px color-mix(in srgb, var(--ring) 40%, transparent); animation: none; }
.fp-ring.faded { opacity: .18; animation: none; }
@keyframes fp-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }

@media (prefers-reduced-motion: reduce) {
  .fp-winner.pop { animation: none; }
  .fp-touchpad.counting .fp-ring { animation: none; }
}

/* ===== Score pad ===== */
.scorepad-panel { width: min(920px, 96vw); }
.sp-toolbar, .sp-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.sp-toolbar select {
  flex: 1 1 150px; min-width: 0; background: var(--panel-2); color: var(--ink);
  border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 9px 10px; font-size: 14px; font-weight: 600;
}
.sp-table-wrap { overflow: auto; max-height: 62vh; border: 2px solid var(--line); border-radius: var(--radius-sm); }
.sp-table { border-collapse: separate; border-spacing: 0; font-family: var(--mono); width: max-content; min-width: 100%; }
.sp-table th, .sp-table td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sp-table thead th { position: sticky; top: 0; z-index: 2; background: var(--bg-2); }
.sp-table tfoot th, .sp-table tfoot td { position: sticky; bottom: 0; z-index: 2; background: var(--bg-2); }
.sp-rowlabel, .sp-corner { position: sticky; left: 0; z-index: 1; background: var(--bg-2); }
.sp-corner { z-index: 4; min-width: 46px; }
.sp-table thead .sp-playerhead { z-index: 3; }
.sp-table tfoot .sp-rowlabel { z-index: 4; }
.sp-rowlabel { color: var(--muted); font-size: 13px; padding: 0 10px; text-align: center; white-space: nowrap; }
.sp-playerhead { min-width: 74px; padding: 4px; position: relative; }
.sp-playername { width: 66px; background: transparent; border: 0; color: var(--ink); text-align: center; font-weight: 700; font-size: 13px; padding: 6px 2px; }
.sp-playername:focus { outline: 1px solid var(--accent); border-radius: 5px; }
.sp-remove {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 5px;
  border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1;
}
.sp-remove:hover { color: var(--danger); }
.sp-cell { min-width: 58px; height: 46px; text-align: center; cursor: pointer; font-size: 18px; color: var(--ink); }
.sp-cell:hover { background: var(--panel); }
.sp-total { min-width: 58px; height: 46px; text-align: center; font-weight: 800; font-size: 18px; color: var(--ink); }
.sp-total.leader { color: var(--accent-ink); background: var(--accent); }

/* Custom keypad (bottom sheet) */
.sp-keypad {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  background: var(--panel); border-top: 2px solid var(--line); padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 34px rgba(0,0,0,.45);
}
.sp-keypad-head { display: flex; justify-content: space-between; align-items: center; max-width: 420px; margin: 0 auto 10px; }
.sp-keypad-who { color: var(--muted); font-size: 14px; font-family: var(--mono); }
.sp-keypad-value { font-family: var(--mono); font-weight: 800; font-size: 30px; color: var(--accent); font-variant-numeric: tabular-nums; }
.sp-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 420px; margin: 0 auto; }
.sp-keys button {
  height: 52px; font-size: 20px; font-family: var(--mono); font-weight: 700;
  border: 2px solid var(--line); background: var(--panel-2); color: var(--ink);
  border-radius: 10px; cursor: pointer; box-shadow: 0 2px 0 rgba(0,0,0,.4);
}
.sp-keys button:active { transform: translateY(2px); box-shadow: 0 0 0 rgba(0,0,0,.4); }
.sp-keys .primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 0 2px 0 var(--accent-press); }

/* ===== Chess clock ===== */
.cc-panel { width: min(560px, 96vw); }
.cc-setup { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.cc-setup .muted { flex-basis: 100%; margin: 4px 0 0; font-size: 13px; }
.cc-board { display: grid; gap: 10px; margin-bottom: 12px; }
.cc-board[data-count="2"] { grid-template-columns: 1fr; }
.cc-board[data-count="3"], .cc-board[data-count="4"],
.cc-board[data-count="5"], .cc-board[data-count="6"] { grid-template-columns: 1fr 1fr; }
/* Two players face each other across the phone. */
.cc-board[data-count="2"] .cc-zone:first-child { transform: rotate(180deg); }
.cc-zone {
  min-height: 130px; border: 3px solid var(--line); border-radius: var(--radius);
  background: var(--panel-2); color: var(--ink); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  transition: border-color .12s, background .12s;
}
.cc-zone.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 15%, var(--panel-2)); }
.cc-zone.flagged { opacity: .5; border-color: var(--danger); }
.cc-name { font-family: var(--mono); font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.cc-time { font-family: var(--mono); font-weight: 800; font-size: clamp(38px, 9vw, 62px); font-variant-numeric: tabular-nums; line-height: 1; }
.cc-zone.active .cc-time { color: var(--accent); }
.cc-zone.flagged .cc-time { color: var(--danger); }
.cc-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ===== Tournament bracket ===== */
.bracket-panel { width: min(920px, 96vw); }
.bk-setup { display: flex; flex-direction: column; gap: 12px; }
.bk-setup .entries { min-height: 130px; }
.bk-opts { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.bk-points { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.bk-points-label { font-family: var(--mono); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.bk-points .setup-num { width: 3.2em; }
.bk-result { margin-top: 16px; }
.bk-note { text-align: center; }

/* Knockout */
.bk-knockout { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 8px; align-items: stretch; }
.bk-round { display: flex; flex-direction: column; gap: 8px; min-width: 150px; }
.bk-round-body { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 12px; }
.bk-round-title { font-family: var(--mono); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; text-align: center; }
.bk-match { display: flex; flex-direction: column; border: 2px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.bk-slot { text-align: left; padding: 9px 11px; background: var(--panel-2); border: 0; border-bottom: 1px solid var(--line); color: var(--ink); cursor: pointer; font-size: 14px; font-family: var(--mono); }
.bk-slot:last-child { border-bottom: 0; }
.bk-slot:hover:not(:disabled) { background: var(--panel); }
.bk-slot.won { background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.bk-slot.bye, .bk-slot.tbd { color: var(--muted); font-style: italic; }
.bk-slot:disabled { cursor: default; }
.bk-champion { text-align: center; font-family: var(--mono); font-weight: 800; font-size: 24px; color: var(--gold); margin-top: 16px; }
.bk-champion-label { display: block; color: var(--muted); font-size: 11px; letter-spacing: 3px; text-transform: uppercase; margin-bottom: 2px; }

/* Standings + fixtures (league / groups) */
.bk-standings { width: 100%; border-collapse: collapse; font-family: var(--mono); margin-bottom: 10px; }
.bk-standings th, .bk-standings td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: center; font-size: 14px; }
.bk-standings thead th { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.bk-standings .bk-team { text-align: left; }
.bk-standings .bk-pts { font-weight: 800; color: var(--accent); }
.bk-standings .bk-qualify td { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.bk-group { margin-bottom: 22px; }
.bk-group-title { font-family: var(--mono); font-size: 15px; margin: 0 0 8px; color: var(--ink); }
.bk-fixtures { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.bk-fixture { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.bk-fx-name { font-size: 14px; }
.bk-fixture > .bk-fx-name:first-child { text-align: right; }
.bk-fx-name.win { font-weight: 800; color: var(--accent); }
.bk-res-group { display: inline-flex; gap: 3px; }
.bk-res { width: 30px; height: 30px; border: 2px solid var(--line); background: var(--panel-2); color: var(--ink-dim); border-radius: 7px; cursor: pointer; font-size: 12px; font-weight: 700; font-family: var(--mono); }
.bk-res.sel.h, .bk-res.sel.a { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.bk-res.sel.d { background: var(--muted); color: var(--bg); border-color: var(--muted); }
.bk-build { margin-top: 12px; }
