/* La scène : le manche ou le clavier, le métronome. Carte blanche bordée ; les composants lisent les variables de zone --z-*. */
.stage {
    --z-texte: var(--scene-texte);
    --z-doux: var(--scene-doux);
    --z-carte: var(--scene-2);
    --z-piste: var(--scene-voile);
    --z-trait: var(--scene-trait);
    --z-choix-fond: var(--choix-clair-fond);
    --z-choix-encre: var(--choix-clair-encre);
    --z-choix-filet: var(--choix-clair-filet);
    --z-ombre: var(--ombre-bouton);
    --z-actif-fond: var(--accent);
    --z-actif-encre: var(--carte);
    --z-anneau: var(--anneau-scene);
    --z-survol: var(--accent);
    border: 1px solid var(--bord);
    background: var(--scene); color: var(--scene-texte); border-radius: 16px; padding: 18px 0 10px; display: flex; flex-direction: column; gap: 14px;
    box-shadow: var(--ombre-scene);
}
.stage-head { display: flex; align-items: center; gap: 14px 20px; flex-wrap: wrap; padding: 0 20px; }
.title-block { flex: 1 1 260px; min-width: 0; }
.title-block h2 { font-family: var(--titre); font-weight: 700; font-size: clamp(22px, 2.6vw, 30px); margin: 0; line-height: 1.1; text-wrap: balance; }
.title-block h2 .k { color: var(--degre-1); }
.title-block p { margin: 3px 0 0; font-family: var(--mono); font-size: 12px; color: var(--scene-doux); font-variant-numeric: tabular-nums; }
.stage .hint { color: var(--scene-doux); }

.pos-nav { display: flex; align-items: center; gap: 6px; }
.icon-btn { width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--z-trait); background: transparent; color: var(--z-texte); display: grid; place-items: center; transition: background .15s; }
.pos-chips { display: flex; gap: 4px; }
.pos-chips button { min-width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--z-trait); background: transparent; color: var(--z-texte);
  font-family: var(--mono); font-size: 13px; font-weight: 700; padding: 0 10px; transition: background .15s, color .15s, border-color .15s; }
/* « En cours » : la position affichée est en accent */
.pos-chips button[aria-pressed="true"] { background: var(--etat-actif); border-color: var(--etat-actif); color: var(--etat-actif-encre); }
.pos-chips .all { font-family: var(--corps); font-weight: 600; font-size: 12.5px; }
/* Action principale de la scène : sapin ; en accent pendant l'écoute */
.play { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px 0 12px; border-radius: 999px; border: 0; background: var(--action-fond); color: var(--action-encre); font-weight: 600; font-size: 13.5px; transition: transform .12s, background .15s; }
.play:active { transform: scale(.97); }
.play[data-on="true"] { background: var(--etat-actif); color: var(--etat-actif-encre); }
@media (hover: hover) {
    .icon-btn:hover { background: var(--scene-voile); }
    .play:not([data-on="true"]):hover { background: var(--sapin-2); }
    .pos-chips button:hover { border-color: var(--scene-doux); }
}

.neck-wrap { overflow-x: auto; overflow-y: hidden; padding: 4px 12px 6px; scrollbar-width: thin; scrollbar-color: var(--scene-3) transparent; -webkit-overflow-scrolling: touch; }
#neck { display: block; width: 100%; min-width: var(--neck-min, 1000px); height: auto; user-select: none; -webkit-user-select: none; }
.scroll-hint { display: none; padding: 0 20px; font-size: 12px; color: var(--scene-doux); }
/* Sous 1 040 px, l'invite de défilement suit le manche : on resserre le vide que laissent la marge du dessin et l'écart de la scène. */
@media (max-width: 1040px) {
    .scroll-hint { display: block; margin-top: -6px; }
    .neck-wrap { padding-bottom: 0; }
}

/* Éléments du dessin */
.fnum { font-family: var(--mono); font-size: 11px; fill: var(--scene-doux); text-anchor: middle; }
.fnum.mark { fill: var(--scene-texte); font-weight: 700; }
.tun { font-family: var(--mono); font-size: 11px; fill: var(--scene-doux); text-anchor: middle; dominant-baseline: central; }
.band { fill: var(--manche-bande); stroke: var(--manche-bande-trait); stroke-width: 1.2; vector-effect: non-scaling-stroke; transform-origin: 0 0; transition: transform .38s cubic-bezier(.2, .8, .2, 1), opacity .25s; }
.zoom-voile { fill: var(--scene); }
/* Noms des cordes rappelés au bord d'un manche zoomé : ils sont sur le voile posé sur le bois (mélange à .88), où le gris de la scène ne fait que 4,48:1 */
#zoomTun .tun { fill: var(--scene-texte); }

/* Matières : les stops des dégradés, les cordes, les touches */
.m-bois-1 { stop-color: var(--matiere-bois-1); } .m-bois-2 { stop-color: var(--matiere-bois-2); } .m-bois-3 { stop-color: var(--matiere-bois-3); }
.m-grain { flood-color: var(--matiere-grain); }
.m-frette-1 { stop-color: var(--matiere-frette-1); } .m-frette-2 { stop-color: var(--matiere-frette-2); } .m-frette-3 { stop-color: var(--matiere-frette-3); }
.m-nacre-1 { stop-color: var(--matiere-nacre-1); } .m-nacre-2 { stop-color: var(--matiere-nacre-2); } .m-nacre-3 { stop-color: var(--matiere-nacre-3); }
.m-sillet-1 { stop-color: var(--matiere-sillet-1); } .m-sillet-2 { stop-color: var(--matiere-sillet-2); } .m-sillet-3 { stop-color: var(--matiere-sillet-3); }
.m-ivoire-1 { stop-color: var(--matiere-ivoire-1); } .m-ivoire-2 { stop-color: var(--matiere-ivoire-2); } .m-ivoire-3 { stop-color: var(--matiere-ivoire-3); }
.m-ebene-1 { stop-color: var(--matiere-ebene-1); } .m-ebene-2 { stop-color: var(--matiere-ebene-2); } .m-ebene-3 { stop-color: var(--matiere-ebene-3); }
.m-couvercle-1 { stop-color: var(--matiere-couvercle-1); } .m-couvercle-2 { stop-color: var(--matiere-couvercle-2); }
.corde-ombre { stroke: var(--matiere-ombre); }
.corde-filee { stroke: var(--matiere-corde-filee); }
.corde-lisse { stroke: var(--matiere-corde-lisse); }
.corde-nylon { stroke: var(--matiere-corde-nylon); }
.corde-reflet { stroke: var(--matiere-reflet); }
.feutre { fill: var(--matiere-feutre); }
.key { cursor: pointer; transition: filter .12s; }
.key.touche-blanche { stroke: var(--matiere-contour); }
.key.touche-noire { stroke: var(--matiere-ebene-contour); }
.key.down { filter: brightness(.82); }
@media (hover: hover) { .key:hover { filter: brightness(.93); } }

/* Pastilles : une couleur par degré */
.dot { cursor: pointer; transition: opacity .28s; }
.dot .in { transform-box: fill-box; transform-origin: center; transition: transform .32s cubic-bezier(.2, .8, .2, 1); }
.dot circle { stroke: var(--matiere-contour-pastille); stroke-width: 1; }
.dot text { font-family: var(--mono); font-weight: 700; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.dot.r-root circle { fill: var(--degre-1); } .dot.r-root text { fill: var(--degre-1-encre); }
.dot.r-d2 circle { fill: var(--degre-2); } .dot.r-d2 text { fill: var(--degre-2-encre); }
.dot.r-third circle { fill: var(--degre-3); } .dot.r-third text { fill: var(--degre-3-encre); }
.dot.r-d4 circle { fill: var(--degre-4); } .dot.r-d4 text { fill: var(--degre-4-encre); }
.dot.r-fifth circle { fill: var(--degre-5); } .dot.r-fifth text { fill: var(--degre-5-encre); }
.dot.r-d6 circle { fill: var(--degre-6); } .dot.r-d6 text { fill: var(--degre-6-encre); }
.dot.r-d7 circle { fill: var(--degre-7); } .dot.r-d7 text { fill: var(--degre-7-encre); }
.dot.r-blue circle { fill: var(--degre-blue); stroke: var(--degre-blue-contour); stroke-width: 1.6; stroke-dasharray: 3 2; }
.dot.r-blue text { fill: var(--degre-blue-encre); }
.dot.ghost { opacity: .26; } .dot.ghost .in { transform: scale(.72); }
.dot.hidden { opacity: 0; pointer-events: none; } .dot.hidden .in { transform: scale(.4); }
.dot.dim { opacity: .12; }
/* Écoute en cours : la pastille qui joue a un contour sauge */
.dot.ping .in { transform: scale(1.3); }
.dot.ping circle { stroke: var(--manche-ping); stroke-width: 2.5; }
@media (hover: hover) { .dot:hover .in { transform: scale(1.12); } }

/* Métronome : « Tempo » garde 200 px au moins, les options passent sur une seconde ligne quand la place manque */
.metro { border-top: 1px solid var(--scene-trait-fin); margin-top: 2px; padding: 14px 20px 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; }
.metro-go { display: inline-flex; align-items: center; gap: 9px; height: 44px; padding: 0 18px 0 14px; border-radius: 999px; border: 1px solid var(--z-trait); background: transparent; color: var(--z-texte); font-weight: 600; font-size: 14px; transition: background .15s, border-color .15s, color .15s; }
/* « En cours » : le métronome en marche est en accent */
.metro-go[aria-pressed="true"] { background: var(--etat-actif); border-color: var(--etat-actif); color: var(--etat-actif-encre); }
.metro-go svg { flex: none; }
/* Un bouton « en cours » garde son fond au survol : sinon le texte blanc disparaît sur la sauge pâle (Ludo, 07/11/2026) */
@media (hover: hover) { .metro-go:hover { background: var(--scene-voile); } .tap:hover { background: var(--scene-voile); } .metro-go[aria-pressed="true"]:hover { background: var(--etat-actif); filter: brightness(.92); } }
.tempo { display: flex; align-items: center; gap: 8px; }
.bpm { display: flex; flex-direction: column; align-items: center; min-width: 86px; line-height: 1; }
.bpm output { font-family: var(--titre); font-weight: 700; font-size: 30px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.bpm span { font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; color: var(--scene-doux); margin-top: 4px; text-transform: uppercase; }
.tempo-track { display: flex; flex-direction: column; gap: 8px; flex: 1 1 200px; min-width: 200px; }
.tempo-track input[type=range] { width: 100%; accent-color: var(--accent); height: 28px; cursor: pointer; margin: 0; }
.beats { display: flex; gap: 7px; align-items: center; min-height: 16px; }
.beats i { width: 12px; height: 12px; border-radius: 50%; background: var(--trait-fort); transition: background .06s, transform .06s; }
.beats i.acc { width: 16px; height: 16px; }
.beats i.sec { width: 14px; height: 14px; }
/* « En cours » : tous les temps qui sonnent sont en accent, l'accent du rythme se marque par sa taille */
.beats i.on { background: var(--etat-actif); transform: scale(1.15); }
.tap { height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--z-trait); background: transparent; color: var(--z-texte); font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .06em; transition: background .1s, transform .1s; }
.tap:active { transform: scale(.94); background: var(--scene-trait); }
.metro-opts { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; justify-content: flex-end; }
.metro-opts .grp { display: flex; align-items: center; gap: 8px; }
@media (max-width: 1180px) { .metro-opts { flex-basis: 100%; justify-content: flex-start; } }
@media (max-width: 620px) {
    .metro { flex-direction: column; align-items: stretch; padding: 14px 14px 6px; }
    .tempo-track { flex: 0 0 auto; min-width: 0; }
    .metro-go { justify-content: center; }
    .tempo { justify-content: space-between; }
}
@media (max-width: 620px) {
    .stage-head { padding: 0 14px; }
    .pos-nav { width: 100%; justify-content: space-between; }
    .pos-chips { flex: 1; justify-content: center; flex-wrap: wrap; }
}
