/* ==========================================================================
   2026 VOLTAS DE GOIÂNIA • 2D TRACK MAP REPLAY STYLES
   ========================================================================== */

:root {
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Outfit', var(--font-sans);
  --font-mono: 'JetBrains Mono', monospace;

  --bg-dark: #070a12;
  --bg-surface: #0f172a;
  --bg-card: rgba(15, 23, 42, 0.88);
  --bg-card-hover: rgba(30, 41, 59, 0.95);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(255, 255, 255, 0.18);

  --cyan: #06b6d4;
  --green: #10b981;
  --amber: #f59e0b;
  --gold: #fbbf24;
  --red: #ef4444;
  --purple: #c084fc;
  --gray-light: #cbd5e1;
  --gray-dim: #64748b;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-dark);
  color: #f8fafc;
  font-family: var(--font-sans);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  background: radial-gradient(circle at 50% 0%, rgba(14, 165, 233, 0.05) 0%, transparent 70%),
              radial-gradient(circle at 10% 90%, rgba(245, 158, 11, 0.03) 0%, transparent 60%),
              var(--bg-dark);
}

/* Top App Header */
.app-header {
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 14, 23, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 100;
}

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

.logo-img {
  height: 38px;
  width: auto;
  filter: brightness(1.1);
  display: block;
}

.title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.title-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  animation: pulse-glow 1.8s infinite;
}

@keyframes pulse-glow {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
}

.badge-tech {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--cyan);
  background: rgba(6, 182, 212, 0.12);
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid rgba(6, 182, 212, 0.25);
}

.badge-oxigen {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 6px;
  border-radius: 3px;
}

.app-header h1 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
  line-height: 1.2;
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-highlight);
  color: #fff;
  transform: translateY(-1px);
}

.nav-btn-accent {
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.3);
  color: #67e8f9;
}

.nav-btn-accent:hover {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--cyan);
  color: #fff;
}

.nav-icon {
  font-size: 13px;
}

/* Language Switcher */
.lang-selector {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 2px;
}

.lang-btn {
  background: transparent;
  border: none;
  color: var(--gray-dim);
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.lang-btn.active {
  background: var(--cyan);
  color: #000;
  font-weight: 800;
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.4);
}

/* Main Track Arena Layout */
.track-arena {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 12px 18px 90px;
  overflow: hidden;
}

/* Top Race HUD Bar */
.race-hud-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  padding: 8px 18px;
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  margin-bottom: 12px;
  z-index: 10;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.hud-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: fit-content;
}

.hud-lbl {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-dim);
}

.hud-val {
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
}

.hud-val.mono {
  font-family: var(--font-mono);
}

.hud-val.highlight {
  color: var(--amber);
  font-family: var(--font-display);
  letter-spacing: 0.5px;
}

.hud-val.text-accent {
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

.hud-val.text-purple {
  color: var(--purple);
}

.hud-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* SVG Stage Canvas */
.svg-stage {
  flex: 1;
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(15, 23, 42, 0.6) 0%, rgba(5, 8, 15, 0.95) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.7);
}

#track-svg {
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 200px);
  filter: drop-shadow(0 15px 35px rgba(0, 0, 0, 0.8));
  user-select: none;
}

/* Track SVG Element Styles */
.track-underpass-roadbed {
  stroke: #162032;
  stroke-width: 28;
  stroke-linecap: round;
  fill: none;
  opacity: 0.8;
}

.track-underpass-slot {
  stroke: #2e3b52;
  stroke-width: 2.2;
  stroke-dasharray: 6 4;
  fill: none;
}

.track-curb {
  stroke: #334155;
  stroke-width: 32;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.6;
}

.track-roadbed {
  stroke: #1e293b;
  stroke-width: 26;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.track-main-path {
  stroke: #475569;
  stroke-width: 2.5;
  stroke-dasharray: 7 5;
  stroke-linecap: round;
}

.track-calculation-path,
.track-pit-path {
  /* Hidden mathematical reference paths sampled by path.getPointAtLength */
  display: none !important;
}

/* Pit Lane Visuals */
.pit-roadbed {
  stroke: #2a1b1b;
  stroke-width: 22;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.95;
}

.pit-slot-visual {
  stroke: #ef4444;
  stroke-width: 2.5;
  stroke-dasharray: 5 4;
  opacity: 0.9;
}

/* Track SVG Typography / Labels */
.track-svg-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  fill: #64748b;
  user-select: none;
}

.pit-label {
  fill: #f87171;
  font-size: 10.5px;
}

.timing-label {
  fill: #34d399;
  font-weight: 800;
}

.drivers-label {
  fill: #38bdf8;
  font-weight: 800;
}

.overpass-label {
  fill: #94a3b8;
  font-size: 9.5px;
}

/* Animated Car Markers */
.car-marker {
  cursor: pointer;
  transition: transform 0.04s linear;
}

.car-marker-aura {
  transition: r 0.2s ease, opacity 0.2s ease;
}

.car-marker:hover .car-marker-aura {
  r: 18;
  opacity: 0.8;
}

.car-marker-core {
  stroke: #ffffff;
  stroke-width: 1.6;
  transition: transform 0.15s ease;
}

.car-marker:hover .car-marker-core {
  stroke-width: 2.2;
}

.car-marker-num {
  font-family: var(--font-display);
  font-size: 9.5px;
  font-weight: 900;
  fill: #ffffff;
  text-anchor: middle;
  dominant-baseline: central;
  user-select: none;
  pointer-events: none;
}

.car-marker.is-pit .car-marker-aura {
  animation: pit-marker-flash 1s infinite alternate;
}

@keyframes pit-marker-flash {
  from { opacity: 0.4; stroke: #ef4444; }
  to { opacity: 0.9; stroke: #fbbf24; }
}

/* Floating Mini-Leaderboard HUD */
.mini-leaderboard {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 290px;
  max-height: calc(100% - 32px);
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  z-index: 20;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.45);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mini-leaderboard.collapsed {
  max-height: 44px;
  overflow: hidden;
}

.leaderboard-header {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.leaderboard-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.leaderboard-icon {
  font-size: 14px;
}

.leaderboard-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #f8fafc;
}

.btn-toggle-hud {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--gray-dim);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-toggle-hud:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.leaderboard-list {
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

/* Leaderboard Row Card */
.leader-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.leader-row:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-highlight);
}

.leader-row.active-leader {
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
  border-color: rgba(251, 191, 36, 0.25);
}

.leader-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.pos-pill {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  width: 22px;
  text-align: center;
  color: var(--gray-dim);
}

.pos-pill.p1 { color: var(--gold); }
.pos-pill.p2 { color: #e2e8f0; }
.pos-pill.p3 { color: var(--amber); }

.car-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 3px;
  color: #fff;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.team-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.team-name {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.driver-name {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--gray-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.driver-name.highlight-driver {
  color: #a78bfa;
}

.leader-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.laps-text {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: #e2e8f0;
}

.status-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 3px;
  text-transform: uppercase;
}

.status-badge.track {
  background: rgba(16, 185, 129, 0.15);
  color: var(--green);
}

.status-badge.pit {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  animation: pulse-glow 1.2s infinite;
}

/* Bottom Playback Controller Bar */
.playback-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 72px;
  background: rgba(10, 14, 23, 0.94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 20px;
  z-index: 100;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
}

/* Playback Actions */
.playback-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ctrl-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: #cbd5e1;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-highlight);
  color: #fff;
  transform: translateY(-1px);
}

.btn-play-main {
  width: auto;
  min-width: 90px;
  padding: 0 16px;
  background: var(--cyan);
  border-color: var(--cyan);
  color: #000;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
  gap: 8px;
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.35);
}

.btn-play-main:hover {
  background: #22d3ee;
  border-color: #22d3ee;
  color: #000;
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.5);
}

.hidden {
  display: none !important;
}

/* Timeline Scrubber Zone */
.scrubber-zone {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.scrubber-slider-wrap {
  position: relative;
  width: 100%;
  height: 8px;
  display: flex;
  align-items: center;
}

.track-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  cursor: pointer;
  position: relative;
  z-index: 2;
}

.track-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  cursor: grab;
  transition: transform 0.1s ease;
}

.track-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.track-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
}

.scrubber-fill {
  position: absolute;
  left: 0;
  top: 1px;
  height: 6px;
  background: linear-gradient(90deg, #0284c7 0%, var(--cyan) 100%);
  border-radius: 3px;
  pointer-events: none;
  width: 0%;
  z-index: 1;
}

/* Milestones Row */
.milestones-row {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.milestones-row::-webkit-scrollbar {
  display: none;
}

.milestone-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--gray-light);
  font-size: 11px;
  font-family: var(--font-sans);
  font-weight: 600;
  padding: 3px 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.milestone-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-highlight);
  color: #fff;
}

.milestone-chip.active-milestone {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--cyan);
  color: #67e8f9;
}

/* Speed Selector Wrap */
.speed-selector-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.speed-lbl {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--gray-dim);
}

.speed-pills {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 2px;
}

.speed-btn {
  background: transparent;
  border: none;
  color: var(--gray-dim);
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.speed-btn.active {
  background: var(--amber);
  color: #000;
  font-weight: 800;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 1024px) {
  .mini-leaderboard {
    width: 260px;
  }
}

@media (max-width: 768px) {
  .app-header {
    height: auto;
    padding: 10px 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .header-left {
    justify-content: space-between;
  }

  .header-actions {
    justify-content: space-between;
  }

  .race-hud-bar {
    padding: 6px 12px;
    gap: 10px;
    overflow-x: auto;
  }

  .hide-mobile {
    display: none !important;
  }

  .mini-leaderboard {
    position: static;
    width: 100%;
    max-height: 180px;
    margin-top: 12px;
  }

  .playback-bar {
    height: auto;
    flex-direction: column;
    padding: 12px 16px;
    gap: 10px;
  }

  .playback-actions {
    width: 100%;
    justify-content: space-between;
  }

  .speed-selector-wrap {
    width: 100%;
    justify-content: space-between;
  }

  .track-arena {
    padding-bottom: 160px;
  }
}

@media (max-width: 480px) {
  .app-header h1 {
    font-size: 13px;
  }

  .hud-val {
    font-size: 12px;
  }

  .milestone-chip {
    font-size: 10px;
    padding: 2px 6px;
  }
}
