/* ============================================================
   MAIN — ZohnStats
   Layout, structure, and view-level styles.
   All values use design tokens from variables.css.
   All @keyframes live in animations.css.
   ============================================================ */

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-base);
    min-height: 100vh;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Ambient background glow — uses color-mix so it adapts to any theme accent */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 50% at 15% 15%, color-mix(in srgb, var(--accent) 8%, transparent) 0%, transparent 65%),
        radial-gradient(ellipse 50% 70% at 85% 85%, color-mix(in srgb, var(--accent-dark) 6%, transparent) 0%, transparent 65%);
    pointer-events: none;
    z-index: 0;
}

body > * { position: relative; z-index: 1; }

/* Subtle scanline texture — "war room" aesthetic */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 3px,
        rgba(255,255,255,0.016) 3px,
        rgba(255,255,255,0.016) 4px
    );
    pointer-events: none;
    z-index: 0;
}
[data-theme="light"] body::after {
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 3px,
        rgba(0,0,0,0.012) 3px,
        rgba(0,0,0,0.012) 4px
    );
}

/* ── City Connect — Atmospheric Layer ─────────────────────────
   Each theme replaces the generic color-mix glows with an
   intentional environmental signature. Position, hue, and
   intensity are chosen per-uniform's conceptual source.
   ─────────────────────────────────────────────────────────── */

/* Atlanta Braves — 1980s Superstation nostalgia
   Powder blue broadcast warmth from the upper-left,
   classic red trim glow from the lower-right corner. */
[data-theme="cc-braves"] body::before {
    background:
        radial-gradient(ellipse 88% 62% at 5% 0%,   rgba(124,185,232,0.28) 0%, transparent 65%),
        radial-gradient(ellipse 55% 75% at 92% 95%, rgba(206,17,65,0.12)   0%, transparent 58%);
}

/* Baltimore Orioles — Camden Yards atmosphere
   Camden green overhead like ballpark ivy; orange brickwork warmth
   rising from the lower-right, a Baltimore summer night. */
[data-theme="cc-orioles"] body::before {
    background:
        radial-gradient(ellipse 75% 55% at 50% -8%, rgba(0,90,60,0.24)    0%, transparent 62%),
        radial-gradient(ellipse 45% 60% at 85% 92%, rgba(223,70,1,0.13)   0%, transparent 52%);
}

/* Cincinnati Reds — total crimson commitment
   Red descends from above and rises from below — the whole
   environment belongs to the color. No other hue enters. */
[data-theme="cc-reds"] body::before {
    background:
        radial-gradient(ellipse 100% 55% at 50% -2%,  rgba(165,0,21,0.24)  0%, transparent 62%),
        radial-gradient(ellipse 100% 45% at 50% 102%, rgba(198,1,31,0.18)  0%, transparent 55%);
}
/* Authentic vertical pinstripes replace the horizontal scanline */
[data-theme="cc-reds"] body::after {
    background: repeating-linear-gradient(
        180deg,
        transparent 0px,
        transparent 15px,
        rgba(165,0,21,0.12) 15px,
        rgba(165,0,21,0.12) 16px
    );
}

/* Kansas City Royals — Kauffman Fountains
   Royal blue pool glow from below, gold stadium lights from above —
   night game at the K, fountains behind center field. */
/* Kansas City Royals — Forever Fountains: fuchsia crests from top, royal blue wells from below */
[data-theme="cc-royals"] body::before {
    background:
        radial-gradient(ellipse 80% 50% at 20%   0%, rgba(255,0,175,0.18) 0%, transparent 55%),
        radial-gradient(ellipse 70% 50% at 80%   0%, rgba(120,81,169,0.14) 0%, transparent 55%),
        radial-gradient(ellipse 80% 55% at 50% 110%, rgba(0,70,135,0.22)  0%, transparent 60%);
}

/* Milwaukee Brewers — Wisco Way
   Wild Mango sunset burns at the top; Great Lakes blue rises
   from below. The horizon lives in the middle of every screen. */
[data-theme="cc-brewers"] body::before {
    background:
        radial-gradient(ellipse 90% 45% at 50% -15%,  rgba(255,122,0,0.24)   0%, transparent 58%),
        radial-gradient(ellipse 100% 68% at 50% 110%,  rgba(35,107,142,0.28)  0%, transparent 64%);
    /* Explicit transparent midpoint so orange and blue don't clash at the viewport center */
    background:
        radial-gradient(ellipse 90% 50% at 50% -10%, rgba(255,122,0,0.22)   0%, transparent 100%),
        radial-gradient(ellipse 100% 50% at 50% 110%, rgba(35,107,142,0.26)  0%, transparent 100%);
}

/* Pittsburgh Pirates — Steel City grit
   Gold glints cold from above, like stadium lights over black
   steel. A second dim source at the lower-left: industrial depth. */
[data-theme="cc-pirates"] body::before {
    background:
        radial-gradient(ellipse 60% 35% at 50% 0%,  rgba(253,184,39,0.11) 0%, transparent 50%),
        radial-gradient(ellipse 35% 55% at 5%  95%, rgba(253,184,39,0.07) 0%, transparent 42%);
}
/* Diagonal crosshatch simulating steel-beam construction geometry */
[data-theme="cc-pirates"] body::after {
    background: repeating-linear-gradient(
        -45deg,
        transparent 0px,
        transparent 23px,
        rgba(253,184,39,0.04) 23px,
        rgba(253,184,39,0.04) 24px
    );
}

/* San Diego Padres — Día de los Muertos
   Pacific aqua from the upper-left horizon; marigold altar warmth
   from the lower-right; a whisper of Fireberry at center depth.
   will-change promotes to GPU to prevent banding on three-gradient overlap. */
[data-theme="cc-padres"] body::before {
    will-change: background;
    background:
        radial-gradient(ellipse 60% 50% at 2%   2%,  rgba(0,181,184,0.17)  0%, transparent 56%),
        radial-gradient(ellipse 65% 55% at 98%  98%, rgba(252,161,32,0.14) 0%, transparent 58%),
        radial-gradient(ellipse 40% 30% at 50%  50%, rgba(200,43,79,0.06)  0%, transparent 48%);
}

/* Texas Rangers — Tejas
   Cochineal earth rises from the ground up like a West Texas
   sunset; cream sky light touches the very top edge. */
[data-theme="cc-rangers"] body::before {
    background:
        radial-gradient(ellipse 90% 55% at 50% 115%, rgba(157,32,36,0.26)  0%, transparent 62%),
        radial-gradient(ellipse 60% 30% at 50% -5%,  rgba(245,245,220,0.04) 0%, transparent 48%);
}

/* ── Bonus Themes — Atmospheric Layer ─────────────────────── */

/* Savannah Bananas — stadium floodlights blazing hot yellow-white
   overhead, scattered crowd warmth from the lower corner. */
[data-theme="cc-bananas"] body::before {
    background:
        radial-gradient(ellipse 90% 50% at 50% -8%,  rgba(255,224,51,0.30) 0%, transparent 62%),
        radial-gradient(ellipse 40% 35% at 10% 94%,  rgba(255,200,0,0.12)  0%, transparent 44%);
}

/* Montreal Expos (Retro) — Olympic Stadium night game.
   Deep royal blue roof overhead; Expos red logo warmth rising
   from the lower-left like the crowd energy at le Big O. */
[data-theme="retro-expos"] body::before {
    background:
        radial-gradient(ellipse 82% 62% at 50% -5%,  rgba(0,48,135,0.30)  0%, transparent 64%),
        radial-gradient(ellipse 52% 42% at 5%  96%,  rgba(206,17,38,0.16) 0%, transparent 50%);
}

/* Kansas City Monarchs (Negro Leagues, 1920–1965) — classic red & cream pinstripes.
   Warm incandescent light from above like evening at Muehlebach Field;
   deep crimson glow rises from the base as the crowd fills the stands. */
[data-theme="nl-monarchs"] body::before {
    background:
        radial-gradient(ellipse 80% 45% at 50% -5%,   rgba(245,230,210,0.06) 0%, transparent 52%),
        radial-gradient(ellipse 70% 55% at 15%  95%,  rgba(180,20,36,0.18)   0%, transparent 56%),
        radial-gradient(ellipse 60% 50% at 85%  95%,  rgba(180,20,36,0.14)   0%, transparent 52%);
}
/* Vertical pinstripes — classic Monarchs uniform detail */
[data-theme="nl-monarchs"] body::after {
    background: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 26px,
        rgba(180,20,36,0.08) 26px,
        rgba(180,20,36,0.08) 27px
    );
}

/* Rocket City Trash Pandas — rocket engine ignition.
   NASA orange erupts from directly below; the cold void of space
   presses down from above. Most dramatic atmosphere in the set. */
[data-theme="aa-trash-pandas"] body::before {
    background:
        radial-gradient(ellipse 100% 48% at 50% 112%, rgba(232,104,48,0.30) 0%, transparent 62%),
        radial-gradient(ellipse 82% 62% at 50% -5%,   rgba(0,30,100,0.24)  0%, transparent 56%);
}

/* ── Header ───────────────────────────────────────────────── */
header {
    background: var(--bg-header);
    backdrop-filter: var(--blur-lg);
    border-bottom: 1px solid var(--border-default);
    box-shadow: var(--shadow-header);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    display: flex;
    flex-direction: column;
}

.header-inner {
    max-width: var(--max-width);
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--space-8);
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}
/* Push settings + waffle icons to the far right */
.settings-btn { margin-left: auto; }

/* Brand */
.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
}
.brand:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

/* Accent ring on logo signals active theme mode — fades in/out when switching */
[data-theme^="cc-"] .brand-logo-img,
[data-theme="retro-expos"] .brand-logo-img,
[data-theme="nl-monarchs"] .brand-logo-img,
[data-theme="aa-trash-pandas"] .brand-logo-img {
    box-shadow: 0 0 0 2px var(--accent);
}

/* Expos logo has a white background — pad it so it reads on dark surfaces */
[data-theme="retro-expos"] .brand-logo-img {
    background: rgba(255, 255, 255, 0.95);
    padding: 3px;
    box-sizing: border-box;
}

/* Royals CC logo (JPEG) — dark jersey background, no treatment needed */
[data-theme="cc-royals"] .brand-logo-img {
    background: transparent;
}

.brand-icon { display: none; }

.brand-logo-img {
    height: 40px;
    width: 40px;
    border-radius: var(--radius-sm);
    transition: box-shadow var(--transition-base);
    object-fit: contain;
    flex-shrink: 0;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.brand-name {
    font-size: var(--text-xl);
    font-weight: 900;
    color: var(--accent);
    letter-spacing: -0.3px;
}

.brand-sub {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-top: 1px;
}

/* Season selector */
.season-select {
    background: var(--bg-interactive);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 700;
    padding: 0.4rem 0.65rem;
    cursor: pointer;
    transition: border-color var(--transition-fast), color var(--transition-fast);
    appearance: none;
}
.season-select:hover,
.season-select:focus {
    outline: none;
    border-color: var(--border-accent-hov);
    color: var(--accent);
}
.season-select option { background: var(--bg-surface); }

/* Nav tab base — used by waffle panel and mobile bottom nav */
.nav-tab {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    font-family: var(--font-sans);
}
.nav-tab .nav-icon { font-size: 1rem; }
.nav-tab:hover {
    background: var(--bg-interactive);
    color: var(--text-secondary);
    border-color: var(--border-default);
}
.nav-tab.active {
    background: var(--accent-subtle);
    color: var(--accent);
    border-color: var(--accent-border);
    font-weight: 700;
}

/* ── Sub-nav: persistent horizontal nav bar inside header ──── */
.sub-nav {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-8);
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 2px;
    border-top: 1px solid var(--border-subtle, var(--border-default));
    overflow-x: auto;
    scrollbar-width: none;
    min-height: 36px;
}
.sub-nav::-webkit-scrollbar { display: none; }

/* Higher specificity beats .nav-tab base — no !important needed */
.sub-nav .nav-tab {
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
    letter-spacing: 0.01em;
    flex-shrink: 0;
    white-space: nowrap;
}
.sub-nav .nav-tab:hover {
    background: var(--bg-interactive);
    color: var(--text-secondary);
    border-color: var(--border-default);
}
.sub-nav .nav-tab.active {
    background: var(--accent-subtle);
    color: var(--accent);
    border-color: var(--accent-border);
    font-weight: 700;
    box-shadow: inset 0 -2px 0 var(--accent);
}

/* Settings button in header */
.settings-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}
.settings-btn:hover {
    background: var(--bg-interactive);
    border-color: var(--border-default);
}

/* Sub-nav Data / Tools separator */
.sub-nav-divider {
    display: inline-block;
    width: 1px;
    height: 16px;
    background: var(--border-mid);
    margin: 0 0.3rem;
    align-self: center;
    flex-shrink: 0;
}

/* On desktop hide menu button and panel (sub-nav handles everything) */
@media (min-width: 769px) {
    .menu-btn    { display: none !important; }
    .menu-panel  { display: none !important; }
}

/* ── Header ticker — second row, full-width band ─────────────── */
.header-ticker {
    display: flex;
    align-items: stretch;
    width: 100%;
    height: var(--ticker-height);
    overflow: hidden;
    border-top: 1px solid var(--border-default);
    flex-shrink: 0;
}
.header-ticker .ticker {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

/* ── Menu button (mobile only) ──────────────────────────────── */
.menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}
.menu-btn:hover {
    background: var(--bg-interactive);
    color: var(--text-secondary);
    border-color: var(--border-default);
}
.menu-btn--open {
    background: var(--accent-subtle);
    color: var(--accent);
    border-color: var(--accent-border);
}

/* 3×3 dot grid icon */
.menu-icon {
    width: 17px;
    height: 17px;
    position: relative;
    display: block;
}
.menu-icon::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 5px; height: 5px;
    background: currentColor;
    border-radius: 1px;
    box-shadow:
        6px 0  0 currentColor, 12px 0  0 currentColor,
        0 6px  0 currentColor, 6px 6px 0 currentColor, 12px 6px 0 currentColor,
        0 12px 0 currentColor, 6px 12px 0 currentColor, 12px 12px 0 currentColor;
}

/* ── Menu panel (mobile dropdown) ──────────────────────────── */
.menu-panel {
    position: fixed;
    top: calc(var(--header-height) + var(--ticker-height));
    left: 0;
    right: 0;
    z-index: calc(var(--z-sticky) - 1);
    background: var(--bg-waffle-panel);
    border-bottom: 1px solid var(--border-default);
    backdrop-filter: var(--blur-lg);
    box-shadow: var(--shadow-waffle-panel);
    padding: 1rem var(--space-4);
    max-height: calc(100dvh - var(--header-height) - var(--ticker-height));
    overflow-y: auto;
    animation: menuSlideDown 0.18s var(--ease-out) both;
}
.menu-panel[hidden] { display: none; }

@keyframes menuSlideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 4-column tile grid */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

/* Tile — overrides base .nav-tab for vertical layout */
.menu-item {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.875rem 0.5rem;
    min-height: 68px;
    background: var(--bg-interactive);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    white-space: normal;
    text-align: center;
}
.menu-item .nav-icon { display: inline-flex; align-items: center; justify-content: center; }
.menu-item:hover {
    background: var(--bg-interactive-hov);
    border-color: var(--border-mid);
}
.menu-item.active {
    background: var(--accent-subtle);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent-border);
}

.menu-panel-footer {
    margin-top: 0.875rem;
    padding-top: 0.875rem;
    border-top: 1px solid var(--border-default);
}

/* ── View transition ─────────────────────────────────────── */
.view-enter {
    animation: fadeUp 0.2s var(--ease-out) both;
}

/* ── Main Content Area ────────────────────────────────────── */
main {
    max-width: var(--max-width);
    margin: var(--space-8) auto;
    padding: 0 var(--space-8);
}

/* ── Search Bar ───────────────────────────────────────────── */
.search-container {
    background: var(--bg-card);
    backdrop-filter: var(--blur-md);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 1.25rem var(--space-6);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-sm);
}

.search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: var(--space-4);
    display: inline-flex;
    align-items: center;
    color: var(--text-muted);
    pointer-events: none;
}

#searchBox {
    width: 100%;
    padding: 0.875rem 2.75rem;
    font-size: var(--text-md);
    font-family: var(--font-sans);
    background: var(--bg-interactive);
    border: 1.5px solid var(--border-mid);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}
#searchBox:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-interactive-hov);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}
#searchBox::placeholder { color: var(--text-subtle); }

.search-clear {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.25rem var(--space-2);
    border-radius: var(--radius-xs);
    transition: color var(--transition-fast);
}
.search-clear:hover { color: var(--text-secondary); }

.search-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.875rem;
}

#resultCount {
    color: var(--text-muted);
    font-size: var(--text-sm);
    font-weight: 600;
}

/* Favorites filter button */
.fav-filter-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.75rem;
    background: var(--bg-subtle);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    letter-spacing: 0.2px;
}
.fav-filter-btn:hover {
    background: var(--bg-interactive);
    border-color: var(--color-fav-border);
    color: var(--color-fav);
}
.fav-filter-btn.active {
    background: var(--color-fav-subtle);
    border-color: var(--color-fav-border);
    color: var(--color-fav);
}

/* Heart button on player cards */
.fav-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--text-subtle);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.3rem;
    border-radius: var(--radius-sm);
    line-height: 1;
    transition: color var(--transition-fast), transform var(--transition-fast);
    z-index: 2;
}
.fav-btn:hover { color: var(--color-fav); transform: scale(1.2); }
.fav-btn--active { color: var(--color-fav); }

/* Ensure player-card-top is relative so fav-btn can position absolutely */
.player-card-top { position: relative; }

/* View toggle */
.view-toggle { display: flex; gap: 0.25rem; }

.view-toggle-btn {
    padding: 0.35rem 0.65rem;
    background: var(--bg-subtle);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    transition: all var(--transition-fast);
}
.view-toggle-btn:hover { color: var(--text-secondary); background: var(--bg-interactive); }
.view-toggle-btn.active {
    background: var(--accent-subtle);
    border-color: var(--accent-border);
    color: var(--accent);
}

/* View header (non-search views) */
.view-header {
    margin-bottom: var(--space-6);
    padding: 0.6rem var(--space-2);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 600;
}

.breadcrumb-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--bg-interactive);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: 700;
    padding: 0.3rem 0.7rem;
    transition: all var(--transition-fast);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.breadcrumb-link:hover {
    background: var(--bg-interactive-hov);
    border-color: var(--accent-border);
    color: var(--accent-light);
}

.breadcrumb-sep {
    color: var(--text-subtle);
    font-size: 0.9rem;
}

.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 700;
    font-size: var(--text-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
}

.breadcrumb-root {
    color: var(--text-muted);
    font-size: var(--text-sm);
    font-weight: 700;
}

/* ── Player Cards Grid ────────────────────────────────────── */
.players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--card-min-w), 1fr));
    gap: 1rem;
}

.player-card {
    background: var(--bg-card);
    backdrop-filter: var(--blur-md);
    padding: var(--space-4) var(--space-4) var(--space-3);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-card);
    transition: transform var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
    position: relative;
    overflow: hidden;
    animation: fadeUp 0.35s var(--ease-out) both;
    cursor: pointer;
}

.player-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent-light) 5%, transparent) 0%, color-mix(in srgb, var(--accent) 6%, transparent) 100%);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.player-card:hover::before { opacity: 1; }
.player-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-accent);
    box-shadow: var(--shadow-card-hov);
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    position: relative;
    z-index: 1;
}

.player-name {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.1px;
    margin-bottom: 0.15rem;
}

.player-id {
    font-size: var(--text-xs);
    color: var(--text-subtle);
    font-weight: 600;
}

.position-badge {
    background: var(--accent-subtle);
    border: 1px solid var(--accent-border);
    color: var(--accent-light);
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 800;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.player-details {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    position: relative;
    z-index: 1;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 0.6rem;
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-default);
    transition: background var(--transition-fast);
}
.detail-row:hover { background: var(--bg-interactive); }

.detail-label {
    color: var(--text-muted);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
}
.detail-value {
    font-weight: 700;
    color: var(--text-secondary);
    font-size: var(--text-xs);
    font-variant-numeric: tabular-nums;
}

/* ── Stats Table (player list table view) ─────────────────── */
.table-wrapper {
    background: var(--bg-card);
    backdrop-filter: var(--blur-md);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    overflow: hidden;
    overflow-x: auto;
    box-shadow: var(--shadow-card);
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
    white-space: nowrap;
}

.stats-table thead tr {
    background: var(--bg-table-head);
    border-bottom: 1px solid var(--border-default);
}

.stats-table th {
    padding: 0.875rem 1.25rem;
    text-align: left;
    color: var(--text-muted);
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: default;
    user-select: none;
}

.stats-table th.sortable { cursor: pointer; }
.stats-table th.sortable:hover { color: var(--text-secondary); }
.stats-table th.sort-active { color: var(--accent); }
.stats-table th.sort-active::after {
    content: attr(data-dir);
    margin-left: 0.25rem;
    font-size: 0.7rem;
}

.stats-table td {
    padding: 0.8rem 1.25rem;
    border-bottom: 1px solid var(--border-default);
    color: var(--text-secondary);
    vertical-align: middle;
    font-variant-numeric: tabular-nums;
}

.stats-table tbody tr {
    transition: background var(--transition-fast);
    cursor: pointer;
}
.stats-table tbody tr:hover { background: var(--bg-interactive); }
.stats-table tbody tr:last-child td { border-bottom: none; }

.tbl-rank {
    color: var(--text-subtle);
    font-weight: 700;
    font-size: var(--text-xs);
    min-width: 2rem;
}

.tbl-player-name { font-weight: 700; color: var(--text-primary); }
.tbl-player-pos  { font-size: var(--text-xs); color: var(--text-subtle); font-weight: 600; margin-top: 1px; }

.tbl-team-badge {
    display: inline-block;
    background: var(--bg-subtle);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    font-size: var(--text-xs);
    font-weight: 700;
    padding: 0.2rem var(--space-2);
    border-radius: var(--radius-xs);
    letter-spacing: 0.3px;
}

.tbl-stat { font-weight: 700; }
/* Stat columns share one neutral weight; color encodes quality (rank/percentile),
   never stat category — keeps tables broadcast-clean, not rainbow. */
.tbl-pts,
.tbl-reb,
.tbl-ast,
.tbl-pct { color: var(--text-primary); }

.sort-arrow { opacity: 0.7; font-size: 0.7rem; margin-left: 2px; }

/* ── Leaderboard View ─────────────────────────────────────── */
.leaderboards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--card-lb-min-w), 1fr));
    gap: 1.25rem;
}

.leaderboard-panel {
    background: var(--bg-card);
    backdrop-filter: var(--blur-md);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    animation: fadeUp 0.35s var(--ease-out) both;
}
.leaderboard-panel--hot {
    border-color: var(--accent-border);
    box-shadow: var(--shadow-card), 0 0 0 1px var(--accent-glow);
}

.leaderboard-header {
    padding: var(--space-4) 1.25rem;
    border-bottom: 1px solid var(--border-default);
    border-left: 4px solid;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.2);
}

.leaderboard-title {
    font-family: var(--font-display);
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.leaderboard-unit {
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.3px;
}

.leaderboard-header--sortable {
    cursor: pointer;
    user-select: none;
}
.leaderboard-header--sortable:hover { background: rgba(255,255,255,0.04); }
[data-theme="light"] .leaderboard-header--sortable:hover { background: rgba(0,0,0,0.04); }

.leaderboard-sort-arrow {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-left: 0.25rem;
    flex-shrink: 0;
}

.leaderboard-list { display: flex; flex-direction: column; }

.leaderboard-row {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-default);
    transition: background var(--transition-fast);
    cursor: pointer;
}
.leaderboard-row:last-child { border-bottom: none; }
.leaderboard-row:hover { background: var(--bg-interactive); }

.lb-rank {
    width: 22px;
    height: 22px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 800;
    flex-shrink: 0;
    background: var(--bg-subtle);
    color: var(--text-muted);
}
.lb-rank-1 { background: var(--color-pts-subtle);  color: var(--color-pts); }
.lb-rank-2 { background: var(--bg-subtle);         color: var(--text-secondary); }
.lb-rank-3 { background: var(--accent-subtle);     color: var(--color-pct); }

.lb-player { flex: 1; min-width: 0; }
.lb-name   { display: block; font-weight: 700; color: var(--text-primary); font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-team   { font-size: 0.72rem; color: var(--text-subtle); font-weight: 600; margin-top: 1px; }
.lb-value  { font-size: 1.05rem; font-weight: 700; flex-shrink: 0; font-family: var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

/* ── Games Grid ───────────────────────────────────────────── */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--card-game-min-w), 1fr));
    gap: 1.25rem;
}

.game-card {
    background: var(--bg-card);
    backdrop-filter: var(--blur-md);
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-mid);
    box-shadow: var(--shadow-card);
    transition: transform var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
    animation: fadeUp 0.35s var(--ease-out) both;
}
.game-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-accent);
    box-shadow: var(--shadow-card-hov);
}
@keyframes gameCardPulse {
    0%   { box-shadow: 0 0 0 0 var(--accent-border); border-color: var(--accent); }
    60%  { box-shadow: 0 0 0 8px transparent; border-color: var(--accent); }
    100% { box-shadow: none; border-color: var(--border-default); }
}
.game-card--highlight {
    animation: gameCardPulse 1.8s ease-out forwards;
}

/* ── Stat Builder ─────────────────────────────────────────── */
.builder-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
}

.builder-panel,
.saved-stats-panel {
    background: var(--bg-card);
    backdrop-filter: var(--blur-md);
    padding: var(--space-8);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-card);
}

.builder-panel h2,
.saved-stats-panel h2 { color: var(--text-primary); font-weight: 800; }

.builder-panel input {
    background: var(--bg-interactive);
    border: 1.5px solid var(--border-mid);
    color: var(--text-primary);
    font-family: var(--font-sans);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.builder-panel input:focus {
    background: var(--bg-interactive-hov);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
    outline: none;
}
.builder-panel button { transition: all var(--transition-base); }
.builder-panel button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.examples-panel {
    grid-column: 1 / -1;
    background: var(--accent-subtle);
    backdrop-filter: var(--blur-md);
    padding: var(--space-8);
    border-radius: var(--radius-lg);
    border: 1px solid var(--accent-border);
}
.examples-panel h3 { color: var(--accent); }
.examples-panel > div > div {
    background: var(--bg-table-sub);
    border: 1px solid var(--border-default);
}

/* ── Home / Landing Page ──────────────────────────────────── */
.home-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.home-hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-xl);
    padding: 2.75rem 2.5rem 2.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    text-align: center;
    box-shadow: var(--shadow-card);
}

.home-hero-glow {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 90% 70% at 50% -10%, color-mix(in srgb, var(--accent-light) 10%, transparent) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 15% 110%, color-mix(in srgb, var(--accent) 8%, transparent) 0%, transparent 55%),
        radial-gradient(ellipse 50% 40% at 85% 110%, color-mix(in srgb, var(--accent-light) 6%, transparent) 0%, transparent 55%);
    pointer-events: none;
}

.home-hero-content { position: relative; z-index: 1; }

.home-hero-badge {
    display: inline-block;
    background: var(--accent-subtle);
    border: 1px solid var(--accent-border);
    color: var(--accent-light);
    font-size: var(--text-xs);
    font-weight: 800;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding: 0.35rem 1rem;
    border-radius: var(--radius-full);
    margin-bottom: 1.5rem;
    animation: fadeUp 0.4s var(--ease-out) both;
}

.home-hero-title {
    font-size: clamp(3rem, 8vw, 5.5rem);
    font-weight: 900;
    letter-spacing: -3px;
    line-height: 1;
    margin-bottom: 1rem;
    color: var(--text-primary);
    animation: fadeUp 0.45s 0.05s var(--ease-out) both;
}

.home-hero-sub {
    color: var(--text-muted);
    font-size: var(--text-md);
    font-weight: 500;
    max-width: 480px;
    margin: 0 auto 1.5rem;
    line-height: 1.5;
    animation: fadeUp 0.5s 0.1s var(--ease-out) both;
}

/* Animated stats strip inside hero */
.home-stats-strip {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    animation: fadeUp 0.55s 0.18s var(--ease-out) both;
}
.home-stat { text-align: center; }
.home-stat-num {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 900;
    color: var(--accent-light);
    letter-spacing: -1px;
    line-height: 1;
    margin-bottom: 0.3rem;
    font-variant-numeric: tabular-nums;
}
.home-stat-lbl {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Sport entry cards */
.home-sports-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

/* Featured MLB card */
.home-sport-card--featured {
    width: 100%;
    flex-direction: row;
    align-items: center;
    text-align: left;
    gap: 1.25rem;
    padding: 1.75rem 2rem;
    margin-bottom: 1rem;
    border-color: var(--accent-border);
}
.home-sport-card--featured .home-sport-icon { font-size: 3.5rem; flex-shrink: 0; }
.home-sport-card--featured .home-sport-name { font-size: 1.75rem; }
.home-sport-card--featured .home-sport-cta  { margin-top: 0.25rem; }
.home-sport-card--featured .home-sport-desc { max-width: 340px; }

/* ── MLB nav shortcuts ────────────────────────────────────── */
.home-mlb-shortcuts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}
.home-shortcut-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
}
.home-shortcut-btn:hover {
    background: var(--bg-interactive-hov);
    border-color: var(--accent-border);
    color: var(--accent-light);
    transform: translateY(-1px);
}
.home-shortcut-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: var(--accent-subtle);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}
.home-shortcut-btn:hover .home-shortcut-icon {
    background: var(--accent);
    border-color: var(--accent);
}
@media (max-width: 600px) {
    .home-mlb-shortcuts { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
    .home-shortcut-btn { padding: 0.75rem 0.875rem; font-size: var(--text-xs); }
}

/* Dev sports grid (kept for CSS completeness) */
.home-dev-sports { margin-bottom: 1.5rem; }
.home-dev-label  {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.6rem;
}
.home-dev-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}
.home-sport-card--dev {
    padding: 1.25rem 1rem 1rem;
    opacity: 0.72;
}
.home-sport-card--dev .home-sport-icon { font-size: 2rem; }
.home-sport-card--dev .home-sport-name { font-size: 1.1rem; }
.home-sport-card--dev:hover { opacity: 1; }
.home-dev-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: 999px;
    padding: 0.15rem 0.5rem;
}

.home-sport-card {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 2rem 1.25rem 1.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: transform var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
    position: relative;
    overflow: hidden;
    animation: fadeUp 0.4s var(--ease-out) both;
    box-shadow: var(--shadow-card);
}

.home-sport-card::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity var(--transition-base);
}
.home-sport-card--nba::before {
    background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(124,141,240,0.18) 0%, transparent 70%);
}
.home-sport-card--mlb::before {
    background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(251,191,36,0.15) 0%, transparent 70%);
}
.home-sport-card--nfl::before {
    background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(100,160,100,0.18) 0%, transparent 70%);
}
.home-sport-card--nhl::before {
    background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(0,120,200,0.18) 0%, transparent 70%);
}

.home-sport-card:not(.home-sport-card--soon):hover {
    transform: translateY(-5px);
    border-color: var(--border-accent);
    box-shadow: var(--shadow-card-hov);
}
.home-sport-card:not(.home-sport-card--soon):hover::before { opacity: 1; }

.home-sport-card--soon {
    opacity: 0.38;
    cursor: default;
}

.home-sport-icon { font-size: 2.75rem; line-height: 1; margin-bottom: 0.25rem; }
.home-sport-name {
    font-size: var(--text-xl);
    font-weight: 900;
    color: var(--text-primary);
}
.home-sport-desc {
    font-size: var(--text-xs);
    color: var(--text-subtle);
    font-weight: 500;
    line-height: 1.5;
}
.home-sport-cta {
    margin-top: 0.625rem;
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--accent-light);
    transition: color var(--transition-fast), transform var(--transition-fast);
    display: inline-block;
}
.home-sport-card:not(.home-sport-card--soon):hover .home-sport-cta {
    color: var(--accent);
    transform: translateX(3px);
}
.home-sport-badge {
    margin-top: 0.375rem;
    display: inline-block;
    background: var(--bg-subtle);
    border: 1px solid var(--border-default);
    color: var(--text-subtle);
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Recently viewed section */
.home-recents:not(:empty),
.home-starred:not(:empty) { margin-bottom: 1.75rem; }

.home-recents-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.home-recent-chip {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: 20px;
    padding: 0.3rem 0.7rem 0.3rem 0.4rem;
    cursor: pointer;
    font-size: 0.78rem;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}
.home-recent-chip:hover {
    border-color: var(--border-mid);
    background: var(--bg-interactive);
}

.home-recent-badge {
    font-size: 0.58rem;
    font-weight: 800;
    padding: 0.1rem 0.35rem;
    border-radius: 10px;
    letter-spacing: 0.04em;
}
.home-recent-badge--nba { background: color-mix(in srgb, var(--color-pct) 18%, transparent); color: var(--color-pct); }
.home-recent-badge--mlb { background: var(--accent-subtle); color: var(--accent); }

.home-recent-name {
    font-weight: 600;
    color: var(--text-primary);
}
.home-recent-sub {
    color: var(--text-muted);
    font-size: 0.72rem;
}

/* On This Day — trivia game (ANN-005) */
.home-on-this-day { margin-bottom: 1.75rem; }

.otd-card {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    box-shadow: var(--shadow-card);
}

.otd-matchup {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.otd-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
}

.otd-team {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.otd-score {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.otd-sep {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 1rem;
}

.otd-challenge {
    padding-top: 0.65rem;
    border-top: 1px solid var(--border-default);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.otd-prompt {
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0;
}

.otd-clue {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin: 0;
}

.otd-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
}

.otd-choice {
    background: var(--bg-interactive);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 0.55rem 0.75rem;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
    text-align: left;
    font-family: var(--font-sans);
    line-height: 1.3;
}
.otd-choice:hover:not(:disabled) {
    background: var(--bg-interactive-hov);
    border-color: var(--border-mid);
    color: var(--text-primary);
}
.otd-choice--reveal {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--accent);
    border-color: var(--accent-border);
    background: var(--accent-subtle);
}
.otd-choice--reveal:hover:not(:disabled) {
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    border-color: var(--accent);
}
.otd-choice--correct {
    background: var(--color-win-subtle);
    border-color: var(--color-win-border);
    color: var(--color-win);
}
.otd-choice--wrong {
    background: var(--color-loss-subtle);
    border-color: var(--color-loss-border);
    color: var(--color-loss);
}
.otd-choice--dim {
    opacity: 0.35;
}

.otd-revealed {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.otd-result {
    font-size: var(--text-sm);
    font-weight: 600;
    margin: 0;
}
.otd-result--right { color: var(--color-win); }
.otd-result--wrong { color: var(--color-loss); }

.otd-arcade-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.5rem;
    padding: 0;
    background: none;
    border: none;
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--accent);
    cursor: pointer;
    font-family: var(--font-sans);
    transition: color var(--transition-fast), gap var(--transition-fast);
}
.otd-arcade-link:hover {
    color: var(--accent-light);
    gap: 0.6rem;
}

@media (max-width: 480px) {
    .otd-choices { grid-template-columns: 1fr; }
}

/* Today's games section */
.home-today { margin-bottom: 2rem; }

.home-section-hdr {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
}
.home-section-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.01em;
}
.home-section-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.home-today-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 0.65rem;
}

/* ── Home game card (dominant tile format) ─────────────────── */
.home-game-card {
    --hgc-team-color: var(--accent);
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-left: 3px solid var(--hgc-team-color);
    border-radius: var(--radius-lg);
    padding: 0.85rem 0.9rem 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    cursor: pointer;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}
.home-game-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, color-mix(in srgb, var(--hgc-team-color) 8%, transparent) 0%, transparent 55%);
    pointer-events: none;
}
.home-game-card:hover {
    border-color: var(--hgc-team-color);
    box-shadow: var(--shadow-card-hov);
    transform: translateY(-2px);
}
.home-game-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.home-game-card--live {
    border-color: var(--color-live-border);
    border-left-color: var(--color-live);
    box-shadow: var(--shadow-live);
}

/* Team row: [logo] [abbr ——flex——] [score] */
.hgc-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.hgc-team-logo {
    width: 26px;
    height: 26px;
    object-fit: contain;
    flex-shrink: 0;
}
.hgc-logo-ph {
    display: inline-block;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}

.hgc-abbr {
    flex: 1;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}
.hgc-abbr--win { color: var(--text-primary); }

.hgc-score {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-muted);
    font-family: var(--font-mono);
    min-width: 1.6ch;
    text-align: right;
}
.hgc-score--win { color: var(--text-primary); }

.hgc-pitchers {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-align: center;
    padding: 0.2rem 0 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Status footer */
.hgc-card-footer {
    margin-top: 0.2rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-default);
    display: flex;
    justify-content: center;
}

.hgc-pill {
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-full);
}
.hgc-pill--final {
    background: var(--bg-interactive);
    color: var(--text-muted);
}
.hgc-pill--live {
    background: var(--color-live-subtle);
    color: var(--color-live);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.hgc-pill--live::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-live);
    animation: liveDot 1.4s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes liveDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.35; transform: scale(0.65); }
}
.hgc-pill--sched {
    background: var(--accent-subtle);
    color: var(--accent);
}

.home-no-games {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.5rem 0;
    grid-column: 1 / -1;
}

/* ── Home search bar (P2-004) ──────────────────────────────── */
.home-welcome {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.875rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    margin-bottom: 0.25rem;
}
.home-welcome-headline {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-display);
}
.home-welcome-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.home-search-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-lg);
    padding: 0.75rem 1rem;
    cursor: pointer;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    text-align: left;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: var(--shadow-sm);
}
.home-search-bar:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-card-hov);
    color: var(--text-secondary);
}
.home-search-bar-text { flex: 1; }
.home-search-kbd {
    font-size: 0.72rem;
    background: var(--bg-raised);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xs);
    padding: 0.15rem 0.4rem;
    color: var(--text-subtle);
    font-family: var(--font-mono);
    font-weight: 600;
    flex-shrink: 0;
}
@media (max-width: 640px) { .home-search-kbd { display: none; } }

/* ── Home section header "See all" link ────────────────────── */
.home-section-link {
    margin-left: auto;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    white-space: nowrap;
}
.home-section-link:hover { color: var(--accent-light); }

/* ── Hot Right Now strip (P2-002) ──────────────────────────── */
.home-hot-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.65rem;
}
@media (max-width: 700px) { .home-hot-grid { grid-template-columns: repeat(2, 1fr); } }

.home-hot-tile {
    --hot-color: var(--accent);
    --team-color: var(--accent);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-left: 3px solid var(--hot-color);
    border-radius: var(--radius-lg);
    padding: 0.75rem 0.85rem;
    cursor: pointer;
    font-family: var(--font-sans);
    text-align: left;
    transition: border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    position: relative;
}
/* De-AI follow-up: gradient wash removed — flat card, single accent left-border,
   no per-stat color glow (the tiles were the last multicolor home surface). */
.home-hot-tile:hover {
    border-color: var(--hot-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hov);
}
.home-hot-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.home-hot-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
}
.home-hot-initials {
    font-size: 0.7rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.03em;
    position: relative;
    z-index: 1;
}
.home-hot-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.home-hot-label {
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.home-hot-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.home-hot-team {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 500;
}
.home-hot-stat {
    color: var(--accent);
    font-size: 1.15rem;
    font-weight: 900;
    font-family: var(--font-mono);
    letter-spacing: -0.03em;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1;
}
.home-hot-unit {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* ── Tonight's Starting Pitchers ────────────────────────── */
.sp-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 0 0.25rem;
}
.sp-card {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 0.65rem 0.9rem;
}
.sp-vs {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    min-width: 44px;
}
.sp-vs-text {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.sp-time {
    font-size: 0.64rem;
    color: var(--text-subtle);
    white-space: nowrap;
}
.sp-pitcher {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    padding: 0.2rem 0.3rem;
    transition: background 0.12s;
    min-width: 0;
}
.sp-pitcher:hover { background: var(--bg-card-hover); }
.sp-pitcher:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sp-pitcher--home { flex-direction: row-reverse; text-align: right; }
.sp-pitcher--tbd  { cursor: default; justify-content: center; }
.sp-tbd { font-size: 0.72rem; color: var(--text-subtle); font-style: italic; }
.sp-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}
.sp-avatar img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
.sp-avatar-initials { position: relative; z-index: 0; }
.sp-info { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.sp-pitcher--home .sp-info { align-items: flex-end; }
.sp-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sp-team { font-size: 0.68rem; font-weight: 700; }
.sp-statline {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.66rem;
    color: var(--text-muted);
}
.sp-pitcher--home .sp-statline { justify-content: flex-end; }
@media (max-width: 480px) {
    .sp-statline { display: none; }
    .sp-avatar   { width: 32px; height: 32px; font-size: 0.6rem; }
}

/* Feature strip (P2-005) */
.home-features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.home-feature-item {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
    box-shadow: var(--shadow-card);
    animation: fadeUp 0.4s var(--ease-out) both;
    cursor: pointer;
    font-family: var(--font-sans);
    text-align: left;
}
.home-feature-item:hover {
    border-color: var(--accent-border);
    box-shadow: var(--shadow-card-hov);
    transform: translateY(-2px);
}
.home-feature-item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.home-feature-icon {
    width: 32px;
    height: 32px;
    background: var(--accent-subtle);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--accent);
    transition: background var(--transition-fast), border-color var(--transition-fast);
}
.home-feature-item:hover .home-feature-icon {
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    border-color: var(--accent);
}
.home-feature-title {
    font-family: var(--font-display);
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    margin-bottom: 0.25rem;
}
.home-feature-desc {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-weight: 500;
    line-height: 1.4;
}

@media (max-width: 900px) {
    .home-sports-grid { grid-template-columns: repeat(2, 1fr); }
    .home-dev-grid    { grid-template-columns: repeat(2, 1fr); }
    .home-features    { grid-template-columns: repeat(2, 1fr); }
    .home-hot-grid    { grid-template-columns: repeat(2, 1fr); }
    .home-hero { padding: 3rem 1.75rem 2.5rem; }
    .home-sport-card--featured { flex-direction: column; text-align: center; }
    .home-sport-card--featured .home-sport-desc { max-width: 100%; }
    .home-stats-strip { gap: 1.5rem; }
}

@media (max-width: 600px) {
    .home-hero { padding: 2.25rem 1.25rem 2rem; }
    .home-hero-title { letter-spacing: -2px; }
    .home-hero-sub { font-size: var(--text-base); }
    .home-sports-grid { gap: 0.75rem; }
    .home-sport-card { padding: 1.5rem 0.875rem 1.25rem; }
    .home-sport-icon { font-size: 2.25rem; }
    .home-features { gap: 0.75rem; }
    .home-hot-grid  { gap: 0.5rem; }
    .home-dev-grid { grid-template-columns: 1fr; }
    .home-sport-card--featured { padding: 1.5rem 1.25rem; gap: 0.75rem; }
    .home-hot-tile { padding: 0.6rem 0.7rem; }
    .home-hot-stat { font-size: 1rem; }
}

/* ── Player Detail ────────────────────────────────────────── */
.player-detail-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.player-detail-header {
    background: var(--bg-card);
    backdrop-filter: var(--blur-md);
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
}

.back-button {
    background: var(--bg-interactive);
    border: 1px solid var(--border-mid);
    color: var(--text-secondary);
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: var(--text-sm);
    margin-bottom: 1.25rem;
    transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
    font-family: var(--font-sans);
}
.back-button:hover {
    background: var(--bg-interactive-hov);
    color: var(--text-primary);
    transform: translateX(-3px);
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--bg-interactive);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: border-color var(--transition-fast), color var(--transition-fast);
    margin-bottom: 1.25rem;
}
.share-btn:hover { border-color: var(--border-mid); color: var(--text-primary); }
.share-btn svg { flex-shrink: 0; }

/* ── Scouting Report ─────────────────────────────────────────── */
.scout-report {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.scout-hdr {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.9rem;
}
.scout-title {
    font-size: var(--text-base);
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: 0.2px;
}
.scout-meta {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-weight: 600;
}
.scout-warn { color: var(--color-live); }
.scout-col-hdr {
    display: grid;
    grid-template-columns: 7rem 10ch 3.5rem 6rem 1fr;
    gap: 0.5rem;
    padding: 0 0.25rem 0.4rem;
    border-bottom: 1px solid var(--border-default);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-subtle);
    margin-bottom: 0.35rem;
}
.scout-rows { display: flex; flex-direction: column; gap: 0.1rem; margin-bottom: 1rem; }
.scout-metric-row {
    display: grid;
    grid-template-columns: 7rem 10ch 3.5rem 6rem 1fr;
    gap: 0.5rem;
    align-items: center;
    padding: 0.45rem 0.25rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}
.scout-metric-row:hover { background: var(--bg-interactive); }
.scout-cat {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
}
.scout-bar {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: -1px;
    white-space: nowrap;
}
.scout-bar--na    { color: var(--text-subtle); }
.scout-bar--elite { color: var(--color-tier-elite); }
.scout-bar--good  { color: var(--color-tier-good); }
.scout-bar--avg   { color: var(--text-muted); }
.scout-bar--weak  { color: var(--color-live); }
.scout-bar--poor  { color: var(--color-loss); }
.scout-pct {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    text-align: right;
}
.scout-grade {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.4px;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-full);
    text-align: center;
    white-space: nowrap;
}
.scout-grade--elite { background: var(--color-tier-elite-subtle); color: var(--color-tier-elite); }
.scout-grade--good  { background: var(--color-tier-good-subtle);  color: var(--color-tier-good); }
.scout-grade--above { background: var(--color-tier-avg-subtle);   color: var(--color-tier-avg); }
.scout-grade--avg   { background: var(--bg-interactive);           color: var(--text-muted); }
.scout-grade--below { background: var(--color-tier-below-subtle); color: var(--color-tier-below); }
.scout-grade--poor  { background: var(--color-tier-poor-subtle);  color: var(--color-tier-poor); }
.scout-detail {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.scout-summary {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.55;
    border-left: 3px solid var(--accent-border);
    padding-left: 0.75rem;
    margin-bottom: 0.6rem;
}
.scout-footnote {
    font-size: 0.68rem;
    color: var(--text-subtle);
    margin: 0;
}
.scout-loading {
    padding: 1.25rem;
    color: var(--text-muted);
    font-size: var(--text-sm);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
@media (max-width: 600px) {
    .scout-col-hdr,
    .scout-metric-row { grid-template-columns: 6rem 8ch 3rem 5.5rem 1fr; gap: 0.35rem; }
    .scout-detail { display: none; }
}

.player-detail-info {
    display: flex;
    align-items: center;
    gap: var(--space-6);
}

.player-detail-avatar {
    width: 100px;
    height: 100px;
    background: var(--accent-subtle);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--accent-border);
    flex-shrink: 0;
}

.player-detail-name {
    font-size: var(--text-3xl);
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
    letter-spacing: -0.5px;
}

.player-detail-meta {
    color: var(--text-muted);
    font-size: var(--text-base);
    margin-bottom: 0.2rem;
    font-weight: 500;
}

.player-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
}

.stats-card {
    background: var(--bg-card);
    backdrop-filter: var(--blur-md);
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-4);
}

.stat-item {
    text-align: center;
    padding: var(--space-4);
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
}

.stat-value {
    font-size: var(--text-3xl);
    font-weight: 900;
    margin-bottom: 0.4rem;
    line-height: 1;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.stat-label {
    color: var(--text-muted);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.recent-games-list { display: flex; flex-direction: column; gap: 0.75rem; }

.recent-game-item {
    background: var(--bg-subtle);
    padding: 0.875rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-default);
}

.recent-game-date { color: var(--text-subtle); font-size: 0.78rem; margin-bottom: 0.4rem; font-weight: 600; }
.recent-game-matchup { color: var(--text-primary); font-weight: 700; margin-bottom: 0.4rem; display: flex; justify-content: space-between; font-size: 0.9rem; }

.shooting-stats-grid { display: flex; flex-direction: column; gap: 1.25rem; }
.shooting-stat-item { background: var(--bg-subtle); padding: var(--space-4); border-radius: var(--radius-sm); border: 1px solid var(--border-default); }
.shooting-stat-header { display: flex; justify-content: space-between; margin-bottom: 0.625rem; font-size: var(--text-sm); }
.shooting-stat-bar { width: 100%; height: 6px; background: var(--bg-interactive); border-radius: var(--radius-xs); overflow: hidden; }
.shooting-stat-fill { height: 100%; border-radius: var(--radius-xs); transition: width 0.5s var(--ease-out); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
    .header-inner { padding: 0 var(--space-4); gap: var(--space-2); }
    .brand-sub { display: none; }
    .sport-switcher .sport-btn { font-size: var(--text-xs); padding: 0.35rem 0.5rem; }
    .player-detail-grid { grid-template-columns: 1fr; }
    .builder-container  { grid-template-columns: 1fr; }
    .games-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    main { padding: 0 var(--space-4); margin: var(--space-4) auto; }
    .player-detail-info { flex-direction: column; text-align: center; }
    .player-detail-name { font-size: var(--text-2xl); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .leaderboards-grid { grid-template-columns: 1fr; }
    .search-meta { flex-direction: column; align-items: flex-start; gap: var(--space-2); }
}

/* ── Bottom Navigation (mobile only) ─────────────────────── */
.bottom-nav       { display: none; }
.bottom-nav-label { display: none; }

@media (max-width: 768px) {
    /* Sub-nav hidden on mobile — menu button + bottom nav handle navigation */
    .sub-nav { display: none; }
    /* Search button: icon-only on mobile */
    .search-global-btn { flex: none; width: 36px; height: 36px; margin: 0; padding: 0; border: none; }
    /* Menu grid: 2 columns on small screens */
    .menu-grid { grid-template-columns: repeat(2, 1fr); }
    .menu-item { min-height: 58px; padding: 0.65rem 0.35rem; font-size: 0.72rem; }
    .menu-item .nav-icon { display: inline-flex; align-items: center; justify-content: center; }
    .menu-panel { padding: 0.875rem var(--space-4); }

    .bottom-nav {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: var(--z-nav);
        background: var(--bg-mobile-nav);
        backdrop-filter: var(--blur-lg);
        border-top: 1px solid var(--border-default);
        box-shadow: var(--shadow-mobile-nav);
        padding: 0 0 env(safe-area-inset-bottom, 0);
        overflow: hidden;
    }

    .bottom-nav .nav-tab {
        flex-direction: column;
        gap: 0.2rem;
        padding: 0.5rem 0.25rem 0.6rem;
        border-radius: 0;
        border: none;
        font-size: 0.62rem;
        letter-spacing: 0.15px;
        text-transform: uppercase;
        font-weight: 700;
        color: var(--text-muted);
        overflow: hidden;
        min-width: 0;
    }
    .bottom-nav .nav-tab.active {
        color: var(--accent-light);
        background: transparent;
    }
    .bottom-nav .nav-icon { display: inline-flex; align-items: center; justify-content: center; }
    .bottom-nav-label { display: block; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: clip; }

    main { padding-bottom: 5rem; }
}

/* ── Global Search Button (header) ───────────────────────────── */

.search-global-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}
.search-global-btn:hover {
    background: var(--bg-interactive);
    color: var(--text-secondary);
    border-color: var(--border-default);
}

/* ── Global Search Overlay ────────────────────────────────────── */

.search-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 8, 18, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: var(--z-modal, 900);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: clamp(4rem, 12vh, 8rem);
    animation: fadeIn 0.12s var(--ease-out) both;
}
.search-overlay[hidden] { display: none; }

.search-modal {
    width: min(620px, calc(100vw - 2rem));
    background: var(--bg-card);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-lg, 12px);
    box-shadow: 0 24px 64px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideDown 0.15s var(--ease-out) both;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.search-modal-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-default);
}
.search-modal-icon {
    color: var(--text-muted);
    flex-shrink: 0;
}
.search-modal-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}
.search-modal-input::placeholder { color: var(--text-muted); font-weight: 400; }
.search-modal-close {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    line-height: 1;
    transition: all var(--transition-fast);
}
.search-modal-close:hover { background: var(--bg-interactive); color: var(--text-secondary); }

.search-modal-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem 0;
}
.search-modal-results::-webkit-scrollbar { width: 4px; }
.search-modal-results::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 2px; }

.search-empty {
    padding: 2rem 1.25rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}
.search-empty strong { color: var(--text-secondary); }

.search-group { padding: 0.25rem 0; }
.search-group + .search-group { border-top: 1px solid var(--border-default); }
.search-group-label {
    padding: 0.5rem 1rem 0.25rem;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.6rem 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background var(--transition-fast);
}
.search-result-item:hover,
.search-result-item--active { background: var(--bg-interactive); }

.search-result-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-subtle);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    flex-shrink: 0;
}
.search-result-avatar--team {
    background: var(--bg-interactive);
    color: var(--text-primary);
    font-size: 1rem;
    border-radius: var(--radius-sm);
}
.search-result-avatar--img { position: relative; overflow: hidden; }
.search-avatar-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
}
.search-result-avatar--img img { position: relative; z-index: 1; }
.search-result-name {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-result-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    margin-right: auto;
}
.search-badge {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 0.15em 0.5em;
    border-radius: 999px;
    flex-shrink: 0;
}
.search-badge--nba {
    background: var(--color-chip-bg);
    color: var(--color-chip);
}
.search-badge--mlb {
    background: var(--accent-subtle);
    color: var(--accent-light);
}
.search-badge--nfl {
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
}

.search-modal-footer {
    display: flex;
    gap: 1.25rem;
    padding: 0.625rem 1rem;
    border-top: 1px solid var(--border-default);
    font-size: 0.7rem;
    color: var(--text-muted);
}
.search-modal-footer kbd {
    display: inline-block;
    background: var(--bg-interactive);
    border: 1px solid var(--border-mid);
    border-radius: 3px;
    padding: 0.1em 0.35em;
    font-family: var(--font-sans);
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-right: 0.25em;
}

@media (max-width: 768px) {
    .search-overlay { padding-top: 1rem; align-items: flex-start; }
    .search-modal { width: 100vw; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
    .search-modal-results { max-height: 60vh; }
}

/* ── Light theme overrides for gradient/glow elements ─────────
   body::before uses raw rgba so we swap it here.
   ─────────────────────────────────────────────────────────── */
[data-theme="light"] body::before {
    background:
        radial-gradient(ellipse 70% 50% at 15% 15%, rgba(91,112,224,0.07) 0%, transparent 65%),
        radial-gradient(ellipse 50% 70% at 85% 85%, rgba(100,80,180,0.05) 0%, transparent 65%);
}

/* Theme toggle button — placed inside waffle panel */
.theme-toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--bg-interactive);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
}
.theme-toggle-btn:hover {
    background: var(--bg-interactive-hov);
    color: var(--text-primary);
    border-color: var(--border-mid);
}
.theme-toggle-icon { display: inline-flex; align-items: center; }

.waffle-panel-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--border-default);
    margin-top: 0.25rem;
}

/* Universal section (Arcade — not sport-specific) */
.waffle-universal-section {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-default);
}
.waffle-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 0.25rem 0.4rem;
}

/* ── Back to top button ──────────────────────────────────────── */
.back-to-top {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: calc(var(--z-nav) - 1);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--bg-interactive);
    border: 1px solid var(--border-mid);
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-card);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.2s, transform 0.2s, background var(--transition-fast);
}
.back-to-top:hover { background: var(--bg-interactive-hov); color: var(--accent-light); }
.back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
@media (max-width: 768px) {
    .back-to-top { bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom, 0px) + 0.75rem); right: 0.75rem; }
}

/* ── Accessibility: global focus rings ───────────────────────── */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 3px;
}
/* Remove outline for mouse users but keep for keyboard */
button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
[tabindex]:focus:not(:focus-visible) {
    outline: none;
}

/* ── Stat Glossary Tooltips ──────────────────────────────────── */
.stat-tip {
    cursor: help;
    border-bottom: 1px dashed var(--border-mid);
    display: inline-block;
    position: relative;
}
.stat-tip::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-surface);
    border: 1px solid var(--border-mid);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.45;
    padding: 0.4rem 0.65rem;
    border-radius: var(--radius-sm);
    white-space: normal;
    max-width: 220px;
    width: max-content;
    text-align: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.35);
    z-index: 800;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
}
.stat-tip:hover::after,
.stat-tip:focus-visible::after {
    opacity: 1;
}

/* ── CSV Export Button ───────────────────────────────────────── */
.lb-export-btn {
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    padding: 0.2rem 0.45rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}
.lb-export-btn:hover {
    background: var(--bg-interactive);
    border-color: var(--border-mid);
    color: var(--accent);
}

/* ── Fantasy Points Badge (leaderboard overlay) ──────────────── */
.lb-fp-badge {
    display: inline-block;
    background: var(--color-win-subtle);
    border: 1px solid var(--color-win-border);
    color: var(--color-win);
    font-size: 0.62rem;
    font-weight: 700;
    padding: 0.1rem 0.35rem;
    border-radius: 999px;
    margin-left: 0.4rem;
    letter-spacing: 0.2px;
    vertical-align: middle;
}

/* ── Home stat labels: sentence case (reduced all-caps) ─────── */
.home-stat-lbl {
    text-transform: none;
    letter-spacing: 0;
    font-size: var(--text-sm);
}

/* ── Game filter pills ────────────────────────────────────────── */
.home-filter-bar {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.home-filter-pill {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-default);
    background: var(--bg-subtle);
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    letter-spacing: 0.2px;
    white-space: nowrap;
}
.home-filter-pill:hover {
    background: var(--bg-interactive);
    border-color: var(--border-mid);
    color: var(--text-secondary);
}
.home-filter-pill.active {
    background: var(--accent-subtle);
    border-color: var(--accent-border);
    color: var(--accent);
}
.home-filter-pill--live.active {
    background: var(--color-live-subtle);
    border-color: var(--color-live-border);
    color: var(--color-live);
}

/* Live count badge in section header */
.home-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--color-live-subtle);
    border: 1px solid var(--color-live-border);
    color: var(--color-live);
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-full);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.home-live-badge::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--color-live);
    animation: liveDot 1.4s ease-in-out infinite;
}

/* ── Consistent home game card height ────────────────────────── */
.home-game-card {
    min-height: 102px;
}

/* ── Search button expands between brand and icons on desktop ── */
@media (min-width: 769px) {
    .search-global-btn {
        flex: 1;
        max-width: 380px;
        height: 36px;
        border-radius: var(--radius-md);
        justify-content: flex-start;
        padding: 0 0.875rem;
        gap: 0.5rem;
        border: 1px solid var(--border-default);
        color: var(--text-muted);
        font-family: var(--font-sans);
        font-size: var(--text-sm);
        font-weight: 500;
    }
    .search-global-btn::after {
        content: 'Search players & teams…';
        white-space: nowrap;
        color: var(--text-subtle);
        font-weight: 400;
    }
    .search-global-btn:hover {
        border-color: var(--border-mid);
        background: var(--bg-interactive);
        color: var(--text-secondary);
    }
}

/* ── Desktop breakpoint: wider home games grid ───────────────── */
@media (min-width: 1280px) {
    .home-today-grid {
        grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    }
    .home-features {
        grid-template-columns: repeat(4, 1fr);
    }
}


/* ── Print Layout (ANN-004) ──────────────────────────────────── */
/* Optimised for announcer game-prep sheets and booth reference cards */

@media print {
    /* Hide chrome, nav, interactive elements */
    .app-header,
    .app-nav,
    .mobile-nav,
    #scoreTicker,
    .ticker-container,
    .back-button,
    .share-btn,
    .per36-btn,
    .compare-select,
    #pd-compare-chart-wrap,
    .builder-panel,
    .saved-stats-panel,
    .home-page,
    .arcade-grid,
    .player-notes-card,
    button[onclick*="backToPlayers"],
    button[onclick*="enterSport"],
    .lb-export-btn,
    .career-trend-controls,
    .career-trend-section > .chart-wrap,
    .no-print,
    .prep-game-list,
    .prep-page-sub { display: none !important; }

    /* Page setup */
    @page { size: letter portrait; margin: 1.5cm; }

    body {
        background: #fff !important;
        color: #111 !important;
        font-size: 11pt;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Remove shadows and blur */
    *, *::before, *::after {
        box-shadow: none !important;
        text-shadow: none !important;
        animation: none !important;
        transition: none !important;
    }

    /* Layout: single column */
    .player-detail-container,
    .player-detail-grid { display: block !important; }

    /* Cards */
    .stats-card {
        background: #fff !important;
        border: 1px solid #ccc !important;
        border-radius: 4px !important;
        margin-bottom: 0.6cm !important;
        padding: 0.4cm !important;
        page-break-inside: avoid;
    }

    /* Player hero */
    .player-detail-header {
        background: #f8f9fb !important;
        border-top-color: #555 !important;
        border-radius: 4px !important;
        padding: 0.5cm !important;
        margin-bottom: 0.5cm !important;
    }
    .player-detail-name { color: #111 !important; font-size: 18pt !important; }
    .player-detail-meta,
    .player-hero-pos,
    .bio-label,
    .bio-value { color: #333 !important; }

    /* Stat values */
    .stat-value,
    .career-season { color: #111 !important; }
    .stat-label,
    .stat-rank,
    .career-gp { color: #555 !important; }

    /* Tables */
    .career-table,
    .recent-games-list { font-size: 9pt !important; }
    .career-table thead th { background: #eee !important; color: #111 !important; }

    /* Charts — hide interactive charts except career table */
    .chart-wrap,
    .charts-duo { display: none !important; }

    /* Shooting card — keep bars */
    .shooting-stat-fill { print-color-adjust: exact; -webkit-print-color-adjust: exact; }

    /* Force page breaks between hero and stats */
    .player-detail-header { page-break-after: avoid; }
    .stats-card:last-child  { page-break-after: auto; }
}

/* ── Settings Panel ──────────────────────────────────────────
   Right-side drawer for app settings. Opened by the gear icon
   in the header. Uses the same overlay pattern as search modal.
   ─────────────────────────────────────────────────────────── */
.settings-panel {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    justify-content: flex-end;
    pointer-events: none;
}
.settings-panel:not([hidden]) { pointer-events: auto; }

.settings-panel-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    transition: opacity var(--transition-base);
    backdrop-filter: blur(2px);
}
.settings-panel--open .settings-panel-backdrop { opacity: 1; }

.settings-panel-drawer {
    position: relative;
    width: 340px;
    max-width: 100vw;
    height: 100%;
    background: var(--bg-surface);
    border-left: 1px solid var(--border-default);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform var(--transition-base);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.settings-panel--open .settings-panel-drawer { transform: translateX(0); }

.settings-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-default);
    flex-shrink: 0;
}
.settings-panel-title {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.settings-panel-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-xs);
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--transition-fast);
}
.settings-panel-close:hover {
    background: var(--bg-interactive);
    border-color: var(--border-default);
    color: var(--text-primary);
}

.settings-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

/* ── Settings sections ── */
.settings-section-label {
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 var(--space-3);
}

/* ── Settings subsection label ── */
.settings-subsection-label {
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-subtle);
    margin: var(--space-4) 0 var(--space-2);
}

/* ── Theme swatch grid ── */
.theme-swatch-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
}
.theme-swatch-grid--cc {
    grid-template-columns: repeat(4, 1fr);
}
.theme-swatch {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
    padding: var(--space-2);
    background: var(--bg-subtle);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
    font-family: var(--font-sans);
}
.theme-swatch:hover {
    background: var(--bg-interactive);
    border-color: var(--border-mid);
}
.theme-swatch[aria-pressed="true"] {
    border-color: var(--border-accent-hov);
    background: var(--accent-subtle);
}

/* Swatch color preview block */
.swatch-preview {
    width: 100%;
    height: 44px;
    border-radius: var(--radius-xs);
    background: var(--sw-bg, #060c18);
    position: relative;
    overflow: hidden;
}
.swatch-preview--logo {
    display: flex;
    align-items: center;
    justify-content: center;
}
.swatch-preview--logo img {
    max-width: 80%;
    max-height: 32px;
    object-fit: contain;
    position: relative;
    z-index: 1;
}
/* Accent stripe at the bottom of each preview */
.swatch-preview::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--sw-accent, #ff8100);
}

/* Per-swatch preview colors — base themes use flat tokens */
.theme-swatch[data-theme-set="dark"]  { --sw-bg: #060c18; --sw-accent: #ff8100; }
.theme-swatch[data-theme-set="light"] { --sw-bg: #f0f4f9; --sw-accent: #d96a00; }

/* City Connect swatches: gradient previews that communicate each
   team's visual identity rather than just a flat dark box. */

/* Abbreviation overlay — gradient gives mood, text gives identity, stripe gives palette */
.swatch-abbr {
    position: absolute;
    inset: 0 0 9px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.07em;
    color: rgba(255, 255, 255, 0.88);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.65);
    pointer-events: none;
    user-select: none;
}
/* Per-team accent color on the abbreviation */
.theme-swatch[data-theme-set="cc-braves"]      .swatch-abbr { color: #7CB9E8; }
.theme-swatch[data-theme-set="cc-orioles"]     .swatch-abbr { color: #DF4601; }
.theme-swatch[data-theme-set="cc-brewers"]     .swatch-abbr { color: #FF7A00; }
.theme-swatch[data-theme-set="cc-pirates"]     .swatch-abbr { color: #FDB827; }
.theme-swatch[data-theme-set="cc-padres"]      .swatch-abbr { color: #00B5B8; }
.theme-swatch[data-theme-set="cc-rangers"]     .swatch-abbr { color: #F5F5DC; }
.theme-swatch[data-theme-set="cc-bananas"]     .swatch-abbr { color: #FFE033; }
.theme-swatch[data-theme-set="retro-expos"]    .swatch-abbr { color: #CE1126; }
.theme-swatch[data-theme-set="nl-monarchs"]    .swatch-abbr { color: #B41428; }
.theme-swatch[data-theme-set="aa-trash-pandas"].swatch-abbr { color: #E86830; }

/* Uniform stripe height for all CC / tribute swatches */
.theme-swatch[data-theme-set^="cc-"] .swatch-preview::after,
.theme-swatch[data-theme-set^="retro-"] .swatch-preview::after,
.theme-swatch[data-theme-set^="nl-"] .swatch-preview::after,
.theme-swatch[data-theme-set^="aa-"] .swatch-preview::after { height: 9px; }

/* Atlanta Braves — powder blue from top, dark base below. Commit to the color. */
.theme-swatch[data-theme-set="cc-braves"] .swatch-preview {
    background: linear-gradient(180deg, rgba(124,185,232,0.70) 0%, rgba(124,185,232,0.15) 55%, #0e1929 100%);
}
.theme-swatch[data-theme-set="cc-braves"] .swatch-preview::after {
    background: linear-gradient(90deg, #7CB9E8 55%, #CE1141 100%);
    height: 5px;
}

/* Baltimore Orioles — Camden green descending, orange warmth at base */
.theme-swatch[data-theme-set="cc-orioles"] .swatch-preview {
    background: linear-gradient(180deg, rgba(0,90,60,0.32) 0%, #0a1a11 55%);
}
.theme-swatch[data-theme-set="cc-orioles"] .swatch-preview::after {
    background: linear-gradient(90deg, #005A3C 0%, #DF4601 100%);
    height: 5px;
}

/* Cincinnati Reds — monochromatic crimson, all in */
.theme-swatch[data-theme-set="cc-reds"] .swatch-preview {
    background: linear-gradient(180deg, #1c0007 0%, rgba(165,0,21,0.18) 100%);
}
.theme-swatch[data-theme-set="cc-reds"] .swatch-preview::after {
    background: #E8203A;
    height: 5px;
}

/* Kansas City Royals — Forever Fountains: fuchsia-to-royal-blue, purple */
.theme-swatch[data-theme-set="cc-royals"] .swatch-preview {
    background: linear-gradient(135deg, #06011a 0%, #160848 50%, #004687 100%);
}
.theme-swatch[data-theme-set="cc-royals"] .swatch-preview::after {
    background: linear-gradient(90deg, #FF00AF 0%, #7851A9 50%, #004687 100%);
    height: 6px;
}
.theme-swatch[data-theme-set="cc-royals"] .swatch-preview img {
    mix-blend-mode: lighten;
}

/* Milwaukee Brewers — Wild Mango sunset bleeding into Great Lakes blue */
.theme-swatch[data-theme-set="cc-brewers"] .swatch-preview {
    background: linear-gradient(180deg, rgba(255,122,0,0.80) 0%, rgba(255,122,0,0.20) 38%, rgba(35,107,142,0.70) 70%, #0b2a3e 100%);
}
.theme-swatch[data-theme-set="cc-brewers"] .swatch-preview::after {
    background: linear-gradient(90deg, #FF7A00 0%, #236B8E 100%);
    height: 5px;
}

/* Pittsburgh Pirates — gold crown from top, Steel City dark below. Make the gold earn its place. */
.theme-swatch[data-theme-set="cc-pirates"] .swatch-preview {
    background: linear-gradient(180deg, rgba(253,184,39,0.55) 0%, rgba(253,184,39,0.08) 50%, #1c1a10 100%);
}
.theme-swatch[data-theme-set="cc-pirates"] .swatch-preview::after {
    background: #FDB827;
    height: 5px;
}

/* San Diego Padres — Día de los Muertos: aqua Pacific left, marigold altar right, obsidian center */
.theme-swatch[data-theme-set="cc-padres"] .swatch-preview {
    background:
        radial-gradient(ellipse 75% 65% at 5%  0%,   rgba(0,181,184,0.75) 0%, transparent 55%),
        radial-gradient(ellipse 65% 55% at 95% 100%, rgba(252,161,32,0.70) 0%, transparent 55%),
        radial-gradient(ellipse 55% 45% at 50% 55%,  rgba(200,43,79,0.40) 0%, transparent 60%),
        #0c0e13;
}
.theme-swatch[data-theme-set="cc-padres"] .swatch-preview::after {
    background: linear-gradient(90deg, #00B5B8 0%, #C82B4F 50%, #FCA120 100%);
    height: 5px;
}

/* Texas Rangers — cochineal earth rising, cream sky above (red lifted for 4-col visibility) */
.theme-swatch[data-theme-set="cc-rangers"] .swatch-preview {
    background: linear-gradient(180deg, rgba(245,245,220,0.06) 0%, #1a0507 20%, rgba(157,32,36,0.42) 100%);
}
.theme-swatch[data-theme-set="cc-rangers"] .swatch-preview::after {
    background: linear-gradient(90deg, #C23035 0%, rgba(245,245,220,0.65) 100%);
    height: 5px;
}

/* Savannah Bananas — actual logo on near-black */
.theme-swatch[data-theme-set="cc-bananas"] .swatch-preview {
    background: #191600;
}
.theme-swatch[data-theme-set="cc-bananas"] .swatch-preview::after {
    background: #FFE033;
    height: 5px;
}

/* Montreal Expos — actual logo on deep navy */
.theme-swatch[data-theme-set="retro-expos"] .swatch-preview {
    background: #04071e;
}
.theme-swatch[data-theme-set="retro-expos"] .swatch-preview::after {
    background: linear-gradient(90deg, #CE1126 0%, #003087 50%, #FFFFFF 100%);
    height: 5px;
}
.theme-swatch[data-theme-set="retro-expos"] .swatch-preview img {
    mix-blend-mode: lighten;
}

/* Kansas City Monarchs — classic red/cream on near-black */
.theme-swatch[data-theme-set="nl-monarchs"] .swatch-preview {
    background: #0a0204;
}
.theme-swatch[data-theme-set="nl-monarchs"] .swatch-preview::after {
    background: linear-gradient(90deg, #B41428 0%, #f5ece0 50%, #B41428 100%);
    height: 5px;
}

/* Rocket City Trash Pandas — actual mascot logo on near-void */
.theme-swatch[data-theme-set="aa-trash-pandas"] .swatch-preview {
    background: #02030e;
}
.theme-swatch[data-theme-set="aa-trash-pandas"] .swatch-preview::after {
    background: linear-gradient(90deg, #002F6C 0%, #E86830 100%);
    height: 5px;
}

/* Trash Pandas logo has white background — pad it for dark surface display */
[data-theme="aa-trash-pandas"] .brand-logo-img {
    background: rgba(255, 255, 255, 0.95);
    padding: 3px;
    box-sizing: border-box;
}

/* Light theme needs a visible inset border so it reads against a dark drawer */
.theme-swatch[data-theme-set="light"] .swatch-preview {
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12);
}

.swatch-label {
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.theme-swatch[aria-pressed="true"] .swatch-label { color: var(--text-primary); }

@media (max-width: 480px) {
    .settings-panel-drawer { width: 100vw; }
}


/* ── F5: Add-to-Home-Screen strip ─────────────────────────────
   position: fixed is intentional (floating prompt over content,
   same documented exception class as .bottom-nav / .menu-panel) */
.a2hs-strip {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    display: flex;
    align-items: center;
    gap: 0.625rem;
    background: var(--bg-raised);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    padding: 0.5rem 0.625rem 0.5rem 0.75rem;
    z-index: 900;
    max-width: calc(100vw - 2rem);
}
.a2hs-icon { width: 24px; height: 24px; border-radius: 6px; flex: 0 0 auto; }
.a2hs-text { font-size: 0.8125rem; color: var(--text-primary); }
.a2hs-install { font-size: 0.75rem; padding: 0.35rem 0.75rem; }
.a2hs-dismiss {
    background: none;
    border: none;
    color: var(--text-subtle);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem;
}
.a2hs-dismiss:hover { color: var(--text-secondary); }

@media (max-width: 768px) {
    .a2hs-strip { bottom: calc(64px + env(safe-area-inset-bottom, 0px) + 0.75rem); }
}

/* ── Home footer — data attribution ─────────────────────────── */
.home-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    margin-top: 2.5rem;
    padding: 1rem 0.25rem calc(1rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border-default);
    font-size: 0.6875rem;
    color: var(--text-subtle);
    line-height: 1.5;
}

/* ── Sport switcher (header MLB / NFL) ─────────────────────── */
.sport-switch {
    display: inline-flex;
    gap: 2px;
    padding: 2px;
    background: var(--bg-raised);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-full);
    margin-left: var(--space-3);
    flex-shrink: 0;
}
.sport-switch-btn {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 3px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.sport-switch-btn--active { background: var(--accent); color: var(--text-on-accent); }
.sport-switch-btn:hover:not(.sport-switch-btn--active) { color: var(--text-primary); }
@media (max-width: 480px) {
    .sport-switch { margin-left: var(--space-2); }
    .sport-switch-btn { padding: 3px 9px; }
}

/* ── NFL offseason state ───────────────────────────────────── */
.nfl-offseason {
    max-width: 460px;
    margin: 4rem auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}
.nfl-offseason-glyph { color: var(--text-subtle); }
.nfl-offseason-title { font-family: var(--font-display); font-size: 1.4rem; color: var(--text-primary); margin: 0; }
.nfl-offseason-text { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.5; margin: 0; }
.nfl-offseason-actions { display: flex; gap: 0.6rem; margin-top: 0.5rem; flex-wrap: wrap; justify-content: center; }
.nfl-offseason-btn {
    font-size: 0.8rem; font-weight: 600; padding: 0.5rem 1rem;
    border-radius: var(--radius-md); border: 1px solid var(--accent);
    background: var(--accent); color: var(--text-on-accent); cursor: pointer;
}
.nfl-offseason-btn--ghost { background: transparent; color: var(--accent); }

/* ── NFL Mock Draft simulator ──────────────────────────────── */
.md-wrap { max-width: 1100px; margin: 0 auto; }
.md-setup { max-width: 520px; margin: 3rem auto; text-align: center; display: flex; flex-direction: column; gap: 1rem; }
.md-title { font-family: var(--font-display); font-size: 2rem; color: var(--text-primary); margin: 0; }
.md-sub { color: var(--text-secondary); margin: 0; }
.md-setup-row { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; }
.md-setup-row label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.md-setup-row select { font-size: 0.9rem; padding: 0.4rem 0.6rem; border-radius: var(--radius-md); border: 1px solid var(--border-mid); background: var(--bg-raised); color: var(--text-primary); }
.md-btn { font-size: 0.85rem; font-weight: 700; padding: 0.55rem 1.2rem; border-radius: var(--radius-md); border: 1px solid var(--border-mid); background: var(--bg-raised); color: var(--text-primary); cursor: pointer; }
.md-btn--primary { background: var(--accent); border-color: var(--accent); color: var(--text-on-accent); align-self: center; }
.md-btn--ghost { background: transparent; }
.md-note { color: var(--text-subtle); font-size: 0.75rem; margin: 0; }
.md-loading, .md-empty { text-align: center; padding: 3rem; color: var(--text-muted); }

.md-draft-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.md-onclock { display: block; font-family: var(--font-display); font-size: 1.15rem; color: var(--accent); font-weight: 700; }
.md-pickno { font-size: 0.8rem; color: var(--text-muted); }
.md-draft-grid { display: grid; grid-template-columns: 1fr 300px; gap: 1rem; align-items: start; }
.md-available { background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-lg); overflow: hidden; }
.md-avail-controls { padding: 0.6rem; border-bottom: 1px solid var(--border-default); display: flex; flex-direction: column; gap: 0.5rem; }
.md-search { width: 100%; padding: 0.45rem 0.7rem; border-radius: var(--radius-md); border: 1px solid var(--border-mid); background: var(--bg-raised); color: var(--text-primary); }
.md-pos-filters { display: flex; gap: 4px; flex-wrap: wrap; }
.md-pos-btn { font-size: 0.7rem; font-weight: 700; padding: 3px 10px; border-radius: var(--radius-full); border: 1px solid var(--border-mid); background: transparent; color: var(--text-secondary); cursor: pointer; }
.md-pos-btn--on { background: var(--accent); border-color: var(--accent); color: var(--text-on-accent); }
.md-list { max-height: 62vh; overflow-y: auto; }
.md-row { display: flex; align-items: center; gap: 0.6rem; width: 100%; padding: 0.5rem 0.8rem; border: none; border-bottom: 1px solid var(--border-default); background: transparent; color: var(--text-primary); cursor: pointer; text-align: left; font-size: 0.85rem; }
.md-row:hover { background: var(--bg-card-hover); }
.md-row-pos { font-weight: 800; font-size: 0.7rem; width: 28px; flex-shrink: 0; }
.md-row-name { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.md-row-team { color: var(--text-muted); font-size: 0.72rem; width: 34px; flex-shrink: 0; }
.md-row-adp { color: var(--text-subtle); font-size: 0.7rem; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.md-surv { font-size: 0.7rem; font-weight: 700; width: 38px; text-align: right; flex-shrink: 0; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.md-surv--low { color: var(--color-loss); }
.md-surv--high { color: var(--color-win); }
.md-roster { background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: 0.8rem; }
.md-roster h3 { margin: 0 0 0.6rem; font-size: 0.9rem; color: var(--text-primary); }
.md-need { display: flex; justify-content: space-between; font-size: 0.75rem; font-weight: 700; padding: 2px 0; }
.md-roster-list { margin-top: 0.6rem; border-top: 1px solid var(--border-default); padding-top: 0.5rem; display: flex; flex-direction: column; gap: 0.3rem; }
.md-rl-row { font-size: 0.78rem; color: var(--text-secondary); }
.md-rl-pos { font-weight: 800; font-size: 0.7rem; }
.md-rl-team { color: var(--text-subtle); font-size: 0.7rem; }
.md-complete { text-align: center; max-width: 640px; margin: 2rem auto; }
.md-grade-card { display: inline-flex; align-items: center; gap: 1rem; background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: 1rem 1.5rem; margin: 1rem 0; }
.md-grade { font-family: var(--font-display); font-size: 3rem; font-weight: 900; color: var(--accent); }
.md-grade-meta { text-align: left; display: flex; flex-direction: column; }
.md-final-roster { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.8rem; margin: 1.5rem 0; text-align: left; }
.md-fr-group { background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 0.6rem; }
.md-fr-pos { font-weight: 800; font-size: 0.75rem; margin-bottom: 0.3rem; }
.md-fr-row { font-size: 0.78rem; color: var(--text-secondary); padding: 1px 0; }
@media (max-width: 760px) { .md-draft-grid { grid-template-columns: 1fr; } .md-roster { order: -1; } }
