/* Selmaville league history — dark theme, grade-school purple accent */
:root {
  --accent: #7764fc;
  --accent-soft: rgba(119, 100, 252, 0.14);
  --accent-text: #b3a8ff;
  --bg: #121216;
  --surface: #1a1a21;
  --surface-2: #22222b;
  --border: #2e2e3a;
  --ink: #ececf1;
  --ink-2: #a6a6b4;
  --ink-3: #73737f;
  --gold: #e8c15a;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.wrap { max-width: 1060px; margin: 0 auto; padding: 0 20px; }

.site-header {
  background: linear-gradient(180deg, rgba(119, 100, 252, 0.22), rgba(119, 100, 252, 0) 90%), var(--bg);
  border-bottom: 1px solid var(--border);
  padding-top: 36px;
}
.site-header h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 44px);
  letter-spacing: -0.02em;
  text-transform: capitalize;
}
.sub { color: var(--ink-2); margin: 6px 0 0; }

.header-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }

/* Era toggle (All-Time vs 12-Team) */
.mode-toggle {
  display: inline-flex; margin-top: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 3px;
}
.mode-toggle button {
  appearance: none; border: none; cursor: pointer; font: inherit;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2);
  background: none; border-radius: 999px; padding: 6px 14px; white-space: nowrap;
}
.mode-toggle button:hover { color: var(--ink); }
.mode-toggle button.active { background: var(--accent); color: #fff; }

#nav { display: flex; gap: 4px; margin-top: 22px; overflow-x: auto; }
#nav button {
  appearance: none; background: none; border: none; cursor: pointer;
  color: var(--ink-2); font: inherit; font-size: 15px; font-weight: 500;
  padding: 10px 14px; border-bottom: 2px solid transparent; white-space: nowrap;
}
#nav button:hover { color: var(--ink); }
#nav button.active { color: var(--accent-text); border-bottom-color: var(--accent); }

main.wrap { padding: 18px 20px 60px; }
.view > h2 { font-size: 22px; margin: 34px 0 4px; letter-spacing: -0.01em; }
.view > h2:first-child { margin-top: 0; }
.view .hint { color: var(--ink-3); font-size: 14px; margin: 0 0 14px; }

/* Stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 18px 0 8px; }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px;
}
.tile .label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }
.tile .value { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: -0.01em; }
.tile .value small { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.tile .detail { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.tile.accent .value { color: var(--accent-text); }

/* Tables */
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { text-align: left; padding: 9px 14px; white-space: nowrap; }
thead th {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ink-3); font-weight: 600; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface);
}
tbody tr { border-bottom: 1px solid rgba(46, 46, 58, 0.55); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .who { color: var(--ink-2); font-size: 13px; }
tr.champ td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
tr.poop td:first-child { box-shadow: inset 3px 0 0 #8a6d3b; }
tr.me td { font-weight: 600; }

/* In-table bar (single-hue, thin, rounded data end) */
.bar-cell { min-width: 140px; }
.bar { display: flex; align-items: center; gap: 8px; }
.bar i {
  display: block; height: 10px; border-radius: 0 4px 4px 0;
  background: var(--accent); min-width: 2px;
}
.bar span { font-variant-numeric: tabular-nums; font-size: 13.5px; color: var(--ink); }

/* Season selector */
.year-picker { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; }
.year-picker button {
  appearance: none; font: inherit; font-size: 14px; cursor: pointer;
  background: var(--surface); color: var(--ink-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px;
}
.year-picker button:hover { color: var(--ink); border-color: var(--ink-3); }
.year-picker button.active {
  background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent);
  font-weight: 600;
}

.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.cols-2 > * { min-width: 0; } /* let grid children shrink so inner tables scroll */
@media (max-width: 800px) { .cols-2 { grid-template-columns: 1fr; } }

.callout {
  background: var(--accent-soft); border: 1px solid rgba(119, 100, 252, 0.35);
  border-radius: 10px; padding: 14px 16px; margin: 14px 0 20px; color: var(--ink);
  font-size: 15px;
}
.badge { font-size: 12px; color: var(--ink-3); }
.footnote { color: var(--ink-3); font-size: 13px; margin: 8px 2px 0; }

/* Head-to-head grid */
.h2h-win { color: var(--accent-text); font-weight: 600; }
.h2h-self { color: var(--ink-3); }

/* Manager name links + manager page */
a.mgr { color: inherit; text-decoration: underline dotted var(--ink-3); text-underline-offset: 3px; }
a.mgr:hover { color: var(--accent-text); text-decoration-color: var(--accent); }
.back-link {
  display: inline-block; margin-bottom: 14px; font-size: 14px;
  color: var(--ink-2); text-decoration: none;
}
.back-link:hover { color: var(--accent-text); }
.mgr-header h2 { font-size: 30px; margin: 0; letter-spacing: -0.01em; }
.mgr-header .sub { margin-bottom: 6px; }
.trophy-case { font-size: 15px; color: var(--ink-2); margin: 8px 0 0; line-height: 1.9; }
.trophy-case b { color: var(--ink); }

/* League milestone timeline */
.timeline { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.chip {
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 14px; font-size: 13.5px; color: var(--ink-2); white-space: nowrap;
}
.chip b { color: var(--accent-text); font-weight: 700; margin-right: 8px; }

/* Scoring-era badge */
.era {
  display: inline-block; font-size: 11px; font-weight: 600; line-height: 1.4;
  padding: 0 7px; border-radius: 999px; vertical-align: 1px;
  border: 1px solid var(--border); color: var(--ink-3);
}
.era.half { color: var(--accent-text); border-color: rgba(119, 100, 252, 0.45); }
footer { padding: 20px; font-size: 13px; }

/* Weekly recap */
.recap-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.week-picker { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.week-picker button {
  appearance: none; font: inherit; font-size: 13px; cursor: pointer; flex: 0 0 auto;
  min-width: 34px; padding: 5px 8px; border-radius: 8px;
  background: var(--surface); color: var(--ink-2); border: 1px solid var(--border);
}
.week-picker button.playoff { border-style: dashed; }
.week-picker button:hover { color: var(--ink); border-color: var(--ink-3); }
.week-picker button.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.recap-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.recap-title h2 { font-size: 24px; margin: 0 0 2px; letter-spacing: -0.01em; }
.recap-title .hint { margin: 0; }
.copy-btn {
  appearance: none; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  background: var(--accent-soft); color: var(--accent-text); border: 1px solid rgba(119, 100, 252, 0.45);
  border-radius: 999px; padding: 8px 14px; white-space: nowrap;
}
.copy-btn:hover { background: rgba(119, 100, 252, 0.24); }
.recap-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 24px; align-items: start; margin-top: 14px; }
.recap-grid > * { min-width: 0; }
@media (max-width: 860px) { .recap-grid { grid-template-columns: 1fr; } }
.recap-h { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); margin: 18px 0 10px; }
.recap-grid .recap-h:first-child { margin-top: 0; }
.awards { display: flex; flex-direction: column; gap: 10px; }
.award {
  display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px;
}
.award-title { font-weight: 800; font-style: italic; text-transform: uppercase; letter-spacing: 0.02em; font-size: 15px; }
.award-text { margin-top: 2px; font-size: 15px; line-height: 1.5; }
.award-text strong { color: var(--ink); }
.award-note { margin-top: 4px; font-size: 13px; color: var(--accent-text); }
.tm { position: relative; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); display: inline-block; vertical-align: middle; flex: 0 0 auto; }
.tm .tm-txt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.tm img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
table.standings th, table.standings td { padding: 6px 10px; font-size: 13.5px; }
table.standings td:first-child, table.standings th:first-child { padding-right: 4px; }
table.standings .tm { width: 26px; height: 26px; }
table.standings .tm .tm-txt { font-size: 9px; }
.tcell { display: flex; align-items: center; gap: 8px; min-width: 0; }
#view-seasons .tcell .tm { width: 26px; height: 26px; }
#view-seasons .tcell .tm .tm-txt { font-size: 9px; }
.tcell .tn { font-weight: 600; line-height: 1.2; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcell .who { font-size: 12px; line-height: 1.2; }
table.standings .move { font-size: 11px; margin-left: 2px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 3px; margin-bottom: 10px; }
.seg button {
  appearance: none; border: none; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600;
  color: var(--ink-2); background: none; border-radius: 999px; padding: 5px 12px; white-space: nowrap;
}
.seg button.active { background: var(--accent); color: #fff; }
.move { font-variant-numeric: tabular-nums; color: var(--ink-3); }
.move.up { color: #6ad38a; }
.move.down { color: #ef7b7b; }
.games { display: flex; flex-direction: column; gap: 8px; }
.game { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.game .side { display: flex; align-items: center; gap: 8px; padding: 3px 0; color: var(--ink-2); }
.game .side.won { color: var(--ink); font-weight: 600; }
.game .side .tm { width: 24px; height: 24px; }
.game .side .tm .tm-txt { font-size: 9px; }
.game .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game .sc { font-variant-numeric: tabular-nums; }
.game-note { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; padding-top: 4px; border-top: 1px dashed var(--border); }
