@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-style: normal; font-display: swap; src: url(fonts/barlow-condensed-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 800; font-style: normal; font-display: swap; src: url(fonts/barlow-condensed-latin-800-normal.woff2) format("woff2"); }
@font-face { font-family: "Archivo"; font-weight: 400; font-style: normal; font-display: swap; src: url(fonts/archivo-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Archivo"; font-weight: 500; font-style: normal; font-display: swap; src: url(fonts/archivo-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Archivo"; font-weight: 600; font-style: normal; font-display: swap; src: url(fonts/archivo-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Archivo"; font-weight: 700; font-style: normal; font-display: swap; src: url(fonts/archivo-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-style: normal; font-display: swap; src: url(fonts/jetbrains-mono-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 700; font-style: normal; font-display: swap; src: url(fonts/jetbrains-mono-latin-700-normal.woff2) format("woff2"); }

:root {
  --bg: #0b1422;
  --bg2: #0f1b2d;
  --card: #132238;
  --card2: #182a44;
  --line: #243a5a;
  --text: #e8eef7;
  --muted: #8ea2bf;
  --home: #2dd4bf;
  --home-ink: #042f2b;
  --away: #fbbf24;
  --away-ink: #3a2703;
  --pos: #4ade80;
  --neg: #f87171;
  --accent: #7dd3fc;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --r: 16px;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #eef3f8; --bg2: #e3ebf4; --card: #ffffff; --card2: #f3f7fb; --line: #d3dde9;
    --text: #0d1b2e; --muted: #5b6d86; --home: #0f9f8f; --home-ink: #ffffff; --away: #d97706; --away-ink: #ffffff;
    --pos: #15803d; --neg: #dc2626; --accent: #0369a1; --shadow: 0 8px 24px rgba(15,35,65,.10);
    color-scheme: light;
  }
}
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, color-mix(in srgb, var(--home) 10%, transparent), transparent 60%),
              radial-gradient(900px 500px at -10% 110%, color-mix(in srgb, var(--away) 8%, transparent), transparent 60%),
              var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.45 var(--body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
.boot { text-align: center; color: var(--muted); padding: 40vh 0; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.pos { color: var(--pos); } .neg { color: var(--neg); }
.hc { color: var(--home); } .ac { color: var(--away); }
h1, h2, h3 { font-family: var(--display); letter-spacing: .01em; margin: 0; line-height: 1.05; }
h2 { font-size: 26px; } h3 { font-size: 19px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.btn { appearance: none; border: 1px solid var(--line); background: var(--card2); border-radius: 12px; padding: 12px 16px; font-weight: 700; cursor: pointer; transition: transform .06s ease, filter .15s; }
.btn:hover { filter: brightness(1.08); } .btn:active { transform: translateY(1px); }
.btn.primary { background: var(--home); color: var(--home-ink); border-color: transparent; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.icon { appearance: none; border: 1px solid var(--line); background: var(--card2); color: var(--text); width: 36px; height: 36px; border-radius: 10px; cursor: pointer; font-weight: 700; flex: none; }
.link { appearance: none; background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 6px; }
label { display: block; font-weight: 600; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
input[type=text] { width: 100%; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 17px; color: var(--text); }
input[type=text]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.check { display: flex; gap: 10px; align-items: center; color: var(--text); font-weight: 500; font-size: 15px; }
.check input { width: 20px; height: 20px; accent-color: var(--home); }
.err { color: var(--neg); min-height: 1.4em; text-align: center; font-weight: 600; }

/* ---------- home ---------- */
.homepage { max-width: 880px; margin: 0 auto; padding: 32px 16px 48px; }
.brand { text-align: center; margin-bottom: 26px; }
.brand h1 { font-size: clamp(56px, 13vw, 104px); font-weight: 800; text-transform: uppercase; letter-spacing: -.01em; }
.brand h1 span { color: var(--home); }
.brand .tag { max-width: 560px; margin: 12px auto 0; color: var(--muted); font-size: 17px; }
.brand .logo { margin: 0 auto 8px; display: block; }
.brand-sm .logo { display: block; }
.ticker { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 16px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.ticker span { border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; background: var(--card); }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cards form h2 { margin-bottom: 4px; }
.cards .btn { margin-top: 16px; width: 100%; }
.code-in { text-transform: uppercase; letter-spacing: .35em; font-family: var(--mono) !important; font-weight: 700; }
.foot { text-align: center; color: var(--muted); margin-top: 18px; font-size: 13px; }
.center { text-align: center; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; max-width: 1180px; margin: 0 auto; }
.brand-sm { font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: 22px; letter-spacing: .02em; margin-right: auto; display: flex; align-items: center; gap: 8px; }
.brand-sm span { color: var(--home); }
.pill { font-family: var(--mono); font-size: 12px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 10px; white-space: nowrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); vertical-align: middle; }
.dot.on { background: var(--pos); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pos) 25%, transparent); }
.dot.warn { background: var(--away); }
.banner { max-width: 1180px; margin: 0 auto 8px; padding: 10px 16px; background: color-mix(in srgb, var(--away) 18%, var(--card)); border: 1px solid var(--away); border-radius: 12px; font-weight: 600; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px 40px; }

/* ---------- lobby ---------- */
.lobby { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.roomcard { text-align: center; }
.roomcard .code { font-family: var(--mono); font-size: 56px; font-weight: 700; letter-spacing: .12em; color: var(--home); line-height: 1.1; }
.qr { background: #fff; border-radius: 12px; padding: 10px; width: 190px; margin: 12px auto; }
.qr svg { display: block; width: 100%; height: auto; }
.share { display: flex; gap: 8px; margin-top: 8px; }
.share input { font-size: 13px !important; padding: 10px !important; }
.share .btn { white-space: nowrap; padding: 10px 12px; }
.plist { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.plist li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card2); }
.plist .you { font-size: 11px; font-weight: 700; color: var(--home); border: 1px solid var(--home); border-radius: 6px; padding: 1px 6px; }
.plist .role { margin-left: auto; font-size: 12px; color: var(--muted); }
.quick { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.quick li { margin: 4px 0; }
.quick b { color: var(--text); }

/* ---------- game ---------- */
.game { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.col { display: grid; gap: 16px; min-width: 0; }
.matchup .teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; text-align: center; }
.team b { display: block; font-family: var(--display); font-size: clamp(26px, 6vw, 38px); text-transform: uppercase; line-height: 1; }
.team small { color: var(--muted); }
.team .tagx { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .12em; padding: 2px 8px; border-radius: 6px; margin-bottom: 6px; }
.team.home .tagx { background: var(--home); color: var(--home-ink); }
.team.away .tagx { background: var(--away); color: var(--away-ink); }
.at { font-family: var(--display); font-size: 28px; color: var(--muted); }
.timer { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.timer .bar { flex: 1; height: 10px; background: var(--bg2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.timer .bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--home), var(--accent)); transform-origin: left; }
.timer .bar i.hot { background: linear-gradient(90deg, var(--away), var(--neg)); }
.timer .secs { font-family: var(--mono); font-weight: 700; font-size: 22px; min-width: 3ch; text-align: right; }

.market .prices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.price { border-radius: 12px; padding: 10px 12px; border: 1px solid var(--line); background: var(--card2); }
.price small { font-weight: 700; letter-spacing: .1em; font-size: 11px; }
.price b { display: block; font-family: var(--mono); font-size: clamp(30px, 8vw, 42px); line-height: 1.05; }
.price span { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.price.home { border-color: color-mix(in srgb, var(--home) 55%, var(--line)); } .price.home small, .price.home b { color: var(--home); }
.price.away { border-color: color-mix(in srgb, var(--away) 55%, var(--line)); } .price.away small, .price.away b { color: var(--away); }
.flash { animation: flash .6s ease; }
@keyframes flash { 0% { background: color-mix(in srgb, var(--accent) 35%, var(--card2)); } 100% { background: var(--card2); } }
.chart { width: 100%; height: auto; display: block; margin-top: 10px; overflow: visible; }
.chart text { font: 10px var(--mono); fill: var(--muted); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 4px; }
.legend i { display: inline-block; width: 16px; height: 0; border-top: 2px solid var(--text); vertical-align: middle; margin-right: 4px; }
.legend i.read { border-top: 2px dashed var(--accent); }
.legend i.true { border-top: 2px dotted var(--pos); }

.ticket .read { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 10px; padding: 12px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 12%, var(--card2)); border: 1px dashed color-mix(in srgb, var(--accent) 60%, var(--line)); }
.ticket .read b { font-family: var(--mono); font-size: 22px; }
.ticket .read small { color: var(--muted); margin-left: auto; font-size: 12px; }
.kelly { margin: 10px 0 0; font-size: 14px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kelly b { color: var(--text); }
.kelly .btn { padding: 6px 10px; font-size: 13px; }
.stake { margin-top: 14px; display: flex; align-items: baseline; gap: 6px; color: var(--text); font-size: 15px; font-weight: 500; }
.stake b { font-family: var(--mono); font-size: 20px; }
input[type=range] { width: 100%; accent-color: var(--home); height: 32px; margin: 2px 0 6px; }
.betbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bet { appearance: none; border: 0; border-radius: 14px; padding: 14px 10px; cursor: pointer; font-weight: 800; text-align: center; transition: transform .06s ease, filter .15s; }
.bet span { display: block; font-family: var(--display); font-size: clamp(20px, 5.4vw, 26px); white-space: nowrap; text-transform: uppercase; letter-spacing: .02em; line-height: 1; }
.bet small { display: block; font-family: var(--mono); font-size: 11.5px; margin-top: 4px; font-weight: 500; opacity: .9; }
.bet.home { background: var(--home); color: var(--home-ink); }
.bet.away { background: var(--away); color: var(--away-ink); }
.bet:hover { filter: brightness(1.07); } .bet:active { transform: translateY(1px); }
.bet:disabled { opacity: .35; cursor: not-allowed; filter: grayscale(.4); }
.betsleft { margin-top: 10px; display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.pips i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; border: 1px solid var(--muted); margin-left: 4px; }
.pips i.used { background: var(--muted); }
.mybets { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.mybets li, .feed li { font-size: 13px; padding: 8px 10px; border-radius: 10px; background: var(--card2); border: 1px solid var(--line); }
.spect { padding: 14px; text-align: center; color: var(--muted); }

.board { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.board li { display: grid; grid-template-columns: 22px 1fr auto; gap: 4px 8px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--card2); border: 1px solid var(--line); }
.board li.me { border-color: var(--home); }
.board .rk { font-family: var(--mono); color: var(--muted); font-size: 12px; }
.board .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .ch { font-family: var(--mono); font-weight: 700; text-align: right; }
.board .sub { grid-column: 2 / 4; display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.board .busted .nm { text-decoration: line-through; color: var(--muted); }
.feed { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; max-height: 280px; overflow: auto; }

/* ---------- reveal ---------- */
.reveal .kicker { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.reveal .winner { font-size: clamp(36px, 8vw, 56px); text-transform: uppercase; margin: 4px 0 12px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.facts div { background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.facts small { display: block; color: var(--muted); font-size: 12px; }
.facts b { font-family: var(--mono); font-size: 18px; }
.results { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 14px; }
.results th { text-align: left; font-size: 11px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.results td { padding: 8px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.results td.n { font-family: var(--mono); text-align: right; white-space: nowrap; }
.results th.n { text-align: right; }
.results .bl { font-family: var(--mono); font-size: 12px; color: var(--muted); display: block; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 1px 6px; margin-left: 4px; background: color-mix(in srgb, var(--pos) 20%, transparent); color: var(--pos); }
.lesson { margin: 14px 0 0; padding: 12px; border-radius: 12px; background: var(--card2); border-left: 4px solid var(--accent); }
.nextrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

/* ---------- final ---------- */
.final { max-width: 760px; margin: 0 auto; }
.final .champ { text-align: center; padding: 26px 16px; }
.final .champ .kicker { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.final .champ h2 { font-size: clamp(44px, 11vw, 80px); text-transform: uppercase; color: var(--home); }
.awards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.award { text-align: center; }
.award small { color: var(--muted); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: 11px; }
.award b { display: block; font-family: var(--display); font-size: 30px; text-transform: uppercase; }
.award span { font-family: var(--mono); color: var(--muted); font-size: 13px; }

/* ---------- rules dialog ---------- */
dialog { border: 1px solid var(--line); border-radius: 18px; padding: 0; background: var(--card); color: var(--text); max-width: 620px; width: calc(100% - 24px); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(3,8,16,.6); backdrop-filter: blur(2px); }
.rules { padding: 18px; max-height: 86vh; overflow: auto; }
.rules header { display: flex; justify-content: space-between; align-items: center; }
.rules ol { padding-left: 20px; margin: 14px 0; }
.rules li { margin: 8px 0; }
.rules .tip { color: var(--muted); font-size: 14px; }

#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .25s ease; max-width: calc(100% - 32px); text-align: center; z-index: 10; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 900px) {
  .game, .lobby { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .cards { grid-template-columns: 1fr; }
  .topbar { padding: 10px 16px; gap: 6px; }
  .brand-sm { font-size: 19px; }
  .brand-sm .full { display: none; }
  .card { padding: 14px; }
  .facts { grid-template-columns: 1fr 1fr; }
  .facts div:last-child { grid-column: 1 / 3; }
  .awards { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
}
