/* ==========================================================================
   F1 MINIMAL PIXEL EDITION 2026 - MODERN RETRO 16-BIT DESIGN SYSTEM
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Press+Start+2P&family=Silkscreen:wght@400;700&display=swap');

:root {
  /* Core Dark Palette */
  --bg-deep: #060709;
  --bg-card: #0c0e14;
  --bg-card-hover: #12151e;
  --bg-surface: #151922;
  --bg-input: #08090d;
  
  /* Neon & Accent Colors */
  --neon-cyan: #00D2BE;
  --neon-red: #E80020;
  --neon-orange: #FF8000;
  --neon-blue: #3874ff;
  --neon-gold: #FFD700;
  --neon-silver: #D1D5DB;
  --neon-bronze: #CD7F32;
  --neon-green: #00E700;

  /* Text Colors */
  --text-main: #F3F4F6;
  --text-muted: #8E95A5;
  --text-dim: #545B6D;
  --text-pixel: #00D2BE;

  /* Borders & Grid */
  --border-subtle: #1c212c;
  --border-pixel: #2a3142;
  --border-accent: #00D2BE;
  --grid-line: rgba(255, 255, 255, 0.03);

  /* Fonts */
  --font-body: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-pixel: 'Press Start 2P', monospace;
  --font-retro: 'Silkscreen', monospace;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  --transition-smooth: 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Base Reset & CRT Scanline */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  background-image: 
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* Retro Pixel Scanline Overlay (Toggleable) */
.scanline-overlay {
  pointer-events: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
  background-size: 100% 4px;
  opacity: 0.35;
  display: block;
}

body.no-scanlines .scanline-overlay {
  display: none;
}

/* ==========================================================================
   HEADER & HERO HUD
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(6, 7, 9, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 2px solid var(--border-pixel);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  max-width: 1400px;
  margin: 0 auto;
}

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

.brand-logo-pixel {
  width: 44px;
  height: 44px;
  background: #000;
  border: 2px solid var(--neon-cyan);
  box-shadow: 0 0 10px rgba(0, 210, 190, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.brand-logo-pixel span {
  font-family: var(--font-pixel);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--neon-red);
  text-shadow: 2px 2px 0 #fff;
}

.brand-titles h1 {
  font-family: var(--font-retro);
  font-size: 1.15rem;
  letter-spacing: 1px;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-pixel-year {
  font-family: var(--font-pixel);
  font-size: 0.65rem;
  background: var(--neon-red);
  color: #fff;
  padding: 3px 6px;
  border: 1px solid #fff;
  box-shadow: 2px 2px 0 #000;
}

.brand-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* API & Sound Status Badges */
.api-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0b111a;
  border: 1px solid var(--border-pixel);
  padding: 6px 12px;
  border-radius: 4px;
  font-family: var(--font-retro);
  font-size: 0.75rem;
}

.api-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #666;
  box-shadow: 0 0 4px #666;
}

.api-badge.live .api-led {
  background: var(--neon-cyan);
  box-shadow: 0 0 8px var(--neon-cyan);
  animation: pulse-led 2s infinite;
}

.api-badge.cached .api-led {
  background: var(--neon-orange);
  box-shadow: 0 0 8px var(--neon-orange);
}

@keyframes pulse-led {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.btn-icon-retro {
  background: var(--bg-card);
  border: 2px solid var(--border-pixel);
  color: var(--text-main);
  padding: 6px 10px;
  font-family: var(--font-retro);
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.btn-icon-retro:hover {
  background: var(--bg-card-hover);
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
}

/* Navigation Tabs */
.header-nav {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  gap: 4px;
  overflow-x: auto;
}

.nav-tab {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-retro);
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  padding: 12px 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.nav-tab:hover {
  color: #fff;
  border-bottom-color: rgba(0, 210, 190, 0.4);
}

.nav-tab.active {
  color: var(--neon-cyan);
  border-bottom-color: var(--neon-cyan);
  background: linear-gradient(to top, rgba(0, 210, 190, 0.08), transparent);
}

.tab-icon {
  font-size: 1rem;
}

/* ==========================================================================
   HERO BANNER & LIVE TRACK TICKER
   ========================================================================== */

.hero-hud {
  max-width: 1400px;
  margin: 20px auto;
  padding: 0 24px;
}

.hero-banner {
  background: linear-gradient(135deg, #090e18 0%, #06070a 100%);
  border: 2px solid var(--border-pixel);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.hero-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--neon-red), var(--neon-cyan), var(--neon-orange), var(--neon-blue));
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  align-items: center;
}

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }
}

.hero-content h2 {
  font-family: var(--font-retro);
  font-size: 1.4rem;
  letter-spacing: 0.5px;
  color: #fff;
  margin-bottom: 8px;
}

.hero-content p {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 580px;
  margin-bottom: 16px;
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-pixel);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chip-label {
  color: var(--text-dim);
  font-family: var(--font-retro);
  font-size: 0.7rem;
}

.chip-val {
  font-weight: 700;
  color: #fff;
}

/* Next Race Countdown Card */
.next-race-card {
  background: #080b12;
  border: 2px solid var(--border-pixel);
  padding: 18px 20px;
  border-radius: 6px;
  position: relative;
  box-shadow: inset 0 0 20px rgba(0, 210, 190, 0.05);
}

.next-race-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.tag-next-gp {
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  background: var(--neon-cyan);
  color: #000;
  padding: 4px 8px;
  border-radius: 2px;
  font-weight: 700;
}

.next-circuit-info {
  margin-bottom: 14px;
}

.next-gp-title {
  font-family: var(--font-retro);
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.next-gp-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Digital Countdown Grid */
.countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.countdown-box {
  background: #040507;
  border: 1px solid var(--border-pixel);
  border-bottom: 3px solid var(--neon-cyan);
  padding: 8px 4px;
  text-align: center;
  border-radius: 3px;
}

.countdown-num {
  font-family: var(--font-pixel);
  font-size: 1.3rem;
  color: #fff;
  text-shadow: 0 0 10px rgba(0, 210, 190, 0.6);
  line-height: 1.2;
}

.countdown-unit {
  font-family: var(--font-retro);
  font-size: 0.6rem;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* Next GP Weekend Sessions Schedule (Polish Time) */
.next-gp-sessions {
  margin-top: 14px;
  border-top: 1px solid var(--border-pixel);
  padding-top: 12px;
}

.sessions-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.sessions-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sessions-badge-flag {
  font-size: 0.95rem;
}

.sessions-header-title {
  font-family: var(--font-retro);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

.sessions-type-badge {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  padding: 3px 6px;
  border-radius: 2px;
  background: #000;
  border: 1px solid var(--border-pixel);
  color: var(--neon-cyan);
}

.sessions-type-badge.sprint-active {
  background: rgba(255, 128, 0, 0.15);
  border-color: var(--neon-orange);
  color: var(--neon-orange);
  box-shadow: 0 0 8px rgba(255, 128, 0, 0.3);
}

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

@media (max-width: 500px) {
  .sessions-grid {
    grid-template-columns: 1fr;
  }
}

.session-item {
  background: #040609;
  border: 1px solid var(--border-pixel);
  border-radius: 4px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.session-item:hover {
  border-color: var(--neon-cyan);
  background: #060910;
}

.session-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.session-icon {
  font-size: 0.85rem;
}

.session-name {
  font-family: var(--font-retro);
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
}

.session-timing {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.session-date {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.session-time {
  font-family: var(--font-pixel);
  font-size: 0.72rem;
  color: var(--neon-cyan);
  letter-spacing: 0.5px;
}

/* Highlight for Sprint */
.session-item.session-sprint {
  border-color: rgba(255, 128, 0, 0.4);
  background: rgba(255, 128, 0, 0.05);
}
.session-item.session-sprint .session-time {
  color: var(--neon-orange);
}

/* Highlight for Main Grand Prix Race */
.session-item.session-race {
  grid-column: 1 / -1;
  border: 1px solid rgba(255, 215, 0, 0.5);
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.08) 0%, rgba(0, 210, 190, 0.05) 100%);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.15);
  padding: 9px 12px;
}

.session-item.session-race .session-name {
  color: var(--neon-gold);
  font-size: 0.82rem;
}

.session-item.session-race .session-time {
  color: var(--neon-gold);
  font-size: 0.85rem;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

/* Retro Pit Lane / Track Animation Bar */
.retro-track-bar {
  margin-top: 22px;
  background: #06070a;
  border: 2px solid var(--border-pixel);
  border-radius: 6px;
  position: relative;
  overflow: hidden;
  height: 86px;
  display: flex;
  align-items: center;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.85);
}

/* Red & White Retro Racing Kerbs */
.track-curbs-top,
.track-curbs-bottom {
  position: absolute;
  left: 0;
  right: 0;
  height: 6px;
  background: repeating-linear-gradient(90deg, #E80020 0px, #E80020 16px, #FFFFFF 16px, #FFFFFF 32px);
  z-index: 2;
}

.track-curbs-top {
  top: 0;
  border-bottom: 1px solid #000;
}

.track-curbs-bottom {
  bottom: 0;
  border-top: 1px solid #000;
}

.track-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.2) 0px, rgba(255, 255, 255, 0.2) 12px, transparent 12px, transparent 24px);
  z-index: 1;
}

/* The Convoy Container */
.cartoon-grid-train {
  display: flex;
  align-items: center;
  gap: 0;
  position: absolute;
  left: 0;
  top: 8px;
  z-index: 5;
  white-space: nowrap;
  animation: drive-convoy 60s linear infinite;
  will-change: transform;
}

.retro-track-bar:hover .cartoon-grid-train {
  animation-play-state: paused;
}

.convoy-spacer {
  flex-shrink: 0;
  width: 1400px;
  height: 1px;
  display: inline-block;
  pointer-events: none;
}

.cartoon-car-wrapper {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  animation: car-bounce 0.35s ease-in-out infinite alternate;
}

.cartoon-car-wrapper:nth-child(even) {
  animation-duration: 0.38s;
  animation-delay: -0.15s;
}

.cartoon-pos-tag {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  background: #000;
  color: var(--neon-cyan);
  padding: 1px 5px;
  border: 1px solid var(--border-pixel);
  border-radius: 2px;
  letter-spacing: 0.5px;
}

.cartoon-pos-tag.p1 {
  color: var(--neon-gold);
  border-color: var(--neon-gold);
  box-shadow: 0 0 6px rgba(255, 215, 0, 0.4);
}

.cartoon-car-svg {
  width: 82px;
  height: 54px;
  image-rendering: pixelated;
  shape-rendering: crispEdges;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.7));
}

@keyframes car-bounce {
  0% { transform: translateY(0); }
  100% { transform: translateY(-2px); }
}

@keyframes drive-convoy {
  0% { transform: translateX(-50%); }
  100% { transform: translateX(0%); }
}

/* ==========================================================================
   MAIN CONTENT CONTAINER & SECTIONS
   ========================================================================== */

.main-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

.content-section {
  display: none;
  animation: fadeIn 0.3s ease forwards;
}

.content-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-pixel);
  padding-bottom: 14px;
  flex-wrap: wrap;
  gap: 16px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title h2 {
  font-family: var(--font-retro);
  font-size: 1.3rem;
  letter-spacing: 0.5px;
  color: #fff;
}

.section-badge {
  font-family: var(--font-pixel);
  font-size: 0.65rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-pixel);
  color: var(--neon-cyan);
  padding: 4px 8px;
  border-radius: 2px;
}

/* Filters & Controls */
.filter-group {
  display: flex;
  gap: 6px;
  background: var(--bg-card);
  padding: 4px;
  border: 1px solid var(--border-pixel);
  border-radius: 4px;
}

.btn-filter {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-retro);
  font-size: 0.78rem;
  padding: 6px 14px;
  cursor: pointer;
  border-radius: 2px;
  transition: var(--transition-fast);
}

.btn-filter:hover {
  color: #fff;
}

.btn-filter.active {
  background: var(--bg-surface);
  color: var(--neon-cyan);
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   SECTION 1: RACE CALENDAR & RESULTS (CARDS & PODIUM)
   ========================================================================== */

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(390px, 1fr));
  gap: 20px;
}

@media (max-width: 480px) {
  .calendar-grid {
    grid-template-columns: 1fr;
  }
}

.race-card {
  background: var(--bg-card);
  border: 1px solid var(--border-pixel);
  border-radius: 6px;
  padding: 18px;
  position: relative;
  transition: var(--transition-normal);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.race-card:hover {
  background: var(--bg-card-hover);
  border-color: #3b455b;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.race-card.completed {
  border-left: 3px solid #2e384d;
}

.race-card.upcoming-highlight {
  border: 2px solid var(--neon-cyan);
  box-shadow: 0 0 15px rgba(0, 210, 190, 0.25);
  background: linear-gradient(145deg, #0c121e 0%, #080a10 100%);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.round-flag-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.round-pill {
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  background: #000;
  border: 1px solid var(--border-pixel);
  color: #fff;
  padding: 4px 6px;
}

.race-flag-pixel {
  width: 26px;
  height: 17px;
  display: inline-block;
  vertical-align: middle;
}

.status-badge-retro {
  font-family: var(--font-retro);
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-badge-retro.completed {
  background: rgba(46, 56, 77, 0.4);
  color: var(--text-muted);
  border: 1px solid #2e384d;
}

.status-badge-retro.next {
  background: rgba(0, 210, 190, 0.15);
  color: var(--neon-cyan);
  border: 1px solid var(--neon-cyan);
  font-weight: 700;
}

.status-badge-retro.upcoming {
  background: rgba(255, 128, 0, 0.15);
  color: var(--neon-orange);
  border: 1px solid rgba(255, 128, 0, 0.4);
}

.race-headline {
  margin-bottom: 14px;
}

.race-title-text {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 3px;
}

.race-sub-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* PODIUM POD BOX (Top 3 with Gold, Silver, Bronze) */
.podium-box {
  background: #08090e;
  border: 1px solid var(--border-pixel);
  border-radius: 4px;
  padding: 10px 12px;
  margin-top: 10px;
}

.podium-title {
  font-family: var(--font-retro);
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
  display: flex;
  justify-content: space-between;
}

.podium-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.podium-row:last-child {
  border-bottom: none;
}

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

.trophy-icon-wrap {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.trophy-icon-wrap svg {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  shape-rendering: crispEdges;
}

.podium-driver-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.podium-helmet-wrap {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
}

.podium-helmet-wrap svg {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  shape-rendering: crispEdges;
}

.podium-driver-code {
  font-family: var(--font-retro);
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.podium-driver-name {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.podium-team-tag {
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 2px;
  font-weight: 600;
  font-family: var(--font-body);
}

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

.podium-time {
  font-family: var(--font-retro);
  font-size: 0.8rem;
  color: var(--neon-cyan);
  background: #06080d;
  padding: 4px 8px;
  border-radius: 3px;
  border: 1px solid var(--border-pixel);
}

@media (max-width: 480px) {
  .podium-helmet-wrap {
    width: 38px;
    height: 38px;
  }
  .podium-driver-name {
    display: none;
  }
}

/* Upcoming Race Details in Card */
.upcoming-details-box {
  background: #080a10;
  border: 1px dashed var(--border-pixel);
  padding: 12px;
  border-radius: 4px;
  margin-top: 10px;
  text-align: center;
}

.upcoming-date-badge {
  font-family: var(--font-retro);
  font-size: 0.82rem;
  color: var(--neon-cyan);
  margin-bottom: 6px;
}

.upcoming-timer-small {
  font-family: var(--font-pixel);
  font-size: 0.75rem;
  color: #fff;
}

/* ==========================================================================
   SECTION 2: STANDINGS (DRIVERS & CONSTRUCTORS)
   ========================================================================== */

.standings-toggle-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.standings-tabs {
  display: inline-flex;
  background: var(--bg-card);
  border: 2px solid var(--border-pixel);
  padding: 4px;
  border-radius: 4px;
}

.standings-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-retro);
  font-size: 0.85rem;
  padding: 8px 24px;
  cursor: pointer;
  border-radius: 2px;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 8px;
}

.standings-tab-btn:hover {
  color: #fff;
}

.standings-tab-btn.active {
  background: var(--neon-cyan);
  color: #000;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 210, 190, 0.4);
}

.standings-container {
  display: none;
}

.standings-container.active {
  display: block;
}

/* Retro Standings Table / List */
.standings-grid-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.standing-card {
  background: var(--bg-card);
  border: 1px solid var(--border-pixel);
  border-radius: 4px;
  padding: 14px 20px;
  display: grid;
  grid-template-columns: 50px 64px 1fr 140px 100px;
  align-items: center;
  gap: 18px;
  transition: var(--transition-fast);
  position: relative;
  overflow: hidden;
}

@media (max-width: 768px) {
  .standing-card {
    grid-template-columns: 36px 52px 1fr 80px;
    gap: 12px;
    padding: 10px 12px;
  }
  .standing-wins-col {
    display: none;
  }
}

.standing-card:hover {
  background: var(--bg-card-hover);
  border-color: #3f4961;
  transform: translateX(4px);
}

.standing-card.p1 {
  border-color: rgba(255, 215, 0, 0.5);
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.08) 0%, var(--bg-card) 40%);
}

.standing-card.p2 {
  border-color: rgba(209, 213, 219, 0.4);
}

.standing-card.p3 {
  border-color: rgba(205, 127, 50, 0.4);
}

.standing-pos {
  font-family: var(--font-pixel);
  font-size: 0.95rem;
  color: var(--text-muted);
  text-align: center;
}

.standing-card.p1 .standing-pos {
  color: var(--neon-gold);
}

.standing-card.p2 .standing-pos {
  color: var(--neon-silver);
}

.standing-card.p3 .standing-pos {
  color: var(--neon-bronze);
}

.standing-avatar-box {
  width: 62px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.standing-avatar-box svg {
  width: 58px;
  height: 58px;
  image-rendering: pixelated;
  shape-rendering: crispEdges;
}

.standing-main-info {
  display: flex;
  flex-direction: column;
}

.standing-driver-name {
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.standing-driver-num {
  font-family: var(--font-pixel);
  font-size: 0.65rem;
  color: var(--text-dim);
}

.standing-team-name {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.team-color-indicator {
  width: 8px;
  height: 8px;
  border-radius: 1px;
}

.standing-wins-col {
  font-family: var(--font-retro);
  font-size: 0.8rem;
  color: var(--text-dim);
}

.standing-pts-col {
  text-align: right;
}

.standing-pts-val {
  font-family: var(--font-pixel);
  font-size: 1.05rem;
  color: #fff;
}

.standing-pts-label {
  font-family: var(--font-retro);
  font-size: 0.65rem;
  color: var(--text-dim);
}

/* Constructor Card Specifics */
.constructor-card {
  grid-template-columns: 50px 174px 1fr 120px 100px;
  gap: 18px;
}

@media (max-width: 900px) {
  .constructor-card {
    grid-template-columns: 36px 130px 1fr 80px;
    gap: 12px;
  }
}

@media (max-width: 600px) {
  .constructor-card {
    grid-template-columns: 32px 110px 1fr 70px;
    gap: 8px;
  }
}

.constructor-car-box {
  width: 168px;
  height: 56px;
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .constructor-car-box {
    width: 120px;
    height: 40px;
  }
}

@media (max-width: 600px) {
  .constructor-car-box {
    width: 105px;
    height: 35px;
  }
}

.constructor-car-box svg {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  shape-rendering: crispEdges;
  transform: scaleX(-1);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.7));
}

/* ==========================================================================
   SECTION 3: INTERACTIVE RACE PROGRESSION & BAR CHART RACE
   ========================================================================== */

.progression-dashboard {
  background: var(--bg-card);
  border: 2px solid var(--border-pixel);
  border-radius: 8px;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.progression-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-pixel);
}

.race-status-hud {
  display: flex;
  align-items: center;
  gap: 16px;
}

.round-lcd-box {
  background: #000;
  border: 2px solid var(--neon-cyan);
  padding: 8px 16px;
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(0, 210, 190, 0.3);
}

.round-lcd-title {
  font-family: var(--font-retro);
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
}

.round-lcd-val {
  font-family: var(--font-pixel);
  font-size: 1.15rem;
  color: var(--neon-cyan);
  letter-spacing: 1px;
}

.race-details-hud {
  display: flex;
  flex-direction: column;
}

.race-name-hud {
  font-family: var(--font-retro);
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
}

.race-winner-banner {
  font-size: 0.85rem;
  color: var(--neon-gold);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Animation Controls Bar */
.animation-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-ctrl {
  background: var(--bg-surface);
  border: 1px solid var(--border-pixel);
  color: #fff;
  font-family: var(--font-retro);
  font-size: 0.8rem;
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.btn-ctrl:hover {
  background: var(--bg-card-hover);
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
}

.btn-ctrl.primary {
  background: var(--neon-cyan);
  border-color: var(--neon-cyan);
  color: #000;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(0, 210, 190, 0.4);
}

.btn-ctrl.primary:hover {
  background: #26ffe6;
}

/* Speed Selector */
.speed-selector {
  display: flex;
  background: #000;
  border: 1px solid var(--border-pixel);
  border-radius: 4px;
  overflow: hidden;
}

.btn-speed {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-retro);
  font-size: 0.75rem;
  padding: 8px 10px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-speed.active {
  background: var(--bg-surface);
  color: var(--neon-cyan);
  font-weight: 700;
}

/* Round Slider / Scrubber */
.round-scrubber-wrap {
  margin: 16px 0 24px;
}

.round-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  background: #040507;
  border: 1px solid var(--border-pixel);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

.round-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  background: var(--neon-cyan);
  border: 2px solid #fff;
  border-radius: 2px;
  box-shadow: 0 0 8px var(--neon-cyan);
  cursor: grab;
}

.round-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background: var(--neon-cyan);
  border: 2px solid #fff;
  border-radius: 2px;
  box-shadow: 0 0 8px var(--neon-cyan);
  cursor: grab;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-family: var(--font-retro);
  font-size: 0.65rem;
  color: var(--text-dim);
}

/* Visualization Toggle (Bar Race vs Line Chart) */
.view-switch-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.view-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-pixel);
  color: var(--text-muted);
  font-family: var(--font-retro);
  font-size: 0.8rem;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
}

.view-btn.active {
  background: #000;
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
}

/* BAR CHART RACE CONTAINER */
.bar-chart-race-container {
  display: block;
  position: relative;
  min-height: 680px;
  height: 680px;
  width: 100%;
}

.race-driver-row {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 58px;
  display: grid;
  grid-template-columns: 36px 96px 1fr 90px;
  align-items: center;
  gap: 14px;
  background: #08090f;
  border: 1px solid var(--border-pixel);
  border-radius: 4px;
  padding: 6px 14px;
  box-sizing: border-box;
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.2s ease, border-color 0.2s ease;
  will-change: transform;
}

.race-driver-row.p1 {
  border-color: rgba(255, 215, 0, 0.4);
}

.race-rank-badge {
  font-family: var(--font-pixel);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.race-driver-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.race-driver-meta .pixel-helmet {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  image-rendering: pixelated;
  shape-rendering: crispEdges;
}

.race-driver-code {
  font-family: var(--font-retro);
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
}

/* The Animated Bar with Pixel Car Driving on it */
.race-bar-track {
  width: 100%;
  height: 38px;
  background: #030406;
  border: 1px solid #1a1e28;
  border-radius: 3px;
  position: relative;
  overflow: visible;
  display: flex;
  align-items: center;
}

.race-bar-fill {
  height: 100%;
  background: var(--neon-cyan);
  border-radius: 2px 0 0 2px;
  transition: width 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
}

/* Animated Pixel Runner at the tip of the bar */
.race-bar-tip-runner {
  position: absolute;
  right: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 40px;
  z-index: 10;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.85));
  transition: right 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.pixel-runner-svg {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  shape-rendering: crispEdges;
  animation: runner-sprint-bounce 0.36s ease-in-out infinite alternate;
}

@keyframes runner-sprint-bounce {
  0% { transform: translateY(0); }
  100% { transform: translateY(-2px); }
}

/* 4-Frame Retro Run Cycle Animation */
.pixel-runner-svg .rf-1,
.pixel-runner-svg .rf-2,
.pixel-runner-svg .rf-3,
.pixel-runner-svg .rf-4 {
  visibility: hidden;
  opacity: 0;
}

.pixel-runner-svg .rf-1 { animation: run-f1 0.36s steps(1) infinite; }
.pixel-runner-svg .rf-2 { animation: run-f2 0.36s steps(1) infinite; }
.pixel-runner-svg .rf-3 { animation: run-f3 0.36s steps(1) infinite; }
.pixel-runner-svg .rf-4 { animation: run-f4 0.36s steps(1) infinite; }

@keyframes run-f1 {
  0%, 24.99% { visibility: visible; opacity: 1; }
  25%, 100% { visibility: hidden; opacity: 0; }
}
@keyframes run-f2 {
  0%, 24.99% { visibility: hidden; opacity: 0; }
  25%, 49.99% { visibility: visible; opacity: 1; }
  50%, 100% { visibility: hidden; opacity: 0; }
}
@keyframes run-f3 {
  0%, 49.99% { visibility: hidden; opacity: 0; }
  50%, 74.99% { visibility: visible; opacity: 1; }
  75%, 100% { visibility: hidden; opacity: 0; }
}
@keyframes run-f4 {
  0%, 74.99% { visibility: hidden; opacity: 0; }
  75%, 100% { visibility: visible; opacity: 1; }
}

.race-score-badge {
  font-family: var(--font-pixel);
  font-size: 0.85rem;
  color: #fff;
  text-align: right;
  z-index: 20;
  position: relative;
  white-space: nowrap;
}

/* LINE CHART CONTAINER */
.line-chart-container {
  display: none;
  background: #040508;
  border: 1px solid var(--border-pixel);
  border-radius: 6px;
  padding: 16px;
  height: 480px;
  position: relative;
}

.line-chart-container.active {
  display: block;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.app-footer {
  border-top: 2px solid var(--border-pixel);
  background: #040508;
  padding: 30px 24px;
  margin-top: 40px;
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-retro);
  color: #fff;
}

.footer-links a {
  color: var(--neon-cyan);
  text-decoration: none;
  margin-left: 12px;
}

.footer-links a:hover {
  text-decoration: underline;
}

/* Responsive tweaks */
@media (max-width: 600px) {
  .header-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .header-meta {
    width: 100%;
    justify-content: space-between;
  }
  .animation-controls {
    width: 100%;
    justify-content: space-between;
  }
  .bar-chart-race-container {
    min-height: 600px;
    height: 600px;
  }
  .race-driver-row {
    grid-template-columns: 28px 72px 1fr 54px;
    gap: 8px;
    height: 52px;
  }
  .race-driver-meta .pixel-helmet {
    width: 34px;
    height: 34px;
  }
  .race-bar-tip-runner {
    width: 32px;
    height: 36px;
    right: -15px;
  }
}
