:root {
  color-scheme: dark;
  --bg: #06090b;
  --panel: #0c1418;
  --panel-2: #111d22;
  --line: #25414a;
  --text: #f4f8fa;
  --muted: #8fa2aa;
  --cyan: #59dcf2;
  --green: #4ee08b;
  --amber: #ffc857;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button, a { font: inherit; }

.topbar {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(18px, calc((100vw - 980px) / 2));
  border-bottom: 1px solid #17262c;
  background: rgba(6, 9, 11, 0.96);
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand img { object-fit: contain; }
.brand span { display: flex; align-items: baseline; gap: 7px; }
.brand strong { font-size: 20px; }
.brand small { color: var(--cyan); font-size: 11px; font-weight: 800; }

.store-actions { display: flex; align-items: center; gap: 8px; }

.platform-link {
  width: 126px;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--panel);
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.platform-link--android:hover { border-color: var(--cyan); color: var(--cyan); background: #0d2026; }
.platform-link--ios { color: #82939a; cursor: default; border-style: dashed; }
.platform-icon { width: 20px; height: 20px; flex: 0 0 auto; fill: currentColor; }
.platform-copy { min-width: 0; display: flex; flex-direction: column; line-height: 1; }
.platform-copy small { margin-bottom: 4px; color: currentColor; font-size: 8px; font-weight: 900; }
.platform-copy strong { font-size: 13px; font-weight: 800; }

main { width: min(980px, calc(100% - 28px)); margin: 0 auto; padding: 38px 0 48px; }
.leaderboard { width: 100%; }
.heading-row, .board-meta, .rank-row, footer { display: flex; align-items: center; justify-content: space-between; }

.eyebrow, .meta-label {
  margin: 0 0 5px;
  color: var(--cyan);
  font-size: 10px;
  font-weight: 900;
}

h1 { margin: 0; font-size: 34px; line-height: 1; }

.live-state { display: flex; align-items: center; gap: 7px; color: var(--green); font-size: 11px; font-weight: 900; }
.live-state span { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px rgba(78, 224, 139, 0.8); }

.scope-controls { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-top: 26px; }
.scope-tabs { display: grid; grid-template-columns: repeat(2, minmax(110px, 1fr)); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.scope-tab { min-height: 40px; padding: 0 18px; border: 0; background: var(--panel); color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 850; }
.scope-tab + .scope-tab { border-left: 1px solid var(--line); }
.scope-tab.is-active { color: var(--cyan); background: #0d2026; box-shadow: inset 0 -2px var(--cyan); }
.country-filter { min-width: 210px; display: grid; gap: 5px; color: var(--cyan); font-size: 9px; font-weight: 900; }
.country-filter select { width: 100%; min-height: 40px; border: 1px solid var(--line); border-radius: 6px; padding: 0 36px 0 11px; background: var(--panel); color: var(--text); font-weight: 750; }
.country-filter select:disabled { color: var(--muted); opacity: .58; }

.category-tabs { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 18px; border-bottom: 1px solid var(--line); }
.category-tab { min-height: 46px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font-weight: 800; }
.category-tab:hover { color: var(--text); }
.category-tab.is-active { color: var(--cyan); border-bottom-color: var(--cyan); }

.board-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 5px; scrollbar-width: thin; }
.board-tab { flex: 0 0 auto; min-height: 36px; border: 1px solid #203840; border-radius: 5px; padding: 0 12px; background: var(--panel); color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 700; }
.board-tab.is-active { border-color: var(--cyan); color: var(--cyan); background: #0d2026; }

.board-meta { margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.board-meta strong { display: block; font-size: 18px; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: var(--panel-2); color: var(--cyan); cursor: pointer; font-size: 23px; }

.status { margin: 14px 0; padding: 18px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); text-align: center; }
.status[hidden] { display: none; }
.ranking { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.rank-row { min-height: 66px; padding: 10px 14px; border: 1px solid #1b3038; border-radius: 6px; background: var(--panel); }
.rank-main { min-width: 0; display: flex; align-items: center; gap: 12px; }
.rank-number { width: 34px; color: var(--muted); font-weight: 900; }
.rank-row:nth-child(1) .rank-number { color: var(--amber); }
.rank-row:nth-child(2) .rank-number { color: #d8e0e4; }
.rank-row:nth-child(3) .rank-number { color: #d58d5d; }
.driver { min-width: 0; }
.driver-name { margin: 0; font-size: 14px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.driver-detail { margin: 4px 0 0; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score { flex: 0 0 auto; text-align: right; }
.score strong { display: block; color: var(--cyan); font-size: 17px; }
.score small { color: var(--muted); font-size: 10px; }

.safety { max-width: 720px; margin: 22px auto 0; color: #71848c; font-size: 11px; line-height: 1.6; text-align: center; }
footer { width: min(980px, calc(100% - 28px)); min-height: 64px; margin: 0 auto; border-top: 1px solid #17262c; color: #71848c; font-size: 12px; }
footer a { color: var(--muted); }

@media (max-width: 560px) {
  .topbar { height: 60px; padding: 0 10px; }
  .brand img { width: 36px; height: 36px; }
  .brand span { display: none; }
  .platform-link { width: 112px; height: 40px; padding: 5px 8px; gap: 6px; }
  .platform-icon { width: 18px; height: 18px; }
  .platform-copy strong { font-size: 12px; }
  main { width: min(100% - 20px, 980px); padding-top: 26px; }
  h1 { font-size: 28px; }
  .category-tab { font-size: 12px; }
  .rank-row { padding: 9px 10px; }
  .rank-main { gap: 7px; max-width: calc(100% - 82px); }
  .rank-number { width: 27px; }
  .score strong { font-size: 15px; }
  .driver-detail { max-width: 190px; }
  .scope-controls { align-items: stretch; flex-direction: column; }
  .scope-tabs { grid-template-columns: repeat(2, 1fr); }
  .country-filter { width: 100%; }
}
