/* Home page */
#homePage { display:flex; flex-direction:column; min-height:100vh; background:#0a0a0a; overflow-y:auto; }
body:not(.home-visible) #homePage { display:none !important; }
body.home-visible #scorebar,
body.home-visible nav,
body.home-visible #content,
body.home-visible #atbat,
body.home-visible #leagueScores,
body.home-visible #divStandings { display:none !important; }
body.home-visible { overflow:auto; }
#homePage.fade-out { opacity:0; transition:opacity .3s ease; }

.home-header { text-align:center; padding:40px 20px 20px; }
.home-logo { font-size:64px; line-height:1; }
.home-title { font-size:28px; font-weight:700; color:#fff; margin:8px 0 0; letter-spacing:1px; }

.home-teams { padding:12px 20px; }
.home-section-title { font-size:14px; font-weight:600; color:#888; text-transform:uppercase; letter-spacing:2px; margin:0 0 12px; text-align:center; }
.home-team-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(64px, 1fr)); gap:8px; max-width:500px; margin:0 auto; }
.home-team-tile { display:flex; flex-direction:column; align-items:center; gap:4px; padding:8px 4px; border-radius:8px; background:#151515; border:1px solid #222; cursor:pointer; transition:all .2s; }
.home-team-tile:hover { border-color:var(--accent); background:#1a1a1a; transform:scale(1.05); }
.home-team-tile img { width:28px; height:28px; object-fit:contain; }
.home-team-tile span { font-size:10px; font-weight:700; color:#ccc; }

.home-team-selected { border-color:var(--accent); background:#1a1a1a; padding:16px 24px; }
.home-team-selected img { width:64px; height:64px; }
.home-team-selected span { font-size:16px; color:var(--accent); }
.home-change-btn { display:block; margin:12px auto 0; background:none; border:1px solid #444; color:#888; font-size:12px; padding:6px 16px; border-radius:6px; cursor:pointer; transition:all .2s; }
.home-change-btn:hover { border-color:var(--accent); color:var(--accent); }

.home-scores { padding:10px 20px 30px; flex:1; }
.home-scores-list { display:flex; gap:10px; flex-wrap:wrap; justify-content:center; padding:4px 0; }
.home-scores-list:empty::after { content:'Loading scores...'; color:#666; font-size:14px; display:block; text-align:center; width:100%; }

.home-btn { background:none; border:none; font-size:20px; cursor:pointer; padding:4px 8px; border-radius:4px; transition:background .2s; line-height:1; }
.home-btn:hover { background:rgba(255,255,255,.1); }

:root { --primary:#0C2C56; --accent:#00A3E0; }
html, body { margin:0; height:100%; overflow:hidden; }
body { font-family: system-ui, sans-serif; background:#0a0a0a; color:#eee; display:flex; flex-direction:column; }
#scorebar { background:var(--primary); padding:12px; z-index:10; display:flex; align-items:center; gap:12px; flex-shrink:0; top:0; font-size:20px; font-weight:700; }
nav { display:flex; background:#111; flex-shrink:0; z-index:9; }
#content { flex:1; overflow-y:auto; overflow-x:auto; -webkit-overflow-scrolling:touch; }
#atbat { background:#111; border-top:1px solid #222; padding:12px; z-index:10; display:flex; align-items:flex-start; gap:14px; flex-shrink:0; }
#atbat:empty { display:none; }
.league-scores { flex-shrink:0; }
.div-standings { flex-shrink:0; }

#scoreText { flex:0; white-space:nowrap; }
.div-standings { display:flex; align-items:center; justify-content:center; gap:12px; padding:10px 12px; background:#0a0a0a; border-top:1px solid #1a1a1a; }
.div-standings:empty { display:none; }
.ds-team { display:flex; flex-direction:column; align-items:center; gap:4px; min-width:50px; }
.ds-flag { width:28px; height:28px; object-fit:contain; opacity:.5; transition:opacity .2s, transform .2s; }
.ds-flag.ds-selected { opacity:1; transform:scale(1.15); filter:drop-shadow(0 0 4px var(--accent)); }
.ds-rank { font-size:10px; color:#666; font-weight:600; }
.ds-record { font-size:10px; color:#888; }
.opp-link { cursor:pointer; text-decoration:underline dotted rgba(255,255,255,.3); text-underline-offset:3px; transition:color .2s, text-decoration-color .2s; }
.opp-link:hover { color:var(--accent); text-decoration-color:var(--accent); }
#bannerActions { display:flex; align-items:center; gap:4px; }
.banner-btn { background:rgba(0,0,0,.3); border:1px solid rgba(255,255,255,.15); color:#aaa; font-size:14px; font-weight:600; padding:8px 16px; border-radius:6px; cursor:pointer; transition:all .2s; }
.banner-btn:hover { color:#fff; border-color:var(--accent); background:rgba(0,163,224,.15); }
#liveInfo { display:flex; align-items:center; justify-content:center; gap:10px; font-size:14px; white-space:nowrap; flex:1; }
#liveInfo:empty { display:none; }
.mc-sep { color:rgba(255,255,255,.15); font-size:16px; user-select:none; }
.mc-player { font-weight:600; font-size:14px; }
.mc-count { font-family:'Courier New',monospace; font-weight:700; font-size:16px; letter-spacing:1px; color:var(--accent); }
.mc-outs { font-size:12px; letter-spacing:2px; color:var(--accent); }
.li-bases { vertical-align:middle; margin:0 2px; }
.mc-inning { font-size:12px; opacity:.7; font-weight:500; }

.li-challenges { font-size:10px; color:#aaa; margin-left:8px; background:rgba(0,0,0,.4); padding:2px 6px; border-radius:4px; }

/* League scores footer */
.league-scores { display:flex; gap:8px; padding:10px 12px; background:#0a0a0a; border-top:1px solid #1a1a1a; overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:thin; scrollbar-color:#333 transparent; }
.league-scores:empty { display:none; }
.ls-game { display:flex; align-items:center; gap:8px; background:#151515; border:1px solid #222; border-radius:8px; padding:8px 12px; cursor:pointer; flex-shrink:0; min-width:130px; transition:border-color .2s, background .2s; }
.ls-game:hover { border-color:var(--accent); background:#1a1a1a; }
.ls-game.ls-live { border-color:#2a5a2a; }
.ls-teams { display:flex; flex-direction:column; gap:2px; font-size:12px; font-weight:600; flex:1; }
.ls-team { display:flex; align-items:center; gap:5px; white-space:nowrap; }
.ls-logo { width:14px; height:14px; object-fit:contain; }
.ls-scores { display:flex; flex-direction:column; gap:2px; align-items:flex-end; font-size:13px; font-weight:700; min-width:18px; }
.ls-score { text-align:right; }
.ls-status { font-size:10px; color:#888; text-align:center; letter-spacing:1px; }
.sz-svg { width:180px; height:230px; flex-shrink:0; cursor:pointer; }
.sz-zone { fill:none; stroke:#555; stroke-width:2; }
.sz-grid { stroke:#333; stroke-width:1; }
.sz-dot { opacity:.85; stroke:#000; stroke-width:1; }
.sz-ball { fill:var(--accent); }
.sz-strike { fill:#ff4444; }
.sz-foul { fill:#888; }
.sz-inplay { fill:#00d084; }
.sz-num { fill:#fff; font-size:13px; font-weight:700; text-anchor:middle; dominant-baseline:middle; pointer-events:none; }
.sz-list { display:flex; flex-direction:column; gap:3px; overflow-y:auto; max-height:230px; flex:1; font-size:12px; }
.sz-pitch { display:flex; align-items:center; gap:8px; padding:2px 4px; border-radius:3px; }
.sz-pnum { width:16px; font-weight:700; text-align:center; }
.sz-ball .sz-pnum { color:var(--accent); }
.sz-strike .sz-pnum { color:#ff4444; }
.sz-foul .sz-pnum { color:#888; }
.sz-inplay .sz-pnum { color:#00d084; }
.sz-ptype { width:90px; color:#ccc; }
.sz-pspeed { width:30px; color:#aaa; text-align:right; }
.sz-presult { color:#777; flex:1; }
.sz-modal { display:none; position:fixed; z-index:100; left:0; top:0; width:100%; height:100%; background:rgba(0,0,0,.9); align-items:center; justify-content:center; }
.sz-modal-content { background:#111; border-radius:12px; border:1px solid #333; padding:20px; width:90%; max-width:500px; max-height:90vh; overflow-y:auto; position:relative; }
.sz-modal-wide { max-width:600px; }
.sz-modal-close { position:absolute; top:10px; right:16px; font-size:28px; cursor:pointer; color:#888; z-index:1; }
.sz-modal-close:hover { color:#fff; }
#szModalBody { display:flex; flex-direction:column; align-items:center; gap:12px; }
#szModalBody .sz-svg.sz-full { width:100%; max-width:400px; height:auto; }
#szModalBody .sz-list { max-height:none; width:100%; }
.zone-tab { display:flex; flex-direction:column; align-items:center; padding:16px; gap:12px; }
.zone-tab-header { font-size:16px; font-weight:700; color:#fff; text-align:center; }
.zone-tab-header .zone-count { color:#aaa; font-weight:400; margin-left:8px; }
.zone-tab-body { display:flex; flex-direction:column; align-items:center; gap:16px; width:100%; max-width:500px; }
.zone-tab-body .sz-svg { width:100%; max-width:400px; height:auto; }
.zone-tab-body .sz-list { max-height:none; width:100%; }
.zone-side { font-size:12px; font-weight:400; color:var(--accent); background:rgba(0,0,0,.3); padding:1px 6px; border-radius:3px; vertical-align:middle; }
.zone-plate-wrapper { display:flex; align-items:center; justify-content:center; gap:4px; width:100%; }
.batter-indicator { display:flex; align-items:center; justify-content:center; width:100px; flex-shrink:0; }
.batter-silhouette { width:90px; height:300px; color:rgba(255,255,255,.4); }
.zone-plate-wrapper .sz-svg { flex:1; max-width:400px; }
.zone-tab-empty { text-align:center; color:#666; padding:40px; font-size:16px; }
nav button { flex:1; padding:10px; background:#111; color:#aaa; border:none; border-bottom:2px solid transparent; font-size:14px; }
nav button:hover { color:#fff; }
nav button.active { color:var(--accent); border-bottom:2px solid var(--accent); }
table { width:100%; border-collapse:separate; border-spacing:0; margin:16px 0; }
th, td { padding:8px; text-align:center; border-bottom:1px solid #222; font-size:14px; }
td:first-child, th:first-child { position:sticky; left:0; z-index:2; background:#0a0a0a; text-align:left; }
th:first-child { background:var(--primary); }
.group-row th:first-child { background:var(--primary); }
.p-num { display:inline-block; min-width:20px; margin-right:5px; font-size:10px; color:#999; text-align:right; }
.p-pos { font-size:10px; color:#888; margin-left:4px; }
th { color:var(--accent); cursor:pointer; user-select:none; }
th:hover { background:color-mix(in srgb, var(--primary), #fff 20%); }
.group-row th { font-size:11px; text-transform:uppercase; letter-spacing:1px; color:#888; border-bottom:2px solid var(--accent); cursor:default; padding:4px 8px; text-align:center; }
.group-row th:hover { background:transparent; }
.divider { border-left:2px solid var(--accent) !important; }
.my-team { background:var(--primary); }
.my-team td:first-child, .my-team th:first-child { background:var(--primary); }
.team-totals { border-top:2px solid var(--accent); font-weight:700; }
.ts-btn { background:var(--primary); color:#eee; border:1px solid var(--accent); border-radius:6px; padding:8px 20px; cursor:pointer; font-size:13px; }
.ts-btn:hover { background:var(--accent); color:#000; }
.ts-cards { display:flex; gap:20px; flex-wrap:wrap; }
.ts-card { flex:1; min-width:280px; background:#1a1a1a; border:1px solid #333; border-radius:10px; padding:20px 24px; }
.ts-card-title { font-size:18px; font-weight:700; color:var(--accent); text-transform:uppercase; letter-spacing:1px; margin-bottom:14px; border-bottom:1px solid #333; padding-bottom:10px; }
.ts-line { display:flex; justify-content:space-between; padding:8px 0; font-size:16px; border-bottom:1px solid #222; }
.ts-label { color:#888; font-weight:600; }
.ts-val { color:#ddd; }
.timeline { padding:12px; }
.play { margin:8px 0; padding:10px; border-radius:6px; }
.my-play { background:var(--primary); border-left:4px solid var(--accent); }
.opp-play { color:#666; font-size:13px; background:#1a1a1a; }
.play .inning { font-size:12px; opacity:.7; }
.play .desc { margin:4px 0; }
.play .meta { font-size:12px; opacity:.8; }
.tl-filter { display:flex; gap:8px; padding:10px 12px 0; }
.tl-btn { background:#1a1a1a; color:#888; border:1px solid #333; border-radius:4px; padding:6px 14px; font-size:13px; cursor:pointer; }
.tl-btn.active { background:var(--primary); color:var(--accent); border-color:var(--accent); }
.tl-inning-header { padding:10px 12px 4px; font-size:13px; font-weight:700; color:var(--accent); border-bottom:1px solid #222; margin-top:8px; }
.play { display:flex; gap:8px; }
.tl-half { font-size:12px; opacity:.6; min-width:16px; padding-top:2px; }
.tl-body { flex:1; }
.tl-headline { font-size:14px; font-weight:600; }
.tl-detail { font-size:12px; color:#999; margin:2px 0; line-height:1.4; }
.opp-play .tl-headline { color:#888; font-weight:400; }

/* Active batter/pitcher highlight */
.active-player { background:rgba(0,163,224,.12) !important; }
.active-player td:first-child, .active-player .sc-name { border-left:3px solid var(--accent); }
.play.challenge-play { background:#1a1500; border-left:4px solid #e8a317; }
.play.challenge-play .tl-headline { color:#e8a317; }
.play.abs-challenge-play { background:#1a0025; border-left:4px solid #a855f7; }
.play.abs-challenge-play .tl-headline { color:#a855f7; }
.ch-badge { font-size:10px; font-weight:700; padding:2px 6px; border-radius:3px; margin-left:6px; vertical-align:middle; }
.ch-badge-review { background:rgba(232,163,23,.2); color:#e8a317; }
.ch-badge-abs { background:rgba(168,85,247,.2); color:#a855f7; }
.ts-sub { font-size:13px; font-weight:600; color:#999; text-transform:uppercase; letter-spacing:.5px; margin-bottom:4px; }
.ch-season-summary { display:flex; justify-content:space-between; align-items:center; padding:8px 14px; background:#111; border-radius:8px; margin-bottom:10px; font-size:13px; color:#ccc; }
.ch-sep { color:#666; font-size:11px; text-transform:uppercase; letter-spacing:1px; }
.player-header { font-size:20px; font-weight:700; margin-bottom:16px; padding-bottom:10px; border-bottom:2px solid var(--accent); }
.player-header .p-num { margin-right:6px; }
.player-header .p-pos { font-size:14px; color:#999; }

/* Standings modal */
.standings-division { margin-bottom:16px; }
.standings-division-title { font-size:14px; font-weight:700; color:var(--accent); text-transform:uppercase; letter-spacing:1px; padding:6px 0; border-bottom:1px solid #333; margin-bottom:4px; }
.standings-table { width:100%; border-collapse:collapse; font-size:13px; margin-bottom:8px; }
.standings-table th { text-align:left; color:#888; font-size:11px; padding:4px 6px; border-bottom:1px solid #333; }
.standings-table th:not(:first-child) { text-align:center; }
.standings-table td { padding:5px 6px; border-bottom:1px solid #1a1a1a; }
.standings-table td:not(:first-child) { text-align:center; }
.standings-table .st-my-team { background:var(--primary); }
.standings-table .st-team-cell { display:flex; align-items:center; gap:6px; }
.standings-table .st-logo { width:18px; height:18px; object-fit:contain; }

.high-pc { color:#ff6464; }
.preview { padding:24px; text-align:center; }
.matchup-header { font-size:22px; font-weight:700; margin-bottom:8px; }
.vs { color:var(--accent); margin:0 8px; font-size:16px; }
.records { color:#888; font-size:14px; margin-bottom:24px; }
.probable-pitchers { margin:16px auto; max-width:300px; }
.probable-pitchers h3 { color:var(--accent); font-size:14px; margin-bottom:10px; }
.pp { padding:8px 12px; border-radius:6px; margin:6px 0; font-size:15px; }
.pp-link { cursor:pointer; transition:background .2s; }
.pp-link:hover { filter:brightness(1.3); }
.venue-name { margin-top:24px; color:#eee; font-size:17px; font-weight:600; }
.venue-location { margin-top:4px; color:#999; font-size:13px; }
.scorecard { overflow-x:auto; padding:4px; padding-left:0; background:rgba(0,0,0,.75); border-radius:8px; }
.sc-table { width:100%; border-collapse:separate; border-spacing:0; font-size:14px; margin:0; }
.sc-table th, .sc-table td { border:1px solid #333; padding:5px 5px; text-align:center; vertical-align:middle; }
.sc-table thead th { background:var(--primary); color:#eee; font-size:12px; font-weight:600; }
.sc-table thead th:first-child { position:sticky; left:0; z-index:3; padding-left:9px; box-shadow:-20px 0 0 0 var(--primary); }
.sc-name { text-align:left !important; white-space:nowrap; width:110px; min-width:110px; font-size:11px; color:#fff; background:#0a0a0a; position:sticky; left:0; z-index:2; padding-left:9px !important; box-shadow:-20px 0 0 0 #0a0a0a; }
.sc-num { display:inline-block; min-width:20px; margin-right:5px; font-size:10px; color:#999; text-align:right; }
.sc-pos-tag { font-size:10px; color:#888; margin-left:4px; }
.sc-inn { min-width:32px; }
.sc-cell { min-width:58px; width:58px; height:58px; font-size:14px; font-weight:600; background:rgba(0,0,0,.5); padding:4px 5px !important; position:relative; }
.sc-ab { display:flex; flex-direction:row; align-items:center; justify-content:space-between; gap:4px; padding:3px 4px; }
.sc-clickable { cursor:pointer; border-radius:4px; transition:background .15s; }
.sc-clickable:hover { background:rgba(255,255,255,.08); }
.sc-diamond { display:block; flex-shrink:0; }
.sc-count { font-size:11px; color:#888; font-weight:400; }
.sc-live-count { color:var(--accent); font-weight:700; font-size:14px; }
.sc-hit { color:#00d084; font-size:14px; }
.sc-ob { color:#4db8ff; font-size:14px; }
.sc-out { color:#e05555; font-size:14px; }
.sc-stat { color:#ddd; font-size:14px; }
.sc-sub .sc-name { padding-left:10px; font-size:11px; color:#bbb; font-style:italic; }
.sc-sub td { border-top:1px dashed #444; }
.box-sub td { border-top:1px dashed #444; }
.box-sub td:first-child { padding-left:20px; font-size:12px; color:#bbb; font-style:italic; }
.ab-event { display:flex; align-items:flex-start; gap:10px; padding:10px 0; border-bottom:1px solid #222; }
.ab-event:last-child { border-bottom:none; }
.ab-icon { font-size:18px; flex-shrink:0; width:24px; text-align:center; }
.ab-event-body { display:flex; flex-direction:column; gap:3px; }
.ab-text { color:#ddd; font-size:15px; font-weight:600; }
.ab-detail { color:#888; font-size:13px; }
.ab-desc { color:#aaa; font-size:13px; font-style:italic; margin-top:2px; }
.sc-runs { border-top:2px solid var(--accent); }
.sc-runs .sc-name { font-weight:700; color:var(--accent); }
.sc-run-cell { color:var(--accent); font-weight:700; }

/* Mobile responsive */
@media (max-width: 600px) {
  #scorebar { flex-wrap:wrap; padding:8px 12px; gap:4px 8px; font-size:16px; }
  .home-btn { order:1; font-size:18px; }
  #scoreText { order:2; flex:1; font-size:15px; min-width:0; }
  #liveInfo { order:3; width:100%; justify-content:center; flex:unset; font-size:13px; gap:8px; }
  .mc-player { font-size:13px; }
  .mc-count { font-size:14px; }
  #bannerActions { order:4; width:100%; justify-content:center; gap:6px; }
  .banner-btn { font-size:12px; padding:6px 10px; flex:1; text-align:center; }
  .ds-flag { width:22px; height:22px; }
  .ds-record { font-size:9px; }
  nav button { padding:8px; font-size:13px; }
  th, td { padding:6px 4px; font-size:12px; white-space:nowrap; }
  .sc-table th, .sc-table td { padding:3px 3px; font-size:11px; }
  .sc-name { width:80px; min-width:80px; font-size:9px; }
  .sc-cell { min-width:42px; width:42px; height:42px; font-size:11px; }
  .sz-modal-content { width:95%; padding:14px; }
  .zone-plate-wrapper { gap:2px; }
  .batter-indicator { width:36px; }
  .batter-silhouette { width:32px; height:120px; }
  .ts-cards { flex-direction:column; }
  .ts-card { min-width:unset; }
  .preview { padding:16px; }
  .matchup-header { font-size:18px; }
  .venue-name { font-size:15px; margin-top:16px; }
  .venue-location { font-size:12px; }
}