/* ============================================================
   STYLE.CSS — Apparence de l'appli Muscu (thème sombre)
   ============================================================ */
:root {
  --fond: #0f1115; --carte: #1a1d24; --carte2: #232731; --bord: #2c313b;
  --texte: #eef0f4; --mute: #8b92a1;
  --accent: #ff7a1a; --vert: #2fd18b; --rouge: #ff5470;
  --fig: #eef0f4; --fig2: #6b7280;
  --rayon: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--fond); color: var(--texte); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
#app { max-width: 560px; margin: 0 auto; padding: 0 14px 20px; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, select { font: inherit; color: var(--texte); background: var(--carte2); border: 1px solid var(--bord); border-radius: 10px; padding: 10px 12px; width: 100%; }
h1 { font-size: 1.35rem; margin: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
h2 { font-size: .85rem; color: var(--mute); margin: 22px 4px 8px; text-transform: uppercase; letter-spacing: .08em; }
h3 { margin: 0 0 8px; font-size: 1rem; }
small { display: block; color: var(--mute); font-size: .82rem; }
.mute { color: var(--mute); }
.centre { text-align: center; }
.vide { color: var(--mute); text-align: center; padding: 24px 0; }

/* --- En-tête --- */
.entete { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: calc(12px + env(safe-area-inset-top)) 2px 12px; background: var(--fond); }
.ico { font-size: 2.1rem; line-height: 1; width: 40px; height: 40px; margin-left: -8px; }
.chrono { font-variant-numeric: tabular-nums; font-weight: 700; }

/* --- Boutons --- */
.gros { display: block; width: 100%; padding: 16px; margin: 10px 0; border-radius: var(--rayon); font-size: 1.08rem; font-weight: 700; text-align: center; }
.principal { background: var(--accent); color: #1b0d00; }
.secondaire { background: var(--carte2); border: 1px solid var(--bord); }
.valider { background: var(--vert); color: #03170d; padding: 28px; font-size: 1.35rem; }
.danger-l { background: transparent; border: 1px solid var(--rouge); color: var(--rouge); }
.lien { display: block; margin: 18px auto; color: var(--mute); text-decoration: underline; font-size: .9rem; }
.lien.danger { color: var(--rouge); }
.gros:active, .carte:active, .tuile:active { transform: scale(.98); }

/* --- Cartes --- */
.carte { display: block; width: 100%; text-align: left; background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 14px; margin: 10px 0; }
.carte.encours { display: flex; justify-content: space-between; align-items: center; border-color: var(--accent); }
.carte.encours .chrono { font-size: 1.5rem; color: var(--accent); }
.ligne { display: flex; justify-content: space-between; }
.puces { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.puces span { background: var(--carte2); border-radius: 20px; padding: 3px 10px; font-size: .8rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 8px; text-align: center; }
.stats h3 { grid-column: 1 / -1; text-align: left; margin: 0; }
.stats b { font-size: 1.5rem; display: block; }

/* --- Exercice dans une séance --- */
.carte.exo { padding: 0; overflow: hidden; }
.carte.exo.actif { border-color: var(--accent); }
.tete-exo { display: flex; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer; }
.tete-exo > div:nth-child(2) { flex: 1; }
.fleche { font-size: 1.6rem; color: var(--mute); }
.vignette { width: 64px; height: 52px; flex: none; background: var(--carte2); border-radius: 10px; padding: 2px; }
.vignette svg { width: 100%; height: 100%; display: block; }
.series { list-style: none; margin: 0; padding: 0 14px 4px; }
.series li { display: flex; align-items: baseline; gap: 10px; padding: 10px 0; border-top: 1px solid var(--bord); cursor: pointer; flex-wrap: wrap; }
.series li small { margin-left: auto; }
.num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--carte2); font-size: .8rem; font-weight: 700; }

/* --- Écran exercice --- */
.schema-bloc { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); overflow: hidden; }
.schema-anim { background: radial-gradient(circle at 50% 40%, #232836, #161920); padding: 8px; }
.schema-anim svg { width: 100%; height: auto; max-height: 230px; display: block; }
details { padding: 10px 14px; }
summary { font-weight: 700; cursor: pointer; color: var(--accent); }
details ol { margin: 8px 0 0; padding-left: 20px; }
details li { margin: 4px 0; }
.derniere { background: var(--carte2); border-radius: 12px; padding: 10px 12px; font-size: .9rem; color: var(--mute); }
.action { margin-top: 14px; }
.etiquette { text-align: center; color: var(--mute); margin: 6px 0 0; text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; }
.chrono.geant { display: block; text-align: center; font-size: 3.6rem; line-height: 1.1; margin: 4px 0 8px; }
.chrono.repos { color: var(--mute); }
.chrono.repos.atteint { color: var(--vert); }
.tenu { text-align: center; font-size: 1.2rem; }
.saisie { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stepper label { display: block; text-align: center; color: var(--mute); font-size: .85rem; margin-bottom: 4px; }
.stepper > div { display: flex; background: var(--carte); border: 1px solid var(--bord); border-radius: 14px; overflow: hidden; }
.stepper button { width: 48px; flex: none; font-size: 1.6rem; font-weight: 700; background: var(--carte2); }
.stepper input { border: 0; background: transparent; text-align: center; font-size: 1.5rem; font-weight: 700; padding: 10px 0; min-width: 0; border-radius: 0; }

/* --- Bibliothèque --- */
.recherche { margin: 4px 0 10px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.chip { white-space: nowrap; padding: 7px 14px; border-radius: 20px; background: var(--carte2); border: 1px solid var(--bord); font-size: .88rem; }
.chip.on { background: var(--accent); color: #1b0d00; border-color: var(--accent); font-weight: 700; }
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 8px; }
.tuile { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 8px; text-align: center; font-size: .9rem; font-weight: 600; }
.tuile .vignette { width: 100%; height: 96px; margin-bottom: 6px; }

/* --- Graphique de progression --- */
.graph { width: 100%; height: auto; }
.g-ligne { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.g-pt { fill: var(--accent); }
.g-txt { fill: var(--mute); font-size: 10px; }

/* --- Réglages --- */
.form label { display: block; margin: 10px 0; color: var(--mute); font-size: .9rem; }
.form label input { margin-top: 6px; }
.form .check { display: flex; gap: 10px; align-items: center; color: var(--texte); }
.form .check input { width: 22px; height: 22px; margin: 0; }
.fichier { cursor: pointer; }

/* --- Barre d'onglets --- */
#nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: #14171d; border-top: 1px solid var(--bord); padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
#nav button { flex: 1; padding: 8px 0 10px; font-size: 1.3rem; opacity: .55; }
#nav button span { display: block; font-size: .72rem; }
#nav button.actif { opacity: 1; color: var(--accent); }

/* --- Fenêtre modale & toast --- */
#modal { display: none; position: fixed; inset: 0; z-index: 20; }
#modal.vu { display: block; }
.fond { position: absolute; inset: 0; background: #000a; }
.boite { position: absolute; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto; background: var(--carte); border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
.boite label { display: block; margin: 10px 0; color: var(--mute); font-size: .9rem; }
.boite label input, .boite label select { margin-top: 6px; }
.boutons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#toast { position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px); background: var(--carte2); border: 1px solid var(--bord); padding: 10px 16px; border-radius: 30px; opacity: 0; transition: .25s; pointer-events: none; z-index: 30; white-space: nowrap; }
#toast.vu { opacity: 1; transform: translate(-50%, 0); }

/* --- Schémas SVG des exercices --- */
.schema .sol { stroke: var(--bord); stroke-width: 2; }
.schema .eq { stroke: #5b6372; stroke-width: 4; stroke-linecap: round; fill: none; }
.schema .eq.fin { stroke-width: 2; opacity: .7; }
.schema .eq-l { stroke: #4a5160; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.schema .eq-f { fill: #3a404d; }
.schema .tapis { fill: #2a5a8a; }
.schema .os { stroke: var(--fig); stroke-width: 7; stroke-linecap: round; }
.schema .os.loin { stroke: var(--fig2); }
.schema .os.pied { stroke-width: 6; }
.schema .tete { fill: var(--fig); }
.schema .cable { stroke: #9aa1ad; stroke-width: 1.5; }
.schema .plaque { fill: var(--accent); stroke: #a94c08; stroke-width: 2; }
.schema .moyeu { fill: #3a404d; }
.schema .halt, .schema .rouleau { fill: var(--accent); }
.schema .poignee { fill: #c9ced8; }
.schema .plateau { stroke: #8a92a2; stroke-width: 6; stroke-linecap: round; }
.schema .halt-ico { fill: var(--fig2); }
