:root {
  --red-bull: #3671c6;
  --ferrari: #e8002d;
  --mercedes: #27f4d2;
  --mclaren: #ff8000;
  --aston-martin: #229971;
  --alpine: #ff87bc;
  --williams: #64c4ff;
  --haas: #b6babd;
  --audi: #e8002d;
  --cadillac: #cc0000;
  --racing-bulls: #6692ff;

  --accent: #e10600;
  --accent-secondary: #e10600;
  --bg-primary: #0a0a0a;
  --bg-secondary: #1a1a1a;
  --bg-card: #1e1e1e;
  --text-primary: #ffffff;
  --text-muted: #888888;
  --border: #2a2a2a;

  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --radius: 18px;
  --radius-sm: 12px;
  --container: 1100px;
}

/* Animation hard kill-switch (per README requirement). */
body.no-animations * {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

body.no-animations .section,
body.no-animations .table-row,
body.no-animations .team-card,
body.no-animations .driver-card,
body.no-animations .compare-result {
  opacity: 1 !important;
  transform: none !important;
}

body.no-animations .speed-lines {
  display: none !important;
}

body.no-animations .leader::after {
  opacity: 0 !important;
}

* {
  box-sizing: border-box;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #333333 #0a0a0a;
}

*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-track {
  background: #0a0a0a;
}

*::-webkit-scrollbar-thumb {
  background: #333333;
  border-radius: 3px;
}

*::-webkit-scrollbar-thumb:hover {
  background: #555555;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans",
    "Apple Color Emoji", "Segoe UI Emoji";
  background: radial-gradient(1200px 800px at 10% 0%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 55%),
    radial-gradient(900px 600px at 95% 20%, rgba(39, 244, 210, 0.07), transparent 60%),
    var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: min(var(--container), calc(100% - 40px));
  margin: 0 auto;
}

.section {
  padding: 26px 0;
  opacity: 0;
  transform: translateY(14px);
  animation: section-in 680ms cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
  animation-delay: var(--delay, 0s);
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-title {
  font-size: 22px;
  letter-spacing: 0.2px;
  margin: 0;
}

.section-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 1024px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
    gap: 18px;
  }
}

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(10, 10, 10, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(42, 42, 42, 0.75);
}

.nav-inner {
  position: relative;
  width: min(var(--container), calc(100% - 40px));
  margin: 0 auto;
  padding: 14px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Hamburger toggle — hidden on desktop (≥1024px), shown below. */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 0;
  margin-left: auto;
  border: 1px solid color-mix(in srgb, var(--accent) 70%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 14%, rgba(20, 20, 20, 0.95));
  cursor: pointer;
  flex-shrink: 0;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent),
    0 8px 20px color-mix(in srgb, var(--accent) 10%, transparent);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.nav-toggle:hover {
  border-color: color-mix(in srgb, var(--accent) 85%, transparent);
  background: color-mix(in srgb, var(--accent) 22%, rgba(20, 20, 20, 0.95));
}

.nav-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.nav-toggle-bar {
  display: block;
  width: 18px;
  height: 2px;
  margin: 0 auto;
  border-radius: 2px;
  background: var(--accent);
  transition: transform 200ms ease, opacity 200ms ease;
}

.nav.is-open .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav.is-open .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav.is-open .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  height: 55px;
  width: auto;
  display: block;
  object-fit: contain;
  mix-blend-mode: screen;
}

.brand-badge {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 95%, transparent), color-mix(in srgb, var(--accent) 35%, transparent));
  box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}

.brand-title {
  display: grid;
  gap: 2px;
}

.brand-title strong {
  font-size: 14px;
  letter-spacing: 0.3px;
}

.brand-title span {
  font-size: 12px;
  color: var(--text-muted);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-link {
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid rgba(42, 42, 42, 0.9);
  background: rgba(26, 26, 26, 0.4);
  color: rgba(255, 255, 255, 0.88);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
  font-size: 13px;
}

.nav-link:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.nav-link.is-active {
  border-color: color-mix(in srgb, var(--accent) 70%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

/* Language switcher */
.lang-switcher {
  position: relative;
  flex-shrink: 0;
}

.lang-switcher-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid rgba(42, 42, 42, 0.9);
  background: rgba(26, 26, 26, 0.4);
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.lang-switcher-btn:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.lang-switcher-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.lang-switcher-flag {
  font-size: 16px;
  line-height: 1;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}

.lang-switcher-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  min-width: 120px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(26, 26, 26, 0.98);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lang-switcher-panel[hidden] {
  display: none !important;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 160ms ease;
}

.lang-option:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.lang-option.is-active {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--text-primary);
}

.lang-option-flag {
  font-size: 16px;
  line-height: 1;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}

/* Hero */
.hero {
  position: relative;
  padding: 28px 0 8px;
}

.hero-card {
  background: linear-gradient(180deg, rgba(30, 30, 30, 0.92), rgba(20, 20, 20, 0.78));
  border: 1px solid rgba(42, 42, 42, 0.85);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  padding: 22px 18px;
  position: relative;
}

@media (min-width: 760px) {
  .hero-card {
    padding: 26px 24px;
  }
}

.hero-kicker {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: rgba(255, 255, 255, 0.92);
  font-size: 12px;
}

.hero-kicker .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 12%, transparent);
}

.hero-title {
  margin: 14px 0 10px;
  font-size: clamp(28px, 4.2vw, 44px);
  letter-spacing: 0.2px;
  line-height: 1.05;
}

.hero-title span {
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-subtitle {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  max-width: 62ch;
  font-size: 14px;
  line-height: 1.6;
}

.hero-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 36px;
}

@media (min-width: 1024px) {
  .hero-stats {
    grid-template-columns: repeat(3, 1fr);
  }
}

.stat-card {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(42, 42, 42, 0.8);
  border-radius: var(--radius-sm);
  padding: 12px 12px;
  display: grid;
  gap: 6px;
}

.stat-label {
  color: var(--text-muted);
  font-size: 12px;
}

.stat-value {
  font-size: 18px;
  letter-spacing: 0.2px;
}

.speed-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.65;
  mix-blend-mode: screen;
}

.speed-line {
  position: absolute;
  top: calc(20% + (var(--i) * 12%));
  right: -20%;
  width: 140%;
  height: 2px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 42%, transparent), transparent);
  transform: skewX(-22deg);
  animation: speedline 1800ms linear infinite;
  animation-delay: calc(var(--i) * -320ms);
}

/* Panels / tables */
.panel {
  background: linear-gradient(180deg, rgba(30, 30, 30, 0.86), rgba(20, 20, 20, 0.74));
  border: 1px solid rgba(42, 42, 42, 0.85);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-header {
  padding: 14px 16px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(42, 42, 42, 0.85);
  background: rgba(0, 0, 0, 0.16);
}

.panel-title {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.2px;
}

.panel-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.panel-meta-count::before {
  content: "·";
  margin-right: 10px;
  color: rgba(255, 255, 255, 0.22);
}

.race-data-status {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.race-data-status.is-live {
  color: #3ecf8e;
}

.race-data-status.is-cached {
  color: #9aa3ad;
}

.race-data-status.is-offline {
  color: #e85d5d;
}

.panel-meta:not(:has(.race-data-status:not([hidden]))) .panel-meta-count::before {
  content: none;
  margin-right: 0;
}

.teams-hero {
  padding-top: 34px;
}

.teams-grid,
.drivers-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 1024px) {
  .teams-grid,
  .drivers-grid {
    grid-template-columns: 1fr 1fr;
    gap: 18px;
  }
}

.team-card,
.driver-card,
.compare-card {
  background: linear-gradient(180deg, rgba(30, 30, 30, 0.9), rgba(20, 20, 20, 0.78));
  border: 1px solid rgba(42, 42, 42, 0.9);
  border-left: 4px solid var(--team-color, var(--accent));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.team-card,
.driver-card {
  padding: 16px;
  display: grid;
  gap: 12px;
  opacity: 0;
  transform: translateY(10px);
  animation: row-in 520ms cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
  animation-delay: var(--delay, 0s);
}

.team-header h2,
.driver-card h2 {
  margin: 0;
  font-size: 22px;
}

.team-full-name {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.team-info {
  display: grid;
  gap: 8px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(42, 42, 42, 0.85);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.team-info p {
  margin: 0;
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px;
  font-size: 13px;
}

.team-info span {
  color: var(--text-muted);
}

.team-block {
  display: grid;
  gap: 9px;
}

.team-block h3,
.driver-stats h3,
.driver-number-wrap h3 {
  margin: 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.88);
}

.team-drivers {
  display: grid;
  gap: 8px;
}

.driver-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(42, 42, 42, 0.8);
  border-radius: 10px;
  padding: 8px 10px;
}

.driver-number {
  display: inline-flex;
  min-width: 42px;
  justify-content: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 82%, transparent);
  color: rgba(0, 0, 0, 0.9);
  font-weight: 700;
  font-size: 12px;
  padding: 5px 8px;
}

.personnel-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 7px;
}

.person-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(42, 42, 42, 0.8);
  background: rgba(0, 0, 0, 0.2);
}

.person-item small,
.driver-meta,
.driver-dob span,
.compare-subtitle {
  color: var(--text-muted);
}

.team-past-drivers {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.driver-tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 12px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}

.driver-card-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.driver-meta {
  margin: 6px 0 0;
  display: flex;
  gap: 10px;
  font-size: 13px;
}

.driver-dob {
  margin: 0;
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 10px;
  font-size: 13px;
}

.driver-bio {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
}

.driver-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.driver-stats-grid p {
  margin: 0;
  border: 1px solid rgba(42, 42, 42, 0.8);
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  padding: 8px 10px;
  display: grid;
  gap: 4px;
}

.driver-stats-grid p span {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
}

.driver-number-display {
  display: grid;
  place-items: center;
  min-height: 120px;
  border-radius: 14px;
  border: 1px solid rgba(42, 42, 42, 0.85);
  background: radial-gradient(90% 120% at 50% 20%, rgba(255, 255, 255, 0.05), transparent 70%), rgba(0, 0, 0, 0.22);
}

.driver-race-number {
  font-size: clamp(56px, 9vw, 78px);
  font-weight: 900;
  line-height: 0.95;
  color: var(--team-color, var(--accent));
}

.compare-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

@media (min-width: 1024px) {
  .compare-controls {
    grid-template-columns: 1fr 1fr;
  }
}

.compare-select {
  display: grid;
  gap: 6px;
}

.compare-select label {
  font-size: 13px;
  color: var(--text-muted);
}

.compare-select select {
  width: 100%;
  padding: 9px 11px;
  border-radius: 999px;
  border: 1px solid rgba(42, 42, 42, 0.9);
  background: rgba(26, 26, 26, 0.9);
  color: rgba(255, 255, 255, 0.95);
}

.compare-result {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 260ms ease, transform 260ms ease;
}

.compare-result.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.compare-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(42, 42, 42, 0.85);
}

@media (min-width: 1024px) {
  .compare-cards {
    grid-template-columns: 1fr 1fr;
  }
}

.compare-card {
  padding: 10px 12px;
  border-left-width: 3px;
}

.compare-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.compare-number {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent) 24%, transparent);
}

.compare-number span {
  font-size: 20px;
  font-weight: 800;
}

.compare-title h3,
.compare-title p {
  margin: 0;
}

.compare-title p {
  margin-top: 4px;
}

.compare-rows {
  padding: 10px 14px 14px;
  display: grid;
  gap: 6px;
}

.compare-row {
  display: grid;
  grid-template-columns: minmax(120px, 140px) 1fr 1fr;
  gap: 8px;
  align-items: center;
}

.compare-label {
  color: var(--text-muted);
  font-size: 13px;
}

.compare-value {
  padding: 6px 8px;
  border-radius: 9px;
  text-align: right;
  border: 1px solid rgba(136, 136, 136, 0.9);
  background: rgba(136, 136, 136, 0.16);
  font-variant-numeric: tabular-nums;
}

.compare-easter-egg {
  margin: 12px 0 0;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(42, 42, 42, 0.7);
  color: rgba(255, 255, 255, 0.55);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

/* Lap sim */
.lapsim-panel {
  overflow: hidden;
}

.lapsim-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 14px;
}

@media (min-width: 1024px) {
  .lapsim-controls {
    grid-template-columns: repeat(2, 1fr);
  }
}

.lapsim-controls label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.lapsim-controls select,
.lapsim-controls input[type="range"] {
  width: 100%;
}

.lapsim-controls select {
  padding: 9px 11px;
  border-radius: 999px;
  border: 1px solid rgba(42, 42, 42, 0.9);
  background: rgba(26, 26, 26, 0.9);
  color: rgba(255, 255, 255, 0.95);
}

.lapsim-breakdown {
  margin: 0 14px 10px;
  border: 1px solid rgba(42, 42, 42, 0.85);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  padding: 10px;
  display: grid;
  gap: 6px;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(42, 42, 42, 0.6);
  padding-bottom: 6px;
}

.breakdown-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.breakdown-row strong {
  color: rgba(255, 255, 255, 0.95);
  font-variant-numeric: tabular-nums;
}

.breakdown-row.final strong {
  color: #00d2ff;
}

.lapsim-warning {
  margin: 0 14px 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.lapsim-warning.is-soft {
  color: rgba(255, 188, 120, 0.95);
}

.lapsim-track-wrap {
  margin: 0 14px 14px;
  border: 1px solid rgba(42, 42, 42, 0.85);
  border-radius: 16px;
  background: radial-gradient(120% 140% at 50% 0%, rgba(255, 255, 255, 0.05), transparent 70%),
    rgba(0, 0, 0, 0.25);
  min-height: 320px;
  display: grid;
  place-items: center;
}

.track-svg {
  width: min(92%, 480px);
  height: auto;
  overflow: visible;
}

.track-path {
  fill: none;
  stroke: rgba(220, 220, 220, 0.9);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.track-dot.main {
  fill: #00d2ff;
  animation: dot-pulse 1100ms ease-in-out infinite;
}

.lapsim-time {
  padding: 0 14px 16px;
  font-size: 15px;
  color: var(--text-muted);
}

.lapsim-time strong {
  color: #ffffff;
  font-size: 30px;
  letter-spacing: 0.02em;
}

.table-wrap {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.table thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(10, 10, 10, 0.6);
  padding: 12px 14px;
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid rgba(42, 42, 42, 0.85);
}

.th-right {
  text-align: right;
}

.table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(42, 42, 42, 0.7);
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  vertical-align: middle;
}

.table-row {
  opacity: 0;
  transform: translateY(10px);
  animation: row-in 520ms cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
  animation-delay: var(--delay, 0s);
}

.table-row:hover {
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  box-shadow: inset 4px 0 0 color-mix(in srgb, var(--accent) 90%, transparent), inset 0 0 0 9999px color-mix(in srgb, var(--accent) 3%, transparent);
}

.position {
  font-variant-numeric: tabular-nums;
  width: 60px;
  color: rgba(255, 255, 255, 0.8);
}

.points {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.team-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.92);
  font-weight: 650;
  letter-spacing: 0.2px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.team-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.team-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--team-color, var(--accent));
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 8%, transparent);
}

.leader {
  position: relative;
}

.leader td {
  border-bottom-color: color-mix(in srgb, var(--accent) 35%, transparent);
}

.leader::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(600px 220px at 10% 40%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 65%);
  animation: leader-pulse 1600ms ease-in-out infinite;
}

/* Footer */
.footer {
  border-top: 1px solid rgba(42, 42, 42, 0.85);
  padding-top: 22px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.footer strong {
  color: rgba(255, 255, 255, 0.86);
}

.site-credit-footer {
  border-top: 1px solid #2a2a2a;
  padding: 24px 20px;
  text-align: center;
}

.site-credit-footer p {
  margin: 0;
  font-size: 12px;
  color: #888888;
  line-height: 1.5;
}

.site-credit-footer a {
  color: #888888;
  text-decoration: none;
  transition: color 160ms ease;
}

.site-credit-footer a:hover {
  color: var(--accent);
}

/* DRS toggle button */
.drs-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 40;
}

.drs-btn {
  border: 1px solid rgba(42, 42, 42, 0.9);
  border-radius: 999px;
  background: rgba(26, 26, 26, 0.75);
  color: rgba(255, 255, 255, 0.9);
  padding: 10px 12px;
  display: inline-flex;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease,
    box-shadow 160ms ease;
  user-select: none;
}

.drs-btn:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
}

.drs-btn:active {
  transform: translateY(0px);
}

.drs-lamp {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.05);
  transition: background 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.drs-btn.is-on {
  border-color: color-mix(in srgb, var(--accent) 70%, transparent);
  box-shadow: 0 18px 48px color-mix(in srgb, var(--accent) 12%, transparent), 0 18px 40px rgba(0, 0, 0, 0.45);
}

.drs-btn.is-on .drs-lamp {
  background: color-mix(in srgb, var(--accent) 95%, transparent);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 14%, transparent), 0 0 18px color-mix(in srgb, var(--accent) 45%, transparent);
}

.drs-label {
  display: grid;
  gap: 1px;
  line-height: 1.1;
}

.drs-label strong {
  font-size: 12px;
  letter-spacing: 0.18em;
}

.drs-label span {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* Intro overlay */
.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  background: radial-gradient(900px 600px at 20% 20%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 55%),
    radial-gradient(900px 600px at 80% 30%, rgba(39, 244, 210, 0.08), transparent 55%),
    rgba(10, 10, 10, 0.96);
  border-bottom: 1px solid rgba(42, 42, 42, 0.85);
}

.intro-overlay.is-active {
  display: grid;
}

.intro-inner {
  width: min(860px, calc(100% - 44px));
  display: grid;
  place-items: center;
  gap: 18px;
  text-align: center;
}

.intro-wheel {
  width: min(240px, 60vw);
  height: auto;
  filter: drop-shadow(0 18px 60px rgba(0, 0, 0, 0.55));
  transform-origin: 50% 50%;
  animation: wheel-startup 1800ms cubic-bezier(0.2, 0.95, 0.2, 1) forwards;
}

.intro-title {
  margin: 0;
  font-size: clamp(20px, 3.4vw, 30px);
  letter-spacing: 0.3px;
}

.intro-title span {
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.intro-hint {
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
}

.intro-overlay.is-fading {
  animation: intro-fade 520ms ease forwards;
}

/* Keyframes */
@keyframes section-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0px);
  }
}

@keyframes row-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0px);
  }
}

@keyframes speedline {
  0% {
    transform: translateX(0) skewX(-22deg);
    opacity: 0.1;
  }
  20% {
    opacity: 0.65;
  }
  100% {
    transform: translateX(-35%) skewX(-22deg);
    opacity: 0.05;
  }
}

@keyframes leader-pulse {
  0%,
  100% {
    opacity: 0.65;
  }
  50% {
    opacity: 1;
  }
}

@keyframes wheel-startup {
  0% {
    transform: rotate(0deg) scale(0.9);
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  40% {
    transform: rotate(720deg) scale(1);
  }
  70% {
    transform: rotate(980deg) scale(1);
  }
  100% {
    transform: rotate(1080deg) scale(1);
  }
}

@keyframes intro-fade {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

@keyframes dot-pulse {
  0%,
  100% {
    r: 4.6;
    opacity: 0.85;
  }
  50% {
    r: 5.6;
    opacity: 1;
  }
}

.intro-wheel-accent {
  fill: color-mix(in srgb, var(--accent) 90%, transparent);
}

/* Live data loading overlay */
.data-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: grid;
  place-items: center;
  background: rgba(10, 10, 10, 0.72);
  backdrop-filter: blur(4px);
}

.data-loading-overlay[hidden] {
  display: none;
}

.data-loading-card {
  display: grid;
  gap: 14px;
  place-items: center;
  padding: 22px 26px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(42, 42, 42, 0.95);
  background: rgba(20, 20, 20, 0.96);
  box-shadow: var(--shadow);
}

.data-loading-card p {
  margin: 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.82);
  letter-spacing: 0.04em;
}

.data-loading-ring {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  animation: data-spin 800ms linear infinite;
}

@keyframes data-spin {
  to {
    transform: rotate(360deg);
  }
}

body.no-animations .data-loading-ring {
  animation: none;
  border-top-color: var(--accent);
}

/* Race Center (live.html) */
.live-session-banner {
  margin-bottom: 16px;
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-session-banner.is-loading {
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 13px;
}

.live-session-banner.is-idle {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #a8a8a8;
}

.live-session-info-icon {
  flex: 0 0 auto;
  color: #888888;
}

.live-session-idle-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #a8a8a8;
}

.live-session-idle-text strong {
  color: #d0d0d0;
  font-weight: 600;
}

.live-session-next {
  display: block;
  margin-top: 4px;
  color: #888888;
  font-size: 13px;
}

.live-session-banner.is-live {
  justify-content: center;
  gap: 10px;
  background: rgba(62, 207, 142, 0.1);
  border: 1px solid rgba(62, 207, 142, 0.35);
  box-shadow: 0 0 24px rgba(62, 207, 142, 0.08);
}

.live-session-live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3ecf8e;
  box-shadow: 0 0 12px rgba(62, 207, 142, 0.7);
  animation: live-pulse 1.6s ease-in-out infinite;
}

.live-session-live-label {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: #3ecf8e;
}

.live-session-live-detail {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
}

@keyframes live-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.55;
    transform: scale(0.92);
  }
}

body.no-animations .live-session-live-dot {
  animation: none;
}

.live-status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(42, 42, 42, 0.9);
  background: rgba(20, 20, 20, 0.88);
}

.live-mode-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.live-mode-badge.is-live {
  color: #fff;
  background: color-mix(in srgb, var(--accent) 85%, transparent);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 35%, transparent);
}

.live-mode-badge.is-replay {
  color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.08);
}

.live-refresh-countdown {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.9);
}

.live-last-updated {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.live-info-card {
  margin-top: 0;
}

.live-info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 16px;
}

@media (min-width: 1024px) {
  .live-info-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.live-table .live-gap {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

.live-table .live-lap-time {
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.9);
}

.live-row-leader {
  background: linear-gradient(
    90deg,
    rgba(212, 175, 55, 0.22),
    rgba(212, 175, 55, 0.06) 55%,
    transparent
  ) !important;
}

.live-row-leader td {
  border-bottom-color: rgba(212, 175, 55, 0.35) !important;
}

.live-row-leader .position {
  color: #e8c84a;
  font-weight: 800;
}

.live-row-pitted {
  box-shadow: inset 4px 0 0 var(--team-color, var(--accent));
  background: color-mix(in srgb, var(--team-color, var(--accent)) 8%, rgba(26, 26, 26, 0.2));
}

.tyre-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.tyre-soft {
  background: rgba(225, 6, 0, 0.2);
  color: #ff8a80;
}

.tyre-medium {
  background: rgba(255, 214, 0, 0.16);
  color: #ffe566;
}

.tyre-hard {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
}

.tyre-inter {
  background: rgba(82, 226, 82, 0.16);
  color: #8df58d;
}

.tyre-wet {
  background: rgba(100, 196, 255, 0.16);
  color: #8fd0ff;
}

.tyre-unknown {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.live-fastest-wrap {
  padding: 14px;
}

.fastest-lap-board {
  display: grid;
  gap: 8px;
  padding: 18px 16px;
  border-radius: 12px;
  background: #9b59b6;
  color: #fff;
  box-shadow: 0 16px 40px rgba(155, 89, 182, 0.28);
}

.fastest-lap-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  opacity: 0.92;
}

.fastest-lap-time {
  font-size: clamp(28px, 5vw, 38px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.fastest-lap-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 13px;
  opacity: 0.95;
}

.live-dnf-reason {
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  line-height: 1.45;
}

.live-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 18px 12px;
  font-size: 13px;
}

.live-error-panel {
  padding: 18px;
}

/* Theme switcher */
.theme-switcher,
#theme-switcher-mount {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 9999;
}

.theme-tyre-btn {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  transition: transform 160ms ease;
}

.theme-tyre-btn:hover {
  transform: translateY(-2px);
}

.theme-tyre-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.theme-tyre {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #0d0d0d;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  transform-origin: 50% 50%;
  pointer-events: none;
}

.theme-tyre-rubber,
.theme-tyre-rim,
.theme-tyre-hub {
  pointer-events: none;
}

.theme-tyre-btn:hover .theme-tyre {
  animation: tyre-spin 900ms ease-in-out;
}

.theme-tyre-rubber {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 7px solid #4a4a4a;
  box-shadow:
    inset 0 0 0 2px #2a2a2a,
    inset 0 0 12px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.04);
}

.theme-tyre-rim {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: linear-gradient(145deg, #9a9a9a, #3d3d3d 55%, #6f6f6f);
  border: 2px solid #b8b8b8;
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.18),
    inset 0 -3px 6px rgba(0, 0, 0, 0.45);
}

.theme-tyre-hub {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #151515;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.theme-panel {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 0;
  width: min(280px, calc(100vw - 28px));
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(42, 42, 42, 0.95);
  background: rgba(20, 20, 20, 0.96);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity 240ms ease, transform 240ms ease;
}

.theme-switcher.is-open .theme-panel {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.theme-panel-title {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.theme-options {
  display: grid;
  gap: 6px;
  max-height: min(52vh, 360px);
  overflow-y: auto;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid rgba(42, 42, 42, 0.9);
  background: rgba(26, 26, 26, 0.7);
  color: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  text-align: left;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.theme-option:hover {
  transform: translateX(2px);
  border-color: color-mix(in srgb, var(--theme-glow) 55%, transparent);
  background: color-mix(in srgb, var(--theme-glow) 10%, rgba(26, 26, 26, 0.7));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--theme-glow) 35%, transparent),
    0 0 18px color-mix(in srgb, var(--theme-glow) 22%, transparent);
}

.theme-option.is-active {
  border-color: color-mix(in srgb, var(--theme-glow) 70%, transparent);
  background: color-mix(in srgb, var(--theme-glow) 14%, rgba(26, 26, 26, 0.7));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--theme-glow) 40%, transparent);
}

.theme-swatch {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.theme-swatch-primary,
.theme-swatch-secondary {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.theme-option-label {
  font-size: 13px;
  line-height: 1.2;
}

@keyframes tyre-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

body.no-animations .theme-tyre-btn:hover .theme-tyre {
  animation: none;
}

body.no-animations .theme-panel {
  transition: none;
}

/* ── Non-desktop responsive layout (< 1024px) ─────────────────────────────── */

@media (max-width: 1023px) {
  .container {
    width: min(var(--container), calc(100% - 24px));
  }

  .nav-inner {
    width: min(var(--container), calc(100% - 24px));
    padding: 12px 0;
    gap: 12px;
  }

  .brand-logo {
    height: 46px;
    width: auto;
  }

  /* Hamburger menu — top right, F1 red. */
  .nav-toggle {
    display: flex;
  }

  .nav.is-open .nav-toggle {
    background: color-mix(in srgb, var(--accent) 28%, rgba(20, 20, 20, 0.95));
  }

  .nav-links {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 30;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(42, 42, 42, 0.95);
    background: rgba(14, 14, 14, 0.98);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  }

  .nav.is-open .nav-links {
    display: flex;
  }

  .nav-link {
    width: 100%;
    text-align: center;
    padding: 11px 14px;
    font-size: 13px;
  }

  .lang-switcher {
    width: 100%;
  }

  .lang-switcher-btn {
    width: 100%;
    justify-content: center;
    padding: 11px 14px;
  }

  .lang-switcher-panel {
    position: static;
    width: 100%;
    margin-top: 4px;
    box-shadow: none;
    border: 1px solid rgba(42, 42, 42, 0.75);
    background: rgba(20, 20, 20, 0.95);
  }

  /* Fixed controls: tyre bottom-left, DRS bottom-right — never overlap nav. */
  .drs-toggle {
    top: auto;
    bottom: max(18px, env(safe-area-inset-bottom, 0px));
    right: max(14px, env(safe-area-inset-right, 0px));
    left: auto;
    z-index: 50;
  }

  .drs-btn {
    padding: 8px 11px;
    gap: 8px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
  }

  .drs-lamp {
    width: 10px;
    height: 10px;
  }

  .drs-label strong {
    font-size: 11px;
    letter-spacing: 0.14em;
  }

  .drs-label span {
    font-size: 10px;
  }

  .theme-switcher,
  #theme-switcher-mount {
    top: auto;
    bottom: max(18px, env(safe-area-inset-bottom, 0px));
    left: max(14px, env(safe-area-inset-left, 0px));
    right: auto;
    z-index: 50;
  }

  .theme-tyre-btn {
    width: 48px;
    height: 48px;
  }

  .theme-tyre {
    width: 46px;
    height: 46px;
  }

  .theme-tyre-rubber {
    border-width: 6px;
  }

  .theme-tyre-rim {
    width: 26px;
    height: 26px;
  }

  /* Theme panel opens upward and stays within viewport. */
  .theme-panel {
    bottom: calc(100% + 10px);
    top: auto;
    left: 0;
    right: auto;
    width: min(268px, calc(100vw - 28px));
    max-height: min(46vh, 320px);
    transform: translateY(10px);
  }

  .theme-switcher.is-open .theme-panel {
    transform: translateY(0);
  }

  .theme-options {
    max-height: min(40vh, 280px);
  }

  /* Tables scroll horizontally — never clip off-screen. */
  .table-wrap {
    margin: 0 -2px;
    padding-bottom: 2px;
  }

  .table {
    min-width: 560px;
  }

  .live-table {
    min-width: 680px;
  }

  /* Card grids stay single column below 1024px (see min-width breakpoints). */
  .teams-grid,
  .drivers-grid,
  .compare-cards,
  .compare-controls,
  .lapsim-controls,
  .grid-2,
  .hero-stats,
  .live-info-grid {
    grid-template-columns: 1fr;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .section-title {
    font-size: 20px;
  }

  .section-subtitle {
    font-size: 12px;
  }

  .hero-title {
    font-size: clamp(24px, 6vw, 36px);
  }

  .hero-subtitle {
    font-size: 13px;
  }

  .hero-kicker {
    font-size: 11px;
  }

  .panel-title {
    font-size: 15px;
  }

  .team-header h2,
  .driver-card h2 {
    font-size: 20px;
  }

  .team-info p {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .compare-row {
    grid-template-columns: minmax(100px, 120px) 1fr 1fr;
    gap: 8px;
    font-size: 13px;
  }

  .lapsim-time strong {
    font-size: 26px;
  }

  .live-status-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .fastest-lap-time {
    font-size: 28px;
  }

  /* Clearance for bottom fixed controls. */
  body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }
}

/* Phone — extra compact sizing (375px target). */
@media (max-width: 767px) {
  .nav-inner {
    padding: 10px 0;
  }

  .brand-logo {
    height: 42px;
    width: auto;
  }

  .nav-toggle {
    width: 40px;
    height: 40px;
  }

  .nav-toggle-bar {
    width: 16px;
  }

  .nav-link {
    font-size: 14px;
  }

  .drs-toggle {
    bottom: max(14px, env(safe-area-inset-bottom, 0px));
    right: max(10px, env(safe-area-inset-right, 0px));
  }

  .drs-btn {
    padding: 7px 9px;
    gap: 6px;
  }

  .drs-label span {
    display: none;
  }

  .theme-switcher,
  #theme-switcher-mount {
    bottom: max(14px, env(safe-area-inset-bottom, 0px));
    left: max(10px, env(safe-area-inset-left, 0px));
  }

  .theme-tyre-btn {
    width: 42px;
    height: 42px;
  }

  .theme-tyre {
    width: 40px;
    height: 40px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  }

  .theme-tyre-rubber {
    border-width: 5px;
  }

  .theme-tyre-rim {
    width: 22px;
    height: 22px;
  }

  .theme-tyre-hub {
    width: 8px;
    height: 8px;
  }

  .theme-panel {
    width: min(248px, calc(100vw - 20px));
    max-height: min(40vh, 260px);
    padding: 12px;
  }

  .theme-options {
    max-height: min(34vh, 220px);
  }

  .theme-option {
    padding: 8px 9px;
  }

  .theme-option-label {
    font-size: 12px;
  }

  .section-title {
    font-size: 18px;
  }

  .hero-title {
    font-size: clamp(22px, 7vw, 30px);
  }

  .hero-subtitle {
    font-size: 12px;
  }

  .stat-value {
    font-size: 16px;
  }

  .team-header h2,
  .driver-card h2 {
    font-size: 18px;
  }

  .panel-title {
    font-size: 14px;
  }

  .lapsim-time strong {
    font-size: 22px;
  }

  .compare-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(42, 42, 42, 0.6);
  }

  .compare-label {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.88);
  }

  .compare-value {
    display: block;
    text-align: left;
    font-size: 12px;
  }

  body {
    padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  }
}

/* Reduced motion should default to no animations even before JS runs. */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
