@charset "UTF-8";

/* Fraunces (licence SIL Open Font License, fonts/OFL.txt), graisse 500, sous-ensemble latin, servie avec l'application. */
@font-face {
  font-family: Fraunces;
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/fraunces-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --page: #f5f5ed;
  --paper: #fffef9;
  --ink: #253c39;
  --ink-soft: #4d5a4f;
  --muted: #657167;
  --icon: #6c796d;
  --green: #276a5b;
  --green-deep: #205447;
  --green-pale: #eaf0e7;
  --coral: #c57e69;
  --coral-ink: #a65a43; /* corail lisible en texte sur le fond de page (contraste 4,6:1) */
  --transition-paper: #fff;
  --transition-ink: #884736;
  --transition-pale: #f7ebe6;
  --line: #e1e5db;
  --stage: #eeefe5; /* fond de la scène 3D, repris par src/scene.js */
  --range-track: #dde4d3;
  --range-ring: #a6b99b;
  --radius: 22px;
  --stage-height: 660px;
  --font-display: Fraunces, Georgia, serif; /* titres de l'accueil */
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
/* Sur ordinateur, la barre verticale ne décale pas l'en-tête entre les pages courtes et longues. */
@media (min-width: 651px) { html { scrollbar-gutter: stable; } }
body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh; margin: 0; background: var(--page); color: var(--ink); }
button, input, output { font: inherit; }
button { color: inherit; cursor: pointer; }
button, a, input, summary { touch-action: manipulation; }
button { border: 0; }
button:disabled { opacity: .4; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid #a9c776; outline-offset: 4px; }
button, a, input, summary { -webkit-tap-highlight-color: rgba(217, 231, 212, .12); }
[hidden] { display: none !important; }
p, h1 { margin: 0; }
button { transition: background-color .16s, color .16s, box-shadow .16s; }
.icon-definitions { position: absolute; height: 0; width: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
/* Le bloc du titre renvoie à l'accueil ; les accès aux modes sont à droite, dans le flux. Le corps de page commence sous le trait de l'en-tête, avec le même écart sur tous les écrans. */
.workspace { flex: 1; width: 100%; max-width: 1600px; margin: 0 auto; padding: 32px 48px; }
/* Scène affichée : la zone de travail a au moins la hauteur de la fenêtre, pour que la page puisse toujours défiler
   jusqu'à elle au passage d'un mode à l'autre depuis la scène, même quand son contenu est court. */
.workspace:has(.lesson-layout:not([hidden]) > .stage-card:not([hidden])) { min-height: 100vh; }
.lesson-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.app-header { width: 100%; max-width: 1600px; margin: 0 auto; flex-wrap: wrap; gap: 0; border-bottom: 1px solid var(--line); }
/* Seuls le logo, le titre et le sous-titre sont cliquables : l'espace autour est une marge, hors du lien. */
.app-home-link { display: flex; flex: 0 1 auto; align-items: center; gap: 14px; margin: 28px 48px; color: inherit; text-decoration: none; }
/* Le couple au trait (#art-couple) : des formes pleines, épaissies d'un contour fixe qui les garde lisibles en petit. */
#art-couple path { stroke-width: 1px; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.couple-leader { fill: var(--green); stroke: var(--green); }
.couple-follower { fill: var(--coral); stroke: var(--coral); }
/* Logo : le couple, de la hauteur du titre et du sous-titre. */
.app-logo { flex: none; width: auto; height: 68px; }
.app-title-block { min-width: 0; }
.mode-selector { --mode-gap: 6px; display: flex; align-items: center; gap: var(--mode-gap); margin: 0 48px 0 auto; padding: 4px; border-radius: 14px; background: var(--stage); }
.mode-selector button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 44px; min-height: 44px; padding: 8px 12px; border-radius: 10px; background: transparent; color: var(--icon); font-size: 14px; font-weight: 600; }
.mode-selector .icon { width: 18px; height: 18px; }
.mode-selector button[aria-pressed="true"] { background: var(--green); color: white; }
.mode-selector button[aria-pressed="false"] span { display: none; }
/* Un trait vertical, au milieu de l'écart, sépare les deux tuiles. */
.mode-selector button + button { position: relative; }
.mode-selector button + button::before { content: ""; position: absolute; top: 25%; bottom: 25%; left: calc(var(--mode-gap) / -2 - .5px); width: 1px; background: #c3cbbb; }
.app-home-link:hover h1 { color: var(--green); }
.app-footer { display: flex; justify-content: space-between; align-items: center; gap: 24px; width: 100%; max-width: 1600px; margin: 0 auto; padding: 20px 48px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 13px; line-height: 1.6; }
.site-credit { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 8px; color: inherit; text-decoration: none; }
.site-credit:hover { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
.credit-logo { flex: 0 0 auto; }
/* « À propos » à gauche, « Comment ça marche ? » au milieu, avant le crédit ; cible tactile de 44 px. */
.footer-link { display: inline-flex; flex: 0 0 auto; align-items: center; min-height: 44px; color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.footer-link:hover { color: var(--green); }
.eyebrow { font-size: 12px; font-weight: 700; line-height: 1.5; letter-spacing: 1.5px; text-transform: uppercase; color: var(--green); }
h1 { font-size: clamp(34px, 3.1vw, 46px); font-weight: 600; line-height: 1.25; letter-spacing: -1.8px; }
.lesson-heading .eyebrow { margin-top: 2px; }
/* Accueil : présentation de l'application, invitation, choix centrés, puis présentation du mode choisi et son lancement, dans une même carte. */
/* « À propos » : une colonne de lecture, sections séparées par un filet. */
.about-page { display: flex; flex-direction: column; gap: 40px; width: 100%; min-width: 0; max-width: 760px; margin: 0 auto 32px; font-size: 16px; line-height: 1.6; }
.about-page :is(h2, h3) { margin: 0; font-weight: 600; }
.about-page h2 { font-size: clamp(30px, 3vw, 40px); line-height: 1.2; letter-spacing: -1px; }
.about-page h2:focus { outline: none; }
.about-page h2:focus-visible { outline: 3px solid #a9c776; outline-offset: 4px; }
.about-page h3 { font-size: clamp(22px, 2vw, 26px); line-height: 1.25; letter-spacing: -.5px; }
.about-page p { margin: 0; }
.about-status { color: var(--ink-soft); font-size: 15px; text-align: center; }
.about-section { display: flex; flex-direction: column; gap: 12px; padding-top: 28px; border-top: 1px solid var(--line); }
/* Remerciements : un hommage centré, dans la police des titres de l'accueil ; un filet court sépare la phrase des noms. */
.about-thanks { align-items: center; text-align: center; }
.about-page .about-thanks-text { max-width: 32ch; font-family: var(--font-display); font-size: clamp(21px, 2.4vw, 25px); font-weight: 500; line-height: 1.45; }
.about-nowrap { white-space: nowrap; }
.about-smiley { display: inline-block; width: 1.05em; height: 1.05em; vertical-align: -.17em; }
.about-names { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 6px 0 0; padding: 0; list-style: none; font-family: var(--font-display); font-size: clamp(24px, 2.8vw, 30px); font-weight: 500; line-height: 1.3; color: var(--green); }
.about-names::before { content: ""; width: 48px; margin-bottom: 12px; border-top: 1px solid var(--line); }
.about-features { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.about-features dt { margin-top: 10px; color: var(--green); font-weight: 700; }
.about-features dd { margin: 0; }
.home-page { position: relative; max-width: 780px; margin: 0 auto 40px; }
.home-page > * { position: relative; }
/* L'accueil coupe ce qui dépasse, sans défilement horizontal. */
.home-screen .workspace { overflow-x: clip; }
.home-page h2 { margin: 0; font-family: var(--font-display); font-size: 32px; font-weight: 500; line-height: 1.2; letter-spacing: -.6px; text-align: center; }
/* Présentation en deux colonnes : le texte aligné à gauche, puis le couple au trait, sans fond, qui se fond dans la page.
   Les deux questions, en italique, une par ligne, sont marquées d'un filet corail, comme une citation.
   La césure, en français d'après la langue de la page, s'applique aux paragraphes ; le titre n'est pas coupé. */
.home-intro { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: center; gap: 40px; margin: 0 0 48px; font-size: 17px; line-height: 1.6; }
.home-intro p { margin: 14px 0 0; color: var(--ink-soft); hyphens: auto; }
.home-page #home-intro-title { font-size: clamp(40px, 4.4vw, 54px); line-height: 1.05; letter-spacing: -1.4px; text-align: left; }
#home-intro-title span { display: block; color: var(--green); }
.home-intro h2 + p { margin-top: 24px; }
.home-couple { justify-self: center; width: auto; max-width: 100%; height: 400px; }
.home-questions { padding-left: 16px; border-left: 2px solid var(--coral); font-style: italic; }
.home-questions span { display: block; }
#home-title:focus { outline: none; }
/* Une tuile par mode, icône seule ; une rangée accueille quatre modes, même sur téléphone. */
/* Le choix du mode ouvre la carte, sur toute sa largeur, séparé de la présentation par un trait. */
.home-mode-choice { grid-column: 1 / -1; padding: 20px 0 22px; border-bottom: 1px solid var(--line); margin-right: -22px; }
.home-modes { display: flex; justify-content: center; gap: 14px; margin: 18px 0 0; }
.home-modes button { display: grid; place-items: center; width: 76px; height: 76px; border: 1px solid var(--line); border-radius: 22px; background: var(--paper); color: var(--icon); box-shadow: 0 1px 2px #253c390d; transition: background-color .18s, color .18s, border-color .18s, box-shadow .18s, transform .18s; }
.home-modes .icon { width: 32px; height: 32px; stroke-width: 1.5; }
.home-modes button[aria-pressed="true"] { border-color: var(--green); background: var(--green); color: white; box-shadow: 0 12px 24px -14px #205447e6; }
.home-mode-card { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: center; gap: 14px 36px; padding: 14px 36px 14px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: 0 24px 48px -36px #253c3973; }
/* La carte suit la largeur de son texte, borné à 34 caractères, sans marge vide à droite. */
.home-mode-card { max-width: 780px; margin: 0 auto; }
.mode-art { aspect-ratio: 16 / 11; border-radius: 14px; background: var(--stage); overflow: hidden; }
.mode-art svg { display: block; width: 100%; height: 100%; }
/* Aperçu de la vraie scène, sur toute l'illustration, à la place du dessin. C'est une illustration : elle ne reçoit
   pas le pointeur. Figures : les pastilles des temps, celle du temps en cours allumée. Séquence : le nom de la figure dansée. */
.mode-art { position: relative; }
.mode-art.has-preview > svg { visibility: hidden; }
.mode-preview { position: absolute; inset: 0; pointer-events: none; }
.preview-stage { position: absolute; inset: 0; }
.preview-stage canvas { display: block; width: 100%; height: 100%; }
.preview-label, .preview-speed, .preview-beats { position: absolute; margin: 0; border-radius: 999px; background: #fffef9e6; color: var(--ink); font-size: 13px; font-weight: 600; line-height: 1.2; white-space: nowrap; }
.preview-label { left: 12px; top: 12px; display: flex; align-items: center; gap: 3px; padding: 5px 12px; }
.preview-label .icon { width: 14px; height: 14px; color: var(--coral-ink); stroke-width: 2; }
.preview-next { color: var(--ink-soft); font-weight: 500; }
[data-preview="library"] .preview-label :is(.icon, .preview-next) { display: none; }
/* Séquence : la figure dansée sur une ligne, le chevron et la figure suivante sur la seconde, sans masquer les têtes. */
[data-preview="cinematic"] .preview-label { display: grid; grid-template-columns: auto 1fr; gap: 2px 3px; padding: 6px 12px 7px; border-radius: 12px; }
[data-preview="cinematic"] .preview-label > :first-child { grid-column: 1 / -1; }
[data-preview="cinematic"] .preview-label .icon { margin-left: -3px; }
.preview-speed { right: 12px; top: 12px; padding: 5px 12px; color: var(--green); }
/* Les temps sur deux rangées, 1 2 3 puis 4 5 6 : le bandeau reste étroit, loin des pieds des danseurs. */
.preview-beats { left: 12px; bottom: 16px; display: grid; grid-template-columns: repeat(3, auto); gap: 3px 4px; padding: 4px; border-radius: 16px; }
.preview-beats span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: var(--ink-soft); font-size: 12px; }
.preview-beats .is-on { background: var(--green); color: white; }
.preview-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: #253c391a; }
.preview-progress span { display: block; height: 100%; background: var(--green); transform-origin: left; }
[data-preview="cinematic"] :is(.preview-beats, .preview-speed, .preview-progress) { display: none; }
.mode-text { display: flex; flex-direction: column; align-items: flex-start; gap: 28px; }
/* Les présentations de tous les modes occupent la même case ; seule celle du mode choisi est visible,
   les autres réservent la place de la plus longue, et « Ouvrir » ne bouge pas d'un mode à l'autre. */
.mode-presentations { display: grid; }
.mode-presentations > * { grid-area: 1 / 1; }
.mode-presentation-sizer { visibility: hidden; }
.mode-presentation { display: flex; flex-direction: column; gap: 10px; }
.mode-presentation h3 { margin: 0; font-size: 34px; font-weight: 600; line-height: 1.15; letter-spacing: -1px; }
.mode-presentation p { max-width: 34ch; color: var(--ink-soft); font-size: 17px; line-height: 1.55; }
#launch-mode { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 22px 0 28px; border-radius: 999px; background: var(--green); color: white; font-size: 16px; font-weight: 600; transition: background-color .18s, box-shadow .18s; }
#launch-mode .icon { transition: transform .18s; }
#launch-mode:active { background: var(--green-deep); }
/* Illustrations de l'accueil. */
.mode-art .art-leader { fill: var(--green); }
.mode-art .art-follower { fill: var(--coral); }
.art-floor { fill: #253c3912; }
.art-stage { fill: var(--stage); }
.art-card-back, .art-card-middle, .art-sheet { fill: var(--paper); stroke: #cfd6c8; stroke-width: 1.5; }
.art-card { transform-box: view-box; transform-origin: 160px 205px; }
.art-card-back { transform: rotate(-13deg); }
.art-card-middle { transform: rotate(9deg); }
.art-card-front { transform: rotate(-1.5deg); }
.art-beats circle { fill: #d9ded2; }
.art-beats .art-beat-on { fill: var(--green); }
.art-line { stroke: #e2e6dc; stroke-width: 6; stroke-linecap: round; }
.art-strip { transform-box: view-box; transform-origin: 160px 110px; transform: rotate(-5deg); }
.art-film { fill: #2f4a45; }
.art-holes { fill: url(#art-film-holes); }
#art-film-holes rect { fill: var(--page); opacity: .85; }
.art-frame .art-stage { fill: #f1f2ea; }
.art-trail { fill: none; stroke: var(--coral); stroke-width: 2.5; stroke-dasharray: 2 7; stroke-linecap: round; }
.art-head { fill: var(--coral); stroke: var(--stage); stroke-width: 3; }
/* Entrée de la présentation à chaque nouveau choix. */
.is-entering .mode-presentation { animation: home-rise .32s ease-out both; }
.is-entering .art-card-back, .is-entering .art-card-middle { animation: home-fan .55s cubic-bezier(.2, .8, .2, 1) both; }
.is-entering .art-strip { animation: home-roll .6s cubic-bezier(.2, .8, .2, 1) both; }
.is-entering .art-frame { animation: home-fade .4s ease-out both; animation-delay: calc(.12s + var(--frame) * .07s); }
.is-entering .art-trail { animation: home-trail .9s ease-out both; }
@keyframes home-rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes home-fade { from { opacity: 0; } }
@keyframes home-fan { from { transform: rotate(-1.5deg); } }
@keyframes home-roll { from { opacity: 0; transform: translateX(28px) rotate(-5deg); } }
@keyframes home-trail { from { stroke-dashoffset: 60; opacity: 0; } }
/* Une colonne. Figures : le bandeau, puis la Liste ; page Figure : le bandeau, la scène, les détails, puis la fiche.
   Cinématique : la scène, puis la séquence. */
.lesson-layout { --row-gap: 22px; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "bar" "library"; row-gap: var(--row-gap); align-items: stretch; }
/* La grille suit la scène dès qu'elle est visible : le cadrage de la caméra se calcule à la taille définitive de la scène. */
.lesson-layout:has(> .stage-card:not([hidden])) { grid-template-areas: "bar" "stage" "details"; }
.lesson-layout:has(> .stage-card:not([hidden])):has(> .figure-sheet:not([hidden])) { grid-template-areas: "bar" "stage" "details" "sheet"; }
.lesson-layout:has(> .stage-card:not([hidden])) > .library-panel { display: none; }
/* Le bandeau, celui de la Carte, coiffe la carte qui le suit : la Liste, ou la scène. Son titre tient sur une ligne. */
.reader-bar { grid-area: bar; margin-bottom: calc(-1 * var(--row-gap)); border: 1px solid var(--green); border-radius: var(--radius) var(--radius) 0 0; }
/* Le bandeau du lecteur tient sur une rangée : un titre trop long réduit sa police, la remontée reste à sa droite. */
.explorer-bar.reader-bar { flex-wrap: nowrap; }
.reader-bar .tree-title { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; }
.reader-bar .tree-overview { flex: none; }
.lesson-layout > :is(.library-panel, .stage-card) { border-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
/* La carte des détails, ou de la séquence, est rattachée à la scène : dessous, sans écart, elles partagent un trait.
   Seule la description détaillée reste une carte à part. */
.lesson-layout > .stage-card { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.lesson-layout > .figure-details { margin-top: calc(-1 * var(--row-gap)); border-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
/* Sur grand écran, elle passe à gauche de la scène, sous le même bandeau, à la hauteur de la scène, qu'elle ne dépasse
   pas : son contenu défile au besoin. */
@media (min-width: 1100px) {
  /* Les détails prennent 3/8 de la largeur, au moins 340 px : la scène garde le couple au centre sans grand vide autour. */
  .lesson-layout:has(> .stage-card:not([hidden])) { grid-template-columns: minmax(340px, 3fr) minmax(0, 5fr); grid-template-areas: "bar bar" "details stage"; }
  .lesson-layout:has(> .stage-card:not([hidden])):has(> .figure-sheet:not([hidden])) { grid-template-areas: "bar bar" "details stage" "sheet sheet"; }
  .lesson-layout > .stage-card { border-bottom-right-radius: var(--radius); }
  .lesson-layout > .figure-details { margin-top: 0; height: calc(var(--stage-height) + 2px); overflow-y: auto; border-top: 0; border-right: 0; border-radius: 0 0 0 var(--radius); }
}
.library-panel { grid-area: library; align-self: start; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); overflow: hidden; }
.library-navigation { padding: 24px; }
.figure-category + .figure-category { margin-top: 26px; }
.library-loading { margin-top: 16px; color: var(--ink-soft); font-size: 14px; line-height: 1.5; }
[aria-busy="true"] { cursor: progress; }
/* La commande dont la figure se charge porte une petite roue, visible même quand un panneau couvre le message d’attente. */
button[aria-busy="true"]::after { content: ""; display: inline-block; flex: none; width: 14px; height: 14px; margin-left: 8px; vertical-align: -2px; box-sizing: border-box; border: 2px solid color-mix(in srgb, currentColor 30%, transparent); border-top-color: currentColor; border-radius: 50%; animation: spin 1.1s linear infinite; }
/* Sur le bouton cinéma, à la largeur fixe, la roue se pose en pastille dans son coin. */
.start-cinematic-button[aria-busy="true"] { position: relative; }
.start-cinematic-button[aria-busy="true"]::after { position: absolute; top: 3px; right: 3px; width: 12px; height: 12px; margin: 0; }
.figure-category h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; color: var(--ink-soft); }
/* Liste : une grille de fiches, comme les cartes de la Carte ; une transition y est corail. */
.figure-category ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; list-style: none; padding: 0; margin: 0; }
.figure-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; height: 100%; padding: 14px 16px; border: 1px solid var(--green); border-radius: 12px; background: var(--paper); text-align: left; }
.figure-card-name { color: var(--green-deep); font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.figure-card-meta { color: var(--muted); font-size: 13px; }
.figure-card.transition { border-color: var(--coral); }
.figure-card.transition :is(.figure-card-name, .figure-card-meta) { color: var(--transition-ink); }
/* Chevron des variantes d'une figure qui en a : une pastille à cheval sur le haut de la fiche, à droite, dans une cible
   de 44 px, comme sur la Carte. Une rangée de fiches qui en porte un s'écarte de la précédente pour lui laisser sa place. */
.figure-category li { position: relative; }
.figure-category ul:has(.has-variants) { row-gap: 22px; }
.figure-category li.has-variants .figure-card { padding-right: 56px; }
.variants-toggle { position: absolute; right: 8px; top: -22px; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; background: transparent; color: var(--green); }
.variants-toggle > span { display: grid; place-items: center; width: 36px; height: 26px; border: 1px solid var(--green); border-radius: 13px; background: var(--paper); }
.variants-toggle .icon { width: 16px; height: 16px; stroke-width: 2; }
.variants-toggle:hover > span, .variants-toggle[aria-expanded="true"] > span { background: var(--green-pale); }
/* Panneau des variantes, posé sous son chevron, en Liste comme en Carte. */
.variant-menu { position: absolute; z-index: 20; min-width: 200px; max-width: min(320px, calc(100vw - 16px)); padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: 0 6px 22px #253c3920; }
.variant-menu-title { margin: 0 0 8px; color: var(--ink-soft); font-size: 13px; font-weight: 600; }
.variant-menu ul { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin: 0; padding: 0; list-style: none; }
.variant-menu .graph-figure { width: 100%; justify-content: space-between; min-height: 44px; }
/* Triangle des boutons qui changent de mode, à droite de leur icône. */
.mode-change-mark { width: 7px; height: 10px; margin-left: 3px; fill: currentColor; stroke: none; flex: 0 0 auto; }
.figure-details-link { display: none; justify-content: center; width: 44px; min-height: 44px; padding: 0; border: 1px solid #c9d2c2; border-radius: 10px; background: transparent; color: var(--green); font-size: 13px; white-space: nowrap; }
.cinematic-mode .figure-details-link { display: inline-flex; align-items: center; }
/* En Séquence, les suites de la figure dansée suivent son nom dans la carte des détails, comme les relations de la page
   Figure, en colonne. */
.figure-details > .next-figures { margin-top: 20px; }
/* Page Figure : en bas à droite des détails, le bouton de la description détaillée ; son chevron se retourne quand elle
   est affichée. */
.detailed-row { display: flex; justify-content: flex-end; flex: none; margin-top: auto; padding-top: 20px; }
.detailed-row[hidden] { display: none; }
.toggle-detailed { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 10px 0 14px; border: 1px solid #c9d2c2; border-radius: 10px; background: transparent; color: var(--green); font-size: 14px; font-weight: 600; }
.toggle-detailed .icon { width: 18px; height: 18px; transition: transform .2s ease; }
.toggle-detailed[aria-expanded="true"] .icon { transform: rotate(180deg); }
.toggle-detailed:hover { color: var(--ink); background: var(--green-pale); }
.next-figures ul { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; list-style: none; padding: 0; margin: 0; }
/* Pastille d'une suite en Séquence : verte pour une figure, corail pour
   une transition, comme dans la Carte et la séquence. Une suite choisie à la main prend un fond plein,
   comme la carte sélectionnée de la Carte ; celle que l'enchaînement automatique prendra porte la lumière tournante
   du bouton d'enchaînement. */
.figure-pill { position: relative; display: inline-flex; align-items: center; gap: 6px; min-width: 0; min-height: 44px; padding: 8px 12px; border: 1px solid var(--green); border-radius: 10px; background: var(--paper); color: var(--green); text-align: left; font-size: 15px; overflow-wrap: anywhere; }
.figure-pill.transition { border-color: var(--coral); color: var(--transition-ink); }
.figure-pill.chosen { border-color: var(--green); background: var(--green); color: white; font-weight: 600; }
.figure-pill.transition.chosen { border-color: var(--transition-ink); background: var(--transition-ink); }
.figure-pill.auto::before { content: ""; position: absolute; inset: -1px; padding: 2.5px; border-radius: 11px; pointer-events: none;
  background: conic-gradient(from var(--glow-angle), transparent 0deg 90deg, var(--green) 165deg, #b8e07a 180deg, transparent 180deg 270deg, var(--green) 345deg, #b8e07a 360deg);
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); animation: glow-turn 2s linear infinite; }
.figure-pill.transition.auto::before { background: conic-gradient(from var(--glow-angle), transparent 0deg 90deg, var(--transition-ink) 165deg, #f2b49f 180deg, transparent 180deg 270deg, var(--transition-ink) 345deg, #f2b49f 360deg); }
/* En cinématique, chaque suite garde sa place. À droite du titre, une jauge circulaire, commune aux suites, est pleine à
   l'ouverture de la fenêtre de choix ; comme une aiguille de montre, le bord de son arc part du haut et tourne dans le
   sens horaire, l'arc restant finissant toujours en haut, jusqu'à l'ancrage. Hors de la fenêtre, elle est masquée et
   garde sa place. */
.cinematic-choice { display: flex; width: fit-content; max-width: 100%; }
.next-figures-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.next-figures-head .tree-label { margin: 0; }
.choice-gauge { flex: none; width: 22px; height: 22px; transform: rotate(-90deg); fill: none; stroke-width: 3; }
.choice-gauge-track { stroke: #e3e8dd; }
.choice-gauge-arc { stroke: var(--green); stroke-linecap: round; stroke-dasharray: var(--remaining, 0) 1;
  stroke-dashoffset: calc(var(--remaining, 0) - 1); }
.choice-gauge.gauge-idle { visibility: hidden; }
.playback-controls button:disabled { opacity: .35; cursor: default; }
.cinematic-mode .figure-details > .beat-track { display: none; }
.figure-history { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 4px; list-style: none; padding: 0; margin: 16px 0 0; }
.figure-history li { display: flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; }
.history-arrow { color: var(--muted); }
/* Chaque occurrence est une pastille bordée, verte ou corail selon sa nature ; la courante prend en plus un fond pâle. */
.sequence-occurrence { display: flex; align-items: stretch; min-width: 0; max-width: 100%; border: 1px solid var(--green); border-radius: 10px; color: var(--green); }
.sequence-occurrence.transition { border-color: var(--coral); color: var(--transition-ink); }
.sequence-occurrence.current { background: var(--green-pale); color: var(--green-deep); }
.sequence-occurrence.transition.current { background: var(--transition-pale); color: var(--transition-ink); }
.sequence-occurrence:not(.current):has(> [data-history-index]:hover) { background: var(--green-pale); }
.sequence-occurrence.transition:not(.current):has(> [data-history-index]:hover) { background: var(--transition-pale); }
.figure-history button { min-height: 44px; padding: 8px 10px; border-radius: 9px; background: transparent; color: inherit; text-align: left; overflow-wrap: anywhere; }
.sequence-occurrence.current [data-history-index] { font-weight: 600; }
/* Composition par la fin : « + » en pointillés après la dernière occurrence, × dans la pastille de celle-ci. */
.figure-history .sequence-add, .figure-history .sequence-remove { display: grid; place-items: center; padding: 0; color: var(--muted); }
.figure-history .sequence-add { width: 44px; min-height: 44px; border: 1.5px dashed #b9c6b3; color: var(--green); }
.figure-history .sequence-remove { width: 44px; margin-left: -10px; }
.figure-history .sequence-add[aria-expanded="true"] { border-style: solid; border-color: var(--green); background: var(--green-pale); }
.figure-history .sequence-add-item { margin-left: 4px; }
.sequence-icon { width: 18px; height: 18px; }
.sequence-additions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: 0 5px 18px #253c3920; }
.sequence-additions button { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; min-height: 44px; padding: 7px 12px; border: 1px solid var(--green); border-radius: 10px; background: var(--paper); color: var(--green); text-align: left; font-weight: 600; }
.sequence-additions button.transition { border-color: var(--coral); color: var(--transition-ink); }
.sequence-via { color: var(--muted); font-size: 12px; font-weight: 400; }
.stage-card { grid-area: stage; height: calc(var(--stage-height) + 2px); min-width: 0; display: flex; flex-direction: column; overflow: hidden; border-radius: var(--radius); background: var(--stage); border: 1px solid #dfe4d8; }
/* --scene-frame : taille d'un cadre des commandes du haut, son bouton de 44 px et sa bordure. */
.stage-surface { --available-height: var(--stage-height); --scene-frame: 46px; container-type: inline-size; flex: 1; position: relative; min-height: 0; }
/* La scène occupe toute la carte et ses commandes sont posées dessus. Seules les commandes captent
   le pointeur : ailleurs dans leurs bandes, un glissement tourne encore la caméra. */
.stage-overlay { position: absolute; left: 0; right: 0; z-index: 2; pointer-events: none; }
.stage-overlay :is(button, label) { pointer-events: auto; }
.stage-top { --stage-gutter: 18px; top: 0; z-index: 3; padding: 13px var(--stage-gutter); }
.stage-toolbar { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) min(36%, 280px) minmax(0, 1fr); align-items: start; gap: 10px; }
.stage-bottom { bottom: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px) minmax(0, 1fr); align-items: end; gap: 12px; padding: 0 18px 16px; }
.stage-bottom .player-bar { grid-column: 2; grid-row: 1; }
/* Le bouton cinéma, et le livre qui prend sa place en Séquence, ont la taille des cadres des commandes du haut. */
.stage-bottom .figure-details-link { grid-column: 3; grid-row: 1; justify-self: end; align-self: end; width: var(--scene-frame); min-height: var(--scene-frame); }
.stage-bottom .start-cinematic-button { display: none; grid-column: 3; grid-row: 1; justify-self: end; align-self: end; width: var(--scene-frame); height: var(--scene-frame); padding: 0; border: 1px solid #c9d2c2; }
/* Leurs icônes ont la taille et le trait de celles du haut ; le triangle du changement de mode reste à leur droite. */
.stage-bottom .start-cinematic-button .icon { width: 25px; height: 25px; stroke-width: 1.6; }
.stage-bottom .figure-details-link .icon { width: 27px; height: 27px; stroke-width: 1.5; }
body:not(.cinematic-mode) .stage-bottom .start-cinematic-button { display: inline-flex; }
/* Les cadres posés sur la scène n'ont pas de fond, seulement une bordure arrondie : la scène reste visible. */
/* Chaque bouton remplit son cadre ; ses coins suivent ceux du cadre, à l'intérieur de la bordure. */
.view-selector, .scene-music, .scene-settings { --frame-radius: 12px; border: 1px solid #c9d2c2; border-radius: var(--frame-radius); }
.view-selector { position: relative; display: flex; justify-self: start; }
:is(.view-selector, .scene-music, .scene-settings) > button { border-radius: calc(var(--frame-radius) - 1px); }
.view-selector button { background: transparent; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border-radius: 9px; color: var(--icon); }
.view-selector button[aria-pressed="true"] { background: var(--paper); color: var(--green); box-shadow: 0 2px 5px #33463114, inset 0 0 0 1px #276a5b26; }
.view-selector .icon { width: 30px; height: 30px; stroke-width: 1.8; }
/* Les icônes de la musique et des réglages ont la taille et le trait de celle des vues. */
:is(.scene-music, .scene-settings) > .tool-button { width: 44px; height: 44px; padding: 0; }
.scene-music .tool-button .icon, .scene-settings .tool-button .icon { width: 28px; height: 28px; stroke-width: 1.5; }
/* Les panneaux de la musique et des réglages s'ouvrent sous les commandes de scène : une légende plus haute qu'elles ne
   les déplace pas. */
.scene-actions { position: relative; grid-column: 3; display: flex; flex-direction: column; justify-self: end; align-items: flex-end; gap: 8px; }
.scene-music, .scene-settings { display: flex; }
.scene-popover { position: absolute; z-index: 4; top: calc(100% + 8px); max-width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: 0 5px 18px #253c3920; pointer-events: auto; }
/* Les vues s'ouvrent à gauche de leur bouton, sur la même rangée, sans recouvrir les réglages. */
.view-options { top: -1px; right: calc(100% + 8px); max-width: none; display: flex; gap: 4px; padding: 4px; }
.view-options button { flex: 0 0 44px; }
.tool-button[aria-expanded="true"], #toggle-views[aria-expanded="true"] { background: var(--green-pale); }
.view-axis { stroke: var(--icon); } /* pas l'axe selon lequel regarde la caméra : un simple trait gris */
.view-axis-x { stroke: #bd4845; }
.view-axis-y { stroke: #237c59; }
.view-axis-z { stroke: #386bc6; }
.tool-button { min-height: 44px; min-width: 44px; padding: 9px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border-radius: 10px; color: var(--icon); }
.tool-button .icon { width: 17px; height: 17px; }
#viewport { position: absolute; inset: 0; touch-action: none; cursor: grab; }
#viewport:active { cursor: grabbing; }
#viewport canvas { display: block; width: 100%; height: 100%; outline: none; }
/* La légende est en haut à gauche de la scène. */
.dancer-legend { grid-column: 1; justify-self: start; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.dancer-legend span { display: inline-flex; align-items: center; gap: 7px; color: #6b786e; font-size: 13px; font-weight: 500; }
.dancer-legend i { width: 7px; height: 7px; border-radius: 50%; }
.dancer-legend h3 { margin: 0; color: var(--ink-soft); font-size: 12px; font-weight: 600; }
.dancer-legend :is(.main-line-mark, .transverse-line-mark) { width: 14px; height: 3px; border-radius: 2px; }
.main-line-mark { background: var(--main-line); }
.dancer-legend .body-line-mark { width: 14px; height: 3px; border-radius: 2px; background: linear-gradient(90deg, var(--green) 50%, var(--coral) 50%); }
.dancer-legend .weight-mark { background: var(--weight); }
.dancer-legend .torsion-left-mark { background: var(--torsion-left); }
.dancer-legend .torsion-right-mark { background: var(--torsion-right); }
.transverse-line-mark { background: var(--transverse-line); }
.leader-dot { background: var(--green); }
.follower-dot { background: var(--coral); }
.stage-message { position: absolute; z-index: 3; inset: 0; display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; padding: 30px; text-align: center; color: var(--green); background: var(--stage); font-size: 15px; line-height: 1.6; }
.loading-orbit { width: 32px; height: 32px; border: 2px solid #cbd8c3; border-top-color: var(--green); border-radius: 50%; animation: spin 1.1s linear infinite; }
.error-message { color: #844c3c; background: #f7eee4; }
/* Une lecture de figure laisse les commandes et la navigation accessibles au-dessus du message. */
.stage-message.figure-request { z-index: 1; inset: auto 12px calc(var(--playback-controls-height, 148px) + 12px); width: fit-content; max-width: calc(100% - 24px); margin: 0 auto; flex-direction: row; gap: 10px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 3px 12px #253c3914; pointer-events: none; text-align: left; }
.stage-message.figure-request p { margin: 0; }
.stage-message.figure-request .loading-orbit { flex: none; width: 20px; height: 20px; }
/* Deux cases par ligne, le titre de la section au-dessus. */
.line-options, .dancer-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; margin-top: 16px; }
.line-options-title { grid-column: 1 / -1; margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.checkbox-control { display: flex; align-items: center; gap: 7px; min-height: 34px; font-size: 14px; color: #687860; cursor: pointer; }
.checkbox-control input { width: 17px; height: 17px; margin: 0; accent-color: var(--green); cursor: pointer; }
.figure-details { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); min-width: 0; }
.playback-panel { min-width: 0; }
.player-bar { width: 100%; min-width: 0; padding: 4px 12px 12px; pointer-events: auto; border: 1px solid var(--line); border-radius: 18px; background: rgba(255, 254, 249, .92); }
.figure-details { grid-area: details; min-height: 0; padding: 20px 24px; display: flex; flex-direction: column; }
.repeat-button { position: relative; width: 44px; }
.repeat-button .icon { width: 21px; height: 21px; }
/* Activé, deux traits de lumière parcourent sa bordure en boucle, comme un sort lancé automatiquement ; désactivé,
   il reste gris comme ses voisins. Le dégradé conique tourne avec son angle de départ ; le masque n'en garde que le bord. */
@property --glow-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes glow-turn { to { --glow-angle: 360deg; } }
.repeat-button[aria-pressed="true"] { color: var(--green-deep); background: var(--green-pale); }
.repeat-button[aria-pressed="true"]::before { content: ""; position: absolute; inset: 0; padding: 2.5px; border-radius: inherit; pointer-events: none;
  background: conic-gradient(from var(--glow-angle), transparent 0deg 90deg, var(--green) 165deg, #b8e07a 180deg, transparent 180deg 270deg, var(--green) 345deg, #b8e07a 360deg);
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); animation: glow-turn 2s linear infinite; }
h2 { margin: 0; }
/* Titre d'une carte, nettement au-dessus des titres de sections, verts et plus petits. */
.details-title { font-size: 22px; font-weight: 700; line-height: 1.3; }
/* En Séquence, « Réinitialiser » est à droite du titre, à l'écart des commandes du lecteur. */
.details-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.reset-sequence { flex: none; min-height: 44px; margin: -8px -8px -8px 0; padding: 0 12px; border-radius: 10px; background: transparent; color: var(--green); font-size: 14px; font-weight: 600; }
/* Figure en cours : sous la chaîne, séparée par un trait fin. */
.player-main { display: flex; align-items: center; width: 100%; margin-top: 8px; }
/* Le motif rythmique est posé sur la scène, hors des bandes de commandes : en haut au centre sur ordinateur. */
.current-beat { position: absolute; z-index: 2; top: 13px; left: 50%; transform: translateX(-50%); display: flex; width: min(36%, 280px); height: 48px; pointer-events: none; }
.beat-pattern { display: flex; justify-content: center; gap: 4px; width: 100%; height: 100%; }
.beat-pattern-segment { position: relative; overflow: hidden; display: flex; flex: 1; min-width: 0; align-items: center; justify-content: center; border-radius: 8px; color: var(--ink-soft); background: #d3dbcd; font-size: 13px; line-height: 1; font-weight: 600; }
.beat-pattern-segment.long { flex: 2; }
/* Le prémouvement d'un départ, « Et », occupe seul la largeur d'un vite du motif, au centre. */
.beat-pattern-segment.prelude { flex: 0 0 calc((100% - (var(--motif-segments, 3) - 1) * 4px) / var(--motif-units, 4)); }
/* Le remplissage et la partie blanche du libellé partagent la même frontière, sans animation autonome. */
.beat-pattern-segment::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--beat-progress, 0%); background: var(--green); }
.beat-pattern-segment::after { content: attr(data-label); position: absolute; z-index: 2; inset: 0; display: flex; align-items: center; justify-content: center; color: white; clip-path: inset(0 calc(100% - var(--beat-progress, 0%)) 0 0); }
.beat-speed { position: absolute; z-index: 1; inset: 0; display: flex; align-items: center; justify-content: center; clip-path: inset(0 0 0 var(--beat-progress, 0%)); }
.beat-pattern-segment:not(.current) .beat-speed, .beat-pattern-segment:not(.current)::after { visibility: hidden; }
.role-name { display: flex; align-items: center; gap: 7px; margin: 0; font-size: 13px; font-weight: 700; line-height: 1.5; color: var(--ink-soft); }
.role-name i { width: 7px; height: 7px; border-radius: 50%; }
.playback-controls { display: grid; grid-template-columns: 44px 44px minmax(44px, 1fr) 44px 44px; gap: 6px; width: 100%; }
.play-button, .step-button { display: flex; align-items: center; justify-content: center; border-radius: 11px; min-height: 48px; }
.play-button { color: white; background: var(--green); box-shadow: 0 3px 6px #26583f0d; }
.play-button .icon { width: 20px; height: 20px; }
.step-button { background: #f0f2e9; color: #6a7b67; }
.step-button .icon { width: 17px; height: 17px; stroke-width: 1.5; }
.timeline-block { margin: 0; }
.dancer-display-setting { display: grid; gap: 8px; margin-top: 16px; font-size: 15px; font-weight: 600; }
.dancer-display-setting select { appearance: none; width: 100%; min-height: 44px; padding: 8px 40px 8px 12px; font: inherit; font-weight: 400; color: var(--green-deep); border: 1px solid var(--line); border-radius: 8px; background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23205447' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 14px center / 16px 16px; }
.field-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 17px; }
.field-heading label { font-weight: 600; }
.field-heading output { color: var(--green); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { appearance: none; -webkit-appearance: none; width: 100%; height: 44px; background: transparent; margin: 1px 0; cursor: pointer; display: block; touch-action: pan-y; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 9px; background: var(--range-track); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 9px; background: var(--range-track); }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; height: 14px; width: 14px; border: 3px solid var(--paper); border-radius: 50%; background: var(--green); margin-top: -5.5px; box-shadow: 0 0 0 1px var(--range-ring); }
input[type="range"]::-moz-range-thumb { height: 8px; width: 8px; border: 3px solid var(--paper); border-radius: 50%; background: var(--green); box-shadow: 0 0 0 1px var(--range-ring); }
input.timeline-range::-webkit-slider-runnable-track { height: 6px; }
input.timeline-range::-moz-range-track { height: 6px; }
input.timeline-range::-webkit-slider-thumb { width: 24px; height: 24px; margin-top: -9px; border-width: 4px; }
input.timeline-range::-moz-range-thumb { height: 16px; width: 16px; border-width: 4px; }
.beat-track { --beat-gap: 4px; display: grid; flex: none; gap: var(--beat-gap); margin-top: 14px; }
.beat-row { display: grid; gap: var(--beat-gap); } /* une colonne par unité musicale, chaque bouton couvre son temps (presentation.js) */
.beat-track button { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 2px; min-height: 40px; border-radius: 7px; background: #f1f3eb; color: #626f59; position: relative; transition: none; }
.beat-track strong { font-size: 16px; font-weight: 600; }
.beat-track button[aria-pressed="true"] { color: var(--green); background: #e0ebd9; box-shadow: inset 0 0 0 1px #c4d8b9; }
/* --panel-room : place sous le panneau, calculée à son ouverture (app.js, fitPanel). */
.settings-block { right: 0; width: 320px; max-width: calc(100cqw - 2 * var(--stage-gutter)); max-height: min(300px, var(--panel-room, 300px)); overflow-y: auto; overscroll-behavior: contain; padding: 16px; }
.settings-block .field-heading { font-size: 15px; }
/* Fondu au bas d'un panneau dont le contenu continue plus bas, faute de barre de défilement visible au doigt. */
.settings-block::after { content: ""; position: sticky; bottom: 0; display: block; height: 36px; margin: -36px -16px 0; border-radius: 0 0 12px 12px; background: linear-gradient(to bottom, color-mix(in srgb, var(--paper) 0%, transparent), var(--paper) 85%); pointer-events: none; opacity: 0; transition: opacity .15s; }
.settings-block.has-more::after { opacity: 1; }
.settings-block .range-endpoints { font-size: 12px; }
.range-setting + .range-setting { margin-top: 16px; }
.settings-block > :first-child { margin-top: 0; }
.range-endpoints { margin-top: -6px; display: flex; justify-content: space-between; color: #65715e; font-size: 14px; }
.home-page > #home-loading { position: absolute; left: 0; right: 0; margin-top: 14px; color: var(--ink-soft); font-size: 14px; line-height: 1.5; text-align: center; }

/* Carte des figures et bandeaux. */
.tree-return { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; background: transparent; margin: -8px 0 8px -8px; padding: 0 8px; border-radius: 10px; color: var(--green); font-size: 12px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; }
.tree-return .icon { width: 16px; height: 16px; stroke-width: 2; }
.tree-page { min-width: 0; }
.explorer { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.explorer { overflow: hidden; }
/* Bandeau : un bandeau sombre, distinct de la scène et des blocs de contenu. */
.explorer-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 16px 20px; border-bottom: 1px solid var(--green); background: var(--green); }
.tree-title { margin: 0 8px 0 0; color: var(--paper); font-size: 20px; font-weight: 600; letter-spacing: -.4px; }
.tree-title:focus { outline: none; }
/* Sur une page Figure, la remontée vers Figures est au bout de la barre. */
.tree-overview { position: relative; min-height: 0; height: 26px; margin: 0 -8px 0 auto; border: 1px solid #fffef966; color: var(--paper); }
/* Le dessin du bouton reste compact ; sa zone active déborde de 9 px tout autour, pour atteindre 44 px de haut, et de large sur téléphone. */
.tree-overview::before { content: ""; position: absolute; inset: -10px; }
/* Sélecteur Liste / Carte, à droite du titre « Figures » : le bouton de la présentation affichée est plein. Le dessin reste
   compact ; la zone active de chaque bouton atteint 44 px de haut. */
.figures-views { display: flex; flex: none; gap: 2px; margin: -4px 0 -4px auto; padding: 3px; border: 1px solid #fffef966; border-radius: 10px; }
.figures-views[hidden] { display: none; }
.figures-views button { position: relative; min-height: 0; height: 28px; padding: 0 12px; border-radius: 7px; background: transparent; color: var(--paper); font-size: 14px; font-weight: 600; }
.figures-views button::before { content: ""; position: absolute; inset: -8px 0; }
.figures-views button[aria-pressed="true"] { background: var(--paper); color: var(--green-deep); }
/* Fiche de la page Figure : résumé et relations, puis la description détaillée, séparée par un trait fin. */
.figure-sheet { grid-area: sheet; min-width: 0; padding: 20px 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.figure-sheet > .details-title, .figure-sheet > .details-heading > .details-title { margin: 0; }
.figure-sheet .detailed-content { margin-top: 18px; }
/* Page Figure : le résumé suit le nom long ; les relations, ou le trajet d'une transition, ferment la carte des détails. */
.figure-summary { margin: 8px 0 0; }
.figure-relations > .tree-section { margin-top: 20px; }
.figure-relations > .inspector-route { margin: 20px 0 0; }
.detailed-role + .detailed-role { margin-top: 28px; }
.detailed-role .role-name { margin: 0 0 12px; }
.detailed-role p { margin: 0 0 12px; color: var(--ink-soft); font-size: 15px; line-height: 1.6; }
.detailed-role p:last-child { margin-bottom: 0; }
.tree-section { margin-top: 24px; }
.tree-label { margin: 0 0 10px; color: var(--green); font-size: 16px; font-weight: 600; line-height: 1.4; }
.graph-figure { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--green); border-radius: 10px; background: var(--paper); color: var(--green); font-size: 15px; font-weight: 600; text-align: left; line-height: 1.4; }
.graph-figure.transition { border-color: var(--coral); background: var(--transition-paper); color: var(--transition-ink); }
.graph-figure::after { content: ""; display: inline-block; width: 5px; height: 5px; margin: 0 2px 1px 0; flex: none; border-top: 1.5px solid currentColor; border-right: 1.5px solid currentColor; transform: rotate(45deg); }
.tree-relations { margin: 0; padding: 0; list-style: none; }
.tree-relations li + li { margin-top: 12px; }
.relation-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 15px; line-height: 1.6; }
.tree-summary { max-width: 650px; margin: 0; color: var(--ink-soft); font-size: 15px; line-height: 1.6; }
.tree-empty { margin: 0; color: var(--ink-soft); font-size: 14px; }
.inspector-route { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; }
.inspector-route .graph-figure { min-width: 0; max-width: calc((100% - 48px) / 2); }
.route-word { flex: none; color: var(--ink-soft); }
/* Vue d'ensemble : carte plane, déplaçable et zoomable. */
.system-view { position: relative; }
.system-map { display: block; width: 100%; height: min(620px, 70vh); min-height: 380px; background: var(--stage); touch-action: none; cursor: grab; user-select: none; }
.system-map:active { cursor: grabbing; }
.map-grid { fill: url(#map-dots); }
#map-dots circle { fill: #c9d0c288; }
/* Liens de la carte, sans mise en avant de la figure consultée. */
.map-edge { fill: none; stroke: #becdb9; stroke-width: 1.8; }
#map-arrow-normal path { fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#map-arrow-normal path { stroke: #becdb9; }
/* Cartes : le nom de la figure ou de la transition. */
.map-card { cursor: pointer; outline: none; }
.map-card text { text-rendering: geometricPrecision; }
.map-card .card { fill: var(--paper); stroke: var(--green); stroke-width: 1.2; }
.map-card use { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.map-card .name { fill: var(--ink); font-size: 18px; font-weight: 600; }
.map-card.transition .card { fill: var(--transition-paper); stroke: var(--coral); }
.map-card.transition .name { fill: var(--transition-ink); font-weight: 500; }
.map-card:focus-visible .card { stroke: var(--ink); stroke-width: 2; }
/* Carte sélectionnée : fond plein, vert pour une figure, corail foncé pour une transition, texte clair. */
.map-card.selected .card { fill: var(--green); stroke: var(--green); }
.map-card.transition.selected .card { fill: var(--transition-ink); stroke: var(--transition-ink); }
.map-card.selected .name { fill: #fffdf4; }
/* Boutons à chevron, à cheval sur le bas de la carte, à droite : les variantes de la figure, toujours au coin, et la
   page Figure de la carte sélectionnée. */
.card-chevron { cursor: pointer; outline: none; }
.card-chevron .hit { fill: transparent; }
.card-chevron .pill { fill: var(--paper); stroke: var(--green); stroke-width: 1.2; }
.card-chevron .chevron { fill: none; stroke: var(--green); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.map-card.transition .card-chevron .pill { stroke: var(--transition-ink); }
.map-card.transition .card-chevron .chevron { stroke: var(--transition-ink); }
.card-chevron:focus-visible .pill { stroke: var(--ink); stroke-width: 2; }
.card-variants[aria-expanded="true"] .pill { fill: var(--green-pale); }
.map-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 42px; min-height: 42px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: 0 2px 8px #253c3914; color: var(--ink-soft); font-size: 14px; font-weight: 600; }
.map-button.active { border-color: var(--green); background: var(--green); color: white; }
.map-reset { position: absolute; right: 14px; bottom: 14px; min-height: 44px; padding: 8px 14px; color: var(--green); }
.map-controls { position: absolute; top: 14px; right: 14px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.map-filters { display: grid; justify-items: end; gap: 8px; }
.filter-panel { width: 270px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); box-shadow: 0 6px 22px #253c3920; }
.filter-title { margin-bottom: 10px; color: var(--ink-soft); font-size: 14px; }
.filter-panel label { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: 15px; cursor: pointer; }
.filter-panel input { width: 18px; height: 18px; accent-color: var(--green); }
.filter-hint { margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.map-zoom { position: relative; display: flex; }
/* Comme les vues de la scène : les commandes s'ouvrent à gauche de leur bouton et restent ouvertes pendant les choix. */
.zoom-options { position: absolute; top: -5px; right: calc(100% + 8px); display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: 0 5px 18px #253c3920; }
.zoom-options .map-button { border-color: transparent; box-shadow: none; }
#zoom-toggle[aria-expanded="true"], #filter-toggle[aria-expanded="true"]:not(.active) { background: var(--green-pale); }
#filter-toggle .icon { stroke-width: 2; }
/* Nom de la figure sélectionnée, en haut à gauche, comme le titre de la scène des lecteurs. */
.map-title { position: absolute; top: 14px; left: 20px; max-width: calc(100% - 100px); margin: 0; overflow: hidden; font-size: 20px; font-weight: 600; line-height: 42px; letter-spacing: -.4px; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
/* La légende laisse sa place au bouton « Réinitialiser », en bas à droite : son filtre passe à la ligne avant lui. */
.map-legend { position: absolute; left: 20px; bottom: 20px; max-width: calc(100% - 160px); pointer-events: none; }
.map-legend h3 { margin: 0 0 8px; color: var(--ink-soft); font-size: 12px; font-weight: 600; }
.map-legend ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; color: var(--ink-soft); font-size: 13px; }
.map-legend li { display: flex; align-items: center; gap: 7px; }
.map-legend .legend-filter { display: grid; gap: 2px; max-width: min(300px, 100%); margin: 10px 0 0; padding-top: 8px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 13px; }
.legend-filter #map-legend-filter-name { color: var(--green); font-weight: 600; }
.legend-filter #map-legend-filter-hint { font-size: 12px; }
.legend-card { width: 16px; height: 11px; border: 1px solid var(--green); border-radius: 3px; background: var(--paper); }
.legend-card.transition { border-color: var(--coral); background: var(--transition-paper); }
.tree-loading { margin: 0 20px 16px; color: var(--ink-soft); font-size: 14px; line-height: 1.5; }
@keyframes spin { to { transform: rotate(360deg); } }


@media (hover: hover) {
  .view-selector button:hover:not([aria-pressed="true"]), .tool-button:hover:not([aria-pressed="true"]) { color: var(--green); background: #dce4d4; }
  .mode-selector button:hover:not([aria-pressed="true"]) { color: var(--green); background: var(--green-pale); }
  .inspector-route button:hover, .map-button:hover:not(.active), .tree-return:hover, .reset-sequence:hover { color: var(--ink); background: var(--green-pale); }
  .explorer-bar .tree-overview:hover { color: var(--paper); background: #fffef91a; }
  .graph-figure:hover { border-color: var(--green); background: var(--green-pale); color: var(--green-deep); }
  .graph-figure.transition:hover { border-color: var(--transition-ink); background: var(--transition-paper); color: var(--transition-ink); }
  .map-card:not(.transition):not(.selected):hover .card { stroke: var(--green-deep); }
  .map-card.transition:not(.selected):hover .card { stroke: var(--transition-ink); }
  .card-detail:hover .pill { fill: var(--green-pale); }
  .map-card.transition .card-detail:hover .pill { fill: var(--transition-pale); }
  .play-button:hover { background: var(--green-deep); }
  .step-button:hover:not([aria-pressed="true"]) { color: var(--green); background: #e4ebdc; }
  .figure-history .sequence-remove:hover:not(:disabled) { color: var(--transition-ink); background: var(--transition-pale); }
  .figure-history .sequence-add:hover:not(:disabled), .sequence-additions button:hover { background: var(--green-pale); }
  .sequence-additions button.transition:hover { background: var(--transition-pale); }
  .repeat-button[aria-pressed="true"]:hover { background: #e0ebd9; }
  .beat-track button:hover { background: #e3eadb; color: var(--green); }
  .figure-card:hover, .figure-pill:not(.chosen):hover:not(:disabled) { background: var(--green-pale); }
  .figure-card.transition:hover, .figure-pill.transition:not(.chosen):hover:not(:disabled) { background: var(--transition-pale); }
  .explorer-bar .library-back:hover { color: var(--paper); background: #fffef91a; }
  .home-modes button:hover:not([aria-pressed="true"]) { border-color: #c9d5c3; background: var(--green-pale); color: var(--green); transform: translateY(-2px); }
  #launch-mode:hover { background: var(--green-deep); box-shadow: 0 10px 22px -14px #205447e6; }
  #launch-mode:hover .icon { transform: translateX(3px); }
}
@media (min-width: 1500px) {
  :root { --stage-height: 705px; }
  :is(.figure-details, .figure-sheet) { padding: 22px 28px; }
}
@media (max-width: 1190px) {
  .workspace { padding: 32px 30px; }
  .app-home-link { margin: 24px 30px; }
  .mode-selector { margin-right: 30px; }
  .app-footer { padding-right: 30px; padding-left: 30px; }
  :is(.figure-details, .figure-sheet) { padding: 20px 19px; }
  .stage-top { --stage-gutter: 12px; padding: 12px; }
  .stage-bottom { padding: 0 12px 12px; }
}
@media (max-width: 920px) {
  .workspace { padding: 32px 24px; }
  .app-home-link { margin-right: 24px; margin-left: 24px; }
  .mode-selector { margin-right: 24px; }
  .app-footer { flex-wrap: wrap; padding-right: 24px; padding-left: 24px; }
  .site-credit { margin-left: auto; }
  .lesson-layout { --row-gap: 18px; }
  .stage-card { height: auto; }
  .stage-surface { --available-height: min(calc(64vh + 67px), 667px); min-height: 0; height: var(--available-height); flex: auto; }
  .stage-top { --stage-gutter: 17px; padding: 10px 17px; }
  /* Le bouton du bas à droite reste aligné sur les commandes du haut. */
  .stage-bottom { padding-right: 17px; padding-left: 17px; }
  :is(.figure-details, .figure-sheet) { padding: 20px 24px 24px; }
}
/* Présentation et carte de l'accueil en une colonne : le couple sous le texte de présentation ; dans la carte, l'illustration au-dessus du texte, « Ouvrir » sur toute la largeur. */
@media (max-width: 760px) {
  .home-intro { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .home-couple { height: 160px; }
  .home-mode-card { grid-template-columns: minmax(0, 1fr); gap: 22px; padding: 12px 12px 18px; }
  .mode-art { aspect-ratio: auto; height: 170px; }
  /* Illustration étroite : le bandeau des temps se resserre pour ne pas atteindre les pieds des danseurs. */
  .preview-beats { left: 8px; bottom: 12px; gap: 2px; padding: 3px; border-radius: 13px; }
  .preview-beats span { width: 19px; height: 19px; font-size: 11px; }
  .mode-text { gap: 22px; padding: 0 8px; }
  /* En une colonne, le texte occupe toute la largeur de la carte. */
  .mode-presentation p { max-width: none; }
  #launch-mode { align-self: stretch; }
}

@media (max-width: 650px) {
  /* Carte : commandes et légende superposées à la carte. */
  .explorer-bar { padding: 12px; }
  .tree-overview { width: 26px; padding: 0; justify-content: center; margin-right: 0; }
  .tree-overview span { display: none; }
  .figures-views button { padding: 0 9px; font-size: 13px; }
  .system-map { height: 62vh; min-height: 340px; }
  .filter-panel { width: min(270px, calc(100vw - 60px)); }
  .map-legend { left: 14px; bottom: 14px; }
  /* Catalogue seul avant le choix, puis scène et détails ; la page défile verticalement pour parcourir tous les blocs. */
  :root {
    --radius: 17px;
    --card-gap: 8px;
  }
  .workspace { display: flex; flex-direction: column; padding: 24px 16px; }
  .app-home-link { margin: 16px; }
  .app-header { flex-wrap: nowrap; }
  .app-home-link { min-width: 0; gap: 8px; margin: 16px 6px 16px 16px; }
  .app-logo { height: 44px; }
  .app-home-link h1 { font-size: 24px; letter-spacing: -.8px; }
  .app-home-link .eyebrow { font-size: 9px; letter-spacing: .5px; }
  .mode-selector { --mode-gap: 2px; flex: none; margin: 0 16px 0 auto; padding: 2px; border-radius: 12px; }
  .mode-selector button { gap: 4px; min-height: 52px; padding: 8px 6px; font-size: 13px; }
  .mode-selector .icon { width: 20px; height: 20px; }
  .app-footer { flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 18px 16px; font-size: 12px; text-align: center; }
  .site-credit { flex-direction: row-reverse; margin-left: 0; }
  /* La marge accueille le message de chargement, sur une ligne. */
  .home-page { margin-bottom: 36px; }
  .home-page h2 { font-size: 24px; letter-spacing: -.5px; }
  .home-intro { margin-bottom: 24px; font-size: 16px; }
  .home-page #home-intro-title { font-size: 36px; letter-spacing: -1px; }
  .home-modes { gap: 10px; margin: 14px 0 0; }
  .home-mode-choice { padding: 12px 0 18px; margin-right: 0; }
  .home-modes button { width: min(72px, calc((100% - 30px) / 4)); height: auto; aspect-ratio: 1; border-radius: 20px; }
  .home-modes .icon { width: 30px; height: 30px; }
  .mode-presentation h3 { font-size: 28px; }
  .mode-presentation p { font-size: 16px; }
  h1 { font-size: 28px; white-space: nowrap; }
  .stage-top { --stage-gutter: 8px; padding: 8px; }
  .stage-toolbar { grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; row-gap: 6px; }
  /* Le motif se pose juste au-dessus du lecteur, centré et de sa largeur. */
  .current-beat { top: auto; bottom: calc(var(--player-height) + 10px); width: 190px; max-width: calc(100% - 12px); }
  .stage-surface { --player-height: 73px; }
  .cinematic-mode .stage-surface { --player-height: 48px; }
  .scene-actions { grid-column: 2; grid-row: 1; }
  /* Les commandes de la scène ont la hauteur des boutons du lecteur compact, icônes réduites d'autant ; une zone
     invisible autour de chacune lui garde une cible tactile de 44 px. */
  .stage-surface { --scene-frame: 36px; }
  .view-selector, .scene-music, .scene-settings { --frame-radius: 9px; }
  :is(#toggle-views, #toggle-music, #toggle-settings) { width: 34px; height: 34px; min-width: 0; min-height: 0; }
  #toggle-views .icon { width: 23px; height: 23px; }
  :is(.scene-music, .scene-settings) > .tool-button .icon { width: 22px; height: 22px; }
  .stage-bottom :is(.start-cinematic-button, .figure-details-link) { height: var(--scene-frame); min-width: 0; min-height: 0; border-radius: 9px; }
  .stage-bottom .start-cinematic-button .icon { width: 20px; height: 20px; }
  .stage-bottom .figure-details-link .icon { width: 21px; height: 21px; }
  :is(#toggle-views, #toggle-music, #toggle-settings, #start-cinematic-figure, #view-figure-details) { position: relative; }
  :is(#toggle-views, #toggle-music, #toggle-settings, #start-cinematic-figure, #view-figure-details)::before { content: ""; position: absolute; inset: -5px; }
  /* Resserrées, les vues ouvertes à gauche tiennent dans la scène dès 320 px. */
  .view-options { right: calc(100% + 6px); gap: 2px; padding: 2px; }
  .stage-surface {
    --available-height: clamp(360px, 65svh, 700px);
    height: clamp(360px, 65vh, 700px);
    height: var(--available-height);
  }
  /* Lecteur compact au bord inférieur, centré, le livre ou le bouton cinéma à droite. */
  .stage-bottom { grid-template-columns: var(--scene-frame) minmax(0, 1fr) var(--scene-frame); gap: 4px; padding: 0 8px 4px; }
  .stage-bottom .player-bar { grid-column: 2; grid-row: 1; justify-self: center; width: 190px; max-width: 100%; padding: 2px 4px 6px; border-radius: 12px; }
  .dancer-legend span { font-size: 11px; }
  .dancer-legend i { width: 6px; height: 6px; }
  .lesson-layout { --row-gap: var(--card-gap); }
  .library-navigation { padding: 16px; }
  .figure-category ul { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .player-main { margin-top: 2px; }
  .playback-controls { grid-template-columns: 32px 32px 40px 32px 32px; gap: 3px; }
  .play-button, .step-button { min-height: 36px; border-radius: 8px; }
  .repeat-button { width: 32px; }
  .play-button .icon, .repeat-button .icon { width: 18px; height: 18px; }
  .step-button .icon { width: 15px; height: 15px; }
  input.timeline-range { height: 24px; }
  input.timeline-range::-webkit-slider-runnable-track { height: 4px; }
  input.timeline-range::-moz-range-track { height: 4px; }
  input.timeline-range::-webkit-slider-thumb { width: 18px; height: 18px; margin-top: -7px; border-width: 3px; }
  input.timeline-range::-moz-range-thumb { width: 12px; height: 12px; border-width: 3px; }
  .timeline-block { margin-top: 0; }
  .stage-bottom .figure-details-link { grid-column: 3; grid-row: 1; }
  body:not(.cinematic-mode) .start-cinematic-button { display: inline-flex; grid-column: 3; grid-row: 1; align-self: end; }
  :is(.figure-details, .figure-sheet) { padding: 18px 12px; }
  .figure-sheet { margin-top: 8px; }
  .checkbox-control { font-size: 13px; }
}
@media (max-width: 370px) {
  .tree-title { font-size: 19px; }
  .workspace { padding-right: 10px; padding-left: 10px; }
  .app-footer { padding-right: 10px; padding-left: 10px; }
  .app-home-link { margin-right: 10px; margin-left: 10px; }
  .mode-selector { --mode-gap: 0px; margin-right: 10px; padding: 0; }
  .mode-selector button { gap: 3px; padding: 8px 2px; font-size: 12px; }
  .app-home-link { margin-right: 2px; margin-left: 10px; }
  .app-home-link h1 { font-size: 22px; letter-spacing: -1.2px; }
  .beat-track { --beat-gap: 2px; }
  .beat-pattern-segment { font-size: 12px; }
  .tool-button { padding: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
  .loading-orbit, .is-entering *, button[aria-busy="true"]::after { animation: none !important; }
  /* Sans mouvement, la bordure de lumière reste fixe et fait tout le tour. */
  .repeat-button[aria-pressed="true"]::before { animation: none; background: var(--green); }
  .figure-pill.auto::before { animation: none; background: var(--green); }
  .figure-pill.transition.auto::before { background: var(--transition-ink); }
}
