:root {
  color-scheme: dark;
  font-family: Manrope, system-ui, sans-serif;
  --mono: "DM Mono", ui-monospace, monospace;
  --page: #11171c;
  --text: #edf1f3;
  --muted: #a4adb3;
  --line: #344049;
  --line-soft: #29343c;
  --surface: #151d24;
  --hover: #1a252f;
  --accent: #82aaff;
  --accent-text: #a9c2ff;
  --selected: #212e43;
  --recent: #9ed4b6;
  --rating-loss: #efa89e;
  --alert-bg: #2d2426;
  --alert-text: #f3c7bc;
  background: var(--page);
  color: var(--text);
}

:root[data-theme="light"] {
  color-scheme: light;
  --page: #f2f4f5;
  --text: #19232c;
  --muted: #4f5d68;
  --line: #9eaab4;
  --line-soft: #c9d1d7;
  --surface: #eaf0f4;
  --hover: #e5ebf0;
  --accent: #4c6bad;
  --accent-text: #294b90;
  --selected: #dce6f7;
  --recent: #216345;
  --rating-loss: #92413a;
  --alert-bg: #f5e3df;
  --alert-text: #7d3f35;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
a { color: inherit; text-decoration: none; }

.shell { width: min(100% - 3rem, 55rem); margin-inline: auto; }
.masthead-inner { min-height: 5.2rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; border-bottom: 1px solid var(--line); }
.masthead { font: .84rem var(--mono); letter-spacing: .025em; }
.brand { font-weight: 500; white-space: nowrap; }
.masthead-nav { display: flex; gap: 1rem; align-items: center; color: var(--muted); }
.masthead a:hover, .theme-toggle:hover { color: var(--accent-text); }
.theme-toggle { display: inline-grid; place-items: center; background: transparent; border: 0; color: inherit; width: 2.25rem; height: 2.25rem; font-size: 1.05rem; padding: 0; }

main { padding: 5.5rem 0 3rem; }
.intro { display: flex; justify-content: space-between; align-items: end; gap: 1.25rem; margin-bottom: 3.5rem; }
h1, h2, p { margin: 0; }
.eyebrow { color: var(--accent-text); font: .83rem var(--mono); letter-spacing: .05em; margin-bottom: 1rem; }
h1 { font-size: clamp(2.7rem, 7vw, 4.75rem); font-weight: 500; letter-spacing: -.065em; line-height: 1.02; }
.intro p:not(.eyebrow) { margin-top: 1.25rem; font-size: clamp(1rem, 2.3vw, 1.38rem); line-height: 1.5; }
.intro .update-timer { color: var(--accent-text); font: .87rem var(--mono); white-space: nowrap; font-variant-numeric: tabular-nums; }

.board { border-top: 1px solid var(--line); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.15rem 0; }
h2 { font: 500 .87rem var(--mono); letter-spacing: .035em; text-transform: lowercase; }
#summary { color: var(--muted); font-size: .92rem; margin-top: .4rem; line-height: 1.5; }
.segments { display: inline-flex; gap: .35rem; }
.segments button { min-height: 2.25rem; min-width: 3.15rem; border: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--muted); font: .83rem var(--mono); }
.segments button:hover { color: var(--text); border-color: var(--muted); }
.segments button[aria-pressed="true"] { color: var(--accent-text); border-color: var(--accent); background: var(--selected); }

table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th, td { text-align: left; padding: .8rem .7rem; border-top: 1px solid var(--line-soft); }
th:first-child, td:first-child { width: 13%; }
th:nth-child(2) { width: 34%; }
th:nth-child(3) { width: 31%; }
th { color: var(--muted); font: .83rem var(--mono); text-transform: lowercase; background: var(--surface); }
td { font-size: .95rem; }
tbody tr:hover { background: var(--hover); }
.rank { color: var(--muted); font: .9rem var(--mono); font-variant-numeric: tabular-nums; }
.rank.lead { color: var(--accent-text); }
.driver { overflow-wrap: anywhere; font-weight: 600; }
.driver-rating { display: block; margin-top: .2rem; color: var(--muted); font: .8rem var(--mono); }
.rating-gain { color: var(--recent); }
.rating-loss { color: var(--rating-loss); }
.last-played small { display: block; color: var(--muted); font-size: .8rem; margin-top: .15rem; }
.activity { display: inline-flex; align-items: center; gap: .38rem; color: var(--muted); font-size: .875rem; line-height: 1.35; }
.activity.recent { color: var(--recent); font-weight: 700; }
.activity.recent::before, .key-dot { display: inline-block; width: .42rem; height: .42rem; background: var(--recent); border-radius: 50%; flex: 0 0 auto; }
.activity.recent::before { content: ""; }
.key-dot { margin: 0 .3rem .08rem 0; }
.empty { min-height: 8rem; display: grid; place-items: center; text-align: center; padding: 1.25rem; border-top: 1px solid var(--line-soft); color: var(--muted); }
.notice { margin: 0 0 1rem; color: var(--alert-text); background: var(--alert-bg); border-left: 2px solid var(--alert-text); padding: .65rem .8rem; }
.board-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.25rem; border-top: 1px solid var(--line); padding: 1rem 0; color: var(--muted); font-size: .85rem; line-height: 1.45; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 620px) {
  .shell { width: calc(100% - 2rem); }
  .masthead-inner { min-height: 4rem; }
  .masthead-nav { gap: .35rem; }
  main { padding-top: 3rem; }
  .intro { align-items: start; flex-direction: column; margin-bottom: 2.25rem; }
  .toolbar { align-items: start; flex-direction: column; padding: .85rem 0; }
  .board-footer, .notice { font-size: .8rem; }
  th, td { padding: .65rem .35rem; }
  th:first-child, td:first-child { width: 14%; }
  th:nth-child(2) { width: 31%; }
  th:nth-child(3) { width: 31%; }
  td, .activity, .rank { font-size: .82rem; }
  .last-played small { font-size: .74rem; }
}
