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

:root {
    --bg: #080810;
    --card-bg: #0e0e1e;
    --card-border: #2a2a4a;
    --accent: #ff6b2b;
    --accent-glow: rgba(255, 107, 43, 0.4);
    --blue: #4fc3f7;
    --text: #e8eaf0;
    --muted: #7a7ea8;
    --divider: #1a1a32;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    display: flex;
    flex-direction: column;
}

/* ── Header ── */
header {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0.5rem 2rem;
    border-bottom: 1px solid var(--card-border);
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-img {
    height: 32px;
    width: auto;
    display: block;
}

.beta-badge {
    font-size: 0.55rem;
    font-weight: bold;
    letter-spacing: 0.12em;
    color: var(--bg);
    background: var(--blue);
    padding: 0.15em 0.45em;
    border-radius: 3px;
    vertical-align: middle;
    opacity: 0.85;
}

.tagline {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--muted);
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
}

.header-social { display: flex; align-items: center; gap: 0.5rem; }
.header-social a { display: flex; align-items: center; color: #ff6b2b; text-decoration: none; transition: opacity 0.15s; }
.header-social a:hover { opacity: 0.7; }
.header-social svg { width: 16px; height: 16px; }

/* ── Tabs ── */
.tabs {
    display: flex;
    gap: 0.25rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 0.25rem;
}

.tab {
    background: none;
    border: none;
    color: var(--muted);
    font-family: inherit;
    font-size: 0.82rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 0.35rem 1.1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.tab:hover { color: var(--text); }

.tab.active {
    background: var(--accent);
    color: #fff;
    text-shadow: none;
}

/* Mobile-only bottom nav — shown instead of .tabs below the 768px breakpoint */
.bottom-tabs { display: none; }

/* ── Main ── */
main {
    position: relative;
    z-index: 1;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.view {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0 1rem;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    align-self: stretch;
}

#view-stats {
    max-width: 900px;
}

.stats-main {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1rem;
    box-sizing: border-box;
}

#view-schedule {
    max-width: none;
    padding: 0 2rem;
}

.view.hidden { display: none !important; }
.hidden { display: none !important; }

/* ── Hero ── */
.hero {
    text-align: center;
    padding: 1.1rem 0 0.8rem;
    flex-shrink: 0;
}

.hero-label, .hero-sublabel {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.hero-label {
    color: var(--text);
    margin-bottom: 0.25rem;
}

.hero-sublabel {
    color: var(--muted);
    margin-top: 0.4rem;
}

.odometer {
    font-size: clamp(3.5rem, 9vw, 7rem);
    font-weight: 900;
    color: var(--accent);
    letter-spacing: -0.03em;
    line-height: 1;
    text-shadow: none;
    font-variant-numeric: tabular-nums;
}

.unit {
    font-size: 0.85rem;
    letter-spacing: 0.6em;
    color: var(--blue);
    margin: 0.25rem 0 0;
    opacity: 0.85;
}

.comparison-wrap {
    min-height: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0.6rem 0 0.4rem;
}

.comparison {
    font-size: 1rem;
    color: var(--blue);
    transition: opacity 0.4s ease;
}

.comparison.fade { opacity: 0; }

.hr-count {
    font-size: 0.85rem;
    color: var(--muted);
}

#total-hrs {
    color: var(--text);
    font-weight: bold;
}

/* ── League HR Leaders ── */
.league-leaders {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    flex-shrink: 0;
    margin-bottom: 0.65rem;
}

.div-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 0.5rem 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.div-card-label {
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--muted);
}

.div-card-body {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 1.6rem;
    flex-wrap: nowrap;
    overflow: hidden;
}

.kpi-name {
    font-size: 0.82rem;
    font-weight: bold;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.kpi-team {
    font-size: 0.7rem;
    color: var(--blue);
    white-space: nowrap;
    flex-shrink: 0;
}

.kpi-logo {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.kpi-hrs {
    font-size: 1rem;
    font-weight: bold;
    color: var(--accent);
    flex-shrink: 0;
    margin-left: auto;
}

.div-leader-empty {
    color: var(--muted);
    font-size: 0.85rem;
}

/* ── Stats row ── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.65rem;
    flex-shrink: 0;
    margin-bottom: 0.65rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 0.65rem 1rem;
    text-align: center;
}

.stat-card.highlight {
    border-color: var(--card-border);
    background: linear-gradient(135deg, #0a0a1c, #110a08);
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: bold;
    color: var(--accent);
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 0.2rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.stat-sub {
    font-size: 0.75rem;
    color: var(--blue);
    margin-top: 0.25rem;
    opacity: 0.85;
    min-height: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    overflow: hidden;
}

/* ── Live Scores button tooltip ── */
.live-scores-tip {
    position: fixed;
    transform: translateX(-50%);
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    white-space: nowrap;
    padding: 0.25rem 0.6rem;
    border-radius: 5px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 9999;
}

.live-scores-tip.visible { opacity: 1; }

/* ── Map badge scorecard hover ── */
.badge-scorecard-tip {
    position: fixed;
    transform: translate(-50%, -100%);
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.6));
}
.badge-scorecard-tip.visible { opacity: 1; }

/* ── Two-column layout ── */
.columns {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.65rem;
    flex: 1;
    min-height: 0;
    margin-bottom: 0.65rem;
}

.card-column {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-height: 0;
}

.season-longest-card {
    flex-shrink: 0;
}

.longest-list-card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.longest-list-card .recent-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 0.9rem 1.1rem;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.card-header {
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    color: var(--blue);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid var(--card-border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header-accent {
    color: var(--accent);
    font-weight: bold;
}

.sidebar-today-count {
    font-size: 1rem;
    font-weight: bold;
    color: var(--accent);
    letter-spacing: 0;
}

/* ── Leaders ── */
.leaders-list {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex: 1;
}

.leader-row {
    display: grid;
    grid-template-columns: 1.5rem auto 1fr auto;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--divider);
    font-size: 0.9rem;
}

.leader-row:last-child { border-bottom: none; }

.leaders-list, .recent-list {
    scrollbar-width: thin;
    scrollbar-color: var(--card-border) transparent;
}
.leaders-list::-webkit-scrollbar, .recent-list::-webkit-scrollbar { width: 4px; }
.leaders-list::-webkit-scrollbar-track, .recent-list::-webkit-scrollbar-track { background: transparent; }
.leaders-list::-webkit-scrollbar-thumb, .recent-list::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 2px; }

.leader-rank { color: var(--muted); font-size: 0.8rem; text-align: right; }
.leader-name { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leader-team { color: var(--blue); font-size: 0.82rem; }
.leader-hrs  { color: var(--accent); font-weight: bold; text-align: right; font-size: 0.95rem; }

/* ── Recent HRs ── */
.recent-list {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex: 1;
}

.hr-event {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--divider);
}

.hr-event:last-child { border-bottom: none; }

.hr-batter { font-size: 0.9rem; color: var(--text); font-weight: normal; }

.hr-meta {
    font-size: 0.82rem;
    color: var(--muted);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.hr-dist { color: var(--accent); font-weight: bold; }
.hr-team { color: var(--blue); font-size: 0.78rem; font-weight: normal; }
.hr-allstar-badge { color: #f59e0b; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em; }

@keyframes hrHighlight {
    0%   { background: rgba(255, 107, 43, 0.25); border-left-color: var(--accent); }
    100% { background: transparent;              border-left-color: transparent; }
}

.hr-event.hr-new,
.today-batter-row.hr-new {
    border-left: 2px solid var(--accent);
    animation: hrHighlight 15s ease-out forwards;
}

/* ── Map toggle ── */
.map-toggle {
    position: absolute;
    top: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    display: flex;
    gap: 0.2rem;
    background: rgba(10, 10, 28, 0.85);
    border: 1px solid var(--card-border);
    border-radius: 7px;
    padding: 0.2rem;
    backdrop-filter: blur(4px);
}

.map-tab {
    background: none;
    border: none;
    color: var(--muted);
    font-family: inherit;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 0.3rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.map-tab:hover { color: var(--text); }

.map-tab.active {
    background: var(--accent);
    color: #fff;
}

/* ── Map view ── */
#view-map {
    padding: 0.65rem 2rem;
    max-width: none;
}

#view-standings {
    padding: 0.65rem 2rem;
    max-width: none;
}

.map-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 0.65rem;
    flex: 1;
    min-height: 0;
}

.map-wrap {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#usa-map {
    width: 100%;
    height: 100%;
}

/* Stadium pulse animation */
@keyframes stadiumPulse {
    0%   { r: var(--base-r); opacity: 0.5; }
    50%  { r: calc(var(--base-r) + 6px); opacity: 0; }
    100% { r: var(--base-r); opacity: 0; }
}

.stadium-pulse {
    animation: stadiumPulse 1.8s ease-out infinite;
}

/* Map tooltip */
.map-tooltip {
    position: absolute;
    background: rgba(10, 10, 28, 0.95);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    pointer-events: none;
    white-space: nowrap;
    z-index: 10;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.map-tooltip.hidden { display: none; }

.tooltip-name { color: var(--text); font-weight: bold; margin-bottom: 0.15rem; }
.tooltip-hrs  { color: var(--accent); }
.tooltip-team { color: var(--muted); font-size: 0.78rem; }

/* Map legend */
.map-legend {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    background: rgba(10,10,28,0.85);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
}

.legend-title {
    font-size: 0.72rem;
    color: var(--muted);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 0.35rem;
}

.legend-bubbles {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.78rem;
    color: var(--muted);
}

.legend-item svg { display: block; }

/* Stadium sidebar list */
.map-sidebar {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#stadium-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
#stadium-panel.hidden { display: none; }

.stadium-list {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    scrollbar-width: none;
}
.stadium-list::-webkit-scrollbar { display: none; }

.stadium-row {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--divider);
    font-size: 0.88rem;
    transition: background 0.15s;
    border-radius: 3px;
}

.stadium-row-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.stadium-row:last-child { border-bottom: none; }
.stadium-row:hover { background: rgba(255,107,43,0.06); }
.stadium-row-link:hover .stadium-name { color: var(--accent); }

.stadium-rank { color: var(--muted); font-size: 0.78rem; min-width: 1.2rem; text-align: right; }
.stadium-logo { width: 20px; height: 20px; flex-shrink: 0; }
.stadium-team-label { color: var(--muted); font-size: 0.75rem; }
.stadium-name { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color 0.15s; }
.stadium-hrs  { color: var(--accent); font-weight: bold; }

/* ── Today stadium list ── */
.today-stadium-group {
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--divider);
}

.today-stadium-group:last-child { border-bottom: none; }

.today-stadium-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.today-stadium-name {
    font-size: 0.88rem;
    font-weight: bold;
    color: var(--text);
}

.today-stadium-total {
    font-size: 0.88rem;
    font-weight: bold;
    color: var(--accent);
}

.today-batter-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.1rem 0 0.1rem 0.75rem;
}

.today-batter-name {
    font-size: 0.8rem;
    color: var(--blue);
}

.today-batter-hrs {
    font-size: 0.8rem;
    color: var(--blue);
}

/* ── Standings view layout (mirrors the Live Scores map/sidebar split) ── */
.standings-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 0.65rem;
    flex: 1;
    min-height: 0;
}

.standings-wrap {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.standings-sidebar {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ── Standings: pennant race (left panel) ── */
.standings-pennant {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pennant-wrap {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.standings-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: center;
    color: var(--text);
    margin: 0 0 1.1rem;
}

.standings-title-mobile-wrap { display: none; }

.pennant-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

.pennant-column {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.pennant-header {
    font-size: 0.75rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--blue);
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 0.15rem;
}

.pennant-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.6rem 0.35rem 0.5rem;
    background: #131328;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    font-size: 0.82rem;
}

.pennant-rank { color: var(--muted); font-size: 0.72rem; width: 0.9rem; text-align: center; flex-shrink: 0; }
.pennant-logo { width: 18px; height: 18px; flex-shrink: 0; }
.pennant-abbr { flex: 1; color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pennant-record { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.78rem; }
.pennant-row .standings-streak { font-size: 0.72rem; min-width: 2rem; text-align: right; }

/* ── Standings: sub-tabs + table (sidebar right panel) ── */
.standings-tabs {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.standings-tab {
    flex: 1;
    background: none;
    border: 1px solid var(--card-border);
    color: var(--muted);
    font-family: inherit;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.35rem 0.4rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.standings-tab:hover { color: var(--text); }
.standings-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.standings-table-wrap {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: none;
}
.standings-table-wrap::-webkit-scrollbar { display: none; }

.standings-group {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--divider);
}
.standings-group:last-child { border-bottom: none; }

.standings-group-header {
    display: grid;
    grid-template-columns: 1.2rem 1fr auto auto auto auto auto;
    gap: 0.4rem;
    align-items: baseline;
    font-size: 0.65rem;
    letter-spacing: 0;
    color: var(--muted);
    padding-bottom: 0.3rem;
}

.standings-group-header .standings-division-label {
    grid-column: 1 / 3;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--blue);
}

.standings-col-label {
    text-align: right;
    min-width: 1.6rem;
}

.standings-col-label-streak {
    text-align: right;
    min-width: 2rem;
}

.standings-row {
    display: grid;
    grid-template-columns: 1.2rem 1fr auto auto auto auto auto;
    gap: 0.4rem;
    align-items: center;
    padding: 0.2rem 0;
    font-size: 0.82rem;
}

.standings-rank { color: var(--muted); font-size: 0.72rem; text-align: right; }
.standings-abbr { color: var(--text); font-weight: 600; }
.standings-stat { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; min-width: 1.6rem; }
.standings-row.standings-wc-in .standings-abbr { color: var(--accent); }

.standings-clinch {
    font-size: 0.6rem;
    font-weight: 700;
    margin-left: 0.2rem;
    vertical-align: super;
}
.standings-clinch-z { color: var(--accent); }
.standings-clinch-y { color: var(--blue); }
.standings-clinch-x { color: #6fcf97; }

.standings-row.standings-eliminated { opacity: 0.45; }

.standings-clickable { cursor: pointer; transition: background 0.15s; }
.standings-clickable:hover { background: rgba(255, 107, 43, 0.06); }
.pennant-row.standings-clickable:hover { background: rgba(255, 107, 43, 0.08); }

.standings-streak {
    font-size: 0.72rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: right;
    min-width: 2rem;
}
.standings-streak-w { color: #6fcf97; }
.standings-streak-l { color: #eb5757; }

.standings-row.standings-wc-leader .standings-rank {
    font-weight: 700;
    color: var(--text);
}

.standings-divider {
    border-top: 1px dashed var(--divider);
    margin: 0.3rem 0;
}

.standings-legend {
    font-size: 0.62rem;
    color: var(--muted);
    letter-spacing: 0.02em;
    padding: 0.6rem 0 0.1rem;
}
.standings-legend b { color: var(--text); }

/* ── Skeleton loaders ── */
.skeleton-row {
    height: 1.8rem;
    background: linear-gradient(90deg, var(--card-border) 25%, #1a1a38 50%, var(--card-border) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Inline ad (300×250 mobile) ── */
.inline-ad {
    display: none;
    text-align: center;
    margin: 0.25rem 0;
}

.inline-ad img { max-width: 100%; height: auto; display: block; margin: 0 auto; }

#scores-sidebar-footer {
    border-top: none;
    padding: 0;
    margin-top: auto;
    margin-left: -1.1rem;
    margin-right: -1.1rem;
    margin-bottom: -0.9rem;
    overflow: hidden;
    border-radius: 0 0 8px 8px;
}
#scores-sidebar-footer .drawer-ad-banner,
#scores-sidebar-footer .drawer-ad-banner img {
    width: 100%;
    height: auto;
    display: block;
}

@media (max-width: 768px) {
    .inline-ad { display: block; }
    #scores-sidebar-footer { display: none !important; }

}

/* ── Side ad (300×250 in left margin) ── */
.side-ad {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: calc((100vw - 900px) / 2);
    z-index: 10;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    pointer-events: none;
}

.side-ad > * { pointer-events: auto; }
.side-ad img {
    max-width: 100%;
    height: auto;
    display: block;
}

@media (min-width: 1440px) {
    .side-ad { display: flex; }
}

/* flex wrapper centers ad+list as a unit */
.players-layout {
    display: flex;
    justify-content: center;
    align-items: stretch;
    padding: 0 1.5rem;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.side-ad-players {
    display: none;
    width: 300px;
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    /* center the 300px ad in the space left of the centered 680px content column */
    left: calc(25vw - 320px);
}

.side-ad-players img { max-width: 100%; height: auto; display: block; }

@media (min-width: 1340px) {
    .side-ad-players { display: block; }
}


/* ── Footer ── */
footer {
    position: relative;
    z-index: 1;
    padding: 0.45rem 2rem;
    border-top: 1px solid var(--divider);
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.dot { opacity: 0.4; }
.footer-link { color: var(--muted); text-decoration: none; }
.footer-link:hover { color: var(--blue); }
.footer-disclaimer { opacity: 0.55; }

.footer-social { display: flex; align-items: center; gap: 0.5rem; margin-left: 0.25rem; }
.footer-social a { display: flex; align-items: center; color: #ff6b2b; text-decoration: none; transition: opacity 0.15s; }
.footer-social a:hover { opacity: 0.75; }
.footer-social svg { width: 14px; height: 14px; }

.social-bar {
  display: none;
  justify-content: center;
  gap: 1.25rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--divider);
}
.social-bar a { display: flex; align-items: center; gap: 0.4rem; color: #ff6b2b; text-decoration: none; font-size: 0.75rem; letter-spacing: 0.05em; }
.social-bar a:hover { opacity: 0.75; }
.social-bar svg { width: 16px; height: 16px; }

/* ── Live indicator ── */
.live-dot { font-size: 0.72rem; letter-spacing: 0.1em; }
.live-dot.live { color: #4ade80; animation: livePulse 1.5s ease-in-out infinite; }
.live-dot.idle { color: var(--muted); }

@keyframes livePulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* ── HR banner ── */
.hr-banner {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: #fff;
    font-family: inherit;
    font-size: 1.25rem;
    font-weight: bold;
    letter-spacing: 0.35em;
    padding: 0.85rem 2.5rem;
    border-radius: 10px;
    z-index: 100;
    box-shadow: 0 0 50px var(--accent-glow), 0 4px 24px rgba(0,0,0,0.5);
    animation: bannerIn 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275),
               bannerPulse 2s ease-in-out 0.45s 3,
               bannerOut 0.5s ease 14.5s forwards;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.hr-banner-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
}

@keyframes bannerIn {
    0%   { opacity: 0; transform: translateX(-50%) scale(0.7) translateY(-20px); }
    70%  { transform: translateX(-50%) scale(1.06) translateY(0); }
    100% { opacity: 1; transform: translateX(-50%) scale(1) translateY(0); }
}
@keyframes bannerPulse {
    0%, 100% { box-shadow: 0 0 50px var(--accent-glow), 0 4px 24px rgba(0,0,0,0.5); }
    50%      { box-shadow: 0 0 100px var(--accent-glow), 0 0 50px var(--accent-glow), 0 4px 24px rgba(0,0,0,0.5); }
}
@keyframes bannerOut { from { opacity: 1; } to { opacity: 0; } }

.walkoff-banner {
    background: linear-gradient(135deg, #b8860b, #ffd700);
    color: #1a0f00;
    font-size: 1.5rem;
    padding: 1rem 3rem;
    box-shadow: 0 0 80px rgba(255, 215, 0, 0.7), 0 4px 24px rgba(0,0,0,0.5);
    animation: bannerIn 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275),
               walkoffPulse 1.5s ease-in-out 0.45s 4,
               bannerOut 0.5s ease 14.5s forwards;
}
@keyframes walkoffPulse {
    0%, 100% { box-shadow: 0 0 80px rgba(255,215,0,0.7), 0 4px 24px rgba(0,0,0,0.5); }
    50%      { box-shadow: 0 0 160px rgba(255,215,0,0.9), 0 0 80px rgba(255,215,0,0.5), 0 4px 24px rgba(0,0,0,0.5); }
}

/* ── VERY GONE flash ── */
.very-gone-flash {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.6);
    font-family: inherit;
    font-size: clamp(3rem, 10vw, 7rem);
    font-weight: 900;
    letter-spacing: 0.2em;
    color: var(--accent);
    text-shadow: 0 0 60px var(--accent-glow), 0 0 120px var(--accent-glow), 0 4px 30px rgba(0,0,0,0.8);
    pointer-events: none;
    z-index: 200;
    white-space: nowrap;
    animation: veryGoneIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards,
               veryGoneOut 0.6s ease 3.4s forwards;
}
@keyframes veryGoneIn {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    70%  { transform: translate(-50%, -50%) scale(1.08); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes veryGoneOut {
    0%   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.3); }
}

/* ── HR map badge ── */
.hr-map-badge {
    position: absolute;
    transform: translate(-50%, -100%);
    pointer-events: none;
    z-index: 20;
    text-align: center;
    animation: hrBadgeFloat 15s ease-out forwards;
}

.hr-badge-top {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    font-weight: bold;
    font-size: 1rem;
    letter-spacing: 0.12em;
    padding: 0.35rem 0.85rem;
    border-radius: 6px 6px 0 0;
    white-space: nowrap;
    box-shadow: 0 0 24px var(--accent-glow);
}

.hr-map-badge.walkoff .hr-badge-top {
    background: linear-gradient(135deg, #b8860b, #ffd700);
    color: #1a0f00;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.8);
}

.hr-map-badge.walkoff .hr-badge-type {
    border-color: #ffd700;
    color: #ffd700;
}

.hr-badge-type {
    background: rgba(10, 10, 28, 0.95);
    border: 1px solid var(--accent);
    border-top: none;
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: bold;
    letter-spacing: 0.15em;
    padding: 0.18rem 0.6rem;
    white-space: nowrap;
}

.hr-badge-batter {
    background: rgba(10, 10, 28, 0.9);
    border: 1px solid var(--card-border);
    border-top: none;
    color: var(--blue);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    padding: 0.12rem 0.6rem;
    border-radius: 0 0 6px 6px;
    white-space: nowrap;
}

.hr-badge-team {
    color: var(--blue);
    opacity: 0.7;
    font-size: 0.65rem;
    margin-left: 0.3em;
}

.scoring-badge-logo {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex-shrink: 0;
}

/* ── Scoring play badge (blue variant) ── */
.hr-map-badge.scoring-badge .hr-badge-top {
    background: linear-gradient(135deg, #1565c0, #1e88e5);
    box-shadow: 0 0 24px rgba(30, 136, 229, 0.7);
}

.hr-map-badge.scoring-badge .hr-badge-type {
    border-color: var(--blue);
    color: var(--blue);
}

.scoring-badge-score {
    background: rgba(10, 10, 28, 0.9);
    border: 1px solid var(--card-border);
    border-top: none;
    color: var(--muted);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    padding: 0.1rem 0.6rem;
    border-radius: 0 0 6px 6px;
    white-space: nowrap;
    text-align: center;
}

/* ── No-hitter / PG watch sidebar section ── */
.nohit-section {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--divider);
    flex-shrink: 0;
}

.nohit-section-header {
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    color: var(--blue);
    text-transform: uppercase;
    margin-bottom: 0.4rem;
}

.nohit-row {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--divider);
    animation: slideIn 0.4s ease;
}

.nohit-row:last-child { border-bottom: none; }
.nohit-none { font-size: 0.78rem; color: var(--muted); padding: 0.3rem 0; }

.nohit-badge {
    font-size: 0.72rem;
    font-weight: bold;
    letter-spacing: 0.14em;
    padding: 0.12rem 0.45rem;
    border-radius: 4px;
    display: inline-block;
    width: fit-content;
}

.nh-badge  { background: rgba(255, 107, 43, 0.15); color: var(--accent); border: 1px solid rgba(255,107,43,0.4); }
.pg-badge  { background: rgba(255, 215, 0, 0.15);  color: #ffd700;       border: 1px solid rgba(255,215,0,0.4); }

.nohit-pitcher {
    font-size: 0.8rem;
    color: var(--blue);
}

.nohit-meta {
    font-size: 0.75rem;
    color: var(--muted);
}

@keyframes hrBadgeFloat {
    0%   { opacity: 0; transform: translate(-50%, -100%) scale(0.75); }
    8%   { opacity: 1; transform: translate(-50%, -100%) scale(1.05); }
    14%  { transform: translate(-50%, -100%) scale(0.97); }
    18%  { transform: translate(-50%, -100%) scale(1); }
    80%  { opacity: 1; transform: translate(-50%, -100%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -100%) scale(1); }
}

/* ── Scoreboard strip ── */
.scoreboard-wrap {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    border-top: 1px solid var(--card-border);
    gap: 0;
}

.scoreboard-arrow {
    flex-shrink: 0;
    background: none;
    border: none;
    border-right: 1px solid var(--card-border);
    color: var(--muted);
    font-size: 1.4rem;
    line-height: 1;
    padding: 0 0.7rem;
    height: 100%;
    cursor: pointer;
    transition: color 0.15s;
    align-self: stretch;
    display: flex;
    align-items: center;
    user-select: none;
}
#scoreboard-next {
    border-right: none;
    border-left: 1px solid var(--card-border);
}
.scoreboard-arrow:hover:not(:disabled) { color: var(--text); }
.scoreboard-arrow.arrow-disabled,
.scoreboard-arrow:disabled { color: rgba(255,255,255,0.15); cursor: default; }

.scoreboard {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.5rem 0;
    scrollbar-width: none;
    scroll-behavior: smooth;
}
.scoreboard::-webkit-scrollbar { display: none; }

.scoreboard-empty {
    color: var(--muted);
    font-size: 0.82rem;
    padding: 0.25rem 0.5rem;
}

.scoreboard-games {
    display: flex;
    gap: 0.5rem;
    padding: 0 0.5rem;
    min-width: max-content;
}

.game-card {
    background: #131328;
    border: 1px solid var(--card-border);
    border-radius: 7px;
    padding: 0.45rem 0.9rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.88rem;
    white-space: nowrap;
    transition: border-color 0.2s, background 0.2s;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.game-card-main {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1;
}

.game-score-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.base-diamond {
    flex-shrink: 0;
    opacity: 0.95;
}
.game-card:hover,
.game-card.live:hover {
    border-color: rgba(79, 195, 247, 0.4);
    background: #0d0d24;
}

.game-card.live {
    border-color: rgba(74, 222, 128, 0.6);
    background: linear-gradient(135deg, #0e0e1e, #0a160e);
}

.game-card.final {
    opacity: 0.5;
    font-size: 0.82rem;
    padding: 0.35rem 0.75rem;
    border-color: var(--card-border);
}

.scorecard-logo {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.game-team {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.team-abbr {
    font-weight: bold;
    color: var(--text);
    min-width: 2.2rem;
}

.team-score {
    font-weight: bold;
    font-size: 1.05rem;
    color: var(--accent);
    min-width: 1.2rem;
    text-align: right;
}

.team-score.winning { color: #4caf50; font-weight: bold; }
.team-score.losing  { color: #ef5350; }

.game-divider {
    color: var(--muted);
    font-size: 0.75rem;
}

.game-status {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    padding-left: 0.5rem;
    border-left: 1px solid var(--divider);
}
.game-status.live-status  { color: #4ade80; }
.game-status.final-status { color: var(--muted); }
.game-status.pre-status   { color: var(--blue); }
.status-weather-icon { font-size: 1rem; vertical-align: middle; margin-right: 2px; }

.game-matchup {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding-top: 0.1rem;
    border-top: 1px solid var(--divider);
}

.game-pitcher,
.game-batter {
    font-size: 0.72rem;
    font-weight: bold;
    color: var(--text);
    letter-spacing: 0.03em;
}

.game-batter { color: var(--blue); }

.matchup-label {
    font-weight: normal;
    color: var(--muted);
    margin-right: 0.25em;
}

.game-weather {
    font-size: 0.72rem;
    color: var(--muted);
    letter-spacing: 0.02em;
    padding-top: 0.1rem;
}

/* ── Schedule view ── */
.schedule-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 0;
    flex-shrink: 0;
}

.sched-nav {
    background: var(--card-bg);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.sched-nav:hover { background: var(--accent); color: #fff; }

.schedule-date-wrap {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 14rem;
    justify-content: center;
}

.schedule-date-label {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text);
}

.schedule-date-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border: 1px solid var(--accent);
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    background: var(--card-bg);
    color: var(--accent);
    transition: background 0.15s, color 0.15s;
}
.schedule-date-icon:hover { background: var(--accent); color: #fff; }

.schedule-date-picker {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.schedule-games {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 1rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    padding-bottom: 1rem;
    align-content: start;
}

.sched-box-card {
    background: #131328;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    transition: border-color 0.2s, background 0.2s;
}
.sched-box-card.live { border-color: rgba(74, 222, 128, 0.6); }
.sched-box-card.allstar { border-color: rgba(245, 158, 11, 0.5); }
.sched-allstar-label { color: #f59e0b; font-weight: 700; font-size: 0.78rem; letter-spacing: 0.03em; }

.sched-box-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    padding: 0.2rem 0.3rem 0.75rem;
    margin: 0 -0.3rem 0.75rem;
    border-bottom: 1px solid var(--card-border);
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.15s;
}
.sched-box-status:hover { background: rgba(255,255,255,0.06); }

.sched-box-icon { display: none; }
.sched-box-icon svg { width: 15px; height: 15px; display: block; }

.sched-box-grid { display: flex; flex-direction: column; }

.sched-box-header-row {
    display: grid;
    grid-template-columns: 7rem repeat(3, 2rem);
    font-size: 0.7rem;
    color: var(--muted);
    letter-spacing: 0.06em;
    padding-bottom: 0.35rem;
    text-align: right;
}

.sched-box-team-row {
    display: grid;
    grid-template-columns: 7rem repeat(3, 2rem);
    align-items: center;
    padding: 0.4rem 0;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.15s;
}
.sched-box-team-row:hover { background: rgba(255,255,255,0.06); }

.sched-box-team {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.sched-box-record {
    font-size: 0.85rem;
    font-weight: normal;
    color: var(--muted);
    margin-left: 0.3rem;
}

.sched-box-stat {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--muted);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.sched-box-inning {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--muted);
}

.sched-box-runs { color: var(--text); }
.sched-box-runs.win  { color: #4caf50; }
.sched-box-runs.loss { color: #ef5350; }

.sched-box-live {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.9rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--card-border);
}
.sched-box-live-info { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.sched-box-live-info .game-matchup { border-top: none; padding-top: 0; }

.sched-box-pitchers {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.9rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--card-border);
}

.sched-box-pitchers-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.sched-box-pitcher {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    min-width: 140px;
    cursor: pointer;
    border-radius: 6px;
    padding: 0.15rem 0.3rem;
    margin: -0.15rem -0.3rem;
    transition: background 0.15s;
}
.sched-box-pitcher:hover { background: rgba(255,255,255,0.06); }

.sched-pitcher-photo {
    width: 46px;
    height: 46px;
    border-radius: 6px;
    object-fit: contain;
    background: rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.sched-pitcher-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sched-pitcher-tag.win      { color: #4caf50; }
.sched-pitcher-tag.loss     { color: #ef5350; }
.sched-pitcher-tag.save     { color: var(--blue); }
.sched-pitcher-tag.probable { color: var(--accent); }

.sched-pitcher-stats {
    font-size: 0.78rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Team full-season schedule drawer ── */
.team-schedule-list {
    display: flex;
    flex-direction: column;
}

.team-sched-row {
    display: flex;
    flex-direction: column;
    padding: 0.4rem 1.1rem;
    border-bottom: 1px solid var(--divider);
    font-size: 0.85rem;
}
.team-sched-row:last-child { border-bottom: none; }

.team-sched-main { display: flex; align-items: center; gap: 0.6rem; }

.team-sched-date { color: var(--muted); width: 3.4rem; flex-shrink: 0; }
.team-sched-opp  { flex: 1; color: var(--text); }
.team-sched-result { font-weight: bold; color: var(--muted); }

.team-sched-makeup {
    font-size: 0.72rem;
    color: var(--muted);
    padding-left: calc(3.4rem + 0.6rem);
    margin-top: 0.1rem;
}

.team-sched-row.sched-current {
    background: rgba(255, 107, 43, 0.12);
    border-left: 2px solid var(--accent);
    padding-left: calc(1.1rem - 2px);
}
.team-sched-row.sched-current .team-sched-date { color: var(--accent); font-weight: bold; }

.team-sched-row.sched-win  .team-sched-result { color: #4caf50; }
.team-sched-row.sched-loss .team-sched-result { color: #ef5350; }
.team-sched-row.sched-live .team-sched-result { color: #4ade80; }
.team-sched-row.sched-ppd  .team-sched-result { color: var(--accent); }

/* ── Live game map indicators ── */
.weather-icon {
    font-size: 14px;
    pointer-events: none;
}

.live-connector {
    stroke: rgba(74, 222, 128, 0.35);
    stroke-width: 1;
    stroke-dasharray: 3 2;
}

.live-score-badge rect {
    fill: rgba(20, 20, 45, 0.88);
    stroke: rgba(74, 222, 128, 0.5);
    stroke-width: 1;
}

.live-score-badge.badge-final {
    opacity: 0.5;
}

.live-score-badge.badge-final rect {
    fill: rgba(14, 14, 30, 0.82);
    stroke: var(--card-border);
}

.badge-score {
    fill: #e8eaf6;
    font-size: 9.5px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.badge-status {
    fill: var(--blue);
    font-size: 8.5px;
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    opacity: 0.85;
}

/* ── Animations ── */
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.error-msg {
    color: var(--muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 1rem 0;
}

/* ── Live tab pulse ── */
.tab.tab-live {
    position: relative;
}
.tab.tab-live::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent);
    animation: livePulse 1.8s ease-in-out infinite;
}
@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.4; transform: scale(0.7); }
}

/* ── Stats view ── */
#view-stats {
    overflow-y: auto;
    scrollbar-width: none;
    padding-top: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

#view-stats::-webkit-scrollbar { display: none; }

/* Hero callout row */
.stats-hero {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.65rem;
}
.stats-hero-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 1rem 1.1rem;
    text-align: center;
}
.stats-hero-value {
    font-size: 1.7rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    line-height: 1;
    margin-bottom: 0.35rem;
}
.stats-hero-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    font-weight: 600;
}

.stats-charts-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.65rem;
}

/* 2-column rows */
.stats-row-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
    margin-top: 0.65rem;
}
#stats-square-ad { grid-column: 1; }
.show-mobile { display: none; }

.stats-col-left,
.stats-col-right {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.stats-col-right .card {
    flex: 1;
    min-height: 0;
}

/* Distance zones */
.dist-zones-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.75rem 1rem 0.9rem;
}
.dist-zone-row {
    display: grid;
    grid-template-columns: 6rem 1fr 3rem 3.2rem;
    align-items: center;
    gap: 0.6rem;
}
.dist-zone-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.dist-zone-ft {
    font-size: 0.65rem;
    color: var(--muted);
    margin-left: 2px;
    font-weight: 400;
}
.dist-zone-bar-wrap {
    height: 18px;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
    overflow: hidden;
}
.dist-zone-bar {
    height: 100%;
    border-radius: 4px;
    min-width: 2px;
}
.dist-zone-count {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    text-align: right;
}
.dist-zone-pct {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

/* Scatter plot */
#chart-scatter {
    padding: 0.5rem 1rem 0.75rem;
}

/* Inning chart — reuse dow-chart styles, just wider */
.innings-chart {
    height: 160px;
    padding: 1rem 1rem 0.5rem;
}

/* Team bars */
.team-bars-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem 1.5rem;
    padding: 0.75rem 1.1rem 1rem;
}
.team-bar-row {
    display: grid;
    grid-template-columns: 2.8rem 1fr 2rem;
    align-items: center;
    gap: 0.5rem;
}
.team-bar-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-align: right;
}
.team-bar-track {
    height: 14px;
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
    overflow: hidden;
}
.team-bar-fill {
    height: 100%;
    border-radius: 3px;
    min-width: 2px;
    opacity: 0.85;
}
.team-bar-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.stat-chart-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
}

.stat-chart-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.stat-chart-title {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    text-align: center;
}

.stat-chart-legend {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    width: 100%;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-label {
    flex: 1;
    color: var(--text-secondary);
}

.legend-pct {
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* ── Day of Week chart ── */
.stats-dow-section .card {
    display: flex;
    flex-direction: column;
}

.dow-chart {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 1rem 1rem 0.5rem;
    height: 160px;
}

.dow-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    height: 100%;
}

.dow-bar-wrap {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 0.25rem;
}

.dow-bar {
    width: 100%;
    background: var(--blue);
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    transition: opacity 0.2s;
}
.dow-bar:hover { opacity: 0.75; }

.dow-label {
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

.dow-day {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.03em;
}

/* ── Drawer ─────────────────────────────────────────────── */
.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.drawer-backdrop.open { opacity: 1; }

.drawer {
    position: fixed;
    top: 0; right: 0;
    width: 360px;
    height: 100%;
    background: #1a1a2e;
    border-left: 1px solid var(--card-border);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
    box-shadow: -8px 0 32px rgba(0,0,0,0.5);
}
.drawer.open { transform: translateX(0); }

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--card-border);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text-primary);
    flex-shrink: 0;
}
.drawer-title-record {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--muted);
}

.drawer-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.drawer-close:hover { color: var(--text-primary); background: rgba(255,255,255,0.07); }

.drawer-back {
    display: none;
    background: var(--card-bg);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    padding: 0.15rem 0.6rem;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
}
.drawer-back:hover { background: var(--accent); color: #fff; }

.drawer-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding: 0.5rem 0;
}
.drawer-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--card-border);
    background: #1a1a2e;
}

/* ── Starting lineups drawer ── */
.lineup-columns {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 0.5rem 1.1rem;
}

.lineup-col { display: flex; flex-direction: column; }

.lineup-team-header {
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--blue);
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 0.3rem;
}

.lineup-pitcher {
    font-size: 0.9rem;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 0.4rem;
}
.lineup-label {
    color: var(--muted);
    font-weight: normal;
    margin-right: 0.3rem;
}
.lineup-pitcher-stats {
    display: block;
    font-size: 0.9rem;
    color: #fff;
    font-weight: 700;
    margin-top: 0.1rem;
    white-space: nowrap;
}

.lineup-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.25rem 0;
    font-size: 0.92rem;
}

.lineup-order { color: var(--muted); font-size: 0.78rem; width: 1.1rem; flex-shrink: 0; }
.lineup-name  { flex: 1; color: var(--text); min-width: 0; }
.lineup-pos   { color: var(--muted); font-size: 0.78rem; flex-shrink: 0; }

/* ── Box score drawer ── */
.box-tabs {
    display: flex;
    gap: 0.3rem;
    padding: 0.5rem 1.1rem 0;
}

.box-tab {
    flex: 1;
    background: none;
    border: 1px solid var(--card-border);
    color: var(--muted);
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.4rem 0.5rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.box-tab:hover { color: var(--text); }
.box-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.box-panel { padding: 0.6rem 1.1rem; }

.box-team { display: flex; flex-direction: column; }

.box-team-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--blue);
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 0.3rem;
}

.box-team-line {
    font-size: 0.75rem;
    font-weight: normal;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.box-section-label {
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0.4rem 0 0.15rem;
}

.box-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.18rem 0;
    font-size: 0.8rem;
}

.box-name { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.box-pos  { color: var(--muted); font-size: 0.7rem; margin-left: 0.3rem; }
.box-note { color: var(--accent); font-size: 0.72rem; }
.box-summary { color: var(--muted); font-size: 0.76rem; flex-shrink: 0; text-align: right; white-space: nowrap; }

.box-notes {
    margin-top: 0.6rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--divider);
}
.box-note-line { color: var(--muted); font-size: 0.76rem; line-height: 1.5; }

.box-info-section { margin-top: 0.5rem; }

.box-info-row {
    padding: 0.15rem 0;
    font-size: 0.78rem;
    line-height: 1.45;
}
.box-info-label { color: var(--text); font-weight: 700; margin-right: 0.35rem; }
.box-info-value { color: var(--muted); }

.drawer-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.drawer-table thead th {
    text-align: left;
    color: var(--muted);
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 0.3rem 1.2rem 0.5rem;
    border-bottom: 1px solid var(--card-border);
}
.drawer-table thead th:last-child { text-align: right; }
.drawer-table tbody tr {
    border-bottom: 1px solid var(--card-border);
}
.drawer-table tbody tr:last-child { border-bottom: none; }
.drawer-table tbody td {
    padding: 0.55rem 1.2rem;
}
.drawer-table tbody td:last-child {
    text-align: right;
    color: var(--accent);
    font-weight: bold;
    font-size: 0.95rem;
}

.drawer-loading, .drawer-empty {
    padding: 2rem 1.2rem;
    color: var(--muted);
    font-size: 0.9rem;
    text-align: center;
}

.drawer-summary {
    display: flex;
    gap: 1.2rem;
    padding: 0.75rem 1.1rem;
    border-bottom: 1px solid var(--card-border);
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.drawer-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    cursor: pointer;
    transition: background 0.15s;
}
.drawer-row:hover { background: rgba(255,255,255,0.04); }

.drawer-rank {
    width: 1.4rem;
    font-size: 0.75rem;
    color: var(--muted);
    text-align: right;
    flex-shrink: 0;
}
.drawer-name {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}
.drawer-stat {
    font-size: 0.8rem;
    color: var(--blue);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.drawer-dist {
    font-size: 0.78rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    width: 2.8rem;
    text-align: right;
    flex-shrink: 0;
}

.drawer-hr-row {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    padding: 0.5rem 1.1rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.drawer-hr-dist {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    width: 3rem;
}
.drawer-hr-meta {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
}
.drawer-hr-batter {
    flex: 1;
    font-size: 0.88rem;
    font-weight: 600;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

a.drawer-player-link {
    color: inherit;
    text-decoration: none;
}
a.drawer-player-link:hover {
    color: var(--accent);
    text-decoration: none;
}
a.drawer-hr-row.drawer-player-link:hover {
    background: rgba(255,255,255,0.04);
    cursor: pointer;
}
.drawer-hr-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* ── Player photo + stats ── */
.drawer-player-profile {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.1rem;
}
.drawer-player-photo-wrap {
    flex-shrink: 0;
    align-self: stretch;
    display: flex;
}
.drawer-player-photo {
    width: auto;
    height: 100%;
    min-height: 120px;
    max-width: 130px;
    object-fit: cover;
    object-position: top center;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    display: block;
}
.drawer-stats-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem 0.5rem;
}
.drawer-stadium-profile {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem 1.1rem;
}
.drawer-stadium-photo {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}
.drawer-stadium-name {
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-align: center;
    letter-spacing: 0.04em;
}
.drawer-stat-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.drawer-stat-val {
    font-size: 0.95rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}
.drawer-stat-lbl {
    font-size: 0.62rem;
    color: var(--text-secondary);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* clickable player/pitcher names everywhere */
[data-player], [data-pitcher] { cursor: pointer; }
[data-player]:hover, [data-pitcher]:hover { color: var(--accent); }
[data-player]:hover .leader-name,
[data-player]:hover .hr-batter { color: var(--accent); }

.legend-item-clickable { cursor: pointer; }
.legend-item-clickable:hover .legend-label { color: var(--accent); }

.stats-source-note {
    grid-column: 1 / -1;
    font-size: 0.68rem;
    color: var(--muted);
    letter-spacing: 0.04em;
    text-align: right;
    padding-top: 0.1rem;
    opacity: 0.7;
}


/* ═══════════════════════════════════════════════════════════
   MOBILE — max-width 768px
   Strictly additive — nothing above this line is changed.
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* ── Prevent horizontal overflow globally ── */
    body { overflow-x: hidden; }
    .view, #view-map, #view-stats { overflow-x: hidden; }

    /* ── Header: logo only — navigation lives in the bottom tab bar ── */
    header {
        grid-template-columns: 1fr;
        justify-items: center;
        padding: 0.4rem 0.75rem;
        gap: 0.5rem;
    }
    .tagline { display: flex; margin-left: auto; }
    .tagline .hide-mobile { display: none; }
    header { grid-template-columns: 1fr auto; }
    .tabs { display: none; }
    .beta-badge { display: none; }
    .logo-img { height: 24px; }

    /* Footer sits below main in normal flow and would be covered by the
       fixed bottom tab bar — drop it, the live/idle status isn't critical */
    footer { display: none; }
    .social-bar { display: none; }

    /* ── Bottom tab bar ── */
    /* Keep this in sync with the bottom-tab padding/icon/label sizing below —
       it's the exact reserved space so main's content never gaps from or
       hides behind the fixed bar. */
    main { padding-bottom: calc(5.75rem + env(safe-area-inset-bottom)); }

    .bottom-tabs {
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 500;
        display: flex;
        height: 5.75rem;
        background: rgba(10, 10, 28, 0.97);
        border-top: 1px solid var(--card-border);
        backdrop-filter: blur(8px);
        padding-bottom: env(safe-area-inset-bottom);
        box-sizing: content-box;
    }

    .bottom-tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.35rem;
        background: none;
        border: none;
        color: var(--muted);
        font-family: inherit;
        padding: 0.4rem 0.2rem;
        cursor: pointer;
    }
    .bottom-tab-icon {
        display: flex;
        color: var(--accent);
    }
    .bottom-tab-icon svg { width: 1.9rem; height: 1.9rem; }
    .bottom-tab-label { font-size: 0.78rem; letter-spacing: 0.02em; }
    .bottom-tab.active { color: var(--accent); }

    /* ── Main view padding ── */
    .view { padding: 0 0.6rem; }
    #view-map { padding: 0.5rem 0.6rem; }
    #view-stats { padding: 0 0.6rem; }

    /* ── Hero counter ── */
    .hero { padding: 0.6rem 0 0.4rem; }
    .odometer { font-size: 2.8rem; }
    .hero-sublabel { font-size: 0.75rem; }

    /* ── Leaderboard stat cards: 2-col, third spans full ── */
    .stats-row {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }
    .stats-row .stat-card:last-child { grid-column: 1 / -1; order: -1; }
    .stat-card .stat-value { font-size: 1.4rem; }

    /* ── Three-column leaderboard lists → single column, full height ── */
    .columns {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        flex: unset;
        min-height: unset;
        overflow-y: visible;
        margin-bottom: 0.5rem;
    }
    /* Each card gets a fixed scroll height so all three are visible */
    .columns .card {
        display: flex;
        flex-direction: column;
        max-height: 40vh;
    }
    .leaders-list, .recent-list {
        overflow-y: auto;
        flex: 1;
        min-height: 0;
    }
    .longest-list-card {
        flex: unset;
        min-height: unset;
    }
    .longest-list-card .recent-list {
        max-height: none;
    }

    /* ── Stats page: single column, smaller text ── */
    .stats-hero {
        grid-template-columns: 1fr 1fr;
        gap: 0.4rem;
    }
    .stats-hero-value { font-size: 1.3rem; }
    .stats-hero-label { font-size: 0.62rem; }

    /* Donut cards: 2-col grid, SVGs scale via JS (width:100%/height:auto) */
    .stats-charts-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.4rem;
    }
    .stat-chart-card {
        min-height: unset;
        padding: 0.65rem 0.5rem;
        overflow-x: hidden;
    }
    .stat-chart-legend {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.3rem 0.5rem;
    }

    .stats-row-main {
        grid-template-columns: 1fr;
        gap: 0.4rem;
    }
    #stats-justbats-ad { order: -1; }
    .hide-mobile { display: none; }
    .show-mobile { display: block; }
    #stats-square-ad-mobile { margin-bottom: calc(5.75rem + env(safe-area-inset-bottom) + 1rem); }

    /* Prevent any card from overflowing */
    .card { overflow-x: hidden; }

    /* Distance zones: tighter fixed columns so the bar stays visible */
    .dist-zone-row {
        grid-template-columns: 4.5rem 1fr 2.5rem 2.8rem;
        gap: 0.35rem;
    }
    .dist-zone-label { font-size: 0.72rem; }
    .dist-zones-wrap { padding: 0.5rem 0.6rem 0.6rem; }
    .dist-zone-count, .dist-zone-pct { font-size: 0.7rem; }

    /* Inning + DoW charts: constrain height, hide any overflow */
    .innings-chart, .dow-chart {
        height: 130px;
        padding: 0.75rem 0.5rem 0.4rem;
        overflow: hidden;
    }
    .dow-label, .dow-day, .ing-count { font-size: 0.62rem; }

    /* Scatter plot */
    #chart-scatter { padding: 0.25rem 0.5rem 0.5rem; }
    #chart-scatter svg { max-width: 100%; }

    /* Suppress tab hover effect on touch */
    .tab:hover { background: transparent; color: var(--text-muted); }
    .tab.active:hover { background: var(--accent); color: #fff; }

    /* ── Live Scores: hide map, stack everything vertically ── */
    .map-wrap   { display: none; }
    .map-toggle { display: none; }

    .map-layout {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    .map-sidebar {
        max-height: 35vh;
        overflow-y: auto;
    }
    /* Make HRs Hit Today header more prominent */
    .map-sidebar .card-header {
        font-size: 1rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid var(--card-border);
        margin-bottom: 0.4rem;
    }

    /* Scorecards: single column, fills remaining space after HR list */
    #view-map {
        display: flex;
        flex-direction: column;
        gap: 0;
        padding: 0.5rem 0.6rem 0.6rem;
    }
    .map-layout { flex: none; margin-bottom: 0.4rem; }
    .scoreboard-wrap {
        border-top: none;
        flex-direction: column;
        overflow-y: auto;
        flex: 1;
        min-height: 0;
        width: 100%;
        box-sizing: border-box;
    }
    .scoreboard-arrow { display: none; }

    .scoreboard {
        overflow: visible;
        padding: 0;
        width: 100%;
        box-sizing: border-box;
    }
    .scoreboard-games {
        display: flex;
        flex-direction: column;
        gap: 0.4rem;
        padding: 0.4rem 0;
        min-width: unset;
        width: 100%;
        box-sizing: border-box;
    }
    .game-card {
        white-space: normal;
        width: 100%;
        box-sizing: border-box;
    }

    /* ── Drawer: full screen width, still slides from right ── */
    .drawer {
        width: 100vw;
        /* keep right:0 and transform from base — do NOT override right */
    }
    .drawer-header { justify-content: flex-start; }
    #drawer-title { flex: 1; text-align: right; }
    .drawer-back { display: block; }
    .drawer-close { display: none; }

    /* ── VERY GONE flash: smaller on phone ── */
    .very-gone-flash {
        font-size: clamp(2rem, 12vw, 3.5rem);
        letter-spacing: 0.1em;
    }

    /* ── Schedule view ── */
    #view-schedule { padding: 0 0.6rem; }
    .schedule-header { gap: 0.5rem; padding: 0.75rem 0; }
    .schedule-date-wrap { min-width: 0; }
    .schedule-date-label { font-size: 0.85rem; }
    .schedule-games { grid-template-columns: 1fr; gap: 0.6rem; }
    .sched-box-card { padding: 0.75rem 0.9rem; }
    .sched-box-pitchers-row { gap: 0.75rem; }
    .sched-box-pitcher { min-width: 0; }
    .sched-box-icon { display: inline-flex; }

    /* ── Standings view: pennant hidden, table fills the full view ── */
    #view-standings { padding: 0.5rem 0.6rem; }
    .standings-layout {
        display: flex;
        flex-direction: column;
        min-height: 0;
    }
    .standings-wrap { display: none; }
    .standings-sidebar { flex: 1; min-height: 0; }
    .standings-title-mobile-wrap { display: block; }
    .standings-title-mobile-wrap .standings-title { font-size: 1.25rem; }
}

/* ── Player page ─────────────────────────────────────────── */
.pp-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem 4rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
}

.pp-page-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.pp-back {
    display: inline-flex;
    align-self: flex-start;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0.25rem 0.75rem;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
}
.pp-back:hover { background: var(--accent); color: #fff; }

.pp-name {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
}


/* Three-column layout: sidebar | charts+list | ads */
.pp-layout {
    display: grid;
    grid-template-columns: 190px 1fr 310px;
    gap: 1.25rem;
}

.pp-sidebar,
.pp-center-col {
    align-self: start;
}

.pp-center-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.pp-ads-col {
    /* spacer column — keeps center content from stretching too wide */
}

.pp-fixed-ads {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    z-index: 10;
}

.pp-side-ads { display: contents; }

.pp-sidebar-ad {
    margin-top: 1rem;
}

/* Highlights bar */
.pp-highlights-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
}

.pp-hl-cell {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 0.75rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    text-align: center;
}

.pp-hl-val {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.pp-hl-label {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.pp-hl-sub {
    font-size: 0.65rem;
    color: var(--muted);
    opacity: 0.7;
}

/* Chart cards */
.pp-chart-tooltip {
    position: fixed;
    z-index: 9999;
    background: var(--card-bg);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s;
    font-size: 0.85rem;
    max-width: 220px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.pp-chart-tooltip.visible { opacity: 1; }
.pp-chart-tooltip .tt-dist {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}
.pp-chart-tooltip .tt-meta {
    color: var(--text-muted, #7a7ea8);
    margin-top: 0.2rem;
    line-height: 1.5;
}

.pp-chart-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    overflow: hidden;
}

.pp-chart-card:empty { display: none; }

.pp-chart-inner {
    padding: 0.85rem 1rem 0.5rem;
}

.pp-chart-title {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pp-chart-legend {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--muted);
    text-transform: none;
}

.pp-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.pp-legend-sweet { background: var(--accent); }

@media (max-width: 900px) {
    .pp-layout { grid-template-columns: 190px 1fr; }
    .pp-ads-col { display: none; }
    .pp-fixed-ads { display: none; }
    .pp-highlights-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
    .pp-layout { grid-template-columns: 1fr; }
    .pp-ads-col { display: none; }
    .pp-fixed-ads { display: none; }
    .pp-highlights-grid { grid-template-columns: repeat(2, 1fr); }

}

.pp-hrs-col { padding-bottom: 3.5rem; }

/* ── Player page sticky affiliate footer ── */
.pp-page-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1a1a2e;
    border-top: 1px solid var(--card-border);
    z-index: 50;
}

/* Left sidebar: photo + stats */
.pp-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pp-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.5rem;
}

.pp-profile {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pp-photo-wrap { width: 100%; }

.pp-photo {
    width: 100%;
    height: auto;
    border-radius: 10px;
    object-fit: cover;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    display: block;
}

.pp-profile-right {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.pp-meta {
    font-size: 0.82rem;
    color: var(--muted);
    letter-spacing: 0.04em;
}
.pp-twp-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0 1rem;
}
.pp-twp-divider::before,
.pp-twp-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--card-border);
}
.pp-twp-divider span {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
}
.pp-bio-flag {
    font-size: 1.1rem;
    margin-top: 0.3rem;
    line-height: 1.4;
    text-align: right;
}
.pp-bio {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 0.15rem;
    line-height: 1.6;
    text-align: right;
}


/* Player page stat grid — larger than drawer version */
.pp-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
}

.pp-stat-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 0.4rem 0.3rem;
    gap: 2px;
}

.pp-stat-val {
    font-size: 1.05rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    line-height: 1;
}

.pp-stat-lbl {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

/* Beckett CTA */
.pp-beckett-cta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    text-decoration: none;
    transition: border-color 0.15s;
}
.pp-beckett-cta:hover { border-color: var(--accent); }
.pp-beckett-eyebrow {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}
.pp-beckett-action {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.3;
}

/* Right column: HR list */
.pp-hrs-col {
    display: flex;
    flex-direction: column;
}

.pp-side-ads img { max-width: 100%; height: auto; display: block; }

@media (max-width: 700px) {
    .pp-side-ads { display: none; }

    /* Profile: match sidecard layout exactly */
    .pp-profile {
        flex-direction: row;
        align-items: flex-start;
        gap: 0.75rem;
    }
    .pp-photo-wrap {
        width: auto;
        flex-shrink: 0;
        align-self: stretch;
        display: flex;
    }
    .pp-photo {
        width: auto;
        height: 100%;
        min-height: 120px;
        max-width: 120px;
        object-fit: cover;
        object-position: top center;
        border-radius: 8px;
        border: none;
    }
    .pp-profile-right {
        flex: 1;
        min-width: 0;
    }
    .pp-bio, .pp-bio-flag {
        white-space: normal;
        word-break: break-word;
    }
    /* Stat cells: match sidecard (no card boxes, just text) */
    .pp-stat-cell {
        background: none;
        border: none;
        padding: 0.15rem 0.25rem;
    }
    .pp-stats-grid {
        gap: 0.35rem 0.5rem;
    }
}

.pp-summary {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px 8px 0 0;
    padding: 0.6rem 1rem;
    border-bottom: none;
}

.pp-hr-list {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 0 0 8px 8px;
    overflow: hidden;
}

.pp-hr-list .drawer-hr-row {
    border-bottom: 1px solid var(--divider);
}

.pp-hr-list .drawer-hr-row:last-child { border-bottom: none; }

.pp-empty {
    color: var(--muted);
    font-size: 0.9rem;
    padding: 1rem 0;
}

.pp-inline-ad {
    display: none;
    justify-content: center;
    padding: 0.75rem 0 1rem;
}
@media (max-width: 700px) {
    .pp-inline-ad { display: flex; }
    .pp-page-header {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 0.75rem;
        padding: 0.75rem 0 0.25rem;
        border-bottom: 1px solid var(--card-border);
        margin-bottom: 0.25rem;
    }
    .pp-back {
        font-size: 1.4rem;
        font-weight: 700;
        line-height: 1;
        padding: 0.15rem 0.6rem;
        flex-shrink: 0;
    }
    .pp-name {
        flex: 1;
        text-align: right;
        font-size: clamp(0.95rem, 4vw, 1.2rem);
        margin: 0;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .pp-photo-wrap {
        align-self: flex-start;
    }
    .pp-photo {
        height: auto;
        width: 110px;
    }
    .pp-profile {
        gap: 0.4rem;
    }
    .pp-profile-right {
        min-width: 0;
        overflow-wrap: break-word;
        word-break: break-word;
        gap: 0.15rem;
    }
    .pp-meta {
        font-size: 1rem;
        text-align: right;
    }
    .pp-stats-grid {
        gap: 0.2rem 0.4rem;
        justify-items: end;
    }
    .pp-stat-cell {
        background: none;
        border: none;
        padding: 0.1rem 0;
        align-items: flex-end;
    }
}
.pp-inline-ad:empty { display: none; }
.pp-inline-ad img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    display: block;
}

/* ── Players listing page ─────────────────────────────────── */
.players-main {
    max-width: 680px;
    width: 100%;
    padding: 0;
    min-height: 0;
    align-self: stretch;
    display: flex;
    flex-direction: column;
}

.players-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0 0.75rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--card-border);
    flex-shrink: 0;
}

.players-title {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.players-search {
    flex: 1;
    min-width: 180px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    padding: 0.5rem 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}
.players-search::placeholder { color: var(--muted); }
.players-search:focus { border-color: var(--accent); }

.players-list {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    margin-bottom: 4rem;
    scrollbar-width: thin;
    scrollbar-color: var(--card-border) transparent;
}
.players-list::-webkit-scrollbar { width: 4px; }
.players-list::-webkit-scrollbar-track { background: transparent; }
.players-list::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 2px; }

.players-row {
    display: grid;
    grid-template-columns: 2.5rem 1fr 3.5rem 4rem 4rem;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--divider);
    text-decoration: none;
    color: var(--text);
    transition: background 0.15s;
}
.players-row:last-child { border-bottom: none; }
.players-row:hover { background: rgba(255,255,255,0.03); }

.players-rank {
    color: var(--muted);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
}
.players-name {
    font-weight: 600;
    font-size: 0.95rem;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.players-team {
    font-size: 0.75rem;
    color: var(--blue);
    font-weight: 700;
    letter-spacing: 0.04em;
}
.players-hrs {
    font-size: 0.88rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
}
.players-hrs strong { color: var(--accent); }
.players-avg {
    font-size: 0.78rem;
    color: var(--muted);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ── Drawer: affiliate + player page link ─────────────────── */
.drawer-affiliate-link {
    display: block;
    padding: 0.9rem 1.1rem;
    color: var(--blue);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    transition: color 0.2s;
}

.drawer-affiliate-link:hover { color: #fff; }

.drawer-ad-banner {
    display: block;
    line-height: 0;
}
.drawer-ad-banner img {
    display: block;
    width: 100%;
    height: auto;
}

.drawer-player-page-link {
    display: block;
    margin: 0.75rem 1.1rem;
    padding: 0.6rem 1rem;
    background: none;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    transition: border-color 0.2s, color 0.2s;
}

.drawer-player-page-link:hover {
    border-color: var(--accent);
    color: var(--accent);
}
/* ── Pages that need vertical page scroll (stats, schedule) ── */
body.page-scroll,
html:has(body.page-scroll) {
    height: auto;
    min-height: 100vh;
    overflow: visible;
}

body.page-scroll {
    overflow-x: hidden;
}

body.page-scroll header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
}

body.page-scroll main {
    flex: none;
    min-height: 0;
    height: auto;
    overflow: visible;
    padding-bottom: 2rem;
}

/* ── MPA nav: <a> tabs and logo link ── */
a.logo {
    text-decoration: none;
    color: inherit;
}

a.tab {
    text-decoration: none;
    display: inline-block;
    color: var(--muted);
}

a.tab:hover { color: var(--text); }

a.tab.active {
    background: var(--accent);
    color: #fff;
}

a.bottom-tab {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 0.2rem;
    padding: 0.5rem 0;
    background: none;
    border: none;
    cursor: pointer;
}
