/* AMR live timing board. Dark timing-screen look like the series sites; light theme via the button. */
:root {
  --navy: #0d1e41; --red: #c5113e; --ground: #08132b; --panel: #10214a; --raise: #16295a; --line: #24365f; --rule: #1a2b52;
  --text: #e8ecf5; --muted: #a3aec8; --pb: #4ade80; --fastest: #c084fc; --pit: #fbbf24;
  --mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace; --cond: 'Barlow Condensed', 'Arial Narrow', sans-serif;
}
:root[data-theme="light"] {
  --ground: #f2f4f8; --panel: #ffffff; --raise: #e4e8f0; --line: #d3d9e5; --rule: #e6e9f0; --text: #0d1e41; --muted: #55607a;
  --pb: #15803d; --fastest: #7e22ce; --pit: #b45309;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--text); font: 15px/1.45 Barlow, system-ui, sans-serif; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
a { color: inherit; }

.bar { background: var(--navy); border-bottom: 4px solid var(--red); color: #fff; }
.bar-in { display: flex; align-items: center; gap: 14px; min-height: 56px; }
.bar .amr { font: 700 15px var(--mono); letter-spacing: .16em; text-decoration: none; padding-right: 14px; border-right: 1px solid rgba(255,255,255,.18); }
.bar .title { font: 700 22px var(--cond); letter-spacing: .04em; text-transform: uppercase; }
.live-dot { font: 600 11px var(--mono); letter-spacing: .14em; background: var(--red); color: #fff; padding: 3px 8px 3px 20px; border-radius: 4px; position: relative; }
.live-dot::before { content: ''; position: absolute; left: 8px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: #fff; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .live-dot::before { animation: none; } }
.theme-btn { margin-left: auto; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; border: 1px solid rgba(255,255,255,.2);
  background: transparent; color: #c8d0e2; cursor: pointer; }
.theme-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .sun { display: none; }
:root[data-theme="light"] .theme-btn .sun { display: block; }
:root[data-theme="light"] .theme-btn .moon { display: none; }

main { padding-top: 20px; padding-bottom: 48px; }
.notice { background: var(--raise); border-left: 3px solid var(--pit); padding: 8px 12px; border-radius: 0 6px 6px 0; font-size: 14px; }
.session .eyebrow { font: 600 12px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--red); }
.session h1 { font: 700 34px/1.05 var(--cond); text-transform: uppercase; letter-spacing: .02em; margin: 4px 0 2px; }
.session .sub { color: var(--muted); }

.status { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; margin: 16px 0; padding: 12px 16px; background: var(--panel);
  border: 1px solid var(--line); border-left: 6px solid var(--muted); border-radius: 10px; }
.status .flag { display: flex; align-items: center; gap: 8px; font: 700 18px var(--cond); text-transform: uppercase; letter-spacing: .04em; }
.status .swatch { width: 14px; height: 14px; border-radius: 3px; background: var(--muted); }
.status .laps { font: 600 18px var(--mono); }
.status .counts { display: flex; gap: 18px; color: var(--muted); font-size: 14px; }
.status .counts b { color: var(--text); font-family: var(--mono); }
.status .paused { color: var(--pit); font-weight: 600; }
.status .next { font-weight: 600; color: var(--red); }
.flag-green { border-left-color: #16a34a; } .flag-green .swatch { background: #16a34a; }
.flag-caution { border-left-color: #facc15; } .flag-caution .swatch { background: #facc15; }
.flag-white { border-left-color: #f8fafc; } .flag-white .swatch { background: #f8fafc; outline: 1px solid var(--line); }
.flag-red { border-left-color: #dc2626; } .flag-red .swatch { background: #dc2626; }
.flag-checkered { border-left-color: #111; } .flag-checkered .swatch { background: repeating-conic-gradient(#111 0 25%, #fff 0 50%) 0 0 / 7px 7px; }

.scroll { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
table.board { width: 100%; border-collapse: collapse; font-size: 15px; }
.board th { font: 600 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.board td { padding: 7px 10px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.board tr:last-child td { border-bottom: 0; }
.board .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.board td.pos { font-weight: 600; width: 44px; }
.carno { display: inline-block; min-width: 34px; text-align: center; font-weight: 600; padding: 1px 4px; border-radius: 4px; background: var(--raise); }
.board td.driver b { font-weight: 600; }
.board .team { display: block; font-size: 12px; color: var(--muted); }
.board td.pb { color: var(--pb); }
.board td.fastest { color: var(--fastest); font-weight: 600; }
.board tr.in-pit td { opacity: .75; }
.tag { font: 600 10px var(--mono); letter-spacing: .08em; padding: 1px 5px; border-radius: 3px; vertical-align: 2px; }
.tag.pit { background: var(--pit); color: #111; }
.tag.out { background: var(--raise); color: var(--muted); }
.gone, .foot { color: var(--muted); font-size: 13px; margin-top: 14px; }

/* The track map across the top, the leaderboard below it. */
.live-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.map-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px 12px; }
.map-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.map-title { font: 600 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
svg.map { display: block; width: 100%; height: min(58vh, 560px); }
@media (max-width: 560px) { svg.map { height: 42vh; } }
svg.map .track-edge { fill: none; stroke: var(--line); stroke-linejoin: round; }
svg.map .track { fill: none; stroke: var(--raise); stroke-linejoin: round; }
svg.map .sf { stroke: var(--text); }
svg.map .car circle { fill: var(--navy); stroke: #fff; stroke-width: 0.6%; }
:root[data-theme="light"] svg.map .car circle { fill: #fff; stroke: var(--navy); }
svg.map .car text { fill: #fff; text-anchor: middle; font-family: var(--mono); font-weight: 600; pointer-events: none; }
:root[data-theme="light"] svg.map .car text { fill: var(--navy); }
/* The leader: red in both themes (listed with the light-theme selector too, or that rule's white would win). */
svg.map .car.leader circle, :root[data-theme="light"] svg.map .car.leader circle { fill: var(--red); stroke: #fff; }
svg.map .car.leader text, :root[data-theme="light"] svg.map .car.leader text { fill: #fff; }
svg.map .car.pit { opacity: .55; }
.map-note { color: var(--muted); font-size: 12px; margin: 6px 0 0; min-height: 1em; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg button { font: 600 12px Barlow, sans-serif; color: var(--muted); background: transparent; border: 0; padding: 5px 10px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--raise); color: var(--text); }
.live-grid[hidden] { display: none; }
