/* ==========================================================================
   MetroSim — 1.2 · Estilos (interfaz 2.0: señalética)
   1. Base y variables
   2. Pantalla inicial
   3. Pantalla de juego y HUD superior
   4. Esquema de línea
   5. Selector de mando
   6. Panel del conductor (velocidad, estación, puertas)
   7. Panel del pasajero, ayuda y mensajes
   8. Responsive
   9. Alpha 0.3: sonido, inversor y viajeros
   10. Alpha 0.4: Línea 3, señales, horarios y pasajero a pie
   11. Alpha 0.6: tarjeta bip!, boletería, fundido de cabina
   ========================================================================== */

/* ---------- 1. Base y variables ---------- */
/* Interfaz 2.0 · lenguaje de señalética: letra condensada de letrero para nombres,
   cifras en monoespaciada (no "bailan" al cambiar) y un solo color de acento,
   el de la línea activa (--line, lo fija hud.setLine). Fuentes locales en fonts/. */
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("fonts/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url("fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("fonts/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 700 900; font-display: swap; src: url("fonts/barlow-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url("fonts/barlow-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700 900; font-display: swap; src: url("fonts/barlow-condensed-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-display: swap; src: url("fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 600 800; font-display: swap; src: url("fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2"); }

:root {
  color-scheme: dark;
  --bg: #070b10;              /* fondo de las pantallas */
  --surface: #0d141c;         /* paneles y ventanas */
  --raise: #141e29;           /* controles dentro de un panel, hover */
  --panel: #0b1118e6;         /* paneles del HUD sobre el 3D (translúcidos) */
  --panel-border: #ffffff17;
  --hair: #ffffff12;          /* filetes interiores */
  --text: #edf1f5;
  --muted: #8693a2;
  --dim: #56626f;
  --line: #8b5a2b;            /* color de la línea activa (lo cambia hud.setLine) */
  --on-line: #fff;            /* texto sobre el color de la línea (oscuro en la L2) */
  --power: #5cc8ff;
  --neutral: #e8eef5;
  --brake: #ffb547;
  --emergency: #ff4d4d;
  --ok: #34d17c;
  --warn: #ffc247;
  --radius: 10px;
  --f-display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --f-body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-data: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-family: var(--f-body);
  background: var(--bg);
  color: var(--text);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body, .screen { width: 100%; height: 100%; overflow: hidden; }
body { background: var(--bg); }
button, select, input { font: inherit; }
button:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--power); outline-offset: 2px; }
.hidden { display: none !important; }
kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 5px;
  border: 1px solid #ffffff2e;
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #ffffff0a;
  font: 600 10.5px/1.4 var(--f-data);
  text-align: center;
  color: #d4dbe3;
}
.hud-label, .small-label, .eyebrow {
  font: 600 10px/1.2 var(--f-data);
  letter-spacing: 1.3px;
  color: var(--muted);
  text-transform: uppercase;
}
/* Íconos de trazo en SVG (sustituyen a los emojis de la interfaz) */
.ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 2. Pantalla inicial (interfaz 2.0) ---------- */
/* Dos columnas: a la izquierda marca, línea elegida y su ficha; a la derecha los modos.
   --line / --on-line los fija main.js (selectLine) con el color de la línea elegida. */
.start-screen {
  position: relative;
  overflow-y: auto;
  display: grid;
  grid-template-rows: 1fr auto;
  background: radial-gradient(120% 90% at 0% 0%, #0f1b27 0, var(--bg) 55%);
  padding: max(28px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.start-netmap { position: fixed; inset: 0; width: 100%; height: 100%; opacity: .13; pointer-events: none; fill: none; stroke-width: 10; stroke-linecap: round; stroke-linejoin: round; }
.start-layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 400px) minmax(0, 1fr);
  gap: 20px 48px;
  width: min(100%, 1180px);
  margin: auto;
  align-items: start;
}
.start-side, .start-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.start-main { gap: 12px; }
.start-brand { display: flex; align-items: center; gap: 12px; }
.metro-mark { width: 58px; height: auto; filter: drop-shadow(0 6px 18px #d7262e55); }
.start-brand h1 { font: 700 34px/1 var(--f-display); letter-spacing: .3px; }
.start-brand h1 span { color: #ff5a61; }
.start-ver { font: 500 11px/1 var(--f-data); color: var(--muted); border: 1px solid var(--panel-border); border-radius: 5px; padding: 4px 6px; }
.start-hero { display: grid; gap: 8px; }
.start-hero h2 { font: 700 clamp(30px, 3.6vw, 42px)/1.02 var(--f-display); letter-spacing: -.2px; text-wrap: balance; }
.tagline { color: #a8b3bf; font-size: 15px; line-height: 1.45; }

.line-picker { display: grid; gap: 8px; }
.line-chips { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) repeat(2, minmax(0, 1.3fr)); gap: 4px; }
.line-chip {
  position: relative;
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: var(--surface);
  color: var(--text);
  font: 700 18px/1 var(--f-display);
  cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .15s;
}
.line-chip::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 6px; height: 3px; border-radius: 2px; background: var(--c); }
.line-chip:hover { background: var(--raise); transform: translateY(-1px); }
.line-chip[aria-checked="true"] { background: var(--c); color: var(--on-c); border-color: transparent; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--c); }
.line-chip[aria-checked="true"]::after { display: none; }
.chip-lock { position: absolute; top: 3px; right: 3px; width: 11px; height: 11px; opacity: .75; }

.line-card { display: grid; gap: 10px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--panel-border); }
.line-card-route { font: 600 18px/1.15 var(--f-display); letter-spacing: .4px; text-wrap: balance; }
.line-card-map { position: relative; height: 16px; margin: 0 6px; }
.line-card-bar { position: absolute; left: -6px; right: -6px; top: 6px; height: 4px; border-radius: 2px; background: var(--line); }
.line-card-map i { position: absolute; top: 4px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--bg); border: 2px solid #fff; }
.line-card-map i.combo { top: 2px; width: 12px; height: 12px; margin-left: -6px; border-width: 3px; }
.line-card-ends { display: flex; justify-content: space-between; gap: 8px; margin-top: -4px; font-size: 12px; color: var(--muted); }
.line-card-facts { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.line-card-facts div { display: grid; gap: 4px; }
.line-card-facts dd { font: 700 18px/1 var(--f-data); }
.line-card-text { font-size: 13px; line-height: 1.45; color: #a8b3bf; }
.line-card-text:empty { display: none; }
/* Clima (1.5) */
/* Hora en Santiago y tramo tarifario (1.8) */
.clock-now { display: grid; gap: 6px; }
.clock-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.clock-time { font-family: var(--f-data); font-size: 30px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.clock-band { --c: var(--muted); display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px 5px 9px; border: 1px solid color-mix(in srgb, var(--c) 55%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--c) 14%, transparent); font-size: 13px; font-weight: 700; white-space: nowrap; }
.clock-band i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.clock-band b { font-family: var(--f-data); font-size: 12px; color: var(--muted); }
.clock-band.punta { --c: #ff5a4f; }
.clock-band.valle { --c: var(--warn); }
.clock-band.baja  { --c: var(--ok); }
.clock-band.closed { --c: var(--dim); }
.clock-band.changed { animation: clockPulse .9s ease-out; }
@keyframes clockPulse { 0% { transform: scale(1.12); } 100% { transform: none; } }
.clock-note { font-size: 12px; color: var(--muted); line-height: 1.35; }
.weather-picker { display: grid; gap: 6px; }
.weather-seg button { padding: 6px 2px 5px; text-align: center; justify-items: center; gap: 2px; }
.weather-seg button b { font-size: 17px; line-height: 1; white-space: nowrap; }
.weather-seg button span { font-size: 11px; max-width: 100%; letter-spacing: -.1px; }
.weather-now { font-size: 12px; color: var(--muted); line-height: 1.35; }

.start-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.tool-button {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px;
  border-radius: 8px; border: 1px solid var(--panel-border); background: transparent; color: #c9d2db; font-size: 13px; cursor: pointer;
}
.tool-button:hover { background: var(--raise); }
.tool-button[hidden] { display: none; }
.creator-launch { border-color: #34d17c66; color: #bff0d3; }

.mode-selection { display: grid; gap: 10px; }
.start-note.disclaimer { margin-top: 6px; font-size: 11.5px; line-height: 1.5; color: var(--dim); }
.mode-card {
  display: grid;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.mode-card:hover { border-color: #ffffff2e; }
.mode-head { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 16px; align-items: center; }
.mode-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 10px; background: var(--raise); color: var(--text); font-size: 26px; }
.mode-text { display: grid; gap: 3px; min-width: 0; }
.mode-text strong { font: 700 22px/1.1 var(--f-display); letter-spacing: .2px; }
.mode-text small { font-size: 14px; line-height: 1.45; color: #9aa6b3; }
.mode-card .go-button { display: inline-flex; align-items: center; gap: 8px; background: transparent; border: 1px solid #ffffff2e; color: var(--text); }
.mode-card .go-button:hover { background: var(--raise); filter: none; }
.mode-opts { display: none; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 14px; align-items: end; padding-top: 14px; border-top: 1px solid var(--hair); margin-left: 64px; }
.mode-card.selected { cursor: default; border-color: color-mix(in srgb, var(--line) 70%, transparent); background: linear-gradient(180deg, color-mix(in srgb, var(--line) 13%, var(--surface)), var(--surface)); }
.mode-card.selected .mode-icon { background: var(--line); color: var(--on-line); }
.mode-card.selected .go-button { background: var(--line); border-color: transparent; color: var(--on-line); padding-inline: 22px; }
.mode-card.selected .go-button:hover { filter: brightness(1.1); }
.mode-card.selected .mode-opts { display: grid; }
.field { display: grid; gap: 6px; min-width: 0; }
.field select {
  width: 100%; min-height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid #ffffff26;
  background: var(--bg); color: var(--text); font-size: 14px; text-overflow: ellipsis;
}
.seg { display: flex; min-width: 0; border: 1px solid #ffffff26; border-radius: 8px; overflow: hidden; }
.seg button {
  flex: 1; min-width: 0; min-height: 40px; padding: 4px 12px; display: grid; gap: 1px; text-align: left;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.seg button + button { border-left: 1px solid #ffffff1a; }
.seg button b { font: 600 13px/1.2 var(--f-body); color: inherit; }
.seg button span { font-size: 11.5px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg button[aria-checked="true"] { background: var(--raise); color: var(--text); box-shadow: inset 0 -2px 0 var(--line); }
.tutorial-launch {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 4px;
  border: 0; background: transparent; color: var(--warn); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.tutorial-launch:hover { text-decoration: underline; text-underline-offset: 3px; }
.mode-lock { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; font-size: 13px; color: #ffd9a0; }
.mode-lock[hidden] { display: none; }

/* Multijugador: unirse a la sala de un Centro de Control (net/) */
.net-launch { grid-column: 1 / -1; justify-self: start; color: var(--muted); }
.net-join { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) 110px auto; gap: 10px 12px; align-items: end; }
.net-join[hidden] { display: none; }
.net-join input {
  width: 100%; min-height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid #ffffff26;
  background: var(--bg); color: var(--text); font-size: 14px;
}
#netCode { font-family: var(--f-data); letter-spacing: 4px; text-transform: uppercase; }
.net-join input:focus-visible { outline: 2px solid var(--line); outline-offset: 1px; }
.net-join .go-button { min-height: 40px; }
.net-join .go-button:disabled { opacity: .6; cursor: progress; }
.net-msg { grid-column: 1 / -1; margin: 0; min-height: 0; font-size: 13px; color: #ffd9a0; }
.net-msg:empty { display: none; }
.net-join small { grid-column: 1 / -1; color: var(--muted); font-size: 12px; line-height: 1.4; }
@media (max-width: 560px) { .net-join { grid-template-columns: minmax(0, 1fr) 96px; } .net-join .go-button { grid-column: 1 / -1; } }
.net-badge {
  position: absolute; left: calc(18px + env(safe-area-inset-left)); top: calc(118px + env(safe-area-inset-top)); z-index: 6;
  padding: 4px 10px; border-radius: 999px; background: #0b1a12cc; border: 1px solid #34d17c66; color: #bff0d3;
  font: 600 12px/1.3 var(--f-data); pointer-events: none; white-space: nowrap;
}
.touch-mode .net-badge { left: 50%; top: calc(12px + env(safe-area-inset-top)); transform: translateX(-50%); }
.net-badge.off { background: #2a1a0ccc; border-color: #ffb02066; color: #ffd9a0; }

.shop-launch {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%;
  padding: 14px 18px; border-radius: 12px; border: 1px dashed #ffffff2e; background: transparent;
  color: var(--text); text-align: left; cursor: pointer;
}
.shop-launch:hover { border-color: var(--warn); background: #ffc2470d; }
.shop-launch .ico { width: 22px; height: 22px; color: var(--warn); }
.shop-launch b { font: 600 18px/1 var(--f-display); letter-spacing: .3px; }
.shop-launch span { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-balance-mini { font: 700 16px/1 var(--f-data); color: var(--ok); }

.start-keys { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.start-keys kbd { margin-right: 2px; }
.start-note { font-size: 12px; color: var(--dim); }
.version { position: relative; padding-top: 20px; color: var(--dim); font: 500 10px/1.5 var(--f-data); letter-spacing: .8px; text-transform: uppercase; text-align: center; }
body.touch-mode .start-keys { display: none; }

@media (max-width: 900px) {
  .start-layout { grid-template-columns: minmax(0, 1fr); max-width: 620px; }
  .start-hero h2 { font-size: 30px; }
}
@media (max-width: 560px) {
  .start-screen { padding-top: max(18px, env(safe-area-inset-top)); }
  .start-side { gap: 14px; }
  .start-hero h2 { font-size: 26px; }
  .tagline { font-size: 14px; }
  .line-chip { height: 40px; font-size: 16px; }
  .mode-card { padding: 14px; }
  .mode-head { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
  .mode-icon { display: none; }
  .mode-text strong { font-size: 19px; }
  .mode-text small { font-size: 13px; }
  .mode-card:not(.selected) .mode-text small { display: none; }
  .mode-card.selected .mode-head { grid-template-columns: minmax(0, 1fr); }
  .mode-card.selected .go-button { justify-content: center; min-height: 46px; }
  .mode-opts { grid-template-columns: minmax(0, 1fr); margin-left: 0; }
  .shop-launch { grid-template-columns: auto minmax(0, 1fr) auto; }
  .shop-launch span { display: none; }
}
/* Celular o tableta en vertical: los modos de juego suben justo después de la línea elegida
   (antes había que bajar pasando por la hora y el clima para llegar a «Conducir») */
@media (max-width: 900px) and (min-height: 521px) {
  .start-side, .start-main { display: contents; }
  .start-layout { gap: 14px; }
  .start-brand { order: 1; } .start-hero { order: 2; } .line-picker { order: 3; } .line-card { order: 4; }
  .start-main > .small-label { order: 5; margin-top: 8px; } .mode-selection { order: 6; } .shop-launch { order: 7; }
  .clock-now { order: 8; margin-top: 2px; } .weather-picker { order: 9; } .start-tools { order: 10; }
  .start-keys { order: 11; } .start-note { order: 12; }
  .start-tools:not(:has(.tool-button:not([hidden]))) { display: none; }
}
@media (max-width: 900px), (max-height: 520px) and (orientation: landscape) {
  /* Ida/Vuelta y vehículos: el recorrido se lee entero en dos líneas en vez de cortarse con «…» */
  #directionSeg button span, #vehicleSeg button span { white-space: normal; }
  #vehicleSeg button { padding-inline: 10px; }
}
/* Celular en horizontal: marca y modos lado a lado, todo más compacto */
@media (max-height: 520px) and (orientation: landscape) {
  .start-screen { padding-top: max(12px, env(safe-area-inset-top)); }
  .start-layout { grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 14px 24px; max-width: none; }
  .start-side { gap: 10px; }
  .start-hero .eyebrow, .tagline, .line-card-text, .start-note, .weather-now, .clock-note { display: none; }
  .clock-time { font-size: 22px; }
  .start-hero h2 { font-size: 22px; }
  .metro-mark { width: 40px; }
  .start-brand h1 { font-size: 26px; }
  .line-chip { height: 36px; }
  .mode-card { padding: 10px 14px; gap: 10px; }
  .mode-icon { width: 38px; height: 38px; font-size: 20px; }
  .mode-head { grid-template-columns: 38px minmax(0, 1fr) auto; }
  .mode-text small { display: none; }
  .mode-opts { margin-left: 0; padding-top: 10px; }
}

/* ---------- 3. Pantalla de juego y HUD superior ---------- */
.game-screen, #gameContainer, #hud { position: absolute; inset: 0; }
.game-screen { background: #000; }
#gameContainer canvas { display: block; width: 100%; height: 100%; cursor: grab; }
#gameContainer canvas:active { cursor: grabbing; }
#hud { pointer-events: none; }

/* Paneles del HUD: fondo translúcido con desenfoque, filete fino y un solo radio */
.hud-brand, .hud-clock, .sound-button, .back-button, .selector-hud, .driver-hud, .passenger-hud,
.controls-help, .help-chip, .score-pill, .bank-pill, .mission-tracker, .message {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 28px #0006;
}

.hud-top {
  position: absolute;
  top: 16px;
  left: 18px;
  right: 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.hud-brand { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 7px 12px 7px 7px; }
.line-badge {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--line);
  color: var(--on-line);
  font: 700 22px/1 var(--f-display);
}
.hud-route { display: grid; gap: 3px; min-width: 0; }
.hud-route strong { font: 600 17px/1.1 var(--f-display); letter-spacing: .5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mode-pill {
  flex: none;
  padding: 5px 8px;
  border-radius: 5px;
  background: var(--raise);
  font: 600 10px/1 var(--f-data);
  letter-spacing: 1.2px;
  color: #c6d0da;
}
.hud-clock { display: grid; gap: 4px; padding: 8px 14px; text-align: right; }
#clock { font: 700 19px/1 var(--f-data); font-variant-numeric: tabular-nums; }

.back-button {
  position: absolute;
  top: 76px;
  left: 18px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  color: #dfe6ee;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: none;
}
.back-button:hover { background: #141e29ee; }

/* ---------- 4. Esquema de línea ---------- */
/* Va en su propia placa (::before) para leerse igual en el túnel y en la calle a pleno sol */
.line-strip {
  position: absolute;
  top: 30px;
  left: 50%;
  width: min(34vw, 420px);
  height: 30px;
  transform: translateX(-50%);
}
.line-strip::before {
  content: "";
  position: absolute;
  inset: -10px -18px -12px;
  z-index: -1;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.line-strip-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 6px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
}
.line-strip-stop {
  position: absolute;
  top: 2px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border: 2px solid #e6ebf0;
  border-radius: 50%;
  background: #0b1118;
}
.line-strip-stop span {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  font: 600 9.5px/1 var(--f-data);
  letter-spacing: .6px;
  color: var(--muted);
  white-space: nowrap;
}
.line-strip-train {
  position: absolute;
  top: -1px;
  width: 20px;
  height: 18px;
  margin-left: -10px;
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 0 0 2px #0b1118, 0 0 12px #ffffff99;
  transition: left .2s linear;
}

/* ---------- 5. Selector de mando ---------- */
.selector-hud {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  gap: 8px;
  padding: 12px 10px;
}
#notchList { list-style: none; display: grid; gap: 3px; }
#notchList li {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 6px;
  min-width: 128px;
  padding: 4px 8px;
  border-radius: 6px;
  background: #ffffff08;
  color: var(--dim);
  font-size: 10px;
  text-align: left;
  transition: background .12s, color .12s;
}
#notchList li b { font: 700 13px/1.2 var(--f-data); }
#notchList li small { font-size: 10px; letter-spacing: .3px; text-transform: uppercase; }
#notchList li.power b { color: #7fd3ff; }
#notchList li.neutral b { color: #c9d2db; }
#notchList li.brake b { color: #ffcf85; }
#notchList li.emergency b { color: #ff8080; }
#notchList li.active { color: #0a121b; font-weight: 700; }
#notchList li.active b { color: #0a121b; }
#notchList li.active.power { background: var(--power); box-shadow: 0 0 14px #5cc8ff59; }
#notchList li.active.neutral { background: var(--neutral); }
#notchList li.active.brake { background: var(--brake); box-shadow: 0 0 14px #ffb54759; }
#notchList li.active.emergency { background: var(--emergency); color: #fff; box-shadow: 0 0 18px #ff4d4d88; animation: blink 0.8s steps(2) infinite; }
#notchList li.active.emergency b { color: #fff; }
#notchList li.separator { margin-top: 5px; }
@keyframes blink { 50% { opacity: .55; } }

/* ---------- 6. Panel del conductor (consola de instrumentos) ---------- */
.driver-hud {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  overflow: hidden;
  border-radius: 14px;
  box-shadow: 0 16px 50px #0009;
}
.panel {
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 12px 18px;
  border-left: 1px solid var(--hair);
}
.panel:first-child { border-left: 0; }
.station-sub { font-size: 12px; color: #a7b3bf; }

/* Velocímetro circular */
.speed-panel {
  position: relative;
  grid-template-columns: auto;
  place-items: center;
  width: 150px;
  padding: 8px 12px;
}
.speed-gauge { width: 118px; height: 118px; }
.gauge-track, .gauge-fill {
  fill: none;
  stroke-width: 9;
  stroke-linecap: round;
  transform: rotate(135deg);
  transform-origin: 60px 60px;
}
.gauge-track { stroke: #ffffff14; stroke-dasharray: 235.6 314.2; }
.gauge-fill { stroke: var(--power); stroke-dasharray: 0 314.2; transition: stroke .2s; }
.gauge-fill.over { stroke: var(--emergency); }
.gauge-limit { stroke: var(--emergency); stroke-width: 4; stroke-linecap: round; }
.speed-readout {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 3px;
}
.speed-number { font: 700 38px/.95 var(--f-data); font-variant-numeric: tabular-nums; letter-spacing: -1px; }
.speed-readout .small-label { font-size: 9px; }
.limit-sign {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 4px solid var(--emergency);
  border-radius: 50%;
  background: #fff;
  color: #111;
  font: 700 13px/1 var(--f-display);
}

/* Estación y precisión de parada */
.station-panel { min-width: 240px; }
.station-panel strong { font: 700 25px/1.05 var(--f-display); letter-spacing: .4px; }
#distance { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.precision { display: grid; gap: 4px; margin-top: 4px; }
.precision span { font-size: 12px; font-variant-numeric: tabular-nums; color: #cfe0f1; }
.precision-scale {
  position: relative;
  height: 10px;
  border-radius: 5px;
  background: #ffffff14;
  overflow: hidden;
}
.precision-ok {
  position: absolute;
  left: 50%;
  width: 25%;
  transform: translateX(-50%);
  top: 0;
  bottom: 0;
  background: #34d17c40;
}
.precision-center { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--ok); }
.precision-marker {
  position: absolute;
  top: 1px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px #fff;
}

/* Maniobra de retorno (1.7): lista de pasos */
.turn-panel {
  position: absolute;
  top: 130px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  min-width: 300px;
  max-width: min(460px, calc(100vw - 32px));
  padding: 10px 14px 10px;
  border-radius: 10px;
  background: #0b1118e6;
  border: 1px solid #ffd16655;
  box-shadow: 0 6px 24px #0008;
  color: var(--text, #e8eef5);
  pointer-events: none;
}
.turn-panel b { display: block; font-size: 12px; letter-spacing: .6px; color: #ffd166; margin-bottom: 6px; }
.turn-panel ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.turn-panel li { font-size: 14px; padding-left: 22px; position: relative; color: #9fb0c2; }
.turn-panel li::before { content: "○"; position: absolute; left: 2px; top: 0; }
.turn-panel li.now { color: #fff; font-weight: 700; }
.turn-panel li.now::before { content: "▶"; color: #ffd166; }
.turn-panel li.done { color: #6fe39a; }
.turn-panel li.done::before { content: "✓"; }
@media (max-width: 700px) { .turn-panel { top: 96px; min-width: 0; } .turn-panel li { font-size: 12px; } }

/* Asistente de parada: punto previsto (anillo) y aviso de frenado */
.precision.wide .precision-scale { background: linear-gradient(90deg, #ffffff10, #ffffff1c 50%, #ff4b4b30); }
.precision-ghost {
  position: absolute;
  top: -1px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  border: 2px solid var(--ok);
  box-sizing: border-box;
  transition: left .12s linear;
}
.precision-ghost.bad { border-color: #ff6b5b; }
.precision-scale { overflow: visible; }
.assist-cue {
  display: block;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .2px;
  color: #cfe0f1;
  background: #ffffff10;
}
.assist-cue.ok { color: #6fe39a; background: #34d17c22; }
.assist-cue.warn { color: #1a1205; background: #ffb000; }
.assist-cue.alert { color: #fff; background: #d42026; animation: assist-blink .5s steps(2) infinite; }
@keyframes assist-blink { 50% { background: #6a1010; } }

/* Puertas */
.door-panel { min-width: 180px; }
.door-row { display: flex; align-items: center; gap: 9px; }
.door-row strong { font: 600 19px/1 var(--f-display); letter-spacing: .5px; }
.lamp {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #3a86ff;
  box-shadow: 0 0 10px #3a86ff;
}
.lamp.open { background: var(--ok); box-shadow: 0 0 12px var(--ok); }
.lamp.moving { background: var(--warn); box-shadow: 0 0 12px var(--warn); animation: blink .6s steps(2) infinite; }

/* ---------- 7. Pasajero, ayuda y mensajes ---------- */
/* Abajo a la derecha: no tapa el centro de la vista */
.passenger-hud {
  position: absolute;
  bottom: 22px;
  right: 18px;
  display: grid;
  gap: 5px;
  width: min(360px, calc(100% - 36px));
  padding: 12px 16px 12px 18px;
  overflow: hidden;
}
.passenger-hud::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--line); }
.passenger-hud strong { font: 700 24px/1.05 var(--f-display); letter-spacing: .5px; }

.controls-help {
  position: absolute;
  bottom: 22px;
  left: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 22px;
  width: min(620px, calc(100vw - 36px));
  padding: 12px 16px 14px;
  color: #c4cfdb;
  font-size: 12.5px;
  line-height: 1.3;
  box-shadow: none;
}
/* Ayuda en dos columnas, por grupos; cada acción en su línea con su tecla */
.controls-help > * { min-width: 0; }
.controls-help kbd { margin-right: 3px; }
.controls-help small { display: block; margin-top: 2px; padding-left: 2px; font-size: 11px; color: var(--muted); }
.controls-help .help-title { grid-column: 1 / -1; display: flex; gap: 6px; align-items: center; }
.controls-help .help-title span { color: var(--dim); letter-spacing: 0; text-transform: none; }
.controls-help .help-group { grid-column: 1 / -1; margin-top: 4px; padding-top: 7px; border-top: 1px solid var(--hair); font: 600 10px/1 var(--f-data); letter-spacing: 1.2px; text-transform: uppercase; color: var(--warn); }
.controls-help .help-title + .help-group { margin-top: 0; padding-top: 0; border-top: 0; }
/* Con la ayuda oculta queda un botón pequeño para volver a abrirla */
.help-chip {
  position: absolute;
  bottom: 22px;
  left: 18px;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 7px 8px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: none;
}
.help-chip:hover { color: var(--text); }
.controls-help.hidden + .help-chip { display: inline-flex; }
body.touch-mode .help-chip { display: none !important; }
/* Conductor: la ayuda se abre sobre la consola, no encima de ella */
#driverHud:not(.hidden) ~ .controls-help { bottom: 186px; }
@media (max-width: 1240px) { #driverHud:not(.hidden) ~ .help-chip { bottom: 186px; } }

.message {
  position: absolute;
  top: 136px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 14px;
  max-width: min(560px, calc(100% - 40px));
  width: max-content;
  color: #e6edf4;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  opacity: 0;
  transition: opacity .2s;
}
.message::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--power); box-shadow: 0 0 10px var(--power); }
.message.visible { opacity: 1; }
.message.ok::before { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.message.warn { border-color: #ffc24766; color: #ffe7b0; }
.message.warn::before { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.message.alert { border-color: #ff4d4daa; background: #2a0d10ee; color: #ffd6d6; }
.message.alert::before { background: var(--emergency); box-shadow: 0 0 10px var(--emergency); }

/* ---------- 8. Responsive ---------- */
@media (max-width: 980px) {
  .controls-help { display: none; }
  .line-strip { display: none; }
}
@media (max-width: 720px) {
  .driver-hud { width: calc(100% - 20px); bottom: 12px; }
  .panel { padding: 10px 10px; }
  .speed-panel { width: 112px; }
  .speed-gauge { width: 90px; height: 90px; }
  .speed-number { font-size: 28px; }
  .station-panel { min-width: 0; flex: 1; }
  .station-panel strong { font-size: 15px; }
  .door-panel { display: none; }
  .selector-hud { top: auto; bottom: 150px; transform: none; right: 10px; padding: 8px 6px; }
  #notchList li { min-width: 0; grid-template-columns: 1fr; padding: 3px 8px; }
  #notchList li small { display: none; }
  .hud-route, .mode-pill { display: none; }
  .message { white-space: normal; width: calc(100% - 40px); text-align: center; }
}

/* ---------- 9. Alpha 0.3: sonido, inversor y viajeros ---------- */

.hud-right { display: flex; align-items: flex-start; gap: 10px; }
.sound-button {
  pointer-events: auto;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: #dfe6ee;
  font-size: 17px;
  cursor: pointer;
  box-shadow: none;
}
.sound-button:hover { background: #141e29ee; }
.sound-button.off { color: var(--emergency); }

.reverser-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 6px;
}
.reverser-pills span {
  padding: 6px 0;
  text-align: center;
  border-radius: 6px;
  background: #ffffff0a;
  color: var(--dim);
  font: 700 13px/1 var(--f-data);
}
.reverser-pills span.active[data-dir="1"] { background: var(--ok); color: #0a121b; box-shadow: 0 0 12px #34d17c59; }
.reverser-pills span.active[data-dir="0"] { background: var(--neutral); color: #0a121b; }
.reverser-pills span.active[data-dir="-1"] { background: var(--brake); color: #0a121b; box-shadow: 0 0 12px #ffb54759; }

.station-sub.onboard { color: #8fb4d6; }
#doorHint.ready { color: var(--ok); }

@media (max-width: 720px) {
  .sound-button { width: 36px; height: 36px; }
}

/* ---------- 10. Alpha 0.4: Línea 3, señales, horarios y pasajero a pie ---------- */
.line-dot {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--line);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  vertical-align: middle;
}
.line-dot.big { width: 64px; height: 64px; margin: 0 auto 6px; border-radius: 14px; color: var(--on-line); font: 700 36px/1 var(--f-display); }

.go-button, .ghost-button {
  min-height: 40px;
  padding: 9px 16px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, filter .15s, border-color .15s;
}
.go-button { border: 1px solid transparent; background: var(--line); color: var(--on-line); }
.go-button:hover { filter: brightness(1.12); }
.ghost-button { border: 1px solid #ffffff2e; background: transparent; color: var(--text); }
.ghost-button:hover { background: var(--raise); }

/* Pantalla de carga */
.loading-screen { display: grid; place-items: center; background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--line) 22%, var(--bg)) 0, var(--bg) 60%); }
.loading-card { display: grid; justify-items: center; gap: 10px; width: min(320px, 86vw); text-align: center; }
.loading-card strong { font: 700 28px/1.1 var(--f-display); letter-spacing: .3px; }
.loading-card small { color: var(--muted); font-size: 14px; }
/* 1.10.2 · La barra avanza con lo que lleva cargado (main.js · setLoading) */
.loading-bar { width: 100%; height: 6px; margin-top: 6px; border-radius: 3px; background: #ffffff14; overflow: hidden; }
.loading-bar i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--line); transition: width .25s ease-out; }
.loading-card .loading-pct { font-variant-numeric: tabular-nums; font-size: 12px; }
@media (prefers-reduced-motion: reduce) { .loading-bar i { transition: none; } }

/* Esquema de línea con 21 estaciones: solo se rotulan terminales y la estación actual */
.line-strip { width: min(46vw, 620px); }
.line-strip-stop { width: 9px; height: 9px; margin-left: -4.5px; top: 3.5px; border-width: 2px; }
.line-strip-stop.combo { width: 12px; height: 12px; margin-left: -6px; top: 2px; border-width: 3px; }
.line-strip-stop span { display: none; }
.line-strip-stop.terminal span, .line-strip-stop.current span { display: block; }
.line-strip-stop.current { background: #fff; box-shadow: 0 0 0 3px #0b1118, 0 0 0 5px #ffffff88; }
.line-strip-stop.current span { color: var(--text); }
.line-strip-stop.terminal.crowded span { display: none; }   /* la actual está al lado: no se montan los nombres */

/* Panel de señal y horario */
.signal-panel { min-width: 170px; }
.signal-row { display: flex; align-items: center; gap: 10px; }
.signal-row > span:last-child { display: grid; gap: 1px; }
.signal-row strong { font: 700 17px/1.1 var(--f-data); }
.signal-head {
  display: grid;
  gap: 3px;
  padding: 4px;
  border-radius: 6px;
  background: #05080b;
  border: 1px solid #ffffff1a;
}
.signal-head i { display: block; width: 11px; height: 11px; border-radius: 50%; background: #1f262d; }
.signal-head i.on[data-a="red"] { background: #ff3030; box-shadow: 0 0 10px #ff3030; }
.signal-head i.on[data-a="yellow"] { background: #ffb000; box-shadow: 0 0 10px #ffb000; }
.signal-head i.on[data-a="green"] { background: #30ff7a; box-shadow: 0 0 10px #30ff7a; }
.delay { font: 700 18px/1.1 var(--f-data); font-variant-numeric: tabular-nums; }
.delay.ontime { color: var(--ok); }
.delay.late { color: var(--emergency); }
.delay.early { color: var(--warn); }

/* Pasajero a pie */
.pax-hint { color: #cfe0f1; margin-top: 2px; }
.crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: #ffffffaa;
  box-shadow: 0 0 0 1px #0008;
}
.help-walker, .help-driver { display: block; }

/* Resumen de servicio / viaje */
.summary {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #000a;
  backdrop-filter: blur(4px);
}
.summary-card {
  display: grid;
  gap: 10px;
  width: min(92vw, 460px);
  padding: 22px 24px;
  border: 1px solid var(--panel-border);
  border-top: 4px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 24px 70px #000b;
}
.summary-card h2 { font: 700 30px/1.05 var(--f-display); letter-spacing: .3px; text-wrap: balance; }
.summary-card ul { list-style: none; display: grid; gap: 0; }
.summary-card li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--hair); font-size: 14px; color: #c3ccd6; }
.summary-card li b { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); text-align: right; }
.summary-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }

@media (max-width: 980px) {
  .signal-panel { display: none; }
}

/* ---------- 11. Alpha 0.6: tarjeta bip!, boletería, fundido de cabina ---------- */
.card-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: center;
  padding: 5px 12px 5px 6px;
  border-radius: var(--radius);
  background: #214b87;
  color: #fff;
  font: 700 13px/1 var(--f-data);
  font-variant-numeric: tabular-nums;
  box-shadow: 0 6px 18px #0006;
}
.card-pill-logo { width: 34px; height: auto; border-radius: 3px; }
.card-pill.low { background: #5a1a1a; box-shadow: 0 0 0 2px #ff6b6b inset; }

.ticket-panel {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #0008;
  backdrop-filter: blur(3px);
  z-index: 5;
}
.ticket-card {
  display: grid;
  gap: 8px;
  width: min(94vw, 460px);
  max-height: 92vh;
  overflow: auto;
  padding: 18px 20px;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  border-top: 4px solid #f7a421;
  background: var(--surface);
  box-shadow: 0 24px 70px #000b;
}
.ticket-head { display: flex; align-items: center; gap: 12px; }
.ticket-head-text { display: grid; flex: 1; }
.ticket-head-text strong { font: 700 22px/1.1 var(--f-display); letter-spacing: .3px; }
.bip-logo {
  flex: none;
  width: 64px;
  height: auto;
  border-radius: 5px;
}
.ticket-close { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid #ffffff2e; border-radius: 8px; background: transparent; color: var(--text); font-size: 16px; cursor: pointer; }
.ticket-close:hover { background: var(--raise); }
.ticket-balance {
  display: flex;
  justify-content: space-between;
  align-items: end;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--raise);
}
.ticket-balance > div { display: grid; gap: 4px; }
.ticket-balance strong { font: 700 28px/1 var(--f-data); font-variant-numeric: tabular-nums; }
.ticket-fares { display: grid; gap: 4px; }
.fare-row { display: flex; justify-content: space-between; padding: 7px 10px; border-radius: 7px; background: #ffffff08; font-size: 13px; }
.fare-row b { font-family: var(--f-data); font-variant-numeric: tabular-nums; }
.fare-row.current { background: #ffc2471f; color: #ffe3a3; font-weight: 600; box-shadow: inset 3px 0 0 var(--warn); }
.ticket-amounts, .ticket-pay { display: flex; flex-wrap: wrap; gap: 6px; }
.ticket-amounts button, .ticket-pay button {
  padding: 8px 12px;
  border: 1px solid #ffffff26;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}
.ticket-amounts button { font-variant-numeric: tabular-nums; }
.ticket-amounts button:hover, .ticket-pay button:hover { background: var(--raise); }
.ticket-amounts button.selected, .ticket-pay button.selected { background: #f7a421; border-color: #f7a421; color: #14305c; }
.ticket-status { min-height: 38px; padding: 9px 12px; border-radius: 8px; background: #ffffff08; font-size: 13px; line-height: 1.4; color: #cfdae6; }
.ticket-status.ok { background: #34d17c1f; color: #c4f2d7; }
.ticket-status.error { background: #ff4d4d22; color: #ffd6d6; }
.ticket-actions { display: flex; justify-content: space-between; gap: 8px; }
.ticket-panel.busy .ticket-actions button { opacity: .5; pointer-events: none; }
#ticketPanel { --line: #f7a421; --on-line: #14305c; }      /* boletería y tótem: colores de la tarjeta bip! */
.ticket-panel.busy .ticket-status::after { content: " ⏳"; }

.fade {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #000;
  color: #dfe7f0;
  font-size: 16px;
  letter-spacing: 1px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .6s;
  z-index: 6;
}
.fade.visible { opacity: 1; }

/* ---------- Puntaje del conductor ---------- */
.score-pill {
  position: relative;
  display: grid;
  gap: 4px;
  min-width: 96px;
  padding: 8px 14px;
  text-align: right;
  transition: border-color .4s, box-shadow .4s;
}
.score-pill.perfect { border-color: var(--ok); box-shadow: 0 0 18px #34d17c55; }
#scoreTotal { font: 700 19px/1 var(--f-data); font-variant-numeric: tabular-nums; }
.score-streak { font: 700 10px/1 var(--f-data); color: var(--warn); letter-spacing: .5px; }
.score-streak:empty, .score-best:empty { display: none; }
.score-best { font: 500 10px/1 var(--f-data); color: var(--muted); }
.score-float {
  position: absolute;
  right: 12px;
  top: 100%;
  font-weight: 800;
  font-size: 16px;
  opacity: 0;
  pointer-events: none;
}
.score-float.gain { color: var(--ok); }
.score-float.loss { color: var(--emergency); }
.score-float.show { animation: scoreFloat 1.4s ease-out forwards; }
@keyframes scoreFloat {
  0%   { opacity: 0; transform: translateY(0); }
  15%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(22px); }
}
@media (max-width: 640px) {
  .score-pill { min-width: 0; padding: 6px 10px; }
  #scoreTotal { font-size: 16px; }
  .score-best { display: none; }
}

/* ---------- Alpha 0.9: cuenta bancaria, misiones, locales de la calle ---------- */
.bank-pill {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 8px 14px;
  text-align: right;
}
.bank-pill strong { font: 700 19px/1 var(--f-data); font-variant-numeric: tabular-nums; color: var(--ok); }
.bank-pill.low { border-color: #ff6b6b88; }
.bank-pill.low strong { color: #ff9a9a; }
.money-float {
  position: absolute;
  right: 12px;
  top: 100%;
  font-weight: 800;
  font-size: 15px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}
.money-float.gain { color: var(--ok); }
.money-float.loss { color: #ff8a8a; }
.money-float.show { animation: scoreFloat 1.8s ease-out forwards; }

.mission-tracker {
  position: absolute;
  top: 122px;
  left: 18px;
  display: grid;
  gap: 5px;
  width: min(320px, calc(100% - 36px));
  padding: 10px 14px 10px 17px;
  overflow: hidden;
}
.mission-tracker::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--warn); }
.mission-tracker strong { font: 600 17px/1.15 var(--f-display); letter-spacing: .3px; }
.mission-tracker ol, .mission-item ol { list-style: none; display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
.mission-tracker li::before, .mission-item li::before { content: "○ "; }
.mission-tracker li.current, .mission-item li.current { color: #ffe3a3; font-weight: 600; }
.mission-tracker li.current::before, .mission-item li.current::before { content: "▶ "; }
.mission-tracker li.done, .mission-item li.done { color: #6cc895; text-decoration: line-through; }
.mission-tracker li.done::before, .mission-item li.done::before { content: "✔ "; }

.store-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--raise);
  font-size: 26px;
}
.store-card, .mission-card { border-top-color: var(--ok); }
.mission-card { width: min(94vw, 560px); border-top-color: var(--warn); }
.store-list { display: grid; gap: 6px; }
.store-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid #ffffff1c;
  border-radius: 9px;
  background: #ffffff06;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.store-item:hover { background: var(--raise); border-color: #ffffff2e; }
.store-item b { font-family: var(--f-data); font-variant-numeric: tabular-nums; white-space: nowrap; }
.store-item.expensive { opacity: .55; }
.store-item.mission { border-color: #ffc24766; background: #ffc2471a; color: #ffe3a3; }
#storePanel.busy .store-item { opacity: .5; pointer-events: none; }
#storePanel.busy .ticket-status::after { content: " ⏳"; }

.mission-active:empty { display: none; }
.mission-offers { display: grid; gap: 8px; }
.mission-item {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid #ffffff1c;
  border-radius: var(--radius);
  background: #ffffff06;
}
.mission-item.active { border-color: #ffc24766; background: #ffc24710; }
.mission-item-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.mission-item-head b { font: 600 18px/1.15 var(--f-display); letter-spacing: .2px; }
.mission-reward { color: var(--ok); font: 700 14px/1 var(--f-data); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mission-item p { font-size: 13px; color: #cfdae6; line-height: 1.35; }
.mission-item button { justify-self: end; padding: 7px 12px; }

.photo-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 7;
}
.photo-flash.show { animation: photoFlash .7s ease-out; }
@keyframes photoFlash { 0% { opacity: .95; } 100% { opacity: 0; } }

@media (max-width: 720px) {
  .mission-tracker { top: 112px; left: 10px; padding: 8px 10px; width: min(250px, calc(100% - 20px)); }
  .mission-tracker ol { display: none; }
  .bank-pill { padding: 5px 8px; }
  .bank-pill strong { font-size: 14px; }
}

/* Esquema de línea bajo la barra superior (no se monta sobre el nombre de la línea) */
#gameScreen .line-strip { top: 76px; }

/* ===== Libreta de misiones (tablero J) ===== */
.mission-book { margin: 10px 0 6px; padding: 10px 12px; border: 1px solid var(--panel-border); border-radius: 12px; background: #ffffff08; }
.mission-book-head { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.mission-book ul { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.mission-book li { padding: 4px 9px; border-radius: 999px; font-size: 12px; border: 1px dashed #ffffff33; color: var(--muted); }
.mission-book li.done { border: 1px solid var(--ok); color: #fff; background: #6fe39a22; }

/* ===== Celebración: libreta completa (celebration.js) ===== */
.celebration {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 50% 40%, #00000055, #000000cc);
  animation: celebIn .45s ease-out;
}
.celebration.leaving { animation: celebOut .35s ease-in forwards; }
@keyframes celebIn { from { opacity: 0; } }
@keyframes celebOut { to { opacity: 0; } }
.celebration .confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.celebration-card {
  position: relative; overflow: hidden; width: min(520px, 100%); max-height: 100%; overflow-y: auto;
  padding: 26px 24px 22px; border-radius: 22px; text-align: center; color: var(--text);
  background: linear-gradient(180deg, #121c28f2, #0a121bf5); border: 2px solid var(--medal);
  box-shadow: 0 0 60px color-mix(in srgb, var(--medal) 55%, transparent), 0 20px 60px #000a;
  animation: celebPop .7s cubic-bezier(.2, 1.6, .4, 1) both .1s;
}
@keyframes celebPop { from { transform: scale(.4) translateY(40px); opacity: 0; } }
.celebration-rays {
  position: absolute; left: 50%; top: 92px; width: 520px; height: 520px; margin: -260px 0 0 -260px; z-index: 0; opacity: .22;
  background: repeating-conic-gradient(var(--medal) 0 9deg, transparent 9deg 22deg);
  border-radius: 50%; animation: spin 16s linear infinite; pointer-events: none;
  mask-image: radial-gradient(circle, #000 20%, transparent 68%);
}
@keyframes spin { to { transform: rotate(1turn); } }
.celebration-card > :not(.celebration-rays) { position: relative; z-index: 1; }
.medal { display: inline-grid; justify-items: center; margin-bottom: 6px; animation: medalDrop 1s cubic-bezier(.3, 1.5, .5, 1) both .35s; }
@keyframes medalDrop { from { transform: translateY(-120px) rotate(-25deg); opacity: 0; } }
.medal-ribbon { width: 46px; height: 34px; margin-bottom: -6px; background: linear-gradient(90deg, var(--medal) 0 33%, #fff 33% 66%, var(--medal) 66%); clip-path: polygon(0 0, 100% 0, 80% 100%, 20% 100%); }
.medal-disc {
  position: relative; display: grid; place-items: center; width: 112px; height: 112px; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 35% 30%, #fff6c8, #ffd23f 40%, #c9952a 75%, #8a6416);
  box-shadow: inset 0 0 0 7px #e8b53a, inset 0 0 0 11px #fff4, 0 6px 22px #0008;
}
.medal-disc b {
  display: grid; place-items: center; width: 70px; height: 70px; border-radius: 50%; font: 900 34px/1 Arial, sans-serif; color: #fff;
  background: var(--medal); box-shadow: 0 0 0 4px #fff, 0 3px 8px #0006; text-shadow: 0 2px 2px #0005;
}
.medal-disc::after {
  content: ""; position: absolute; inset: -40%; background: linear-gradient(115deg, transparent 40%, #ffffffaa 50%, transparent 60%);
  animation: shine 2.6s ease-in-out infinite 1.3s;
}
@keyframes shine { from { transform: translateX(-70%); } 60%, to { transform: translateX(70%); } }
.celebration-kicker { margin: 6px 0 0; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--medal); filter: brightness(1.8); }
.celebration-title { margin: 4px 0 2px; font-size: clamp(26px, 6vw, 38px); font-weight: 900; letter-spacing: .02em; text-shadow: 0 0 24px color-mix(in srgb, var(--medal) 70%, transparent); }
.celebration-sub { margin: 0 0 14px; color: var(--muted); }
.celebration-types { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; }
.celebration-types li { padding: 5px 10px; border-radius: 999px; font-size: 13px; background: #6fe39a22; border: 1px solid var(--ok); animation: stamp .45s cubic-bezier(.2, 1.8, .4, 1) both; }
@keyframes stamp { from { transform: scale(2.2); opacity: 0; } }
.celebration-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.celebration-stats div { padding: 10px; border-radius: 12px; background: #ffffff0d; }
.celebration-stats span { display: block; font-size: 12px; color: var(--muted); }
.celebration-stats b { font-size: 24px; }
.celebration-stats .c-reward { color: var(--ok); }
.celebration-grand { margin: 0 0 12px; padding: 12px; border-radius: 12px; background: linear-gradient(90deg, #ffd23f33, #ff5d8f33, #4fd6ff33); animation: stamp .6s both 2.2s; }
.celebration-grand p { margin: 0 0 4px; font-weight: 900; letter-spacing: .04em; color: #ffd23f; }
.celebration-grand span { font-size: 13px; color: var(--text); }
.celebration-grand.hidden { display: none; }
.celebration-lines { display: flex; justify-content: center; gap: 8px; margin: 0 0 18px; padding: 0; list-style: none; }
.celebration-lines li {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font: 800 13px/1 Arial, sans-serif;
  color: #ffffff55; border: 2px dashed #ffffff33;
}
.celebration-lines li.won { color: #fff; background: var(--c); border: 2px solid #ffd23f; }
.celebration-lines li.new { animation: stamp .6s cubic-bezier(.2, 1.8, .4, 1) both 1.8s; box-shadow: 0 0 16px #ffd23f; }
.celebration .go-button { padding: 12px 22px; font-size: 16px; background: var(--medal); border-radius: 12px; cursor: pointer; }
@media (prefers-reduced-motion: reduce) {
  .celebration-rays, .medal-disc::after { animation: none; }
}

/* ===== Tienda Metro (shopUI.js) ===== */
.shop-overlay { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 16px; background: #000a; }
.shop-card {
  --line: var(--warn); --on-line: #14110a;          /* la tienda tiene su propio acento dorado */
  display: flex; flex-direction: column; width: min(720px, 100%); max-height: min(88vh, 100%);
  border-radius: 14px; background: var(--surface); border: 1px solid var(--panel-border); border-top: 4px solid var(--warn); box-shadow: 0 24px 70px #000b; overflow: hidden;
}
.shop-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px 10px; }
.shop-head > div:first-child { flex: 1; }
.shop-head h2 { display: flex; align-items: center; gap: 10px; margin: 4px 0 0; font: 700 26px/1 var(--f-display); letter-spacing: .3px; }
.shop-head h2 .ico { color: var(--warn); }
.shop-kicker { margin: 0; font: 600 10.5px/1.2 var(--f-data); letter-spacing: 1.3px; text-transform: uppercase; color: var(--muted); }
.shop-balance { display: grid; gap: 4px; text-align: right; }
.shop-balance span { display: block; font: 600 10.5px/1 var(--f-data); letter-spacing: 1.3px; text-transform: uppercase; color: var(--muted); }
.shop-balance b { font: 700 20px/1 var(--f-data); color: var(--ok); }
.shop-close { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; border: 1px solid #ffffff2e; background: transparent; color: var(--text); font-size: 16px; cursor: pointer; }
.shop-close:hover { background: var(--raise); }
.shop-tabs { display: flex; gap: 4px; padding: 0 18px; border-bottom: 1px solid var(--panel-border); }
.shop-tabs button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 8px 12px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; font-weight: 500; }
.shop-tabs button:hover { color: var(--text); }
.shop-tabs button.active { color: var(--text); border-bottom-color: var(--warn); }
.shop-notice { margin: 10px 18px 0; padding: 8px 12px; border-radius: 10px; font-size: 13px; background: #ffffff10; }
.shop-notice.ok { background: #6fe39a22; color: var(--ok); }
.shop-notice.warn { background: #ffb54722; color: var(--brake); }
.shop-notice.hidden { display: none; }
.shop-body { overflow-y: auto; padding: 4px 18px 18px; }
.shop-section h3 { margin: 18px 0 2px; font: 700 19px/1.1 var(--f-display); letter-spacing: .3px; }
.shop-section p { margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.shop-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 6px; border-radius: var(--radius); background: #ffffff06; border: 1px solid #ffffff14; }
.shop-item.owned { border-color: #34d17c55; background: #34d17c0d; }
.shop-item-icon { display: grid; place-items: center; width: 64px; min-width: 64px; font-size: 28px; }
.shop-item-text { flex: 1; min-width: 0; }
.shop-item-text b { font-size: 15px; font-weight: 600; }
.shop-item-text p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.shop-item-buy button { min-width: 104px; padding: 8px 12px; border-radius: 9px; cursor: pointer; font-family: var(--f-data); font-size: 14px; font-variant-numeric: tabular-nums; }
.shop-item-buy .go-button.poor { display: grid; gap: 2px; background: transparent; border: 1px dashed #ffffff33; color: var(--text); filter: none; }
.shop-item-buy .go-button.poor small { font: 500 10.5px/1 var(--f-body); color: var(--muted); }
.shop-item-buy .go-button.poor:hover { border-color: var(--warn); }
.shop-item-buy button:disabled { cursor: default; opacity: .6; }
.train-preview { width: 64px; height: 26px; }
.line-dot { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: #fff; font: 800 12px/1 Arial, sans-serif; }
.home-room { display: block; width: 100%; height: auto; margin: 4px 0 10px; border-radius: 12px; }
.album-line { padding: 10px; margin-bottom: 8px; border-radius: 12px; background: #ffffff08; }
.album-head { display: flex; align-items: center; gap: 10px; }
.album-head b { flex: 1; }
.album-count { font-size: 13px; color: var(--muted); }
.album-bar { height: 5px; margin: 8px 0; border-radius: 3px; background: #ffffff14; overflow: hidden; }
.album-bar i { display: block; height: 100%; }
.album-line ul { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; }
.album-line li { padding: 2px 7px; border-radius: 6px; font-size: 11px; color: #ffffff40; border: 1px dashed #ffffff22; }
.album-line li.got { color: #fff; border-style: solid; background: #ffffff10; }
@media (max-width: 560px) {
  .shop-item { flex-wrap: wrap; }
  .shop-item-buy { width: 100%; }
  .shop-item-buy button { width: 100%; }
}

/* ---------- Versión móvil: celular y tablet ---------- */
/* Toques sin zoom por doble toque ni menú de mantener presionado; sin "rebote" de la página */
html, body { overscroll-behavior: none; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html { -webkit-tap-highlight-color: transparent; }        /* sin el destello azul al tocar (se hereda en toda la página) */
button, select { touch-action: manipulation; }
/* Pantallas táctiles: sin el anillo de foco celeste en el botón recién tocado (con teclado sigue) */
body.touch-mode :focus, body.touch-mode :focus-visible { outline: none; }
@media (hover: none) and (pointer: coarse) { :focus, :focus-visible { outline: none; } }
.game-screen { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
/* Altura real de la pantalla (la barra del navegador del celular no tapa nada) */
@supports (height: 100dvh) {
  html, body, .screen { height: 100dvh; }
  .ticket-card { max-height: 92dvh; }
  .shop-card { max-height: min(88dvh, 100%); }
}
.ticket-panel, .summary, .shop-overlay, .celebration {
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
}
/* Ventanas (boletería, locales, misiones, resumen) en pantallas bajas */
@media (max-height: 520px) {
  .ticket-card { padding: 12px 14px; gap: 6px; }
  .ticket-balance { padding: 8px 10px; }
  .ticket-balance strong { font-size: 22px; }
  .ticket-status { min-height: 0; }
  .summary-card { max-height: 100%; overflow: auto; padding: 14px 16px; gap: 6px; }
  .summary-card h2 { font-size: 19px; }
  .summary-card li { padding: 3px 0; font-size: 13px; }
  .shop-card { max-height: 100%; }
  .shop-head { padding: 8px 14px 4px; }
  .shop-kicker, .shop-balance span { display: none; }
  .shop-head h2 { margin: 0; font-size: 18px; }
  .shop-tabs { padding: 0 14px; }
  .shop-tabs button { padding-block: 4px 6px; }
  .shop-item { padding: 6px 10px; }
  .shop-body { padding: 4px 14px 14px; }
}
/* Botones de las ventanas más fáciles de tocar */
@media (pointer: coarse) {
  .ticket-close, .shop-close { width: 42px; height: 42px; }
  .ticket-amounts button, .ticket-pay button { min-height: 42px; padding: 8px 14px; }
  .store-item { min-height: 46px; align-items: center; }
  .summary-actions { flex-wrap: wrap; }
  .summary-actions button { flex: 1; min-height: 44px; }
  .mission-item button { min-height: 40px; }
  .shop-tabs button { min-height: 40px; }
  .back-button { min-height: 36px; }
}
@media (max-width: 420px) {
  .shop-tabs { overflow-x: auto; }
  .shop-tabs button { flex: 0 0 auto; font-size: 13px; }
  .shop-head { flex-wrap: wrap; }
  .ticket-actions { flex-wrap: wrap; }
  .ticket-actions button { flex: 1; }
}
.shop-head, .shop-tabs, .shop-notice { flex-shrink: 0; }

/* Horario compacto en el panel de estación (cuando el panel de señal y horario no cabe) */
.schedule-mini { display: none; font-size: 12px; color: #a9b7c5; font-variant-numeric: tabular-nums; }
.schedule-mini .delay { font-size: 13px; }
@media (max-width: 980px) { .schedule-mini { display: block; } }

/* Finalizar turno (modo Conductor): al lado del botón Menú */
.end-shift-button { left: 104px; border-color: #ffd16655; }
.back-button.hidden + .end-shift-button { left: 18px; }        /* conductor: sin botón de Menú, ocupa su lugar */
/* Resumen en pantallas bajas (celular en horizontal): dos columnas y botones siempre a la vista */
@media (max-height: 520px) {
  .summary-card { width: min(94vw, 780px); grid-template-rows: auto auto minmax(0, 1fr) auto; overflow: hidden; }
  .summary-card ul { grid-template-columns: 1fr 1fr; column-gap: 18px; row-gap: 0; overflow-y: auto; min-height: 0; }
  .summary-card li { font-size: 12px; }
  .summary-actions { margin-top: 2px; }
}
/* ---------- Tutorial interactivo (tutorial.js) ---------- */
.tutorial {
  position: absolute; top: 118px; z-index: 4; display: grid; gap: 7px;
  width: min(360px, calc(100% - 32px)); padding: 12px 14px 12px;
  border: 1px solid #ffc24740; border-left: 4px solid var(--warn); border-radius: var(--radius);
  background: #0b1118f0; backdrop-filter: blur(14px); box-shadow: 0 14px 40px #000a;
  transition: border-color .25s, background .25s;
}
.tutorial-driver { left: 18px; }
.tutorial-passenger { right: 18px; }
.tutorial.enter { animation: tutorialIn .35s ease-out; }
.tutorial.passed { border-color: var(--ok); background: #0c1f17f0; }
.tutorial header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tutorial-badge { font: 700 10.5px/1 var(--f-data); letter-spacing: 1.3px; color: var(--warn); }
.tutorial.passed .tutorial-badge::after { content: " · ✔ ¡BIEN!"; color: var(--ok); }
.tutorial-count { font: 500 11px/1 var(--f-data); color: var(--muted); }
.tutorial-bar { height: 4px; border-radius: 2px; background: #ffffff14; overflow: hidden; }
.tutorial-bar i { display: block; height: 100%; background: var(--warn); transition: width .4s; }
.tutorial-title { font: 700 20px/1.1 var(--f-display); letter-spacing: .2px; }
.tutorial-text { font-size: 13px; line-height: 1.45; color: #d6e1ec; }
.tutorial-live {
  padding: 6px 9px; border-radius: 8px; background: #ffffff0d; font-size: 12.5px; font-weight: 700;
  color: #ffe7a8; font-variant-numeric: tabular-nums;
}
.tutorial-live[hidden] { display: none; }
.tutorial footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.tutorial footer button { padding: 7px 12px; border-radius: 9px; cursor: pointer; font-size: 12.5px; }
.tutorial-next[hidden], .tutorial-wait[hidden], .tutorial-skip[hidden] { display: none; }
.tutorial-skip[hidden] + .tutorial-next { margin-left: auto; }
.tutorial-wait { font-size: 12px; color: var(--muted); font-style: italic; }
.tut-focus { outline: 2px solid var(--warn); outline-offset: 3px; animation: tutorialPulse 1.4s ease-in-out infinite; }
@keyframes tutorialIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes tutorialPulse { 50% { outline-color: #ffd16633; } }
@media (prefers-reduced-motion: reduce) {
  .tutorial.enter, .tut-focus { animation: none; }
}
@media (max-width: 720px) {
  .tutorial { top: 64px; left: 50%; right: auto; transform: translateX(-50%); width: min(340px, calc(100% - 32px)); padding: 9px 11px; gap: 5px; }
  .tutorial.enter { animation: none; }
  .tutorial-title { font-size: 15px; }
  .tutorial-text { font-size: 12px; }
}
/* Pantallas táctiles: centrada entre las columnas de botones (mando a la izquierda, puertas/inversor a la derecha) y bajo los avisos */
body.touch-mode .tutorial {
  top: 116px; left: 50%; right: auto; transform: translateX(-50%);   /* bajo los avisos (#message) */
  width: max(220px, min(400px, calc(100% - 250px))); padding: 9px 11px; gap: 5px;
}
body.touch-mode .tutorial.enter { animation: none; }
body.touch-mode .tutorial-title { font-size: 15px; }
body.touch-mode .tutorial-text { font-size: 12px; line-height: 1.3; }
body.touch-mode .tutorial footer button { padding: 5px 10px; }

/* Señal compacta en el panel de estación (cuando el panel de señal y horario no cabe) */
.signal-mini { display: none; align-items: center; gap: 7px; font-size: 12px; color: #a9b7c5; font-variant-numeric: tabular-nums; }
.signal-head-mini { grid-auto-flow: column; gap: 3px; padding: 3px 4px; border-radius: 9px; }
.signal-head-mini i { width: 10px; height: 10px; }
@media (max-width: 980px) { .signal-mini { display: flex; } }
/* Celular en horizontal: cabe el panel completo de señal y horario (el tablero va reducido) */
@media (max-height: 520px) {
  body.touch-mode .signal-panel { display: grid; }
  body.touch-mode .signal-mini, body.touch-mode .schedule-mini { display: none; }
}

/* ---------- Informe de fin de turno del Conductor (shiftReport.js) ---------- */
/* Entrada en secuencia: la tarjeta sube, el recorrido se dibuja estación por estación
   (--trip-time), cae el timbre con la nota (.stamped) y se revela el resto (.revealed). */
.summary.summary-report { overflow-y: auto; }
.report {
  position: relative;
  display: grid;
  gap: 14px;
  width: min(94vw, 720px);
  max-height: 100%;
  overflow-y: auto;
  padding: 20px 22px 18px;
  border: 1px solid var(--panel-border);
  border-top: 4px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 30px 80px #000c;
  animation: reportIn .5s cubic-bezier(.2, .9, .3, 1.1) both;
}
@keyframes reportIn { from { opacity: 0; transform: translateY(26px) scale(.96); } }
.report.stamped:not(.report-instant) { animation: reportIn .5s cubic-bezier(.2, .9, .3, 1.1) both, reportShake .35s ease-out; }
@keyframes reportShake { 0% { translate: 0 0; } 25% { translate: 0 4px; } 50% { translate: 0 -2px; } 100% { translate: 0 0; } }
.report-confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }

.report-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.report-head .line-badge { width: 44px; height: 44px; font-size: 26px; }
.report-head-text { display: grid; gap: 4px; min-width: 0; }
.report-head h2 { font: 700 30px/1.05 var(--f-display); letter-spacing: .3px; text-wrap: balance; }

/* Timbre con la nota */
.report-grade {
  display: grid; justify-items: center; align-content: center; gap: 2px;
  width: 92px; height: 92px; border-radius: 50%;
  border: 3px solid var(--grade); color: var(--grade);
  box-shadow: inset 0 0 0 4px color-mix(in srgb, var(--grade) 18%, transparent), 0 0 30px color-mix(in srgb, var(--grade) 30%, transparent);
  transform: rotate(-12deg);
  opacity: 0;
}
.report-grade b { font: 700 48px/.9 var(--f-display); }
.report-grade small { font: 700 9.5px/1 var(--f-data); letter-spacing: .8px; text-transform: uppercase; }
.report.stamped .report-grade { animation: stampIn .45s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes stampIn { from { opacity: 0; transform: rotate(-30deg) scale(2.6); } to { opacity: 1; transform: rotate(-12deg) scale(1); } }

/* Puntaje y barra contra el récord */
.report-score { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4px 20px; padding: 12px 14px; border-radius: var(--radius); background: var(--raise); }
.report-points { display: grid; gap: 4px; grid-row: span 2; }
.report-points strong { font: 700 34px/1 var(--f-data); font-variant-numeric: tabular-nums; }
.report-points small { font-size: 14px; color: var(--muted); }
.report-recordbar { position: relative; height: 8px; border-radius: 4px; background: #ffffff12; }
.report-recordfill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 4px; background: linear-gradient(90deg, var(--line), var(--grade)); transition: width 1.3s cubic-bezier(.2, .8, .3, 1); }
.report-recordmark { position: absolute; top: -5px; bottom: -5px; width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 6px #fff; }
.report-recordmark::after { content: "récord"; position: absolute; top: -14px; left: 50%; transform: translateX(-50%); font: 600 9px/1 var(--f-data); color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.report-record { font-size: 13px; color: var(--muted); }
.report-newrecord { display: inline-flex; align-items: center; gap: 5px; margin-right: 6px; padding: 3px 8px; border-radius: 5px; background: #ffd23f; color: #1a1400; font-weight: 700; }
.report.revealed .report-newrecord { animation: recordPop .6s cubic-bezier(.3, 1.7, .5, 1) both; }
@keyframes recordPop { from { transform: scale(.3); opacity: 0; } }

/* Recorrido interactivo */
.report-trip { display: grid; gap: 10px; }
.report-trip-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; align-items: center; }
.report-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 11.5px; color: var(--muted); }
.report-legend i { display: inline-block; width: 9px; height: 9px; margin-right: -6px; border-radius: 50%; }
.report-legend i.ok, .trip-stop.ok { --st: var(--ok); }
.report-legend i.warn, .trip-stop.warn { --st: var(--warn); }
.report-legend i.bad, .trip-stop.bad { --st: var(--emergency); }
.report-legend i { background: var(--st); }
.report-legend .star { width: 12px; height: 12px; margin-right: -6px; color: #ffd23f; fill: #ffd23f; }
.trip-track { position: relative; height: 44px; margin: 0 12px; }
.trip-line, .trip-fill { position: absolute; left: -12px; right: -12px; top: 20px; height: 4px; border-radius: 2px; background: #ffffff14; }
.trip-fill { right: auto; width: calc(100% + 24px); background: var(--line); transform-origin: left; animation: tripDraw var(--trip-time, 1s) linear both; }
@keyframes tripDraw { from { transform: scaleX(0); } }
.trip-train {
  position: absolute; left: 100%; top: 2px; display: grid; place-items: center; width: 24px; height: 24px; margin-left: -12px;
  border-radius: 6px; background: #fff; color: #0b1118; box-shadow: 0 0 12px #fff8; font-size: 15px;
  animation: tripTrain var(--trip-time, 1s) linear both; pointer-events: none; opacity: 0;
}
.report.revealed .trip-train { opacity: 0; transition: opacity .3s; }
@keyframes tripTrain { 0% { left: 0; opacity: 1; } 92% { opacity: 1; } 100% { left: 100%; opacity: 0; } }
.trip-stop {
  position: absolute; top: 12px; width: 20px; height: 20px; margin-left: -10px; padding: 0;
  display: grid; place-items: center; border-radius: 50%;
  border: 3px solid var(--st); background: var(--surface); color: #ffd23f; cursor: pointer;
  animation: stopPop .35s cubic-bezier(.3, 1.8, .5, 1) both;
  transition: transform .15s;
}
.trip-stop .ico { width: 11px; height: 11px; fill: #ffd23f; stroke: #ffd23f; stroke-width: 1; }
.trip-stop:hover { transform: scale(1.25); }
.trip-stop[aria-selected="true"] { background: var(--st); color: #0b1118; transform: scale(1.3); box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--st), 0 0 16px var(--st); }
.trip-stop[aria-selected="true"] .ico { fill: #0b1118; stroke: #0b1118; }
.trip-stop.pulse { animation: stopPulse .4s ease-out; }
@keyframes stopPop { from { transform: scale(0); opacity: 0; } }
@keyframes stopPulse { 50% { transform: scale(1.55); } }
.report-empty .trip-detail, .report-empty .trip-line, .report-empty .trip-fill, .report-empty .trip-train, .report-empty .report-hint, .report-empty .report-legend { display: none; }
.trip-empty { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; color: var(--muted); background: var(--surface); }
.trip-detail { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 14px; min-height: 64px; padding: 10px 14px; border-radius: var(--radius); background: var(--raise); }
.trip-detail:empty { visibility: hidden; }
.trip-detail-name { display: grid; gap: 4px; min-width: 0; }
.trip-detail-name strong { font: 700 21px/1.1 var(--f-display); letter-spacing: .3px; }
.trip-detail dl { display: flex; flex-wrap: wrap; gap: 6px 18px; grid-column: 1 / -1; }
.trip-detail dl div { display: grid; gap: 4px; }
.trip-detail dd { font: 700 15px/1 var(--f-data); font-variant-numeric: tabular-nums; }
.trip-detail dd small { font: 500 11px var(--f-body); color: var(--muted); }
.trip-detail dd.ok { color: var(--ok); } .trip-detail dd.warn { color: var(--warn); } .trip-detail dd.bad { color: #ff8080; } .trip-detail dd.money { color: var(--ok); }
.trip-perfect { grid-row: 1; grid-column: 2; display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 5px; background: #ffd23f22; color: #ffe27a; font-size: 12px; font-weight: 600; }
.trip-perfect .ico { fill: currentColor; }

/* Pestañas y paneles */
.report-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--panel-border); }
.report-tabs button { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px 11px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 14px; font-weight: 500; cursor: pointer; }
.report-tabs button:hover { color: var(--text); }
.report-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--line); }
.report-panel { display: grid; gap: 10px; animation: panelIn .3s ease-out; }
.report-panel[hidden] { display: none; }
@keyframes panelIn { from { opacity: 0; transform: translateY(6px); } }
.report-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.report-tile { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius); border: 1px solid var(--hair); background: #ffffff05; min-width: 0; }
.report-tile > div:last-child { display: grid; gap: 3px; min-width: 0; }
.report-tile b { font: 700 20px/1.1 var(--f-data); font-variant-numeric: tabular-nums; }
.report-tile small { font-size: 12px; color: var(--muted); }
.report-tile-big { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--raise); color: var(--grade); font-size: 22px; }
.ring { flex: none; width: 44px; height: 44px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke: #ffffff14; stroke-width: 5; }
.ring .ring-fill { stroke: var(--ok); stroke-linecap: round; stroke-dasharray: 113.1; stroke-dashoffset: 113.1; transition: stroke-dashoffset 1.1s cubic-bezier(.2, .8, .3, 1) .2s; }
.report.revealed .ring .ring-fill { stroke-dashoffset: calc(113.1 * (1 - var(--p) / 100)); }
.report-faults { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 6px; }
.report-faults li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: #ffffff05; font-size: 13px; }
.report-faults li span { display: inline-flex; align-items: center; gap: 8px; color: #c3ccd6; }
.report-faults li b { font: 700 14px/1 var(--f-data); }
.report-faults li.ok .ico { color: var(--ok); }
.report-faults li.bad { background: #ff4d4d14; }
.report-faults li.bad .ico, .report-faults li.bad b { color: #ff8080; }

/* Boleta de sueldo */
.receipt { display: grid; gap: 8px; padding: 14px 16px; border-radius: var(--radius); background: #f4f1e8; color: #23201a; font-family: var(--f-data); box-shadow: inset 0 -10px 10px -10px #0002; }
.receipt .small-label { color: #7b7466; }
.receipt-head { display: flex; justify-content: space-between; padding-bottom: 6px; border-bottom: 1px dashed #0003; }
.receipt-rows { list-style: none; display: grid; align-content: start; gap: 3px; max-height: 132px; overflow-y: auto; padding-right: 4px; font-size: 12.5px; }
.receipt-sums { display: grid; align-content: start; gap: 8px; }
/* Ancho: estaciones a la izquierda, totales a la derecha (la ventana no crece) */
@media (min-width: 601px) {
  .receipt { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 22px; }
  .receipt-head { grid-column: 1 / -1; }
  .receipt-sums .receipt-sub:first-child { padding-top: 0; border-top: 0; }
}
.receipt-rows li { display: flex; justify-content: space-between; gap: 10px; animation: receiptRow .3s ease-out both; }
.receipt-rows li span { font-family: var(--f-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.receipt-rows li.muted, .receipt-sub.muted { color: #8a8475; }
@keyframes receiptRow { from { opacity: 0; transform: translateX(-8px); } }
.receipt-sub, .receipt-total, .receipt-balance { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.receipt-sub { padding-top: 6px; border-top: 1px dashed #0003; }
.receipt-sub span, .receipt-total span, .receipt-balance span { font-family: var(--f-body); }
.receipt-total { align-items: baseline; padding-top: 8px; border-top: 2px solid #23201a; font-size: 15px; font-weight: 700; }
.receipt-amount { font-size: 26px; color: #137a3f; }
.receipt-balance { color: #6b6557; }

.report-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding-top: 4px; }
.report-hint { font-size: 12px; color: var(--muted); }
.report-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
body.touch-mode .report-hint { display: none; }

/* Saltar la entrada o "reducir movimiento": todo en su estado final */
.report-instant, .report-instant * { animation: none !important; }
.report-instant .report-grade { opacity: 1; }
.report-instant .trip-train { display: none; }
@media (prefers-reduced-motion: reduce) { .report-recordfill, .ring .ring-fill { transition: none; } }

@media (max-width: 600px) {
  .report { padding: 16px 14px 14px; gap: 12px; }
  .report-head { grid-template-columns: auto minmax(0, 1fr); }
  .report-head h2 { font-size: 24px; }
  .report-grade { position: absolute; top: 14px; right: 12px; width: 70px; height: 70px; }
  .report-grade b { font-size: 36px; }
  .report-grade small { font-size: 8px; }
  .report-head-text { padding-right: 84px; }
  .trip-track { margin: 0 16px; }
  .report-score { grid-template-columns: minmax(0, 1fr); }
  .report-points { grid-row: auto; }
  .report-tiles { grid-template-columns: minmax(0, 1fr); }
  .report-buttons { width: 100%; }
  .report-buttons button { flex: 1; }
}
@media (max-height: 520px) {
  .report { width: min(96vw, 820px); gap: 10px; padding: 14px 16px; }
  .report-grade { width: 70px; height: 70px; }
  .report-grade b { font-size: 36px; }
  .report-head h2 { font-size: 22px; }
}

/* ===== Mapa de la misión (dentro del seguimiento de misión, modo pasajero) ===== */
.mission-guide {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  align-items: center;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--panel-border);
}
.guide-compass {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid #ffd16688;
  background: radial-gradient(circle, #ffd16618, #0000 70%);
}
.guide-compass::before { content: ""; position: absolute; top: 2px; left: 50%; width: 2px; height: 5px; margin-left: -1px; background: #ffd166aa; border-radius: 1px; }
.guide-arrow { width: 26px; height: 26px; fill: var(--warn); transition: transform .12s linear; }
.guide-compass.off .guide-arrow, .guide-compass.here .guide-arrow { opacity: 0; }
.guide-compass.off::after { content: "●"; position: absolute; color: var(--warn); font-size: 14px; }
.guide-compass.here { border-color: #6cc895; }
.guide-compass.here::after { content: "✔"; color: #6cc895; }
.guide-dist { position: absolute; bottom: -9px; padding: 0 4px; border-radius: 6px; background: var(--surface); font: 600 10px/1.3 var(--f-data); color: #ffe3a3; white-space: nowrap; }
.guide-dist:empty { display: none; }
.guide-text { display: grid; gap: 2px; min-width: 0; }
.guide-text strong { font: 600 14px/1.15 var(--f-display); color: #ffe3a3; }
.guide-text .station-sub { font-size: 11.5px; line-height: 1.25; }
.guide-strip { position: relative; grid-column: 1 / -1; height: 16px; margin: 4px 4px 0; }
.guide-strip-track { position: absolute; left: 0; right: 0; top: 7px; height: 3px; border-radius: 2px; background: var(--line); opacity: .85; }
.guide-strip i { position: absolute; top: 4px; width: 9px; height: 9px; margin-left: -4.5px; border-radius: 50%; }
.guide-strip .guide-stop { top: 6px; width: 5px; height: 5px; margin-left: -2.5px; background: #0b1118; border: 1px solid #ffffffaa; }
.guide-you { background: #fff; box-shadow: 0 0 0 2px #0b1118, 0 0 0 3px #fff8; z-index: 2; transition: left .3s linear; }
.guide-pin { top: -1px !important; width: 0 !important; height: 0 !important; margin-left: -6px !important; border-radius: 0 !important; border: 6px solid transparent; border-top: 9px solid var(--warn); z-index: 1; }
.guide-pin.hidden { display: none; }
.line-strip-stop.target { border-color: var(--warn); background: var(--warn); box-shadow: 0 0 0 3px #0b1118, 0 0 0 5px #ffd16699; }
.line-strip-stop.target span { display: block; color: #ffe3a3; }
@media (max-width: 720px) {
  .mission-guide { gap: 2px 8px; padding-top: 6px; }
  .guide-compass { width: 38px; height: 38px; }
  .guide-arrow { width: 21px; height: 21px; }
}
body.touch-mode .guide-text strong { font-size: 12px; }
body.touch-mode .guide-text .station-sub { font-size: 10.5px; }
body.touch-mode .guide-compass { width: 36px; height: 36px; }
body.touch-mode .guide-arrow { width: 20px; height: 20px; }

/* ===== Sin dinero en modo pasajero: botón para ir a ganar sueldo como conductor ===== */
.driver-job-button {
  left: 104px;
  border-color: #ffd166aa;
  color: #ffe3a3;
  font-weight: 600;
  animation: jobPulse 2.2s ease-in-out infinite;
}
@keyframes jobPulse { 0%, 100% { box-shadow: 0 0 0 0 #ffd16600; } 50% { box-shadow: 0 0 0 5px #ffd16640; } }
body.touch-mode .back-button.driver-job-button { top: auto; bottom: calc(120px + env(safe-area-inset-bottom)); left: 50%; right: auto; transform: translateX(-50%); z-index: 13; padding: 9px 14px; }

/* ===== Confirmación de volver al menú ===== */
#confirmPanel { z-index: 20; }
.confirm-card { width: min(92vw, 380px); border-top-color: var(--warn); }
.confirm-card strong { font: 700 22px/1.15 var(--f-display); }
.confirm-card p { margin: 2px 0 6px; font-size: 13.5px; line-height: 1.4; }

/* 1.7.2 · Pantallas de cabina ampliadas (tocar la DMI o la pantalla de estado, o P) */
.cab-screens {
  position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: calc(12px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
  background: rgba(4, 7, 10, .82); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.cab-screens-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; max-width: 100%; }
.cab-screens canvas {
  width: min(calc((100vw - 56px) / 2), 640px, calc((100vh - 70px) * 16 / 9)); aspect-ratio: 16 / 9; height: auto;
  border-radius: 10px; border: 3px solid #1b232c; box-shadow: 0 10px 40px #000a; background: #0c141d;
}
@media (orientation: portrait) {
  .cab-screens canvas { width: min(calc(100vw - 32px), 640px, calc((100vh - 110px) / 2 * 16 / 9)); }
}
.cab-screens-hint { margin: 0; color: #a7b6c6; font-size: 13px; }
.cab-screens-hint kbd { font-size: 11px; }

/* ---------- 1.9 · Tarifas según el horario (tocando la hora) ---------- */
.clock-now { cursor: pointer; border-radius: var(--radius); margin: -6px; padding: 6px; transition: background .15s; }
.clock-now:hover, .clock-now:focus-visible { background: #ffffff0a; outline: none; }
.clock-more { margin-left: 6px; color: var(--warn); letter-spacing: .3px; text-transform: none; }
.hud-clock { pointer-events: auto; cursor: pointer; color: var(--text); font: inherit; }
.hud-clock:hover { background: var(--raise); }
.hud-clock-band { --c: var(--dim); display: inline-block; width: 7px; height: 7px; margin-left: 4px; border-radius: 50%; background: var(--c); box-shadow: 0 0 6px var(--c); vertical-align: 1px; }
.hud-clock-band.punta { --c: #ff5a4f; }
.hud-clock-band.valle { --c: var(--warn); }
.hud-clock-band.baja  { --c: var(--ok); }
#fareInfoPanel { position: fixed; z-index: 30; }
.fare-info-card { border-top-color: var(--warn); }
.fare-info-now { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fare-info-next { display: block !important; }
.fare-prices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.fare-price { --c: var(--muted); display: grid; gap: 2px; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--c) 12%, transparent); box-shadow: inset 0 3px 0 var(--c); }
.fare-price small { font-size: 11.5px; color: var(--muted); }
.fare-price b { font: 700 18px/1.1 var(--f-data); font-variant-numeric: tabular-nums; }
.fare-price span { font-size: 11px; color: var(--muted); }
.fare-price.punta, .fare-slot.punta, .fare-bar-seg.punta { --c: #ff5a4f; }
.fare-price.valle, .fare-slot.valle, .fare-bar-seg.valle { --c: var(--warn); }
.fare-price.baja,  .fare-slot.baja,  .fare-bar-seg.baja  { --c: var(--ok); }
.fare-days button { text-align: center; place-items: center; font-size: 12.5px; font-weight: 600; min-height: 36px; padding: 4px 8px; }
.fare-days button.selected { background: var(--raise); color: var(--text); box-shadow: inset 0 -2px 0 var(--warn); }
.fare-bar-wrap { display: grid; gap: 3px; }
.fare-bar { position: relative; display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--raise); }
.fare-bar-seg { background: var(--c); opacity: .85; }
.fare-bar-seg + .fare-bar-seg { border-left: 1px solid var(--surface); }
.fare-bar-now { position: absolute; top: -2px; bottom: -2px; width: 3px; margin-left: -1.5px; background: #fff; border-radius: 2px; box-shadow: 0 0 0 1px #0008, 0 0 8px #fff; }
.fare-bar-ends { display: flex; justify-content: space-between; font: 600 11px/1 var(--f-data); color: var(--muted); }
.fare-slot > span { display: inline-flex; align-items: center; gap: 8px; }
.fare-slot i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.fare-slot-time { font-family: var(--f-data); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted); }
.fare-slot.current .fare-slot-time { color: inherit; }
.fare-slot em { font-style: normal; font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: var(--warn); color: #14305c; }
.fare-notes { margin: 0; padding-left: 18px; display: grid; gap: 3px; font-size: 12px; line-height: 1.4; color: var(--muted); }
@media (max-width: 420px) { .fare-price b { font-size: 15px; } }

/* ---------- 1.10 · Tu tarifa (fecha de nacimiento · TNE · adulto mayor) ---------- */
#riderPanel { position: fixed; z-index: 31; }
.rider-card { width: min(94vw, 420px); border-top-color: var(--warn); }
.rider-intro { margin: 0; font-size: 13.5px; line-height: 1.45; }
.rider-field { display: grid; gap: 5px; }
.rider-field input {
  min-height: 44px; padding: 0 12px; border-radius: 8px; border: 1px solid #ffffff26;
  background: var(--bg); color: var(--text); font: 600 16px var(--f-data); color-scheme: dark;
}
.rider-field input:focus { outline: 2px solid var(--warn); outline-offset: 1px; }
.rider-check { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; background: #ffffff08; font-size: 13.5px; cursor: pointer; }
.rider-check small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.rider-check input { width: 18px; height: 18px; accent-color: var(--warn); flex: none; }
#riderSave:disabled { opacity: .45; pointer-events: none; }
.fare-mine { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px 8px 12px; border-radius: 8px; background: #ffffff08; font-size: 13px; }
.fare-mine.special { background: #34d17c1a; box-shadow: inset 3px 0 0 var(--ok); }
.fare-mine .ghost-button { min-height: 32px; padding: 0 12px; font-size: 12.5px; flex: none; }

/* =============================== 1.13 · MICROSIM (BUS, BETA) =============================== */
.beta-tag { display: inline-block; vertical-align: 3px; margin-left: 6px; padding: 1px 6px; border-radius: 4px; background: #d7262e; color: #fff; font: 700 11px/1.4 var(--f-data); letter-spacing: .5px; text-transform: uppercase; }
.mode-note { grid-column: 1 / -1; font-size: 13px; line-height: 1.6; color: #9aa6b3; }
.mode-note kbd { margin-right: 2px; }

.bus-screen { position: fixed; inset: 0; z-index: 30; background: #000; user-select: none; -webkit-user-select: none; touch-action: none; }
.bus-canvas, .bus-canvas canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.bus-label { font: 600 10px/1.2 var(--f-data); letter-spacing: 1.2px; color: var(--muted); text-transform: uppercase; }
.bus-screen .hidden { display: none !important; }

.bus-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left)); pointer-events: none; }
.bus-brand, .bus-right { display: flex; align-items: center; gap: 10px; pointer-events: auto; }
.bus-brand { padding: 8px 14px 8px 8px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--panel-border); backdrop-filter: blur(6px); min-width: 0; }
.bus-badge { display: grid; place-items: center; min-width: 46px; height: 34px; padding: 0 8px; border-radius: 7px; background: #d7262e; color: #fff; font: 700 17px/1 var(--f-data); }
.bus-route { display: grid; gap: 2px; min-width: 0; }
.bus-route strong { font: 700 15px/1.15 var(--f-display); letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bus-pill { position: relative; display: grid; gap: 2px; padding: 7px 12px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--panel-border); backdrop-filter: blur(6px); }
.bus-pill strong { font: 700 16px/1 var(--f-data); }
.bus-float { position: absolute; right: 8px; top: 100%; font: 700 14px var(--f-data); color: var(--ok); opacity: 0; pointer-events: none; }
.bus-float.show { animation: busFloat 1.6s ease-out; }
@keyframes busFloat { 0% { opacity: 0; transform: translateY(0); } 15% { opacity: 1; } 100% { opacity: 0; transform: translateY(18px); } }
.bus-icon-btn { display: grid; place-items: center; width: 42px; height: 42px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--panel-border); color: var(--text); cursor: pointer; }
.bus-icon-btn svg, .bus-touch svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.bus-strip { position: absolute; top: calc(max(12px, env(safe-area-inset-top)) + 62px); left: 50%; transform: translateX(-50%); width: min(720px, calc(100% - 32px)); height: 30px; pointer-events: none; }
.bus-strip-track { position: absolute; left: 0; right: 0; top: 8px; height: 4px; border-radius: 2px; background: #d7262e; box-shadow: 0 0 0 1px #0006; }
.bus-strip-stop { position: absolute; top: 4px; transform: translateX(-50%); display: grid; justify-items: center; }
.bus-strip-stop i { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid #d7262e; }
.bus-strip-stop.done i { background: var(--ok); border-color: #fff; }
.bus-strip-stop.skipped i { background: var(--emergency); border-color: #fff; }
.bus-strip-stop em { display: none; }
.bus-strip-bus { position: absolute; top: 2px; width: 16px; height: 16px; margin-left: -8px; border-radius: 4px; background: #fff; box-shadow: 0 0 0 2px #d7262e, 0 2px 6px #0008; transition: left .2s linear; }

.bus-bell { position: absolute; top: calc(max(12px, env(safe-area-inset-top)) + 100px); left: 50%; transform: translateX(-50%); padding: 7px 16px; border-radius: 8px; background: #b5121b; color: #fff; font: 700 15px/1 var(--f-data); letter-spacing: 1.5px; box-shadow: 0 0 22px #ff2a2a88; animation: busPulse 1s ease-in-out infinite alternate; pointer-events: none; }
@keyframes busPulse { from { opacity: .75; } to { opacity: 1; } }
.bus-toast { position: absolute; top: calc(max(12px, env(safe-area-inset-top)) + 140px); left: 50%; transform: translateX(-50%); max-width: min(640px, calc(100% - 32px)); padding: 10px 16px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--panel-border); backdrop-filter: blur(6px); font-size: 15px; line-height: 1.4; text-align: center; pointer-events: none; }
.bus-toast.ok { border-color: #34d17c88; }
.bus-toast.warn { border-color: #ffc24799; color: #ffe2a8; }

.bus-guide { position: absolute; left: max(14px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom)); width: min(300px, calc(100% - 32px)); padding: 9px 14px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--panel-border); text-align: center; font: 600 14px/1.3 var(--f-body); pointer-events: none; }
.bus-guide.ok { border-color: var(--ok); color: #c9f5da; }
.bus-guide-bar { position: relative; height: 10px; margin-top: 7px; border-radius: 5px; background: linear-gradient(90deg, #ff4d4d55, #ffc24755 30%, #34d17c88 45%, #34d17c88 55%, #ffc24755 70%, #ff4d4d55); }
.bus-guide-bar b { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: #fff; }
.bus-guide-bar i { position: absolute; top: -4px; width: 10px; height: 18px; margin-left: -5px; border-radius: 3px; background: #d7262e; border: 2px solid #fff; transition: left .1s linear; }

.bus-bottom { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; align-items: flex-end; gap: 10px; padding: 0 max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); pointer-events: none; }
.bus-panel { padding: 12px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--panel-border); backdrop-filter: blur(6px); }
.bus-speed { display: grid; grid-template-columns: auto auto; gap: 8px 12px; align-items: center; }
.bus-speed-num { display: grid; justify-items: center; }
.bus-speed-num strong { font: 700 44px/1 var(--f-data); }
.bus-speed-num.over strong { color: var(--emergency); }
.bus-limit { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: #fff; border: 5px solid #d01f1f; color: #111; font: 700 17px/1 var(--f-data); }
.bus-pedals { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; align-items: center; }
.bus-pedals i { display: block; height: 6px; border-radius: 3px; background: #ffffff14; overflow: hidden; }
.bus-pedals b { display: block; height: 100%; width: 0; background: var(--power); }
.bus-pedals .brk b { background: var(--brake); }
.bus-next { display: grid; gap: 5px; width: min(440px, 52vw); }
.bus-next strong { font: 700 24px/1.1 var(--f-display); }
.bus-next-row { display: flex; flex-wrap: wrap; gap: 6px 14px; font: 600 13px/1.3 var(--f-body); color: #cfd8e2; }
.bus-next-sub { color: var(--muted); }
.bus-next-sub b { color: var(--text); }
.bus-delay.ok { color: var(--ok); } .bus-delay.warn { color: var(--warn); } .bus-delay.bad { color: var(--emergency); }
[data-k=doors].open { color: var(--warn); }
.bus-dot { display: inline-block; width: 9px; height: 9px; margin-right: 5px; border-radius: 50%; vertical-align: 0; }
.bus-dot.green { background: #2cff7a; } .bus-dot.amber { background: #ffb21e; } .bus-dot.red { background: #ff2d22; box-shadow: 0 0 8px #ff2d22; }
.bus-hint { min-height: 1.3em; font: 600 13.5px/1.35 var(--f-body); color: #ffd98a; }

.bus-keys { position: absolute; right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); display: grid; gap: 5px; justify-items: end; padding: 9px 12px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--panel-border); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 12px; color: #c4cfdb; pointer-events: none; }
.bus-keys kbd { margin-right: 2px; }
@media (max-width: 1180px) { .bus-keys { display: none; } }

.bus-touch { display: none; }
.bus-touch-mode .bus-keys { display: none; }
.bus-touch-mode .bus-touch { display: block; }
.bus-touch button { touch-action: none; display: grid; place-items: center; gap: 2px; border-radius: 14px; border: 1px solid #ffffff30; background: #0b1118b8; color: var(--text); font: 700 11px/1 var(--f-body); backdrop-filter: blur(4px); -webkit-tap-highlight-color: transparent; }
.bus-touch button.on { background: #ffffff30; }
.bus-touch-left { position: absolute; left: max(12px, env(safe-area-inset-left)); bottom: max(12px, env(safe-area-inset-bottom)); display: flex; gap: 10px; }
.bus-touch-left button { width: 70px; height: 70px; }
.bus-touch-left svg { width: 30px; height: 30px; }
.bus-touch-mid { position: absolute; left: max(12px, env(safe-area-inset-left)); bottom: calc(max(12px, env(safe-area-inset-bottom)) + 82px); display: flex; gap: 8px; }
.bus-touch-mid button { width: 62px; height: 54px; }
.bus-touch-right { position: absolute; right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); display: flex; gap: 10px; align-items: flex-end; }
.bus-pedal { width: 84px; height: 120px; font-size: 12px !important; letter-spacing: .8px; }
.bus-pedal.gas { height: 150px; border-color: #5cc8ff77 !important; }
.bus-pedal.brake { border-color: #ffb54777 !important; }
.bus-pedal.gas.on { background: #5cc8ff55 !important; }
.bus-pedal.brake.on { background: #ffb54755 !important; }
.bus-touch-mode .bus-bottom { justify-content: center; padding-left: 190px; padding-right: 200px; }
.bus-touch-mode .bus-speed { padding: 8px 10px; }
.bus-touch-mode .bus-speed-num strong { font-size: 32px; }
.bus-touch-mode .bus-limit { width: 36px; height: 36px; border-width: 4px; font-size: 13px; }
.bus-touch-mode .bus-pedals { display: none; }
.bus-touch-mode .bus-next { padding: 8px 12px; gap: 3px; }
.bus-touch-mode .bus-next strong { font-size: 18px; }
.bus-touch-mode .bus-guide { left: 50%; bottom: 150px; transform: translateX(-50%); }
@media (max-width: 1100px) { .bus-screen:not(.bus-touch-mode) .bus-guide { left: 50%; bottom: 196px; transform: translateX(-50%); } }

.bus-overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; background: #02050acc; backdrop-filter: blur(3px); }
.bus-card { display: grid; gap: 12px; width: min(460px, 100%); max-height: calc(100% - 8px); overflow: auto; padding: 22px; border-radius: 14px; background: var(--surface); border: 1px solid var(--panel-border); text-align: center; }
.bus-card h2 { font: 700 26px/1.1 var(--f-display); }
.bus-card p { font-size: 14px; line-height: 1.5; color: #b6c1cc; }
.bus-card-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.bus-btn { padding: 11px 18px; border-radius: var(--radius); border: 1px solid #ffffff2e; background: transparent; color: var(--text); font-weight: 700; cursor: pointer; }
.bus-btn.primary { background: #d7262e; border-color: transparent; color: #fff; }
.bus-btn:hover { filter: brightness(1.12); }
.bus-grade { justify-self: center; display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; font: 700 46px/1 var(--f-display); background: var(--raise); border: 3px solid var(--muted); }
.bus-grade.grade-S { border-color: #ffd34d; color: #ffd34d; } .bus-grade.grade-A { border-color: var(--ok); color: var(--ok); }
.bus-grade.grade-B { border-color: var(--power); color: var(--power); } .bus-grade.grade-C { border-color: var(--warn); color: var(--warn); }
.bus-stats { display: grid; gap: 4px; text-align: left; }
.bus-stats div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--hair); font-size: 14px; }
.bus-stats dt { color: var(--muted); } .bus-stats dd { font: 600 14px var(--f-data); }

@media (max-width: 720px) {
  .bus-route strong { font-size: 12px; }
  .bus-pill:nth-of-type(2) { display: none; }
  .bus-next { width: auto; flex: 1; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .bus-strip { top: calc(max(8px, env(safe-area-inset-top)) + 54px); }
  .bus-bell { top: calc(max(8px, env(safe-area-inset-top)) + 86px); }
  .bus-toast { top: calc(max(8px, env(safe-area-inset-top)) + 86px); font-size: 13px; padding: 7px 12px; }
  .bus-route .bus-label { display: none; }
}

/* 1.15 · Conductor: ¿qué quieres conducir? (tren del Metro, Tren Nos o bus) */
.vehicle-field { grid-column: 1 / -1; }
.vehicle-seg button { flex: 1 1 0; }
.mode-card.bus-vehicle .train-only, .mode-card.bus-vehicle #netJoin, .mode-card.bus-vehicle #driverLock { display: none !important; }
#busDriverNote[hidden] { display: none; }

/* 1.15 · Viaje en bus como pasajero */
.bus-ride-bar { display: none; }
.bus-ride-mode .bus-ride-bar { position: absolute; right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); display: flex; gap: 10px; }
.bus-ride-mode .bus-speed, .bus-ride-mode .bus-keys, .bus-ride-mode .bus-touch, .bus-ride-mode .bus-delay, .bus-ride-mode .bus-guide { display: none !important; }
.bus-ride-mode .bus-bottom { justify-content: flex-start; padding-right: 340px; }
.bus-ride-mode.bus-touch-mode .bus-bottom { padding-left: max(14px, env(safe-area-inset-left)); }
.bus-ride-btn { display: grid; justify-items: center; align-content: center; gap: 3px; min-width: 96px; height: 92px; padding: 8px 12px; border-radius: 14px; border: 1px solid #ffffff30; background: #0b1118d0; color: var(--text); font-size: 26px; cursor: pointer; backdrop-filter: blur(4px); }
.bus-ride-btn span { font: 700 13px/1.1 var(--f-body); }
.bus-ride-btn small { font: 600 10px/1 var(--f-data); color: var(--muted); min-height: 10px; }
.bus-ride-btn svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bus-ride-btn.bell.on { background: #b5121bcc; border-color: #ff6b6b; }
.bus-ride-btn.off:not(:disabled) { background: #1d7a46d9; border-color: #34d17c; animation: busPulse 1s ease-in-out infinite alternate; }
.bus-ride-btn:disabled { opacity: .45; cursor: default; }
@media (max-width: 720px) { .bus-ride-btn { min-width: 74px; height: 76px; font-size: 22px; } .bus-ride-mode .bus-bottom { padding-right: 260px; } }

/* 1.15 · Paradero en la calle (modo pasajero) */
.bus-stop-panel { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; padding: 16px; background: #02050acc; backdrop-filter: blur(3px); }
.bus-stop-panel .bus-card { display: grid; gap: 12px; width: min(460px, 100%); padding: 22px; border-radius: 14px; background: var(--surface); border: 1px solid var(--panel-border); text-align: center; }
.bus-stop-panel h2 { font: 700 26px/1.1 var(--f-display); }
.bus-stop-panel p { font-size: 14px; line-height: 1.5; color: #b6c1cc; }
.bus-stop-dirs { display: grid; gap: 8px; }
.bus-stop-dir { display: grid; gap: 3px; padding: 12px 14px; border-radius: 10px; border: 1px solid #ffffff26; background: var(--raise); color: var(--text); text-align: left; cursor: pointer; }
.bus-stop-dir:hover { border-color: #d7262e; }
.bus-stop-dir b { font: 700 17px/1.2 var(--f-display); }
.bus-stop-dir b i { font-style: normal; display: inline-block; margin-right: 8px; padding: 1px 7px; border-radius: 5px; background: #d7262e; color: #fff; font: 700 13px/1.4 var(--f-data); }
.bus-stop-dir small { font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.bus-stop-panel .bus-btn { padding: 11px 18px; border-radius: var(--radius); border: 1px solid #ffffff2e; background: transparent; color: var(--text); font-weight: 700; cursor: pointer; }
@media (max-width: 760px) { .vehicle-seg { display: grid; grid-template-columns: 1fr 1fr; } .vehicle-seg button + button { border-left: 0; } .vehicle-seg button:nth-child(even) { border-left: 1px solid #ffffff1a; } .vehicle-seg button:nth-child(n+3) { border-top: 1px solid #ffffff1a; } }
