:root {
  --bg: #0a0b0d;
  --surface: #131519;
  --surface-2: #1a1d22;
  --surface-3: #23272e;
  --line: #24272d;
  --text: #f2f4f7;
  --muted: #9aa3af;
  --faint: #7d8693;
  --accent: #f2f4f7;
  --c-peak: #c8f04a;
  --c-full: #3ddc97;
  --c-normal: #4cb8ff;
  --c-light: #ffb547;
  --c-recovery: #a98bff;
  --danger: #ff6b6b;
  --fig: #e9edf2;
  --fig-2: #646d7a;
  --kit: #8a94a2;
  --radius: 22px;
  --radius-sm: 14px;
  --font-display: "Barlow Condensed", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, sans-serif;
  --tabbar-h: 66px;
  --lvl: var(--c-normal);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--lvl); outline-offset: 2px; }
/* Surfaces du navigateur aux couleurs de l'app */
::selection { background: color-mix(in srgb, var(--lvl) 38%, transparent); color: var(--text); }
input { caret-color: var(--lvl); }
html, .sheet { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 18px) 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px);
}
.app.no-tabs { padding-bottom: 120px; }

/* ───────── Typo */
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-family: var(--font-display); font-size: 34px; line-height: 1; text-transform: uppercase; letter-spacing: 0.01em; }
h2 { font-family: var(--font-display); font-size: 28px; line-height: 1.05; text-transform: uppercase; letter-spacing: 0.01em; }
h3 { font-size: 17px; }
.kicker { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }

.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 18px; }
.top .date { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: capitalize; margin-bottom: 4px; }
.sec { display: flex; justify-content: space-between; align-items: baseline; margin: 28px 2px 12px; }
.sec h2, .sec h3 { font-family: var(--font-display); font-size: 20px; text-transform: uppercase; letter-spacing: 0.03em; }

/* ───────── Surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 12px; }

/* ───────── Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--surface-2); font-weight: 800; font-size: 16px;
  transition: transform .12s ease, background .2s ease, opacity .2s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--lvl); border-color: transparent; color: #0a0b0d; }
.btn.white { background: var(--text); color: var(--bg); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); background: transparent; border-color: rgb(255 107 107 / .35); }
.btn.block { width: 100%; }
.btn.lg { min-height: 58px; font-size: 17px; border-radius: 18px; }
.btn svg, .icon-btn svg, .link svg, .ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary svg { fill: currentColor; stroke: none; }
.link { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 8px 0; color: var(--muted); font-weight: 700; font-size: 14px; }
.link svg { width: 16px; height: 16px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); display: grid; place-items: center; flex-shrink: 0; position: relative;
}
.icon-btn.sm { width: 36px; height: 36px; border-radius: 11px; }
.icon-btn.sm svg { width: 17px; height: 17px; }
.icon-btn .dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--c-light); border: 2px solid var(--surface); }
.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────── Puces, segments */
.chip {
  min-height: 44px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2);
  font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: all .15s;
}
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.tag svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.tag.lvl { background: color-mix(in srgb, var(--lvl) 16%, transparent); color: var(--lvl); }
.tag.ok { color: var(--c-full); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border-radius: 14px; padding: 4px; gap: 4px; }
.segmented button { min-height: 40px; border: 0; background: transparent; border-radius: 10px; font-weight: 700; font-size: 14px; color: var(--muted); }
.segmented button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }

.lvl-ico { display: inline-grid; place-items: center; }
.lvl-ico svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

[data-lvl="peak"] { --lvl: var(--c-peak); }
[data-lvl="full"] { --lvl: var(--c-full); }
[data-lvl="normal"] { --lvl: var(--c-normal); }
[data-lvl="light"] { --lvl: var(--c-light); }
[data-lvl="recovery"] { --lvl: var(--c-recovery); }

/* ───────── Énergie du jour */
.hero {
  position: relative; overflow: hidden; border-radius: 28px; padding: 18px 18px 16px;
  background: radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--lvl) 20%, transparent), transparent 70%), var(--surface);
  border: 1px solid color-mix(in srgb, var(--lvl) 22%, var(--line));
}
.gauge { position: relative; width: 210px; margin: 0 auto; }
.gauge svg { width: 100%; height: auto; }
.gauge .track { stroke: var(--surface-3); }
.gauge .spent { stroke: var(--lvl); opacity: .22; }
.gauge .val { stroke: var(--lvl); transition: stroke-dasharray 1s cubic-bezier(.2,.8,.2,1); filter: drop-shadow(0 0 10px color-mix(in srgb, var(--lvl) 45%, transparent)); }
.gauge .tick { stroke: var(--bg); stroke-width: 3; }
.gauge .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding-top: 8px; }
.gauge .score { font-family: var(--font-display); font-size: 76px; font-weight: 700; line-height: .9; letter-spacing: -0.02em; }
.gauge .lbl { font-size: 11px; font-weight: 800; letter-spacing: 0.16em; color: var(--muted); margin-top: 2px; }
.gauge .approx { font-size: .5em; vertical-align: .55em; margin-right: 2px; color: var(--muted); letter-spacing: 0; }
.gauge.estimated .val { opacity: .7; }
.hero-level { margin-top: -14px; text-align: center; font-family: var(--font-display); font-size: 26px; font-weight: 700; text-transform: uppercase; color: var(--lvl); letter-spacing: .02em; display: flex; align-items: center; justify-content: center; gap: 8px; }
.hero-level .lvl-ico svg { width: 22px; height: 22px; }
.hero-sub { text-align: center; font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.signals { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 12px; }
.signal { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: rgb(255 255 255 / .05); font-size: 12.5px; font-weight: 700; color: var(--text); border: 0; }
.signal i { width: 7px; height: 7px; border-radius: 50%; background: var(--c-light); flex-shrink: 0; }
.signal.good i { background: var(--c-full); }
.signal.bad i { background: var(--danger); }
.signal.more { color: var(--muted); }
.comps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.comp { background: rgb(255 255 255 / .04); border-radius: 14px; padding: 10px 8px 9px; text-align: center; border: 0; }
.comp .ico { color: var(--muted); display: grid; place-items: center; }
.comp .ico svg { width: 18px; height: 18px; }
.comp .v { font-family: var(--font-display); font-size: 19px; font-weight: 700; margin-top: 4px; white-space: nowrap; }
.comp .k { font-size: 11px; color: var(--muted); font-weight: 700; }
.comp .bar { height: 4px; border-radius: 2px; background: var(--surface-3); margin-top: 7px; overflow: hidden; }
.comp .bar i { display: block; height: 100%; border-radius: 2px; background: var(--c-normal); }
.comp .bar i.hi { background: var(--c-full); }
.comp .bar i.mid { background: var(--c-light); }
.comp .bar i.lo { background: var(--danger); }
.hero-cta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.hero-cta .btn { min-height: 46px; font-size: 14px; padding: 0 10px; white-space: nowrap; }

/* Semaine */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.week .wd { display: grid; justify-items: center; gap: 6px; font-size: 11px; font-weight: 800; color: var(--faint); position: relative; }
.week .wd i { width: 100%; max-width: 38px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: var(--surface); }
.week .wd i svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.week .wd.planned i { border: 1.5px dashed #3a3f48; background: transparent; }
.week .wd.done i { background: color-mix(in srgb, var(--c-full) 22%, transparent); color: var(--c-full); }
.week .wd.today { color: var(--text); }
.week .wd.today i { border: 2px solid var(--text); background: transparent; }
.week .wd.missed i { border: 1.5px dashed color-mix(in srgb, var(--danger) 60%, transparent); background: transparent; }
.week .wd.rest i { background: transparent; }
.week .wd.sport::after { content: ""; position: absolute; bottom: -6px; width: 5px; height: 5px; border-radius: 50%; background: var(--c-normal); }

/* Ressenti */
.checkin { display: grid; gap: 14px; }
.ck-row .ck-lbl { display: flex; justify-content: space-between; font-size: 13px; font-weight: 800; margin-bottom: 8px; }
.ck-row .ck-lbl span:last-child { color: var(--muted); font-weight: 700; }
.ck-scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.ck-scale.three { grid-template-columns: repeat(3, 1fr); }
.ck-scale .chip { padding: 0; min-height: 48px; flex-direction: column; gap: 2px; font-size: 11px; }
.ck-scale .chip svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ck-scale .chip[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.ck-summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ───────── Séance du jour */
.session { padding: 18px 0 16px; overflow: hidden; }
.session > .pad { padding: 0 18px; }
.session-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.session-top h2 { margin-top: 4px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.plan-note { margin-top: 10px; font-size: 13px; font-weight: 700; color: var(--lvl); }
.rail { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 14px 18px 4px; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.tile {
  flex: 0 0 132px; scroll-snap-align: start; background: var(--surface-2); border: 1px solid var(--line); border-radius: 18px;
  padding: 8px 8px 10px; text-align: left; display: flex; flex-direction: column; gap: 4px; position: relative;
}
.tile .fig { width: 100%; aspect-ratio: 1; background: radial-gradient(circle at 50% 60%, rgb(255 255 255 / .04), transparent 70%); border-radius: 12px; }
.tile .nm { font-size: 13px; font-weight: 800; line-height: 1.2; min-height: 2.4em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .rx { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--lvl); }
.tile .rx small { font-family: var(--font-body); font-size: 11px; color: var(--muted); font-weight: 700; }
.tile .ss { position: absolute; top: 8px; left: 8px; font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 6px; background: var(--surface-3); color: var(--muted); }
.session .actions { padding: 14px 18px 0; }
.adjust { margin-top: 12px; }
.adjust .segmented button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 50px; font-size: 11px; }
.adjust .segmented button .lvl-ico svg { width: 17px; height: 17px; }
.adjust .segmented button[aria-pressed="true"] { color: var(--lvl); background: color-mix(in srgb, var(--lvl) 16%, var(--surface-3)); }
.session-muscles { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.session-muscles .mmap { width: 96px; flex-shrink: 0; }
.session-muscles .names { font-size: 13px; color: var(--muted); font-weight: 600; }
.session-muscles .names b { color: var(--text); font-weight: 800; }

.done-card { text-align: center; padding: 28px 18px; }
.done-card .big { width: 60px; height: 60px; border-radius: 50%; margin: 0 auto 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--lvl) 20%, transparent); color: var(--lvl); }
.done-card .big svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.stale-card { border-color: color-mix(in srgb, var(--c-light) 45%, var(--line)); margin-bottom: 12px; }

/* Nutrition */
.nutri { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.nut { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 12px 8px; display: grid; justify-items: center; text-align: center; }
.nut .ring { width: 58px; height: 58px; position: relative; }
.nut .ring.none { border-radius: 50%; background: var(--surface-2); }
.nut .ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.nut .ring .t { stroke: var(--surface-3); }
.nut .ring .p { stroke: var(--c-full); stroke-linecap: round; }
.nut .ring .ic { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.nut .ring .ic svg { width: 20px; height: 20px; transform: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nut .v { font-family: var(--font-display); font-size: 21px; font-weight: 700; margin-top: 6px; }
.nut .k { font-size: 11.5px; color: var(--muted); font-weight: 700; }

/* ───────── Schémas d'exercices */
.fig line, .fig polyline { stroke-linecap: round; stroke-linejoin: round; fill: none; }
.p-n { fill: var(--fig); }
.p-f { fill: var(--fig-2); }
.p-h { fill: var(--lvl); }
.p-hf { fill: color-mix(in srgb, var(--lvl) 45%, #15181d); }
.ghost { opacity: .14; }
.ghost * { fill: var(--fig); }
/* Le muscle principal s'allume pendant la phase d'effort */
.fig.anim .p-h, .fig.anim .p-hf { opacity: .62; transition: opacity .35s ease, filter .35s ease; }
.fig.anim.work .p-h, .fig.anim.work .p-hf { opacity: 1; filter: drop-shadow(0 0 1.2px var(--lvl)); }
.shadow { fill: #000; }
.trace { fill: none; stroke: var(--lvl); stroke-width: 1.1; stroke-linecap: round; stroke-dasharray: 0 2.6; opacity: .75; }
.kit { stroke: var(--kit); }
.kit-thin { stroke: var(--kit); opacity: .55; }
.kit-ring { fill: none; stroke: var(--kit); stroke-width: 2.4; }
.kit-fill { fill: var(--kit); }
.kit-hub { fill: var(--bg); }
.kit-box { fill: var(--surface-3); stroke: var(--kit); stroke-width: 1.5; }
.floor { stroke: var(--surface-3); stroke-width: 1.5; }

.mmap { width: 100%; height: auto; }
.mm-base { fill: #262a31; }
.mm-o { fill: #30353d; }
.mm-t { fill: color-mix(in srgb, var(--lvl) 22%, #30353d); }
.mm-s { fill: color-mix(in srgb, var(--lvl) 45%, #30353d); }
.mm-p { fill: var(--lvl); }

/* ───────── Mode séance */
.workout-head {
  position: sticky; top: 0; z-index: 5; margin: calc(-18px - env(safe-area-inset-top)) -16px 14px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.workout-head h3 { font-family: var(--font-display); font-size: 22px; text-transform: uppercase; line-height: 1; }
.workout-head .clock { font-family: var(--font-display); font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.progress-bar { height: 4px; background: var(--surface-2); border-radius: 4px; margin-top: 10px; overflow: hidden; }
.progress-bar > i { display: block; height: 100%; background: var(--lvl); border-radius: 4px; transition: width .4s ease; }

.warmup summary { list-style: none; display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.warmup summary::-webkit-details-marker { display: none; }
.warmup .wu-moves { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.warmup .wu { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.warmup .wu .fig { background: var(--surface-2); border-radius: 12px; margin-bottom: 4px; }
.ramp { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }

.ex-card { scroll-margin-top: 100px; padding: 14px; }
.ex-card.done { opacity: .55; }
.ex-head { display: flex; gap: 12px; align-items: center; }
.ex-head .figbox { width: 92px; height: 92px; flex-shrink: 0; background: var(--surface-2); border-radius: 16px; border: 0; padding: 0; position: relative; }
.ex-head .figbox .fig { width: 100%; height: 100%; }
.ex-head .figbox .i { position: absolute; right: 5px; bottom: 5px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; color: var(--muted); }
.ex-head .figbox .i svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.ex-head h3 { font-size: 18px; line-height: 1.15; }
.ex-head .target { font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--lvl); margin-top: 2px; }
.ex-head .target small { font-family: var(--font-body); font-size: 12px; color: var(--muted); font-weight: 700; margin-left: 4px; }
.ss-label { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 18px 4px 8px; display: flex; align-items: center; gap: 8px; }
.ss-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.hint-line { font-size: 13px; font-weight: 700; color: var(--c-full); margin-top: 10px; }
.sets { margin-top: 12px; }
.set-head, .set-row { display: grid; grid-template-columns: 30px minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(0, 1fr) 52px; gap: 6px; align-items: center; }
.set-head { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 0 2px 6px; text-align: center; }
.set-row + .set-row { margin-top: 6px; }
.rpe-q { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 32px; margin: -8px 0; padding: 0; border: 0; background: none; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; }
.rpe-q i { width: 15px; height: 15px; border-radius: 50%; background: var(--surface-3); color: var(--muted); display: grid; place-items: center; font-style: normal; font-size: 9.5px; letter-spacing: 0; }
.rpe-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rpe-list li { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); font-size: 14px; font-weight: 700; }
.rpe-list b { font-family: var(--font-display); font-size: 22px; text-align: center; }
.rpe-list li.cur { outline: 2px solid var(--lvl); outline-offset: -2px; }
.rpe-list li.cur b { color: var(--lvl); }
.sec + .week { margin-top: 0; }
.set-row .idx { font-family: var(--font-display); font-weight: 700; color: var(--muted); text-align: center; font-size: 17px; }
.set-row .idx.top { font-size: 10px; font-family: var(--font-body); font-weight: 800; color: var(--lvl); letter-spacing: .04em; }
.set-row input {
  width: 100%; min-height: 48px; border-radius: 12px; border: 1px solid transparent; background: var(--surface-2);
  text-align: center; font-family: var(--font-display); font-size: 20px; font-weight: 700; padding: 0 4px; font-variant-numeric: tabular-nums;
}
/* Objectif, pas valeur : plus petit et en texte courant, lisible mais clairement distinct d'un chiffre saisi */
.set-row input::placeholder { color: var(--faint); opacity: 1; font-family: var(--font-body); font-size: 14px; font-weight: 600; }
.set-row input:focus { outline: 2px solid var(--lvl); outline-offset: 0; }
.check { width: 100%; height: 48px; border-radius: 12px; border: 0; background: var(--surface-3); display: grid; place-items: center; transition: all .15s; }
.check svg { width: 22px; height: 22px; fill: none; stroke: var(--faint); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.set-row.is-done .check, .check.on { background: var(--lvl); }
.set-row.is-done .check svg, .check.on svg { stroke: var(--bg); }
.set-row.is-done input { color: var(--muted); }
.ex-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; }
.ex-foot .last { font-size: 12px; color: var(--faint); font-weight: 600; min-width: 0; }
.ex-foot .link { white-space: nowrap; flex-shrink: 0; }
.recovery-row { display: flex; gap: 12px; align-items: center; padding: 8px 0; }
.recovery-row + .recovery-row { border-top: 1px solid var(--line); }
.recovery-row .figbox { width: 64px; height: 64px; background: var(--surface-2); border-radius: 14px; flex-shrink: 0; border: 0; padding: 0; }
.recovery-row .figbox .fig { width: 100%; height: 100%; }
.recovery-row .check { width: 52px; flex-shrink: 0; }
.recovery-row.is-done .check { background: var(--lvl); }
.recovery-row.is-done .check svg { stroke: var(--bg); }
.finisher { border-style: dashed; }

/* Minuteur de repos : caché hors écran pour ne jamais recouvrir « Terminer » */
.rest-bar {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(calc(100% + 120px));
  bottom: calc(env(safe-area-inset-bottom) + 84px); width: min(528px, calc(100% - 32px));
  background: var(--text); color: var(--bg); border-radius: 20px; padding: 10px 10px 10px 16px; overflow: hidden;
  display: flex; align-items: center; gap: 12px; z-index: 30; box-shadow: 0 20px 40px -10px rgb(0 0 0 / .7);
  visibility: hidden; pointer-events: none;
  transition: transform .35s cubic-bezier(.2,.8,.2,1), visibility 0s linear .35s;
}
.rest-bar.show { transform: translateX(-50%) translateY(0); visibility: visible; pointer-events: auto; transition: transform .35s cubic-bezier(.2,.8,.2,1), visibility 0s; }
.rest-bar { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 10px 12px; }
.rest-row { display: flex; align-items: center; gap: 12px; padding-left: 6px; }
.rest-bar .t { font-family: var(--font-display); font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 78px; }
.rest-bar .lbl { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; opacity: .6; flex: 1; }
/* Pendant le repos : la série suivante et son geste */
.rest-next { display: flex; align-items: center; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid rgb(0 0 0 / .08); }
.rest-fig { width: 56px; height: 56px; flex-shrink: 0; border-radius: 14px; background: var(--bg); }
.rest-fig .fig { width: 100%; height: 100%; }
.rest-next .nx { font-weight: 800; font-size: 15px; line-height: 1.2; }
.rest-next .nx-t { font-size: 13px; font-weight: 700; opacity: .65; margin-top: 2px; }
.rest-next .lbl { flex: none; }
.rest-bar button { min-height: 44px; padding: 0 14px; border-radius: 12px; border: 0; background: rgb(0 0 0 / .08); font-weight: 800; color: var(--bg); }
.rest-bar .fill { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--lvl); }

.bottom-action { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; padding: 16px 16px calc(env(safe-area-inset-bottom) + 16px); background: linear-gradient(transparent, var(--bg) 35%); }
.bottom-action .inner { max-width: 528px; margin: 0 auto; display: flex; gap: 10px; }

/* ───────── Barre d'onglets */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(16px); border-top: 1px solid var(--line);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-decoration: none; color: var(--faint); font-size: 11px; font-weight: 800; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.active { color: var(--text); }
.tabbar.hidden { display: none; }

/* Séance en cours, rappelée au-dessus des onglets sur les autres écrans */
.app.has-live { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 96px); }
.live-bar {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 19;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 10px); width: min(528px, calc(100% - 32px)); min-height: 58px;
  display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; text-align: left; color: var(--text);
  border-radius: 18px; border: 1px solid color-mix(in srgb, var(--lvl) 45%, var(--line));
  background: color-mix(in srgb, var(--lvl) 14%, var(--surface)); box-shadow: 0 14px 30px -12px rgb(0 0 0 / .8);
  transition: transform .12s ease;
}
.live-bar:active { transform: translateX(-50%) scale(.98); }
.live-dot { width: 10px; height: 10px; flex-shrink: 0; border-radius: 50%; background: var(--lvl); animation: live 1.8s ease-in-out infinite; }
@keyframes live { 50% { opacity: .35; } }
.live-bar b { display: block; font-size: 14px; font-weight: 800; }
.live-bar small { display: block; font-size: 12.5px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-go { display: inline-flex; align-items: center; gap: 2px; flex-shrink: 0; font-size: 14px; font-weight: 800; color: var(--lvl); }
.live-go svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; }

/* ───────── Panneaux */
.sheet-backdrop { position: fixed; inset: 0; background: rgb(0 0 0 / .6); z-index: 40; animation: fade .2s ease; }
.sheet {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); z-index: 41;
  width: min(560px, 100%); max-height: 90dvh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 28px 28px 0 0; padding: 10px 20px calc(env(safe-area-inset-bottom) + 20px);
  animation: up .3s cubic-bezier(.2,.8,.2,1);
}
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 0 auto 14px; }
.sheet h2 { margin-bottom: 6px; }
.sheet-close { position: absolute; top: 14px; right: 14px; }
@keyframes up { from { transform: translate(-50%, 100%); } }
@keyframes fade { from { opacity: 0; } }
/* Sortie plus rapide que l'entrée ; part de la position où le doigt l'a lâché */
.sheet.closing { animation: sheet-out .22s cubic-bezier(.4, 0, 1, 1) forwards; pointer-events: none; }
.sheet-backdrop.closing { animation: fade-out .22s ease forwards; pointer-events: none; }
@keyframes sheet-out { to { transform: translate(-50%, 100%); } }
@keyframes fade-out { to { opacity: 0; } }
.sheet .grab { touch-action: none; }

/* Fiche exercice */
.ex-hero { background: radial-gradient(circle at 50% 55%, color-mix(in srgb, var(--lvl) 10%, transparent), transparent 70%), var(--surface-2); border-radius: 22px; margin: 4px 0 16px; padding: 8px; }
.ex-hero .fig { width: min(100%, 300px); margin: 0 auto; }

/* Lecteur du schéma : frise du tempo, consigne de la phase, pause et ralenti */
.player { display: grid; gap: 10px; }
.player .fig { cursor: pointer; }
.pl-line { display: flex; gap: 3px; height: 4px; margin: 0 8px; }
.pl-line i { position: relative; min-width: 4px; border-radius: 2px; background: rgb(255 255 255 / .1); overflow: hidden; }
.pl-line i.h { background: rgb(255 255 255 / .05); }
.pl-line b { position: absolute; inset: 0; background: var(--muted); transform: scaleX(0); transform-origin: left; }
.pl-line i.w b { background: var(--lvl); }
.pl-bar { display: flex; align-items: center; gap: 10px; padding: 0 4px 4px; }
.pl-btn { width: 44px; height: 44px; flex-shrink: 0; border: 0; border-radius: 14px; background: var(--surface-3); color: var(--text); display: grid; place-items: center; }
.pl-btn svg { width: 18px; height: 18px; fill: currentColor; }
.pl-phase { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.pl-phase b { font-family: var(--font-display); font-size: 22px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .25s ease; }
.pl-phase span { font-size: 13px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.player.work .pl-phase b { color: var(--lvl); }
.player.paused .pl-phase b { color: var(--muted); }
.pl-speed { min-height: 44px; padding: 0 12px; flex-shrink: 0; border: 1px solid var(--line); border-radius: 14px; background: transparent; color: var(--muted); font-weight: 800; font-size: 14px; }
.pl-speed[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.ex-muscles { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: center; margin: 16px 0; }
.legend-m { display: grid; gap: 10px; font-size: 14px; }
.legend-m .lg { display: flex; gap: 8px; align-items: flex-start; }
.legend-m .lg i { width: 10px; height: 10px; border-radius: 3px; margin-top: 5px; flex-shrink: 0; background: var(--lvl); }
.legend-m .lg.s i { background: color-mix(in srgb, var(--lvl) 45%, #30353d); }
.legend-m .lg small { display: block; font-size: 11px; color: var(--muted); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.legend-m .lg b { font-weight: 700; }
.cues { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; counter-reset: c; }
.cues li { counter-increment: c; display: flex; gap: 12px; align-items: center; background: var(--surface-2); border-radius: 14px; padding: 12px 14px; font-weight: 700; font-size: 15px; }
.cues li::before { content: counter(c); font-family: var(--font-display); font-size: 20px; color: var(--lvl); width: 18px; text-align: center; }

/* Détail de l'énergie */
.why-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.why-list li { display: flex; gap: 10px; align-items: center; background: var(--surface-2); border-radius: 14px; padding: 12px 14px; font-weight: 700; font-size: 14px; }
.why-list li i { width: 8px; height: 8px; border-radius: 50%; background: var(--c-light); flex-shrink: 0; }
.why-list li.good i { background: var(--c-full); }
.why-list li.bad i { background: var(--danger); }
.energy-math { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; gap: 6px; text-align: center; margin: 8px 0 16px; }
.energy-math .n { font-family: var(--font-display); font-size: 34px; font-weight: 700; line-height: 1; }
.energy-math .k { font-size: 11px; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.energy-math .op { font-family: var(--font-display); font-size: 24px; color: var(--muted); }
.scale-lv { display: grid; gap: 6px; }
.scale-lv .lv { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.scale-lv .lv .lvl-ico { color: var(--lvl); }
.scale-lv .lv .lvl-ico svg { width: 20px; height: 20px; }
.scale-lv .lv b { font-size: 14px; }
.scale-lv .lv small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.scale-lv .lv .rng { font-family: var(--font-display); font-size: 17px; font-weight: 700; color: var(--lvl); }
.scale-lv .lv.cur { outline: 2px solid var(--lvl); }

/* ───────── Programme / bibliothèque */
.cycle { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.cycle .wk { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 8px; text-align: center; }
.cycle .wk b { display: block; font-family: var(--font-display); font-size: 18px; }
.cycle .wk span { font-size: 11px; color: var(--muted); font-weight: 700; }
.cycle .wk.cur { border-color: var(--text); background: var(--surface-2); }
.cycle .wk.cur span { color: var(--text); }
.day-card { padding: 16px 0 6px; }
.day-card .pad { padding: 0 16px; }
.day-card.next { border-color: var(--text); }
.ex-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 16px; background: none; border: 0; text-align: left; }
.ex-row + .ex-row { border-top: 1px solid var(--line); }
.ex-row .figbox { width: 56px; height: 56px; background: var(--surface-2); border-radius: 12px; flex-shrink: 0; }
.ex-row .figbox .fig { width: 100%; height: 100%; }
.ex-row .nm { font-weight: 800; font-size: 15px; }
.ex-row .sub { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.ex-row .chev { color: var(--faint); }
.ex-row .chev svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.filters { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 14px; padding: 0 16px; }
.filters::-webkit-scrollbar { display: none; }
.filters .chip { min-height: 38px; flex-shrink: 0; }
.lib { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.lib .tile { flex: none; }
.cta-row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-align: left; text-decoration: none; }
.cta-row .figs { display: flex; }
.cta-row .figs .fig { width: 44px; height: 44px; background: var(--surface-2); border-radius: 12px; margin-left: -8px; border: 2px solid var(--surface); }
.cta-row .figs .fig:first-child { margin-left: 0; }

/* ───────── Progrès */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 12px; }
.stat .v { font-family: var(--font-display); font-size: 28px; font-weight: 700; line-height: 1; }
.stat .k { font-size: 12px; color: var(--muted); font-weight: 700; margin-top: 4px; }
.heat { display: grid; grid-template-columns: 1fr 120px; gap: 12px; align-items: center; }
.heat-list { display: grid; gap: 6px; }
.heat-list .hl { display: grid; grid-template-columns: 1fr auto; font-size: 13px; font-weight: 700; }
.heat-list .hl span:last-child { font-family: var(--font-display); font-size: 16px; color: var(--muted); }
.chart { width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--faint); font-size: 10px; font-family: var(--font-body); font-weight: 700; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 10px; font-weight: 600; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.history-item { display: flex; gap: 14px; align-items: center; padding: 12px 0; border: 0; border-top: 1px solid var(--line); background: none; width: 100%; text-align: left; }
.history-item:first-child { border-top: 0; }
.history-item .badge { width: 44px; height: 44px; border-radius: 14px; display: grid; place-content: center; text-align: center; line-height: 1; font-family: var(--font-display); font-weight: 700; background: color-mix(in srgb, var(--lvl) 18%, transparent); color: var(--lvl); flex-shrink: 0; }
.history-item .badge b { font-size: 18px; }
.history-item .badge small { font-size: 10px; font-weight: 700; text-transform: uppercase; margin-top: 2px; font-family: var(--font-body); }
.history-item .chev { color: var(--faint); }
.history-item .chev svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.ex-list { list-style: none; padding: 0; margin: 0; }
.ex-list li { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; font-weight: 700; }
.ex-list li:first-child { border-top: 0; }
.ex-list .sets-t { color: var(--muted); font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }

/* ───────── Formulaires */
.field { display: grid; gap: 8px; }
.field + .field { margin-top: 18px; }
.field > label, .field > .label { font-size: 13px; font-weight: 800; color: var(--muted); }
.input { width: 100%; min-height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 16px; font-size: 16px; }
.input:focus { outline: 2px solid var(--text); outline-offset: 1px; }
.field-grid { margin-top: 18px; }
.field-grid + .field { margin-top: 18px; }
.grid-2 > *, .grid-3 > * { margin-top: 0 !important; }
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper .val { flex: 1; text-align: center; font-family: var(--font-display); font-size: 52px; font-weight: 700; }
.stepper .icon-btn { width: 58px; height: 58px; font-size: 26px; font-weight: 700; background: var(--surface-2); }
.day-chips { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day-chips .chip { padding: 0; min-width: 0; }
.sources { list-style: none; margin: 0; padding: 0; }
.sources li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.sources li:first-child { border-top: 0; }
.sources .src { color: var(--faint); font-weight: 800; font-size: 13px; white-space: nowrap; }
.sources .src.ok { color: var(--c-full); }
.sources .src.warn { color: var(--c-light); }
.account { display: flex; align-items: center; gap: 12px; }
.account .av { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-weight: 800; }
details summary { cursor: pointer; font-weight: 700; }
code { font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }

/* ───────── Accueil */
.onb { min-height: calc(100dvh - 160px); display: flex; flex-direction: column; }
.onb-progress { display: flex; gap: 6px; margin-bottom: 28px; }
.onb-progress i { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-3); }
.onb-progress i.on { background: var(--text); }
.onb h1 { margin-bottom: 8px; font-size: 40px; }
.onb .lead { color: var(--muted); margin: 0 0 26px; font-weight: 600; }
.onb-hero { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 24px; }
.onb-hero .fig { background: var(--surface); border-radius: 18px; }
.option-list { display: grid; gap: 10px; }
.option { text-align: left; padding: 16px 18px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); display: grid; gap: 2px; transition: all .15s; }
.option strong { font-size: 17px; }
.option span { color: var(--muted); font-size: 14px; font-weight: 600; }
.option[aria-pressed="true"] { border-color: var(--text); background: var(--surface-2); }

/* Messages en bas, près du pouce, au-dessus de ce qui occupe déjà le bas de l'écran */
.toast {
  --toast-bottom: calc(env(safe-area-inset-bottom) + var(--tabbar-h) + 14px);
  position: fixed; left: 50%; bottom: var(--toast-bottom); transform: translate(-50%, 16px); opacity: 0; visibility: hidden;
  width: max-content; max-width: min(528px, calc(100% - 32px));
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 800; font-size: 14px;
  z-index: 60; text-align: center; box-shadow: 0 14px 30px -12px rgb(0 0 0 / .8);
  transition: transform .25s cubic-bezier(.2,.8,.2,1), opacity .2s ease, visibility 0s linear .25s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; transition-delay: 0s; }
body:has(.live-bar) .toast { --toast-bottom: calc(env(safe-area-inset-bottom) + var(--tabbar-h) + 80px); }
body:has(.bottom-action) .toast { --toast-bottom: calc(env(safe-area-inset-bottom) + 92px); }
body:has(.rest-bar.show) .toast { --toast-bottom: calc(env(safe-area-inset-bottom) + 92px + var(--rest-h, 152px)); }
body:has(.tabbar.hidden):not(:has(.bottom-action)) .toast { --toast-bottom: calc(env(safe-area-inset-bottom) + 24px); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 370px) {
  .gauge { width: 180px; }
  .gauge .score { font-size: 64px; }
  .comp .v { font-size: 16px; }
  .set-head, .set-row { grid-template-columns: 24px minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(0, 1fr) 46px; }
}
