:root {
    color-scheme: light;
    --bg: #e4e7eb;
    --surface: #ffffff;
    --surface-alt: #f1f3f5;
    --text: #0b0d10;
    --muted: #4a525c;
    --border: #b9bfc7;
    --head-bg: #1a1a1a;
    --head-text: #ffffff;
    --head-red: #ff5a52;
    --red: #c62828;
    --live-bg: #fdeceb;
    --live-accent: #c62828;
    --green: #146c2e;
    --warn: #8a4b00;
    --colhead-bg: #2b2f35;
    --colhead-text: #d3d8de;
    --sect-bg: #d3d8de;
    --link: #0b4fa8;
    --err-bg: #fff3cd; --err-text: #5c4400;
    --banner-bg: #fde7e7; --banner-text: #7a1b1b; --banner-border: #e39a9a;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
    --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --hdr-h: 84px;
    /* header chrome: black in both themes */
    --head-muted: #c4c9ce;
    --head-tab: #b5bbc1;
    --head-line: #555;
    --head-rule: #2d2d2d;
    --head-hover: #242424;
    --head-active: #262626;
    --head-chip: #2a2a2a;
    --head-chip-text: #8f969d;
    --head-warn: #ff9c94;
    --head-alert: #ffb300;
    --on-red: #fff;
    --select: #b9d3f7;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #13161a;
    --surface: #1b1f25;
    --surface-alt: #20252b;
    --text: #e4e7ea;
    --muted: #a1aab4;
    --border: #333a43;
    --head-bg: #0b0d10;
    --head-text: #ffffff;
    --head-red: #ff6b63;
    --red: #e04a48;
    --live-bg: #2a1a1d;
    --live-accent: #ff6b63;
    --green: #56c776;
    --warn: #ffb74d;
    --colhead-bg: #262b32;
    --colhead-text: #a9b2bb;
    --sect-bg: #272c33;
    --link: #7ab8ff;
    --err-bg: #332b10; --err-text: #f0d98a;
    --banner-bg: #341a1a; --banner-text: #ffb4b4; --banner-border: #5c2a2a;
    --select: #2c4a75;
    }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #13161a;
    --surface: #1b1f25;
    --surface-alt: #20252b;
    --text: #e4e7ea;
    --muted: #a1aab4;
    --border: #333a43;
    --head-bg: #0b0d10;
    --head-text: #ffffff;
    --head-red: #ff6b63;
    --red: #e04a48;
    --live-bg: #2a1a1d;
    --live-accent: #ff6b63;
    --green: #56c776;
    --warn: #ffb74d;
    --colhead-bg: #262b32;
    --colhead-text: #a9b2bb;
    --sect-bg: #272c33;
    --link: #7ab8ff;
    --err-bg: #332b10; --err-text: #f0d98a;
    --banner-bg: #341a1a; --banner-text: #ffb4b4; --banner-border: #5c2a2a;
    --select: #2c4a75;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    line-height: 1.25;
    overflow-x: hidden;
}

button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--link); outline-offset: -2px; }
.header button:focus-visible { outline-color: var(--head-text); }
a { text-underline-offset: 2px; }
a:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 2px; }
::selection { background: var(--select); color: var(--text); }

/* ---------- header ---------- */
.header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--head-bg);
    border-bottom: 3px solid var(--head-red);
    color: var(--head-text);
}
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    max-width: 1000px;
    margin: 0 auto;
}
.logo { font-size: 20px; font-weight: 800; letter-spacing: 0.5px; text-decoration: none; }
.logo-free { color: var(--head-text); }
.logo-odds { color: var(--head-red); }
.header-info { display: flex; align-items: center; gap: 12px; font-size: 11px; color: var(--head-muted); min-width: 0; }
.last-update { font-family: var(--mono); white-space: nowrap; }
.last-update.stale { color: var(--head-warn); }
.theme-btn { display: inline-flex; align-items: center; gap: 5px; background: transparent; border: 1px solid var(--head-line); color: var(--head-text); border-radius: 3px; padding: 3px 8px; font-size: 11px; }
.theme-btn:hover { border-color: var(--head-red); }

/* Day switcher in the header: ‹ Today · Mon, Oct 26 › */
.day-nav { display: inline-flex; align-items: center; gap: 2px; }
.day-btn {
    width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: 1px solid var(--head-line); border-radius: 3px; color: var(--head-text); font-size: 16px; line-height: 1;
}
.day-btn:hover:not(:disabled) { border-color: var(--head-red); }
.day-btn:disabled { opacity: .35; cursor: default; }
.day-label { min-width: 64px; padding: 0 6px; text-align: center; color: var(--head-text); font-size: 12px; font-weight: 700; white-space: nowrap; }
.day-date { margin-left: 6px; color: var(--head-muted); font-weight: 400; }
.day-date:empty { display: none; }
.theme-btn svg { flex: 0 0 auto; }

.sport-nav { border-top: 1px solid var(--head-rule); }
.tablist {
    display: flex;
    max-width: 1000px;
    margin: 0 auto;
    overflow-x: auto;
    scrollbar-width: none;
}
/* On phones the tabs scroll sideways: fade the edge that has more tabs past it */
.tablist.more-right { -webkit-mask-image: linear-gradient(to right, black calc(100% - 32px), transparent); mask-image: linear-gradient(to right, black calc(100% - 32px), transparent); }
.tablist.more-left { -webkit-mask-image: linear-gradient(to left, black calc(100% - 32px), transparent); mask-image: linear-gradient(to left, black calc(100% - 32px), transparent); }
.tablist.more-left.more-right { -webkit-mask-image: linear-gradient(to right, transparent, black 32px, black calc(100% - 32px), transparent); mask-image: linear-gradient(to right, transparent, black 32px, black calc(100% - 32px), transparent); }
.tablist::-webkit-scrollbar { display: none; }
.sport-tab {
    flex: 0 0 auto;
    background: transparent;
    border: 0;
    border-bottom: 3px solid transparent;
    color: var(--head-tab);
    padding: 8px 14px 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.4px;
    margin-bottom: -1px;
}
.sport-tab:hover { color: var(--head-text); background: var(--head-hover); }
.sport-tab[aria-selected="true"] { color: var(--head-text); border-bottom-color: var(--head-red); background: var(--head-active); }
.tab-count {
    margin-left: 5px; font-family: var(--mono); font-size: 10px; font-weight: 600;
    color: var(--head-chip-text); background: var(--head-chip); border-radius: 8px; padding: 1px 5px;
}
.tab-count:empty { display: none; }
.sport-tab[aria-selected="true"] .tab-count { background: var(--red); color: var(--on-red); }
.sport-tab.none:not([aria-selected="true"]) .tab-count { background: transparent; }
.sport-tab.has-error::after { content: "!"; color: var(--head-alert); margin-left: 4px; font-weight: 800; }

/* ---------- board ---------- */
.main { max-width: 1000px; margin: 0 auto; padding: 8px 0 20px; }
.sport-section { margin-bottom: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 3px; }

.sport-header {
    position: sticky;
    top: var(--hdr-h);
    z-index: 10;
    display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
    padding: 5px 10px;
    background: var(--sect-bg);
    border-left: 4px solid var(--red);
    border-bottom: 1px solid var(--border);
}
.sport-header h2 { font-size: 13px; font-weight: 800; letter-spacing: 0.6px; }
.sport-header .count { color: var(--muted); font-size: 11px; }
.sport-header .live-count { color: var(--live-accent); font-size: 11px; font-weight: 700; }

/* One grid definition shared by column header and rows */
.colhead, .row {
    display: grid;
    grid-template-columns: 46px 86px minmax(0, 1fr) 46px 84px 84px 56px;
    align-items: center;
    column-gap: 6px;
    padding: 0 10px;
}
.colhead {
    position: sticky;
    top: calc(var(--hdr-h) + 27px);
    z-index: 9;
    background: var(--colhead-bg);
    color: var(--colhead-text);
    font-size: 10px; font-weight: 700; letter-spacing: 0.6px;
    height: 20px;
}
.colhead .c-rot, .colhead .c-score, .colhead .c-spread, .colhead .c-total, .colhead .c-ml { text-align: right; }
.colhead .c { font-size: inherit; font-weight: inherit; color: inherit; overflow: visible; text-overflow: clip; }

.game { border-bottom: 1px solid var(--border); border-left: 3px solid transparent; }
.game:last-child { border-bottom: 0; }
.game.alt { background: var(--surface-alt); }
.game.in { background: var(--live-bg); border-left-color: var(--live-accent); }
.row { min-height: 25px; }
.row.away { padding-top: 2px; }
.row.home { padding-bottom: 2px; border-top: 1px dotted var(--border); }

.c { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
.c-rot { color: var(--muted); font-weight: 600; position: relative; padding-right: 4px; }
.derived {
    display: inline-block; width: 4px; height: 4px; border-radius: 50%;
    background: var(--muted); opacity: 0.6; margin-left: 3px; vertical-align: middle; cursor: help;
}

.c-time { font-size: 11px; color: var(--muted); }
.c-time .sched { font-family: var(--mono); color: var(--text); }
.c-time .tz { margin-left: 3px; font-size: 9px; }
.c-time .final-tag { font-weight: 700; color: var(--green); }
.c-time .alert-tag { font-weight: 700; color: var(--warn); }
.c-time .live-tag {
    color: var(--on-red); background: var(--live-accent); font-size: 9px; font-weight: 800; letter-spacing: 0.5px;
    padding: 1px 4px; border-radius: 2px; margin-right: 4px; animation: pulse 2s ease-in-out infinite;
}
.c-time .clock { color: var(--live-accent); font-family: var(--mono); font-weight: 700; }
@keyframes pulse { 50% { opacity: 0.6; } }

.c-team { display: flex; align-items: baseline; gap: 6px; font-weight: 500; }
.tname { overflow: hidden; text-overflow: ellipsis; }
.rec { color: var(--muted); font-size: 10px; font-weight: 400; font-family: var(--mono); flex: 0 0 auto; }
/* Live situation (down & distance, outs/bases, last play) in the team cell: it gives up width before the name does */
.tname { flex: 0 1 auto; min-width: 0; }
.sit {
    flex: 0 1000 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    margin-left: 4px; font-size: 11px; font-weight: 500; color: var(--text);
}
.sit::before { content: "\25B8\00A0"; color: var(--live-accent); }
.sit.rz { color: var(--live-accent); font-weight: 700; }
.sit-short { display: none; }

.c-score { font-size: 15px; font-weight: 500; }
.row.win .tname, .row.win .c-score { font-weight: 800; }
.game.post .row:not(.win) .tname, .game.post .row:not(.win) .c-score { color: var(--muted); }
.game.in .c-score { color: var(--live-accent); font-weight: 700; }

.c-spread, .c-total, .c-ml { font-size: 12px; }
.c-spread.fav { font-weight: 700; }
.juice { margin-left: 4px; font-size: 10px; color: var(--muted); }
.ou { color: var(--muted); margin-right: 2px; font-size: 10px; }
.na { color: var(--muted); opacity: 0.6; }

/* Result marks on finished games: ✓ on the side that covered, ▲/▼ on the over/under row that hit, P = push */
.res { margin-left: 3px; color: var(--green); font-weight: 800; font-family: var(--sans); font-size: .9em; }
.res.push { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.sect-error, .sect-empty, .banner-error, .empty-state {
    padding: 10px 12px; font-size: 12px;
}
.sect-error { background: var(--err-bg); color: var(--err-text); border-bottom: 1px solid var(--border); }
.banner-error { background: var(--banner-bg); color: var(--banner-text); border: 1px solid var(--banner-border); border-radius: 3px; margin-bottom: 10px; }
.sect-empty { color: var(--muted); }
/* Football week views: one divider per game day */
.day-div {
    padding: 5px 10px; background: var(--surface-alt); border-bottom: 1px solid var(--border); border-top: 1px solid var(--border);
    color: var(--text); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
}
.empty-state { text-align: center; padding: 40px 12px; color: var(--muted); font-size: 14px; }
.link-btn { background: none; border: 0; color: var(--link); text-decoration: underline; padding: 0 2px; }

/* ---------- skeleton ---------- */
.skeleton { background: var(--surface); border: 1px solid var(--border); border-radius: 3px; }
.skel-game { padding: 8px 12px; border-bottom: 1px solid var(--border); display: grid; gap: 6px; }
.skel-bar {
    height: 12px; border-radius: 2px; width: 70%;
    background: linear-gradient(90deg, var(--surface-alt) 25%, var(--border) 50%, var(--surface-alt) 75%);
    background-size: 200% 100%; animation: shimmer 1.2s linear infinite;
}
.skel-bar + .skel-bar { width: 55%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- footer ---------- */
.footer { max-width: 1000px; margin: 0 auto; padding: 10px 12px 24px; text-align: center; color: var(--muted); font-size: 11px; }
.footer-sub { margin-top: 3px; font-size: 10px; }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
    .colhead, .row { grid-template-columns: 38px 70px minmax(0, 1fr) 42px 70px 70px 48px; column-gap: 4px; padding: 0 6px; }
    .c-time .tz { display: none; }
    .juice { display: none; }
    .theme-label, .day-date { display: none; }
}
@media (max-width: 560px) {
    .colhead, .row { grid-template-columns: 42px 60px minmax(0, 1fr) 40px 58px 56px; }
    .c-ml { display: none; }
    .rec { display: none; }
    /* The tinted row and red score already mark live games; the tag would push the clock out of the narrow time column. */
    .c-time .live-tag { display: none; }
    .sit-full { display: none; }
    .sit-short { display: inline; }
    .sit.wide-only { display: none; }
    /* the day switcher takes the header space; the update time only shows when it's a warning */
    .last-update:not(.stale) { display: none; }
}
@media (max-width: 400px) {
    .colhead, .row { grid-template-columns: 40px 54px minmax(0, 1fr) 38px 58px; }
    .c-total { display: none; }
    .last-update { font-size: 10px; }
    .header-info { gap: 8px; }
    .header-top { padding: 6px 8px; gap: 8px; }
}

@media (pointer: coarse) {
    .day-btn { width: 32px; height: 32px; font-size: 18px; }
    .theme-btn { min-height: 32px; min-width: 32px; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    .live-tag, .skel-bar { animation: none; }
}
.footer a { color: var(--link); }
