/* Матч-центр: dark like the cards, coffee accent, Oswald for numbers/headings, Inter for text. */
@font-face { font-family: "Oswald"; src: url(fonts/Oswald.woff2) format("woff2"); font-weight: 200 700; font-display: swap; }
@font-face { font-family: "Inter"; src: url(fonts/Inter-Regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url(fonts/Inter-SemiBold.woff2) format("woff2"); font-weight: 600 700; font-display: swap; }

:root {
  --bg: #0B0C10;
  --panel: #14161D;
  --panel2: #1A1D26;
  --line: #262A35;
  --fg: #F2F0EC;
  --muted: #A3A7B3;
  --dim: #6B7080;
  --coffee: #E3A462;
  --away: #E0283F;
  --home: #8FB4DD;
  --display: "Oswald", "Arial Narrow", sans-serif;
  --body: "Inter", system-ui, sans-serif;
  --st: max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px));
  --sb: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --sl: max(env(safe-area-inset-left, 0px), var(--tg-safe-area-inset-left, 0px));
  --sr: max(env(safe-area-inset-right, 0px), var(--tg-safe-area-inset-right, 0px));
  --ct: var(--tg-content-safe-area-inset-top, 0px);
  --tabs: 64px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font: 400 15px/1.45 var(--body); min-height: 100vh; overscroll-behavior-y: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--coffee); outline-offset: 2px; }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; }

main {
  padding: calc(var(--st) + var(--ct) + 12px) calc(16px + var(--sr)) calc(var(--tabs) + var(--sb) + 20px) calc(16px + var(--sl));
  max-width: 720px; margin: 0 auto;
}
.screen[hidden] { display: none; }
.screen { display: flex; flex-direction: column; gap: 16px; animation: in .18s ease-out; }
@keyframes in { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .screen { animation: none; } }

.kicker { font: 600 12px/1 var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--coffee); }
h2 { font: 700 22px/1.1 var(--display); text-transform: uppercase; margin: 0; letter-spacing: .02em; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.muted { color: var(--muted); }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.empty b { font: 700 22px/1.1 var(--display); text-transform: uppercase; color: var(--fg); }
.btn { background: var(--coffee); color: var(--bg); font-weight: 600; border-radius: 999px; padding: 12px 20px; min-height: 44px; }
.btn.ghost { background: var(--panel2); color: var(--fg); border: 1px solid var(--line); }

/* --- score header --- */
.score { border-radius: 16px; overflow: hidden; display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; min-height: 132px; position: relative; }
.score .team { padding: 16px 12px; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; color: #fff; min-width: 0; }
.score .team.home { text-align: right; align-items: flex-end; }
.score .abbr { font: 700 13px/1 var(--display); letter-spacing: .14em; opacity: .85; }
.score .name { font: 700 20px/1 var(--display); text-transform: uppercase; overflow-wrap: anywhere; }
.score .pts { font: 700 52px/0.9 var(--display); font-variant-numeric: tabular-nums; }
.score .lost .pts { opacity: .6; }
.score .mid { background: var(--bg); display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 0 10px; gap: 4px; min-width: 64px; }
.score .state { font: 600 12px/1.2 var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); text-align: center; }
.score .state.live { color: #FF5A5F; }
.score .state.live::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-right: 5px; vertical-align: 1px; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.headline { font: 700 26px/1.08 var(--display); text-transform: uppercase; text-wrap: balance; margin: 0; }

/* --- hero --- */
.hero { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; }
.hero .big { font: 700 64px/0.85 var(--display); color: var(--coffee); }
.hero .big small { display: block; font-size: 13px; letter-spacing: .12em; color: var(--muted); margin-top: 6px; text-transform: uppercase; }
.hero .who { font: 700 22px/1.05 var(--display); text-transform: uppercase; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font: 600 12px/1 var(--body); padding: 7px 10px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); }
.chip.solid { background: var(--coffee); color: var(--bg); border-color: var(--coffee); }

/* --- tables --- */
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 8px 6px; text-align: right; white-space: nowrap; }
.tbl th { font: 600 11px/1 var(--display); letter-spacing: .1em; color: var(--muted); text-transform: uppercase; }
.tbl td:first-child, .tbl th:first-child { text-align: left; }
.tbl tbody tr + tr td { border-top: 1px solid var(--line); }
.tbl .best { color: var(--coffee); font-weight: 600; }
.tbl .deciding { background: rgba(227,164,98,.12); border-radius: 6px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: 0; }

.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row .lbl { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.bar-row .lbl span:nth-child(2) { color: var(--muted); }
.bar-row .lbl b { font-weight: 600; }
.bar-row .lbl b.win { color: var(--coffee); }
.bar { display: flex; gap: 3px; height: 6px; }
.bar i { display: block; border-radius: 3px; }

/* --- segmented / chips filters --- */
.seg { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.seg button { flex: 1 0 auto; padding: 9px 14px; border-radius: 999px; font-weight: 600; font-size: 13px; color: var(--muted); min-height: 38px; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--panel2); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
select { font: 600 13px var(--body); color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 10px 14px; min-height: 40px; max-width: 100%; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); min-height: 38px; }
.toggle[aria-pressed="true"] { border-color: var(--coffee); color: var(--coffee); }

/* --- flow chart --- */
.chart { position: relative; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.chart canvas { display: block; width: 100%; height: 300px; border-radius: 14px; background: #08090E; }
.tip { position: absolute; top: 8px; left: 8px; right: 8px; background: rgba(20,22,29,.94); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 13px; pointer-events: none; }
.tip[hidden] { display: none; }
.tip .t { font: 600 12px/1 var(--display); letter-spacing: .1em; color: var(--coffee); text-transform: uppercase; }
.tip .s { font: 700 20px/1.1 var(--display); margin: 4px 0; }
.tip .p { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.fact { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.fact b { display: block; font: 700 26px/1 var(--display); }
.fact span { font-size: 11px; color: var(--muted); }
.moments { display: flex; flex-direction: column; gap: 6px; }
.moment { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; text-align: left; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.moment .m-t { font-weight: 600; font-size: 14px; }
.moment .m-w { font-size: 12px; color: var(--muted); }
.moment .m-s { font: 700 16px var(--display); }
.mk { width: 10px; height: 10px; border-radius: 50%; }
.mk.run { background: var(--coffee); } .mk.lead { background: #fff; } .mk.clutch { background: #F2C94C; } .mk.decisive { background: #5BE08A; }

/* --- court --- */
.court { width: 100%; height: auto; display: block; background: #111318; border-radius: 14px; touch-action: manipulation; }
.shot-sum { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }

/* --- box score --- */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); }
.box th { position: sticky; top: 0; background: var(--panel); cursor: pointer; }
.box th[aria-sort] { color: var(--coffee); }
.box th[aria-sort="descending"]::after { content: " ↓"; } .box th[aria-sort="ascending"]::after { content: " ↑"; }
.box td:first-child, .box th:first-child { position: sticky; left: 0; background: var(--panel); z-index: 1; max-width: 132px; overflow: hidden; text-overflow: ellipsis; }
.box td:first-child small { color: var(--dim); margin-left: 4px; }
.box tr.dnp td { color: var(--dim); }
.box tr.total td { font-weight: 600; border-top: 1px solid var(--muted); }

/* --- play-by-play --- */
.pbp { display: flex; flex-direction: column; }
.pbp h3 { font: 700 14px/1 var(--display); letter-spacing: .12em; color: var(--coffee); margin: 18px 0 8px; text-transform: uppercase; }
.play { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; padding: 9px 0 9px 10px; border-top: 1px solid var(--line); font-size: 14px; border-left: 3px solid transparent; }
.play .c { font: 500 13px var(--display); color: var(--muted); font-variant-numeric: tabular-nums; }
.play .sc { font: 700 14px var(--display); white-space: nowrap; }
.play.scored .x { font-weight: 600; }

/* --- bottom tabs --- */
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: space-around; background: rgba(11,12,16,.96); border-top: 1px solid var(--line);
  padding: 6px calc(6px + var(--sr)) calc(6px + var(--sb)) calc(6px + var(--sl)); backdrop-filter: blur(10px); }
nav.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--dim); padding: 6px 2px; min-height: 48px; border-radius: 10px; }
nav.tabs button svg { width: 22px; height: 22px; }
nav.tabs button[aria-current="page"] { color: var(--coffee); }
nav.tabs[hidden] { display: none; }

/* --- bottom sheet --- */
.sheet { position: fixed; inset: 0; z-index: 10; display: flex; align-items: flex-end; background: rgba(0,0,0,.5); }
.sheet[hidden] { display: none; }
.sheet .in { width: 100%; max-width: 720px; margin: 0 auto; background: var(--panel); border-radius: 18px 18px 0 0; border: 1px solid var(--line); padding: 18px calc(18px + var(--sr)) calc(22px + var(--sb)) calc(18px + var(--sl)); display: flex; flex-direction: column; gap: 8px; animation: up .18s ease-out; }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
.sheet .s-t { font: 700 22px/1.1 var(--display); text-transform: uppercase; }
.sheet .s-w { font: 600 12px/1 var(--display); letter-spacing: .1em; color: var(--coffee); text-transform: uppercase; }

/* --- loading --- */
.sk { background: linear-gradient(90deg, var(--panel) 0%, var(--panel2) 50%, var(--panel) 100%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 14px; }
@keyframes sk { to { background-position: -200% 0; } }

/* --- tactics board --- */
.board { position: relative; width: 100%; aspect-ratio: 1020 / 820; border-radius: 14px; overflow: hidden; background: #111318; border: 1px solid var(--line); touch-action: pan-y; }
.board svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.steps-bar { display: grid; gap: 4px; }
.steps-bar i { display: block; height: 4px; border-radius: 2px; background: #2A2E38; overflow: hidden; }
.steps-bar i b { display: block; height: 100%; width: 0; background: var(--coffee); }
.cap-title { font: 700 22px/1.05 var(--display); text-transform: uppercase; color: var(--coffee); }
.big-title { font: 700 40px/1 var(--display); text-transform: uppercase; margin: 4px 0 0; }
.t-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 12px; }
.t-legend span { display: inline-flex; gap: 6px; align-items: center; }

/* --- start screen --- */
.h-list { display: flex; flex-direction: column; gap: 8px; }
.h-game { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; text-align: left; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.h-teams { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.h-team { display: grid; grid-template-columns: 14px 1fr auto; gap: 8px; align-items: center; font-weight: 600; }
.h-team span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-team b { font: 700 20px var(--display); }
.h-team.lost { color: var(--muted); }
.h-game > span { font-size: 12px; text-align: right; }
.h-live { color: #FF5A5F; font: 600 12px var(--display); letter-spacing: .06em; }
.h-board { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 14px; background: var(--panel); border: 1px solid var(--coffee); border-radius: 14px; }
.h-board b { font: 700 20px var(--display); text-transform: uppercase; color: var(--coffee); }
.h-board span { font-size: 13px; }
