/* WinLose — design system
   Token di colore per ruolo; il tema segue quello del dispositivo. */

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0a0b0d;
  --bg-glow: rgba(57, 135, 229, 0.10);
  --surface: #121419;
  --surface-2: #181b21;
  --surface-3: #20242c;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --text: #f0efec;
  --text-2: #b4b8c0;
  --muted: #7d828c;
  --accent: #d4f75c;
  --accent-ink: #11140a;
  --blue: #3987e5;
  --blue-soft: rgba(57, 135, 229, 0.16);
  --red: #e66767;
  --red-soft: rgba(230, 103, 103, 0.16);
  --win: #199e70;
  --loss: #d95926;
  --good: #0ca30c;
  --critical: #d03b3b;
  --gold: #e8b931;
  --silver: #b8bec8;
  --bronze: #c9814a;
  --grid: rgba(255, 255, 255, 0.06);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 12px 32px -12px rgba(0, 0, 0, 0.6);
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --tabbar-h: 68px;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f5f5f3;
    --bg-glow: rgba(42, 120, 214, 0.08);
    --surface: #ffffff;
    --surface-2: #f8f8f6;
    --surface-3: #efefec;
    --border: rgba(10, 12, 16, 0.08);
    --border-strong: rgba(10, 12, 16, 0.16);
    --text: #0b0b0b;
    --text-2: #4a4b4f;
    --muted: #75767b;
    --accent: #11140a;
    --accent-ink: #d4f75c;
    --blue: #2a78d6;
    --blue-soft: rgba(42, 120, 214, 0.10);
    --red: #e34948;
    --red-soft: rgba(227, 73, 72, 0.10);
    --win: #1baf7a;
    --loss: #eb6834;
    --grid: rgba(10, 12, 16, 0.07);
    --shadow: 0 1px 2px rgba(10, 12, 16, 0.04), 0 8px 24px -12px rgba(10, 12, 16, 0.12);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 50% -200px, var(--bg-glow), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, table td, .kpi-value { font-variant-numeric: tabular-nums; }

h1, h2, h3 { margin: 0; letter-spacing: -0.02em; line-height: 1.2; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }

.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;
}

/* ------------------------------------------------------------ layout */

.shell { max-width: 1180px; margin: 0 auto; padding: 0 16px calc(var(--tabbar-h) + 32px); }

.topbar {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 16px; height: 60px;
  display: flex; align-items: center; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.02em; font-size: 16px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--blue) 0 50%, var(--red) 50% 100%);
  box-shadow: 0 0 0 1px var(--border-strong) inset;
}
.brand-mark::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.brand small { color: var(--muted); font-weight: 500; }

.nav { display: none; gap: 4px; }
.nav a {
  padding: 7px 12px; border-radius: 999px; color: var(--text-2); font-weight: 500; font-size: 14px;
  transition: background .15s, color .15s;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-3); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-top: 1px solid var(--border);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 500; color: var(--muted); padding: 6px 0;
}
.tabbar a svg { width: 22px; height: 22px; }
.tabbar a[aria-current="page"] { color: var(--text); }
.tabbar .tab-cta span.cta-dot {
  width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); margin-top: -10px;
  box-shadow: 0 8px 24px -6px color-mix(in srgb, var(--accent) 60%, transparent);
}
.tabbar .tab-cta svg { width: 24px; height: 24px; }

@media (min-width: 860px) {
  .nav { display: flex; }
  .tabbar { display: none; }
  .shell { padding-bottom: 64px; }
}

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 28px 0 20px; flex-wrap: wrap; }
.page-head p { color: var(--text-2); margin-top: 4px; }
.eyebrow { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

.grid { display: grid; gap: 16px; }
.grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) { .grid-kpi { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1040px) { .grid-kpi { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.grid-2 { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
}
.stack { display: flex; flex-direction: column; gap: 16px; }
.section { margin-top: 16px; }

/* ------------------------------------------------------------ superfici */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px 0;
}
.card-head p { color: var(--muted); font-size: 13px; }
.card-body { padding: 16px 18px 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; }

.kpi { padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 6px; min-height: 112px; }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.kpi-value small { font-size: 14px; color: var(--text-2); font-weight: 500; letter-spacing: 0; }
.kpi-sub { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.kpi-hero {
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 55%),
    var(--surface);
}

/* ------------------------------------------------------------ elementi */

.avatar {
  --h: 212;
  width: 32px; height: 32px; flex: none; border-radius: 50%;
  display: inline-grid; place-items: center;
  font-size: 13px; font-weight: 650; color: hsl(var(--h) 80% 88%);
  background: linear-gradient(145deg, hsl(var(--h) 45% 34%), hsl(var(--h) 50% 22%));
  box-shadow: 0 0 0 1px hsl(var(--h) 50% 50% / .35) inset;
}
@media (prefers-color-scheme: light) {
  .avatar { color: hsl(var(--h) 60% 26%); background: linear-gradient(145deg, hsl(var(--h) 70% 92%), hsl(var(--h) 60% 84%)); }
}
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }
.avatar.lg { width: 56px; height: 56px; font-size: 22px; }

.who { display: inline-flex; align-items: center; gap: 10px; min-width: 0; font-weight: 550; }
.who span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.accent { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--text); }
.badge.warn { background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--text); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.blue { background: var(--blue); } .dot.red { background: var(--red); }
.dot.win { background: var(--win); } .dot.loss { background: var(--loss); }

.form-dots { display: inline-flex; gap: 3px; }
.form-dots i {
  width: 16px; height: 16px; border-radius: 5px; display: grid; place-items: center;
  font-style: normal; font-size: 9.5px; font-weight: 700; color: #fff;
}
.form-dots i.w { background: var(--win); }
.form-dots i.l { background: var(--loss); }
.form-dots i.e { background: var(--surface-3); }

.meter { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; min-width: 48px; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--win); }

.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 13px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }

/* ------------------------------------------------------------ tabelle */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .pos { width: 36px; color: var(--muted); font-weight: 600; }
.table th.right, .table td.right { text-align: right; }
.medal { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; color: #1b1b1b; }
.medal.g1 { background: var(--gold); } .medal.g2 { background: var(--silver); } .medal.g3 { background: var(--bronze); }
.hide-sm { display: none; }
@media (min-width: 640px) { .hide-sm { display: table-cell; } }

/* ------------------------------------------------------------ bottoni e form */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--border-strong);
  background: var(--surface-2); font-weight: 600; font-size: 14px; cursor: pointer;
  transition: transform .08s, background .15s, border-color .15s, opacity .15s;
  -webkit-tap-highlight-color: transparent; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn svg { width: 18px; height: 18px; flex: none; max-width: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); }
.btn-danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); background: transparent; }
.btn-danger:hover { background: var(--red-soft); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn-lg { height: 52px; font-size: 16px; border-radius: 14px; padding: 0 22px; }
.btn-block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 13px; font-weight: 550; color: var(--text-2); }
.input, select.input, textarea.input {
  height: 44px; padding: 0 12px; border-radius: 11px; width: 100%;
  border: 1px solid var(--border-strong); background: var(--surface-2);
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 10px 12px; }
.input:focus, select.input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.help { font-size: 12.5px; color: var(--muted); }
.form-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); } .form-grid.cols-2 { grid-template-columns: repeat(2, 1fr); } }

.seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: 12px; background: var(--surface-3); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  min-width: 44px; height: 36px; padding: 0 14px; display: grid; place-items: center; border-radius: 9px;
  font-weight: 600; font-size: 14px; color: var(--text-2); cursor: pointer; transition: background .15s, color .15s;
}
.seg input:checked + label { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.seg input:focus-visible + label { outline: 2px solid var(--blue); outline-offset: 1px; }

.alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
  font-size: 14px; border: 1px solid var(--border-strong); background: var(--surface-2);
}
.alert.error { border-color: color-mix(in srgb, var(--critical) 50%, transparent); background: color-mix(in srgb, var(--critical) 10%, var(--surface)); }
.alert.success { border-color: color-mix(in srgb, var(--good) 45%, transparent); background: color-mix(in srgb, var(--good) 9%, var(--surface)); }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.flashes { display: flex; flex-direction: column; gap: 8px; padding-top: 16px; }

.empty { padding: 28px 18px; text-align: center; color: var(--muted); font-size: 14px; }

/* ------------------------------------------------------------ dashboard */

.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 300px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.pair-card { display: flex; flex-direction: column; gap: 14px; }
.pair-avatars { display: flex; }
.pair-avatars .avatar + .avatar { margin-left: -8px; box-shadow: 0 0 0 2px var(--surface); }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-row div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.stat-row b { display: block; font-size: 17px; letter-spacing: -0.02em; }
.stat-row span { font-size: 11.5px; color: var(--muted); }

.heatmap { display: grid; gap: 3px; font-size: 12px; }
.heatmap .hm-cell {
  height: 40px; border-radius: 7px; display: grid; place-items: center; font-weight: 650; font-size: 11.5px;
  background: var(--surface-2); color: var(--text); min-width: 0;
}
.heatmap .hm-cell.self { background: transparent; border: 1px dashed var(--border); }
.heatmap .hm-cell.none { color: var(--muted); font-weight: 500; }
.heatmap .hm-head { display: grid; place-items: center; color: var(--text-2); font-weight: 600; font-size: 11.5px; min-width: 0; overflow: hidden; }
.heatmap .hm-row-head { justify-content: start; padding-right: 4px; white-space: nowrap; text-overflow: ellipsis; }
.hm-scale { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.hm-scale .bar { flex: 1; height: 8px; border-radius: 999px; background: linear-gradient(90deg, var(--loss), var(--surface-3) 50%, var(--win)); }

.streak { display: inline-flex; align-items: center; gap: 4px; font-weight: 650; }
.streak.w { color: var(--win); } .streak.l { color: var(--loss); }

/* ------------------------------------------------------------ partite */

.match-card { padding: 14px 16px; display: grid; gap: 12px; scroll-margin-top: 80px; }
.match-card:target { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.match-teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.team { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.team.red { align-items: flex-end; text-align: right; }
.team .names { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.team .roles { font-size: 11.5px; color: var(--muted); }
.team.winner .names::after { content: " ●"; color: var(--accent); font-size: 10px; vertical-align: middle; }
.score { font-size: 24px; font-weight: 750; letter-spacing: -0.03em; display: flex; align-items: center; gap: 8px; }
.score .b { color: var(--blue); } .score .r { color: var(--red); } .score .sep { color: var(--muted); font-weight: 400; }
.round-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.round-pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; background: var(--surface-2); color: var(--text-2); }
.match-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.filters { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.filters .field:first-child { grid-column: 1 / -1; }
@media (min-width: 720px) { .filters { grid-template-columns: 2fr 1fr 1fr auto; align-items: end; } .filters .field:first-child { grid-column: auto; } }

/* ------------------------------------------------------------ nuova partita */

.table-stage { position: relative; margin: 26px 0; }
.table-stage img { width: 100%; height: auto; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.spot {
  position: absolute; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 92px; padding: 6px 10px 7px; border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1.5px solid var(--border-strong);
  box-shadow: 0 8px 22px -8px rgba(0,0,0,.55);
  transition: transform .15s, border-color .15s, box-shadow .15s;
  cursor: pointer; touch-action: manipulation;
}
.spot.blue { border-color: color-mix(in srgb, var(--blue) 70%, transparent); }
.spot.red { border-color: color-mix(in srgb, var(--red) 70%, transparent); }
.spot .spot-role { white-space: nowrap; font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.spot.blue .spot-role { color: var(--blue); } .spot.red .spot-role { color: var(--red); }
.spot .spot-name { font-size: 14px; font-weight: 650; white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.spot .spot-name.is-empty { color: var(--muted); font-weight: 500; }
.spot .spot-rate { font-size: 10.5px; color: var(--muted); min-height: 14px; }
.spot select { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; font-size: 16px; }
.spot:focus-within { box-shadow: 0 0 0 3px var(--blue-soft), 0 8px 22px -8px rgba(0,0,0,.55); }
.spot.picked { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); transform: translate(-50%, -50%) scale(1.04); }
.spot.drop-target { border-style: dashed; border-color: var(--accent); }
.swap-mode .spot select { pointer-events: none; }
.swap-mode .spot { cursor: grab; }
@media (max-width: 520px) {
  .spot { min-width: 76px; padding: 4px 8px 5px; border-radius: 11px; }
  .spot .spot-name { font-size: 12.5px; max-width: 84px; }
  .spot .spot-role { font-size: 9px; }
  .spot .spot-rate { display: none; }
}

.team-summary { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
.team-box { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); min-width: 0; }
.team-box.blue { box-shadow: inset 3px 0 0 var(--blue); }
.team-box.red { box-shadow: inset -3px 0 0 var(--red); text-align: right; }
.team-box .t-label { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.team-box.blue .t-label { color: var(--blue); } .team-box.red .t-label { color: var(--red); }
.team-box .t-names { font-weight: 600; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-box .t-strength { font-size: 12px; color: var(--muted); }
.vs { font-size: 12px; font-weight: 700; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px 0 6px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface-2); cursor: pointer; font-weight: 550;
  transition: background .15s, border-color .15s; -webkit-tap-highlight-color: transparent;
}
.chip[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 16%, var(--surface-2)); border-color: var(--accent); }
.chip:disabled { opacity: .4; cursor: not-allowed; }

.options { display: grid; gap: 8px; }
.option {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; text-align: left;
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer;
}
.option[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--surface-2)); }
.option .o-teams { font-weight: 600; font-size: 14px; }
.option .o-teams .dot { margin-right: 4px; }
.option .o-diff { font-size: 12.5px; color: var(--text-2); }
.option .o-meta { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }

.round-card { padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); display: grid; gap: 12px; }
.round-card[hidden] { display: none; }
.winner-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.winner-pick input { position: absolute; opacity: 0; pointer-events: none; }
.winner-pick label {
  height: 56px; border-radius: 13px; display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px solid var(--border-strong); background: var(--surface); font-weight: 650; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s; -webkit-tap-highlight-color: transparent;
}
.winner-pick label.blue:hover { border-color: var(--blue); }
.winner-pick label.red:hover { border-color: var(--red); }
.winner-pick input:checked + label.blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.winner-pick input:checked + label.red { background: var(--red); border-color: var(--red); color: #fff; }
.winner-pick input:focus-visible + label { outline: 2px solid var(--text); outline-offset: 2px; }
.winner-pick .wp-names { font-size: 11.5px; font-weight: 500; opacity: .8; display: block; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 44px; height: 26px; border-radius: 999px; background: var(--surface-3); position: relative; transition: background .15s; flex: none; border: 1px solid var(--border-strong); }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .18s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); background: var(--accent-ink); }
.switch input:focus-visible + .track { outline: 2px solid var(--blue); outline-offset: 2px; }

.summary-score { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 8px 0; }
.summary-score .s { font-size: 44px; font-weight: 750; letter-spacing: -0.04em; line-height: 1; }
.summary-score .s.b { color: var(--blue); } .summary-score .s.r { color: var(--red); }
.summary-score .sep { color: var(--muted); font-size: 28px; }

.action-bar {
  position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 10px); z-index: 20;
  margin-top: 16px; padding: 10px; border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-strong); box-shadow: 0 16px 40px -16px rgba(0,0,0,.6);
  display: flex; align-items: center; gap: 12px;
}
.action-bar .ab-text { flex: 1; min-width: 0; font-size: 13px; color: var(--text-2); }
.action-bar .ab-text b { color: var(--text); display: block; font-size: 14px; }
@media (min-width: 860px) { .action-bar { bottom: 16px; } }

.step-title { display: flex; align-items: center; gap: 10px; }
.step-num { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--text-2); }

/* ------------------------------------------------------------ login */

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 380px; padding: 28px 24px; }
.auth-card .brand { justify-content: center; margin-bottom: 20px; font-size: 18px; }
.auth-card h1 { font-size: 22px; text-align: center; }
.auth-card .lead { text-align: center; color: var(--text-2); margin: 6px 0 22px; font-size: 14px; }
.pin-input { letter-spacing: .5em; text-align: center; font-size: 22px; font-weight: 650; height: 56px; }
.auth-foot { text-align: center; margin-top: 18px; font-size: 12.5px; color: var(--muted); }

/* ------------------------------------------------------------ admin */

.subnav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; scrollbar-width: none; }
.subnav a { padding: 8px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 550; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); white-space: nowrap; }
.subnav a[aria-current="page"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.pin-reveal { font-size: 40px; font-weight: 750; letter-spacing: .25em; text-align: center; padding: 18px; border-radius: 14px; background: var(--surface-2); border: 1px dashed var(--border-strong); font-variant-numeric: tabular-nums; }
.inline-form { display: inline; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 12.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; color: var(--text-2); word-break: break-word; }
details.reveal summary { cursor: pointer; color: var(--text-2); font-size: 12.5px; }

.danger-zone { border-color: color-mix(in srgb, var(--critical) 35%, var(--border)); }

.player-hero { display: flex; align-items: center; gap: 16px; padding: 28px 0 20px; flex-wrap: wrap; }
.player-hero h1 { font-size: 28px; }
.hide-mobile { display: none; }
@media (min-width: 860px) { .hide-mobile { display: inline-flex; } }
.ico-14 { width: 14px; height: 14px; flex: none; }
.ico-20 { width: 20px; height: 20px; flex: none; }
.badge svg { width: 13px; height: 13px; }
@media (max-width: 400px) { .hide-xs { display: none; } }
.meter-wide { display: none; width: 64px; }
@media (min-width: 640px) { .meter-wide { display: block; } }
.match-meta > span:first-child { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
