@font-face { font-family: Montserrat; font-weight: 500; font-display: swap; src: url(/gfx/fonts/montserrat-500.woff2) format("woff2"); }
@font-face { font-family: Montserrat; font-weight: 700; font-display: swap; src: url(/gfx/fonts/montserrat-700.woff2) format("woff2"); }
@font-face { font-family: Montserrat; font-weight: 900; font-display: swap; src: url(/gfx/fonts/montserrat-900.woff2) format("woff2"); }

:root {
  --navy: #04173d; --deep: #06215a; --blue: #0d4ab0; --bright: #4c9bff; --cyan: #27d7ff;
  --ink: #fff; --soft: #c3d4f2; --dim: #8ea5cd;
  --live: #ff3b4e; --gold: #ffc940;
  --card: rgba(11, 44, 110, .72); --card-2: rgba(255, 255, 255, .06); --line: rgba(130, 175, 255, .22);
  --top: env(safe-area-inset-top, 0px); --bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; background: var(--navy); }
body {
  min-height: 100dvh; color: var(--ink); font: 500 15px/1.35 Montserrat, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; background: radial-gradient(900px 520px at 50% -80px, var(--blue) 0%, #08296e 48%, var(--navy) 100%) no-repeat var(--navy);
  padding-bottom: calc(68px + var(--bottom));
}
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 4px; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: calc(8px + var(--top)) 16px 8px;
  background: rgba(4, 23, 61, .86); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.logo { height: 40px; width: auto; display: block; }
.heading { min-width: 0; flex: 1; }
h1 { font-size: 16px; font-weight: 900; letter-spacing: .1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress { font-size: 12px; color: var(--soft); }

.offline { background: #7a5a00; color: #fff; padding: 8px 16px; font-size: 13px; font-weight: 700; text-align: center; }
main { max-width: 680px; margin: 0 auto; padding: 14px 16px 20px; }
main.wide { max-width: 1240px; }

.tabs { position: fixed; z-index: 5; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr);
  padding-bottom: var(--bottom); background: rgba(4, 23, 61, .94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 58px; font-size: 11px; font-weight: 700; color: var(--dim); text-decoration: none; }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tabs a[aria-current="page"] { color: var(--cyan); }

h2 { font-size: 13px; font-weight: 700; color: var(--soft); letter-spacing: .5px; text-transform: uppercase; margin: 22px 0 8px; display: flex; justify-content: space-between; align-items: baseline; }
h2 a { font-size: 13px; font-weight: 700; color: var(--cyan); text-transform: none; letter-spacing: 0; text-decoration: none; }
h2:first-child { margin-top: 2px; }
.empty { padding: 42px 16px; text-align: center; color: var(--soft); }

/* The game on the scoreboard */
.hero { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px 12px; box-shadow: 0 10px 28px rgba(0, 0, 0, .28); }
.hero.is-live { border-color: rgba(255, 59, 78, .65); }
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; color: var(--soft); margin-bottom: 10px; }
.hero-team { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 7px 0; }
.hero-team + .hero-team { border-top: 1px solid var(--line); }
.hero-name { font-size: 23px; font-weight: 900; line-height: 1.15; overflow-wrap: anywhere; }
.hero-sub { font-size: 12px; color: var(--soft); margin-top: 2px; }
.hero-score { font-size: 52px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; text-align: right; min-width: 1.3em; }
.hero-team.lost .hero-name, .hero-team.lost .hero-score { color: var(--dim); }
.hero-team.won .hero-score { color: var(--gold); }
.hero-sets { display: block; font-size: 12px; font-weight: 700; color: var(--soft); margin-top: 3px; text-align: right; }
.hero-foot { display: flex; justify-content: center; align-items: baseline; gap: 12px; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line); font-weight: 700; color: var(--soft); flex-wrap: wrap; }
.clock { font-size: 24px; font-weight: 900; color: var(--ink); font-variant-numeric: tabular-nums; }
.clock.stopped { color: var(--soft); }
.period { font-size: 18px; font-weight: 900; color: var(--ink); }
.set-list { width: 100%; text-align: center; font-size: 13px; }
.flash { animation: flash 900ms ease-out; }
@keyframes flash { 0% { color: var(--cyan); transform: scale(1.14); } 100% { transform: scale(1); } }

.chip { display: inline-block; padding: 2px 8px; border-radius: 5px; font-size: 11px; font-weight: 900; letter-spacing: .5px; text-transform: uppercase; white-space: nowrap; }
.chip.live { background: var(--live); color: #fff; animation: pulse 1.8s ease-in-out infinite; }
.chip.soon { background: rgba(39, 215, 255, .18); color: var(--cyan); }
.chip.final { background: rgba(255, 255, 255, .13); color: var(--soft); }
.chip.off { background: rgba(255, 255, 255, .08); color: var(--dim); }
.chip.gold { background: var(--gold); color: #2b1d00; }
@keyframes pulse { 50% { opacity: .62; } }

/* One game in a list */
.games { display: grid; gap: 8px; }
.game { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; scroll-margin: 90px; }
.game.is-live { border-color: rgba(255, 59, 78, .7); }
.game.is-mine { box-shadow: inset 3px 0 0 var(--cyan); }
.game.champ { border-color: rgba(255, 201, 64, .6); }
.game.cancelled .line { text-decoration: line-through; opacity: .6; }
.when { font-size: 12px; color: var(--soft); line-height: 1.3; }
.when b { display: block; font-size: 13px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.when .chip { margin-top: 3px; }
.round { font-size: 11px; font-weight: 700; color: var(--gold); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 2px; }
.line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 1px 0; }
.line .nm { min-width: 0; font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line small { font-size: 11px; font-weight: 500; color: var(--dim); margin-left: 5px; }
.line .sc { font-weight: 900; font-size: 16px; font-variant-numeric: tabular-nums; }
.line.tbd .nm { font-weight: 500; font-style: italic; color: var(--soft); }
.line.lost .nm, .line.lost .sc { color: var(--dim); font-weight: 500; }
.line.won .sc { color: var(--gold); }
.note { background: var(--card-2); border-radius: 10px; padding: 8px 12px; font-size: 13px; color: var(--soft); display: flex; gap: 10px; }
.note b { color: var(--ink); flex: none; width: 74px; font-size: 13px; }

.champions { display: grid; gap: 8px; margin-bottom: 12px; }
.champion { background: linear-gradient(120deg, rgba(255, 201, 64, .24), rgba(255, 201, 64, .06)); border: 1px solid rgba(255, 201, 64, .6); border-radius: 12px; padding: 10px 14px; font-weight: 900; font-size: 18px; }
.champion small { display: block; font-size: 12px; font-weight: 700; color: var(--gold); text-transform: uppercase; letter-spacing: .5px; }

/* Filters */
.segments { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--card-2); border-radius: 11px; margin-bottom: 10px; }
.segments a, .segments button { display: block; min-height: 38px; padding: 8px 6px; text-align: center; border: 0; border-radius: 8px; background: none; font-size: 13px; font-weight: 700; color: var(--soft); text-decoration: none; cursor: pointer; }
.segments [aria-pressed="true"], .segments [aria-current="page"] { background: var(--blue); color: #fff; }
.team-pick { display: block; margin-bottom: 12px; font-size: 12px; font-weight: 700; color: var(--soft); }
select { display: block; width: 100%; min-height: 44px; margin-top: 4px; padding: 8px 12px; font: 700 15px Montserrat, system-ui, sans-serif; color: #fff; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
select option { background: var(--deep); }

/* Bracket: pans sideways on a phone */
.scroller { overflow-x: auto; margin: 0 -16px; padding: 0 16px 8px; -webkit-overflow-scrolling: touch; }
.tree { position: relative; }
.tree svg { position: absolute; inset: 0; pointer-events: none; }
.tree path { fill: none; stroke: rgba(130, 175, 255, .5); stroke-width: 1.5; }
.tree .label { position: absolute; font-size: 11px; font-weight: 900; letter-spacing: .6px; text-transform: uppercase; color: var(--cyan); white-space: nowrap; }
.tree .label.gold { color: var(--gold); }
.box { position: absolute; background: var(--deep); border: 1px solid var(--line); border-radius: 9px; padding: 5px 8px; overflow: hidden; }
.box.is-live { border-color: var(--live); }
.box.champ { border-color: var(--gold); }
.box.is-mine { box-shadow: inset 3px 0 0 var(--cyan); }
.box .meta { display: flex; justify-content: space-between; align-items: center; font-size: 10px; color: var(--soft); margin-bottom: 3px; height: 16px; }
.box .meta b { font-weight: 900; }
.box .chip { padding: 0 5px; font-size: 9px; }
.box .line { padding: 0; line-height: 1.32; }
.box .nm { font-size: 13px; }
.box .sc { font-size: 13px; }
.hint { font-size: 12px; color: var(--dim); margin-top: 6px; }

/* Standings */
.table { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.tr { display: grid; grid-template-columns: minmax(0, 1fr) 30px 30px 42px 82px; align-items: center; gap: 4px; padding: 10px 12px; text-align: center; font-variant-numeric: tabular-nums; }
.tr + .tr { border-top: 1px solid var(--line); }
.tr.head { padding: 7px 12px; font-size: 11px; font-weight: 700; color: var(--dim); }
.tr > :first-child { text-align: left; min-width: 0; }
.tr .n { font-weight: 700; }
.tr small { display: block; font-size: 11px; font-weight: 500; color: var(--dim); }
.tr.out .n, .tr.out { color: var(--dim); }
.tr.is-mine { box-shadow: inset 3px 0 0 var(--cyan); }

.foot { margin-top: 26px; text-align: center; font-size: 12px; color: var(--dim); }
.foot a { color: var(--soft); }
.install { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; padding: 12px 14px; background: var(--card-2); border-radius: 12px; font-size: 13px; color: var(--soft); }
.install b { display: block; color: var(--ink); font-size: 14px; }
.install-actions { display: flex; flex: none; gap: 6px; align-items: center; }
.btn { min-height: 38px; padding: 8px 14px; border: 0; border-radius: 9px; background: var(--bright); color: #04173d; font-weight: 900; cursor: pointer; }
.btn.quiet { background: none; color: var(--soft); font-weight: 700; padding: 8px; }

@media (prefers-reduced-motion: reduce) { .chip.live, .flash { animation: none; } }
