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

html {
  scrollbar-width: thin;
  scrollbar-color: #2a2a2a #080808;
}
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: #080808; }
::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 99px; }

body {
  font-family: 'Montserrat', 'Helvetica Neue', Arial, sans-serif;
  background: #080808;
  color: #d8d8d8;
  overflow: hidden;
  height: 100vh;
}

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

/* ── Design tokens ───────────────────────────── */
:root {
  --chrome:    #bbb;
  --chrome-hi: #ddd;
  --muted:     #555;
  --border:    rgba(255,255,255,0.07);
}

/* ── Canvas ──────────────────────────────────── */
#car-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

/* ── CSS2D labels container ──────────────────── */
#labels {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  overflow: hidden;
}

/* ── Loading ─────────────────────────────────── */
#car-loading {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: #080808;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
.loading-label {
  font-family: 'Montserrat', sans-serif;
  font-weight: 300;
  font-size: 9px;
  letter-spacing: 0.4em;
  color: #444;
}
.loading-bar {
  width: 160px;
  height: 1px;
  background: #1a1a1a;
}
#loading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #444, #bbb);
  transition: width 0.15s ease;
}

/* ── Nav ─────────────────────────────────────── */
.nav {
  position: fixed;
  top: 38px;
  left: 38px;
  right: 38px;
  z-index: 200;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  background: rgba(6,6,6,0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 40px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo-emblem { width: 36px; height: 36px; flex-shrink: 0; }
.logo-emblem svg { width: 100%; height: 100%; }
.nav-wordmark {
  font-family: 'Jost', 'Montserrat', sans-serif;
  font-weight: 200;
  font-size: 11px;
  letter-spacing: 0.3em;
  color: #fff;
  margin-right: -0.3em;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 40px;
}
.nav-links a {
  font-family: 'Montserrat', sans-serif;
  font-weight: 300;
  font-size: 9.5px;
  letter-spacing: 0.22em;
  color: #999;
  transition: color 0.2s;
  margin-right: -0.22em;
}
.nav-links a:hover { color: #fff; }

/* ── Fullscreen button ───────────────────────── */
.btn-fullscreen {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.05);
  color: #999;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.btn-fullscreen:hover {
  border-color: rgba(255,255,255,0.45);
  color: #fff;
  background: rgba(255,255,255,0.10);
}

/* ── HUD Labels (CSS2DObject) ────────────────── */
.hud-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.8s ease;
  user-select: none;
  pointer-events: none;
}
.hud-title.visible { opacity: 1; }

.hud-brand {
  font-family: 'Jost', sans-serif;
  font-weight: 200;
  font-size: 11px;
  letter-spacing: 0.45em;
  color: #888;
  margin-right: -0.45em;
}
.hud-model {
  font-family: 'Jost', sans-serif;
  font-weight: 200;
  font-size: 28px;
  letter-spacing: 0.1em;
  color: var(--chrome-hi);
  line-height: 1;
  margin-right: -0.1em;
  text-shadow: 0 0 40px rgba(200,200,200,0.15);
}
.hud-year {
  font-family: 'Montserrat', sans-serif;
  font-weight: 300;
  font-size: 11px;
  letter-spacing: 0.3em;
  color: #777;
  margin-top: 2px;
  margin-right: -0.3em;
}

/* Spec flotante con línea conectora */
.hud-spec {
  display: flex;
  align-items: center;
  gap: 0;
  opacity: 0;
  transition: opacity 0.8s ease;
  user-select: none;
  pointer-events: none;
  white-space: nowrap;
}
.hud-spec.visible { opacity: 1; }

/* Variante derecha: línea + texto */
.hud-spec.right {
  flex-direction: row;
}
/* Variante izquierda: texto + línea */
.hud-spec.left {
  flex-direction: row-reverse;
}

.spec-line {
  width: 48px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(150,150,150,0.4));
  flex-shrink: 0;
}
.hud-spec.left .spec-line {
  background: linear-gradient(90deg, rgba(150,150,150,0.4), transparent);
}

.spec-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  border: 1px solid rgba(160,160,160,0.5);
  flex-shrink: 0;
  background: transparent;
}

.spec-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 10px;
}
.spec-value {
  font-family: 'Jost', sans-serif;
  font-weight: 200;
  font-size: 22px;
  color: var(--chrome-hi);
  letter-spacing: 0.05em;
  line-height: 1;
}
.spec-label {
  font-family: 'Montserrat', sans-serif;
  font-weight: 300;
  font-size: 10px;
  letter-spacing: 0.25em;
  color: #888;
  margin-right: -0.25em;
}

/* ── Pedales ─────────────────────────────────── */
.pedals {
  position: fixed;
  bottom: 52px;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  padding: 0 32px;
}

.pedal {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.28);
  background: rgba(12,12,12,0.80);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #aaa;
  font-family: 'Montserrat', sans-serif;
  font-weight: 300;
  font-size: 7.5px;
  letter-spacing: 0.22em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: none;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.04), 0 4px 24px rgba(0,0,0,0.6);
}

.pedal:hover {
  border-color: rgba(255,255,255,0.5);
  color: #fff;
}

.pedal.active {
  border-color: rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.10);
  color: #fff;
}

.pedal.loading {
  color: rgba(255,255,255,0.3);
  border-color: rgba(255,255,255,0.08);
  cursor: default;
}
.pedal.loading::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid transparent;
  border-top-color: rgba(255,255,255,0.75);
  animation: pedal-spin 0.75s linear infinite;
  pointer-events: none;
}
@keyframes pedal-spin {
  to { transform: rotate(360deg); }
}

#btn-gas.active { border-color: rgba(255,255,255,0.7); }

/* ── Drag hint ───────────────────────────────── */
.drag-hint {
  position: fixed;
  top: 120px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #666;
  font-family: 'Montserrat', sans-serif;
  font-size: 8.5px;
  letter-spacing: 0.3em;
  pointer-events: none;
  animation: fadeUp 1s ease both 2s;
  transition: opacity 0.4s;
  white-space: nowrap;
}
.drag-hint.hidden { opacity: 0; }

/* ── Model label ─────────────────────────────── */
.model-label {
  position: fixed;
  bottom: 148px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  color: rgba(255,255,255,0.35);
  font-family: 'Montserrat', sans-serif;
  font-weight: 200;
  font-size: 8px;
  letter-spacing: 0.35em;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 0.4s;
}
.model-label.flash {
  animation: labelFlash 0.8s ease both;
}
@keyframes labelFlash {
  0%   { color: rgba(80, 220, 255, 0.9); }
  100% { color: rgba(255, 255, 255, 0.35); }
}

/* ── Animations ──────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 768px) {
  .nav-inner { padding: 0 20px; height: 56px; }
  .nav-links { display: none; }
  .hud-model { font-size: 20px; }
  .spec-value { font-size: 14px; }
  .spec-line { width: 28px; }
  body { padding: 0; }
  .nav { top: 0; left: 0; right: 0; border-radius: 0; }
  .nav,
  .pedal { backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* ── Landscape móvil — layout tipo juego ─────── */
@media (orientation: landscape) and (max-height: 500px) {
  .nav-inner { height: 44px; padding: 0 16px; }
  .nav-links  { display: none; }
  .nav        { top: 0; left: 0; right: 0; border-radius: 0; }
  .nav,
  .pedal      { backdrop-filter: none; -webkit-backdrop-filter: none; }

  /* Pedales en las esquinas inferiores */
  .pedals {
    bottom: 20px;
    top:    auto;
    align-items: flex-end;
    padding: 0 16px;
  }
  .pedal {
    width:  62px;
    height: 62px;
  }

  .drag-hint   { top: 52px; }
  .model-label { bottom: auto; top: 52px; }
}
