/* ============================================================
   THROW — Global Design System
   Dark navy theme, clean and professional
   ============================================================ */

/* ── Reset & base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Theme tokens — dark (default) ────────────────────────── */
:root,
[data-theme="dark"] {
  /* Backgrounds */
  --bg:         #f2efe8;
  --bg-2:       #f2efe8;
  --surface:    #fffefb;
  --surface-2:  #faf7f0;
  --surface-3:  #faf7f0;

  /* Borders */
  --border:     rgba(18,21,23,0.07);
  --border-2:   rgba(18,21,23,0.12);
  --border-3:   rgba(18,21,23,0.20);

  /* Text */
  --text:       #121517;
  --text-2:     rgba(18,21,23,0.60);
  --text-3:     rgba(18,21,23,0.32);

  /* Accent — electric blue */
  --blue:       #99231a;
  --blue-2:     #99231a;
  --blue-3:     #701812;
  --blue-bg:    rgba(153,35,26,0.12);
  --blue-bg-2:  rgba(153,35,26,0.22);

  /* Red */
  --red:        #d5372a;
  --red-2:      #d5372a;
  --red-bg:     rgba(213,55,42,0.12);

  /* Green */
  --green:      #99231a;
  --green-2:    #99231a;
  --green-bg:   rgba(153,35,26,0.12);

  /* Amber */
  --amber:      #a8730c;
  --amber-2:    #a8730c;
  --amber-bg:   rgba(168,115,12,0.12);

  /* Teal */
  --teal:       #99231a;
  --teal-bg:    rgba(153,35,26,0.12);

  /* Gradients */
  --grad:       linear-gradient(135deg, #99231a 0%, #99231a 100%);
  --grad-text:  linear-gradient(135deg, #99231a, #99231a, #99231a);
  --grad-red:   linear-gradient(135deg, #d5372a 0%, #d5372a 100%);
  --grad-green: linear-gradient(135deg, #99231a 0%, #99231a 100%);
  --grad-card:  linear-gradient(160deg, #faf7f0 0%, #fffefb 100%);

  /* Typography */
  --font-display: 'Bebas Neue', sans-serif;

  /* Shape */
  --r:    10px;
  --r-sm: 6px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Shadow */
  --shadow:      0 4px 24px rgba(18,21,23,0.158);
  --shadow-sm:   0 2px 10px rgba(18,21,23,0.122);
  --shadow-blue: 0 4px 20px rgba(153,35,26,0.28);
  --shadow-red:  0 4px 20px rgba(213,55,42,0.28);

  /* Theme toggle icon */
  --theme-toggle-icon: "Light";
}

/* ── Theme tokens — light ──────────────────────────────────── */
[data-theme="light"] {
  --bg:         #121517;
  --bg-2:       #121517;
  --surface:    #ffffff;
  --surface-2:  #121517;
  --surface-3:  #121517;
  --border:     rgba(18,21,23,0.028);
  --border-2:   rgba(0,0,0,0.13);
  --border-3:   rgba(0,0,0,0.22);
  --text:       #f2efe8;
  --text-2:     #c6bfae;
  --text-3:     #7b8896;
  --blue:       #701812;
  --blue-2:     #701812;
  --blue-3:     #99231a;
  --blue-bg:    rgba(112,24,18,0.10);
  --blue-bg-2:  rgba(112,24,18,0.18);
  --red:        #8c2622;
  --red-2:      #8c2622;
  --red-bg:     rgba(140,38,34,0.10);
  --green:      #99231a;
  --green-2:    #701812;
  --green-bg:   rgba(112,24,18,0.10);
  --amber:      #7c5407;
  --amber-2:    #7c5407;
  --amber-bg:   rgba(124,84,7,0.10);
  --teal:       #701812;
  --teal-bg:    rgba(112,24,18,0.10);
  --grad:       linear-gradient(135deg, #701812 0%, #701812 100%);
  --grad-red:   linear-gradient(135deg, #8c2622 0%, #8c2622 100%);
  --grad-green: linear-gradient(135deg, #99231a 0%, #701812 100%);
  --grad-card:  linear-gradient(160deg, #ffffff 0%, #121517 100%);
  --r:    10px;  --r-sm: 6px;  --r-lg: 14px;  --r-xl: 20px;
  --shadow:      0 4px 24px rgba(0,0,0,0.10);
  --shadow-sm:   0 2px 10px rgba(18,21,23,0.028);
  --shadow-blue: 0 4px 20px rgba(112,24,18,0.18);
  --shadow-red:  0 4px 20px rgba(140,38,34,0.18);
  --theme-toggle-icon: "Dark";
}

/* ── Light-mode topbar override (uses hardcoded rgba in .topbar) ─ */
[data-theme="light"] .topbar {
  background: rgba(18,21,23,0.96);
  border-bottom-color: rgba(0,0,0,0.10);
}

/* ── Light-mode modal overrides (hardcoded gradients in .modal/.panel) ── */
[data-theme="light"] .modal { background: #ffffff; border-color: rgba(18,21,23,0.042); }
[data-theme="light"] .panel { background: #ffffff; border-color: rgba(18,21,23,0.042); }

/* ── Light-mode select option ──────────────────────────────── */
[data-theme="light"] select option { background: #ffffff; color: #f2efe8; }

/* ── Theme toggle — DARK | pill | LIGHT ────────────────────── */
.theme-toggle-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.tt-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  cursor: pointer;
  transition: opacity .2s;
  user-select: none;
  color: var(--text-2);
}
[data-theme="dark"]  .tt-dark  { opacity: 1; color: var(--text); }
[data-theme="dark"]  .tt-light { opacity: 0.4; }
[data-theme="light"] .tt-light { opacity: 1; color: var(--text); }
[data-theme="light"] .tt-dark  { opacity: 0.4; }

.tt-pill {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  border: 1.5px solid var(--border-3);
  background: var(--surface-3);
  cursor: pointer;
  padding: 0;
  transition: background .2s, border-color .2s;
  flex-shrink: 0;
}
[data-theme="light"] .tt-pill {
  background: var(--blue);
  border-color: var(--blue);
}
.tt-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-2);
  transition: transform .2s cubic-bezier(.34,1.4,.64,1), background .2s;
}
[data-theme="light"] .tt-knob {
  transform: translateX(16px);
  background: #ffffff;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ────────────────────────────────────────────── */
h1 { font-size: 2rem;   font-weight: 800; letter-spacing: -0.5px; }
h2 { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.3px; }
h3 { font-size: 1.1rem; font-weight: 700; }
p  { color: var(--text-2); }
a  { color: var(--blue-2); text-decoration: none; }
a:hover { text-decoration: underline; }

.text-muted  { color: var(--text-2); }
.text-faint  { color: var(--text-3); }
.text-blue   { color: var(--blue-2); }
.text-green  { color: var(--green-2); }
.text-red    { color: var(--red-2); }
.text-amber  { color: var(--amber-2); }
.text-sm     { font-size: 13px; }
.text-xs     { font-size: 11px; }
.text-lg     { font-size: 18px; }
.text-xl     { font-size: 22px; }
.font-bold   { font-weight: 700; }
.font-black  { font-weight: 900; }

/* ── Layout ────────────────────────────────────────────────── */
.container { max-width: 1080px; margin: 0 auto; padding: 16px; }
.hidden { display: none !important; }
.flex   { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.wrap  { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }

/* ── Card ──────────────────────────────────────────────────── */
.card {
  background: var(--grad-card);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card-sm { padding: 14px; }
.card-flush { padding: 0; overflow: hidden; }

/* ── Top bar ───────────────────────────────────────────────── */
.topbar {
  background: rgba(250,247,240,0.92);
  border-bottom: 1px solid var(--border-2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 100;
  padding: 0 20px;
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar-logo {
  font-size: 18px; font-weight: 900; letter-spacing: 3px;
  background: var(--grad); -webkit-background-clip: text;
  -webkit-text-fill-color: transparent; background-clip: text;
}
.topbar-back {
  color: var(--text-2); font-size: 20px; text-decoration: none;
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); transition: background .15s;
}
.topbar-back:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.topbar-nav { display: flex; align-items: center; gap: 12px; }
.topbar-user { font-size: 13px; font-weight: 600; color: var(--text-2); }
.topbar-logout {
  font-size: 13px; color: var(--text-3); text-decoration: none;
  padding: 5px 10px; border-radius: var(--r-sm);
  border: 1px solid var(--border-2); transition: all .15s;
}
.topbar-logout:hover { color: var(--red-2); border-color: var(--red); background: var(--red-bg); text-decoration: none; }
.tier-badge {
  font-size: 11px; font-weight: 800; padding: 3px 9px;
  border-radius: 999px; letter-spacing: 0.5px; text-transform: uppercase;
}
.tier-1 { background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border-2); }
.tier-2 { background: var(--blue-bg); color: var(--blue-2); border: 1px solid rgba(153,35,26,0.3); }

/* ── Topbar "v2" (dashboard / lobby / profile / teams) ───────────────
   Uses split left/right layout with a gradient logo tile, gradient
   wordmark, profile chip, player-code pill, and signout button.
   The older .topbar-brand / .topbar-logo / .topbar-nav / .topbar-logout
   rules above are kept for game.html and dartbot.html which still
   use that variant.                                                    */
.topbar-left  { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.topbar-logo-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 18px; color: #fff;
  box-shadow: 0 0 16px rgba(153,35,26,0.35); flex-shrink: 0;
}
.topbar-logo-text {
  font-family: var(--font-display); font-size: 20px; letter-spacing: 3px;
  background: var(--grad-text);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.player-code-pill {
  font-size: 11px; font-weight: 800; letter-spacing: 0.5px;
  padding: 3px 10px; border-radius: 999px;
  background: rgba(153,35,26,0.1); border: 1px solid rgba(153,35,26,0.3);
  color: var(--teal); cursor: pointer; user-select: all;
  transition: background .15s;
}
.player-code-pill:hover { background: rgba(153,35,26,0.18); }

.topbar-signout {
  font-size: 13px; color: var(--text-3); text-decoration: none;
  padding: 5px 12px; border-radius: var(--r-sm); border: 1px solid var(--border-2);
  transition: color .15s, border-color .15s, background .15s;
}
.topbar-signout:hover { color: var(--red-2); border-color: var(--red); background: var(--red-bg); }

.topbar-profile {
  font-size: 13px; color: var(--text-2); text-decoration: none;
  padding: 5px 12px; border-radius: var(--r-sm); border: 1px solid var(--border-2);
  display: flex; align-items: center; gap: 6px;
  transition: color .15s, border-color .15s, background .15s;
}
.topbar-profile:hover { color: var(--text); border-color: var(--border-3); background: var(--surface-2); }
.topbar-profile-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--grad); display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 12px; color: #fff; flex-shrink: 0;
  overflow: hidden; position: relative;
}
.topbar-profile-avatar img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; border-radius: 50%;
}
.topbar-profile-avatar.has-photo { font-size: 0; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--r);
  font-size: 14px; font-weight: 700; cursor: pointer;
  border: 1px solid var(--border-2);
  background: var(--surface-2); color: var(--text);
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
  white-space: nowrap; text-decoration: none;
  letter-spacing: 0.2px;
}
.btn:hover { background: var(--surface-3); border-color: var(--border-3); text-decoration: none; color: var(--text); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.38; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--blue); border-color: transparent;
  color: #fff; box-shadow: var(--shadow-blue);
}
.btn-primary:hover { background: #701812; box-shadow: 0 6px 28px rgba(153,35,26,0.4); color: #fff; }

.btn-success {
  background: #1e7a3e; border-color: transparent; color: #fff;
}
.btn-success:hover { background: #145229; }

.btn-danger {
  background: var(--red-bg); border-color: rgba(213,55,42,0.3); color: var(--red-2);
}
.btn-danger:hover { background: rgba(213,55,42,0.22); border-color: var(--red); }

.btn-warn {
  background: var(--amber-bg); border-color: rgba(168,115,12,0.3); color: var(--amber-2);
}
.btn-ghost {
  background: transparent; border-color: var(--border-2); color: var(--text-2);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: var(--r-sm); }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-full { width: 100%; }
.btn-icon { padding: 8px; border-radius: 50%; width: 36px; height: 36px; }

/* ── Form controls ─────────────────────────────────────────── */
label {
  display: block; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--text-2); margin-bottom: 6px;
}
input, select, textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text);
  border-radius: var(--r);
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, background .15s;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  background: var(--surface-3);
}
input::placeholder { color: var(--text-3); }
input:disabled, select:disabled { opacity: 0.38; cursor: not-allowed; }
select option { background: var(--surface); color: var(--text); }

.field { display: flex; flex-direction: column; gap: 6px; }

/* ── Pills / Tags ──────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--surface-3); border: 1px solid var(--border-2); color: var(--text-2);
  white-space: nowrap;
}
.pill-blue  { background: var(--blue-bg);  border-color: rgba(153,35,26,0.3);  color: var(--blue-2); }
.pill-green { background: rgba(30,122,62,0.12); border-color: rgba(30,122,62,0.3);   color: #145229; }
.pill-red   { background: var(--red-bg);   border-color: rgba(213,55,42,0.3);   color: var(--red-2); }
.pill-amber { background: var(--amber-bg); border-color: rgba(168,115,12,0.3);  color: var(--amber-2); }
.pill-teal  { background: var(--teal-bg);  border-color: rgba(153,35,26,0.3);  color: var(--teal); }
.pill-grad  { background: var(--grad); border-color: transparent; color: #fff; }

/* ── Divider ───────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.divider-grad { height: 2px; background: var(--grad); border-radius: 2px; margin: 4px 0 18px; opacity: 0.5; }

/* ── Toast ─────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--surface-3);
  border: 1px solid var(--border-3);
  color: var(--text); padding: 11px 22px;
  border-radius: 999px; font-size: 13px; font-weight: 700;
  box-shadow: var(--shadow);
  z-index: 9999; white-space: nowrap;
  opacity: 0; transition: opacity .22s, transform .22s;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--red-bg); border-color: var(--red); color: var(--red-2); }
#toast.success { background: rgba(30,122,62,0.12); border-color: #1e7a3e; color: #145229; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  display: none; align-items: center; justify-content: center;
  z-index: 500; padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: linear-gradient(160deg, #faf7f0 0%, #f2efe8 100%);
  border: 1px solid var(--border-2);
  border-radius: var(--r-xl);
  padding: 24px 22px;
  width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(18,21,23,0.2);
  animation: fadeUp .2s ease both;
}
.modal-title { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }

/* ── Slide-up panel ────────────────────────────────────────── */
.panel-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 300; display: none;
  align-items: flex-end; justify-content: center;
}
.panel-backdrop.open { display: flex; }
.panel {
  background: linear-gradient(180deg, #faf7f0 0%, #f2efe8 100%);
  border: 1px solid var(--border-2);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  width: 100%; max-width: 680px;
  max-height: 82vh; display: flex; flex-direction: column;
  animation: slideUp .22s cubic-bezier(.34,1.2,.64,1);
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px; border-bottom: 1px solid var(--border);
}
.panel-title { font-size: 16px; font-weight: 800; }
.panel-body { overflow-y: auto; padding: 16px 20px 28px; flex: 1; }

/* ── League table ──────────────────────────────────────────── */
.lt-wrap { overflow-x: auto; }
.lt {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.lt thead th {
  padding: 8px 10px; text-align: center;
  color: var(--text-3); font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border-2);
}
.lt thead th:nth-child(2) { text-align: left; }
.lt tbody td {
  padding: 10px 10px; text-align: center;
  border-bottom: 1px solid var(--border);
}
.lt tbody td:nth-child(2) { text-align: left; font-weight: 700; }
.lt tbody tr:hover td { background: var(--surface-2); }

/* Position highlights */
.lt-pos { font-weight: 800; color: var(--text-3); }
.lt-row-1 td { color: var(--amber-2); }
.lt-row-1 .lt-pos::before { content: '★ '; font-size: 10px; }
.lt-row-2 td, .lt-row-3 td { color: var(--blue-2); }

/* ── Animations ────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
@keyframes pulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.07); }
}
@keyframes popIn {
  0%   { transform: scale(0.5) rotate(-10deg); opacity: 0; }
  70%  { transform: scale(1.1) rotate(3deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-3); }

/* ============================================================
   UNIFIED SCORER — canonical .ctrl-card / .numpad / .lane-toggle
   Used by game.html (x01.js), match-view.html (fixture-scoring.js),
   dartbot.html, icon-match.html. Quick-scores 26/45/60/81/100/140/180
   removed — only Miss (data-quick="0") remains as a quick button.
   FAST / PER-DART toggle preserved for game.html and match-view.html.
   ============================================================ */

/* Numpad — 3-col grid, shared base for all scorer pages */
.numpad {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 5px; margin-bottom: 8px;
}
.numpad button,
.np-btn {
  background: var(--surface-2) !important;
  border: 1px solid var(--border-2) !important;
  border-radius: var(--r) !important;
  color: var(--text) !important;
  font-size: 16px; font-weight: 800;
  font-family: inherit;
  height: 44px; padding: 0;
  cursor: pointer;
  transition: background .12s, transform .08s, border-color .12s;
  display: flex; align-items: center; justify-content: center;
}
.numpad button:hover,
.np-btn:hover { background: var(--surface-3) !important; border-color: var(--border-3) !important; }
.numpad button:active,
.np-btn:active { transform: scale(0.95); }
.numpad button:disabled,
.np-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.np-back,
.numpad button[data-key="clear"],
.numpad button[data-action="back"] { font-size: 16px; color: var(--text-2); }

/* Enter — blue accent like the rest of the platform */
.np-enter,
.numpad button[data-key="enter"],
.numpad button.btn-primary {
  background: var(--blue) !important;
  border-color: transparent !important;
  color: #fff !important;
  font-size: 18px;
  box-shadow: 0 2px 12px rgba(153,35,26,0.35);
}
.np-enter:hover,
.numpad button[data-key="enter"]:hover,
.numpad button.btn-primary:hover { background: #701812 !important; }

/* Miss — full width red tint, kept as the only quick action */
.np-miss,
.numpad button.quick-miss {
  grid-column: 1 / -1 !important;
  height: 38px !important; font-size: 13px;
  font-weight: 800; letter-spacing: 0.4px;
  background: rgba(213,55,42,0.09) !important;
  border-color: rgba(213,55,42,0.25) !important;
  color: var(--red-2) !important;
}
.np-miss:hover,
.numpad button.quick-miss:hover {
  background: rgba(213,55,42,0.16) !important;
  border-color: var(--red) !important;
  color: var(--red-2) !important;
}

/* FAST / PER-DART toggle — used by game.html + match-view.html */
.lane-toggle {
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  padding: 3px;
  margin: 8px 0 10px;
}
.lt-btn {
  background: transparent;
  color: var(--text-2);
  border: none; border-radius: 6px;
  padding: 8px 0;
  font-size: 12px; font-weight: 800;
  letter-spacing: 0.6px; text-transform: uppercase;
  cursor: pointer;
  transition: background .12s, color .12s;
  font-family: inherit;
}
.lt-btn:hover:not(.active) { color: var(--text); }
.lt-btn.active {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(153,35,26,0.3);
}

/* Visit-total input row */
.ctrl-input-row {
  display: flex; gap: 8px;
  margin-bottom: 8px;
}
.ctrl-input-row input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text);
  border-radius: var(--r);
  padding: 0 14px;
  height: 48px;
  font-size: 22px; font-weight: 800;
  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: 1px; text-align: center;
  outline: none;
  transition: border-color .15s, background .15s;
}
.ctrl-input-row input:focus { border-color: var(--blue); background: var(--surface-3); }
.ctrl-input-row input::placeholder {
  color: var(--text-3);
  font-family: 'DM Sans', sans-serif;
  font-weight: 600; letter-spacing: 0; font-size: 14px;
}
.ctrl-input-row input.invalid { border-color: var(--red); }

/* Per-dart slot row (kept for game.html per-dart lane) */
.dart-row { display: flex; gap: 5px; align-items: center; }
.dart-row .x01-slot {
  flex: 1; height: 44px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  color: var(--text);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 18px; letter-spacing: 1px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.dart-row .x01-slot:hover  { background: var(--surface-3); border-color: var(--border-3); }
.dart-row .x01-slot.active { border-color: var(--blue); background: var(--blue-bg); color: var(--blue-2); }

.dart-entry-header {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; font-weight: 800;
  letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 6px;
}
.x01-tentative {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 14px; letter-spacing: 1px;
  color: var(--blue-2);
  text-transform: none;
}

/* Action row — Undo / Reset leg / Exit / Submit etc.
   Used by all four scorers; .ctrl-actions and .action-row are aliases. */
.ctrl-actions,
.action-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.ctrl-actions .btn,
.action-row .btn { flex: 1 1 0; min-width: 0; }

/* ── Centre scorer card — input panel + numpad ──────────────────────────
   Shared by dartbot.html, game.html (x01.js), match-view.html.
   The ctrl-card itself is the dark gradient card; inside it sits:
     1. ctrl-input-row + lane-toggle + numpad + ctrl-actions
   The central big-number score-display was removed 2026-05 — the live
   remaining preview (current minus typed visit, or "BUST" in red) lives
   on the active player card via .pc-score.bust below. The ctrl-stats-strip
   block was also removed (player cards already show legs / 3-avg / 180s).
   Page-specific bits (dartbot's purple Submit + 1/2/3 darts-used) layer on top.
   ──────────────────────────────────────────────────────────────────────── */
.ctrl-card {
  background: var(--grad-card);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 8px;
}

/* Live BUST state on the active player card — applied by the JS scorers
   when the typed visit would bust. Uses the same red token as other
   bust/error chrome across the app. */
.pc-score.bust {
  color: var(--red-2, #8c2622);
  letter-spacing: 1px;
}

/* The .ctrl-stats-strip block was removed 2026-05 — the player cards
   already show all the same numbers (legs / 3-avg / 180s) so the
   in-card strip was redundant chrome. The .css-* classes are still
   used by .mp-panel (multiplayer page) so those scoped rules live in
   css/multiplayer.css. */

/* ── Turn-queue strip (3+ player matches) ──────────────────────────────
   Sits ABOVE the centre scorer card, shows the full turn order as
   small avatars; the active thrower has a blue ring + dot. Hidden
   for 1- or 2-player matches.
   ──────────────────────────────────────────────────────────────────── */
.turn-queue {
  display: flex; gap: 6px; align-items: center; justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  padding: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.tq-slot {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 2px solid transparent;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 14px; letter-spacing: 0.5px;
  color: var(--text-2);
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
}
.tq-slot img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.tq-slot.tq-active {
  border-color: var(--blue);
  background: var(--blue-bg);
  color: var(--blue-2);
  box-shadow: 0 0 0 3px rgba(153,35,26,0.18);
}
.tq-slot.tq-next {
  border-color: var(--border-3);
  color: var(--text);
}
.tq-slot.tq-active::after {
  content: '';
  position: absolute;
  bottom: -8px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--blue);
}
.tq-arrow {
  color: var(--text-3);
  font-size: 12px;
  font-weight: 800;
}

/* ── Others-list panel (3+ player matches, right column) ──────────── */
.others-list {
  background: var(--grad-card);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow);
}
.others-title {
  font-size: 10px; font-weight: 800;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 4px;
}
.others-row {
  display: grid;
  grid-template-columns: 32px 1fr auto auto;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 8px 10px;
}
.others-row.others-next {
  border-color: rgba(153,35,26,0.3);
  background: rgba(153,35,26,0.06);
}
.others-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-3);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 13px;
  color: var(--text-2);
  overflow: hidden;
  position: relative;
}
.others-avatar img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.others-name { font-size: 13px; font-weight: 700; }
.others-score {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  letter-spacing: 0.5px;
  color: var(--text);
  line-height: 1;
}
.others-tag {
  font-size: 9px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--blue-bg);
  color: var(--blue-2);
  border: 1px solid rgba(153,35,26,0.3);
}
.others-legs {
  font-size: 10px; font-weight: 700;
  color: var(--text-3);
  margin-top: 2px;
}

/* ── Match-grid wrapper — used by game.html, dartbot.html, match-view.html
   Three modes:
     match-grid--solo   = single column (1 player, freeplay solo)
     match-grid--duo    = 1fr 320px 1fr (2 players, includes dartbot)
     match-grid--multi  = 1fr 320px 1fr (3+ players: active | scorer | others)
   ──────────────────────────────────────────────────────────────────── */
.match-grid {
  display: grid;
  gap: 8px;
  padding: 10px;
  max-width: 1200px;
  margin: 0 auto;
  align-items: start;
}
.match-grid--solo,
.match-grid--duo,
.match-grid--multi {
  grid-template-columns: 1fr 320px 1fr;
}
/* The third column on solo is .solo-spacer (empty) — kept as a real
   grid item so the centre stays centred. */
.solo-spacer { min-height: 1px; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .match-grid--solo,
  .match-grid--duo,
  .match-grid--multi { grid-template-columns: 1fr 280px 1fr; }
}
@media (max-width: 700px) {
  .match-grid--solo,
  .match-grid--duo,
  .match-grid--multi {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
  }
  .match-grid--solo > .player-card:first-child,
  .match-grid--duo > .player-card:first-child,
  .match-grid--multi > .player-card:first-child { grid-column: 1; grid-row: 1; }
  .match-grid--duo > .player-card:last-child,
  .match-grid--multi > .others-list,
  .match-grid--multi > .player-card:last-child { grid-column: 2; grid-row: 1; }
  .match-grid--solo > .ctrl-wrap,
  .match-grid--duo > .ctrl-wrap,
  .match-grid--multi > .ctrl-wrap { grid-column: 1 / -1; grid-row: 2; }
  .match-grid--solo > .solo-spacer { display: none; }
}

@media (max-width: 600px) {
  .container { padding: 10px; }
  .topbar { padding: 0 12px; }
  .topbar-logo { font-size: 16px; letter-spacing: 2px; }
  h1 { font-size: 1.6rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}