:root {
  --bg: #0f1218; --panel: #171c26; --panel2: #1e2532; --border: #2a3242; --text: #e8ecf2; --muted: #8b95a7;
  --up: #3ecf8e; --down: #ff6b6b; --live: #ff4d4d; --accent: #5b8def;
  --o0: #e69f00; --o1: #56b4e9; --o2: #cc79a7; --o3: #f0e442;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
h1 { margin: 0 0 2px; font-size: 22px; }
h2 { font-size: 17px; margin: 22px 0 10px; }
h3 { font-size: 14px; margin: 10px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.live { color: var(--live); font-weight: 600; }
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--muted); }
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--panel); position: sticky; top: 0; z-index: 5; }
.meta { margin-top: 4px; font-size: 13px; color: var(--muted); }
.controls { text-align: right; }
button { background: var(--accent); color: white; border: 0; border-radius: 6px; padding: 8px 14px; font-weight: 600; cursor: pointer; }
button.secondary { background: var(--panel2); color: var(--text); border: 1px solid var(--border); }
button:disabled { opacity: .5; cursor: default; }
.status { margin-top: 6px; font-size: 13px; color: var(--muted); min-height: 18px; }
.status.error { color: var(--down); }
main { padding: 6px 20px 40px; max-width: 1400px; margin: 0 auto; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.ep { font-weight: 700; }
tr[data-team] { cursor: pointer; } tr[data-team]:hover { background: var(--panel2); }
.logo { width: 18px; height: 18px; vertical-align: -4px; margin-right: 4px; }
.rank { color: var(--muted); font-size: 12px; }
.owner { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 10px; color: #111; }
.owner.o0 { background: var(--o0); } .owner.o1 { background: var(--o1); } .owner.o2 { background: var(--o2); } .owner.o3 { background: var(--o3); }

.owners { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 14px; }
.owner-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px; border-top: 4px solid var(--border); }
.owner-card.o0 { border-top-color: var(--o0); } .owner-card.o1 { border-top-color: var(--o1); } .owner-card.o2 { border-top-color: var(--o2); } .owner-card.o3 { border-top-color: var(--o3); }
.owner-card header { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: center; }
.owner-card .place { grid-row: 1 / 3; font-size: 28px; font-weight: 800; color: var(--muted); }
.owner-card h2 { margin: 0; font-size: 20px; }
.owner-card .big { font-size: 26px; font-weight: 800; } .owner-card .big small { font-size: 12px; color: var(--muted); font-weight: 500; }
.owner-card .big .delta { font-size: 14px; }
.owner-card .sub { grid-column: 2; font-size: 12px; color: var(--muted); }
.owner-card .teams { list-style: none; margin: 12px 0 0; padding: 0; }
.owner-card .team { display: grid; grid-template-columns: 1fr 44px 46px 40px 44px; gap: 6px; padding: 5px 0; border-top: 1px solid var(--border); cursor: pointer; align-items: center; }
.owner-card .team.head { font-size: 11px; color: var(--muted); text-transform: uppercase; cursor: default; border-top: 0; }
.owner-card .team:hover:not(.head) { background: var(--panel2); }
.owner-card .team .rec, .owner-card .team .make, .owner-card .team .ep, .owner-card .team .delta { text-align: right; font-variant-numeric: tabular-nums; }
.owner-card .team .ep { font-weight: 700; }
.owner-card .team .who { min-width: 0; white-space: normal; overflow-wrap: anywhere; }

.games td.game { white-space: nowrap; }
.games td.game .small { white-space: normal; }
th, td { padding: 6px 8px; }
.games th, .games td { padding: 6px 6px; }
.games tr.leading td { background: rgba(62, 207, 142, .06); }
.games tr.won td:nth-child(2) b { color: var(--up); } .games tr.lost td:nth-child(2) b { color: var(--down); }
.bar { display: inline-block; width: 60px; height: 6px; background: var(--panel2); border-radius: 3px; margin-right: 6px; vertical-align: middle; overflow: hidden; }
.bar div { height: 100%; background: var(--accent); }
.swing { font-weight: 700; }
.field tr.in td { background: rgba(91, 141, 239, .08); }
.two { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; }
@media (max-width: 900px) { .two { grid-template-columns: 1fr; } }
.mini td, .mini th { padding: 4px 8px; }
code { background: var(--panel2); padding: 1px 4px; border-radius: 4px; font-size: 12px; }

.modal { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 20; padding: 30px 12px; overflow: auto; }
.modal.open { display: block; }
.modal-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; max-width: 980px; margin: 0 auto; padding: 20px; position: relative; }
.modal-card .close { position: absolute; top: 10px; right: 10px; background: var(--panel2); color: var(--text); font-size: 18px; line-height: 1; padding: 4px 9px; }
.modal-card h2 { margin-top: 0; }
.cols { display: grid; grid-template-columns: 260px 1fr; gap: 20px; }
@media (max-width: 800px) { .cols { grid-template-columns: 1fr; } }
.sched td { white-space: normal; }

@media (max-width: 1350px) { .games .bar { display: none; } }
.games { font-size: 13px; }
.games th { white-space: normal; }
.games th, .games td { padding: 5px 5px; }
.games .logo { width: 16px; height: 16px; }

.stack > div { line-height: 1.5; white-space: nowrap; }
.stack > div + div { border-top: 1px dashed var(--border); margin-top: 3px; padding-top: 3px; }
.games tr.h2h td { background: rgba(91, 141, 239, .06); }
.tag { display: inline-block; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); border: 1px solid var(--accent); border-radius: 4px; padding: 0 5px; margin-left: 6px; vertical-align: middle; }
.games th, .games td { padding: 5px 4px; }
.games .owner { padding: 0 5px; font-size: 10px; }
.games .stack .small { font-size: 12px; }
@media (max-width: 600px) {
  .top { position: static; flex-direction: column; padding: 12px; }
  .controls { text-align: left; }
  main { padding: 6px 12px 24px; }
}
main > section, .two > div, .owner-card, .cols > div { min-width: 0; }
.scroll { max-width: 100%; }
.cols > div { overflow-x: auto; }
.owner-card .team { grid-template-columns: minmax(0, 1fr) 38px 38px 34px 38px; gap: 4px; }
.owner-card .big, .owner-card .sub { min-width: 0; overflow-wrap: anywhere; }
.help { padding: 6px 2px; background: transparent; color: inherit; font: inherit; text-transform: inherit; letter-spacing: inherit; text-align: inherit; border-radius: 3px; text-decoration: underline dotted; text-underline-offset: 4px; cursor: help; }
.help:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.column-help { position: fixed; z-index: 30; bottom: 16px; left: 50%; transform: translateX(-50%); width: max-content; max-width: min(440px, calc(100vw - 24px)); padding: 14px 18px; background: var(--panel2); border: 1px solid var(--accent); border-radius: 8px; box-shadow: 0 6px 24px #0008; pointer-events: none; }
.top { align-items: center; flex-direction: row; }
.top h1 { margin: 0; }
.refresh-icon { display: grid; place-items: center; flex: 0 0 40px; height: 40px; padding: 0; background: transparent; color: var(--muted); border: 1px solid var(--border); }
.refresh-icon:hover { color: var(--text); background: var(--panel2); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.status { margin: 0 auto; padding: 8px 20px; max-width: 1400px; }
.status:empty { display: none; }
.week-label { color: var(--muted); font-size: 13px; font-weight: 500; margin-left: 8px; }
.standings-tabs { display: flex; gap: 4px; margin: 0 0 14px; border-bottom: 1px solid var(--border); }
.standings-tabs button { border-radius: 0; background: none; color: var(--muted); padding: 10px 16px; border-bottom: 2px solid transparent; }
.standings-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
#historyContent { background: var(--panel); padding: 18px; border: 1px solid var(--border); border-radius: 10px; }
.history-chart { width: 100%; max-height: 370px; display: block; overflow: visible; }
.history-chart text { fill: var(--muted); font-size: 12px; }
.history-chart .chart-axis-title { fill: var(--text); font-weight: 700; }
.history-chart .history-axis-owner { fill: var(--text); }
.history-chart .history-axis-value { fill: var(--text); font-weight: 700; }
.history-plot { position: relative; }
.history-tooltip { position: fixed; z-index: 30; max-width: calc(100vw - 16px); padding: 7px 10px; background: var(--panel2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; font-size: 12px; pointer-events: none; box-shadow: 0 3px 12px #0006; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.history-chart [data-history-point] { cursor: pointer; }
.marker-shape { fill: currentColor; stroke: var(--panel); stroke-width: 1; pointer-events: none; }
.selected-point .marker-shape { transform: scale(1.3); }
.marker-hit { pointer-events: all; }
.history-marker { width: 14px; height: 14px; fill: currentColor; margin-right: 5px; vertical-align: -2px; }
.history-legend, .history-values { display: flex; flex-wrap: wrap; gap: 12px 24px; }
.history-legend { margin-bottom: 12px; font-size: 12px; }
.history-legend i, .history-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.history-detail { border-top: 1px solid var(--border); padding-top: 14px; }
.history-detail label { color: var(--muted); margin-right: 8px; }
.history-detail select { background: var(--panel2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 8px; font: inherit; }
.history-values > span { flex: 1 0 100px; }
.history-values b { margin-left: 8px; }
.history-values { margin-top: 14px; }
@media (max-width: 600px) { #historyContent { padding: 12px; } .history-chart { min-height: 210px; } }
.site-footer { max-width: 1360px; margin: 0 auto; padding: 20px 12px 28px; border-top: 1px solid var(--border); }
.site-footer button { margin-top: 12px; font-size: 12px; }
.delta .help { padding: 0; min-height: 0; text-decoration: none; }
.delta .help:hover { text-decoration: underline dotted; }
.watch-games { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(310px, 100%), 1fr)); gap: 14px; }
.watch-card { padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: linear-gradient(135deg, #1b2639, var(--panel) 60%); min-width: 0; }
.watch-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: 10px; letter-spacing: .04em; margin-bottom: 14px; }
.watch-meta > span:first-child { color: #99baff; }
.watch-team { display: flex; align-items: center; gap: 8px; }
.watch-team > b { margin-left: auto; }
.watch-team-link { background: none; padding: 0; text-align: left; color: var(--text); font-size: 17px; }
.watch-team-link .logo { width: 24px; height: 24px; vertical-align: -6px; }
.watch-venue { color: var(--muted); font-size: 11px; margin: 4px 0 4px 32px; }
.watch-summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; border-top: 1px solid var(--border); margin-top: 14px; padding-top: 10px; font-size: 12px; }
.watch-summary span { color: var(--muted); }
.owner-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.owner-filter { background: transparent; border: 1px solid var(--border); color: var(--muted); border-radius: 20px; padding: 8px 14px; font-size: 12px; }
.owner-filter:hover { background: var(--panel2); color: var(--text); }
.owner-filter[aria-pressed="true"] { background: var(--panel2); color: var(--text); border-color: var(--accent); }
.pool-games-section { border: 1px solid var(--border); border-radius: 10px; padding: 0 16px 16px; margin-top: 24px; }
.pool-games-section > h2 { margin-bottom: 4px; }
.filter-scope { margin: 0 0 12px; }
.pool-games-section > h3 { font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--text); margin: 20px 0 8px; }
.pool-games-section > h3 .small { font-weight: 400; margin-left: 6px; }
@media (max-width: 600px) { .pool-games-section { padding: 0 10px 12px; } }
@media (max-width: 600px) {
  .owners { grid-template-columns: minmax(0, 1fr); }
  .owner-card { padding: 12px; }
  .owner-card .team { padding: 8px 0; }
  .help { min-height: 36px; }
  .games th, .games td { padding: 8px; }
}
