

/* === TITRE === */
.title-image {
  width: 222px; /* ajustez selon votre image */
  height: auto;
  display: block;
  margin: 0 auto; 
  margin-top: 44px;
  margin-bottom: 79px;
  opacity: 77%;
}

html, body {
  overflow-x: hidden;
  max-width: 100%;
}

body {
  overflow-x: hidden;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: #787f79;
  color: #333;
  text-align: center;
  margin: 0;
  padding: 0;
}

h1.page-title {
  margin-top: -10px;
  margin-bottom: -33px;
  transform: scale(1.2);
  color: #444;
  opacity: 0.9;
}


/* === INSTRUCTIONS === */
.instructions {
  font-size: 1.1rem;
  color: #444;
}

.instructions-initial {
  margin-top: 126px;
}

.instructions-root-selected {
  height: 16px;   /* ajuste selon le rendu */
}


/* Piano interactif */
.piano {
  position: relative;
  z-index: 2;
}

/* === CLAVIER === */
.piano-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 40px auto 60px;
  width: 90%;
  max-width: 800px;
}

.piano {
  position: relative;
  display: inline-block;
  width: 100%;
  z-index: 2;
}

/* Piano gris */
.piano-gris-overlay {
  position: absolute;
  top: -176px !important;
  left: 50.1%;
  transform: translateX(-50%);
  width: 100%;
  pointer-events: none;
  z-index: 5;
  mix-blend-mode: darken;
}

/* Image principale */
.piano-overlay {
  position: absolute;
  top: -176px !important;
  left: 50.1%;
  transform: translateX(-50%);
  width: 100%;
  pointer-events: none;
  z-index: 1;
}

/* Piano ombre */
.piano-ombre {
  position: absolute;
  opacity: 100%;
  top: -176px;
  left: 50.1%;
  transform: translateX(-50%); /* ← ajuste ici */
  width: 100%;
  z-index: 2;
  pointer-events: none;
}

/* Piano speculaire */
.piano-specular {
  position: absolute;
  opacity: 100%;
  top: -176px;
  left: 50.1%;
  transform: translateX(-50%); /* ← ajuste ici */
  width: 100%;
  z-index: 4;
  pointer-events: none;
  mix-blend-mode: lighten;
  opacity: 1;
}

/* === TOUCHES === */
.white-key {
  display: inline-block;
  width: 30px;
  height: 180px;
  background: rgba(255, 255, 255, 0.01);
  position: relative;
  z-index: 2;
  overflow: visible;
  border: none;

  --encoche-hauteur: 65%;
  --encoche-gauche: 35%;
  --encoche-droite: 80%;

  clip-path: polygon(
    0% var(--encoche-hauteur),
    var(--encoche-gauche) var(--encoche-hauteur),
    var(--encoche-gauche) 0%,
    var(--encoche-droite) 0%,
    var(--encoche-droite) var(--encoche-hauteur),
    100% var(--encoche-hauteur),
    100% 100%,
    0% 100%
  );
}

.white-key.do,
.white-key.fa {
  --encoche-gauche: 56%;
  --encoche-droite: 0%;
}

.white-key.re {
  --encoche-gauche: 23%;
  --encoche-droite: 79%;
}

.white-key.mi,
.white-key.si {
  --encoche-gauche: 46%;
  --encoche-droite: 100%;
}

.white-key.sol {
  --encoche-gauche: 24%;
  --encoche-droite: 68%;
}

.white-key.la {
  --encoche-gauche: 35%;
  --encoche-droite: 80%;
}

.black-key {
  position: absolute;
  width: 20px;
  height: 63.9%;
  background: rgba(0, 0, 0, 0.01);
  top: -1.4px;
  transform: translateX(-50%);
  z-index: 3;
  overflow: hidden;
  border-radius: 0 0 3px 3px;
}

/* === HALO BLANC UNIFIÉ === */
.white-key .halo-layer {
  position: absolute;
  inset: -1%;
  pointer-events: none;
  z-index: 6;
}

.white-key .halo-layer .halo {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  background: radial-gradient(
    circle at var(--halo-x, 50%) var(--halo-y, 90%),
    var(--key-color, rgba(255, 255, 255, 1)) 38%,
    rgba(0, 0, 0, 0) 100%
  );
  filter: blur(18px);
  transition: opacity 0.22s ease;
  -webkit-mask-image: radial-gradient(
    circle at var(--halo-x, 50%) var(--halo-y, 90%),
    rgba(0, 0, 0, 1) 0%,
    rgba(0, 0, 0, 1) 35%,
    rgba(0, 0, 0, 0.6) 45%,
    rgba(0, 0, 0, 0) 55%
  );
}

/* === ACTIVATION HALO === */
.white-key.active .halo-layer .halo,
.white-key.key-root .halo-layer .halo {
  opacity: 1;
}

.white-key {
  --halo-x: 20%;
  --halo-y: 135%;
}

.black-key .halo {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 6;
  filter: blur(20px);
  will-change: opacity;
  background: radial-gradient(
  circle at 50% 90%,
  var(--key-color, rgba(0, 0, 0, 0)) 50%,
  rgba(0, 0, 0, 0) 90%
);
  mix-blend-mode: normal;
  transition: opacity 0.22s ease;
}

.black-key.active .halo,
.black-key.key-root .halo {
  opacity: 1;
}

.black-key.key-root {
  --key-color: rgba(255, 80, 80, 0.95);
}

.black-key.active:not(.key-root) {
  --key-color: rgba(120, 200, 120, 0.95);
}

/* === SLASH CHORD : la basse n'est pas une tonique visuelle === */
.slash-chord .white-key.key-root,
.slash-chord .black-key.key-root {
  --key-color: rgb(153, 255, 153);
  box-shadow: none;
}

/* === TONIQUE === */
.white-key.key-root {
  --key-color: rgba(255, 80, 80, 0.95);
  box-shadow: 0 0 12px rgba(229, 115, 115, 0.9);
}

/* === INTERVALLES === */
.white-key.active:not(.key-root) {
  --key-color: rgba(120, 200, 120, 0.95);
}

/* === TOUCHES DÉSACTIVÉES === */
.key-disabled {
  opacity: 0.33;
  pointer-events: none;
}

/* ===================================================== */
/* === ZONE ACCORDS (AU-DESSUS DU PIANO) === */
/* ===================================================== */

.chord-groups {
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 20px auto 24px;
  transform: translate(351.6px, -15px);
  max-width: 900px;
  padding: 0 12px;
  --gold: #c9a24d;
}

/* === UNE CATÉGORIE (UNE LIGNE) === */
.chord-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-start;
  width: fit-content;
}

/* === TITRE DE CATÉGORIE === */
.chord-group-title {
  min-width: 200px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--gold);
  text-align: right;
}

/* === CONTENEUR DES BOUTONS === */
.chord-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

/* ===================================================== */
/* === BOUTONS D’ACCORDS (STRUCTURE + APPARENCE) === */
/* ===================================================== */

.chord-btn {
  /* structure */
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  /* reset ancien système */
  padding: 0;
  border: 2px solid transparent;
  background: transparent;
  cursor: pointer;

  /* apparence */
  font-size: 0.95rem;
  border-radius: 30px; /* pilule */

  /* transitions */
  transition: background 0.15s ease, box-shadow 0.15s ease, border 0.15s ease;
}

/* === TAILLES DE BOUTONS === */
.chord-btn.size-1 { width: 40px; height: 24px; }
.chord-btn.size-2 { width: 56px; height: 24px; }
.chord-btn.size-3 { width: 72px; height: 24px; }
.chord-btn.size-4 { width: 96px; height: 24px; }

/* === POSITION INDIVIDUELLE DES BOUTONS ( Slash Chords )=== */
.chord-btn.pos-1 {
  --tx: 50.5px;
  --ty: 22.6px;
  transform: translate(var(--tx), var(--ty));
}
.chord-btn.pos-1:active {
  transform: translate(var(--tx), var(--ty)) scale(0.96);
}
.chord-btn.pos-2 {
  --tx: -75px;
  --ty: 52.6px;
  transform: translate(var(--tx), var(--ty));
}
.chord-btn.pos-2:active {
  transform: translate(var(--tx), var(--ty)) scale(0.96);
}
.chord-btn.pos-3 {
  --tx: -196.7px;
  --ty: 82.4px;
  transform: translate(var(--tx), var(--ty));
}
.chord-btn.pos-3:active {
  transform: translate(var(--tx), var(--ty)) scale(0.96);
}


/* === AJUSTEMENT GLOBAL PAR LIGNE === */
.group-1 { transform: translate(-86px, -4px); }
.group-2 { transform: translate(-86px, -3.2px); }
.group-3 { transform: translate(-86px, -2.4px); }
.group-4 { transform: translate(-86px, -1.5px); }
.group-5 { transform: translate(-86px, -0.7px); }


/* === ÉTATS DES BOUTONS === */

/* Disabled */
.chord-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Hover inactif */
.chord-btn:hover:not(.active):not(:disabled) {
  background: #ffeccf;
}

/* Feedback au clic (temporaire) */
.chord-btn:active {
  transform: scale(0.96);
}

/* Actif */
.chord-btn.active {
  border-color: #ffefd7;
}

.locked {
  opacity: 0.35;
  filter: grayscale(1);
  cursor: not-allowed;
}

/* ===================================================== */
/* === LABEL (TEXTE UNIQUEMENT, NE DICTE PLUS LA FORME) === */
/* ===================================================== */

.chord-label {
  width: 100%;
  height: 100%;
  white-space: nowrap;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0;
  border: none;
  background: transparent;

  color: #4e3823;
  line-height: 1;
  pointer-events: none;
}

/* Label actif */
.chord-btn.active .chord-label {
  color: #ffefd7;
}

/* ===================================================== */
/* === MODES ♯ / ♭ === */
/* ===================================================== 

body.accidental-flat .chord-groups {
  background-image: url("chords-flat.png");
}

body.accidental-sharp .chord-groups {
  background-image: url("chords-sharp.png");
}

/* ===================================================== */
/* === INFO === */
/* ===================================================== */



.chord-name-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin-top: -92px;
  pointer-events: none !important;
}

#chord-name,
#btn-arpeggio,
#inversion-controls,
#inversion-controls button {
  pointer-events: auto;
}

#chord-name {
  font-size: 3rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1;
  padding: 2px 10px;
  background-color: rgba(255, 255, 255, 0);
  cursor: pointer;
  position: static; /* ← supprime le position absolute */
  margin-top: 0;
  transform: translateY(5px); /* ← ajustez la valeur */
  transition: opacity 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

#chord-name:hover {
  color: rgba(255, 255, 255, 0.9);
  transform: translateY(5px) scale(1.1);
}
#chord-name:active {
  transform: translateY(5px) scale(1);
}


#chord-notes {
  font-size: 1.5rem;      /* un peu plus grand */
  font-weight: 500;  
  color: rgba(255, 255, 255, 0.75); /* blanc légèrement opaque */
  margin-top: -19px;       /* le descend un peu */

  line-height: 0.2;
  padding: 2px 10px;


  background-color: #787f79;; /* EXACTEMENT la couleur du fond */
  z-index: 10;
}


/* ===================================================== */
/* === RESPONSIVE === */
/* ===================================================== */


/* ===================================================== */
/* === PIANO (INCHANGÉ) === */
/* ===================================================== */

#piano-wrapper {
  position: relative;
  max-width: 1400px;
  margin: 0 auto;
  transform: scale(1.3);
}

.white-key {
  box-sizing: border-box;
}

.white-key:not(:last-child) {
  margin-right: 0.01%;
}

/* === LABELS AVEC # OU ♭ === */
.chord-btn.has-accidental .chord-label {
  font-size: 0.92em; /* léger, ajustable */
}

.info {
  display: flex;
  flex-direction: column;
  align-items: center;
  
  border: 1.9px solid rgba(255, 255, 255, 0.5);
  border-radius: 25px;

  width: 923px;

  padding: 12px 16px;
  margin: 120px auto;
  box-shadow: 0 0px 7px rgba(0,0,0,0.1);
}

.info.info-initial {
  height: 77px;   /* plus petit, ajuste selon le rendu */
}

.info.info-root-selected {
  height: 77px;   /* plus petit, ajuste selon le rendu */

}
.info.info-chord-selected {
  height: 93px;  /* ta valeur actuelle */
}

.piano-scene {
  transform: translateY(22px);
  position: relative;
}

.instructions {
  font-size: 1.3em;
  font-style: italic;
  color: rgba(255, 255, 255, 0.70);
  transform: translateY(-15px);
  white-space: pre-line;
  line-height: 0.6;
}


/* Legendes */
:root {
  --bass-color: rgb(120, 120, 255); /* bleu pastel pour la basse, par exemple */
}

#legend {
  margin-top: 0px;
  letter-spacing: 0.02em;
  text-align: center;
}


.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 12px;
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.8);
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.description-wrapper {
  height: 35px;              /* à ajuster */
  display: flex;
  align-items: center;       /* centrage vertical du texte */
  justify-content: center;
}

#chord-description {
  font-size: 1.07rem;
  white-space: pre-line;
  text-align: center;
  font-style: italic;
  color: rgba(255, 255, 255, 0.6);
}



/* ===================================================== */
/* === NOTES DES ACCORDS === */
/* ===================================================== */


.chord-note {
  margin-right: 9px; /* espace léger */
}
.chord-note:last-child {
  margin-right: 0;
}


/*" BOUTON # / b " */
#accidental-toggle,
#accidental-toggle * {
   font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
   font-variant-ligatures: none;
}

#accidental-toggle {
  position: absolute;            /* n’influence pas le layout */
  bottom: -48px;                  /* à ajuster */
  right: 323px;                   /* à ajuster */

  width: 40px;
  height: 23px;
  border-radius: 13px;

  background: #828a84;
  border: 1.6px solid rgba(255, 255, 255, 0.5);

  color: rgba(255, 255, 255, 0.75);
  font-size: 1rem;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.1em;
  line-height: 1;

  box-shadow: 0 0px 6px rgba(0,0,0,0.1);
  transition: background 0.2s ease, transform 0.15s ease;

  cursor: pointer;
  z-index: 9999999999;
  pointer-events: auto;
}

#accidental-toggle span {
  display: inline-block;     /* permet de bouger le texte séparément */
  position: relative;        /* pour décalages par rapport au bouton */
  top: 0.8px;                 /* remonte le texte de 2px */
  left: 0px;                 /* décale le texte de 3px vers la droite */
}

#accidental-toggle:hover {
  background: #98a19a;
  color: white;
  border: 1.6px solid rgba(255, 255, 255, 0.9);
  transform: scale(1.1);
}

/* Click : micro compression */
#accidental-toggle:active {
  transform: scale(1);
}

.accidental-separator {
  margin: 0 -0.30em;   /* 🔑 rapproche ♭ et ♯ */
}

.accidental-flat,
.accidental-sharp {
  font-size: 1em;      /* héritent du bouton */
}


/* "BOUTON D'OCTAVE" */
#octave-toggle.disabled {
  pointer-events: none;
  opacity: 0.26;  /* optionnel, donne un retour visuel */
}

#octave-toggle {
  position: absolute;          
  right: 674.5px;                  
  bottom: 256px;

  width: 56px;
  height: 56px;

  border: 0px solid rgba(212, 175, 55, 0);
  border-radius: 6px 6px 56px 6px; /* top-left, top-right, bottom-right, bottom-left */

  background: rgb(214, 169, 115, 0);

  cursor: pointer;
  z-index: 10;

  overflow: hidden;
  
  display: flex;
  justify-content: center;
  align-items: center;

  color: transparent;
  transition: transform 0.1s ease; /* mouvement du bouton */
}

#octave-toggle:hover {
  background-color: rgb(214, 169, 115); /* #ffeccf avec 50% d'opacité */
    transform: scale(105%);
}

/* texte via pseudo-élément, redressé */
#octave-toggle::after {
  content: "C" attr(data-octave);             
  position: absolute;
  top: 41%;
  left: 44%;
  transform: translate(-53%, -50%); /* juste redresser le texte */
  color: #ffeccf;
  pointer-events: none;
  user-select: none;
  font-weight:999;
  font-size: 1.6rem;
}

/* effet bouton enfoncé */
#octave-toggle:active {
  transform: scale(1); /* enfoncement vertical seulement */
}


/* CSS pour les labels de C2 C3 C3*/
.key-label {
  position: absolute;
  bottom: 9.29px;
  left: 50%;
  transform: translateX(-48%);

  font-size: 12px;
  font-weight: 900;
  color: rgb(0, 0, 0);
  opacity: 0.15;

  background: none;
  z-index: 9999;     /* FORCE AU-DESSUS DE TOUT */
  pointer-events: none;
}

/* posotions individuelles */
.key-label.do-0 {
  left: 48%;
}
.key-label.do-1 {
  left: 49.4%;
}
.key-label.do-2 {
  left: 50.3%;
}

/* BOUTON ARPEGGIO */
#btn-arpeggio {
  position: absolute;               
  bottom: 46px;
  z-index: 1000;

  width: 50px;         /* largeur fixe */
  height: 28px;        /* hauteur = largeur → carré */
  border-radius: 17px;  /* arrondi des coins, pas 50% sinon cercle */

  background: #828a84;
  border: 1.9px solid rgba(255, 255, 255, 0.5);

  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;

  line-height: 1;

  cursor: pointer;
  box-shadow: 0 0px 6px rgba(0,0,0,0.1);
  transition: background 0.2s ease, transform 0.15s ease;
  transform: translateX(-10px);
}

#btn-arpeggio span {
  display: inline-block;     /* permet de bouger le texte séparément */
  position: relative;        /* pour décalages par rapport au bouton */
  top: 0.7px;                 /* remonte le texte de 2px */
  left: 0.6px;                 /* décale le texte de 3px vers la droite */
}

#btn-arpeggio:hover {
  background: #98a19a;
  color: white;
  border: 1.6px solid rgba(255, 255, 255, 0.9);
  transform: translateX(-10px) scale(1.1);
}

#btn-arpeggio:active {
  transform: translateX(-10px) scale(1);
  color: white;
}

/* Police des boutons */
.chord-label,
.chord-label * {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-variant-ligatures: none;
}

/* PARTITION */
#score-container {
  position: absolute;
  left: 155px;
  top: -139px;

  width: 179px;
  height: 327px;

  background: #d5dad6;
  z-index: 1;
  pointer-events: none;

  border-radius: 33px;
}

#score-container svg g[type="Accidental"] path {
  transform: scale(1.55);
  transform-origin: center;
  transform-box: fill-box;
}

#score-container svg {
  transform: scale(1.15);
  transform-origin: top left;
}



/* RENVERSEMENTS */
#inversion-controls {
  position: absolute;
  display: flex;
  gap: 6px;
  align-items: center;
}

.inv-btn {
  width: 30px;         /* largeur fixe */
  height: 23px;        /* hauteur = largeur → carré */
  border-radius: 13px;  /* arrondi des coins, pas 50% sinon cercle */

  background: #828a84;
  border: 1.6px solid rgba(255, 255, 255, 0.5);

  color: rgba(255, 255, 255, 0.7);
  font-size: 0.7rem;

  line-height: 1;

  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 0px 6px rgba(0,0,0,0.1);
  transition: background 0.2s ease, transform 0.15s ease;

  transform: translateY(-13px);

}

.inv-btn:hover {
  background: #98a19a;
  color: white;
  border: 1.6px solid rgba(255, 255, 255, 0.9);
  transform: translateY(-13px) scale(1.1);
}

.inv-btn:active {
  transform: translateY(-13px) scale(1);
  color: white;

}

.inv-btn.active {
  background: #8ac198;
  border: 1.6px solid rgba(255, 255, 255, 0.9);
  color: rgba(255, 255, 255, 0.9);
  font-weight: 700;
}

/* MODALS */
.modal {
    position: fixed;
    inset: 0;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.33);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999; /* ← augmenté pour passer au dessus de tout */
    opacity: 0;
    transition: opacity 0.33s ease;
    backdrop-filter: blur(0px);
}

/* Cache par défaut */
.hidden {
    opacity: 0;
    pointer-events: none;
}

#accordium-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
}

#accordium-modal:not(.hidden) {
    opacity: 1;
    backdrop-filter: blur(6px);
    background: rgba(255, 255, 255, 0.55); /* ← fond blanc semi-transparent */
}

#accordium-modal .accordium-modal-content {
    background: transparent;
    padding: 20px;
    width: min(100vh, 90vw);
    max-width: 95%;
    border-radius: 18px;
    transform: scale(0.93);
    opacity: 0;
    transition: transform 0.93s ease, opacity 0.93s ease;
    margin: 15px auto 0;
    text-align: center;
}


#accordium-modal:not(.hidden) .accordium-modal-content {
    transform: scale(1);
    opacity: 1;
}

#accordium-modal .accordium-modal-content img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    display: block;
}

#accordium-modal-body {
    transform: translateY(10px);
    transition: transform 0.2s ease;
}

#accordium-modal:not(.hidden) #accordium-modal-body {
    transform: translateY(0);
}

/* BOÎTE */
.modal-content {
    background: #1e1e1e;
    color: white;
    padding: 40px;
    border-radius: 18px;
    width: 420px;
    max-width: 90%;
    position: relative;
    text-align: center;
    transform: scale(0.93);
    opacity: 0;
    transition: transform 0.93s ease, opacity 0.93s ease;
}

/* Croix */
.close-modal {
    position: absolute;
    top: 10px;
    right: -280px;
    font-size: 33px;
    cursor: pointer;
    opacity: 0.7;
    color: rgba(0, 0, 0, 0.3); /* ← sombre sur fond blanc */
    font-weight: 700;
}

.close-modal:hover {
    opacity: 1;
    color: rgba(0, 0, 0, 0.7);
}



@keyframes fadeIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
}

.btn-inscription {
  display: inline-block;
  position: relative;
  top: -13px;
  padding: 12px 28px;
  background: #b30000;
  color: white;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-inscription:hover {
  background: #c40000;
  transform: scale(1.08);
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.22);
}

.btn-inscription:active {
  transform: scale(0.98);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
}


.arc-de-cercle {
    position: fixed;
    right: 0px;
    top: 50%;
    transform: translateY(-50%);
    width: 94px;
}


.back-link {
  position: absolute;
  top: 12px;
  left: 40px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.56);
  text-decoration: none;
  transition: color 0.2s;
  z-index: 9999999999999;
}
.back-link:hover { color: #e4ff9e }


.modal-note {
  margin-top: 13px;
  font-size: 11px;
  color: rgba(2, 44, 0, 0.5);
  line-height: 1.6;
  white-space: nowrap;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  display: inline-block;
}
.modal-note-main { color: rgba(2, 44, 0, 0.85); font-weight: 600; font-size: 14px; }
.modal-note-sub  { color: rgba(2, 44, 0, 0.85); font-weight: 500; font-size: 12px; }

.acc-svg { display: none; }

/* ===================================================== */
/* === RESPONSIVE : ACCORDIUM === */
/* (--ui-scale est défini dans auth.css) */
/* ===================================================== */

/* Empêche iOS de regonfler le texte en paysage */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* --- Tactile (toutes tailles) --- */
.chord-btn, .white-key, .black-key,
#octave-toggle, #accidental-toggle, #btn-arpeggio, .inv-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Pas de :hover "collant" sur écran tactile */
@media (hover: none) {
  .chord-btn:hover:not(.active):not(:disabled) { background: transparent; }
  #accidental-toggle:hover {
    background: #828a84; color: rgba(255,255,255,0.75);
    border-color: rgba(255,255,255,0.5); transform: none;
  }
  #btn-arpeggio:hover {
    background: #828a84; color: rgba(255,255,255,0.7);
    border-color: rgba(255,255,255,0.5); transform: translateX(-10px);
  }
  .inv-btn:not(.active):hover {
    background: #828a84; color: rgba(255,255,255,0.7);
    border-color: rgba(255,255,255,0.5); transform: translateY(-13px);
  }
}

/* --- Scène réduite (is-scaled est activé en JS sous 1400px) --- */
body.is-scaled #stage-fit { overflow-x: clip; }
body.is-scaled #stage {
  width: 1400px;               /* largeur de conception */
  display: flow-root;
  transform-origin: 0 0;
}

/* Zone de tap agrandie sur les boutons d'accords */
body.is-scaled .chord-btn::before {
  content: "";
  position: absolute;
  inset: -4px;
}

/* --- Sous 1400px --- */
@media (max-width: 1399px) {

  /* Pas de défilement horizontal, défilement vertical libre */
  html, body {
    overflow-x: clip;
    max-width: 100%;
    touch-action: pan-y pinch-zoom;
  }
  body { overflow-y: visible; }

  /* Éléments retirés */
  .arc-de-cercle { display: none; }
  body.page-accordium .social-links { display: none; }  /* "body." : bat la règle d'auth.css */

  /* Titre */
  h1.page-title {
    transform: none;
    margin-top: 0;
    padding-top: 24px;
  }
  .title-image {
    width: 166px;
    transform: scale(1.2);
    margin-top: 0;
    margin-bottom: 59px;
  }

  /* Bloc d'information recentré (dépend de CONTENT_LEFT / CONTENT_WIDTH dans script.js) */
  body.is-scaled .info {
    position: relative;
    left: -110px;
  }

  /* Toggle ♭|♯ : suit le décalage du bloc info (323px + 110px / 1,3 ≈ 408, ajusté à 416) */
  body.is-scaled #accidental-toggle { right: 416px; }

  /* Boutons ronds : centrage par flex, sans décalages manuels */
  #btn-arpeggio,
  .inv-btn,
  #accidental-toggle {
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    text-align: center;
  }
  #btn-arpeggio span,
  #accidental-toggle span { top: 0; left: 0; }

  /* Séparateur dessiné en CSS plutôt que le caractère "｜" */
  .accidental-separator {
    font-size: 0;
    width: 1.5px;
    height: 12px;
    margin: 0 5px;
    background: currentColor;
    opacity: 0.6;
    border-radius: 1px;
  }
    #accidental-toggle .accidental-flat,
  #accidental-toggle .accidental-sharp {
    display: inline-flex;
    align-items: center;
  }
  #accidental-toggle .acc-txt { display: none; }
  #accidental-toggle .acc-svg {
    display: block;
    width: 7px;
    height: 12px;
  }

  /* --- AUTH : fixe, coin haut droit, réduite par un simple scale --- */
  .page-accordium #auth-area {
    top: 8px;
    right: 10px;
    transform: scale(var(--ui-scale));
    transform-origin: top right;
  }
  .page-accordium #guest-buttons { gap: 6px; }

  /* Un bloc masqué ne doit plus occuper de place */
  .page-accordium #guest-buttons.hidden,
  .page-accordium #user-area.hidden { display: none; }

  /* Le -93px d'auth.css est calé sur l'accueil */
  .page-accordium #user-badge-btn {
    margin-top: 0;
    margin-right: 0;
  }
  .page-accordium #user-menu {
    top: calc(100% + 4px);
    right: 0;
  }

  /* Toasts : même échelle, sous le badge */
  .page-accordium #toast-container {
    top: 40px;
    right: 10px;
    transform: scale(var(--ui-scale));
    transform-origin: top right;
  }
}

/* --- Petits écrans --- */
@media (max-width: 800px) {
  .back-link { left: 14px; font-size: 13px; }

  /* Modale : la croix était à right:-280px, donc hors écran */

  /* !important légitime : on neutralise des styles écrits en ligne par le JS */
  #accordium-modal-body div[style*="nowrap"] {
    white-space: normal !important;
    display: block !important;
    left: auto !important;
    transform: none !important;
  }
}

/* === ÉCRAN "TOURNE TON TÉLÉPHONE" (portrait téléphone) === */
#rotate-overlay {
  display: none;
  width: 100%;
  box-sizing: border-box;
}

/* === MODALE D'INSCRIPTION (Accordium) === */
@media (max-width: 1399px) {

  /* La modale devient le conteneur de défilement (un téléphone en paysage fait ~375px de haut) */
  #accordium-modal {
    width: 100%;
    height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    align-items: flex-start;
  }

  /* Bloque le défilement de la page derrière */
  body:has(#accordium-modal:not(.hidden)) { overflow: hidden; }

  #accordium-modal .accordium-modal-content {
    box-sizing: border-box;
    width: min(560px, 100%);
    max-width: 100%;
    margin: auto;                    /* centrée si courte, calée en haut si elle dépasse */
    padding: 12px calc(10px + env(safe-area-inset-right, 0px))
             calc(20px + env(safe-area-inset-bottom, 0px))
             calc(10px + env(safe-area-inset-left, 0px));
  }

   #accordium-modal .accordium-modal-content img {
    width: 70%;
    max-width: none;
    margin: 0 auto;
    border-radius: 10px;
  }

  /* Croix : collante en haut, zone tactile de 44px, posée sur l'image */
  #accordium-modal .close-modal {
    position: sticky;
    top: 8px;
    right: auto;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0 0 -44px auto;
    font-size: 30px;
    line-height: 1;
    opacity: 1;
    color: rgba(0, 0, 0, 0.6);
    background: rgba(255, 255, 255, 0.75);
    border-radius: 50%;
  }

  /* Bouton : confortable au pouce */
  #accordium-modal .btn-inscription {
    top: 0;
    margin-top: 10px;
    min-height: 48px;
    padding: 14px 30px;
    font-size: 17px;
  }

  /* Note : passe à la ligne au lieu de déborder */
  #accordium-modal .modal-note {
    display: block;
    left: auto;
    transform: none;
    white-space: normal;
    padding: 0 6px;
  }
  #accordium-modal .modal-note-main { font-size: 12px; }
  #accordium-modal .modal-note-sub  { font-size: 11px; }
}

/* Doit rester APRÈS le bloc 1399px : ses règles html/body doivent gagner */
@media (orientation: portrait) and (max-width: 599px) {

  html, body {
    height: 100%;
    overflow: hidden;
  }

  /* !important légitime : le JS écrit height en ligne sur #stage-fit */
  #stage-fit {
    position: absolute;
    top: 0; left: 0;
    width: 0;
    height: 0 !important;
    overflow: hidden;
    visibility: hidden;
  }

  #rotate-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 26px;
    position: fixed;
    inset: 0;
    height: 100dvh;
    z-index: 2147483647;
    background: #787f79;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    padding: 0 30px;
    touch-action: none;
  }
  #rotate-overlay p {
    margin: 0;
    font-size: 1.05rem;
    font-style: italic;
    line-height: 1.5;
  }
  .rotate-phone {
    width: 30px;
    height: 52px;
    border: 3px solid rgba(255, 255, 255, 0.8);
    border-radius: 7px;
    animation: rotatePhone 2.4s ease-in-out infinite;
  }
}

@keyframes rotatePhone {
  0%, 20%   { transform: rotate(0deg); }
  60%, 100% { transform: rotate(-90deg); }
}