/* =============================================================================
   style.css — FunSails, version épurée

   Le principe qui commande tout (INTERFACE.md) : on montre ce qui CHANGE et ce
   sur quoi on AGIT ; le reste se consulte. Cette version le pousse plus loin :
     · une seule ligne en haut, sans cadres — trois chiffres et leur pourquoi ;
     · un cadran pour le réglage, au lieu de deux nombres à comparer ;
     · le tiroir de réglages n'existe que quand on l'ouvre ;
     · une alerte à la fois ;
     · sur téléphone, des commandes translucides posées sur l'eau.

   Deux classes posées par le script sur <html> commandent la disposition :
     .tactile — l'écran se touche : commandes au pouce ;
     .compact — tactile OU fenêtre étroite : réglages en feuille, bandeau réduit.
   Le téléphone se joue en portrait : à l'horizontale, le jeu attend (#tourner).
============================================================================= */

:root {
  --fond:        #181A20;
  --ardoise:     #1E2125;
  --ardoise-2:   #23272C;
  --creux:       #181A20;   /* fond des sélecteurs segmentés */
  --trait:       #2E3238;
  --trait-vif:   #3A3F46;
  --texte:       #ECEEF1;
  --texte-doux:  #99A0A8;
  --texte-faible:#868E97;   /* 4,6:1 sur l'ardoise, même pour les 8,5 px */
  --verre:       rgba(30, 33, 37, 0.66);
  --verre-trait: rgba(255, 255, 255, 0.11);

  /* Couleurs de SENS : elles portent l'information, pas la marque. */
  --monte:       #57e39b;
  --chute:       #ff8a5c;
  --alerte:      #ff5a3c;
  --ciel:        #6EA8F0;
  --sails:       #F0705E;

  --mono: ui-monospace, "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --texte-face: "Helvetica Neue", system-ui, -apple-system, "Segoe UI", sans-serif;

  --tribord:     var(--monte);
  --babord:      var(--chute);
  --h-ligne: 64px;          /* la ligne du haut */
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--fond);
  color: var(--texte);
  font-family: var(--texte-face);
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font-family: inherit; }

/* La carte occupe tout l'écran : plus rien ne lui prend de place, tout se pose
   dessus. Un canvas en position fixe ne s'étire pas entre top et bottom comme
   un bloc : sa hauteur se calcule. */
#plan-eau {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: block;
  cursor: grab;
}
#plan-eau.deplacement { cursor: grabbing; }

/* Vrai plan d'eau : la « Carte dessinée » d'EksploGeo, sous le canvas. Elle
   ne prend aucun geste — le canvas, posé dessus, les reçoit tous. Le papier
   vient du module (classe aq-papier) : pas de fond ici, il le couvrirait. */
#fond-carte {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  pointer-events: none;
}
/* Le module pose aussi son cartouche, son étiquette de survol, ses fiches :
   le jeu n'en veut aucun. Seul le dessin reste. */
#fond-carte > :not(.maplibregl-canvas-container) { display: none !important; }
#fond-carte[hidden] { display: none; }
#mentions-carte {
  position: fixed;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 2px 10px;
  max-width: 100%;
  box-sizing: border-box;
  font-size: 10.5px;
  line-height: 1.5;
  color: #5a4a3c;
  background: rgba(244, 238, 223, 0.88);
  border-top-left-radius: 6px;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: none;
}
html.carte-reelle #mentions-carte { display: block; }
/* Tant que la carte n'est pas là, rien à montrer : le jeu ne se joue que sur
   un vrai plan d'eau. */
html.sans-carte #plan-eau { visibility: hidden; }
.etat-carte { margin: 0; display: flex; align-items: center; justify-content: center; gap: 8px;
  flex-wrap: wrap; font-size: 13px; color: var(--texte-doux); text-align: center; }
.etat-carte.panne { color: var(--alerte); }
.etat-carte .lien { min-height: 36px; }
html.accueil-ouvert #mentions-carte { display: none; }
html.compact #mentions-carte { font-size: 9px; padding: 1px 8px; left: 0; border-radius: 0; text-align: right; }

.seul-compact { display: none !important; }
.seul-tactile { display: none !important; }
html.compact .seul-large { display: none !important; }
html.tactile .seul-tactile { display: grid !important; }
html.tactile .seul-clavier { display: none !important; }

/* ---------------------------------------------------------------------------
   LA LIGNE DU HAUT — en-tête et bandeau confondus
--------------------------------------------------------------------------- */

#entete {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  height: calc(var(--h-ligne) + 48px);
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  /* Le voile qui fait lire des chiffres blancs sur une carte claire : sombre
     en haut, fondu vers le bas. Il remplace les fonds de blocs. */
  background: linear-gradient(180deg, rgba(16, 18, 22, 0.94) 0%,
    rgba(16, 18, 22, 0.62) 58%, rgba(16, 18, 22, 0) 100%);
  pointer-events: none;
}
#entete > * { pointer-events: auto; }
#entete .gauche, #entete .droite {
  height: var(--h-ligne);
  display: flex;
  align-items: center;
  gap: 10px;
}
#entete svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
#entete .marque {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 44px;
  padding: 0 4px;
  background: none;
  border: 0;
  color: var(--texte);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
#entete .marque .logo { stroke: var(--sails); }
#entete .rond {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 19px;
  background: var(--verre);
  border: 1px solid var(--verre-trait);
  color: var(--texte);
  cursor: pointer;
}
#entete .rond:hover { border-color: rgba(255, 255, 255, 0.24); }
#entete .rond.texte { width: auto; min-width: 44px; padding: 0 10px; font-family: var(--mono); font-size: 12px; }
#entete .rond svg { width: 16px; height: 16px; }
#b-pause svg { fill: currentColor; stroke: none; }
#b-pause .i-jouer { display: none; }
#b-pause.en-pause .i-jouer { display: block; }
#b-pause.en-pause .i-pause { display: none; }
#b-pause.en-pause { color: var(--ciel); border-color: rgba(110, 168, 240, 0.5); }
#b-reglages.actif { color: var(--ciel); border-color: rgba(110, 168, 240, 0.5); }

/* ---------------------------------------------------------------------------
   LE BANDEAU — trois chiffres, sans cadres
--------------------------------------------------------------------------- */

#bandeau {
  position: fixed;
  top: env(safe-area-inset-top);
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
#rang1 {
  display: grid;
  /* Largeurs FIXES : `auto` faisait sauter tout le bandeau trente fois par
     seconde, chaque chiffre poussant ses voisins. */
  grid-template-columns: repeat(3, 150px);
  padding-top: 8px;
  pointer-events: auto;
  cursor: default;
}
.jauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}
.etiquette {
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--texte-faible);
}
.chiffre {
  margin-top: 2px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 28px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--texte);
}
/* Le signe de la VMG dit si l'on gagne sur la marque : c'est la seule valeur
   du bandeau qui change de couleur, et elle ne le fait que pour cela. */
.jauge-vmg.monte .chiffre { color: var(--monte); }
.jauge-vmg.chute .chiffre { color: var(--chute); }
.contexte {
  margin-top: 4px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 10px;
  color: var(--texte-doux);
  /* La ligne de contexte ne doit jamais élargir sa colonne. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.contexte.penalite { color: var(--alerte); }

/* Le POURQUOI, en une ligne fine : trois micro-barres signées autour de zéro. */
.jauge-air {
  display: flex;
  gap: 20px;
  margin-top: 7px;
  pointer-events: auto;
}
.barre {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 10px;
  color: var(--texte-doux);
  white-space: nowrap;
}
.barre-nom { color: var(--texte-faible); }
.barre-piste {
  position: relative;
  width: 40px;
  height: 3px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.barre-piste::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -2px;
  bottom: -2px;
  width: 1px;
  background: rgba(255, 255, 255, 0.28);
}
.barre-piste i {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 0;
  background: var(--monte);
}
.barre-piste i.negatif { background: var(--chute); }
.barre-val { width: 30px; }

/* Une alerte à la fois, sous la ligne : son apparition ne déplace rien. */
#alertes {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  white-space: nowrap;
  pointer-events: none;
}
.pastille {
  padding: 4px 12px 5px;
  border-radius: 999px;
  background: rgba(30, 33, 37, 0.88);
  border: 1px solid currentColor;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--texte-doux);
}
.pastille.grave { color: var(--alerte); }
.pastille.chaud { color: var(--chute); }
.pastille.bien { color: var(--monte); }
.pastille.info { color: var(--ciel); }
/* La gêne : trois couleurs pleines, pour être vues du coin de l'œil. */
.pastille.jaune { background: #F2C230; border-color: #F2C230; color: #1d1a10; font-weight: 600; }
.pastille.orange { background: #F08A3C; border-color: #F08A3C; color: #1d120a; font-weight: 600; }
.g-jaune { color: #F2C230; } .g-orange { color: #F08A3C; } .g-rouge { color: #E5484D; }
.pastille.rouge { background: #E5484D; border-color: #E5484D; color: #fff; font-weight: 700; }

/* Le détail, à la demande. */
#detail {
  margin-top: 44px;
  padding: 10px 14px 12px;
  background: rgba(30, 33, 37, 0.97);
  border: 1px solid var(--trait);
  border-radius: 8px;
  pointer-events: auto;
}
#detail[hidden] { display: none; }
#detail table { border-collapse: collapse; font-size: 11px; }
#detail th {
  padding: 3px 10px 3px 0;
  text-align: left;
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--texte-faible);
}
#detail td {
  padding: 3px 24px 3px 0;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--texte);
}
#detail td:last-child { padding-right: 0; }

/* ---------------------------------------------------------------------------
   LE CADRAN — l'angle au vent et le réglage en un dessin
--------------------------------------------------------------------------- */

#cadran {
  position: fixed;
  left: max(20px, env(safe-area-inset-left));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 3;
  display: flex;
  align-items: flex-end;
  gap: 14px;
  pointer-events: none;
}
#cadran svg { width: 140px; height: 140px; flex: none; }
#cadran .fond { fill: rgba(16, 18, 22, 0.72); stroke: var(--verre-trait); }
#cadran .anneau { fill: none; stroke: rgba(255, 255, 255, 0.06); }
#cadran .reperes { stroke: rgba(255, 255, 255, 0.22); fill: none; }
#cadran .vent { stroke: var(--ciel); stroke-width: 3.5; stroke-linecap: round; }
#cadran .vent-pointe { fill: var(--ciel); }
#cadran .coque { fill: #bfd6e3; stroke: #16262f; stroke-width: 1.6; }
#cadran .optimum { stroke: var(--monte); stroke-width: 2.4; stroke-dasharray: 3 3; fill: none; }
#cadran .bome { stroke: var(--texte); stroke-width: 3.2; stroke-linecap: round; fill: none; }
#cadran.faseye .bome { stroke: var(--chute); }
#cadran .lecture {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 10px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
#cadran .angle { font-size: 22px; font-weight: 600; }
#cadran .amure { margin-left: 8px; font-size: 11px; font-weight: 400; color: var(--texte-doux); }
#cadran .reglage-bome { font-size: 11px; color: var(--texte-doux); }
#cadran.faseye .reglage-bome { color: var(--chute); }
#cadran .spi { font-size: 11px; color: var(--monte); }
#cadran .spi:empty { display: none; }
/* Sur la carte claire, la lecture du cadran prend un fond de verre : posée à
   nu, son texte gris se perdait dans le lavis de l'eau. */
html.carte-reelle #cadran .coque { fill: #F0705E; }
html.carte-reelle #cadran .lecture { padding: 8px 12px; border-radius: 10px; background: var(--verre); }

/* ---------------------------------------------------------------------------
   RÉGLAGES — un tiroir qui n'existe que quand on l'ouvre
--------------------------------------------------------------------------- */

#panneau {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  z-index: 8;
  display: flex;
  flex-direction: column;
  background: var(--ardoise);
  border-left: 1px solid var(--trait);
  box-shadow: -16px 0 40px rgba(0, 0, 0, 0.35);
  font-size: 13px;
  color: var(--texte-doux);
}
/* Replié, le tiroir disparaît tout entier : c'est le bouton Réglages de la
   ligne du haut qui le rouvre, toujours au même endroit. */
#panneau.replie .volet { display: none; }
#panneau.replie { display: none; }
#panneau .tete {
  display: flex;
  align-items: center;
  padding: 14px 10px 10px 20px;
  padding-top: max(14px, env(safe-area-inset-top));
}
#panneau .titre { flex: 1; font-size: 15px; font-weight: 600; color: var(--texte); }
#fermer-panneau {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  color: var(--texte-doux);
  cursor: pointer;
}
#fermer-panneau svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

/* Les onglets en sélecteur segmenté. */
#rail {
  margin: 0 20px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  border-radius: 9px;
  background: var(--creux);
}
#rail button {
  height: 34px;
  border-radius: 7px;
  background: none;
  border: 0;
  color: var(--texte-doux);
  font-size: 12px;
  cursor: pointer;
}
#rail button:hover { color: var(--texte); }
#rail button.actif { background: var(--trait); color: var(--texte); font-weight: 600; }

.volet {
  flex: 1;
  min-height: 0;
  padding: 18px 20px 24px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.volet[hidden] { display: none; }

.volet h3 {
  margin: 22px 0 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--texte-faible);
}
.volet h3:first-child { margin-top: 0; }
.volet p { margin: 10px 0 0; line-height: 1.5; font-size: 12.5px; }

.volet dl {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 5px 10px;
  margin: 0 0 12px;
}
.volet dl.seul-tactile { grid-template-columns: 92px 1fr; gap: 8px 10px; }
.volet dt { font-family: var(--mono); font-size: 11px; color: var(--texte); }
.volet dd { margin: 0; font-size: 12px; line-height: 1.45; }

.regles { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.regles li { display: grid; grid-template-columns: 30px 1fr; font-size: 12.5px; line-height: 1.45; color: var(--texte); }
.regles b { font-family: var(--mono); font-weight: 600; color: var(--ciel); }

.reglage {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  font-size: 13px;
  color: var(--texte);
}
.reglage > span:last-child {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
.reglage .vent, .reglage .houle { color: var(--texte-doux); font-family: var(--texte-face); }

/* Sélecteurs segmentés : un creux, une pastille pour le choix actif. */
.choix {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border-radius: 8px;
  background: var(--creux);
}
.choix button {
  min-width: 40px;
  padding: 6px 9px;
  border-radius: 6px;
  background: none;
  border: 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--texte-doux);
  cursor: pointer;
}
.choix button:hover { color: var(--texte); }
.choix button.actif { background: rgba(110, 168, 240, 0.18); color: var(--ciel); }

.presets { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.cherche { display: block; margin: 14px 0 6px; font-size: 12.5px; color: var(--texte-doux); }
.champ-texte { width: 100%; box-sizing: border-box; min-height: 38px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--trait); background: var(--creux); color: var(--texte); font: inherit; font-size: 13px; }
.champ-texte:focus { outline: 2px solid var(--ciel); outline-offset: 1px; }
#resultats-commune:not(:empty) { margin-top: 6px; }
.note-carte { margin: 10px 0 0; font-size: 11.5px; line-height: 1.45; color: var(--texte-doux); }
.presets button {
  padding: 9px 4px;
  border-radius: 7px;
  background: var(--creux);
  border: 1px solid transparent;
  color: var(--texte-doux);
  font-size: 12px;
  cursor: pointer;
}
.presets button:hover { color: var(--texte); }
.presets button.actif { color: var(--ciel); border-color: rgba(110, 168, 240, 0.45); background: rgba(110, 168, 240, 0.12); }

.curseur {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px 8px;
  padding: 6px 0 10px;
  font-size: 13px;
  color: var(--texte);
}
.curseur > span:nth-child(2) {
  justify-self: end;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(110, 168, 240, 0.14);
  color: var(--ciel);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
}
.curseur input { grid-column: 1 / -1; width: 100%; accent-color: var(--ciel); margin: 0; touch-action: pan-x; }

.action {
  display: block;
  width: 100%;
  min-height: 42px;
  margin-top: 8px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ciel);
  background: rgba(110, 168, 240, 0.10);
  border: 1px solid rgba(110, 168, 240, 0.40);
  cursor: pointer;
}
.action:hover { background: rgba(110, 168, 240, 0.18); }
.action.primaire { background: var(--ciel); border-color: var(--ciel); color: #0E1A28; font-weight: 700; }
.action.primaire:hover { filter: brightness(1.06); }
.action.discret { color: var(--texte); background: var(--ardoise-2); border-color: var(--trait); font-weight: 500; }
.action.discret:hover { border-color: var(--trait-vif); }
.action.arret { color: var(--alerte); background: rgba(255, 90, 60, 0.10); border-color: rgba(255, 90, 60, 0.45); }
.action.primaire.arret { background: rgba(255, 90, 60, 0.12); color: var(--alerte); }
.volet .pied {
  position: sticky;
  bottom: -24px;
  margin: 18px -20px -24px;
  padding: 14px 20px 22px;
  background: var(--ardoise);
  border-top: 1px solid var(--trait);
}
.volet .pied .action { margin-top: 0; min-height: 46px; }

#panneau.verrouille .choix button,
#panneau.verrouille .presets button,
#panneau.verrouille .curseur input,
#panneau.verrouille #carrer { opacity: 0.45; cursor: not-allowed; }

.verrou {
  padding: 9px 11px;
  border-radius: 6px;
  background: rgba(255, 90, 60, 0.10);
  color: var(--alerte);
  font-size: 12px;
  line-height: 1.45;
}
.verrou[hidden] { display: none; }
.indice { color: var(--texte-faible); font-size: 12px; }

#rose { display: block; width: 100%; max-width: 280px; margin: 0 auto; height: auto; aspect-ratio: 1 / 1; touch-action: none; cursor: pointer; }
#rose .anneau { fill: none; stroke: var(--trait); }
#rose .anneau.faible { stroke: rgba(46, 50, 56, 0.7); }
#rose .croix { stroke: var(--trait-vif); }
#rose .moyeu { fill: var(--texte); }
#rose text { font-family: var(--mono); text-anchor: middle; }
#rose .cardinal { font-size: 10px; fill: var(--texte-faible); }
#rose .cardinal.fort { fill: var(--texte-doux); }
#rose .graduation { font-size: 8.5px; fill: var(--texte-faible); text-anchor: start; }
#rose .vent-tige { stroke: var(--ciel); stroke-width: 3; fill: none; }
#rose .vent-pointe { fill: var(--ciel); }
#rose .vent-poignee { fill: none; stroke: var(--ciel); stroke-width: 1.5; opacity: 0.4; }
#rose .houle-tige { stroke: var(--texte-faible); stroke-width: 1.6; fill: none; stroke-dasharray: 5 4; }
#rose .houle-pointe { fill: var(--texte-faible); }

.polaire { padding-top: 14px; margin-top: 18px !important; border-top: 1px solid var(--trait); }
.polaire label { display: block; font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 6px; color: var(--texte-faible); }
.polaire input { max-width: 100%; font-size: 11px; color: var(--texte-doux); }
#nom-polaire { display: block; margin-top: 6px; font-family: var(--mono); font-size: 10px; color: var(--texte-doux); }
.version { font-family: var(--mono); font-size: 10px; color: var(--texte-faible); }
#version { color: var(--texte-doux); }

/* ---------------------------------------------------------------------------
   COMMANDES TACTILES — translucides, posées sur l'eau
--------------------------------------------------------------------------- */

#commandes { display: none; }
html.tactile #commandes {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: block;
  pointer-events: none;
}
html.tactile #commandes > * { pointer-events: auto; }

#commandes .boutons {
  position: absolute;
  left: 16px;
  bottom: calc(30px + 72px + 22px + env(safe-area-inset-bottom));
  display: flex;
  gap: 10px;
}
#commandes .bascule {
  width: 52px;
  height: 52px;
  border-radius: 26px;
  background: rgba(30, 33, 37, 0.78);
  border: 1px solid var(--verre-trait);
  color: var(--texte);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
#commandes .bascule.actif { background: rgba(110, 168, 240, 0.22); border-color: rgba(110, 168, 240, 0.55); color: var(--ciel); }
#commandes .bascule.temps { font-family: var(--mono); font-weight: 500; font-size: 12px; }

#pad-barre {
  position: absolute;
  left: 16px;
  right: 76px;
  bottom: calc(30px + env(safe-area-inset-bottom));
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  border-radius: 36px;
  background: var(--verre);
  border: 1px solid var(--verre-trait);
  touch-action: none;
  overflow: hidden;
}
#pad-barre .fleche { width: 22px; height: 22px; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
#pad-barre .fleche.babord { stroke: var(--babord); }
#pad-barre .fleche.tribord { stroke: var(--tribord); }
#pad-barre .legende { font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--texte-faible); pointer-events: none; }
#pad-repere {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  border: 2px solid transparent;
  pointer-events: none;
}
#pad-barre.babord-tenu { background: rgba(255, 138, 92, 0.16); }
#pad-barre.tribord-tenu { background: rgba(87, 227, 155, 0.14); }
#pad-barre.babord-tenu #pad-repere { border-color: var(--babord); }
#pad-barre.tribord-tenu #pad-repere { border-color: var(--tribord); }

#ecoute {
  position: absolute;
  right: 16px;
  bottom: calc(30px + env(safe-area-inset-bottom));
  width: 48px;
  height: 196px;
  padding: 18px 0;
  display: flex;
  justify-content: center;
  border-radius: 24px;
  background: var(--verre);
  border: 1px solid var(--verre-trait);
  touch-action: none;
}
#ecoute .piste {
  position: relative;
  width: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
  pointer-events: none;
}
#ecoute-optimum { position: absolute; left: -12px; right: -12px; height: 2px; margin-top: -1px; background: var(--monte); }
#ecoute-poignee { position: absolute; left: 50%; width: 32px; height: 22px; margin: -11px 0 0 -16px; border-radius: 11px; background: var(--texte); }
#ecoute.auto #ecoute-poignee { background: var(--trait-vif); }

/* ---------------------------------------------------------------------------
   DISPOSITION COMPACTE — téléphone, ou fenêtre étroite
--------------------------------------------------------------------------- */

html.compact #entete { padding-left: max(4px, env(safe-area-inset-left)); padding-right: max(4px, env(safe-area-inset-right)); }
html.compact #entete .gauche, html.compact #entete .droite { gap: 0; }
/* Sur téléphone, le logo seul : il ramène à l'accueil du jeu. */
html.compact #entete .marque span { display: none; }
html.compact #entete .marque { width: 44px; justify-content: center; padding: 0; }
html.compact #entete .rond { width: 44px; height: 44px; background: none; border-color: transparent; }

/* Décalé vers la gauche : à droite, Pause et Réglages prennent 88 px contre
   44 px pour le retour. Centré, le chrono collait au bouton Pause. */
html.compact #rang1 { grid-template-columns: repeat(3, 80px); transform: translateX(-22px); }
html.compact .chiffre { font-size: 23px; }
html.compact .contexte { display: none; }
html.compact #i-chrono-ctx.penalite { display: block; position: absolute; top: 58px; left: 50%; transform: translateX(-50%); }
html.compact #rang1 { position: relative; }
html.compact .jauge-air { display: none; }
html.compact #detail { margin-top: 30px; max-width: calc(100vw - 12px); overflow-x: auto; touch-action: pan-x; }
html.compact #detail td { padding-right: 12px; }

/* Le cadran rapetisse et se pose au-dessus des pouces, sans sa lecture. */
html.compact #cadran {
  left: auto;
  right: 86px;
  bottom: calc(30px + 72px + 18px + env(safe-area-inset-bottom));
}
html.compact #cadran svg { width: 76px; height: 76px; }
html.compact #cadran .lecture { display: none; }
html:not(.tactile).compact #cadran { right: 16px; bottom: 16px; }

/* Les réglages deviennent une feuille qui monte du bas. */
html.compact #panneau {
  top: auto;
  left: 0;
  right: 0;
  width: auto;
  height: min(80dvh, 660px);
  border-left: 0;
  border-top: 1px solid var(--trait);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
}
html.compact #panneau .tete { padding-top: 12px; }
html.compact .choix button { min-height: 40px; }
html.compact .presets button { min-height: 44px; }

/* ---------------------------------------------------------------------------
   CLASSEMENT
--------------------------------------------------------------------------- */

#resultats {
  position: fixed;
  z-index: 7;
  left: 50%;
  top: calc(var(--h-ligne) + 60px);
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 24px));
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(30, 33, 37, 0.98);
  border: 1px solid var(--trait-vif);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
#resultats[hidden] { display: none; }
#resultats .poignee { display: none; }
.res-tete { display: flex; align-items: baseline; justify-content: space-between; }
#res-rang { margin: 0; font-size: 26px; font-weight: 600; }
#res-rang small { font-size: 15px; font-weight: 400; color: var(--texte-doux); }
.res-statut { padding: 3px 10px; border-radius: 999px; border: 1px solid rgba(110, 168, 240, 0.5); color: var(--ciel); font-size: 11px; }
.res-statut.definitif { border-color: rgba(87, 227, 155, 0.5); color: var(--monte); }
.res-temps { display: flex; gap: 26px; }
.res-temps div { display: flex; flex-direction: column; gap: 2px; }
.res-temps .valeur { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 21px; font-weight: 600; }
.res-temps .valeur.pen { color: var(--alerte); }
.res-temps .valeur.pen.nulle { color: var(--texte-faible); }
#res-etat { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--texte-doux); }
#resultats table { width: 100%; border-collapse: collapse; font-size: 13px; }
#resultats th { padding: 0 6px 6px 0; text-align: left; font-size: 8.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--texte-faible); border-bottom: 1px solid var(--trait); }
#resultats td { padding: 8px 6px 8px 0; border-bottom: 1px solid var(--trait); }
#resultats td.rang, #resultats td.temps, #resultats td.pen { font-family: var(--mono); font-variant-numeric: tabular-nums; }
#resultats td.rang { width: 34px; color: var(--texte-doux); }
#resultats td.pen { color: var(--alerte); }
#resultats td.pen.nulle { color: var(--texte-faible); }
#resultats td.bateau i { display: inline-block; width: 9px; height: 9px; margin-right: 8px; border-radius: 2px; }
#resultats tr.vous td { color: var(--texte); font-weight: 600; }
#resultats tr.vous td.bateau { color: var(--ciel); }
#resultats tr.vous td.pen { color: var(--alerte); }
#resultats tr.vous td.pen.nulle { color: var(--texte-faible); }
.res-actions { display: flex; gap: 8px; }
.res-actions .action { margin-top: 0; min-height: 46px; }
.res-actions .primaire { flex: 2; background: var(--sails); border-color: var(--sails); color: #1F0E0B; }
.res-actions .discret { flex: 1; }

html.compact #resultats {
  top: auto;
  bottom: 0;
  left: 0;
  right: 0;
  transform: none;
  width: auto;
  max-height: 86dvh;
  overflow: auto;
  padding: 10px 20px max(26px, env(safe-area-inset-bottom));
  border-radius: 18px 18px 0 0;
  border-width: 1px 0 0;
}
html.compact #resultats .poignee { display: block; align-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--trait); }

/* ---------------------------------------------------------------------------
   ÉCRAN D'ACCUEIL DU JEU
--------------------------------------------------------------------------- */

#accueil {
  position: fixed;
  inset: 0;
  z-index: 9;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: auto;
  touch-action: pan-y;
  padding: max(11vh, 80px) 18px calc(28px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(18, 50, 74, 0.82) 0%, rgba(24, 26, 32, 0.97) 42%, var(--fond) 100%);
}
#accueil[hidden] { display: none; }
/* Derrière l'accueil, rien de ce qui pilote le bateau ne doit se voir. La
   ligne du haut garde son nom, sans chiffres ni boutons. */
html.accueil-ouvert #bandeau,
html.accueil-ouvert #cadran,
html.accueil-ouvert #commandes,
html.accueil-ouvert #panneau,
html.accueil-ouvert #message,
html.accueil-ouvert #entete .droite { visibility: hidden; }
html.accueil-ouvert #entete { z-index: 10; background: none; }

.accueil-corps { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 12px; }
.accueil-tete { display: flex; align-items: center; gap: 12px; }
.accueil-tete .logo { width: 36px; height: 36px; fill: none; stroke: var(--sails); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
#accueil h1 { margin: 0; font-size: 34px; font-weight: 600; letter-spacing: 0.01em; }
.accroche { margin: 0 0 12px; font-size: 14px; color: var(--texte-doux); }
/* Les types de partie sont des options : la sélection prend le bleu des
   autres sélecteurs du jeu (niveau, réglages), en transparence. Le corail de
   FunSails ne sert plus qu'au bouton qui lance — en voile lui aussi : l'aplat
   plein d'avant était trop violent sur le fond sombre. */
.parties { display: flex; flex-direction: column; gap: 12px; }
.choix-partie { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 18px; border-radius: 12px; background: var(--ardoise); border: 1px solid var(--trait); color: var(--texte); text-align: left; cursor: pointer; font: inherit; }
.choix-partie:hover { border-color: var(--trait-vif); }
.choix-partie .texte { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.choix-partie .titre { font-size: 15px; font-weight: 600; }
.choix-partie .detail { font-size: 12.5px; color: var(--texte-doux); line-height: 1.4; }
.choix-partie .coche { flex: none; width: 22px; height: 22px; }
.choix-partie .coche .rond { fill: none; stroke: var(--trait-vif); stroke-width: 1.5; }
.choix-partie .coche .v { fill: none; stroke: var(--fond); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.choix-partie[aria-checked="true"] { background: rgba(110, 168, 240, 0.12); border-color: rgba(110, 168, 240, 0.55); }
.choix-partie[aria-checked="true"] .titre { color: #9CC3F5; }
.choix-partie[aria-checked="true"] .detail { color: #B9BEC4; }
.choix-partie[aria-checked="true"] .coche .rond { fill: var(--ciel); stroke: var(--ciel); }
.choix-partie[aria-checked="true"] .coche .v { opacity: 1; }
.choix-partie:focus-visible { outline: 2px solid var(--ciel); outline-offset: 2px; }
.partir { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; border-radius: 12px; background: rgba(240, 112, 94, 0.22); border: 1px solid rgba(240, 112, 94, 0.6); color: #F7A496; font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; }
.partir:hover { background: rgba(240, 112, 94, 0.3); }
.partir:focus-visible { outline: 2px solid var(--sails); outline-offset: 2px; }
.partir svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
/* Le niveau se choisit avant la partie, juste sous l'accroche : il vaut pour
   la partie rapide comme pour la régate personnalisée. */
.niveau-accueil { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.niv-tete { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; color: var(--texte-doux); }
.niv-nom { color: var(--texte); font-weight: 600; }
.reglage .niv-nom { margin-left: 6px; font-weight: 500; color: var(--texte-doux); }
.niveau-accueil .choix { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.niveau-accueil .choix button { min-height: 40px; font-size: 14px; }
.scores { margin-top: 8px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.score { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 10px; background: var(--ardoise); border: 1px solid var(--trait); }
.score .valeur { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 600; }
.score .sous { font-size: 11px; color: var(--texte-doux); }
.note { margin: 0; font-size: 11.5px; line-height: 1.45; color: var(--texte-doux); }
.lien { align-self: center; min-height: 44px; padding: 0 12px; background: none; border: 0; color: var(--ciel); font-size: 13px; cursor: pointer; }

/* ---------------------------------------------------------------------------
   Portrait seulement, message, panne
--------------------------------------------------------------------------- */

#tourner {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  background: var(--fond);
  text-align: center;
  font-size: 15px;
  color: var(--texte);
}
#tourner[hidden] { display: none; }
#tourner svg { width: 64px; height: 64px; fill: none; stroke: var(--sails); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#tourner p { margin: 0; max-width: 30ch; line-height: 1.5; }

#message {
  position: fixed;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  z-index: 6;
  margin: 0;
  max-width: calc(100vw - 32px);
  padding: 11px 20px 12px;
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--texte);
  background: rgba(30, 33, 37, 0.94);
  border: 1px solid var(--trait-vif);
  border-radius: 10px;
  pointer-events: none;
  text-align: center;
}
#message[hidden] { display: none; }
html.compact #message { font-size: 13px; padding: 10px 16px 11px; }

#panne {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  width: min(460px, calc(100vw - 32px));
  padding: 20px 24px;
  background: var(--ardoise);
  border: 1px solid var(--alerte);
  border-left-width: 3px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--texte-doux);
}
#panne[hidden] { display: none; }
#panne h2 { margin: 0 0 10px; font-size: 13px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--alerte); }
#panne p { margin: 0 0 10px; }
#panne p:last-child { margin-bottom: 0; }

:focus-visible { outline: 2px solid var(--ciel); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 1ms !important; }
}

/* La règle d'affichage des chiffres, citée par le banc d'essai : tout chiffre
   qui change est en chasse fixe — font-variant-numeric: tabular-nums. */

/* =============================================================================
   VERRE LIQUIDE — deux matières au choix : clair ou fumé (ou celle du système)

   Un menu de verre, c'est quatre choses : le flou fort de ce qui est dessous
   (la carte reste reconnaissable en couleurs, sans le détail), un voile clair
   ou anthracite, un filet d'un pixel avec un reflet en haut — c'est lui qui
   donne l'épaisseur —, et de grands arrondis avec une ombre très douce.
   L'état « choisi » est une pastille blanche presque pleine, texte en bleu.
   La classe verre-clair / verre-fume est posée sur <html> avant le premier
   dessin (index.html), puis tenue par le réglage Apparence.
============================================================================= */

html.verre-clair {
  --texte:        #1E2733;
  --texte-doux:   #4D5866;
  --texte-faible: #5E6976;
  --trait:        rgba(30, 45, 65, 0.13);
  --trait-vif:    rgba(30, 45, 65, 0.24);
  --creux:        rgba(60, 80, 110, 0.13);
  --ardoise:      rgba(255, 255, 255, 0.40);
  --ardoise-2:    rgba(255, 255, 255, 0.40);
  --ciel:         #2F6FE4;
  --monte:        #14915A;
  --chute:        #D2602A;
  --alerte:       #D63A22;
  --sails:        #E2604C;
  --vitre:        rgba(250, 252, 255, 0.50);
  --vitre-bord:   rgba(255, 255, 255, 0.70);
  --vitre-reflet: rgba(255, 255, 255, 0.90);
  --vitre-ombre:  0 18px 50px rgba(40, 60, 90, 0.20), 0 2px 6px rgba(40, 60, 90, 0.08);
  --vitre-pied:   rgba(250, 252, 255, 0.55);
  --verre:        var(--vitre);
  --verre-trait:  var(--vitre-bord);
  --pastille:     rgba(255, 255, 255, 0.95);
  --pastille-texte: #1E2733;
  --voile-accueil: rgba(236, 242, 248, 0.18);
  color-scheme: light;
}
html.verre-fume {
  --texte:        #F2F5F8;
  --texte-doux:   #C3CBD4;
  --texte-faible: #A9B2BC;
  --trait:        rgba(255, 255, 255, 0.14);
  --trait-vif:    rgba(255, 255, 255, 0.26);
  --creux:        rgba(255, 255, 255, 0.11);
  --ardoise:      rgba(255, 255, 255, 0.08);
  --ardoise-2:    rgba(255, 255, 255, 0.08);
  --ciel:         #7DB2F5;
  --alerte:       #ff6a4c;
  --vitre:        rgba(22, 28, 36, 0.52);
  --vitre-bord:   rgba(255, 255, 255, 0.18);
  --vitre-reflet: rgba(255, 255, 255, 0.22);
  --vitre-ombre:  0 18px 50px rgba(10, 16, 24, 0.35);
  --vitre-pied:   rgba(22, 28, 36, 0.60);
  --verre:        var(--vitre);
  --verre-trait:  var(--vitre-bord);
  --pastille:     rgba(255, 255, 255, 0.90);
  --pastille-texte: #1E2733;
  --voile-accueil: rgba(10, 14, 20, 0.28);
}

/* La matière, une fois pour toutes. */
html[class*="verre-"] #entete .gauche,
html[class*="verre-"] #entete .rond,
html[class*="verre-"] #bandeau,
html[class*="verre-"] #cadran svg,
html[class*="verre-"] #cadran .lecture,
html[class*="verre-"] #panneau,
html[class*="verre-"] .pastille:not(.jaune):not(.orange):not(.rouge),
html[class*="verre-"] #message,
html[class*="verre-"] #resultats,
html[class*="verre-"] .accueil-corps,
html[class*="verre-"] #commandes .bascule,
html[class*="verre-"] #pad-barre,
html[class*="verre-"] #ecoute,
html[class*="verre-"] #bulle-vent {
  background: var(--vitre);
  -webkit-backdrop-filter: blur(26px) saturate(170%);
  backdrop-filter: blur(26px) saturate(170%);
  border: 1px solid var(--vitre-bord);
  box-shadow: inset 0 1px 0 var(--vitre-reflet), var(--vitre-ombre);
}
html[class*="verre-"] body { background: #EFE8D6; }

/* La ligne du haut : plus de voile sombre, des pièces de verre posées. */
html[class*="verre-"] #entete { background: none; top: 6px; }
html[class*="verre-"] #entete .gauche { height: 44px; margin-top: 10px; padding: 0 12px 0 6px; gap: 2px; border-radius: 22px; }
html[class*="verre-"] #entete .droite { gap: 8px; }
html[class*="verre-"] #entete .rond { width: 44px; height: 44px; border-radius: 22px; color: var(--texte); }
html[class*="verre-"] #entete .rond.texte { width: auto; min-width: 48px; }
html[class*="verre-"] #entete .rond:hover { border-color: var(--vitre-bord); filter: brightness(1.04); }
html[class*="verre-"] #b-pause.en-pause,
html[class*="verre-"] #b-reglages.actif { background: var(--pastille); color: #2F6FE4; border-color: var(--pastille); }

html[class*="verre-"] #bandeau { top: calc(env(safe-area-inset-top) + 12px); padding: 8px 10px 10px; border-radius: 26px; }
html[class*="verre-"] #rang1 { padding-top: 0; grid-template-columns: repeat(3, 132px); }
html[class*="verre-"] .chiffre { font-size: 26px; }
html[class*="verre-"] #detail { margin-top: 10px; background: none; border: 0; border-top: 1px solid var(--trait); border-radius: 0; padding: 10px 6px 2px; }
html[class*="verre-"] .barre-piste { background: var(--creux); border-radius: 2px; }
html[class*="verre-"] .barre-piste::before { background: var(--trait-vif); }
html[class*="verre-"] #alertes { top: calc(100% + 8px); }
html[class*="verre-"] .pastille { padding: 5px 14px 6px; }

/* Le cadran : un disque de verre. */
html[class*="verre-"] #cadran svg { border-radius: 50%; }
html[class*="verre-"] #cadran .fond { fill: none; stroke: none; }
html[class*="verre-"] #cadran .anneau { stroke: var(--trait); }
html[class*="verre-"] #cadran .reperes { stroke: var(--trait-vif); }
html[class*="verre-"] #cadran .lecture { padding: 9px 14px 10px; border-radius: 18px; margin-bottom: 8px; }

/* Les réglages : une carte qui flotte, plus un tiroir collé au bord. */
html[class*="verre-"] #panneau {
  top: calc(env(safe-area-inset-top) + 72px);
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: 372px;
  border-radius: 30px;
  overflow: hidden;
}
html[class*="verre-"] #panneau .tete { padding: 14px 10px 10px 22px; }
html[class*="verre-"] #fermer-panneau { width: 34px; height: 34px; margin-right: 6px; border-radius: 17px; background: var(--creux); }
html[class*="verre-"] #rail { margin: 0 16px; border-radius: 20px; background: var(--creux); }
html[class*="verre-"] #rail button { border-radius: 17px; }
html[class*="verre-"] #rail button.actif { background: var(--pastille); color: var(--pastille-texte); box-shadow: 0 2px 8px rgba(30, 45, 65, 0.12); }
html[class*="verre-"] .volet { padding-left: 22px; padding-right: 22px; }
html[class*="verre-"] .choix { border-radius: 999px; background: var(--creux); }
html[class*="verre-"] .choix button { border-radius: 999px; }
html[class*="verre-"] .choix button.actif { background: var(--pastille); color: #2F6FE4; font-weight: 600; box-shadow: 0 2px 8px rgba(30, 45, 65, 0.12); }
html[class*="verre-"] .presets button { border-radius: 14px; background: var(--creux); }
html[class*="verre-"] .presets button.actif { background: var(--pastille); color: #2F6FE4; border-color: var(--pastille); }
html[class*="verre-"] .champ-texte { border-radius: 14px; background: var(--creux); border-color: var(--trait); }
html[class*="verre-"] .curseur > span:nth-child(2) { background: var(--creux); }
html[class*="verre-"] .action { border-radius: 999px; min-height: 44px; }
html[class*="verre-"] .action.discret { background: var(--creux); border-color: var(--trait); }
html[class*="verre-"] .action.discret:hover { border-color: var(--trait-vif); }
html[class*="verre-"] .action.primaire { background: var(--pastille); border-color: var(--pastille); color: #1E2733; box-shadow: 0 4px 16px rgba(30, 45, 65, 0.16); }
html[class*="verre-"] .action.primaire.arret { color: var(--alerte); }
html[class*="verre-"] .volet .pied {
  background: var(--vitre-pied);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border-top-color: var(--trait);
  margin-left: -22px; margin-right: -22px; padding-left: 22px; padding-right: 22px;
}
html[class*="verre-"] .verrou { border-radius: 14px; }
html[class*="verre-"] #rose .anneau.faible { stroke: var(--trait); }

/* Téléphone : le panneau devient une feuille de verre, détachée des bords. */
html[class*="verre-"].compact #panneau {
  top: auto;
  left: 8px;
  right: 8px;
  bottom: max(8px, env(safe-area-inset-bottom));
  width: auto;
  height: min(78dvh, 640px);
  border-radius: 30px;
}
html[class*="verre-"].compact #entete .gauche { padding: 0 6px; }
html[class*="verre-"].compact #entete .rond { width: 42px; height: 42px; }
html[class*="verre-"].compact #entete .droite { gap: 6px; }
html[class*="verre-"].compact #bandeau { padding: 6px 4px 8px; }
html[class*="verre-"].compact #rang1 { grid-template-columns: repeat(3, 66px); transform: none; }
html[class*="verre-"].compact .chiffre { font-size: 21px; }
html[class*="verre-"].compact #bandeau { left: calc(50% - 18px); }
html[class*="verre-"].compact .chiffre { font-size: 20px; }

/* Les commandes au pouce. */
html[class*="verre-"] #commandes .bascule { color: var(--texte); }
html[class*="verre-"] #commandes .bascule.actif { background: var(--pastille); color: #2F6FE4; border-color: var(--pastille); }
html[class*="verre-"] #ecoute .piste { background: var(--creux); }
html[class*="verre-"] #ecoute-poignee { background: var(--pastille); box-shadow: 0 2px 8px rgba(30, 45, 65, 0.25); }
html[class*="verre-"] #ecoute.auto #ecoute-poignee { background: var(--trait-vif); }

/* Classement, message. */
html[class*="verre-"] #resultats { border-radius: 28px; }
html[class*="verre-"] .res-actions .action { border-radius: 999px; }
html[class*="verre-"] #message { border-radius: 18px; }
html[class*="verre-"].compact #resultats { left: 8px; right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); border-radius: 30px; border-width: 1px; }

/* L'accueil : la carte se voit derrière, tout tient dans une carte de verre. */
html[class*="verre-"] #accueil { background: var(--voile-accueil); padding-top: max(9vh, 72px); }
html[class*="verre-"] .accueil-corps { padding: 22px 20px 18px; border-radius: 32px; }
html[class*="verre-"] .choix-partie { border-radius: 22px; background: var(--creux); border: 1px solid var(--trait); }
html[class*="verre-"] .choix-partie:hover { border-color: var(--trait-vif); }
html[class*="verre-"] .choix-partie .coche .rond { stroke: var(--texte-faible); }
html[class*="verre-"] .choix-partie[aria-checked="true"] { background: var(--pastille); border-color: var(--pastille); box-shadow: 0 4px 16px rgba(30, 45, 65, 0.14); }
html[class*="verre-"] .choix-partie[aria-checked="true"] .titre { color: #1E2733; }
html[class*="verre-"] .choix-partie[aria-checked="true"] .detail { color: #4D5866; }
html[class*="verre-"] .choix-partie[aria-checked="true"] .coche .rond { fill: #2F6FE4; stroke: #2F6FE4; }
html[class*="verre-"] .choix-partie[aria-checked="true"] .coche .v { stroke: #fff; }
html[class*="verre-"] .partir { border-radius: 999px; min-height: 54px; }
html.verre-clair .partir { background: rgba(240, 112, 94, 0.26); border-color: rgba(226, 96, 76, 0.55); color: #8A2A1B; }
html.verre-clair .partir:hover { background: rgba(240, 112, 94, 0.34); }
html.verre-fume .partir { background: rgba(196, 72, 56, 0.62); border-color: rgba(255, 170, 155, 0.5); color: #FFE6E1; }
html.verre-fume .partir:hover { background: rgba(196, 72, 56, 0.75); }
html[class*="verre-"] .score { border-radius: 20px; background: var(--creux); border-color: var(--trait); }
html[class*="verre-"] .niveau-accueil .choix { padding: 3px; }
html[class*="verre-"] #accueil h1 { letter-spacing: -0.01em; }
html.verre-clair #accueil .lien { color: #2F6FE4; }

/* Sans carte (chargement, panne) : un fond uni de la couleur du papier. */
html.verre-clair.sans-carte body { background: #EFE8D6; }
html.verre-fume.sans-carte body { background: #2A3038; }

/* ---------------------------------------------------------------------------
   LA BULLE — le vent sous le curseur
--------------------------------------------------------------------------- */
#bulle-vent {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 7px 12px 8px;
  border-radius: 16px;
  pointer-events: none;
  white-space: nowrap;
  color: var(--texte);
  will-change: transform;
}
#bulle-vent[hidden] { display: none; }
#bulle-vent .v { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 19px; font-weight: 650; letter-spacing: -0.02em; }
#bulle-vent .v small { font-size: 11.5px; font-weight: 500; color: var(--texte-doux); }
#bulle-vent .s { font-size: 11.5px; color: var(--texte-doux); }
#bulle-vent.terre .s { font-size: 12.5px; }
html.accueil-ouvert #bulle-vent { display: none; }

/* Le bouton de départ, dans la ligne du haut : drapeau et libellé. Corail
   pour lancer, rouge pour annuler ou abandonner. Sur téléphone, le drapeau
   seul. */
#entete .rond.depart { gap: 6px; padding: 0 14px 0 11px; font-family: var(--texte-face); font-size: 13px; font-weight: 600; color: var(--sails); }
#entete .rond.depart svg { width: 16px; height: 16px; }
#entete .rond.depart.arret { color: var(--alerte); }
html.compact #entete .rond.depart { padding: 0; width: 44px; }
html[class*="verre-"].compact #entete .rond.depart { width: 42px; }
html.compact #entete .rond.depart .libelle { display: none; }
/* Sur téléphone, la droite n'a de place que pour la pause et les réglages :
   le drapeau passe à gauche, à côté du logo. */
html.compact #entete .rond.depart { position: fixed; left: calc(max(4px, env(safe-area-inset-left)) + 52px); top: calc(env(safe-area-inset-top) + 10px); }
html[class*="verre-"].compact #entete .rond.depart { top: calc(env(safe-area-inset-top) + 17px); }
html[class*="verre-"].compact #rang1 { grid-template-columns: repeat(3, 60px); }
html[class*="verre-"].compact #bandeau { left: calc(50% + 1px); }

/* Les dates du jeu : première mise en ligne et dernière mise à jour. Au pied
   de l'accueil, et au pied du panneau des réglages, hors du défilement des
   onglets pour rester visibles. */
.dates-jeu {
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
  color: var(--texte-doux);
}
.dates-jeu time { color: var(--texte); font-weight: 600; }
.dates-jeu .numero { white-space: nowrap; }
#panneau .pied-panneau {
  flex: none;
  margin: 0;
  padding: 10px 20px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--trait);
}

/* Les listes de l'aide (réglage automatique). */
.volet ul { margin: 8px 0 0; padding-left: 18px; font-size: 12.5px; line-height: 1.5; }
.volet ul li + li { margin-top: 4px; }
