:root {
  color-scheme: dark;
  --bg: #0b0f14;
  --panel: #111720;
  --surface: #0c121a;
  --line: #263241;
  --text: #e5edf5;
  --muted: #92a1b2;
  --cyan: #67e8f9;
  --rose: #fb7185;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    14px/1.5 system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
}
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 20;
  transform: translateY(-160%);
  border-radius: 6px;
  background: var(--cyan);
  color: #061015;
  padding: 8px 12px;
  font-weight: 700;
}
.skip-link:focus-visible {
  transform: translateY(0);
}
main {
  width: min(1440px, 100%);
  margin: auto;
  padding: 18px;
}
header,
.section-head,
.filters,
.legend,
.table-title,
.game-summary,
.season-summary {
  display: flex;
  align-items: center;
}
header {
  justify-content: space-between;
  margin-bottom: 14px;
}
h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.03em;
}
h1,
h2,
h3 {
  text-wrap: balance;
}
h2 {
  margin: 0 0 3px;
  font-size: 16px;
}
h3 {
  margin: 0;
  font-size: 14px;
}
p {
  margin: 0;
  color: var(--muted);
}
#data-status {
  color: var(--muted);
  font-size: 12px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 12px;
}
.section-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 13px;
}
.legend {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px 10px;
  max-width: 58%;
  font-size: 12px;
  color: var(--muted);
}
.legend button {
  border: 0;
  background: none;
  color: inherit;
  min-height: 28px;
  padding: 2px 3px;
  cursor: pointer;
}
.legend button:hover,
.legend button[aria-pressed="true"] {
  color: var(--text);
  background: #1a2532;
}
.legend button b {
  display: inline-block;
  min-width: 18px;
  color: var(--text);
}
.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 4px;
}
.chart-wrap {
  height: 340px;
}
.chart-help {
  margin-top: 4px;
  font-size: 11px;
}
#rank-chart {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.grid-line {
  stroke: #263241;
  stroke-width: 1;
}
.axis-text {
  fill: #708094;
  font-size: 11px;
}
.team-line {
  fill: none;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  opacity: 0.78;
}
.team-line.leader {
  stroke-width: 4;
  opacity: 1;
}
.filters {
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}
select,
button {
  height: 34px;
  border: 1px solid #344458;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 0 9px;
  font: inherit;
  touch-action: manipulation;
}
select:focus-visible,
button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
#game {
  max-width: 310px;
}
button {
  cursor: pointer;
}
button:not(:disabled):hover {
  border-color: #58708c;
}
button:disabled {
  opacity: 0.45;
  cursor: wait;
}
#load-season {
  background: var(--cyan);
  border-color: var(--cyan);
  color: #061015;
  font-weight: 700;
}
.game-summary {
  min-height: 52px;
  border-block: 1px solid var(--line);
  gap: 12px;
  margin: 0 -15px 12px;
  padding: 9px 15px;
}
.game-summary b {
  font-size: 15px;
}
.game-summary strong {
  font-size: 21px;
  letter-spacing: -0.04em;
}
.game-summary span {
  color: var(--muted);
}
.scoreboard {
  margin: 0 0 14px;
}
.scoreboard.empty {
  border: 1px dashed var(--line);
  color: var(--muted);
  padding: 12px;
  text-align: center;
}
.scoreboard-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.scoreboard table {
  min-width: 680px;
}
.scoreboard th,
.scoreboard td {
  padding: 6px 10px;
}
.scoreboard th:first-child,
.scoreboard td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #101923;
  text-align: left;
}
.scoreboard td.total {
  background: #182433;
  color: var(--cyan);
  font-weight: 800;
}
.lineup {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 7px;
  margin: 12px 0 18px;
}
.lineup.empty {
  display: block;
  border: 1px dashed var(--line);
  color: var(--muted);
  padding: 18px;
  text-align: center;
}
.slot {
  min-width: 0;
  border-top: 2px solid #344458;
  padding: 8px 4px;
}
.slot small {
  color: var(--cyan);
}
.slot strong {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.slot span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
}
.stat-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(380px, 0.8fr);
  gap: 12px;
}
.stat-block {
  min-width: 0;
}
.table-title {
  justify-content: space-between;
  margin: 0 1px 7px;
}
.table-title span {
  color: var(--muted);
  font-size: 11px;
}
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.table-wrap.tall {
  max-height: 560px;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  white-space: nowrap;
  background: var(--surface);
  font-variant-numeric: tabular-nums;
}
th,
td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
}
th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #101923;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}
td:nth-child(2),
th:nth-child(2) {
  text-align: left;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tr.substitute td {
  color: var(--muted);
  background: #101923;
}
tr.substitute td:nth-child(2) {
  padding-left: 18px;
  color: var(--text);
}
.note,
.progress-note {
  margin-top: 10px;
  font-size: 12px;
}
.season-summary {
  gap: 24px;
  border-block: 1px solid var(--line);
  padding: 12px 1px;
  margin-bottom: 14px;
  color: var(--muted);
}
.season-summary b {
  font-size: 20px;
  color: var(--text);
  margin-right: 4px;
}
@media (max-width: 1050px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }
  .lineup {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 760px) {
  main {
    padding: 10px;
  }
  header,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .legend {
    max-width: 100%;
    justify-content: flex-start;
  }
  .filters {
    justify-content: flex-start;
  }
  .record-head .filters {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    width: 100%;
  }
  .record-head label {
    align-items: stretch;
    flex-direction: column;
    gap: 3px;
    white-space: nowrap;
  }
  .record-head select {
    width: 100%;
    min-height: 40px;
  }
  .record-head label:last-child {
    grid-column: 1 / -1;
    width: 100%;
  }
  #game {
    max-width: none;
    width: 100%;
  }
  .chart-wrap {
    height: 290px;
  }
  .season-summary {
    gap: 12px;
    flex-wrap: wrap;
  }
  .game-summary {
    flex-wrap: wrap;
  }
  .table-title {
    align-items: flex-start;
    gap: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
