/* =============================================================
   Répète — styles
   ============================================================= */
:root {
  --fond: #f7f3ef;
  --surface: #fffdfb;
  --surface-2: #f1ebe6;
  --encre: #241a1e;
  --encre-douce: #6e6267;
  --trait: #e6ddd7;
  --accent: #7a1f3d;
  --accent-fort: #5e1530;
  --accent-doux: #f3e3e8;
  --accent-texte: #ffffff;
  --repere: #8a7f84;
  --onde: #d5c9c4;
  --onde-jouee: #7a1f3d;
  --boucle: rgba(122, 31, 61, .12);
  --ombre: 0 1px 2px rgba(36, 26, 30, .06), 0 8px 24px rgba(36, 26, 30, .08);
  --rayon: 14px;
  --taille-paroles: 22px;
  --police-texte: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, ui-serif, serif;
  --police-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #161113;
    --surface: #201a1c;
    --surface-2: #2a2225;
    --encre: #f3ecee;
    --encre-douce: #ab9ea3;
    --trait: #382e32;
    --accent: #e27a9b;
    --accent-fort: #f094b1;
    --accent-doux: #3b2129;
    --accent-texte: #1d0f14;
    --repere: #9a8d92;
    --onde: #4a3f43;
    --onde-jouee: #e27a9b;
    --boucle: rgba(226, 122, 155, .16);
    --ombre: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--fond);
  color: var(--encre);
  font-family: var(--police-ui);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, label.pastille { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 22px; height: 22px; flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

.surtitre {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--encre-douce);
}

/* ---------- Connexion ---------- */
.page-connexion { display: grid; place-items: center; min-height: 100dvh; padding: 24px 16px; }
.connexion { width: 100%; max-width: 380px; }
.connexion-carte {
  background: var(--surface); border-radius: 22px; box-shadow: var(--ombre);
  padding: 36px 28px 30px; text-align: center;
}
.connexion-logo { display: block; margin: 0 auto 18px; border-radius: 16px; }
.connexion h1 { font-family: var(--police-texte); font-size: 40px; margin: 4px 0 6px; color: var(--accent); font-weight: 600; }
.connexion-texte { margin: 0 0 26px; color: var(--encre-douce); }
.connexion form { display: grid; gap: 10px; text-align: left; }
.connexion label { font-size: 14px; font-weight: 600; }
.connexion input {
  font-size: 18px; padding: 13px 14px; border-radius: 12px;
  border: 1.5px solid var(--trait); background: var(--fond); color: var(--encre);
}
.connexion input:focus { outline: none; border-color: var(--accent); }
.erreur { margin: 0; color: #c0392b; font-size: 14px; }
.bouton-principal {
  margin-top: 8px; border: 0; border-radius: 12px; padding: 14px;
  background: var(--accent); color: var(--accent-texte); font-weight: 650; font-size: 17px;
}

/* ---------- Structure ---------- */
.appli {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}
.tiroir {
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--trait);
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  min-height: 0;
}
.tiroir-tete { display: flex; align-items: center; justify-content: space-between; padding: 22px 20px 14px; }
.marque { margin: 2px 0 0; font-family: var(--police-texte); font-size: 28px; font-weight: 600; color: var(--accent); }
.tiroir nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; -webkit-overflow-scrolling: touch; }
.liste-chants { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.liste-chants button {
  width: 100%; display: grid; grid-template-columns: 30px 1fr; gap: 4px 8px; align-items: center;
  text-align: left; border: 0; background: none; padding: 11px 12px; border-radius: 12px;
  min-height: 52px;
}
.liste-chants button:hover { background: var(--surface-2); }
.liste-chants .num { font-variant-numeric: tabular-nums; color: var(--encre-douce); font-size: 14px; font-weight: 600; }
.liste-chants .nom { font-weight: 600; font-size: 16px; line-height: 1.25; }
.liste-chants .info { grid-column: 2; font-size: 13px; color: var(--encre-douce); display: flex; gap: 6px; flex-wrap: wrap; }
.liste-chants .info .nb-reperes { color: var(--accent); }
.liste-chants button[aria-current="true"] { background: var(--accent-doux); }
.liste-chants button[aria-current="true"] .num,
.liste-chants button[aria-current="true"] .nom { color: var(--accent); }
.tiroir-pied {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--trait); font-size: 13px; color: var(--encre-douce);
}
.tiroir-pied a { color: inherit; }

.scene {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0; min-height: 0;
  padding-right: env(safe-area-inset-right);
}
.scene-tete {
  display: flex; align-items: center; gap: 12px;
  padding: calc(18px + env(safe-area-inset-top)) 28px 12px;
  border-bottom: 1px solid var(--trait);
  background: var(--fond);
}
.titre-bloc { flex: 1; min-width: 0; }
.titre-bloc h1 {
  margin: 2px 0 0; font-family: var(--police-texte); font-weight: 600;
  font-size: 30px; line-height: 1.15; letter-spacing: -.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.taille-texte { display: flex; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.taille-texte button {
  border: 0; background: none; width: 44px; height: 38px; border-radius: 999px;
  font-family: var(--police-texte); font-size: 18px; font-weight: 600;
}
.taille-texte button:first-child { font-size: 15px; }
.taille-texte button:hover { background: var(--surface); }
.taille-texte .petit { font-family: var(--police-ui); font-size: .7em; margin-left: 1px; }

.icone-bouton {
  border: 0; background: none; width: 44px; height: 44px; border-radius: 12px;
  display: inline-grid; place-items: center; flex: none;
}
.icone-bouton:hover { background: var(--surface-2); }

/* ---------- Paroles ---------- */
.paroles {
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 28px 28px 48px;
  font-family: var(--police-texte);
  font-size: var(--taille-paroles);
  line-height: 1.5;
  outline: none;
}
.paroles > * { max-width: 34em; margin-left: auto; margin-right: auto; }
.paroles p { margin: 0 auto 1.05em; }
.paroles .auteur { font-style: italic; color: var(--encre-douce); font-size: .8em; margin-top: -.4em; }
.paroles .partie {
  font-family: var(--police-ui); font-size: 12.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent); margin: 1.6em auto .5em;
}
.paroles .partie:first-child { margin-top: 0; }
.paroles .bis { font-weight: 600; letter-spacing: 0; text-transform: none; margin-left: 4px; }
.paroles .repere { font-style: italic; color: var(--repere); font-size: .86em; }
.paroles .voix {
  display: inline-block; font-family: var(--police-ui); font-style: normal; font-weight: 700;
  font-size: 11px; line-height: 1; letter-spacing: .03em;
  padding: 3px 5px; margin-right: 6px; border: 1px solid currentColor; border-radius: 5px;
  vertical-align: .25em;
}
.paroles .moi { color: var(--encre); font-weight: 700; }
.paroles .indic { font-family: var(--police-ui); font-size: .62em; color: var(--accent); font-weight: 600; }
.paroles .vide-paroles { color: var(--encre-douce); font-style: italic; }

/* ---------- Lecteur ---------- */
.lecteur {
  background: var(--surface);
  border-top: 1px solid var(--trait);
  box-shadow: 0 -10px 30px rgba(36, 26, 30, .05);
  padding: 14px 24px calc(14px + env(safe-area-inset-bottom));
}
.sans-piste { display: flex; align-items: center; gap: 10px; justify-content: center; color: var(--encre-douce); padding: 10px 0; }
.lecteur-corps { display: grid; gap: 10px; max-width: 1100px; margin: 0 auto; }
.ligne-haut { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.versions { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; }
.versions button {
  border: 0; background: none; border-radius: 999px; padding: 8px 16px; min-height: 38px;
  font-size: 15px; font-weight: 600; color: var(--encre-douce);
}
.versions button[aria-checked="true"] { background: var(--surface); color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.temps { font-variant-numeric: tabular-nums; font-size: 15px; color: var(--encre-douce); white-space: nowrap; }
.temps #t-actuel { color: var(--encre); font-weight: 600; }
.temps .sep { margin: 0 5px; opacity: .6; }

.onde-cadre { position: relative; height: 92px; touch-action: none; user-select: none; -webkit-user-select: none; }
#onde { width: 100%; height: 100%; display: block; cursor: pointer; }
.onde-chargement {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 14px; color: var(--encre-douce);
}

.passages-bloc { display: grid; gap: 4px; }
.passages {
  display: flex; gap: 6px; overflow-x: auto; padding: 2px 1px 4px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.passages::-webkit-scrollbar { display: none; }
.passage {
  flex: none; display: inline-flex; align-items: baseline; gap: 6px;
  border: 1.5px solid var(--trait); background: var(--surface); border-radius: 10px;
  padding: 7px 12px; min-height: 40px; font-size: 14.5px; font-weight: 600;
  max-width: 220px;
}
.passage .nom-passage { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.passage .duree { font-weight: 500; font-size: 12.5px; color: var(--encre-douce); font-variant-numeric: tabular-nums; }
.passage.en-cours { border-color: var(--onde); background: var(--surface-2); }
.passage[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-texte); }
.passage[aria-pressed="true"] .duree { color: inherit; opacity: .8; }
.astuce { margin: 0; font-size: 12.5px; color: var(--encre-douce); min-height: 1em; }

.commandes { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.groupe { display: flex; align-items: center; gap: 8px; }
.groupe.droite { flex-wrap: wrap; justify-content: flex-end; }
.rond {
  position: relative; border: 0; background: var(--surface-2); width: 50px; height: 50px; border-radius: 50%;
  display: grid; place-items: center;
}
.rond .mini { position: absolute; bottom: 7px; right: 8px; font-size: 10px; font-weight: 700; }
.rond:hover { filter: brightness(.97); }
.rond.lecture { width: 64px; height: 64px; background: var(--accent); color: var(--accent-texte); }
.rond.lecture svg { width: 30px; height: 30px; }
.pastille {
  display: inline-flex; align-items: center; gap: 7px; border: 1.5px solid var(--trait);
  background: var(--surface); border-radius: 999px; padding: 0 16px; height: 44px;
  font-size: 15px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.pastille svg { width: 19px; height: 19px; }
.pastille:hover { background: var(--surface-2); }
.pastille.accent { border-color: var(--accent); color: var(--accent); }
.pastille[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-texte); }
.pastille.danger { color: #b8323f; }
@media (prefers-color-scheme: dark) { .pastille.danger { color: #ff8a94; } }
.compteur {
  font-variant-numeric: tabular-nums; font-size: 12.5px; padding: 2px 7px; border-radius: 999px;
  background: rgba(255,255,255,.25);
}
#b-vitesse { min-width: 84px; justify-content: center; font-variant-numeric: tabular-nums; }
#b-vitesse.modifie { border-color: var(--accent); color: var(--accent); }

/* ---------- Menu vitesse ---------- */
.menu-flottant {
  position: fixed; z-index: 50; background: var(--surface); border-radius: 14px; box-shadow: var(--ombre);
  border: 1px solid var(--trait); padding: 6px; display: grid; gap: 2px; min-width: 150px;
}
.menu-flottant button {
  border: 0; background: none; text-align: left; padding: 11px 14px; border-radius: 9px;
  font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums;
  display: flex; justify-content: space-between; gap: 12px;
}
.menu-flottant button:hover { background: var(--surface-2); }
.menu-flottant button[aria-checked="true"] { color: var(--accent); }
.menu-flottant .aide { font-weight: 500; color: var(--encre-douce); font-size: 13px; }

/* ---------- Feuille (dialog) ---------- */
.feuille {
  border: 0; padding: 0; border-radius: 20px; background: var(--surface); color: var(--encre);
  width: min(620px, calc(100vw - 32px)); max-height: min(86dvh, 860px);
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.feuille[open] { display: flex; flex-direction: column; }
.feuille::backdrop { background: rgba(20, 12, 16, .4); }
.feuille-tete { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 8px 24px; border-bottom: 1px solid var(--trait); }
.feuille-tete h2 { margin: 0; font-size: 19px; }
.feuille-corps { overflow-y: auto; padding: 8px 24px 26px; -webkit-overflow-scrolling: touch; }
.feuille h3 {
  font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--encre-douce);
  margin: 22px 0 10px;
}
.liste-reperes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.liste-reperes li {
  display: grid; grid-template-columns: 26px minmax(0, 1fr) auto auto; align-items: center; gap: 8px;
  background: var(--surface-2); border-radius: 12px; padding: 8px 8px 8px 12px;
}
.liste-reperes .no { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.liste-reperes input {
  width: 100%; min-width: 0; border: 1.5px solid transparent; background: var(--surface); border-radius: 9px;
  padding: 8px 10px; font-size: 16px;
}
.liste-reperes input:focus { outline: none; border-color: var(--accent); }
.ajuste { display: flex; align-items: center; gap: 2px; }
.ajuste button {
  border: 0; background: var(--surface); border-radius: 8px; width: 38px; height: 38px; font-weight: 700;
  font-size: 13px;
}
.ajuste .t {
  min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; font-size: 14.5px; font-weight: 600;
  border: 0; background: none; height: 38px; border-radius: 8px;
}
.ajuste .t:hover { background: var(--surface); }
.liste-reperes .suppr { border: 0; background: none; width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center; color: var(--encre-douce); }
.liste-reperes .suppr:hover { color: #b8323f; background: var(--surface); }
.vide { color: var(--encre-douce); margin: 0; line-height: 1.5; }
.reglage { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 0; }
.reglage + .reglage { border-top: 1px solid var(--trait); }
.reglage-titre { margin: 0; font-weight: 600; }
.reglage-aide { margin: 3px 0 0; font-size: 13.5px; color: var(--encre-douce); line-height: 1.45; }
.segmente { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; flex: none; }
.segmente button { border: 0; background: none; border-radius: 8px; padding: 8px 11px; font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; min-width: 42px; }
.segmente button[aria-checked="true"] { background: var(--surface); color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.raccourcis { margin-top: 22px; font-size: 13px; color: var(--encre-douce); }
kbd {
  font-family: inherit; font-size: 12px; border: 1px solid var(--trait); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 6px; margin: 0 2px; background: var(--surface-2);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; top: calc(16px + env(safe-area-inset-top)); z-index: 60;
  transform: translate(-50%, -20px); opacity: 0; pointer-events: none;
  background: var(--encre); color: var(--fond); padding: 11px 18px; border-radius: 999px;
  font-size: 14.5px; font-weight: 600; transition: opacity .2s, transform .2s;
  max-width: calc(100vw - 32px);
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

.seulement-petit { display: none; }
.voile { display: none; }

/* ---------- iPad portrait / petites fenêtres ---------- */
@media (max-width: 900px) {
  .appli { grid-template-columns: minmax(0, 1fr); }
  .tiroir {
    position: fixed; inset: 0 auto 0 0; z-index: 40; width: min(320px, 86vw);
    transform: translateX(-102%); transition: transform .25s ease;
    box-shadow: var(--ombre);
  }
  .tiroir.ouvert { transform: none; }
  .voile { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(20, 12, 16, .35); }
  .seulement-petit { display: inline-grid; }
  .scene-tete { padding-left: 14px; padding-right: 16px; }
}

/* ---------- Téléphone ---------- */
@media (max-width: 600px) {
  :root { --taille-paroles: 19px; }
  .scene-tete { gap: 6px; padding: calc(10px + env(safe-area-inset-top)) 10px 8px 6px; }
  .titre-bloc h1 { font-size: 22px; }
  .taille-texte button { width: 38px; height: 34px; }
  .paroles { padding: 18px 18px 32px; }
  .lecteur { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
  .lecteur-corps { gap: 8px; }
  .versions button { padding: 7px 12px; font-size: 14px; min-height: 34px; }
  .temps { font-size: 13.5px; }
  .onde-cadre { height: 64px; }
  .commandes { justify-content: center; gap: 10px; }
  .groupe.droite { width: 100%; justify-content: space-between; flex-wrap: nowrap; gap: 6px; }
  .groupe.droite .pastille { padding: 0 11px; height: 40px; font-size: 14px; flex: 1 1 auto; justify-content: center; }
  #b-vitesse { min-width: 0; }
  .cache-petit { display: none; }
  .rond { width: 46px; height: 46px; }
  .rond.lecture { width: 58px; height: 58px; }
  .astuce { display: none; }
  .liste-reperes li { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .liste-reperes .ajuste { grid-column: 2 / 4; grid-row: 2; justify-content: flex-start; }
  .liste-reperes .suppr { grid-column: 3; grid-row: 1; }
  .reglage { flex-direction: column; align-items: flex-start; gap: 8px; }
  .feuille { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 20px 20px 0 0; }
  .feuille-corps { padding: 6px 16px calc(24px + env(safe-area-inset-bottom)); }
}
@media (max-height: 560px) and (min-width: 601px) {
  .onde-cadre { height: 64px; }
  .scene-tete { padding-top: calc(10px + env(safe-area-inset-top)); padding-bottom: 8px; }
  .titre-bloc h1 { font-size: 24px; }
}
