/* ============================================================
   Starlink Spotter — design « mission control »
   Fond espace profond, panneaux verre dépoli, typographie
   aérospatiale (Space Grotesk) + télémétrie mono (JetBrains Mono),
   accents lumineux cyan/violet, halos doux.
   ============================================================ */

@font-face {
  font-family: 'Space Grotesk';
  src: url('vendor/fonts/space-grotesk.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('vendor/fonts/jetbrains-mono.woff2') format('woff2');
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --bg: #05070f;
  --bg-2: #0a1022;
  --panel: rgba(13, 19, 42, 0.62);
  --panel-strong: rgba(8, 12, 28, 0.9);
  --stroke: rgba(146, 180, 255, 0.14);
  --stroke-bright: rgba(146, 180, 255, 0.32);
  --text: #eaf0ff;
  --muted: #8b96bb;
  --accent: #5ec8ff;
  --accent-2: #8a7dff;
  --green: #7ef9a2;
  --gold: #ffe066;
  --amber: #ffa94d;
  --red: #ff6b7a;
  --font-ui: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
  --glass-blur: blur(18px) saturate(150%);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

/* Micro-label « console » réutilisable : MAJUSCULES espacées */
.kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.85;
}

/* ============================================================
   Écran de démarrage — ciel étoilé + anneaux orbitaux animés
   ============================================================ */
#start-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  background:
    radial-gradient(ellipse 120% 70% at 50% -10%, #16224d 0%, transparent 60%),
    radial-gradient(ellipse 80% 50% at 80% 110%, #1a1340 0%, transparent 55%),
    var(--bg);
  overflow: hidden;
}

/* Deux couches d'étoiles (radial-gradients répétés) qui scintillent en
   alternance — zéro image, zéro JS. */
.stars, .stars::after {
  content: '';
  position: absolute;
  inset: -50%;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 25% 35%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 65% 15%, #cfe2ff 50%, transparent 51%),
    radial-gradient(1px 1px at 85% 55%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 45% 75%, #aaccff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 10% 60%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 92% 85%, #cfe2ff 50%, transparent 51%);
  background-size: 320px 280px;
  animation: twinkle 5s ease-in-out infinite;
}
.stars::after {
  background-size: 460px 380px;
  background-position: 130px 90px;
  animation-delay: -2.5s;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 0.3; }
}

/* Fine grille « radar » sous le contenu */
#start-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(146, 180, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(146, 180, 255, 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 30%, transparent 75%);
}

.start-inner {
  position: relative;
  max-width: 440px;
  text-align: center;
}

/* Logo au centre de deux anneaux orbitaux inclinés, chacun portant
   un « satellite » lumineux qui tourne. */
.orbit-stack {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.start-logo {
  font-size: 56px;
  filter: drop-shadow(0 0 24px rgba(94, 200, 255, 0.55));
}
.orbit-ring {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(146, 180, 255, 0.28);
  border-radius: 50%;
  animation: orbit 9s linear infinite;
}
.orbit-ring.r2 {
  inset: 22px;
  border-color: rgba(138, 125, 255, 0.25);
  animation-duration: 6s;
  animation-direction: reverse;
}
.orbit-ring i {
  position: absolute;
  top: -3px;
  left: 50%;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px 2px rgba(94, 200, 255, 0.8);
}
.orbit-ring.r2 i { background: var(--accent-2); box-shadow: 0 0 10px 2px rgba(138, 125, 255, 0.8); }
@keyframes orbit { to { transform: rotate(360deg); } }

.start-inner h1 {
  margin: 10px 0 4px;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: linear-gradient(100deg, #fff 20%, var(--accent) 55%, var(--accent-2) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.start-inner > p {
  color: var(--muted);
  line-height: 1.6;
  font-size: 15px;
}
.start-status {
  min-height: 1.4em;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--accent);
}
.start-meta {
  margin-top: 22px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.7;
}

/* ============================================================
   Boutons
   ============================================================ */
.btn-primary {
  position: relative;
  background: linear-gradient(135deg, #36a4f0 0%, #7c6cff 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 15px 42px;
  font-family: var(--font-ui);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  margin-top: 16px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12) inset,
    0 8px 28px rgba(80, 130, 255, 0.38);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.45; box-shadow: none; }

.btn-secondary {
  background: rgba(146, 180, 255, 0.06);
  color: var(--accent);
  border: 1px solid var(--stroke-bright);
  border-radius: var(--radius);
  padding: 14px 20px;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn-secondary:active { background: rgba(146, 180, 255, 0.14); }

/* ============================================================
   Modals — verre dépoli
   ============================================================ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(3, 5, 12, 0.7);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 24px;
}
.modal-inner {
  background: var(--panel-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--stroke);
  border-top-color: var(--stroke-bright);
  border-radius: 20px;
  padding: 26px 24px;
  width: 100%;
  max-width: 390px;
  max-height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}
.modal-inner h2 {
  margin: 4px 0 6px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.modal-inner p { color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.modal-inner label {
  display: block;
  margin: 14px 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.modal-inner input,
.modal-inner select {
  display: block;
  width: 100%;
  margin-top: 7px;
  padding: 13px 14px;
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.02em;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(4, 7, 16, 0.8);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  color-scheme: dark; /* picker date/heure natif en sombre */
}
.modal-inner input:focus,
.modal-inner select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(94, 200, 255, 0.18);
}
.modal-inner select { appearance: none; -webkit-appearance: none; cursor: pointer; }
.modal-inner input[type='search'] { -webkit-appearance: none; appearance: none; }

/* Résultats de la recherche d'adresse (modale position) */
#geo-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 4px;
}
.geo-note {
  color: var(--muted);
  font-size: 12px;
  font-family: var(--font-mono);
  margin: 2px;
}
.geo-sep {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.7;
  margin: 14px 0 0;
}
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}
.modal-actions .btn-primary { margin-top: 0; padding: 13px 26px; font-size: 15px; }
.error { color: var(--red); font-size: 13px; font-family: var(--font-mono); }
.modal-note { color: var(--gold); font-size: 12.5px; }

/* ============================================================
   Bandeau simulation — chip ambre flottante
   ============================================================ */
.sim-banner {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 62px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap; /* mobile : l'heure passe au-dessus des vitesses */
  gap: 8px 12px;
  background: rgba(48, 36, 8, 0.78);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(255, 209, 102, 0.45);
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 10px 8px 14px;
  border-radius: 999px;
  z-index: 800;
  white-space: nowrap;
  max-width: 95%;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45), 0 0 18px rgba(255, 209, 102, 0.12);
}
.btn-live {
  background: var(--gold);
  color: #231a00;
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* ============================================================
   Layout app
   ============================================================ */
#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  background: linear-gradient(180deg, rgba(8, 12, 28, 0.96), rgba(8, 12, 28, 0.88));
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--stroke);
  z-index: 500;
}

/* Onglets : contrôle segmenté en verre */
#mode-tabs {
  display: flex;
  gap: 2px;
  background: rgba(146, 180, 255, 0.07);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 3px;
}
.tab {
  background: transparent;
  color: var(--muted);
  border: none;
  border-radius: 9px;
  padding: 8px 15px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: color 0.15s ease;
}
.tab.active {
  background: linear-gradient(135deg, #36a4f0, #7c6cff);
  color: #fff;
  box-shadow: 0 2px 14px rgba(80, 130, 255, 0.45);
}

/* Compteur télémétrie + point « live » qui pulse */
#counter {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--green);
  text-align: right;
}
#counter::before {
  content: '';
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.view { position: relative; flex: 1; min-height: 0; }

#statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 12px calc(7px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(8, 12, 28, 0.96), rgba(8, 12, 28, 0.88));
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--stroke);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  z-index: 500;
}
/* Le statut TLE s'ellipse sur UNE ligne : le footer ne grandit jamais */
#data-status {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-actions { display: flex; gap: 6px; flex: none; }
.link-btn {
  background: rgba(146, 180, 255, 0.07);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  color: var(--accent);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 5px 12px;
  white-space: nowrap;
  transition: background 0.15s ease;
}
.link-btn:active { background: rgba(146, 180, 255, 0.16); }

/* ============================================================
   Mode AR — HUD au-dessus de la caméra
   ============================================================ */
#view-ar { background: #000; }
#ar-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#ar-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
/* Vignette douce : fond la caméra dans l'interface, lisibilité du HUD */
#view-ar::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 120px 30px rgba(3, 5, 12, 0.75);
}
.ar-hint {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--stroke-bright);
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 13.5px;
  max-width: 90%;
  text-align: center;
  z-index: 10;
}

/* ============================================================
   Mode Carte
   ============================================================ */
#map {
  position: absolute;
  inset: 0;
  /* Océan : même dégradé que le disque du globe (fond vectoriel, plus de
     tuiles raster — voir map.js). */
  background:
    radial-gradient(ellipse 100% 80% at 35% 25%, #0d1830 0%, #060b1a 75%),
    var(--bg);
}

/* Boutons flottants : verre sombre, lueur colorée quand actif */
.fab {
  position: absolute;
  right: 14px;
  bottom: 18px;
  width: 50px;
  height: 50px;
  border-radius: 16px;
  border: 1px solid var(--stroke-bright);
  background: var(--panel-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  font-size: 21px;
  cursor: pointer;
  z-index: 600;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.fab:active { transform: scale(0.92); }
.fab-trains { bottom: 80px; }
.fab-trains.active {
  background: linear-gradient(135deg, rgba(255, 169, 77, 0.95), rgba(255, 140, 40, 0.95));
  border-color: var(--amber);
  box-shadow: 0 0 22px rgba(255, 169, 77, 0.65);
}
.fab-visible { bottom: 142px; }
.fab-visible.active {
  background: linear-gradient(135deg, rgba(255, 224, 102, 0.95), rgba(255, 196, 60, 0.95));
  border-color: var(--gold);
  box-shadow: 0 0 22px rgba(255, 224, 102, 0.65);
}

.fab-search { bottom: 204px; }

.popup-train { color: var(--amber); }
.popup-vis { color: var(--gold); }
.popup-shadow { color: var(--muted); }

/* Actions du popup satellite (Suivre / Isoler) */
.popup-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.popup-btn {
  background: rgba(146, 180, 255, 0.08);
  border: 1px solid var(--stroke-bright);
  border-radius: 9px;
  color: var(--accent);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 11px;
}
.popup-btn:active { background: rgba(146, 180, 255, 0.18); }

/* ---------- Chips d'ouverture des panneaux (bas gauche) ---------- */
#map-chips {
  position: absolute;
  left: 12px;
  bottom: 18px;
  display: flex;
  gap: 7px;
  z-index: 600;
}
.map-chip {
  background: var(--panel-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--stroke-bright);
  border-radius: 999px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 9px 13px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}
.map-chip:active { background: rgba(146, 180, 255, 0.16); }

/* ---------- Pastilles d'état (suivi / train isolé), haut gauche ---------- */
#state-chips {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 650;
}
.state-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(13, 32, 26, 0.85);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(126, 249, 162, 0.5);
  color: var(--green);
  border-radius: 999px;
  padding: 6px 8px 6px 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.state-chip.chip-train {
  border-color: rgba(255, 169, 77, 0.5);
  color: var(--amber);
  background: rgba(40, 26, 8, 0.85);
}
.state-chip button {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  color: inherit;
  font-size: 11px;
  cursor: pointer;
  line-height: 1;
}

/* ---------- Panneau latéral ---------- */
.side-panel {
  position: absolute;
  left: 12px;
  bottom: 66px;
  width: min(380px, calc(100% - 24px));
  max-height: min(58%, 480px);
  display: flex;
  flex-direction: column;
  background: var(--panel-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--stroke);
  border-top-color: var(--stroke-bright);
  border-radius: 16px;
  z-index: 700;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
.side-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--stroke);
}
.side-panel h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
#panel-close {
  background: rgba(146, 180, 255, 0.08);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 9px;
}
#panel-content {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.panel-note {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
  margin: 2px 0;
}
.panel-summary {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  background: rgba(146, 180, 255, 0.06);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 10px 12px;
}
.panel-summary b { color: var(--gold); }
.panel-section {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
}

/* Carte d'un passage / d'un train */
.pass-card {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: rgba(146, 180, 255, 0.04);
}
.pass-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
}
.pass-head b { color: var(--gold); font-weight: 700; }
.pass-rel {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  white-space: nowrap;
}
.pass-data {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}
.pass-data b { color: var(--text); }
.pass-actions { display: flex; gap: 8px; margin-top: 3px; }
.panel-btn {
  background: rgba(146, 180, 255, 0.08);
  border: 1px solid var(--stroke-bright);
  border-radius: 9px;
  color: var(--accent);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 11px;
}
.panel-btn:active { background: rgba(146, 180, 255, 0.18); }

/* Stats */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.stat {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(146, 180, 255, 0.04);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat b {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.stat span { font-size: 11px; color: var(--muted); }
.stat-bar { display: flex; flex-direction: column; gap: 3px; }
.stat-bar-label { font-size: 11.5px; color: var(--muted); }
.stat-bar-track {
  position: relative;
  height: 16px;
  border-radius: 6px;
  background: rgba(146, 180, 255, 0.06);
  overflow: hidden;
}
.stat-bar-fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #36a4f0, #7c6cff);
  opacity: 0.75;
}
.stat-bar-track span {
  position: absolute;
  right: 7px;
  top: 1px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text);
}

/* Recherche */
#search-input {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 15px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(4, 7, 16, 0.8);
  color: var(--text);
  outline: none;
}
#search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(94, 200, 255, 0.18);
}
#search-results { display: flex; flex-direction: column; gap: 6px; }
.search-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  background: rgba(146, 180, 255, 0.04);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  padding: 9px 12px;
}
.search-row b { font-family: var(--font-ui); font-size: 13.5px; }
.search-row span { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.search-row:active { background: rgba(146, 180, 255, 0.12); }

/* Toast */
.toast {
  position: absolute;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--stroke-bright);
  border-radius: 999px;
  color: var(--text);
  font-size: 13px;
  padding: 10px 18px;
  z-index: 900;
  white-space: nowrap;
  max-width: 92%;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* ---------- Mode Globe ---------- */
#view-globe {
  background:
    radial-gradient(ellipse 120% 80% at 50% 110%, #101735 0%, transparent 60%),
    var(--bg);
  overflow: hidden;
}
#globe-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none; /* le canvas gère lui-même drag + pinch */
  cursor: grab;
}
#globe-canvas:active { cursor: grabbing; }
.globe-info {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--stroke-bright);
  border-radius: 999px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 16px;
  z-index: 10;
  white-space: nowrap;
  max-width: 92%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.globe-help {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-align: center;
  width: 94%;
  opacity: 0.75;
  pointer-events: none;
}

/* ---------- Vitesses du time-lapse (dans le bandeau simulation) ---------- */
.sim-speeds {
  display: flex;
  gap: 3px;
}
.sim-speeds button {
  background: transparent;
  border: 1px solid rgba(255, 209, 102, 0.4);
  border-radius: 7px;
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 7px;
}
.sim-speeds button.active {
  background: var(--gold);
  color: #231a00;
}

/* Bandeau « visibles à l'œil nu » */
.vis-hint {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(48, 36, 8, 0.78);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(255, 224, 102, 0.45);
  color: var(--gold);
  border-radius: 12px;
  padding: 9px 15px;
  font-size: 12.5px;
  line-height: 1.45;
  z-index: 600;
  max-width: 92%;
  text-align: center;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}

/* Fiche satellite : carte télémétrie */
.sat-popup {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 18px;
  background: var(--panel-strong);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--stroke);
  border-top: 1px solid var(--stroke-bright);
  border-radius: 16px;
  padding: 14px 44px 14px 18px;
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 88%;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
}
.sat-popup strong {
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text);
}
.popup-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(146, 180, 255, 0.08);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
}

/* ============================================================
   Mode nuit (vision nocturne) : voile rouge multiplicatif
   ============================================================ */
#night-overlay {
  position: fixed;
  inset: 0;
  z-index: 6000;
  pointer-events: none;
  background: #5d0f0f;
  mix-blend-mode: multiply;
}
.link-btn.active {
  background: rgba(255, 107, 122, 0.16);
  border-color: rgba(255, 107, 122, 0.45);
  color: var(--red);
}

/* Badges météo / éclat dans les cartes de passage */
.badge-clear { color: var(--green); }
.badge-cloudy { color: var(--muted); }
.badge-bright { color: var(--gold); }
.badge-dim { color: var(--muted); opacity: 0.85; }

/* Lieux favoris (modale position) */
#fav-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.fav-row { display: flex; gap: 6px; align-items: stretch; }
.fav-row .search-row { flex: 1; }
.fav-del {
  background: rgba(255, 107, 122, 0.08);
  border: 1px solid rgba(255, 107, 122, 0.3);
  border-radius: 10px;
  color: var(--red);
  font-size: 12px;
  cursor: pointer;
  padding: 0 12px;
}
.fav-save-row { display: flex; gap: 8px; margin: 12px 0 0; }
.fav-save-row input { margin-top: 0; flex: 1; font-size: 13px; }
.fav-save-row .btn-secondary { padding: 10px 16px; flex: none; }

/* ============================================================
   Responsive mobile (≤ 600px) — la cible principale de l'app
   ============================================================ */
@media (max-width: 600px) {
  /* Topbar sur deux niveaux : onglets pleine largeur, télémétrie dessous.
     Fini le compteur qui s'enroule sur 3 lignes à côté des onglets. */
  #topbar {
    flex-wrap: wrap;
    row-gap: 7px;
    padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
  }
  #mode-tabs { width: 100%; }
  .tab { flex: 1; padding: 8px 4px; font-size: 13.5px; }
  #counter {
    width: 100%;
    justify-content: center;
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Le bandeau simulation descend sous la topbar (plus haute sur mobile) */
  .sim-banner { top: calc(env(safe-area-inset-top) + 108px); }

  /* FABs plus compacts, pile resserrée */
  .fab { width: 46px; height: 46px; font-size: 19px; right: 12px; border-radius: 14px; }
  .fab-trains { bottom: 76px; }
  .fab-visible { bottom: 134px; }
  .fab-search { bottom: 192px; }

  /* Chips de panneaux : passent à la ligne si l'écran est très étroit */
  #map-chips { flex-wrap: wrap; right: 72px; bottom: 14px; }
  .map-chip { font-size: 12px; padding: 8px 11px; }

  /* Panneau latéral : quasi pleine largeur */
  .side-panel {
    left: 8px;
    width: calc(100% - 16px);
    bottom: 60px;
    max-height: 62%;
  }

  /* Footer compact */
  .link-btn { font-size: 11.5px; padding: 5px 9px; }
  #statusbar { font-size: 10px; }

  .globe-help { font-size: 9.5px; }
}

/* Écrans très étroits : on garde l'essentiel lisible */
@media (max-width: 360px) {
  .tab { font-size: 12.5px; }
  .map-chip { font-size: 11px; padding: 7px 9px; }
  .link-btn { font-size: 10.5px; padding: 4px 7px; }
}

/* Paysage bas (téléphone à l'horizontale) : topbar sur une seule ligne */
@media (max-height: 480px) and (orientation: landscape) {
  #topbar { flex-wrap: nowrap; }
  #mode-tabs { width: auto; }
  .tab { flex: none; padding: 6px 12px; }
  #counter { width: auto; }
  .sim-banner { top: calc(env(safe-area-inset-top) + 56px); }
  .side-panel { max-height: 78%; width: min(360px, calc(100% - 24px)); }
}
