/* ==========================================================================
   Le Cœur du piano — V4 « Scène »
   Un seul monde visuel : la salle de concert dans le noir. Mono-thème sombre,
   toutes les couleurs explicites. Noir, crème, un seul rouge.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* la palette, et rien d'autre */
  --nuit: #000000;
  --creme: #F0E1BF;
  --rouge: #C0172F;

  /* rôles */
  --bg: var(--nuit);
  --fg: var(--creme);
  --fg-2: rgba(240, 225, 191, 0.74);   /* 8,7:1 sur noir */
  --fg-3: rgba(240, 225, 191, 0.62);   /* 6,3:1 sur noir */
  --trait: rgba(240, 225, 191, 0.16);
  --trait-2: rgba(240, 225, 191, 0.3);
  --voile: rgba(240, 225, 191, 0.05);
  --voile-2: rgba(240, 225, 191, 0.1);
  --voile-3: rgba(240, 225, 191, 0.16);

  /* typographie : une didone pour les titres, une grotesque pour le texte */
  --f-titre: "Bodoni Moda", "Bodoni 72", "Didot", "Playfair Display", Georgia, serif;
  --f-texte: "Work Sans", "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* échelle (px) : 13 · 15 · 17 · 20 · 24 · 30 · 40 · 54 · 72 · 96 */
  --t-13: 0.8125rem;
  --t-15: 0.9375rem;
  --t-17: 1.0625rem;
  --t-20: 1.25rem;
  --t-24: 1.5rem;
  --t-30: 1.875rem;
  --t-40: 2.5rem;
  --t-54: 3.375rem;

  --gouttiere-g: max(16px, env(safe-area-inset-left, 0px));
  --gouttiere-d: max(16px, env(safe-area-inset-right, 0px));
  --entete: 64px;
  --duree: 180ms;
  --courbe: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Le monde est la nuit : on redit les mêmes valeurs pour les deux réglages
   explicites, afin qu'aucun thème clair hérité ne vienne blanchir la salle. */
:root[data-theme="light"],
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --fg: #F0E1BF;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

p, li, dd { text-wrap: pretty; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-texte);
  font-size: var(--t-17);
  line-height: 1.6;
  font-weight: 400;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--creme);
  outline-offset: 3px;
  border-radius: 2px;
}

.sr {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.wrap {
  padding-left: var(--gouttiere-g);
  padding-right: var(--gouttiere-d);
  max-width: 1440px;
  margin-inline: auto;
}

/* --------------------------------------------------------------------------
   En-tête
   -------------------------------------------------------------------------- */
.entete {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 30;
  height: var(--entete);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-left: var(--gouttiere-g);
  padding-right: var(--gouttiere-d);
  background: var(--nuit);
  border-bottom: 1px solid var(--trait);
  transition: background-color var(--duree) ease, border-color var(--duree) ease;
}
body[data-vue="plateau"]:not(.defile) .entete {
  background: transparent;
  border-color: transparent;
}

.marque {
  font-family: var(--f-titre);
  font-style: italic;
  font-weight: 500;
  font-size: var(--t-20);
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: var(--t-15);
  color: var(--fg-2);
  text-decoration: none;
  border-radius: 999px;
  transition: color var(--duree) ease, background-color var(--duree) ease;
  white-space: nowrap;
}
.nav a:hover { color: var(--fg); background: var(--voile-2); }
.nav a[aria-current="page"] { color: var(--fg); }
.nav a[aria-current="page"]::after {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--creme);
}
.nav svg { width: 20px; height: 20px; flex: none; }
@media (max-width: 520px) {
  .nav .nav-plateau { display: none; }
}

/* --------------------------------------------------------------------------
   Vues : une seule à l'écran, comme un plateau qui change de décor
   -------------------------------------------------------------------------- */
.vue[hidden] { display: none !important; }
.vue { min-height: 100svh; }
.vue:not(.v-plateau) { padding-top: var(--entete); }

/* --------------------------------------------------------------------------
   Boutons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: 500 var(--t-15)/1.2 var(--f-texte);
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--duree) ease, color var(--duree) ease, border-color var(--duree) ease, transform var(--duree) var(--courbe);
}
.btn:active { transform: translateY(1px); }
.btn-plein { background: var(--creme); color: var(--nuit); }
.btn-plein:hover { background: #fff3d9; }
.btn-trait { background: transparent; color: var(--fg); border-color: var(--trait-2); }
.btn-trait:hover { border-color: var(--creme); background: var(--voile); }
.btn[disabled], .btn[aria-disabled="true"] {
  opacity: 0.38;
  cursor: not-allowed;
}
.btn-petit { min-height: 38px; padding: 6px 16px; font-size: var(--t-13); }

/* --------------------------------------------------------------------------
   1. Le plateau (accueil)
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
}
.hero-decor {
  position: absolute;
  left: 0;
  top: var(--entete);
  width: 100%;
  height: calc(100% - var(--entete));
  z-index: -1;
  display: block;
}
.hero-texte {
  position: relative;
  padding-top: clamp(150px, 23vh, 240px);
  padding-bottom: 72px;
  padding-left: max(var(--gouttiere-g), 10vw);
  padding-right: var(--gouttiere-d);
  max-width: min(54vw, 800px);
}
.presente {
  margin: 0 0 14px;
  font-family: var(--f-titre);
  font-style: italic;
  font-size: var(--t-20);
  color: var(--fg-2);
}
.hero-titre {
  margin: 0;
  font-family: var(--f-titre);
  font-weight: 400;
  font-optical-sizing: auto;
  font-size: clamp(3.2rem, 7vw, 7.5rem);
  line-height: 0.9;
  letter-spacing: -0.015em;
}
.hero-titre span { display: block; }
.hero-sous {
  margin: 18px 0 0;
  font-family: var(--f-titre);
  font-style: italic;
  font-size: clamp(1.4rem, 2.3vw, 2.1rem);
  line-height: 1.2;
  color: var(--fg-2);
}
.qr {
  margin: 28px 0 0;
  max-width: 44ch;
  font-size: var(--t-17);
  color: var(--fg-2);
}
.qr p { margin: 0 0 10px; }
.qr b { font-weight: 600; color: var(--fg); }
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

@media (max-aspect-ratio: 11/10), (max-width: 760px) {
  .hero { display: flex; flex-direction: column; }
  .hero-decor {
    position: relative;
    inset: auto;
    height: auto;
    order: 2;
    z-index: 0;
    margin-top: auto;
  }
  .hero-texte {
    max-width: 640px;
    padding-top: calc(var(--entete) + 36px);
    padding-bottom: 8px;
    padding-left: var(--gouttiere-g);
  }
  .qr { margin-top: 24px; }
}


/* décor du plateau et piano : aplats crème (à diverses opacités = lumière), noir, rouge */
.h-bg, .h-k, .p-k { fill: var(--nuit); }
.h-r, .p-r { fill: var(--rouge); }
.h-c, .p-c { fill: var(--creme); }
.p-c90 { fill: var(--creme); fill-opacity: 0.9; }
.p-c70 { fill: var(--creme); fill-opacity: 0.7; }
.p-c45 { fill: var(--creme); fill-opacity: 0.45; }
.p-c25, .h-c25 { fill: var(--creme); fill-opacity: 0.25; }
.h-c18 { fill: var(--creme); fill-opacity: 0.18; }
.p-c12, .h-c12 { fill: var(--creme); fill-opacity: 0.12; }
.p-c10, .h-c10 { fill: var(--creme); fill-opacity: 0.1; }
.p-c08, .h-c08 { fill: var(--creme); fill-opacity: 0.08; }
.p-c06, .h-c06 { fill: var(--creme); fill-opacity: 0.06; }
.h-c03 { fill: var(--creme); fill-opacity: 0.03; }
.h-c02 { fill: var(--creme); fill-opacity: 0.022; }
.h-cone { fill: var(--creme); fill-opacity: 0.05; }
.h-cone2 { fill: var(--creme); fill-opacity: 0.04; }
.p-sh { fill: var(--nuit); fill-opacity: 0.82; }
.h-plank { fill: none; stroke: var(--creme); stroke-opacity: 0.035; stroke-width: 1.2; }
.p-str { fill: none; stroke: var(--nuit); stroke-opacity: 0.38; stroke-width: 0.28; }
.p-str2 { fill: none; stroke: var(--nuit); stroke-opacity: 0.55; stroke-width: 0.55; }
.p-joint { fill: none; stroke: var(--nuit); stroke-opacity: 0.45; stroke-width: 0.22; }

/* --------------------------------------------------------------------------
   2. La Promenade (rosace)
   -------------------------------------------------------------------------- */
.promenade {
  display: grid;
  grid-template-columns: minmax(0, 23rem) minmax(0, 1fr);
  grid-template-areas: "tete rosace" "cartel rosace";
  grid-template-rows: auto 1fr;
  column-gap: clamp(24px, 4vw, 64px);
  row-gap: 22px;
  align-items: start;
  padding-block: clamp(24px, 6vh, 64px) 48px;
  min-height: calc(100svh - var(--entete));
}
.prom-tete { grid-area: tete; min-width: 0; }
.prom-cartel { grid-area: cartel; min-width: 0; }
.rosace-boite { grid-area: rosace; align-self: center; }
.prom-tete h2 {
  margin: 0 0 14px;
  font-family: var(--f-titre);
  font-weight: 400;
  font-size: clamp(2.4rem, 3.6vw, 3.25rem);
  line-height: 1;
  white-space: nowrap;
}
.prom-intro { margin: 0; color: var(--fg-2); max-width: 40ch; }

.cartel {
  border-top: 1px solid var(--trait-2);
  padding-top: 18px;
  min-height: 14.5rem;
}
.cartel-tete {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 4px;
  color: var(--fg-3);
  font-size: var(--t-15);
}
.cartel-tete i {
  font-family: var(--f-titre);
  font-size: var(--t-20);
  color: var(--fg);
}
.cartel h3 {
  margin: 0 0 8px;
  font-family: var(--f-titre);
  font-weight: 500;
  font-size: var(--t-30);
  line-height: 1.1;
}
.cartel p.cartel-ligne { margin: 0 0 16px; color: var(--fg-2); }
.cartel-pied { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.cartel-pied .etat { margin: 0; }
.etat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--t-15);
  color: var(--fg-2);
}
.etat::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  border: 1px solid var(--fg-2);
}
.etat-ouvert::before { background: var(--creme); border-color: var(--creme); }

.prom-note {
  display: flex;
  gap: 10px;
  margin: 26px 0 0;
  font-size: var(--t-13);
  color: var(--fg-3);
  max-width: 40ch;
}
.pastille {
  flex: none;
  width: 18px; height: 3px;
  margin-top: 0.62em;
  background: var(--rouge);
  border-radius: 2px;
}

.rosace-boite {
  position: relative;
  min-width: 0;
  width: 100%;
  max-height: calc(100svh - var(--entete) - 40px);
  aspect-ratio: 1280 / 820;
}
.ro-faisceau {
  fill: var(--creme);
  fill-opacity: 0.06;
  transition: transform 220ms var(--courbe);
}
.rosace {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.ro-anneau { fill: none; stroke: var(--trait); stroke-width: 1.2; }
.ro-fil { fill: none; stroke: var(--creme); stroke-opacity: 0.2; stroke-width: 1.3; transition: stroke-opacity var(--duree) ease; }
.ro-fil.on { stroke-opacity: 0.85; }
.ro-fil-rouge { fill: none; stroke: var(--rouge); stroke-width: 2.6; stroke-linecap: round; }
.ro-arc-rouge { fill: none; stroke: var(--rouge); stroke-width: 6; stroke-linecap: round; }
.ro-sommet { fill: var(--creme); fill-opacity: 0.55; }
.ro-sommet-rouge { fill: var(--rouge); }
.ro-centre { fill: var(--nuit); }
.ro-centre-trait { fill: none; stroke: var(--trait-2); stroke-width: 1.2; }

.rayon { cursor: pointer; outline: none; }
.rayon .petale {
  fill: var(--creme);
  fill-opacity: 0.075;
  transition: fill-opacity var(--duree) ease;
}
.rayon .marque-rayon {
  color: var(--creme);
  opacity: 0.78;
  transition: opacity var(--duree) ease, transform var(--duree) var(--courbe);
  transform-box: fill-box;
  transform-origin: center;
}
.rayon .note-rayon {
  font-family: var(--f-titre);
  font-style: italic;
  font-size: 23px;
  fill: var(--creme);
  fill-opacity: 0.7;
}
.rayon .titre-rayon {
  font-family: var(--f-texte);
  font-weight: 500;
  font-size: 18.5px;
  fill: var(--creme);
  fill-opacity: 0.66;
  transition: fill-opacity var(--duree) ease;
}
.rayon .num-rayon {
  font-family: var(--f-texte);
  font-size: 14px;
  fill: var(--creme);
  fill-opacity: 0.45;
}
.rayon .anneau-focus { fill: none; stroke: var(--creme); stroke-width: 2.4; opacity: 0; }
.rayon:hover .petale,
.rayon.actif .petale { fill-opacity: 0.17; }
.rayon:hover .marque-rayon,
.rayon.actif .marque-rayon { opacity: 1; transform: scale(1.08); }
.rayon:hover .titre-rayon,
.rayon.actif .titre-rayon { fill-opacity: 1; }
.rayon:focus-visible .anneau-focus { opacity: 1; }
.rayon:focus-visible .petale { fill-opacity: 0.2; }
.rayon.ouvert .petale { fill-opacity: 0.12; }

.ro-centre-note { font-family: var(--f-titre); font-style: italic; font-size: 34px; fill: var(--creme); }
.ro-centre-sous { font-family: var(--f-texte); font-size: 15px; fill: var(--creme); fill-opacity: 0.62; }
.ro-legende { font-family: var(--f-texte); font-size: 14px; fill: var(--creme); fill-opacity: 0.62; }

@media (max-width: 1180px) {
  .rayon .titre-rayon { display: none; }
  .rosace-boite { aspect-ratio: 1 / 1; max-height: none; }
}
@media (max-width: 900px) {
  .promenade {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "tete" "rosace" "cartel";
    grid-template-rows: auto;
    padding-top: 24px;
  }
  .rosace-boite { width: 100%; max-width: 560px; margin-inline: auto; }
  .cartel { min-height: 0; }
}

/* --------------------------------------------------------------------------
   3. Les portes (scènes en répétition, Ateliers, Bibliothèque, Notations)
   -------------------------------------------------------------------------- */
.porte-rideau {
  position: relative;
  height: clamp(250px, 46svh, 470px);
  overflow: hidden;
}
.porte-rideau > svg { display: block; width: 100%; height: 100%; }
.porte-marque {
  position: absolute;
  left: 50%;
  bottom: 7%;
  width: clamp(60px, 9vw, 104px);
  aspect-ratio: 1;
  transform: translateX(-50%);
  color: var(--creme);
}
.porte-marque svg { width: 100%; height: 100%; display: block; }
.porte-cartel {
  max-width: 860px;
  padding-block: 28px 56px;
}
.porte-tete { margin: 0 0 6px; color: var(--fg-3); }
.porte-tete i { font-family: var(--f-titre); font-size: var(--t-20); color: var(--fg); }
.porte-titre {
  margin: 0 0 10px;
  font-family: var(--f-titre);
  font-weight: 400;
  font-size: clamp(2.3rem, 5vw, 4.2rem);
  line-height: 1.02;
}
.porte-ligne { margin: 0 0 28px; font-size: var(--t-20); color: var(--fg-2); max-width: 46ch; }
.porte-etat {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  margin: 0 0 14px;
  color: var(--fg-2);
}
.porte-etat b {
  font-family: var(--f-titre);
  font-style: italic;
  font-weight: 500;
  font-size: var(--t-24);
  color: var(--fg);
}
.porte-corps { max-width: 62ch; }
.porte-corps ul { margin: 0; padding: 0; list-style: none; }
.porte-corps li {
  padding: 12px 0;
  border-top: 1px solid var(--trait);
  color: var(--fg-2);
}
.porte-corps li b { color: var(--fg); font-weight: 500; }
.porte-corps li i { font-family: var(--f-titre); }
.porte-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  margin-top: 40px;
  align-items: stretch;
}
.porte-nav a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--trait);
  border-radius: 14px;
  text-decoration: none;
  transition: border-color var(--duree) ease, background-color var(--duree) ease;
}
.porte-nav a:hover { border-color: var(--trait-2); background: var(--voile); }
.porte-nav small { color: var(--fg-3); font-size: var(--t-13); }
.porte-nav span { font-family: var(--f-titre); font-size: var(--t-17); line-height: 1.25; }
.porte-nav .pn-suiv { text-align: right; }
.porte-nav .pn-centre { justify-content: center; text-align: center; }
@media (max-width: 600px) {
  .porte-nav { grid-template-columns: 1fr 1fr; }
  .porte-nav .pn-centre { grid-column: 1 / -1; order: 3; }
}

/* énoncés : à la manière d'un cours */
.enonce {
  margin: 0 0 18px;
  padding: 0 0 0 18px;
  border-left: 2px solid var(--trait-2);
  font-family: var(--f-titre);
  font-style: italic;
  font-size: var(--t-20);
  line-height: 1.5;
}
.enonce .tete {
  font-family: var(--f-texte);
  font-style: normal;
  font-weight: 600;
  font-size: var(--t-15);
  margin-right: 6px;
}

/* --------------------------------------------------------------------------
   4. Scène 2
   -------------------------------------------------------------------------- */
.scene-tete {
  padding-block: 22px 18px;
}
.scene-tete .porte-tete { margin-bottom: 2px; }
.scene-titre {
  margin: 0 0 8px;
  font-family: var(--f-titre);
  font-weight: 400;
  font-size: clamp(2.3rem, 4.4vw, 3.9rem);
  line-height: 1;
  letter-spacing: -0.01em;
}
.scene-ligne { margin: 0; font-size: var(--t-17); color: var(--fg-2); max-width: 70ch; }

.scene-corps {
  --cote-sim: clamp(400px, calc(100svh - var(--entete) - 384px), 640px);
  display: grid;
  grid-template-columns: minmax(0, var(--cote-sim)) minmax(0, 1fr);
  gap: clamp(20px, 3.4vw, 56px);
  align-items: start;
  padding-bottom: 64px;
}
.plateau {
  position: sticky;
  top: calc(var(--entete) + 12px);
  min-width: 0;
}
.cours { min-width: 0; max-width: 68ch; }

@media (max-width: 1060px) {
  .scene-corps { grid-template-columns: minmax(0, 1fr); }
  .plateau { position: relative; top: auto; max-width: 640px; }
}
@media (max-height: 819px) and (min-width: 1061px) {
  .plateau { position: relative; top: auto; }
}

/* le simulateur */
.sim-boite {
  container-type: inline-size;
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  background: var(--nuit);
  box-shadow: inset 0 0 0 1px var(--trait);
}
.sim { display: block; width: 100%; height: auto; aspect-ratio: 1; touch-action: manipulation; }
.sim-cone { fill: var(--creme); fill-opacity: 0.045; }
.sim-cone2 { fill: var(--creme); fill-opacity: 0.035; }
.sim-flaque1 { fill: var(--creme); fill-opacity: 0.05; }
.sim-flaque2 { fill: var(--creme); fill-opacity: 0.05; }
.sim-flaque3 { fill: var(--creme); fill-opacity: 0.05; }
.sim-lentille { fill: var(--creme); }
.sim-helice { fill: none; stroke: var(--creme); stroke-opacity: 0.17; stroke-width: 1.1; }
.sim-parcours { fill: none; stroke: var(--creme); stroke-opacity: 0.6; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sim-depasse { fill: none; stroke: var(--rouge); stroke-width: 3.4; stroke-linecap: round; }
.sim-chute { stroke: var(--creme); stroke-opacity: 0.22; stroke-width: 1; }
.sim-cercle { fill: none; stroke: var(--creme); stroke-opacity: 0.24; stroke-width: 1.2; }
.sim-cran { stroke: var(--creme); stroke-opacity: 0.32; stroke-width: 1.2; }
.sim-arc { fill: none; stroke-width: 6; stroke-linecap: butt; }
.sim-arc.limma { stroke: var(--creme); stroke-opacity: 0.88; }
.sim-arc.apotome { stroke: var(--creme); stroke-opacity: 0.36; stroke-width: 9; }
.sim-arc.egal { stroke: var(--creme); stroke-opacity: 0.62; }
.sim-arc.autre { stroke: var(--creme); stroke-opacity: 0.14; }
.sim-arc.comma { stroke: var(--rouge); stroke-width: 9; }
.sim-pt { fill: var(--creme); cursor: pointer; }
.sim-pt.recent { fill: var(--creme); }
.sim-pt.rouge, .sim-ombre.rouge { fill: var(--rouge); }
.sim-halo { fill: var(--creme); fill-opacity: 0.16; pointer-events: none; }
.sim-ombre { fill: var(--creme); cursor: pointer; }
.sim-et { font: 500 13px var(--f-texte); fill: var(--creme); fill-opacity: 0.86; pointer-events: none; }
.sim-et.faible { fill-opacity: 0.45; font-size: 11px; }
.sim-et-note { font-family: var(--f-titre); font-style: italic; font-size: 16px; fill: var(--creme); pointer-events: none; }
.sim-et-comma { font: 500 13px var(--f-texte); fill: var(--creme); pointer-events: none; }
.sim-legende-coin { font: 400 12px var(--f-texte); fill: var(--creme); fill-opacity: 0.55; }

.sim-levier {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 6px;
}
.sim-levier .sur-scene { width: 38px; min-height: 38px; background: rgba(0, 0, 0, 0.72); }
@container (max-width: 480px) {
  .sim-levier .bascule small { display: none; }
}
.sim-levier .bascule { background: rgba(0, 0, 0, 0.72); min-height: 38px; }
@media (max-width: 460px) {
  .sim-levier { top: 8px; left: 8px; }
  .sim-levier .bascule { padding: 4px 12px 4px 6px; gap: 8px; font-size: var(--t-13); }
  .sim-levier .bascule small { display: none; }
}
.sim-vues {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  box-shadow: inset 0 0 0 1px var(--trait);
}
.sim-vues button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--fg-2);
  font: 500 var(--t-13)/1 var(--f-texte);
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color var(--duree) ease, color var(--duree) ease;
}
.sim-vues button[aria-pressed="true"] { background: var(--creme); color: var(--nuit); }

/* console */
.console {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}
.console-ligne {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}
.compteur {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-right: auto;
  min-width: 0;
}
.console-ligne .btn-plein { flex: 0 1 auto; }
.compteur-n {
  font-family: var(--f-titre);
  font-size: var(--t-40);
  line-height: 0.9;
  font-variant-numeric: lining-nums tabular-nums;
  min-width: 1.2ch;
}
.compteur-sur { color: var(--fg-3); font-size: var(--t-15); line-height: 1.3; }
.btn-icone { width: 46px; padding: 0; }
.btn-icone svg { width: 18px; height: 18px; }
.son .barre { display: none; }
.son[aria-pressed="false"] .ondes { display: none; }
.son[aria-pressed="false"] .barre { display: inline; }

.bascule {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 6px 14px 6px 8px;
  border: 1px solid var(--trait-2);
  border-radius: 999px;
  background: transparent;
  color: var(--fg);
  font: 500 var(--t-15)/1.2 var(--f-texte);
  cursor: pointer;
  transition: border-color var(--duree) ease, background-color var(--duree) ease;
}
.bascule:hover { border-color: var(--creme); }
.bascule .piste {
  position: relative;
  width: 38px; height: 22px;
  border-radius: 999px;
  background: var(--voile-3);
  transition: background-color var(--duree) ease;
  flex: none;
}
.bascule .piste::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--creme);
  transition: transform var(--duree) var(--courbe);
}
.bascule[aria-checked="true"] .piste { background: var(--creme); }
.bascule[aria-checked="true"] .piste::after { background: var(--nuit); transform: translateX(16px); }
.bascule small { color: var(--fg-3); font-weight: 400; font-size: var(--t-13); }

.lecture {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 22px;
  margin: 0 0 10px;
  padding: 0 2px;
  min-height: 2.6rem;
}
.lecture div { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.lecture dt { font-size: var(--t-13); color: var(--fg-3); }
.lecture dd {
  margin: 0;
  font-size: var(--t-15);
  font-variant-numeric: tabular-nums lining-nums;
  white-space: nowrap;
}
.lecture dd.note { font-family: var(--f-titre); font-style: italic; font-size: var(--t-24); line-height: 1.1; }
.lecture sup { font-size: 0.7em; }
.lecture div:first-child dt, .lecture dt.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (max-width: 460px) {
  .lecture { gap: 2px 14px; }
}

.ecart {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  gap: 8px 20px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--voile);
  box-shadow: inset 0 0 0 1px var(--trait);
}
.ecart-val {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--f-titre);
  font-size: var(--t-24);
  line-height: 1.1;
  font-variant-numeric: lining-nums;
  white-space: nowrap;
}
.ecart-val .pastille { width: 22px; height: 6px; margin: 0; align-self: center; }
.ecart-val .signe { font-family: var(--f-texte); font-weight: 300; font-size: 0.78em; margin-right: 1px; }
.ecart-val.ferme .pastille { background: var(--creme); }
.ecart-texte { margin: 0; font-size: var(--t-15); line-height: 1.5; color: var(--fg-2); min-width: 0; }
.ecart-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.battements { flex: 1 1 220px; min-width: 0; height: 46px; display: block; }
.batt-env { fill: var(--creme); fill-opacity: 0.32; }
.batt-axe { stroke: var(--trait-2); stroke-width: 1; }
.batt-tete { stroke: var(--creme); stroke-width: 2; }
@media (max-width: 520px) {
  .ecart { grid-template-columns: minmax(0, 1fr); }
}

.demitons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  min-height: 1.5em;
  margin: 10px 2px 0;
  padding: 0;
  list-style: none;
  font-size: var(--t-13);
  color: var(--fg-2);
}
.demitons li { display: inline-flex; align-items: center; gap: 8px; }
.demitons li[hidden] { display: none; }
.dt-swatch { width: 22px; height: 6px; border-radius: 1px; background: var(--creme); }
.dt-swatch.limma { opacity: 0.88; }
.dt-swatch.apotome { opacity: 0.36; height: 9px; }
.dt-swatch.egal { opacity: 0.62; }
.dt-swatch.autre { opacity: 0.14; }
.dt-swatch.comma { background: var(--rouge); height: 9px; }

/* les trois couches */
.couche {
  border-top: 1px solid var(--trait-2);
}
.couche:last-of-type { border-bottom: 1px solid var(--trait-2); }
.couche > summary {
  list-style: none;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  cursor: pointer;
}
.couche > summary::-webkit-details-marker { display: none; }
.couche-titre {
  font-family: var(--f-titre);
  font-size: var(--t-30);
  line-height: 1.05;
}
.couche-sous { display: block; font-family: var(--f-texte); font-size: var(--t-13); color: var(--fg-3); margin-top: 2px; }
.couche-icone { width: 44px; height: 44px; color: var(--creme); }
.couche-chevron {
  width: 28px; height: 28px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--trait-2);
  position: relative;
  transition: transform var(--duree) var(--courbe), background-color var(--duree) ease;
}
.couche-chevron::before,
.couche-chevron::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 10px; height: 1.5px;
  background: var(--creme);
  transform: translate(-50%, -50%);
}
.couche-chevron::after { transform: translate(-50%, -50%) rotate(90deg); transition: transform var(--duree) var(--courbe); }
.couche[open] .couche-chevron::after { transform: translate(-50%, -50%) rotate(0deg); }
.couche > summary:hover .couche-chevron { background: var(--voile-2); }
.couche-corps { padding: 2px 0 26px; }
.couche-corps > *:first-child { margin-top: 0; }

/* environnements de cours */
.env { margin: 0 0 18px; }
.env p { margin: 0 0 10px; }
.env-tete { font-weight: 600; }
.env-nom { font-family: var(--f-titre); font-style: italic; font-weight: 500; color: var(--fg-2); }
.env.def p, .env.rem p { color: var(--fg-2); }
.env.def .env-tete, .env.rem .env-tete { color: var(--fg); }
.env.prop {
  padding: 14px 0 14px 18px;
  border-left: 2px solid var(--creme);
}
.env.prop .corps-italique {
  font-family: var(--f-titre);
  font-style: italic;
  font-size: var(--t-20);
  line-height: 1.5;
}
.env.prop.rouge { border-left-color: var(--rouge); }
.demo { color: var(--fg-2); }
.demo .demo-tete { font-style: italic; color: var(--fg); }
.cqfd {
  display: inline-block;
  width: 0.62em; height: 0.62em;
  margin-left: 6px;
  background: var(--creme);
  vertical-align: -0.04em;
}

.blague {
  margin: 22px 0 6px;
  padding: 18px 0 4px;
  border-top: 1px solid var(--trait);
}
.blague-titre { margin: 0 0 10px; font-family: var(--f-titre); font-style: italic; font-size: var(--t-24); }
.blague-nombres {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 18px;
  align-items: baseline;
  margin: 0 0 12px;
  font-variant-numeric: lining-nums tabular-nums;
}
.blague-nombres dt { font-family: var(--f-titre); font-size: var(--t-24); white-space: nowrap; }
.blague-nombres dt sup { font-size: 0.6em; }
.blague-nombres dd {
  margin: 0;
  font-family: var(--f-titre);
  font-size: clamp(1.9rem, 3.6vw, 2.6rem);
  line-height: 1.15;
  white-space: nowrap;
}
.blague-nombres dd .diff { color: var(--fg-3); }
.blague p { color: var(--fg-2); margin: 0; }

.protocole { margin: 0 0 20px; padding: 0; list-style: none; counter-reset: pas; }
.protocole li {
  counter-increment: pas;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--trait);
  color: var(--fg-2);
}
.protocole li::before {
  content: counter(pas);
  font-family: var(--f-titre);
  font-size: var(--t-24);
  line-height: 1.1;
  color: var(--fg);
}
.protocole b { color: var(--fg); font-weight: 500; }

.reglages { display: grid; gap: 14px; margin: 0 0 22px; }
.reglage { display: grid; gap: 6px; }
.reglage > span { font-size: var(--t-13); color: var(--fg-3); }
.choix { display: flex; flex-wrap: wrap; gap: 6px; }
.choix button {
  appearance: none;
  border: 1px solid var(--trait-2);
  background: transparent;
  color: var(--fg-2);
  font: 500 var(--t-13)/1.2 var(--f-texte);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color var(--duree) ease, color var(--duree) ease, border-color var(--duree) ease;
}
.choix button:hover { border-color: var(--creme); color: var(--fg); }
.choix button[aria-pressed="true"] { background: var(--creme); color: var(--nuit); border-color: var(--creme); }

.formules { margin: 0 0 6px; padding: 14px 16px; border-radius: 14px; background: var(--voile); box-shadow: inset 0 0 0 1px var(--trait); }
.formules p { margin: 0 0 8px; font-size: var(--t-13); color: var(--fg-3); }
.tex { color: var(--fg); }
.tex-bloc {
  display: block;
  margin: 10px 0 14px;
  overflow-x: auto;
  overflow-y: hidden;
  font-family: var(--f-titre);
  font-size: var(--t-20);
  line-height: 1.4;
  -webkit-overflow-scrolling: touch;
}
.tex-bloc mjx-container { margin: 0 !important; }
.tex mjx-container[jax="SVG"] { color: var(--creme); }
.tex-bloc mjx-container svg { max-width: none; }
.formules p.tex-legende { margin: 4px 0 0; }

.convergents {
  width: 100%;
  border-collapse: collapse;
  margin: 6px 0 12px;
  font-variant-numeric: tabular-nums lining-nums;
  font-size: var(--t-15);
}
.convergents th {
  text-align: left;
  font-weight: 400;
  font-size: var(--t-13);
  color: var(--fg-3);
  padding: 6px 8px 6px 0;
  border-bottom: 1px solid var(--trait-2);
}
.convergents td { padding: 4px 8px 4px 0; border-bottom: 1px solid var(--trait); }
.convergents td.frac { font-family: var(--f-titre); font-size: var(--t-20); }
.convergents td.num { text-align: right; white-space: nowrap; }
.convergents th.num { text-align: right; }
.convergents tr.fort td { color: var(--fg); }
.convergents tr:not(.fort) td { color: var(--fg-2); }
.convergents button {
  appearance: none;
  border: 1px solid var(--trait-2);
  background: transparent;
  color: var(--fg);
  font: 500 var(--t-13)/1 var(--f-texte);
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.convergents button:hover { border-color: var(--creme); }
.convergents button[aria-pressed="true"] { background: var(--creme); color: var(--nuit); }
.table-defile { overflow-x: auto; }

.tiroir {
  margin-top: 22px;
  padding: 16px 18px;
  border-radius: 16px;
  box-shadow: inset 0 0 0 1px var(--trait-2);
}
.tiroir h4 { margin: 0 0 8px; font-family: var(--f-titre); font-style: italic; font-weight: 500; font-size: var(--t-20); }
.tiroir p { margin: 0 0 8px; color: var(--fg-2); font-size: var(--t-15); }

.m-rouge { fill: var(--rouge); }
.icone-spirale { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

/* --------------------------------------------------------------------------
   Pied de page : la fiche de la variante
   -------------------------------------------------------------------------- */
.pied {
  border-top: 1px solid var(--trait);
  padding-block: 18px 28px;
  font-size: var(--t-13);
  color: var(--fg-3);
}
.fiche > summary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  padding: 6px 0;
  color: var(--fg-2);
}
.fiche > summary::-webkit-details-marker { display: none; }
.fiche > summary::before {
  content: "";
  width: 9px; height: 9px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--duree) var(--courbe);
}
.fiche[open] > summary::before { transform: rotate(45deg); }
.fiche dl {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 10px 28px;
  margin: 14px 0 6px;
}
.fiche dl div { min-width: 0; border-top: 1px solid var(--trait); padding-top: 8px; }
.fiche dt { color: var(--fg); font-weight: 500; }
.fiche dd { margin: 2px 0 0; color: var(--fg-2); }
.pied-ligne { margin: 10px 0 0; }

/* --------------------------------------------------------------------------
   Entrée en scène : la douche s'ouvre (courte), rien d'autre
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
