* {
    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: 'Courier New', 'Lucida Console', monospace;
    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;
    text-align: right;
}

/* ── 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;
}

/* ── 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 2rem;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    align-self: stretch;
}

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

.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: rgba(255, 107, 43, 0.3);
    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;
}

.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);
    animation: slideIn 0.4s ease;
}

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

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

.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; }

@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;
}

.map-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    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-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);
}

/* ── 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; }
}

/* ── 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; }

/* ── 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;
    top: 4rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: #fff;
    font-family: 'Courier New', monospace;
    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;
}

@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: 'Courier New', monospace;
    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.88rem;
    color: var(--text);
    font-weight: bold;
}

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

@keyframes hrBadgeFloat {
    0%   { opacity: 0; transform: translate(-50%, -70%)  scale(0.6); }
    10%  { opacity: 1; transform: translate(-50%, -112%) scale(1.1); }
    16%  { transform: translate(-50%, -106%) scale(0.96); }
    22%  { transform: translate(-50%, -110%) scale(1); }
    75%  { opacity: 1; transform: translate(-50%, -132%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -158%) scale(0.9); }
}

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

.scroll-pause {
    flex-shrink: 0;
    background: none;
    border: none;
    border-right: 1px solid var(--card-border);
    color: var(--muted);
    font-size: 0.85rem;
    padding: 0 0.75rem;
    height: 100%;
    cursor: pointer;
    transition: color 0.2s;
    align-self: stretch;
    display: flex;
    align-items: center;
}
.scroll-pause:hover { color: var(--text); }
.scroll-pause.paused { color: var(--accent); }

.scoreboard {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.5rem 0;
    scrollbar-width: none;
    cursor: grab;
    user-select: none;
}
.scoreboard::-webkit-scrollbar { display: none; }
.scoreboard.dragging { cursor: grabbing; }

.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;
}

.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); }

.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;
}

/* ── 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: 'JetBrains Mono', 'Fira Code', monospace;
}

.badge-status {
    fill: var(--blue);
    font-size: 8.5px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    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;
    padding-top: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

/* 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;
}
.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-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-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.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;
}
.drawer-hr-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* clickable player names everywhere */
[data-player] { cursor: pointer; }
[data-player]: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 + tabs only, no tagline ── */
    header {
        grid-template-columns: auto 1fr;
        padding: 0.4rem 0.75rem;
        gap: 0.5rem;
    }
    .tagline { display: none; }
    .beta-badge { display: none; }
    .logo-img { height: 24px; }
    .tabs { gap: 0.1rem; padding: 0.15rem; }
    .tab { font-size: 0.68rem; padding: 0.28rem 0.45rem; letter-spacing: 0.04em; }

    /* ── 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; }
    .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;
    }

    /* 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%; }

    /* ── 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: none;
        overflow-y: visible;
    }
    /* 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, show ~2 cards then scroll */
    .scoreboard-wrap {
        border-top: none;
        flex-direction: column;
        overflow-y: auto;
        /* ~2 game cards tall: each card ~72px + gap */
        max-height: 160px;
        flex-shrink: 0;
    }
    .scroll-pause { display: none; }
    .scoreboard {
        overflow: visible;
        padding: 0;
        cursor: default;
        user-select: auto;
    }
    .scoreboard-games {
        display: flex;
        flex-direction: column;
        gap: 0.4rem;
        padding: 0.4rem 0;
        min-width: unset;
    }
    .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 */
    }

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