/* Cap Côtier — styles. Palette marine, clair et sombre ; téléphone d'abord, barre latérale au-delà de 860 px. */

:root {
  --fond: #eef3f7;
  --surface: #ffffff;
  --surface2: #e6edf3;
  --texte: #0d1b2a;
  --texte2: #566778;
  --accent: #0a6e8a;
  --accent-fort: #064e63;
  --accent-doux: #d5edf3;
  --marine: #0b2a4a;
  --ok: #1b8a4b;
  --ok-doux: #dcf3e5;
  --ko: #c62f3b;
  --ko-doux: #fbe3e5;
  --jaune: #f2b705;
  --bord: rgba(13, 27, 42, 0.1);
  --ombre: 0 1px 2px rgba(13, 27, 42, 0.06), 0 4px 18px rgba(13, 27, 42, 0.06);
  --rayon: 16px;
  --sa-haut: env(safe-area-inset-top, 0px);
  --sa-bas: env(safe-area-inset-bottom, 0px);
  --sa-g: env(safe-area-inset-left, 0px);
  --sa-d: env(safe-area-inset-right, 0px);
  color-scheme: light dark;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #07121c;
    --surface: #0f1e2c;
    --surface2: #172b3d;
    --texte: #e7eef5;
    --texte2: #93a6b8;
    --accent: #3fb6cf;
    --accent-fort: #8fdcec;
    --accent-doux: #12394a;
    --ok: #4cc77f;
    --ok-doux: #123526;
    --ko: #ff6b74;
    --ko-doux: #3a1418;
    --bord: rgba(255, 255, 255, 0.09);
    --ombre: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--fond); color: var(--texte); }
body { font-size: 17px; line-height: 1.45; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
.boot { position: fixed; inset: 0; display: grid; place-content: center; gap: 12px; text-align: center; color: var(--texte2); }
.boot img { border-radius: 22px; margin: 0 auto; }

/* ---------------- Coquille ---------------- */
#app { min-height: 100%; }
.coquille { display: flex; min-height: 100vh; min-height: 100dvh; }
.contenu { flex: 1; min-width: 0; padding: calc(var(--sa-haut) + 8px) calc(var(--sa-d) + 18px) calc(var(--sa-bas) + 96px) calc(var(--sa-g) + 18px); }
.page { max-width: 860px; margin: 0 auto; }
.grand-titre { font-size: 34px; font-weight: 750; letter-spacing: -0.02em; margin: 14px 0 4px; }
.sous-titre { color: var(--texte2); margin: 0 0 18px; }
.entete { display: flex; align-items: center; gap: 10px; }
.entete .grand-titre { flex: 1; }
.retour { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--accent); padding: 10px 0; font-size: 17px; }

.onglets { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around;
  padding: 6px calc(var(--sa-d) + 6px) calc(var(--sa-bas) + 6px) calc(var(--sa-g) + 6px);
  background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--bord); }
.onglet { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none; color: var(--texte2); font-size: 11px; padding: 4px 0; min-height: 48px; }
.onglet svg { width: 26px; height: 26px; }
.onglet[aria-current="page"] { color: var(--accent); }

@media (min-width: 860px) {
  .onglets { position: sticky; top: 0; flex-direction: column; justify-content: flex-start; width: 248px; height: 100vh; height: 100dvh;
    padding: calc(var(--sa-haut) + 20px) 12px 20px calc(var(--sa-g) + 12px); border-top: 0; border-right: 1px solid var(--bord); gap: 2px; }
  .onglets::before { content: "Cap Côtier"; font-weight: 750; font-size: 22px; padding: 4px 12px 16px; color: var(--texte); }
  .onglet { flex: 0 0 auto; flex-direction: row; gap: 12px; font-size: 16px; padding: 10px 12px; border-radius: 10px; min-height: 0; justify-content: flex-start; }
  .onglet svg { width: 22px; height: 22px; }
  .onglet[aria-current="page"] { background: var(--accent-doux); }
  .contenu { padding-bottom: 40px; padding-top: 20px; }
}

/* ---------------- Cartes et listes ---------------- */
.carte { background: var(--surface); border-radius: var(--rayon); box-shadow: var(--ombre); border: 1px solid var(--bord); padding: 16px; margin-bottom: 14px; }
.carte h2 { font-size: 20px; margin-bottom: 6px; }
.carte h3 { font-size: 17px; margin-bottom: 4px; }
.carte p { margin: 6px 0; }
.carte.vedette { background: linear-gradient(135deg, #0b2a4a, #0a6e8a); color: #fff; border: 0; position: relative; overflow: hidden; }
.carte.vedette p, .carte.vedette .muet { color: rgba(255, 255, 255, 0.82); }
.carte.vedette .bouton.secondaire { background: rgba(255, 255, 255, 0.16); color: #fff; }
.grille { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grille .carte { margin: 0; }
.muet { color: var(--texte2); font-size: 15px; }
.petit { font-size: 13px; }
.titre-section { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--texte2); margin: 26px 4px 8px; }

.liste { background: var(--surface); border-radius: var(--rayon); border: 1px solid var(--bord); overflow: hidden; margin-bottom: 14px; }
.ligne { display: flex; align-items: center; gap: 14px; width: 100%; padding: 13px 16px; border: 0; background: none; text-align: left; border-bottom: 1px solid var(--bord); min-height: 56px; }
.ligne:last-child { border-bottom: 0; }
.ligne:active { background: var(--surface2); }
.ligne .corps { flex: 1; min-width: 0; }
.ligne .titre { font-weight: 600; }
.ligne .detail { color: var(--texte2); font-size: 14px; }
.ligne .chevron { color: var(--texte2); flex: none; }
.pastille { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--accent-doux); color: var(--accent); }
.pastille svg { width: 24px; height: 24px; }

.bouton { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 13px 20px; min-height: 48px;
  background: var(--accent); color: #fff; font-weight: 650; font-size: 17px; }
.bouton:active { filter: brightness(0.92); }
.bouton svg { width: 22px; height: 22px; flex: none; }
.bouton.secondaire { background: var(--surface2); color: var(--texte); }
.bouton.danger { background: var(--ko); }
.bouton.plein { width: 100%; }
.bouton[disabled] { opacity: 0.45; cursor: default; }
.rangee { display: flex; gap: 10px; flex-wrap: wrap; }
.rangee > .bouton { flex: 1; }

.barre-prog { height: 8px; border-radius: 4px; background: var(--surface2); overflow: hidden; }
.barre-prog > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.etoiles { color: var(--jaune); letter-spacing: 1px; white-space: nowrap; }
.etoiles .vide { color: var(--bord); }
.badge { display: inline-block; font-size: 12px; font-weight: 650; padding: 3px 8px; border-radius: 20px; background: var(--surface2); color: var(--texte2); }
.badge.ok { background: var(--ok-doux); color: var(--ok); }
.badge.ko { background: var(--ko-doux); color: var(--ko); }

.puces { margin: 6px 0; padding-left: 22px; }
.puces li { margin: 4px 0; }
.tableau { width: 100%; border-collapse: collapse; font-size: 15px; margin: 8px 0; }
.tableau th, .tableau td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--bord); vertical-align: top; }
.tableau th { color: var(--texte2); font-weight: 650; font-size: 13px; }
.defile-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.attention { background: color-mix(in srgb, var(--jaune) 16%, var(--surface)); border-left: 4px solid var(--jaune); padding: 10px 12px; border-radius: 10px; margin: 10px 0; font-size: 15px; }
.retenir { background: var(--accent-doux); border-radius: var(--rayon); padding: 14px 16px; }
.figures { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.figure { background: var(--surface2); border-radius: 12px; padding: 8px; display: grid; place-items: center; }
.figure svg { display: block; max-width: 100%; height: auto; }
.legende { font-size: 13px; color: var(--texte2); text-align: center; margin-top: 4px; max-width: 220px; }

/* ---------------- Questions ---------------- */
.question .enonce { font-size: 19px; font-weight: 600; margin: 4px 0 12px; }
.choix { display: grid; gap: 10px; }
.choix button { display: flex; gap: 12px; align-items: flex-start; text-align: left; border: 2px solid var(--bord); background: var(--surface); border-radius: 14px; padding: 13px 14px; min-height: 52px; font-size: 16px; }
.choix button .lettre { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface2); font-weight: 700; font-size: 14px; }
.choix button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-doux); }
.choix button[aria-pressed="true"] .lettre { background: var(--accent); color: #fff; }
.choix button.juste { border-color: var(--ok); background: var(--ok-doux); }
.choix button.juste .lettre { background: var(--ok); color: #fff; }
.choix button.faux { border-color: var(--ko); background: var(--ko-doux); }
.choix button.faux .lettre { background: var(--ko); color: #fff; }
.choix button:disabled { cursor: default; }
.explication { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface2); font-size: 15px; }
.explication strong { display: block; margin-bottom: 4px; }
.question .explication { margin-bottom: 8px; }
.pied-question { background: linear-gradient(transparent, var(--surface) 30%); }
.compteur { display: flex; justify-content: space-between; align-items: center; color: var(--texte2); font-size: 14px; margin-bottom: 8px; }
.pied-question { position: sticky; bottom: calc(var(--sa-bas) + 76px); padding-top: 12px; }
@media (min-width: 860px) { .pied-question { bottom: 16px; } }
.grille-examen { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; margin: 10px 0; }
.grille-examen button { aspect-ratio: 1; border: 1px solid var(--bord); border-radius: 7px; background: var(--surface); font-size: 12px; padding: 0; }
.grille-examen button.repondu { background: var(--accent-doux); }
.grille-examen button.actuel { outline: 2px solid var(--accent); }
.grille-examen button.juste { background: var(--ok-doux); color: var(--ok); }
.grille-examen button.faux { background: var(--ko-doux); color: var(--ko); }
.score-geant { font-size: 64px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }

/* ---------------- Dialogues dessinés ---------------- */
.voile { position: fixed; inset: 0; z-index: 100; background: rgba(5, 12, 20, 0.5); display: grid; place-items: center; padding: 20px; animation: apparait 0.18s ease-out; }
.dialogue { background: var(--surface); color: var(--texte); border-radius: 20px; padding: 20px; width: min(520px, 100%); max-height: calc(100dvh - 40px); overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); }
.dialogue h2 { font-size: 21px; margin-bottom: 8px; }
.dialogue .rangee { margin-top: 16px; }
@keyframes apparait { from { opacity: 0; } to { opacity: 1; } }

/* ---------------- Jeu ---------------- */
.jeu { position: fixed; inset: 0; z-index: 50; background: #000; color: #fff; user-select: none; -webkit-user-select: none; touch-action: none; overflow: hidden; }
.jeu { --pupitre: 150px; }
.masque-jumelles { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.masque-jumelles.cache { display: none; }
.cadre-baie { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }   /* sous le tableau de bord */
.cadre-baie.cache { display: none; }
.jeu .vue3d { position: absolute; left: 0; right: 0; top: 0; bottom: calc(var(--pupitre) + var(--sa-bas)); overflow: hidden; }
.jeu .vue3d canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.verre { background: rgba(8, 18, 28, 0.55); backdrop-filter: blur(12px) saturate(1.3); -webkit-backdrop-filter: blur(12px) saturate(1.3); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 14px; }
.hud { position: absolute; top: calc(var(--sa-haut) + 8px); left: calc(var(--sa-g) + 8px); right: calc(var(--sa-d) + 8px); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.hud-haut { display: flex; gap: 8px; align-items: flex-start; }
.hud-haut > *, .hud-ligne2 > * { pointer-events: auto; }
.hud-ligne2 { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.hud .limite { align-self: center; margin: 0; padding: 5px 12px; border-radius: 10px; background: #fff; color: #0d1b2a; font-size: 13px; pointer-events: none; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.hud .limite.depasse { background: #c62f3b; color: #fff; }
.bouton-rond { width: 44px; height: 44px; border-radius: 22px; display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, 0.15); background: rgba(8, 18, 28, 0.55); color: #fff; flex: none; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.bouton-rond svg { width: 22px; height: 22px; }
.consigne { flex: 1; min-width: 0; padding: 9px 12px; font-size: 15px; line-height: 1.3; }
.consigne .etape { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: #ffd23f; font-weight: 700; }
.score-hud { padding: 8px 12px; text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; }
.score-hud b { font-size: 20px; }
.instruments { padding: 7px 10px; display: grid; grid-template-columns: auto auto; gap: 2px 12px; font-size: 13px; font-variant-numeric: tabular-nums; pointer-events: none; }
.instruments .v { font-weight: 700; font-size: 16px; text-align: right; }
.instruments .l { color: rgba(255, 255, 255, 0.7); }
.instruments .alerte { color: #ff8a8a; }
.limite { grid-column: 1 / -1; margin-top: 4px; padding: 3px 8px; border-radius: 8px; background: #fff; color: #0d1b2a; font-weight: 700; font-size: 12px; text-align: center; }
.minicarte { position: relative; padding: 0; background: #f6fafd; width: 132px; height: 132px; flex: none; border-radius: 66px; overflow: hidden; border: 2px solid rgba(255, 255, 255, 0.35); }
.minicarte canvas { position: static; width: 100%; height: 100%; }
.commandes { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--pupitre) + var(--sa-bas)); padding: 10px calc(var(--sa-d) + 12px) calc(var(--sa-bas) + 10px) calc(var(--sa-g) + 12px);
  display: flex; align-items: center; gap: 12px; background: linear-gradient(#17283a, #0a1520); border-top: 1px solid rgba(255, 255, 255, 0.14); box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.35); }
.barre-tactile { width: min(42vw, 260px); height: 64px; position: relative; flex: none; }
.barre-tactile .rail { position: absolute; left: 0; right: 0; top: 50%; height: 6px; margin-top: -3px; border-radius: 3px; background: rgba(255, 255, 255, 0.25); }
.barre-tactile .bouton-barre { position: absolute; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 28px; background: rgba(255, 255, 255, 0.9); color: #0d1b2a; display: grid; place-items: center; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35); }
.barre-tactile .bouton-barre svg { width: 32px; height: 32px; }
.manette { width: 64px; height: calc(var(--pupitre) - 34px); position: relative; flex: none; margin: 0 4px; }
.manette .rail { position: absolute; top: 0; bottom: 0; left: 50%; width: 8px; margin-left: -4px; border-radius: 4px; background: linear-gradient(#4cc77f 0 45%, rgba(255, 255, 255, 0.5) 45% 55%, #ff9f43 55%); opacity: 0.6; }
.manette .poignee { position: absolute; left: 50%; width: 60px; height: 34px; margin: -17px 0 0 -30px; border-radius: 10px; background: rgba(255, 255, 255, 0.92); color: #0d1b2a; font-weight: 800; font-size: 13px; display: grid; place-items: center; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35); }
.manette .cran { position: absolute; left: 4px; right: 4px; top: 50%; height: 2px; background: #fff; }
.manette .etiquette { position: absolute; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 700; color: rgba(255, 255, 255, 0.85); }
.actions { flex: 1; min-width: 0; display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px; scrollbar-width: none; justify-content: center; }
.actions::-webkit-scrollbar { display: none; }
.action { flex: none; min-width: 62px; height: 62px; padding: 6px 6px 4px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(8, 18, 28, 0.58); color: #fff; font-size: 10.5px; font-weight: 600; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.action svg { width: 22px; height: 22px; }
.action.actif { background: #ffd23f; color: #0d1b2a; border-color: #ffd23f; }
.action.urgence { background: #c62f3b; border-color: #ff8a8a; }
.action.attente { box-shadow: 0 0 0 2px #ffd23f; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(255, 210, 63, 0.3); } }
.toasts { position: absolute; left: 50%; top: calc(var(--sa-haut) + 96px); max-height: calc(100% - var(--pupitre) - 120px); overflow: hidden; transform: translateX(-50%); width: min(480px, calc(100% - 300px)); display: grid; gap: 6px; pointer-events: none; z-index: 5; }
@media (max-width: 700px) { .toasts { width: calc(100% - 24px); top: auto; bottom: calc(var(--pupitre) + var(--sa-bas) + 10px); } }
.toast { padding: 9px 12px; border-radius: 12px; font-size: 14px; line-height: 1.3; background: rgba(8, 18, 28, 0.82); border: 1px solid rgba(255, 255, 255, 0.14); animation: apparait 0.2s; }
.toast.faute { background: rgba(150, 25, 35, 0.9); }
.toast.bonus { background: rgba(20, 110, 60, 0.9); }
.toast b { display: block; }
.chargement { position: absolute; inset: 0; display: grid; place-content: center; gap: 12px; text-align: center; background: #07121c; z-index: 10; }
.chargement .barre-prog { width: 240px; background: rgba(255, 255, 255, 0.15); }
.signal-son { position: absolute; left: 50%; bottom: calc(var(--pupitre) + var(--sa-bas) + 70px); transform: translateX(-50%); padding: 6px 14px; font-size: 22px; letter-spacing: 6px; font-weight: 800; pointer-events: none; }
.jeu .dialogue { background: #0f1e2c; color: #e7eef5; }
.jeu .dialogue .bouton.secondaire { background: #172b3d; color: #e7eef5; }
.jeu .choix button { background: #0f1e2c; border-color: rgba(255, 255, 255, 0.14); color: #e7eef5; }
.jeu .choix button .lettre { background: #172b3d; }
.jeu .choix button[aria-pressed="true"] { background: #12394a; border-color: #3fb6cf; }
.jeu .explication { background: #172b3d; }
.vhf-ecran { font-family: ui-monospace, "SF Mono", Menlo, monospace; background: #0d2b1e; color: #8dffb5; border-radius: 10px; padding: 10px 12px; font-size: 22px; letter-spacing: 2px; display: flex; justify-content: space-between; align-items: center; }
.morceaux { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.morceaux button { border: 1px solid rgba(255, 255, 255, 0.2); background: #172b3d; color: #e7eef5; border-radius: 10px; padding: 8px 10px; font-size: 14px; }
.morceaux button:disabled { opacity: 0.3; }
.message-vhf { min-height: 70px; background: #0b1622; border-radius: 10px; padding: 10px; font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.message-vhf span { background: #12394a; border-radius: 8px; padding: 4px 8px; }
.grande-carte { position: absolute; inset: 0; z-index: 30; background: #f3eedd; }
.grande-carte canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.grande-carte .bouton-rond { position: absolute; top: calc(var(--sa-haut) + 10px); right: calc(var(--sa-d) + 10px); }
.legende-carte { position: absolute; left: calc(var(--sa-g) + 10px); bottom: calc(var(--sa-bas) + 10px); color: #0d1b2a; font-size: 12px; background: rgba(255, 255, 255, 0.8); padding: 6px 10px; border-radius: 10px; }

.cache { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Téléphone en portrait : actions sur toute la largeur, au-dessus de la barre et de la manette ; instruments compacts. */
@media (max-width: 640px) {
  .jeu { --pupitre: 214px; }
  .commandes { flex-wrap: wrap; align-items: center; align-content: space-between; row-gap: 6px; }
  .actions { order: -1; flex: 1 1 100%; justify-content: flex-start; }
  .barre-tactile { flex: 1; width: auto; max-width: 260px; }
  .manette { height: calc(var(--pupitre) - 128px); margin: 14px 4px 14px auto; }
  .instruments { font-size: 12px; gap: 1px 8px; padding: 6px 8px; }
  .instruments .v { font-size: 14px; }
  .minicarte { width: 108px; height: 108px; }
  .consigne { font-size: 14px; }
  .score-hud { font-size: 12px; padding: 6px 8px; }
  .score-hud b { font-size: 17px; }
  .onglet { font-size: 10.5px; }
}

/* Téléphone à l'horizontale : pupitre bas et compact. */
@media (max-height: 500px) and (min-width: 641px) {
  .jeu { --pupitre: 104px; }
  .action { height: 54px; min-width: 56px; }
  .barre-tactile { width: 200px; }
  .instruments { font-size: 11.5px; }
  .minicarte { width: 96px; height: 96px; }
}

/* Paysage (comme l'app) : la vue 3D sur tout l'écran ; tout en bas, les boutons sur un panneau translucide ; juste
   au-dessus, la barre à gauche et la manette des gaz à droite, chacune sur son panneau translucide. */
@media (min-aspect-ratio: 23/20) {
  .jeu { --pupitre: 0px; }
  .jeu .vue3d { bottom: 0; }
  .commandes { inset: 0; height: auto; padding: 0; display: block; background: none; border: 0; box-shadow: none; pointer-events: none; }
  .commandes .actions { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--sa-bas) + 8px);
    width: max-content; max-width: calc(100% - 20px - var(--sa-g) - var(--sa-d)); flex: none; justify-content: flex-start;
    padding: 6px 10px; border-radius: 20px; background: rgba(8, 18, 28, 0.5); border: 1px solid rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3); pointer-events: auto; }
  .commandes .barre-tactile { position: absolute; left: calc(var(--sa-g) + 30px); bottom: calc(var(--sa-bas) + 100px);
    width: min(300px, 32vw); pointer-events: auto; isolation: isolate; }
  .commandes .barre-tactile::before { content: ''; position: absolute; inset: -6px -16px; border-radius: 40px; z-index: -1;
    background: rgba(8, 18, 28, 0.45); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid rgba(255, 255, 255, 0.12); }
  .commandes .manette { position: absolute; right: calc(var(--sa-d) + 26px); bottom: calc(var(--sa-bas) + 120px); margin: 0;
    height: min(140px, 27vh); pointer-events: auto; isolation: isolate; }
  .commandes .manette::before { content: ''; position: absolute; inset: -26px -8px; border-radius: 22px; z-index: -1;
    background: rgba(8, 18, 28, 0.45); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid rgba(255, 255, 255, 0.12); }
  .signal-son { bottom: calc(var(--sa-bas) + 210px); }
}
/* Téléphone couché (peu de hauteur) : instruments compacts, barre et manette plus basses et plus courtes. */
@media (min-aspect-ratio: 23/20) and (max-height: 500px) {
  .instruments { font-size: 11px; gap: 0 8px; padding: 5px 8px; }
  .instruments .v { font-size: 13px; }
  .consigne { font-size: 13px; padding: 6px 10px; }
  .commandes .barre-tactile { bottom: calc(var(--sa-bas) + 84px); width: min(240px, 28vw); height: 56px; }
  .commandes .barre-tactile .bouton-barre { width: 48px; height: 48px; margin: -24px 0 0 -24px; }
  .commandes .manette { bottom: calc(var(--sa-bas) + 100px); height: min(84px, 20vh); }
  .minicarte { width: 88px; height: 88px; }
}
/* Paysage : la manette des gaz longue, contre le bord droit, de la mini-carte jusqu'en bas (plus facile à doser) ; la
   rangée de boutons s'arrête avant elle (centrée si elle tient, sinon elle défile). */
@media (min-aspect-ratio: 23/20) {
  .commandes .manette { right: calc(var(--sa-d) + 14px); bottom: calc(var(--sa-bas) + 34px); height: min(300px, 47vh); }
  .commandes .actions { left: calc(var(--sa-g) + 10px); right: calc(var(--sa-d) + 106px); transform: none; width: auto; max-width: none;
    justify-content: safe center; }
}
@media (min-aspect-ratio: 23/20) and (max-height: 500px) {
  .commandes .manette { bottom: calc(var(--sa-bas) + 34px); height: min(200px, 38vh); }
  .commandes .action { height: 50px; min-width: 50px; font-size: 9.5px; padding: 4px 4px 3px; }
  .commandes .actions { gap: 4px; }
  .commandes .barre-tactile { bottom: calc(var(--sa-bas) + 80px); }
}

/* Téléphone couché, surtout dans Safari (environ 340 points de haut une fois la barre d'adresse ôtée) : rien ne se
   chevauche. En haut, la pause, la consigne (deux lignes au plus) et le score sur une ligne ; dessous, les instruments
   en bandeau à gauche, la mini-carte à droite ; en bas, les boutons compacts ; juste au-dessus, la barre à gauche ; à
   droite, sous la mini-carte, la manette des gaz, de la hauteur qui reste. */
@media (min-aspect-ratio: 23/20) and (max-height: 500px) {
  .hud { top: calc(var(--sa-haut) + 6px); gap: 6px; }
  .hud-haut { gap: 6px; }
  .hud .bouton-rond { width: 38px; height: 38px; }
  .consigne { font-size: 12.5px; line-height: 1.25; padding: 5px 10px; }
  .consigne .etape { font-size: 10px; }
  .consigne .texte { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .score-hud { display: flex; align-items: baseline; gap: 8px; padding: 8px 10px; font-size: 12px; line-height: 1; }
  .score-hud > div:first-child { display: none; }
  .score-hud b { font-size: 17px; }
  .instruments { grid-auto-flow: column; grid-template-columns: none; grid-template-rows: auto auto; gap: 0 14px; padding: 4px 10px; font-size: 10px; }
  .instruments .v { font-size: 13px; text-align: left; }
  .minicarte { width: 76px; height: 76px; }
  .commandes .actions { bottom: calc(var(--sa-bas) + 6px); gap: 4px; padding: 4px 6px; border-radius: 16px; }
  .commandes .action { height: 44px; min-width: 46px; font-size: 9px; padding: 3px 4px 2px; gap: 1px; border-radius: 10px; }
  .commandes .action svg { width: 18px; height: 18px; }
  .commandes .barre-tactile { left: calc(var(--sa-g) + 26px); bottom: calc(var(--sa-bas) + 70px); width: min(220px, 27vw); height: 46px; }
  .commandes .barre-tactile::before { inset: -3px -14px; }
  .commandes .barre-tactile .bouton-barre { width: 40px; height: 40px; margin: -20px 0 0 -20px; }
  .commandes .barre-tactile .bouton-barre svg { width: 24px; height: 24px; }
  .commandes .manette { bottom: calc(var(--sa-bas) + 34px); height: clamp(64px, calc(100% - var(--sa-haut) - var(--sa-bas) - 214px), 200px); }
  .commandes .manette .poignee { height: 28px; margin-top: -14px; font-size: 12px; }
  .toasts { top: calc(var(--sa-haut) + 100px); }
}
