:root {
  --fond: #f6f1e7;
  --carte: #fffdf8;
  --texte: #1f2421;
  --doux: #6b6f68;
  --ligne: #e3dccd;
  --accent: #e0752d;
  --accent-fonce: #b8571a;
  --vert: #2f8f5b;
  --rouge: #c0392b;
  --bois: #8a5a33;
  --point: #1f2421;
  --nav: #1d2a24;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #141a17;
    --carte: #1e2622;
    --texte: #eef0ea;
    --doux: #a3aaa2;
    --ligne: #33403a;
    --accent: #f0893f;
    --accent-fonce: #f6a76b;
    --vert: #4cc283;
    --rouge: #ef6b5b;
    --bois: #d39a6a;
    --point: #eef0ea;
    --nav: #0e1411;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
main { max-width: 760px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 16px 24px; }
h1 { font-size: 1.7rem; margin: .3em 0 .2em; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; margin: 1.4em 0 .5em; }
h3 { font-size: 1.05rem; margin: 0 0 .6em; }
h3 small, h2 small { color: var(--doux); font-weight: 400; font-size: .8em; }
a { color: var(--accent-fonce); }
.petit-texte { color: var(--doux); font-size: .88rem; }
.surtitre { color: var(--doux); margin: 0; font-size: .9rem; }
.retour { display: inline-block; margin: 4px 0; text-decoration: none; font-weight: 600; }
.gros { font-size: 1.5rem; font-weight: 700; text-align: center; color: var(--accent-fonce); margin: .4em 0; }
.alerte { color: var(--rouge); }

/* navigation */
nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; background: var(--nav); padding-bottom: env(safe-area-inset-bottom);
}
nav a {
  flex: 1; text-align: center; color: #c6cfc8; text-decoration: none; font-size: .75rem; padding: 8px 0 10px;
}
nav a span { display: block; font-size: 1.35rem; line-height: 1.2; }
nav a.on { color: #ffb37a; }

/* cartes, boutons */
.carte { background: var(--carte); border: 1px solid var(--ligne); border-radius: 14px; padding: 16px; margin: 12px 0; }
.carte.texte p:first-child { margin-top: 0; }
.carte.texte p:last-child { margin-bottom: 0; }
.btn {
  appearance: none; border: 1px solid var(--ligne); background: var(--carte); color: var(--texte);
  border-radius: 999px; padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block;
}
.btn:disabled { opacity: .5; }
.btn.principal { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.grand { display: block; text-align: center; padding: 14px 18px; margin: 10px 0; font-size: 1.05rem; }
.btn.bon { background: var(--vert); border-color: var(--vert); color: #fff; }
.btn.faux { background: var(--rouge); border-color: var(--rouge); color: #fff; opacity: .75; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ligne { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.ligne.centre { justify-content: center; align-items: center; }
.defile { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; }
.options { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0; font-size: .92rem; }
.options input { accent-color: var(--accent); }
.tempo, .champ { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: .92rem; }
.tempo input { flex: 1; accent-color: var(--accent); }
.tempo b { min-width: 2.5em; text-align: right; }
select { font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--ligne); background: var(--carte); color: var(--texte); max-width: 100%; }

/* accueil */
.hero { padding: 6px 0; }
.hero h1 { font-size: 2.2rem; margin-bottom: 0; }
.hero p { margin: .2em 0; }
.barre { height: 10px; background: var(--ligne); border-radius: 99px; overflow: hidden; margin: 12px 0 4px; }
.barre div { height: 100%; background: var(--vert); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats div { background: var(--carte); border: 1px solid var(--ligne); border-radius: 12px; padding: 10px; text-align: center; }
.stats b { display: block; font-size: 1.5rem; }
.stats small { color: var(--doux); font-size: .78rem; }
.seance { padding-left: 1.3em; }
.seance li { margin: 6px 0; }
.seance a { text-decoration: none; color: var(--texte); font-weight: 600; }
.seance small { color: var(--doux); font-weight: 400; }

/* parcours */
.niveau h2 { display: flex; align-items: center; gap: 10px; }
.num { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .95rem; }
.lecons { list-style: none; padding: 0; margin: 0; }
.lecons a { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--ligne); background: var(--carte); border-radius: 12px; margin: 6px 0; color: var(--texte); text-decoration: none; }
.lecons small { margin-left: auto; color: var(--doux); }
.lecons .etat { width: 22px; text-align: center; color: var(--vert); font-weight: 700; }
.lecons .suiv a { border-color: var(--accent); }
.lecons .suiv .etat { color: var(--accent); }
.lecons .fait a { opacity: .8; }
.fin-lecon { margin: 20px 0; }
.bravo { font-size: 1.2rem; font-weight: 700; color: var(--vert); text-align: center; }

/* diagrammes */
.accord { appearance: none; border: 1px solid var(--ligne); background: var(--carte); color: var(--texte); border-radius: 12px; padding: 6px 6px 4px; display: flex; flex-direction: column; align-items: center; cursor: pointer; font: inherit; min-width: 96px; }
.accord.petit { min-width: 80px; padding: 4px; }
.accord .code { font-weight: 800; font-size: 1.05rem; }
.accord .nom { font-size: .72rem; color: var(--doux); }
.accord:active { transform: scale(.97); }
.diag .frette { stroke: var(--doux); stroke-width: 1.2; }
.diag .sillet { stroke: var(--texte); stroke-width: 4; }
.diag .corde { stroke: var(--bois); stroke-width: 1.4; }
.diag .point { fill: var(--point); }
.diag .vide { fill: none; stroke: var(--texte); stroke-width: 1.4; }
.diag .doigt { fill: var(--carte); font-size: 10px; font-weight: 700; text-anchor: middle; font-family: system-ui, sans-serif; }
.diag .base { fill: var(--doux); font-size: 11px; font-family: system-ui, sans-serif; }

/* écoute accord */
.micacc .ligne { align-items: center; }
.micacc-etat { flex: 1; min-width: 160px; }
.pastilles { display: flex; gap: 8px; margin-bottom: 8px; }
.pastilles i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--ligne); }
.pastilles i.ok { background: var(--vert); border-color: var(--vert); }
.jauge { height: 8px; background: var(--ligne); border-radius: 99px; overflow: hidden; }
.jauge div { height: 100%; width: 0; background: var(--accent); transition: width .1s; }
.entendu { color: var(--doux); font-size: .9rem; min-height: 1.4em; }
.micacc.reussi { border-color: var(--vert); }

/* boucle / rythme */
.motif { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 4px; text-align: center; }
.motif .sub { font-size: 1.4rem; font-weight: 800; border-radius: 8px; padding: 4px 0; background: var(--fond); overflow: hidden; white-space: nowrap; text-overflow: clip; }
.motif .sub.on { background: var(--accent); color: #fff; }
.motif.comptes { color: var(--doux); font-size: .8rem; margin-top: 2px; }
.scene { position: relative; display: flex; align-items: center; justify-content: center; gap: 18px; margin: 12px 0 6px; }
.scene .ensuite { color: var(--doux); font-size: .9rem; text-align: center; }
.scene .ensuite b { font-size: 1.6rem; color: var(--texte); }
.decompte { position: absolute; inset: 0; display: grid; place-items: center; font-size: 4rem; font-weight: 900; color: var(--accent); pointer-events: none; }
.decompte:empty { display: none; }
.temps-points { display: flex; justify-content: center; gap: 10px; margin: 8px 0; }
.temps-points i { width: 14px; height: 14px; border-radius: 50%; background: var(--ligne); }
.temps-points i:first-child { outline: 2px solid var(--ligne); outline-offset: 2px; }
.temps-points i.on { background: var(--accent); }
.temps-points.grands i { width: 26px; height: 26px; }

/* défi minute */
.minute-ecran { display: grid; grid-template-columns: 1fr 1fr; align-items: center; text-align: center; margin: 12px 0; }
.chrono { font-size: 2.6rem; font-weight: 900; }
.score { font-size: 2.6rem; font-weight: 900; color: var(--vert); }
.record { grid-column: 1 / -1; color: var(--doux); }

/* tablature */
.tab { padding: 4px 0; font-family: ui-monospace, Menlo, monospace; }
.tab-ligne { display: flex; margin: 0 0 12px; }
.tab-noms, .tcol { display: flex; flex-direction: column; }
.tab-noms span, .tcol span { height: 22px; line-height: 22px; text-align: center; font-size: .95rem; }
.tab-noms span { width: 18px; color: var(--doux); font-weight: 700; }
.tcol { flex: 1; max-width: 40px; border-radius: 6px; }
.tcol span { background: linear-gradient(to bottom, transparent 10.5px, var(--doux) 10.5px, var(--doux) 11.5px, transparent 11.5px); font-weight: 800; }
.tcol span:not(:empty) { background: none; }
.tcol.on { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.tcol.joue { background: color-mix(in srgb, var(--vert) 30%, transparent); }
.tcol.ok span { color: var(--vert); }

/* quiz */
.choix { display: flex; flex-direction: column; gap: 8px; }
.choix .btn { text-align: left; border-radius: 12px; }
.explication { color: var(--vert); font-weight: 600; }

/* morceaux */
.recherche { width: 100%; font: inherit; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--ligne); background: var(--carte); color: var(--texte); }
.filtres { display: flex; gap: 6px; overflow-x: auto; margin: 10px 0; padding-bottom: 4px; }
.puce { appearance: none; border: 1px solid var(--ligne); background: var(--carte); color: var(--texte); border-radius: 99px; padding: 6px 12px; white-space: nowrap; font: inherit; font-size: .88rem; }
.puce.on { background: var(--texte); color: var(--fond); }
.morceau-lien { display: flex; justify-content: space-between; align-items: center; gap: 10px; text-decoration: none; color: var(--texte); margin: 8px 0; padding: 12px 14px; }
.morceau-lien small { display: block; color: var(--doux); }
.puces { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; max-width: 45%; }
.puces span { font-size: .75rem; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--fond); border: 1px solid var(--ligne); }

/* lecteur de morceau */
.reglages .champ select { flex: 1 1 0; min-width: 0; width: 100%; }
.partition { margin: 14px 0 120px; }
.pligne { margin: 0 0 16px; }
.mesures { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.mesure { border: 1px solid var(--ligne); background: var(--carte); border-radius: 10px; padding: 8px 6px 6px; text-align: center; transition: background .1s; display: flex; flex-direction: column; justify-content: space-between; }
.mesure .acc b { font-size: 1.15rem; margin: 0 3px; }
.mesure .mots { display: block; font-size: .92rem; line-height: 1.25; margin-top: 4px; min-height: 1.2em; }
.pligne .section { margin: 0 2px 4px; }
.karaoke { display: block; font-size: 1.15rem; font-weight: 700; color: var(--accent-fonce); line-height: 1.2; }
.mesure.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.tps { display: flex; justify-content: center; gap: 4px; margin-top: 4px; }
.tps i { width: 6px; height: 6px; border-radius: 50%; background: var(--ligne); }
.mesure.on .tps i { background: rgba(255, 255, 255, .45); }
.mesure.on .tps i.on { background: #fff; }
.paroles { margin: 6px 2px 0; font-size: 1.02rem; }
.section { margin: 6px 2px 0; color: var(--doux); font-style: italic; }
.lecteur {
  position: fixed; left: 0; right: 0; bottom: calc(60px + env(safe-area-inset-bottom)); z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 760px; margin: 0 auto; padding: 8px 16px; background: color-mix(in srgb, var(--fond) 92%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--ligne);
}
.lecteur .decompte { position: absolute; inset: auto 0 100%; height: 80px; font-size: 3.4rem; }
.lect-accord { display: flex; align-items: center; gap: 10px; min-height: 60px; }
.lect-accord b { font-size: 1.6rem; display: block; }
.lect-accord small { color: var(--doux); }
.btn.rond { width: 60px; height: 60px; border-radius: 50%; padding: 0; font-size: 1.4rem; flex: none; }

/* outils */
.grille-outils { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.outil { text-decoration: none; color: var(--texte); margin: 0; }
.outil b { display: block; font-size: 1.05rem; }
.outil small { color: var(--doux); }
.metro-bpm { text-align: center; }
.metro-bpm b { font-size: 3.4rem; font-weight: 900; display: block; line-height: 1; }
.metro input[type=range] { width: 100%; accent-color: var(--accent); }

/* accordeur */
.acc-cordes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.acc-cordes button { appearance: none; border: 1px solid var(--ligne); background: var(--fond); color: var(--texte); border-radius: 12px; padding: 10px 0; font: inherit; }
.acc-cordes button b { display: block; font-size: 1.1rem; }
.acc-cordes button small { color: var(--doux); }
.acc-cordes button.actif { border-color: var(--accent); background: var(--accent); color: #fff; }
.acc-cordes button.actif small { color: #fff; }
.acc-ecran { text-align: center; margin: 16px 0; padding: 12px; border-radius: 14px; background: var(--fond); }
.acc-ecran.ok { background: color-mix(in srgb, var(--vert) 22%, var(--fond)); }
.acc-note { font-size: 3.2rem; font-weight: 900; line-height: 1.1; }
.acc-cents { color: var(--doux); }
.acc-jauge { position: relative; height: 34px; margin: 12px 8px 4px; background: linear-gradient(90deg, var(--rouge), var(--ligne) 40%, var(--vert) 50%, var(--ligne) 60%, var(--rouge)); border-radius: 8px; opacity: .9; }
.acc-centre { position: absolute; left: 50%; top: -4px; bottom: -4px; width: 2px; background: var(--texte); }
.acc-aiguille { position: absolute; left: 50%; top: 2px; bottom: 2px; width: 6px; margin-left: -3px; border-radius: 3px; background: var(--texte); transition: left .08s; }
.aide { color: var(--doux); font-size: .85rem; text-align: center; }

@media (max-width: 420px) {
  .mesures { grid-template-columns: repeat(2, 1fr); }
  .grille-outils { grid-template-columns: 1fr; }
  .motif .sub { font-size: 1.1rem; }
}
