:root {
  --bg: #0B1117; --panel: #151D26; --panel2: #1D2732; --fg: #EDF1F5; --muted: #93A1B1; --rule: #2A3542;
  --accent: #E31837; --gold: #FFB81C; --live: #FF4D5E; --good: #3CCB7F;
  --fb: #C8402F; --cbb: #D69222; --nba: #2C64A8; --nhl: #2E8A55;
  --top: env(safe-area-inset-top, 0px); --bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.35 system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-text-size-adjust: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
main { max-width: 760px; margin: 0 auto; padding: calc(var(--top) + 14px) 16px calc(var(--bottom) + 84px); }
main.wide { max-width: none; padding-left: 0; padding-right: 0; }
h1 { font-size: 26px; line-height: 1.1; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 20px 0 8px; }
.top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.stamp { font-size: 12px; color: var(--muted); white-space: nowrap; }
.muted { color: var(--muted); }
.notice { background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; padding: 12px 14px; color: var(--muted); }
.notice.bad { border-color: var(--accent); color: var(--fg); margin-bottom: 10px; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(15, 22, 30, .94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--rule); padding-bottom: var(--bottom); }
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 0 7px; font-size: 11px; color: var(--muted); }
.tabs a.on { color: var(--fg); }
.tabs a.on .ti { color: var(--accent); }
.ti { font-size: 17px; line-height: 20px; }

.strip { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 8px; padding: 2px 16px; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 7px 12px; min-height: 34px; border-radius: 17px; background: var(--panel); color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.chip.on { background: var(--fg); color: var(--bg); }
.seg { display: inline-flex; background: var(--panel); border-radius: 9px; padding: 2px; }
.seg button { padding: 6px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--panel2); color: var(--fg); }

.game { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; background: var(--panel); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; border-left: 3px solid transparent; }
.game.mine { border-left-color: var(--gold); }
.game.live { border-left-color: var(--live); }
.teamrow { grid-column: 1; display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; min-height: 28px; }
.teamrow img, .noimg { width: 26px; height: 26px; object-fit: contain; display: block; }
.tname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tname small { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 4px; }
.tname sup { font-size: 11px; font-weight: 600; color: var(--muted); margin-right: 3px; vertical-align: baseline; }
.tscore { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.post .tscore.lose, .post .tname.lose { color: var(--muted); font-weight: 500; }
.ginfo { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; align-items: flex-end; justify-content: center; text-align: right; min-width: 104px; max-width: 140px; gap: 2px; }
.gstat { font-size: 13px; font-weight: 700; }
.live .gstat { color: var(--live); }
.gchan { font-size: 12px; color: var(--muted); }
.gchan.pdx { color: var(--good); }
.sit { grid-column: 1 / -1; font-size: 12px; color: var(--muted); margin-top: 3px; }
.more { display: block; width: 100%; text-align: center; padding: 11px; border-radius: 10px; background: var(--panel); color: var(--muted); font-size: 13px; font-weight: 600; margin-bottom: 8px; }

.tl { overflow-x: auto; background: var(--panel); border-radius: 12px; }
.tlgrid { position: relative; }
.tlhead { display: flex; position: sticky; top: 0; height: 26px; border-bottom: 1px solid var(--rule); }
.tlhour { flex: none; font-size: 11px; color: var(--muted); padding: 6px 0 0 4px; border-left: 1px solid var(--rule); }
.tlrow { display: flex; border-bottom: 1px solid var(--rule); }
.tlrow:last-child { border-bottom: 0; }
.tlname { position: sticky; left: 0; z-index: 3; flex: none; width: 118px; padding: 8px; background: var(--panel); font-size: 12px; font-weight: 600; border-right: 1px solid var(--rule); overflow-wrap: anywhere; }
.tltrack { position: relative; flex: none; }
.tlbar { position: absolute; height: 30px; border-radius: 6px; padding: 2px 6px; font-size: 11px; line-height: 13px; overflow: hidden; color: #fff; }
.tlbar.fb { background: var(--fb); } .tlbar.cbb { background: var(--cbb); color: #1a1205; } .tlbar.nba { background: var(--nba); } .tlbar.nhl { background: var(--nhl); }
.tlbar.done { opacity: .5; }
.tlnow { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--live); z-index: 2; pointer-events: none; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; }

.back { display: inline-block; color: var(--muted); font-size: 14px; padding: 4px 8px 8px 0; }
.score { background: var(--panel); border-radius: 14px; padding: 16px 12px; display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; text-align: center; }
.score img, .score .noimg { width: 56px; height: 56px; object-fit: contain; margin: 0 auto 4px; display: block; }
.score .nm { font-weight: 600; font-size: 14px; }
.score .rec { font-size: 12px; color: var(--muted); }
.score .big { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; white-space: nowrap; }
.score .st { font-size: 14px; font-weight: 700; margin-top: 6px; }
.score.live .st { color: var(--live); }
.score .ch { font-size: 12px; color: var(--muted); margin-top: 2px; }
.play { background: var(--panel); border-radius: 10px; padding: 10px 12px; margin-top: 8px; font-size: 14px; }
.play b { color: var(--gold); }

.tbl { overflow-x: auto; background: var(--panel); border-radius: 10px; margin-bottom: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { padding: 6px 8px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--rule); }
tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-weight: 600; font-size: 11px; }
th:first-child, td:first-child { position: sticky; left: 0; background: var(--panel); text-align: left; font-weight: 600; }
.vs td { text-align: center; } .vs td:first-child, .vs td:last-child { position: static; font-weight: 600; text-align: center; width: 28%; } .vs td:nth-child(2) { color: var(--muted); font-size: 12px; white-space: normal; }

.fp { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; background: var(--panel); padding: 9px 12px; border-bottom: 1px solid var(--rule); }
.fp:first-of-type { border-radius: 10px 10px 0 0; } .fp:last-of-type { border-radius: 0 0 10px 10px; border-bottom: 0; }
.fp img, .fp .noimg { width: 26px; height: 26px; object-fit: contain; }
.fp b { font-weight: 600; display: block; } .fp small { color: var(--muted); font-size: 12px; }
.fp .pts { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.fnote { font-size: 12px; color: var(--muted); margin-top: 8px; }

.mapframe { width: 100%; border: 0; display: block; height: calc(100dvh - 58px - var(--bottom)); background: var(--bg); }
main.map { padding: var(--top) 0 0; }

.hero { background: linear-gradient(135deg, #E31837, #8E0F24); border-radius: 14px; padding: 16px; margin-bottom: 8px; }
.hero .k { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .85; }
.hero .m { font-size: 22px; font-weight: 800; margin: 4px 0; }
.hero .d { font-size: 14px; }
.hero .c { display: inline-block; margin-top: 8px; padding: 4px 10px; background: rgba(0, 0, 0, .28); border-radius: 12px; font-size: 13px; font-weight: 600; }
.sched { display: grid; grid-template-columns: 42px 26px minmax(84px, 1fr) minmax(0, auto); gap: 8px; align-items: center; padding: 9px 12px; background: var(--panel); border-bottom: 1px solid var(--rule); font-size: 14px; }
.sched:first-of-type { border-radius: 10px 10px 0 0; } .sched:last-of-type { border-radius: 0 0 10px 10px; border-bottom: 0; }
.sched img, .sched .noimg { width: 26px; height: 26px; object-fit: contain; }
.sched .w { font-weight: 700; color: var(--muted); font-size: 12px; white-space: nowrap; }
.sched .r { text-align: right; font-size: 13px; }
.sched .r small { display: block; color: var(--muted); font-size: 12px; }
.win { color: var(--good); font-weight: 700; } .loss { color: var(--live); font-weight: 700; }

.set { background: var(--panel); border-radius: 10px; }
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; border-bottom: 1px solid var(--rule); }
.setrow:last-child { border-bottom: 0; }
.setrow small { display: block; color: var(--muted); font-size: 12px; }
input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent); }

#toasts { position: fixed; top: calc(var(--top) + 8px); left: 12px; right: 12px; z-index: 40; display: grid; gap: 6px; justify-items: center; pointer-events: none; }
.toast { max-width: 420px; width: 100%; background: var(--panel2); border: 1px solid var(--rule); border-left: 3px solid var(--gold); border-radius: 10px; padding: 10px 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, .4); }
.toast b { display: block; }
