/* Redpoint, l'app grimpeur : le standard des apps d'entraînement, fond quasi noir, cartes anthracite, un seul accent rouge.
   Contrastes vérifiés au calcul (WCAG AA). Effort = rouge, repos = bleu : paire distincte pour les daltoniens. */
@font-face {
  font-family: Archivo; src: url(fonts/archivo.woff2) format('woff2');
  font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
}
:root {
  color-scheme: dark;
  --bg: #0b0b0c;
  --card: #1c1c1e;       /* cartes */
  --card2: #2a2a2d;      /* puces, vignettes, pistes */
  --line: #38383c;       /* séparateurs décoratifs */
  --stroke: #6e6e74;     /* contours de champs : 3.3:1 sur les cartes */
  --fg: #f5f5f5;
  --mut: #a1a1a6;        /* texte secondaire : 6.6:1 sur les cartes */
  --brand: #c72122;      /* aplats rouges, texte blanc 5.7:1 */
  --lit: #ff5a4e;        /* rouge en texte et en trait sur fond sombre : 5.5:1 sur les cartes */
  --rest: #1666aa;       /* repos, texte blanc 6:1 */
  --warn: #f7bc50;
  --err: #f67c8e;
  --onsight: #61cb7c;
  --flash: #f2cf3b;
  --f: Archivo, system-ui, sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --sat: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --sab: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --sal: var(--safe-area-inset-left, env(safe-area-inset-left, 0px));
  --sar: var(--safe-area-inset-right, env(safe-area-inset-right, 0px));
  --gl: max(16px, var(--sal));
  --gr: max(16px, var(--sar));
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--brand) 60%, transparent); color: #fff; }
:focus-visible { outline: 2px solid var(--lit); outline-offset: 2px; }
html { background: var(--bg); }
body {
  display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh;
  max-width: calc(528px + var(--gl) + var(--gr)); margin: 0 auto; padding: calc(12px + var(--sat)) var(--gr) 0 var(--gl);
  background: var(--bg); color: var(--fg); font: 400 16px/1.45 var(--f); font-variant-numeric: tabular-nums;
  accent-color: var(--brand); caret-color: var(--lit); overflow-wrap: break-word; -webkit-font-smoothing: antialiased;
}
main { flex: 1; padding-bottom: 28px; }
button, .btn { -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; font: inherit; color: inherit; }
button { cursor: pointer; }
.ic { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Typographie : titres en capitales étroites extra-grasses, texte en largeur normale */
h1, h2, .display { font-weight: 800; font-stretch: 75%; text-transform: uppercase; letter-spacing: .005em; line-height: 1.02; text-wrap: balance; }
h1 { margin: 14px 0 6px; font-size: 2.15rem; }
h2 { margin: 0 0 6px; font-size: 1.9rem; }
h3 { margin: 30px 0 12px; font-size: 1.1rem; font-weight: 700; }
p { margin: 0; }
.mut { color: var(--mut); }
.lead { margin: 6px 0 18px; font-size: 1.05rem; max-width: 60ch; }
.small { font-size: .875rem; }
.empty { margin: 24px 0; color: var(--mut); }
.err { min-height: 1.4em; color: var(--err); }
.hint { color: var(--mut); font-size: .9rem; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Boutons */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 56px; padding: 14px 22px;
  border: 0; border-radius: 99px; background: var(--brand); color: #fff; font-size: 1.06rem; font-weight: 700; text-align: center;
  transition: transform .12s var(--ease), background-color .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; transform: none; cursor: progress; }
.btn.ghost { background: var(--card2); color: var(--fg); }
.btn.text { min-height: 48px; background: none; color: var(--mut); font-weight: 600; }
.btn.text:active { color: var(--fg); }
.btn.small { width: auto; min-height: 44px; padding: 10px 18px; font-size: .95rem; }
.btn + .btn { margin-top: 10px; }
.danger, .btn.danger { color: var(--err) !important; }
.icon-btn { display: grid; place-items: center; width: 48px; height: 48px; padding: 0; border: 0; border-radius: 50%; background: none; }
.icon-btn:active { background: var(--card2); }
.icon-btn .ic { width: 26px; height: 26px; }
.back { display: inline-flex; align-items: center; gap: 2px; min-height: 48px; margin-left: -8px; padding: 8px 12px 8px 0; border: 0; background: none; color: var(--fg); font-weight: 600; }
.back .ic { width: 26px; height: 26px; }

/* Champs */
label { display: block; color: var(--mut); font-size: .875rem; font-weight: 500; }
input:not([type=checkbox]), select {
  width: 100%; margin-top: 6px; padding: 14px; border: 1px solid var(--stroke); border-radius: 14px;
  background: var(--card); color: var(--fg); font: 500 1rem var(--f);
}
input:not([type=checkbox]):focus-visible, select:focus-visible { outline-offset: 0; border-color: var(--lit); }
::placeholder { color: var(--mut); opacity: 1; }
form > * + * { margin-top: 14px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid > * + * { margin-top: 0; }
.grid .btn + .btn { margin-top: 0; }
.full { grid-column: 1 / -1; }
fieldset { margin-inline: 0; padding: 0; border: 0; display: flex; flex-wrap: wrap; gap: 8px; }
legend { margin-bottom: 8px; padding: 0; color: var(--mut); font-size: .875rem; font-weight: 500; }
fieldset label { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 16px; border: 1px solid var(--line); border-radius: 99px; background: var(--card); color: var(--fg); font-size: 1rem; }
fieldset label:has(:checked) { border-color: var(--lit); background: color-mix(in srgb, var(--brand) 22%, var(--card)); }
fieldset input { width: 20px; height: 20px; margin: 0; }

/* Cartes, puces, listes */
.card { display: grid; gap: 10px; width: 100%; padding: 20px; border: 0; border-radius: 24px; background: var(--card); color: var(--fg); text-align: left; }
button.card { transition: transform .12s var(--ease); }
button.card:active { transform: scale(.985); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 7px 13px; border-radius: 99px; background: var(--card2); font-size: .9rem; font-weight: 600; }
.chip.soft { background: color-mix(in srgb, var(--rest) 35%, var(--card2)); }
.warn { display: flex; align-items: flex-start; gap: 8px; color: var(--warn); font-size: .92rem; font-weight: 500; }
.warn .ic { margin-top: 1px; }
.badge { padding: 3px 10px; border-radius: 99px; background: var(--brand); color: #fff; font-size: .78rem; font-weight: 700; font-stretch: 100%; text-transform: none; letter-spacing: 0; white-space: nowrap; }
.rows { border-radius: 20px; background: var(--card); overflow: hidden; }
.row { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 12px 16px; border: 0; background: none; color: var(--fg); text-align: left; }
.row + .row { border-top: 1px solid var(--line); }
.row:active { background: var(--card2); }
.row > span:not(.ri, .thumb) { flex: 1; display: grid; gap: 2px; min-width: 0; }
.row b { font-weight: 600; }
.row small { color: var(--mut); font-size: .875rem; }
.row > .ic { color: var(--mut); }
.ri { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--card2); color: var(--lit); }
.account { margin-top: 28px; }
.card .rows { margin: 4px -8px 0; background: var(--card2); }
.card .rows .row + .row { border-top-color: #3d3d42; }
.card .rows .row:active { background: #343438; }

progress { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border: 0; border-radius: 99px; overflow: hidden; background: var(--card2); }
progress::-webkit-progress-bar { background: var(--card2); }
progress::-webkit-progress-value { background: var(--lit); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--lit); border-radius: 99px; }

/* Figures d'exercices (www/figures.js) : trait blanc, point rouge sur la prise */
.figure polyline, .figure path, .figure circle { fill: none; stroke: var(--fg); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.figure .prop { stroke: #5c5c63; stroke-width: 2.2; }
.figure .head { fill: var(--card); }
.figure .ghost { opacity: .25; }
.figure .dot { fill: var(--lit); stroke: none; }
.figure .lest { fill: var(--mut); stroke: none; }
.thumb { display: grid; place-items: center; flex: none; width: 56px; height: 56px; border-radius: 14px; background: var(--card2); }
.thumb .figure { width: 48px; height: 52px; }
.thumb .figure :is(polyline, path, circle) { stroke-width: 4.6; }
.thumb .figure .head { fill: var(--card2); }

/* En-tête des onglets */
.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.top h1 { margin-bottom: 4px; }
.avatar { flex: none; display: grid; place-items: center; width: 48px; height: 48px; margin-top: 10px; border: 0; border-radius: 50%; background: var(--card2); font-weight: 800; font-size: 1.15rem; }
.avatar:active { background: var(--line); }

/* Aujourd'hui : la prochaine séance */
.hero { gap: 12px; padding: 18px 18px 20px; }
.strip { display: flex; gap: 8px; margin: 0 0 6px; overflow: hidden; }
.hero h2 { margin: 2px 0 0; font-size: 2.1rem; }
.hero .btn { margin-top: 6px; }
.hero .btn + .btn { margin-top: 0; }
.block h3 { margin-top: 30px; }
.week { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.week li { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px; border-radius: 18px; background: var(--card); }
.week i { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line); font: 700 .95rem var(--f); font-style: normal; color: var(--mut); }
.week .done i { border-color: var(--brand); background: var(--brand); color: #fff; }
.week .next i { border-color: var(--lit); color: var(--fg); }
.week span { font-weight: 600; }
.week small { color: var(--mut); font-size: .85rem; }
.week .next small { color: var(--lit); font-weight: 600; }

/* Programmes */
.prog { gap: 8px; margin-bottom: 12px; }
.prog .ph { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.prog b { font-weight: 800; font-stretch: 75%; font-size: 1.45rem; text-transform: uppercase; line-height: 1.05; }
.prog .progress { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.prog .progress small { color: var(--mut); font-size: .85rem; }
.weeks { display: grid; gap: 4px; margin: 22px 0 0; padding: 14px 16px; border-radius: 20px; background: var(--card); list-style: none; }
.weeks li { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; }
.weeks li > span:first-child { display: flex; align-items: baseline; gap: 8px; font-weight: 600; }
.weeks small { color: var(--mut); font-size: .82rem; font-weight: 500; }
.dots { display: flex; gap: 8px; }
.dots i { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); }
.dots .done { border-color: var(--brand); background: var(--brand); color: #fff; }
.dots .done .ic { width: 16px; height: 16px; stroke-width: 3; }
.dots .next { border-color: var(--lit); box-shadow: inset 0 0 0 5px var(--card), inset 0 0 0 14px var(--lit); }
.exlist { margin: 0; padding: 0; list-style: none; }
.exlist li { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 10px 0; }
.exlist li + li { border-top: 1px solid var(--line); }
.exlist b { display: block; font-weight: 600; }
.exlist small { color: var(--mut); font-size: .875rem; }
.exlist .tag { color: var(--lit); }
.exlist .end { display: flex; align-items: center; gap: 4px; }
.exlist .icon-btn { margin-right: -12px; color: var(--mut); } /* icône calée sur le bord, zone de toucher de 48 px */
.exlist .icon-btn.on { color: var(--lit); } /* exercice remplacé ou désactivé */
.exlist li.off > :not(.end) { opacity: .45; }
.dock { position: sticky; bottom: 0; z-index: 1; margin: 18px calc(-1 * var(--gr)) 0 calc(-1 * var(--gl)); padding: 12px var(--gr) calc(12px + var(--sab)) var(--gl); background: var(--bg); }
body:not(.focus) .dock { bottom: calc(64px + var(--sab)); } /* au-dessus de la barre d'onglets */

/* Journal */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 16px; }
.stats div { display: grid; gap: 2px; padding: 14px 8px; border-radius: 18px; background: var(--card); text-align: center; }
.stats b { font-weight: 800; font-stretch: 75%; font-size: 1.9rem; line-height: 1; color: var(--lit); }
.stats span { color: var(--mut); font-size: .78rem; }
#add { margin-top: 12px; }
#list { margin: 18px 0; padding: 0; list-style: none; }
#list li { display: grid; grid-template-columns: 4.6rem minmax(0, 1fr) auto; align-items: center; gap: 2px 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
#list b { display: flex; align-items: center; gap: 8px; grid-row: span 2; font-weight: 800; font-stretch: 75%; font-size: 1.45rem; }
#list b::before { content: ''; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--dot, transparent); box-shadow: inset 0 0 0 2px var(--dot-ring, var(--dot, transparent)); }
.s-redpoint { --dot: var(--lit); }
.s-flash { --dot: var(--flash); }
.s-onsight { --dot: var(--onsight); }
.s-project { --dot-ring: var(--stroke); }
#list small { grid-column: 2; color: var(--mut); }
#list button { grid-row: 1 / span 2; grid-column: 3; display: grid; place-items: center; min-width: 48px; min-height: 48px; padding: 0; border: 0; background: none; color: var(--mut); }

/* Minuteur libre, profil */
#cfg, #profileForm { margin-top: 22px; }
.total { margin-top: 16px; color: var(--mut); }
.total b { color: var(--fg); }

/* Connexion */
.brand { display: flex; align-items: center; gap: 14px; margin: 28px 0 8px; }
.brand img { border-radius: 16px; }
.brand h1 { margin: 0; font-size: 2.6rem; }
#authForm .btn:first-of-type { margin-top: 4px; }

/* Lecteur de séance */
body.focus nav { display: none; }
#run { display: flex; flex-direction: column; min-height: calc(100dvh - 12px - var(--sat)); }
.runbar { display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; margin: -4px -8px 0; }
.runbar b { text-align: center; font-weight: 700; font-size: 1.02rem; }
.runbar span { color: var(--mut); font-weight: 700; text-align: center; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; margin-top: 10px; }
.seg i { position: relative; height: 4px; border-radius: 2px; background: var(--card2); overflow: hidden; }
.seg i::after { content: ''; position: absolute; inset: 0; background: var(--lit); transform: scaleX(var(--f, 0)); transform-origin: left; transition: transform .5s var(--ease); }
.runbody { flex: 1; }
.runbody > h1 { margin-top: 18px; }
.runbody > .chips, .runbody > .warn { margin-top: 12px; }
.step { animation: enter .42s var(--ease); }
@keyframes enter { from { transform: translateX(18px); opacity: .35; } }
.figcard { display: grid; place-items: center; height: min(34dvh, 260px); margin-top: 16px; border-radius: 24px; background: linear-gradient(160deg, #26262a, #151517); }
.figcard .figure { width: auto; height: 92%; max-width: 92%; }
.figcard .figure .head { fill: #1f1f22; }
.now { display: flex; align-items: center; gap: 16px; margin-top: 18px; }
.ring { position: relative; flex: none; width: 96px; height: 96px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3.4; }
.ring .track { stroke: var(--card2); }
.ring .arc { stroke: var(--lit); stroke-linecap: round; transition: stroke-dasharray .5s var(--ease); }
.ring b { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; font-weight: 800; font-stretch: 75%; font-size: 1.75rem; line-height: 1; }
.ring small { margin-top: 3px; color: var(--mut); font-size: .75rem; font-weight: 500; font-stretch: 100%; }
.coach { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.coach .av { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800; font-size: 1.05rem; }
.coach p { padding: 11px 14px; border-radius: 4px 18px 18px 18px; background: var(--card); font-size: 1rem; font-weight: 500; line-height: 1.4; }
.runbody > .coach { margin-top: 18px; }
.how { margin-top: 16px; color: var(--mut); }
.how summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; color: var(--fg); font-weight: 600; cursor: pointer; list-style: none; }
.how summary::-webkit-details-marker { display: none; }
.how summary::after { content: ''; width: 9px; height: 9px; margin: 0 6px 4px 0; border-right: 2px solid var(--mut); border-bottom: 2px solid var(--mut); transform: rotate(45deg); transition: transform .2s var(--ease); }
.how[open] summary::after { margin-bottom: -4px; transform: rotate(-135deg); }
.how p { max-width: 65ch; padding-bottom: 8px; line-height: 1.5; }
#run .dock { bottom: 0; margin-top: 16px; }
#run .dock .btn + .btn { margin-top: 2px; }
.pair { display: flex; margin-top: 2px; }
.pair .btn + .btn { margin-top: 0; }
.done-badge { display: grid; place-items: center; width: 76px; height: 76px; margin: 26px 0 4px; border-radius: 50%; background: var(--brand); }
.done-badge .ic { width: 40px; height: 40px; stroke-width: 2.6; color: #fff; }
.sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 18px; }
.sum div { display: grid; gap: 2px; padding: 14px 10px; border-radius: 18px; background: var(--card); }
.sum b { font-weight: 800; font-stretch: 75%; font-size: 1.7rem; line-height: 1.05; }
.sum span { color: var(--mut); font-size: .8rem; }
.status { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; min-height: 64px; padding: 10px 10px 10px 16px; border-radius: 18px; background: var(--card); }
.status p { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.status .ok .ic { color: var(--lit); stroke-width: 2.6; }
.status .btn { flex: none; }

/* Compte à rebours plein écran : effort rouge, repos bleu, chiffre à taille d'affiche lisible à 2 m */
#countdown {
  position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center;
  padding: calc(8px + var(--sat)) var(--gr) calc(16px + var(--sab)) var(--gl);
  background: var(--card); color: #fff; text-align: center; transition: background-color .25s; -webkit-user-select: none; user-select: none;
}
#countdown.hang { background: var(--brand); }
#countdown.rest { background: var(--rest); }
#countdown.grow { animation: grow .5s var(--ease); }
@keyframes grow { from { clip-path: circle(28px at var(--x, 50%) var(--y, 90%)); } to { clip-path: circle(150vmax at var(--x, 50%) var(--y, 90%)); } }
#cClose { position: absolute; top: calc(8px + var(--sat)); left: max(8px, var(--sal)); color: #fff; }
#cClose:active { background: rgb(255 255 255 / .15); }
#cTitle { min-height: 48px; padding: 12px 56px 0; font-weight: 700; font-size: 1.02rem; }
.face { flex: 1; display: grid; place-content: center; }
#cPhase { font-weight: 800; font-stretch: 75%; font-size: 2rem; text-transform: uppercase; letter-spacing: .01em; }
#cTime { font-weight: 800; font-stretch: 62%; font-size: min(64vw, 42dvh); line-height: .92; letter-spacing: -.02em; }
#cTime.long { font-size: min(44vw, 34dvh); } /* « 1:30 » : quatre signes au lieu de deux */
.has-next #cTime { font-size: min(54vw, 30dvh); }
.has-next #cTime.long { font-size: min(40vw, 26dvh); }
#cSub { min-height: 1.5em; font-weight: 600; font-size: 1.15rem; }
.bar { width: min(78vw, 420px); height: 10px; margin: 16px auto 0; border-radius: 99px; background: rgb(255 255 255 / .25); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: #fff; transform-origin: left; transition: transform .1s linear; }
#cNext { display: flex; align-items: center; gap: 16px; width: 100%; max-width: 528px; margin-bottom: 14px; padding: 12px 16px 12px 12px; border-radius: 22px; background: rgb(255 255 255 / .14); text-align: left; }
.nfig { flex: none; display: grid; place-items: center; width: 104px; height: 88px; border-radius: 16px; background: rgb(0 0 0 / .2); }
.nfig .figure { width: 92%; height: 92%; }
.nfig .figure :is(polyline, path, circle) { stroke: #fff; stroke-width: 3.6; }
.nfig .figure .prop { stroke: rgb(255 255 255 / .45); }
.nfig .figure .head { fill: #2a5e8f; }
.nfig .figure .dot { fill: #fff; }
#cNext small { display: block; font-size: .85rem; font-weight: 600; opacity: .85; }
#cNext b { display: block; font-weight: 800; font-stretch: 75%; font-size: 1.7rem; line-height: 1.05; text-transform: uppercase; }
#cNext span:last-child { display: block; margin-top: 2px; font-size: 1.05rem; font-weight: 600; }
#cCoach { max-width: 32ch; min-height: 3em; margin-bottom: 18px; font-size: 1.05rem; font-weight: 500; }
.ctrl { display: flex; gap: 10px; width: 100%; max-width: 528px; }
.ctrl .btn { margin: 0; background: rgb(255 255 255 / .18); color: #fff; }
.ctrl .btn:active { background: rgb(255 255 255 / .28); }
@media (max-height: 640px) { #cCoach { display: none; } #cNext { margin-bottom: 10px; } .nfig { width: 84px; height: 70px; } }

/* Barre d'onglets Android, dans le flux : elle ne masque jamais la fin du contenu */
nav { position: sticky; bottom: 0; z-index: 2; display: flex; margin: 0 calc(-1 * var(--gr)) 0 calc(-1 * var(--gl)); padding: 0 var(--sar) var(--sab) var(--sal); background: var(--bg); border-top: 1px solid var(--line); }
nav button { flex: 1; display: grid; justify-items: center; align-content: center; gap: 4px; min-height: 64px; padding: 8px 4px 10px; border: 0; background: none; color: var(--mut); font-size: .8rem; font-weight: 600; line-height: 1.2; }
nav .ic { width: 56px; height: 30px; padding: 3px 16px; border-radius: 99px; transition: background-color .15s; }
nav button[aria-current=page] { color: var(--fg); }
nav button[aria-current=page] .ic { background: color-mix(in srgb, var(--brand) 38%, transparent); color: #fff; }
nav button:not([aria-current=page]):active .ic { background: var(--card2); }
@media (min-width: 600px) { nav { border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0; } }
@media (pointer: coarse) { body:has(input:not([type=checkbox], [type=date], [type=file]):focus) nav { display: none; } }

/* Feuille « Remplacer l'exercice », remontée du bas comme une feuille Android */
.sheet {
  width: 100%; max-width: calc(528px + var(--gl) + var(--gr)); max-height: 88dvh; margin: auto auto 0; padding: 24px var(--gr) calc(8px + var(--sab)) var(--gl);
  border: 0; border-radius: 28px 28px 0 0; background: var(--card); color: var(--fg); overflow-y: auto;
}
.sheet::backdrop { background: rgb(0 0 0 / .6); }
.sheet[open] { animation: rise .32s var(--ease); }
@keyframes rise { from { transform: translateY(40%); opacity: 0; } }
.sheet .rows { margin-top: 16px; background: var(--card2); }
.sheet .row + .row { border-top-color: #3d3d42; }
.sheet .row:active { background: #343438; }
.sheet .row .thumb, .sheet .thumb .figure .head { background: var(--card); fill: var(--card); }
.sheet .row > .ic { color: var(--lit); stroke-width: 2.6; }
.sheet .thumb > .ic { width: 26px; height: 26px; color: var(--mut); }
.sheet .btn.text { margin-top: 6px; }

/* Robustesse : bannière hors ligne, chargement, message */
.banner { display: grid; gap: 10px; padding: 14px 16px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 18px; color: var(--mut); font-size: .92rem; }
.banner .btn { justify-self: start; margin: 0; }
.skeleton { height: 96px; margin-bottom: 12px; border-radius: 24px; background: var(--card); animation: pulse 1.4s ease-in-out infinite; }
.skeleton.tall { height: 300px; }
@keyframes pulse { 50% { opacity: .45; } }
#toast {
  position: fixed; z-index: 20; left: var(--gl); right: var(--gr); bottom: calc(80px + var(--sab)); max-width: 528px; margin: 0 auto;
  padding: 14px 18px; border-radius: 16px; background: var(--fg); color: var(--bg); font-weight: 600; box-shadow: 0 8px 24px rgb(0 0 0 / .5);
}
#toast:empty { display: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::after { animation: none !important; transition: none !important; }
}
