/* Polices hébergées avec le site (licence SIL OFL, voir polices/) : aucune requête vers un service tiers. */
@font-face { font-family: Fredoka; src: url("../polices/Fredoka.ttf") format("truetype"); font-weight: 300 700; font-stretch: 75% 125%; font-display: swap; }
@font-face { font-family: Jost; src: url("../polices/Jost.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }

/* le temps de charger la langue du joueur (langue.js) : rien ne s'affiche en français */
.attente-langue body { visibility: hidden; }

:root {
  --nuit: #0e1230;
  --nuit-2: #1a2058;
  --nuit-3: #262f78;
  --or: #ffd166;
  --or-fonce: #e8a93a;
  --texte: #f3f4ff;
  --texte-doux: #aab2e6;
  --verre: rgba(255, 255, 255, 0.06);
  --bord: rgba(255, 255, 255, 0.12);
  --ok: #7be0a0;
  --attention: #ffb37a;
  --ombre: 0 18px 40px -18px rgba(0, 0, 0, 0.6);
  --titre: Fredoka, "Trebuchet MS", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(120, 90, 255, 0.28), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(40, 130, 220, 0.22), transparent 60%),
    linear-gradient(180deg, var(--nuit), var(--nuit-2) 70%, var(--nuit-3));
  background-attachment: fixed;
  color: var(--texte);
  font: 17px/1.5 Jost, system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--titre); font-weight: 600; margin: 0; letter-spacing: 0.005em; }

button {
  font: 600 1rem/1 var(--titre);
  color: #2a1d00;
  background: linear-gradient(180deg, #ffe08f, var(--or) 45%, var(--or-fonce));
  border: 0;
  border-radius: 14px;
  padding: 0.85rem 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 0 #b9802a, 0 10px 24px -8px rgba(255, 190, 80, 0.55);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
button:hover { filter: brightness(1.05); }
button:active { transform: translateY(3px); box-shadow: 0 1px 0 #b9802a, 0 6px 16px -8px rgba(255, 190, 80, 0.5); }
button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
button.secondaire { background: var(--verre); color: var(--texte); box-shadow: inset 0 0 0 1px var(--bord); }
button.secondaire:active { transform: translateY(1px); }

.icone-bouton {
  width: 44px; height: 44px; padding: 0;
  display: grid; place-items: center;
  background: var(--verre); color: var(--texte);
  box-shadow: inset 0 0 0 1px var(--bord);
  border-radius: 12px;
}
.icone-bouton:active { transform: translateY(1px); box-shadow: inset 0 0 0 1px var(--bord); }
.icone-bouton svg { width: 22px; height: 22px; fill: currentColor; }
.icone-bouton svg.trace { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* ---- Décor de l'accueil : des notes qui tombent doucement derrière le contenu ---- */
#pluie { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }

/* ---- Accueil ---- */
#accueil { position: relative; z-index: 1; max-width: 1040px; margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) 16px 56px; }

.barre { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.marque { display: flex; align-items: center; gap: 10px; font: 600 1.5rem var(--titre); }
.marque img { border-radius: 11px; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.6); }
.barre-droite { display: flex; align-items: center; gap: 10px; }

.pastille {
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 1rem; border-radius: 999px;
  font: 500 0.95rem var(--titre);
  background: var(--verre); color: var(--texte);
  box-shadow: inset 0 0 0 1px var(--bord);
}
.pastille:active { transform: translateY(1px); box-shadow: inset 0 0 0 1px var(--bord); }
.voyant { width: 10px; height: 10px; border-radius: 50%; background: #6b7196; box-shadow: 0 0 0 3px rgba(107, 113, 150, 0.25); }
.pastille.ok .voyant { background: var(--ok); box-shadow: 0 0 0 3px rgba(123, 224, 160, 0.25), 0 0 12px var(--ok); }
.pastille.attention .voyant { background: var(--attention); box-shadow: 0 0 0 3px rgba(255, 179, 122, 0.25); }

.heros { margin: clamp(28px, 6vw, 64px) 0 clamp(22px, 4vw, 36px); max-width: 720px; }
.heros h1 { font-size: clamp(2.3rem, 6vw, 4rem); line-height: 1.02; font-weight: 600; text-wrap: balance; }
.heros h1 span {
  background: linear-gradient(90deg, #ff6b7a, var(--or) 35%, #7be0a0 65%, #5fb3ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.heros p { color: var(--texte-doux); font-size: 1.1rem; margin: 0.9rem 0 0; max-width: 52ch; }

.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 22px; }
.mode {
  display: flex; align-items: center; gap: 16px; text-align: left;
  padding: 18px 20px; border-radius: 20px;
  background: var(--verre); color: var(--texte);
  box-shadow: inset 0 0 0 1.5px var(--bord), var(--ombre);
  font-family: Jost, system-ui, sans-serif;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.mode:active { transform: translateY(2px); }
.mode svg { flex: 0 0 52px; height: 52px; padding: 8px; border-radius: 14px; background: rgba(255, 255, 255, 0.08); }
.mode svg .forme { fill: #8b93c9; }
.mode svg circle { fill: var(--nuit); }
.mode svg .trait { fill: none; stroke: var(--nuit); stroke-width: 2.4; stroke-linecap: round; }
.mode-texte { display: grid; gap: 2px; }
.mode strong { font: 600 1.25rem var(--titre); }
.mode-texte span { color: var(--texte-doux); font-weight: 400; font-size: 0.95rem; line-height: 1.35; }
.mode[aria-pressed="true"] {
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.2), rgba(255, 209, 102, 0.05));
  box-shadow: inset 0 0 0 2px var(--or), 0 14px 34px -14px rgba(255, 190, 80, 0.5);
}
.mode[aria-pressed="true"] svg { background: linear-gradient(180deg, #ffe08f, var(--or-fonce)); }
.mode[aria-pressed="true"] svg .forme { fill: #fff6dc; }
.mode[aria-pressed="true"] svg circle { fill: #7a5410; }
.mode[aria-pressed="true"] svg .trait { stroke: #7a5410; }

.titre-section { font-size: 1.6rem; margin: 40px 0 14px; }

.morceaux { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 14px; }
.morceau {
  width: 100%; height: 100%; padding: 0; overflow: hidden; text-align: left;
  display: flex; flex-direction: column;
  border-radius: 20px;
  background: linear-gradient(180deg, #fffdf8, #f6efe2);
  color: #2f2618;
  box-shadow: 0 5px 0 #c9bba3, var(--ombre);
  font-family: Jost, system-ui, sans-serif;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.morceau:hover { transform: translateY(-3px); box-shadow: 0 8px 0 #c9bba3, 0 24px 44px -18px rgba(0, 0, 0, 0.7); }
.morceau:active { transform: translateY(3px); box-shadow: 0 2px 0 #c9bba3, var(--ombre); }
.apercu { display: block; width: 100%; height: 78px; background: linear-gradient(180deg, #18205a, #262f78); }
.apercu svg { display: block; width: 100%; height: 100%; }
.morceau-corps { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 16px; flex: 1; }
.morceau strong { font: 600 1.3rem/1.15 var(--titre); }
.morceau .auteur { color: #8a7a62; font-size: 0.9rem; }
.morceau .infos { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 0.85rem; color: #6d5f4a; }
.niveau { display: inline-flex; gap: 3px; }
.niveau i { width: 8px; height: 8px; border-radius: 50%; background: #e2d6c2; }
.niveau i.plein { background: #e8a93a; }
.morceau .record { margin-top: auto; padding-top: 10px; font: 600 0.95rem var(--titre); color: #b07d10; }
.morceau .record.vide { color: #a4957f; font-weight: 500; }

.derniere { margin: 28px 0 0; color: var(--texte-doux); font-size: 0.95rem; }
.derniere strong { color: var(--or); font-family: var(--titre); font-weight: 600; }

@media (max-width: 640px) {
  .modes { grid-template-columns: 1fr; }
  .pastille #etat-cable { max-width: 9.5em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ---- Réglages ---- */
dialog {
  width: min(480px, calc(100% - 32px));
  border: 0; border-radius: 22px; padding: 24px;
  background: linear-gradient(180deg, #232a6e, #1a2058);
  color: var(--texte);
  box-shadow: inset 0 0 0 1px var(--bord), 0 30px 80px -20px rgba(0, 0, 0, 0.8);
}
dialog::backdrop { background: rgba(8, 10, 30, 0.6); backdrop-filter: blur(4px); }
dialog h2 { font-size: 1.7rem; margin-bottom: 12px; }
dialog label { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--bord); font-size: 0.98rem; }
dialog label.curseur input { flex: 1; accent-color: var(--or); }
dialog output { min-width: 4.4em; text-align: right; color: var(--or); font-family: var(--titre); font-weight: 600; }
dialog .interrupteur input { flex: 0 0 auto; width: 20px; height: 20px; accent-color: var(--or); }
dialog .aide { color: var(--texte-doux); font-size: 0.9rem; margin: 14px 0 18px; }
dialog .aide strong { color: var(--texte); }
dialog > button { width: 100%; }

/* ---- Jeu ---- */
#jeu { position: fixed; inset: 0; background: var(--nuit); }
#scene { width: 100%; height: 100%; display: block; touch-action: none; }
.hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: grid; grid-template-columns: 1fr auto 1fr auto; align-items: start; gap: 16px;
  padding: max(14px, env(safe-area-inset-top)) 16px 0;
  pointer-events: none;
  text-shadow: 0 2px 10px rgba(5, 8, 25, 0.9);
}
.hud-gauche { min-width: 0; }
.hud h1 { font-size: clamp(1.3rem, 3vw, 2rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progression { margin-top: 8px; height: 6px; width: min(260px, 100%); border-radius: 99px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
#progression { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--or-fonce), var(--or)); box-shadow: 0 0 10px var(--or); }
#consigne {
  margin: 4px 0 0; justify-self: center;
  padding: 0.5rem 1.2rem; border-radius: 999px;
  font: 600 clamp(1.1rem, 2.6vw, 1.6rem) var(--titre);
  color: #fff; background: var(--couleur-consigne, rgba(255, 255, 255, 0.12));
  box-shadow: 0 8px 24px -8px var(--couleur-consigne, transparent);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: background 0.2s ease;
}
#consigne:empty { visibility: hidden; }
#consigne.sombre { color: #3a2c00; text-shadow: none; }
.hud-droite { justify-self: end; text-align: right; }
#score { font: 600 clamp(1.6rem, 4vw, 2.6rem)/1 var(--titre); font-variant-numeric: tabular-nums; }
#combo { margin-top: 6px; font: 600 1rem var(--titre); color: var(--or); min-height: 1.4em; }
#combo .multi { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 99px; background: var(--or); color: #2a1d00; text-shadow: none; }
#combo.monte { animation: pop 0.25s ease; }
#btn-pause { pointer-events: auto; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }

@media (max-width: 700px) {
  .hud { grid-template-columns: 1fr auto auto; }
  #consigne { grid-column: 1 / -1; grid-row: 2; }
}

/* ---- Pause et fin ---- */
.voile {
  position: fixed; inset: 0; z-index: 5;
  display: grid; place-items: center; padding: 16px;
  background: rgba(8, 10, 30, 0.72); backdrop-filter: blur(6px);
}
#confettis { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.carte {
  position: relative;
  width: min(460px, 100%);
  display: flex; flex-direction: column; gap: 12px; text-align: center;
  padding: 30px 26px 26px; border-radius: 26px;
  background: linear-gradient(180deg, #2a3280, #1a2058);
  box-shadow: inset 0 0 0 1px var(--bord), 0 40px 90px -30px rgba(0, 0, 0, 0.9);
}
.carte h2 { font-size: 2rem; }
.etoiles { display: flex; justify-content: center; gap: 6px; font-size: 3rem; line-height: 1; }
.etoiles span { color: rgba(255, 255, 255, 0.15); transform: scale(0.6); opacity: 0; animation: etoile 0.45s cubic-bezier(.3, 1.6, .5, 1) forwards; }
.etoiles span.pleine { color: #ffd166; text-shadow: 0 0 18px rgba(255, 209, 102, 0.8); }
.etoiles span:nth-child(2) { animation-delay: 0.15s; } .etoiles span:nth-child(3) { animation-delay: 0.3s; }
.etoiles span:nth-child(4) { animation-delay: 0.45s; } .etoiles span:nth-child(5) { animation-delay: 0.6s; }
@keyframes etoile { to { transform: scale(1); opacity: 1; } }
#fin-message { margin: 0; color: var(--or); font: 600 1.2rem var(--titre); min-height: 1.4em; }
#fin-chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 4px 0 8px; }
#fin-chiffres div { background: var(--verre); border-radius: 14px; padding: 10px 8px; box-shadow: inset 0 0 0 1px var(--bord); }
#fin-chiffres dt { color: var(--texte-doux); font-size: 0.85rem; }
#fin-chiffres dd { margin: 2px 0 0; font: 600 1.45rem var(--titre); font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; transition: none !important; }
}

/* ---- Joueur, onglets, recherche, filtres ---- */
.pastille.joueur { gap: 0.5rem; padding-left: 0.5rem; }
.avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, 0.12); font-size: 1.05rem; line-height: 1; }
.discret { color: var(--texte-doux); font-weight: 400; font-size: 0.9em; }
.vide { color: var(--texte-doux); text-align: center; padding: 24px 0; }

.onglets { display: flex; gap: 6px; margin: 34px 0 18px; padding: 5px; border-radius: 16px; background: var(--verre); box-shadow: inset 0 0 0 1px var(--bord); width: fit-content; max-width: 100%; }
.onglets button { white-space: nowrap; background: transparent; color: var(--texte-doux); box-shadow: none; padding: 0.65rem 1.1rem; border-radius: 12px; font-weight: 500; }
.onglets button:active { transform: none; }
.onglets button[aria-pressed="true"] { background: linear-gradient(180deg, #ffe08f, var(--or-fonce)); color: #2a1d00; box-shadow: 0 6px 16px -8px rgba(255, 190, 80, 0.7); }
.compteur:not(:empty) { display: inline-block; min-width: 1.4em; margin-left: 4px; padding: 0 6px; border-radius: 99px; background: rgba(0, 0, 0, 0.18); font-size: 0.8rem; line-height: 1.5; }

.recherche { position: relative; }
.recherche-ligne { display: flex; gap: 10px; align-items: stretch; }
.recherche-ligne .recherche { flex: 1; min-width: 0; }
.recherche-ligne > button { white-space: nowrap; }
@media (max-width: 560px) { .recherche-ligne { flex-direction: column; } }
.lien.danger { color: #ff9a9a; }
/* un message passager (morceau qui ne se charge pas, pas de réseau…) */
.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 20; transform: translateX(-50%);
  max-width: min(520px, calc(100% - 32px)); padding: 12px 18px; border-radius: 14px; background: #2a3280; color: var(--texte);
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.8), inset 0 0 0 1px var(--bord); text-align: center; animation: cadeau-arrivee 0.3s ease both; }
.toast[hidden] { display: none; }

/* ---- Le parcours d'accueil : trois questions, puis des morceaux choisis pour le joueur ---- */
.parcours { width: min(560px, calc(100% - 32px)); }
.parcours h2 { margin-bottom: 14px; }
.parcours-points { display: flex; justify-content: center; gap: 8px; margin: 0 0 18px; padding: 0; list-style: none; }
.parcours-points li { width: 34px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.15); transition: background 0.3s; }
.parcours-points li.fait { background: var(--or); }
.parcours-choix { display: grid; gap: 10px; }
.parcours-choix button { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: center;
  text-align: left; padding: 14px 18px; background: rgba(255, 255, 255, 0.07); color: var(--texte); box-shadow: inset 0 0 0 1px var(--bord); }
.parcours-choix button span { grid-row: span 2; font-size: 1.8rem; }
.parcours-choix button small { color: var(--texte-doux); font-weight: 400; }
.parcours-choix button:hover, .parcours-choix button:focus-visible { box-shadow: inset 0 0 0 2px var(--or); }
.parcours-choix.minutes { grid-template-columns: 1fr 1fr; }
.parcours-choix.minutes button { grid-template-columns: 1fr; text-align: center; }
.parcours-gouts { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.parcours-gouts .puce { font-size: 1rem; padding: 10px 16px; }
.parcours section { animation: cadeau-arrivee 0.35s ease both; }
.parcours section[hidden] { display: none; }
/* « Continuer avec Google » : le bouton blanc au logo G, comme le demande Google */
.google { display: flex; align-items: center; justify-content: center; gap: 12px; background: #ffffff; color: #1f1f1f;
  box-shadow: inset 0 0 0 1px #dadce0; font-weight: 600; }
.google svg { width: 20px; height: 20px; }
.google[hidden] { display: none; }
.recherche svg { position: absolute; left: 16px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); fill: none; stroke: var(--texte-doux); stroke-width: 2; stroke-linecap: round; }
.recherche input {
  width: 100%; padding: 0.95rem 1rem 0.95rem 3rem; border-radius: 16px; border: 0;
  background: rgba(255, 255, 255, 0.08); color: var(--texte); font: 1.05rem Jost, system-ui, sans-serif;
  box-shadow: inset 0 0 0 1px var(--bord);
}
.recherche input::placeholder { color: var(--texte-doux); }
.recherche input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--or); }
.filtres { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.filtres-titre { color: var(--texte-doux); font-size: 0.9rem; margin-right: 2px; }
.puce { padding: 0.5rem 0.95rem; border-radius: 999px; font: 500 0.92rem var(--titre); background: var(--verre); color: var(--texte); box-shadow: inset 0 0 0 1px var(--bord); }
.puce:active { transform: translateY(1px); box-shadow: inset 0 0 0 1px var(--bord); }
.puce[aria-pressed="true"] { background: var(--texte); color: var(--nuit); box-shadow: none; }
#liste .titre-section { margin-top: 30px; }
.titre-section.petit { font-size: 1.3rem; margin-top: 34px; }

/* ---- Fiche d'un morceau ---- */
#fiche { width: min(520px, calc(100% - 32px)); }
.fiche-categorie { display: inline-block; padding: 2px 10px; border-radius: 99px; background: rgba(255, 209, 102, 0.16); color: var(--or); font: 600 0.8rem var(--titre); letter-spacing: 0.04em; text-transform: uppercase; }
#fiche h2 { margin: 10px 0 2px; font-size: 1.9rem; line-height: 1.1; }
.fiche-auteur { margin: 0; color: var(--texte-doux); }
.fiche-apercu { margin: 16px 0 10px; height: 90px; border-radius: 14px; overflow: hidden; background: linear-gradient(180deg, #121848, #222a6c); }
.fiche-apercu svg { display: block; width: 100%; height: 100%; }
.fiche-infos { margin: 0 0 14px; color: var(--texte-doux); font-size: 0.95rem; }
.segmente { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(0, 0, 0, 0.2); margin-bottom: 6px; }
.segmente button { background: transparent; color: var(--texte-doux); box-shadow: none; border-radius: 10px; padding: 0.7rem; }
.segmente button:active { transform: none; }
.segmente button[aria-pressed="true"] { background: var(--texte); color: var(--nuit); }
.podium { margin: 14px 0 4px; }
.podium-titre { margin: 0 0 6px; color: var(--texte-doux); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; }
.podium-ligne { display: grid; grid-template-columns: 28px 34px 1fr auto; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--bord); }
.podium-ligne .valeur { font: 600 1rem var(--titre); color: var(--or); }
dialog .actions { display: flex; gap: 10px; margin-top: 18px; }
dialog .actions button { flex: 1; }
button.plein { width: 100%; margin-top: 12px; }
button.danger { color: #ffb3b3; }

/* ---- Joueurs ---- */
.liste-joueurs { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 8px; }
.liste-joueurs li { display: flex; gap: 8px; }
.joueur-choix { flex: 1; display: flex; align-items: center; gap: 12px; text-align: left; background: var(--verre); color: var(--texte); box-shadow: inset 0 0 0 1px var(--bord); padding: 0.6rem 0.8rem; font-size: 1.1rem; }
.joueur-choix .avatar { width: 40px; height: 40px; font-size: 1.4rem; }
.joueur-choix[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--or); background: rgba(255, 209, 102, 0.12); }
.icone-bouton.petit { width: 48px; height: auto; font-size: 1.1rem; }
.nouveau-joueur { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--bord); }
.nouveau-joueur h3 { font-size: 1.15rem; margin-bottom: 10px; }
.nouveau-joueur input { width: 100%; padding: 0.8rem 1rem; border-radius: 12px; border: 0; background: rgba(255, 255, 255, 0.08); color: var(--texte); font: 1.05rem Jost, system-ui, sans-serif; box-shadow: inset 0 0 0 1px var(--bord); }
.nouveau-joueur input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--or); }
.choix-avatar { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 10px; }
.avatar-choix { padding: 0; aspect-ratio: 1; font-size: 1.6rem; background: var(--verre); box-shadow: inset 0 0 0 1px var(--bord); border-radius: 12px; }
.avatar-choix[aria-pressed="true"] { background: rgba(255, 209, 102, 0.22); box-shadow: inset 0 0 0 2px var(--or); }

/* ---- Classement ---- */
.classement { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.classement-ligne { display: grid; grid-template-columns: 44px 48px 1fr auto; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 18px; background: var(--verre); box-shadow: inset 0 0 0 1px var(--bord); }
.classement-ligne.premier { background: linear-gradient(135deg, rgba(255, 209, 102, 0.22), rgba(255, 209, 102, 0.05)); box-shadow: inset 0 0 0 2px var(--or); }
.classement-ligne .rang { font: 600 1.6rem var(--titre); text-align: center; }
.classement-ligne .avatar { width: 46px; height: 46px; font-size: 1.6rem; }
.classement-ligne .nom { display: grid; font: 600 1.2rem var(--titre); }
.classement-ligne .nom small { font: 400 0.85rem Jost, system-ui, sans-serif; color: var(--texte-doux); }
.classement-ligne .points { font: 600 1.25rem var(--titre); color: var(--or); }
.records { display: grid; gap: 4px; }
.record-ligne { display: grid; grid-template-columns: 1fr 30px auto auto; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--bord); }
.record-ligne .titre { font-weight: 500; }
.record-ligne .avatar { width: 28px; height: 28px; font-size: 0.95rem; }
.record-ligne .valeur { color: var(--or); font: 600 1rem var(--titre); min-width: 4.5em; text-align: right; }

/* ---- Badges ---- */
.badges { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: 12px; }
.badge { display: grid; justify-items: center; gap: 4px; text-align: center; padding: 18px 12px 14px; border-radius: 18px; background: var(--verre); box-shadow: inset 0 0 0 1px var(--bord); }
.badge .badge-icone { font-size: 2.4rem; filter: grayscale(1); opacity: 0.35; }
.badge strong { font: 600 1.05rem var(--titre); color: var(--texte-doux); }
.badge .badge-description { font-size: 0.85rem; color: var(--texte-doux); line-height: 1.3; }
.badge .badge-date { margin-top: 4px; font-size: 0.78rem; color: var(--or); }
.badge.gagne { background: linear-gradient(180deg, rgba(255, 209, 102, 0.18), rgba(255, 209, 102, 0.04)); box-shadow: inset 0 0 0 1.5px rgba(255, 209, 102, 0.6); }
.badge.gagne .badge-icone { filter: none; opacity: 1; animation: pop 0.4s ease; }
.badge.gagne strong { color: var(--texte); }
.fin-badges:empty { display: none; }
.fin-badges { display: grid; gap: 8px; margin: 2px 0 6px; }
.fin-badges-titre { margin: 0; font: 600 1rem var(--titre); color: var(--or); }
.badge-gagne { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 12px; border-radius: 14px; background: rgba(255, 209, 102, 0.14); box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.5); font: 600 1rem var(--titre); animation: etoile 0.5s cubic-bezier(.3, 1.6, .5, 1) both; }
.badge-gagne .badge-icone { font-size: 1.6rem; }

/* ---- Crédits ---- */
#credits { width: min(640px, calc(100% - 32px)); max-height: 85vh; }
.liste-credits { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 0.9rem; color: var(--texte-doux); }
.liste-credits strong { color: var(--texte); }
dialog a { color: var(--or); }

@media (max-width: 640px) {
  .barre { flex-wrap: wrap; }
  .barre-droite { flex-wrap: wrap; justify-content: flex-end; }
  .pastille.joueur #joueur-nom { max-width: 6em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .onglets { width: 100%; }
  .onglets button { flex: 1; padding: 0.6rem 0.3rem; font-size: 0.9rem; }
  .classement-ligne { grid-template-columns: 34px 40px 1fr; }
  .classement-ligne .points { grid-column: 3; }
  .record-ligne { grid-template-columns: 1fr 28px auto; }
  .record-ligne .nom { display: none; }
}

/* ---- Compte ---- */
.icone-compte { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.pastille.ok .icone-compte { stroke: var(--ok); }
#compte { width: min(440px, calc(100% - 32px)); }
#compte form, #compte [data-vue] { display: grid; gap: 10px; }
#compte [hidden] { display: none !important; }
#compte h2 { margin-bottom: 2px; }
#compte .aide { margin: 0 0 6px; }
#compte .plein { margin-top: 0; }
#compte [data-croix] { margin-top: 12px; }
.champ { display: grid; gap: 6px; font-size: 0.95rem; color: var(--texte-doux); border: 0 !important; padding: 0 !important; }
.champ input, .classement-morceau select {
  width: 100%; padding: 0.8rem 1rem; border-radius: 12px; border: 0;
  background: rgba(255, 255, 255, 0.08); color: var(--texte); font: 1.05rem Jost, system-ui, sans-serif;
  box-shadow: inset 0 0 0 1px var(--bord);
}
.champ input:focus, .classement-morceau select:focus { outline: none; box-shadow: inset 0 0 0 2px var(--or); }
.classement-morceau select option { background: var(--nuit-2); color: var(--texte); }
.erreur { margin: 0; padding: 0.6rem 0.8rem; border-radius: 10px; background: rgba(255, 120, 120, 0.14); color: #ffc4c4; font-size: 0.92rem; }
button.lien { background: none; box-shadow: none; color: var(--or); font-weight: 500; padding: 0.5rem; }
button.lien:active { transform: none; }
button:disabled { opacity: 0.6; cursor: progress; }

/* ---- Pseudo public d'un joueur ---- */
.pseudo { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 10px; margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.2); }
.pseudo-titre { grid-column: 1; font-size: 0.8rem; color: var(--texte-doux); text-transform: uppercase; letter-spacing: 0.05em; }
.pseudo strong { grid-column: 1; font: 600 1.1rem var(--titre); }
.pseudo .icone-bouton { grid-column: 2; grid-row: 1 / 3; width: 46px; height: 46px; font-size: 1.4rem; }
.joueur-choix .nom { display: grid; }
.joueur-choix .nom small { font-size: 0.8rem; color: var(--texte-doux); }
.nouveau-joueur[hidden] { display: none; }

/* ---- Classement mondial ---- */
.classement-choix { display: grid; gap: 10px; margin-bottom: 8px; }
.classement-choix > .segmente { max-width: 360px; }
.classement-morceau { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.segmente.petit button { padding: 0.55rem 0.8rem; font-size: 0.9rem; }
.classement-ligne .medaille { font: 600 1.4rem var(--titre); text-align: center; }
.classement-ligne .valeur { font: 600 1.2rem var(--titre); color: var(--or); }
.classement-ligne .nom { font: 600 1.1rem var(--titre); }
.classement-ligne.moi, .podium-ligne.moi { box-shadow: inset 0 0 0 2px var(--ok); background: rgba(123, 224, 160, 0.1); }
.podium-ligne.moi { border-radius: 10px; padding-left: 6px; padding-right: 6px; }
.fiche-record { margin: 12px 0 0; color: var(--or); font: 600 1rem var(--titre); min-height: 1.2em; }
@media (max-width: 640px) {
  .classement-morceau { grid-template-columns: 1fr; }
  .classement-ligne { grid-template-columns: 34px 40px 1fr auto; }
}

/* ---- Le chemin de niveaux ---- */
.barre-jeu { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 6px; }
.vies { display: inline-flex; align-items: center; gap: 8px; padding: 0.55rem 1rem; border-radius: 999px; background: rgba(255, 90, 110, 0.14); box-shadow: inset 0 0 0 1px rgba(255, 120, 140, 0.4); }
.vies .coeur { font-size: 1.2rem; }
.vies strong { font: 600 1.25rem var(--titre); }
.bonus-stock { display: flex; gap: 6px; }
.bonus-pastille { padding: 0.45rem 0.8rem; border-radius: 999px; background: var(--verre); box-shadow: inset 0 0 0 1px var(--bord); font: 600 0.95rem var(--titre); }
.pastille.cadeau { background: linear-gradient(180deg, #ffe08f, var(--or-fonce)); color: #2a1d00; box-shadow: 0 6px 18px -8px rgba(255, 190, 80, 0.8); animation: halo 1.8s ease-in-out infinite; }
@keyframes halo { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 209, 102, 0.6); } 50% { box-shadow: 0 0 0 8px rgba(255, 209, 102, 0); } }
#message-chemin { margin: 8px 0 18px; }

/* ---- Favoris : l'étoile sur les cartes, dans la fiche et dans la liste d'entraînement ---- */
.morceaux li, .liste-entrainement li { position: relative; }
.favori { position: absolute; top: 8px; right: 8px; z-index: 1; width: 38px; height: 38px; min-width: 0; padding: 0; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.35rem; line-height: 1; color: rgba(255, 255, 255, 0.85);
  background: rgba(10, 12, 40, 0.55); box-shadow: none; backdrop-filter: blur(4px); }
.favori.oui { color: #ffd166; text-shadow: 0 0 12px rgba(255, 209, 102, 0.8); }
.favori.saute { animation: favori-saute 0.45s cubic-bezier(.3, 1.8, .5, 1); }
.liste-entrainement .favori { top: 50%; transform: translateY(-50%); }
.liste-entrainement .favori.saute { animation: none; }
.liste-entrainement .entrainement-ligne { padding-right: 56px; }
.favori-fiche { position: static; display: inline-grid; vertical-align: middle; width: 34px; height: 34px; font-size: 1.2rem; }
.puce-favoris[aria-pressed="true"] { background: #ffd166; color: #2a1d00; }
@keyframes favori-saute { 40% { transform: scale(1.45) rotate(-12deg); } }

/* ---- Le cadeau du jour : la boîte tremble, s'ouvre au toucher, le bonus jaillit dans un rayon de lumière ---- */
.cadeau-voile { z-index: 6; align-content: center; justify-items: center; gap: 18px; text-align: center; overflow: hidden; }
.cadeau-voile[hidden] { display: none; }
.cadeau-confettis { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cadeau-titre { margin: 0; font: 700 clamp(1.6rem, 5vw, 2.4rem) var(--titre); color: var(--or); text-shadow: 0 6px 30px rgba(255, 190, 80, 0.5); animation: cadeau-arrivee 0.5s cubic-bezier(.3, 1.6, .5, 1) both; }
.cadeau-aide { margin: 0; color: var(--texte-doux); animation: cadeau-clignote 1.4s ease-in-out infinite; }
.cadeau-scene { position: relative; width: 260px; height: 260px; display: grid; place-items: center; }
.cadeau-rayons { position: absolute; inset: -60px; border-radius: 50%; opacity: 0.35; transition: opacity 0.4s, transform 0.6s;
  background: repeating-conic-gradient(from 0deg, rgba(255, 214, 120, 0.55) 0deg 10deg, transparent 10deg 30deg);
  -webkit-mask: radial-gradient(circle, #000 20%, transparent 68%); mask: radial-gradient(circle, #000 20%, transparent 68%);
  animation: cadeau-tourne 14s linear infinite; }
.cadeau-boite { position: relative; width: 170px; height: 170px; padding: 0; border: 0; background: none; box-shadow: none; cursor: pointer;
  animation: cadeau-arrivee 0.6s cubic-bezier(.3, 1.6, .5, 1) both, cadeau-tremble 1.6s ease-in-out 0.6s infinite; }
.cadeau-boite:hover, .cadeau-boite:focus-visible { filter: brightness(1.1); }
.cadeau-corps { position: absolute; left: 12px; right: 12px; bottom: 0; height: 110px; border-radius: 10px 10px 16px 16px;
  background: linear-gradient(90deg, transparent 42%, #ffd166 42% 58%, transparent 58%), linear-gradient(180deg, #ff5d73, #c81d4e);
  box-shadow: inset 0 -12px 0 rgba(0, 0, 0, 0.15), 0 24px 40px -18px rgba(0, 0, 0, 0.8); }
.cadeau-couvercle { position: absolute; left: 0; right: 0; top: 34px; height: 40px; border-radius: 10px; z-index: 1;
  background: linear-gradient(90deg, transparent 40%, #ffe08f 40% 60%, transparent 60%), linear-gradient(180deg, #ff7a8c, #e0305e);
  box-shadow: 0 8px 14px -6px rgba(0, 0, 0, 0.5); transition: transform 0.7s cubic-bezier(.2, .9, .3, 1.2), opacity 0.7s; }
.cadeau-noeud { position: absolute; left: 50%; top: -30px; width: 70px; height: 34px; transform: translateX(-50%); }
.cadeau-noeud::before, .cadeau-noeud::after { content: ""; position: absolute; top: 0; width: 34px; height: 30px; border: 9px solid #ffd166; border-radius: 50% 50% 10% 50%; }
.cadeau-noeud::before { left: 0; transform: rotate(-20deg); }
.cadeau-noeud::after { right: 0; transform: scaleX(-1) rotate(-20deg); }
.cadeau-boite.ouvert { animation: none; cursor: default; }
.cadeau-boite.ouvert .cadeau-couvercle { transform: translate(40px, -170px) rotate(35deg); opacity: 0; }
.cadeau-boite.ouvert .cadeau-corps { animation: cadeau-disparait 0.6s 0.25s ease-in forwards; }
.cadeau-voile.ouvert .cadeau-rayons { opacity: 1; transform: scale(1.25); }
.cadeau-voile.ouvert .cadeau-aide { display: none; }
.cadeau-gain { position: absolute; display: grid; justify-items: center; gap: 6px; width: 240px; animation: cadeau-jaillit 0.7s 0.35s cubic-bezier(.3, 1.7, .5, 1) both; }
.cadeau-gain[hidden] { display: none; }
.cadeau-icone { font-size: 5.5rem; line-height: 1; filter: drop-shadow(0 0 26px rgba(255, 214, 120, 0.9)); animation: cadeau-flotte 2.2s 1s ease-in-out infinite; }
.cadeau-gain strong { font: 700 1.7rem var(--titre); }
.cadeau-gain span:last-child { color: var(--texte-doux); }
#btn-cadeau-ok { min-width: 180px; animation: cadeau-arrivee 0.4s 0.9s both; }
@keyframes cadeau-arrivee { from { transform: scale(0.3) translateY(40px); opacity: 0; } }
@keyframes cadeau-tremble { 0%, 60%, 100% { transform: rotate(0) scale(1); } 66% { transform: rotate(-7deg) scale(1.04); } 74% { transform: rotate(6deg) scale(1.06); } 82% { transform: rotate(-4deg) scale(1.03); } 90% { transform: rotate(2deg); } }
@keyframes cadeau-tourne { to { transform: rotate(360deg); } }
@keyframes cadeau-clignote { 50% { opacity: 0.45; } }
@keyframes cadeau-disparait { to { transform: scale(0.6) translateY(30px); opacity: 0; } }
@keyframes cadeau-jaillit { from { transform: translateY(70px) scale(0.2); opacity: 0; } }
@keyframes cadeau-flotte { 50% { transform: translateY(-10px); } }
@media (prefers-reduced-motion: reduce) {
  .cadeau-boite, .cadeau-rayons, .cadeau-icone, .cadeau-aide { animation: none; }
}

.carte-niveaux { display: grid; gap: 26px; }
.monde { border-radius: 26px; padding: 18px 0 8px; background:
  radial-gradient(120% 60% at 50% 0%, color-mix(in srgb, var(--couleur-monde) 30%, transparent), transparent 70%),
  rgba(255, 255, 255, 0.03); box-shadow: inset 0 0 0 1px var(--bord); overflow: hidden; }
.monde-entete { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 0 20px; }
.monde-numero { padding: 2px 10px; border-radius: 99px; background: var(--couleur-monde); color: #fff; font: 600 0.8rem var(--titre); text-transform: uppercase; letter-spacing: 0.05em; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }
.monde-entete h3 { font-size: 1.6rem; }
.monde-etoiles { margin-left: auto; color: var(--or); font: 600 1rem var(--titre); }
.chemin { position: relative; max-width: 560px; margin: 0 auto; }
.sentier { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.sentier path { fill: none; stroke: rgba(255, 255, 255, 0.18); stroke-width: 10; stroke-linecap: round; stroke-dasharray: 2 16; vector-effect: non-scaling-stroke; }
.noeud {
  position: absolute; transform: translate(-50%, -50%);
  width: 64px; height: 64px; padding: 0; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--couleur-monde) 55%, white), var(--couleur-monde) 70%);
  color: #fff; font: 600 1.35rem var(--titre); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  box-shadow: 0 6px 0 color-mix(in srgb, var(--couleur-monde) 60%, black), 0 14px 24px -10px rgba(0, 0, 0, 0.7);
}
.noeud:active { transform: translate(-50%, calc(-50% + 4px)); box-shadow: 0 2px 0 color-mix(in srgb, var(--couleur-monde) 60%, black); }
.noeud.defi { width: 82px; height: 82px; font-size: 1.9rem; }
.noeud.ferme { background: #3a3f63; box-shadow: 0 6px 0 #23264a; color: rgba(255, 255, 255, 0.5); cursor: default; font-size: 1.1rem; }
.noeud.actuel { animation: noeud-actuel 1.4s ease-in-out infinite; }
@keyframes noeud-actuel { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.25) drop-shadow(0 0 12px var(--couleur-monde)); } }
.noeud-etoiles { position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 0.85rem; color: var(--or); letter-spacing: 1px; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8); }
.noeud-joueur { position: absolute; top: -26px; left: 50%; transform: translateX(-50%); width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #fff; font-size: 1.2rem; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5); text-shadow: none; }

/* ---- Fiche d'un niveau ---- */
#fiche-niveau { width: min(500px, calc(100% - 32px)); }
#fiche-niveau h2 { margin: 10px 0 4px; font-size: 1.9rem; }
.niveau-objectif { margin: 6px 0; font: 600 1.15rem var(--titre); }
.etoiles.petites { display: block; font-size: 1rem; color: var(--or); margin: 0 0 12px; }
.choix-bonus { display: grid; gap: 8px; }
.bonus-choix { display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; align-items: center; gap: 0 10px; text-align: left; background: var(--verre); color: var(--texte); box-shadow: inset 0 0 0 1px var(--bord); padding: 0.6rem 0.8rem; font-family: Jost, system-ui, sans-serif; }
.bonus-choix .bonus-icone { grid-row: 1 / 3; font-size: 1.7rem; }
.bonus-choix strong { font: 600 1rem var(--titre); }
.bonus-choix .discret { font-size: 0.82rem; }
.bonus-choix[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--or); background: rgba(255, 209, 102, 0.14); }
.bonus-choix:disabled { opacity: 0.45; cursor: not-allowed; }
.grosse-vie { font-size: 3.4rem; text-align: center; margin: 4px 0; }
#plus-de-vies { width: min(420px, calc(100% - 32px)); text-align: center; }

/* ---- Les deux univers ---- */
.univers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.univers button {
  display: flex; align-items: center; gap: 14px; text-align: left; padding: 16px 18px; border-radius: 20px;
  background: var(--verre); color: var(--texte); box-shadow: inset 0 0 0 1.5px var(--bord), var(--ombre);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); font-family: Jost, system-ui, sans-serif;
}
.univers button:active { transform: translateY(2px); }
.univers-icone { font-size: 2rem; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; background: rgba(255, 255, 255, 0.08); }
.univers-texte { display: grid; gap: 2px; }
.univers-texte strong { font: 600 1.25rem var(--titre); }
.univers-texte span { color: var(--texte-doux); font-size: 0.95rem; }
.univers button[aria-pressed="true"] { background: linear-gradient(135deg, rgba(255, 209, 102, 0.2), rgba(255, 209, 102, 0.05)); box-shadow: inset 0 0 0 2px var(--or), 0 14px 34px -14px rgba(255, 190, 80, 0.5); }
.univers button[aria-pressed="true"] .univers-icone { background: linear-gradient(180deg, #ffe08f, var(--or-fonce)); }
.onglets[hidden] { display: none; }
@media (max-width: 640px) { .univers { grid-template-columns: 1fr 1fr; } .univers-texte span { display: none; } .univers button { padding: 12px; gap: 10px; } .univers-icone { width: 42px; height: 42px; font-size: 1.6rem; } }

/* ---- Cours ---- */
.carte-continuer {
  width: 100%; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto auto; gap: 2px 16px; align-items: center; text-align: left;
  padding: 20px 22px; border-radius: 22px; color: #2a1d00;
  background: linear-gradient(135deg, #ffe08f, var(--or) 50%, var(--or-fonce)); box-shadow: 0 6px 0 #b9802a, 0 20px 40px -18px rgba(255, 190, 80, 0.7);
  font-family: Jost, system-ui, sans-serif;
}
.carte-continuer .discret { color: #6b4c10; }
.carte-continuer strong { font: 600 1.6rem var(--titre); }
.carte-continuer .fleche { grid-column: 2; grid-row: 1 / 4; font-size: 2rem; }
.bravo { font: 600 1.15rem var(--titre); color: var(--or); }
.etiquette { margin-left: 10px; padding: 2px 10px; border-radius: 99px; background: rgba(123, 224, 160, 0.18); color: var(--ok); font: 600 0.8rem var(--titre); vertical-align: 3px; }
.lecons { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 10px; }
.lecon-carte { width: 100%; display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; gap: 0 12px; align-items: center; text-align: left;
  padding: 12px 14px; border-radius: 16px; background: var(--verre); color: var(--texte); box-shadow: inset 0 0 0 1px var(--bord); font-family: Jost, system-ui, sans-serif; }
.lecon-carte strong { font: 600 1.05rem var(--titre); line-height: 1.2; }
.lecon-etat { grid-row: 1 / 3; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, 0.1); font: 600 1rem var(--titre); }
.lecon-carte.finie .lecon-etat { background: var(--ok); color: #0e2a1a; }
.lecon-carte.en-cours { box-shadow: inset 0 0 0 2px var(--or); }
.lecon-carte.en-cours .lecon-etat { background: var(--or); color: #2a1d00; }

/* ---- Écran de leçon ---- */
#lecon { position: relative; z-index: 1; }
.lecon-cadre { max-width: 820px; margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) 16px 48px; }
.lecon-entete { display: flex; align-items: center; gap: 14px; }
.lecon-entete h1 { font-size: clamp(1.5rem, 4vw, 2.2rem); }
.lecon-etapes { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0; padding: 0; }
.pas { width: 40px; height: 40px; padding: 0; border-radius: 50%; background: var(--verre); color: var(--texte); box-shadow: inset 0 0 0 1px var(--bord); font: 600 1rem var(--titre); }
.pas.fait { background: var(--ok); color: #0e2a1a; box-shadow: none; }
.pas.actuel { box-shadow: inset 0 0 0 3px var(--or); }
.lecon-contenu { padding: 26px; border-radius: 24px; background: linear-gradient(180deg, rgba(42, 50, 128, 0.85), rgba(26, 32, 88, 0.85)); box-shadow: inset 0 0 0 1px var(--bord), var(--ombre); display: grid; gap: 14px; }
.lecon-contenu h2 { font-size: 1.8rem; }
.lecon-texte { margin: 0; font-size: 1.08rem; line-height: 1.6; max-width: 62ch; }
.lecon-figure { background: #fffdf8; border-radius: 16px; padding: 8px; overflow-x: auto; min-height: 120px; }
.lecon-consigne { margin: 0; font: 500 1.08rem var(--titre); color: var(--or); }
.lecon-puces { display: flex; flex-wrap: wrap; gap: 8px; }
.puce-info { padding: 0.4rem 0.8rem; border-radius: 99px; background: var(--verre); box-shadow: inset 0 0 0 1px var(--bord); font-size: 0.9rem; }
.resultat-etape { display: grid; gap: 4px; padding: 14px 16px; border-radius: 16px; }
.resultat-etape strong { font: 600 1.4rem var(--titre); }
.resultat-etape.reussi { background: rgba(123, 224, 160, 0.14); box-shadow: inset 0 0 0 1px rgba(123, 224, 160, 0.5); }
.resultat-etape.pas-encore { background: rgba(255, 179, 122, 0.12); box-shadow: inset 0 0 0 1px rgba(255, 179, 122, 0.45); }
.lecon-contenu .actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---- Lecteur de partition ---- */
#partition { position: fixed; inset: 0; display: grid; grid-template-rows: auto 1fr auto; background: linear-gradient(180deg, var(--nuit), var(--nuit-2)); z-index: 2; }
.partition-entete { display: flex; align-items: center; gap: 14px; padding: max(12px, env(safe-area-inset-top)) 16px 10px; }
.partition-titres { flex: 1; min-width: 0; }
.partition-titres h1 { font-size: clamp(1.1rem, 3vw, 1.6rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.partition-titres p { margin: 0; }
.partition-compteurs { display: grid; justify-items: end; font: 600 1.4rem var(--titre); }
.partition-compteurs .discret { font-size: 0.85rem; }
.partition-feuille { margin: 0 12px; border-radius: 18px; background: #fffdf8; overflow-y: auto; overflow-x: hidden; box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.8); scroll-behavior: smooth; }
.partition-feuille svg { display: block; margin: 0 auto; }
.partition-feuille .vf-stavenote path, .partition-feuille .vf-stavenote text { transition: fill 0.15s ease; }
.partition-feuille .cible path { fill: #d18b00 !important; stroke: #d18b00 !important; }
.partition-feuille .cible { filter: drop-shadow(0 0 4px rgba(255, 180, 0, 0.9)); }
.partition-feuille .juste path { fill: #1f9d55 !important; stroke: #1f9d55 !important; }
.partition-feuille .ratee path { fill: #d93a3a !important; stroke: #d93a3a !important; }
.partition-clavier { width: calc(100% - 24px); height: clamp(70px, 14vh, 120px); margin: 10px 12px max(10px, env(safe-area-inset-bottom)); display: block; }
.partition-nav { display: flex; align-items: center; gap: 6px; font: 600 0.95rem var(--titre); white-space: nowrap; }
.partition-nav[hidden] { display: none; }
.partition-feuille.navigable { cursor: pointer; }
.vue-partition { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); }
.vue-partition button { min-width: 0; padding: 6px 10px; border-radius: 999px; background: transparent; box-shadow: none; font-size: 1rem; line-height: 1; }
.vue-partition button[aria-pressed="true"] { background: rgba(255, 255, 255, 0.2); }
#partition[data-vue="partition"] .partition-clavier { display: none; }
#partition[data-vue="partition"] { grid-template-rows: auto 1fr; }
#partition[data-vue="clavier"] .partition-feuille { display: none; }
.partition-suite { display: none; }
#partition[data-vue="clavier"] { grid-template-rows: auto 1fr auto; }
#partition[data-vue="clavier"] .partition-suite { display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 0.4em 0.7em; margin: 0 16px; font: 600 clamp(1.4rem, 4.5vw, 2.6rem) var(--titre); color: var(--texte-doux); }
.partition-suite .maintenant { color: var(--or); font-size: 1.35em; }
#partition[data-vue="clavier"] .partition-clavier { height: clamp(160px, 45vh, 380px); }
.choix-reglage { display: grid; gap: 6px; font-weight: 500; }
.choix-reglage select { padding: 10px 12px; border-radius: 12px; border: 0; background: rgba(255, 255, 255, 0.08); color: var(--texte); font: inherit; }
.choix-reglage select option { background: var(--nuit-2); color: var(--texte); }
@media (max-width: 560px) { .vue-partition button { padding: 6px 7px; font-size: 0.85rem; } .partition-compteurs { font-size: 1.1rem; } }
.decompte { position: absolute; inset: 0; display: grid; place-items: center; font: 700 clamp(5rem, 18vw, 10rem) var(--titre); color: var(--or); text-shadow: 0 10px 40px rgba(0, 0, 0, 0.6); pointer-events: none; }
.decompte[hidden] { display: none; }

/* ---- Entraînement ---- */
.liste-entrainement { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 8px; }
.entrainement-ligne { width: 100%; display: grid; gap: 2px; text-align: left; padding: 12px 14px; border-radius: 14px; background: var(--verre); color: var(--texte); box-shadow: inset 0 0 0 1px var(--bord); font-family: Jost, system-ui, sans-serif; }
.entrainement-ligne strong { font: 600 1.05rem var(--titre); }
#entrainement-options { width: min(520px, calc(100% - 32px)); }
#entrainement-options h2 { margin: 10px 0 12px; font-size: 1.7rem; }
.segmente.trois { grid-template-columns: 1fr 1fr 1fr; }
#entrainement-options input[type="number"] { width: 4.5em; padding: 0.4rem; border-radius: 8px; border: 0; background: rgba(255, 255, 255, 0.08); color: var(--texte); font: 1rem Jost, sans-serif; box-shadow: inset 0 0 0 1px var(--bord); }

/* ---- Progrès ---- */
.progres-cartes { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.progres-carte { display: grid; gap: 2px; padding: 16px; border-radius: 18px; background: var(--verre); box-shadow: inset 0 0 0 1px var(--bord); }
.progres-carte strong { font: 600 1.5rem var(--titre); color: var(--or); }
.semaine { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 170px; padding: 12px; border-radius: 18px; background: var(--verre); box-shadow: inset 0 0 0 1px var(--bord); }
.jour { display: grid; grid-template-rows: auto 1fr auto; justify-items: center; gap: 4px; height: 100%; }
.jour .barre { align-self: end; width: 70%; min-height: 3px; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, var(--or), var(--or-fonce)); }
.jour .minutes { font: 600 0.85rem var(--titre); color: var(--or); }
.notes-dures { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.note-dure { padding: 0.5rem 1rem; border-radius: 99px; font: 600 1.05rem var(--titre); background: color-mix(in srgb, var(--couleur-note) 30%, transparent); box-shadow: inset 0 0 0 1.5px var(--couleur-note); }

/* ---- Réglage du décalage ---- */
#calibrage { width: min(440px, calc(100% - 32px)); }
.calibrage-temps { min-height: 2.4em; font: 600 1.05rem var(--titre); color: var(--or); }

/* ---- Objectif du jour ---- */
.objectif-semaine { display: grid; gap: 8px; margin-bottom: 14px; padding: 14px 16px; border-radius: 18px; background: var(--verre); box-shadow: inset 0 0 0 1px var(--bord); }
.objectif-texte { font: 600 1.05rem var(--titre); }
.objectif-barre { height: 10px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.objectif-plein { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--or-fonce), var(--or)); transition: width 0.4s ease; }
.objectif-semaine.atteint { box-shadow: inset 0 0 0 2px var(--ok); }
.objectif-semaine.atteint .objectif-plein { background: linear-gradient(90deg, #3fbf77, var(--ok)); }

/* ---- Pages de morceaux (piano/) ---- */
.page-morceau { min-height: 100vh; }
.page-cadre { max-width: 860px; margin: 0 auto; padding: 24px 16px 60px; }
.page-marque { display: inline-flex; align-items: center; gap: 10px; color: var(--texte); text-decoration: none; font: 600 1.4rem var(--titre); }
.page-marque img { border-radius: 10px; }
.page-article { margin-top: 24px; display: grid; gap: 14px; }
.page-article h1 { font-size: clamp(2rem, 6vw, 3rem); line-height: 1.05; }
.page-article h2 { font-size: 1.5rem; margin-top: 18px; }
.page-article p { margin: 0; line-height: 1.6; }
.page-article a { color: var(--or); }
.page-auteur { color: var(--texte-doux); }
.page-partition { background: #fffdf8; border-radius: 18px; padding: 8px; min-height: 160px; overflow: hidden; }
.page-partition .discret { color: #8a7c6a; padding: 12px; }
.bouton-page { justify-self: start; display: inline-block; padding: 0.9rem 1.6rem; border-radius: 14px; text-decoration: none; font: 600 1.05rem var(--titre);
  color: #2a1d00 !important; background: linear-gradient(180deg, #ffe08f, var(--or) 45%, var(--or-fonce)); box-shadow: 0 4px 0 #b9802a, 0 10px 24px -8px rgba(255, 190, 80, 0.55); }
.page-liens { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 8px; }
.page-liens li { padding: 10px 12px; border-radius: 12px; background: var(--verre); box-shadow: inset 0 0 0 1px var(--bord); display: grid; }
.page-liens a { font: 600 1.02rem var(--titre); text-decoration: none; }
.page-source { font-size: 0.85rem; }
.page-article .fiche-categorie { justify-self: start; }
