/* ==========================================================================
   cabina.css — Fase 3: la portada como cabina de camión de noche.
   Primero el diseño de celular (parabrisas arriba, tablero en grilla);
   luego, en escritorio, un "escenario" 16:9 que cubre la pantalla y donde
   cada control se ubica en % (1em = 1/100 del ancho del escenario).
   ========================================================================== */

.cabina {
  --brillo: #ffe9cc;                 /* blanco cálido de retroiluminación */
  --brillo-suave: rgba(255, 233, 204, 0.55);
  --glow: 0 0 6px rgba(255, 226, 190, 0.55), 0 0 18px rgba(255, 210, 160, 0.18);
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  background: #020305;
  color: var(--brillo);
  overflow: hidden;
  isolation: isolate;
}

/* ---------- Parabrisas ---------- */
.cabina__parabrisas {
  position: relative;
  height: 52vh;
  height: 52svh;
  min-height: 280px;
  overflow: hidden;
  flex-shrink: 0;
}
.cabina__via {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
/* Pórtico verde que se puede tocar: enlace transparente que sigue al
   letrero dibujado en el canvas (lo ubica js/cabina-escena.js) */
.portico-enlace {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  border-radius: 4px;
  cursor: pointer;
  transform-origin: 0 0;
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow 0.2s;
}
.portico-enlace[hidden] { display: none; }
.portico-enlace:hover {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.75), 0 0 22px rgba(255, 255, 255, 0.35);
}
/* Reflejo tenue en el vidrio */
.cabina__vidrio {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0.025) 42%, rgba(255, 255, 255, 0) 50%),
    radial-gradient(60% 30% at 70% 100%, rgba(255, 233, 204, 0.05), rgba(255, 233, 204, 0) 70%);
}
.parabrisas-movil {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Banda parasol con el h1: arriba, sin tapar la carretera */
.parasol {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 52px;
  padding: 0 16px;
  background: linear-gradient(to bottom, rgba(2, 3, 5, 0.97), rgba(4, 7, 12, 0.88));
  border-bottom: 1px solid rgba(255, 233, 204, 0.08);
}
.parasol__marca { flex-shrink: 0; text-decoration: none; }
.parasol .marca__placa { width: 40px; height: 38px; padding: 2px; border-bottom-width: 2px; }
.parasol__titulo {
  font-family: var(--f-display);
  font-size: clamp(1.125rem, 0.8rem + 1.2vw, 1.625rem);
  font-weight: 800;
  line-height: 1;
  color: #f3f5f8;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.parasol__empresa {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--acero);
  white-space: nowrap;
}
@media (max-width: 560px) { .parasol__empresa { display: none; } }

/* ---------- Fundido de salida ---------- */
.cabina__fundido {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease-in;
}
.cabina.saliendo .cabina__fundido { opacity: 1; }

/* ---------- Escenario (celular: flujo normal) ---------- */
.escenario {
  position: relative;
  flex: 1;
  background:
    radial-gradient(90% 60% at 50% 0%, rgba(255, 233, 204, 0.07), rgba(255, 233, 204, 0) 70%),
    linear-gradient(to bottom, #0c1016, #050608 40%, #020304);
  border-top: 1px solid rgba(255, 226, 190, 0.18);
}
.escenario__fondo,
.volante { display: none; }

/* ==========================================================================
   Controles: base común
   ========================================================================== */
.tablero {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 12px 14px;
  max-width: 560px;
  margin-inline: auto;
}
.ctl {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 56px;
  padding: 6px 4px;
  background: linear-gradient(to bottom, #12171e, #090c10);
  border: 1px solid rgba(255, 233, 204, 0.14);
  border-radius: 6px;
  color: var(--brillo);
  font-family: var(--f-texto);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.1;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
}
.ctl:active { transform: translateY(1px); }
.ctl__icono svg { width: 22px; height: 22px; filter: drop-shadow(0 0 4px rgba(255, 226, 190, 0.5)); }
.ctl:hover,
.ctl:focus-visible { border-color: rgba(255, 233, 204, 0.45); box-shadow: 0 0 14px rgba(255, 226, 190, 0.15); }
.cabina :focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--rojo);
}

/* --- GPS --- */
.gps {
  position: relative;
  grid-column: 1 / -1;
  overflow: hidden;
  background: #070b12;
  border: 1px solid rgba(255, 233, 204, 0.18);
  border-radius: 8px;
  box-shadow: inset 0 0 0 3px #020304, 0 0 24px rgba(120, 160, 220, 0.08);
}
.gps__mapa {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.7;
  pointer-events: none;
}
.gps__barra {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--acero);
  border-bottom: 1px solid rgba(255, 233, 204, 0.08);
}
.gps__flecha { width: 14px; height: 14px; color: var(--rojo); filter: drop-shadow(0 0 4px rgba(210, 31, 44, 0.8)); }
.gps__lista {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 0;
  padding: 8px;
  list-style: none;
}
.gps__destino {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 7px 12px;
  background: rgba(10, 16, 26, 0.82);
  border: 1px solid rgba(255, 233, 204, 0.1);
  border-radius: 4px;
  color: #f3f5f8;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.15;
  text-decoration: none;
  transition: background-color 0.2s, border-color 0.2s;
}
.gps__destino::after {
  content: "";
  margin-left: auto;
  padding-left: 8px;
  width: 7px; height: 7px;
  border-top: 2px solid var(--acero);
  border-right: 2px solid var(--acero);
  transform: rotate(45deg);
  flex-shrink: 0;
  box-sizing: content-box;
  padding: 0;
  margin-right: 2px;
}
.gps__destino:hover,
.gps__destino:focus-visible,
.gps__destino.is-elegido { background: rgba(210, 31, 44, 0.9); border-color: var(--rojo); }
.gps__destino:hover::after,
.gps__destino.is-elegido::after { border-color: #fff; }

/* Mensaje "Tomando salida" */
.gps__aviso {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  background: rgba(5, 9, 15, 0.94);
  font-size: 1.0625rem;
  font-weight: 600;
  color: #f3f5f8;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s;
}
.gps__aviso svg { width: 34px; height: 34px; color: var(--rojo); flex-shrink: 0; filter: drop-shadow(0 0 6px rgba(210, 31, 44, 0.8)); }
.gps__aviso b { display: block; font-family: var(--f-display); font-size: 1.75em; font-weight: 800; line-height: 1; }
.gps.anunciando .gps__aviso { opacity: 1; visibility: visible; }

/* --- Arranque = Cotiza --- */
.arranque {
  grid-column: span 5;
  flex-direction: row;
  min-height: 52px;
  background: linear-gradient(to bottom, #e02a37, #a5141f);
  border-color: #ff5a64;
  box-shadow: 0 0 18px rgba(210, 31, 44, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  color: #fff;
}
.arranque__boton { display: flex; align-items: baseline; gap: 6px; }
.arranque__texto { font-family: var(--f-display); font-size: 1.5rem; font-weight: 900; line-height: 1; }
.arranque__sub { font-size: 0.8125rem; font-weight: 700; }
.arranque:hover { box-shadow: 0 0 26px rgba(210, 31, 44, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.25); border-color: #ff8a90; }

/* --- Rastreo --- */
.rastreo {
  grid-column: span 5;
  flex-direction: row;
  gap: 8px;
  min-height: 52px;
  font-size: 0.875rem;
  font-weight: 700;
}
.rastreo .gps-punto {
  position: relative;
  width: 8px; height: 8px;
  background: var(--rojo);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--rojo);
}

/* --- Radio --- */
.radio {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  background: linear-gradient(to bottom, #0f1319, #07090c);
  border: 1px solid rgba(255, 233, 204, 0.12);
  border-radius: 6px;
}
.radio__boton {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  flex-shrink: 0;
  background: #0a0d12;
  border: 1px solid rgba(255, 233, 204, 0.16);
  border-radius: 4px;
  color: var(--brillo-suave);
}
.radio__boton svg { width: 18px; height: 18px; }
.radio__boton:hover { color: var(--brillo); border-color: rgba(255, 233, 204, 0.4); }
.radio__encender[aria-pressed="true"] { color: var(--rojo); border-color: rgba(210, 31, 44, 0.6); }
.radio__encender[aria-pressed="true"] svg { filter: drop-shadow(0 0 5px rgba(210, 31, 44, 0.9)); }
.radio__pantalla {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 44px;
  overflow: hidden;
  background: #030406;
  border: 1px solid rgba(255, 233, 204, 0.08);
  border-radius: 3px;
  font-family: var(--f-texto);
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 44px;
  color: rgba(255, 233, 204, 0.18);
  white-space: nowrap;
}
.radio__cinta { display: inline-block; padding-left: 10px; }
.radio.encendida .radio__pantalla {
  color: var(--brillo);
  text-shadow: 0 0 6px rgba(255, 226, 190, 0.6);
  background: #0a0806;
}
.radio.encendida .radio__cinta {
  padding-left: 0;
  animation: radio-cinta 16s linear infinite;
}
/* Mientras suena el aviso: "SERVITRUCK" quieto en la pantalla */
.radio.encendida.radio--aviso .radio__cinta {
  padding-left: 10px;
  animation: none;
  letter-spacing: 0.18em;
}
.radio__texto { padding-right: 3em; }
@keyframes radio-cinta {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.radio__nivel { display: flex; align-items: flex-end; gap: 2px; height: 18px; }
.radio__nivel i {
  width: 3px;
  background: rgba(255, 233, 204, 0.15);
}
.radio__nivel i:nth-child(1) { height: 30%; }
.radio__nivel i:nth-child(2) { height: 45%; }
.radio__nivel i:nth-child(3) { height: 60%; }
.radio__nivel i:nth-child(4) { height: 80%; }
.radio__nivel i:nth-child(5) { height: 100%; }
.radio__nivel i.on { background: var(--brillo); box-shadow: 0 0 4px rgba(255, 226, 190, 0.7); }

/* --- Medidores, indicador, luces y bocina (celular: teclas con ícono) --- */
.medidor, .indicador, .luces, .bocina { grid-column: span 2; }
.medidor__esfera { display: none; }
.bocina__marca { display: none; }
.luces__tecla svg { width: 22px; height: 22px; opacity: 0.55; }
.luces[aria-pressed="true"] { border-color: rgba(255, 233, 204, 0.6); }
.luces[aria-pressed="true"] .luces__tecla svg { opacity: 1; filter: drop-shadow(0 0 6px rgba(255, 240, 220, 0.95)); }

/* --- Bajar del camión --- */
/* En celular: "Baja del camión" sobre el borde inferior del parabrisas
   (el acceso personal es ahora un testigo luminoso: ver más abajo) */
.bajar {
  position: absolute;
  top: -42px;
  left: 50%;
  z-index: 6;
  transform: translateX(-50%);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  color: var(--acero);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
}
.bajar svg { width: 16px; height: 16px; animation: bajar 2.4s ease-in-out infinite; }
.bajar:hover { color: var(--brillo); }
@keyframes bajar {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

/* Sacudida de la cabina (bocina sin audio) */
.cabina.sacude .escenario,
.cabina.sacude .cabina__parabrisas { animation: sacudida 0.45s linear; }
@keyframes sacudida {
  0%, 100% { transform: translate(0, 0); }
  15% { transform: translate(-3px, 2px); }
  30% { transform: translate(3px, -2px); }
  45% { transform: translate(-2px, -1px); }
  60% { transform: translate(2px, 2px); }
  80% { transform: translate(-1px, 1px); }
}

/* ==========================================================================
   ESCRITORIO: escenario 16:9 que cubre la pantalla
   ========================================================================== */
@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  .cabina {
    display: block;
    height: 100vh;
    height: 100svh;
    min-height: 560px;
  }
  .cabina__parabrisas {
    position: absolute;
    inset: 0;
    height: auto;
    min-height: 0;
  }
  .parabrisas-movil { display: none; }
  .parasol { height: 58px; padding: 0 clamp(20px, 3vw, 44px); }
  .parasol .marca__placa { width: 46px; height: 43px; }

  .escenario {
    --ancho: max(100vw, 177.78vh);
    position: absolute;
    left: 50%;
    bottom: 0;
    z-index: 2;
    width: var(--ancho);
    height: max(100vh, 56.25vw);
    margin-left: calc(var(--ancho) / -2);
    background: none;
    border: 0;
    font-size: calc(var(--ancho) / 100);   /* 1em = 16px en un escenario de 1600px */
    pointer-events: none;
    will-change: transform;
  }
  .escenario__fondo,
  .volante {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }
  .volante { z-index: 2; }

  .tablero {
    display: block;
    position: absolute;
    inset: 0;
    max-width: none;
    margin: 0;
    padding: 0;
  }
  .tablero > * { position: absolute; z-index: 1; pointer-events: auto; }
  /* Consola y panel izquierdo por delante de los brazos: siempre visibles */
  .tablero > .gps,
  .tablero > .radio,
  .tablero > .arranque,
  .tablero > .rastreo,
  .tablero > .luces,
  .tablero > .testigos { z-index: 3; }

  /* Cada control: posición en % del escenario (diseño base 1600 x 900) */
  .ctl { font-size: 1em; min-height: 0; }

  /* GPS en la consola central */
  .gps {
    left: 60%;
    top: 65.6%;
    width: 22.5em;
    height: 14.5em;
    font-size: 1em;
    border-radius: 0.6em;
    transform: perspective(70em) rotateY(-7deg);
    transform-origin: left center;
    box-shadow: inset 0 0 0 0.25em #020304, 0 0 2.4em rgba(140, 180, 240, 0.12), 0 0 0.6em rgba(255, 233, 204, 0.1);
  }
  .gps__barra { padding: 0.55em 0.9em 0.45em; font-size: 0.75em; }
  .gps__flecha { width: 1.1em; height: 1.1em; }
  .gps__lista { gap: 0.45em; padding: 0.6em; }
  .gps__destino { min-height: 3.05em; padding: 0.5em 0.8em; font-size: 0.9375em; border-radius: 0.3em; }
  .gps__aviso { font-size: 1.05em; }

  /* Radio bajo el GPS */
  .radio {
    left: 60%;
    top: 92.4%;
    width: 22.5em;
    height: 3.6em;
    padding: 0.35em;
    gap: 0.35em;
    border-radius: 0.4em;
    transform: perspective(70em) rotateY(-7deg);
    transform-origin: left center;
  }
  .radio__boton { width: 2.8em; height: 2.8em; border-radius: 0.3em; }
  .radio__boton svg { width: 1.1em; height: 1.1em; }
  .radio__pantalla { height: 2.8em; line-height: 2.8em; font-size: 0.8em; }
  .radio__nivel { height: 1.1em; gap: 0.12em; }
  .radio__nivel i { width: 0.2em; }

  /* Botón de encendido = Cotiza */
  .arranque {
    left: 84.125%;
    top: 69.1%;
    width: 6.75em;
    height: 6.75em;
    padding: 0.55em;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 35%, #3a414c, #12161c 70%);
    border: 0.12em solid #4a525e;
    box-shadow: 0 0 0 0.3em #05070a, 0 0 2.4em rgba(210, 31, 44, 0.45);
  }
  .arranque__boton {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1em;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 30%, #f0404c, #b3161f 60%, #7c0d15);
    box-shadow: inset 0 0 0 0.12em rgba(255, 255, 255, 0.18), inset 0 -0.4em 0.8em rgba(0, 0, 0, 0.35), 0 0 1.2em rgba(210, 31, 44, 0.7);
    transition: box-shadow 0.25s, transform 0.12s;
  }
  .arranque__texto { font-size: 1.6em; text-shadow: 0 0 0.4em rgba(255, 255, 255, 0.5); }
  .arranque__sub { font-size: 0.7em; letter-spacing: 0.02em; }
  .arranque:hover { box-shadow: 0 0 0 0.3em #05070a, 0 0 3.4em rgba(210, 31, 44, 0.75); }
  .arranque:hover .arranque__boton { box-shadow: inset 0 0 0 0.12em rgba(255, 255, 255, 0.3), inset 0 -0.4em 0.8em rgba(0, 0, 0, 0.3), 0 0 2em rgba(255, 60, 70, 0.9); }
  .arranque:active .arranque__boton { transform: scale(0.96); }

  /* Rastreo bajo el encendido */
  .rastreo {
    left: 82.5%;
    top: 83.1%;
    width: 10em;
    height: 3em;
    border-radius: 0.35em;
    gap: 0.6em;
  }
  .rastreo > span:last-child { font-size: 0.85em; }

  /* Medidores dentro del hueco superior del volante */
  .medidor {
    width: 8.5em;
    height: 8.5em;
    padding: 0;
    border-radius: 50%;
    background: none;
    border: 0;
    justify-content: center;
    gap: 0.25em;
  }
  .medidor--vel { left: 30.44%; top: 71.11%; }
  .medidor--rpm { left: 41.06%; top: 71.11%; }
  .medidor__esfera {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
  }
  /* Ícono bajo el eje de la aguja y texto en el hueco inferior de la esfera */
  .medidor .ctl__icono { position: absolute; top: 56%; left: 50%; transform: translateX(-50%); }
  .medidor .ctl__icono svg { width: 1.45em; height: 1.45em; }
  .medidor .ctl__texto {
    position: absolute;
    left: 0; right: 0;
    bottom: 6%;
    font-size: 0.8em;
    text-shadow: var(--glow);
  }
  .medidor:hover,
  .medidor:focus-visible { box-shadow: 0 0 2.2em rgba(255, 226, 190, 0.25); }
  .medidor:hover .medidor__aguja { transform: rotate(var(--giro-hover)); }

  /* Correo: luz testigo */
  .indicador {
    left: 38.25%;
    top: 83%;
    width: 3.5em;
    height: 3.5em;
    padding: 0;
    border-radius: 50%;
    background: radial-gradient(circle, #15110c, #050505 70%);
    border: 0.12em solid #2a2f37;
  }
  .indicador .ctl__icono svg { width: 1.5em; height: 1.5em; }
  .indicador .ctl__texto,
  .bocina .ctl__texto { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

  /* Luces altas: tecla basculante en el panel izquierdo */
  .luces {
    left: 9.5%;
    top: 72%;
    width: 9.5em;
    height: 4.5em;
    flex-direction: row;
    gap: 0.7em;
    border-radius: 0.4em;
  }
  .luces .ctl__texto { font-size: 0.85em; }
  .luces__tecla {
    display: grid;
    place-items: center;
    width: 2.4em;
    height: 3em;
    background: linear-gradient(to bottom, #1b2129, #0a0d11);
    border: 0.08em solid #2c333d;
    border-radius: 0.25em;
    transform: perspective(10em) rotateX(14deg);
    transition: transform 0.2s;
  }
  .luces__tecla svg { width: 1.4em; height: 1.4em; }
  .luces[aria-pressed="true"] .luces__tecla { transform: perspective(10em) rotateX(-14deg); }

  /* Bocina en la maza del volante */
  .bocina {
    left: 36%;
    top: 89.55%;
    z-index: 3;
    width: 8em;
    height: 8em;
    padding: 0 0 2.4em;
    justify-content: center;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 35%, #1d232c, #090b0f 70%);
    border: 0.1em solid #20262f;
    color: rgba(255, 233, 204, 0.55);
  }
  .bocina__marca {
    display: block;
    font-family: var(--f-display);
    font-size: 1.05em;
    font-weight: 800;
    letter-spacing: 0.14em;
    color: rgba(200, 208, 217, 0.5);
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.8), 0 1px 0 rgba(255, 255, 255, 0.08);
  }
  .bocina .ctl__icono svg { width: 1.2em; height: 1.2em; filter: none; }
  .bocina:hover { color: var(--brillo); }
  .bocina.suena { box-shadow: 0 0 2.4em rgba(255, 226, 190, 0.35); }

  /* Indicación para bajar, dentro del volante */
  .bajar {
    left: 45.5%;
    top: 93.4%;
    transform: none;
    font-size: 0.8em;
    padding: 0.3em 0;
    color: rgba(200, 208, 217, 0.7);
  }
  .bajar svg { width: 1.1em; height: 1.1em; }
}

/* ==========================================================================
   Esfera de los medidores (SVG generado en js/cabina-tablero.js)
   ========================================================================== */
.medidor__bisel { fill: url(#md-bisel); }
.medidor__cara { fill: #050607; }
.medidor__marca { stroke: var(--brillo); stroke-linecap: round; filter: drop-shadow(0 0 2px rgba(255, 226, 190, 0.9)); }
.medidor__marca--roja { stroke: var(--rojo); filter: drop-shadow(0 0 3px rgba(210, 31, 44, 0.9)); }
.medidor__num {
  fill: var(--brillo);
  font-family: var(--f-texto);
  font-size: 15px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
  filter: drop-shadow(0 0 2px rgba(255, 226, 190, 0.8));
}
.medidor__unidad { fill: rgba(255, 233, 204, 0.5); font-family: var(--f-texto); font-size: 10px; font-weight: 600; text-anchor: middle; }
.medidor__aguja {
  transform-origin: 100px 100px;
  transform: rotate(var(--giro));
  transition: transform 0.6s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.medidor__aguja line { stroke: var(--rojo); stroke-width: 3.5; stroke-linecap: round; filter: drop-shadow(0 0 4px rgba(210, 31, 44, 0.95)); }
.medidor__eje { fill: #1b2028; stroke: #3a414c; stroke-width: 2; }

/* Leve temblor de aguja al rodar */
@media (prefers-reduced-motion: no-preference) {
  .medidor--vel .medidor__aguja { animation: aguja 3.2s ease-in-out infinite; }
}
.movimiento-forzado .medidor--vel .medidor__aguja { animation: aguja 3.2s ease-in-out infinite; }
@keyframes aguja {
  0%, 100% { transform: rotate(var(--giro)); }
  50% { transform: rotate(calc(var(--giro) + 1.2deg)); }
}

/* Movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  html:not(.movimiento-forzado) .radio.encendida .radio__cinta { animation: none; }
  html:not(.movimiento-forzado) .bajar svg { animation: none; }
  html:not(.movimiento-forzado) .cabina.sacude .escenario,
  html:not(.movimiento-forzado) .cabina.sacude .cabina__parabrisas { animation: none; }
}

/* En celular, mientras estás en la cabina, el WhatsApp flotante cede su
   lugar al botón de WhatsApp del tablero */
@media not all and (min-width: 900px) and (min-aspect-ratio: 5/4) {
  body.en-cabina .wsp { opacity: 0; visibility: hidden; transform: translateY(12px); }
}
.wsp { transition: transform 0.25s var(--ease-out), border-color 0.25s, opacity 0.3s, visibility 0.3s; }

/* ==========================================================================
   Header: oculto mientras estás en la cabina (el GPS hace de menú)
   ========================================================================== */
.header.en-cabina {
  transform: translateY(-110%);
  visibility: hidden;
  transition: transform 0.4s var(--ease-out), visibility 0s linear 0.4s;
}

/* ==========================================================================
   Fase 4: barra superior mínima (banda parasol) con botón "Menú"
   ========================================================================== */
.parasol__menu {
  flex-shrink: 0;
  margin-left: 12px;
  min-height: 36px;
  padding: 6px 14px 5px;
  background: transparent;
  border: 1px solid rgba(255, 233, 204, 0.28);
  border-radius: 3px;
  color: #f3f5f8;
  font-size: 0.8125rem;
  font-weight: 700;
}
.parasol__menu:hover { border-color: rgba(255, 233, 204, 0.7); }
@media (max-width: 560px) { .parasol__titulo { font-size: 1rem; } }

/* Cierre del menú de respaldo */
.menu-movil { z-index: 120; }
.menu-movil__cerrar {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  background: transparent;
  border: 1px solid var(--linea);
  color: var(--blanco);
}
.menu-movil__cerrar svg { width: 22px; height: 22px; }

/* Velocímetro conectado a la velocidad real del camión */
.medidor--vivo .medidor__aguja {
  animation: none !important;
  transition: transform 0.18s linear;
}

/* Mientras cargan los scripts la cabina queda en negro: nunca se ve el
   tablero sin volante ni carretera (la clase la quita js/cabina-tablero.js) */
.cabina-cargando .cabina__fundido { opacity: 1; transition: none; }

/* Al volver a la carretera desde el parador: aparece desde negro */
.cabina.entrando .cabina__fundido { animation: desde-negro 0.9s ease-out both; }
@keyframes desde-negro { from { opacity: 1; } to { opacity: 0; } }

/* ==========================================================================
   Botón "Ver con movimiento" (solo aparece si el sistema pide movimiento
   reducido; lo crea js/movimiento.js)
   ========================================================================== */
.movimiento {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  margin-left: 12px;
  padding: 4px 14px 3px 5px;
  background: rgba(210, 31, 44, 0.1);
  border: 1px solid rgba(210, 31, 44, 0.6);
  border-radius: 3px;
  color: #f3f5f8;
  font-family: var(--f-texto);
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}
.movimiento:hover { background: rgba(210, 31, 44, 0.22); border-color: var(--rojo); }
.movimiento__icono {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  background: var(--rojo);
  border-radius: 2px;
  color: #fff;
  box-shadow: 0 0 10px rgba(210, 31, 44, 0.55);
}
.movimiento__icono svg { width: 15px; height: 15px; }
.movimiento__corto { display: none; }
/* Activado: queda como control discreto para volver a la versión quieta */
.movimiento.is-activo {
  background: transparent;
  border-color: rgba(255, 233, 204, 0.28);
}
.movimiento.is-activo .movimiento__icono {
  background: transparent;
  border: 1px solid rgba(255, 233, 204, 0.45);
  color: #ffe9cc;
  box-shadow: none;
}
.movimiento.is-activo:hover { border-color: rgba(255, 233, 204, 0.7); }
/* Sin banda parasol: flotante abajo a la izquierda */
.movimiento--flotante {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 85;
  margin: 0;
  background: rgba(8, 18, 31, 0.92);
}
@media (max-width: 760px) {
  .movimiento { padding-right: 10px; gap: 7px; margin-left: 8px; }
  .movimiento__texto { display: none; }
  .movimiento__corto { display: inline; }
}
@media (max-width: 400px) {
  .movimiento { padding-right: 5px; }
  .movimiento__corto { display: none; }
}

/* ==========================================================================
   Testigos luminosos del tablero (js/testigos.js; lista en js/config.js)
   Apagados: gris oscuro, casi invisibles. Encendidos: su color con brillo.
   El de la App Servitruck es un enlace: ámbar, con parpadeo lento y sutil.
   ========================================================================== */
.testigos {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 6px 8px;
  background: #050608;
  border: 1px solid #161a21;
  border-radius: 6px;
}
.testigo {
  --c: 255, 176, 32;
  position: relative;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  color: rgba(255, 233, 204, 0.11);
  transition: color 0.25s, filter 0.25s;
}
.testigo svg { width: 100%; height: 100%; }
.testigo--ambar { --c: 255, 176, 32; }
.testigo--rojo { --c: 232, 46, 58; }
.testigo--verde { --c: 61, 220, 106; }
.testigo--azul { --c: 70, 140, 255; }
.testigo.is-encendido {
  color: rgb(var(--c));
  filter: drop-shadow(0 0 3px rgba(var(--c), 0.9)) drop-shadow(0 0 8px rgba(var(--c), 0.45));
}
/* Testigo-enlace: área de toque cómoda, se ilumina más al pasar o enfocar */
.testigo--enlace {
  width: 44px;
  height: 44px;
  margin: -9px 0;
  padding: 9px;
  border-radius: 50%;
  text-decoration: none;
  cursor: pointer;
}
.testigo--enlace:hover,
.testigo--enlace:focus-visible {
  color: rgb(255, 214, 120);
  filter: drop-shadow(0 0 4px rgba(var(--c), 1)) drop-shadow(0 0 14px rgba(var(--c), 0.8));
  animation: none;
}
.testigo--enlace:focus-visible { outline: 2px solid #fff; outline-offset: 0; }
/* Rótulo pequeño al pasar el mouse o enfocar con el teclado */
.testigo--enlace::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  padding: 6px 10px;
  background: #0d1b2e;
  border: 1px solid rgba(var(--c), 0.5);
  border-radius: 4px;
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition: opacity 0.2s, transform 0.2s;
  filter: none;
  z-index: 5;
}
.testigo--enlace:hover::after,
.testigo--enlace:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
/* Parpadeo lento: un aviso tenue cada pocos segundos */
.testigo--parpadeo.is-encendido { animation: testigo-aviso 4.5s ease-in-out infinite; }
@keyframes testigo-aviso {
  0%, 78%, 100% { opacity: 1; }
  86% { opacity: 0.45; }
  92% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  html:not(.movimiento-forzado) .testigo--parpadeo.is-encendido { animation: none; }
}

/* Celular: el testigo de la App, 1,5 veces más grande que los decorativos */
.testigos .testigo--enlace { width: 53px; height: 53px; margin: -10px 0; padding: 7px; }

/* Escritorio: testigos repartidos por el cuadro de instrumentos, cada uno en
   su zona (--x/--y los fija js/testigos.js; todas dentro del aro del volante) */
@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  .tablero > .testigos { display: contents; }
  .testigos .testigo {
    position: absolute;
    left: var(--x);
    top: var(--y);
    z-index: 3;
    width: 1.35em;
    height: 1.35em;
    margin: 0;
    padding: 0;
    transform: translate(-50%, -50%);
    pointer-events: none;
  }
  /* App: 1,5 veces el tamaño de los decorativos (ícono 2,025em) */
  .testigos .testigo--enlace {
    width: 2.425em;
    height: 2.425em;
    padding: 0.2em;
    pointer-events: auto;
  }
  .testigo--enlace::after { font-size: 0.8em; }
}
