/* ============ COACH · direction artistique « salle de sport violette » ============
   Violet Félix #b810be, vert citron énergie, encre aubergine. Typo : Anton (titres, chiffres), Barlow (texte). */
:root {
  --purple: #b810be;
  --purple-dark: #8a0b8f;
  --purple-soft: #f6e3f7;
  --lime: #c6f432;
  --lime-ink: #1d2400;
  --bg: #faf6fb;
  --card: #ffffff;
  --ink: #1e1022;
  --muted: #75647a;
  --line: #ecdeee;
  --ok: #2f9e44;
  --warn: #d9480f;
  --radius: 20px;
  --shadow: 0 1px 0 rgba(30, 16, 34, .04), 0 10px 24px -16px rgba(80, 10, 90, .45);
  --f-title: "Anton", Impact, "Arial Narrow", sans-serif;
  --f-body: "Barlow", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --purple: #d23ad8;
    --purple-dark: #b810be;
    --purple-soft: #3a1440;
    --bg: #130b16;
    --card: #1f1424;
    --ink: #f6eef8;
    --muted: #b39cba;
    --line: #35243b;
    --shadow: 0 10px 24px -16px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.45 var(--f-body);
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
body.playing { overflow: hidden; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.15; }
h3 { font-size: 1.05rem; font-weight: 800; }
p { margin: 0 0 .6em; }
code { font-size: .85em; background: var(--purple-soft); padding: .1em .35em; border-radius: 6px; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.err { color: var(--warn); font-weight: 600; }
[hidden] { display: none !important; }

/* ---------- en-tête ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--purple); color: #fff;
  box-shadow: 0 6px 20px -12px rgba(80, 10, 90, .8);
}
.top-avatar { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--lime); }
.wordmark { font: 400 1.9rem/1 var(--f-title); letter-spacing: .06em; margin: 0; }
.wordmark.big { font-size: 4.6rem; color: #fff; text-shadow: 0 6px 0 rgba(0, 0, 0, .15); }
.top-date { margin-left: auto; font-weight: 700; font-size: .9rem; opacity: .9; text-transform: capitalize; }
.icon-btn { background: rgba(255, 255, 255, .16); border: 0; color: inherit; width: 40px; height: 40px; border-radius: 12px; font-size: 1.3rem; cursor: pointer; }
.icon-btn.small { width: 34px; height: 34px; font-size: 1rem; background: var(--purple-soft); }

main { max-width: 640px; margin: 0 auto; padding: 16px; }
.view > * + * { margin-top: 14px; }
.page-title { font: 400 2rem var(--f-title); letter-spacing: .02em; }

/* ---------- barre d'onglets ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabbar button { border: 0; background: none; color: var(--muted); font: 700 .72rem var(--f-body); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border-radius: 14px; cursor: pointer; }
.tabbar button span { font-size: 1.35rem; filter: grayscale(1); opacity: .7; }
.tabbar button.active { color: var(--purple); background: var(--purple-soft); }
.tabbar button.active span { filter: none; opacity: 1; }

/* ---------- cartes ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.card.hot { border: 2px solid var(--purple); }
.muted-card { opacity: .85; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 800; color: var(--purple); margin-bottom: .3em; }
.pill { background: var(--lime); color: var(--lime-ink); font-weight: 800; font-size: .85rem; padding: 3px 10px; border-radius: 99px; }
.note { background: var(--purple-soft); border-radius: 12px; padding: 10px 12px; font-size: .9rem; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.small-links { justify-content: space-between; }

/* ---------- Félix ---------- */
.felix { display: flex; align-items: flex-end; gap: 4px; margin: -4px -4px 0; }
.felix-img { width: 132px; height: 132px; object-fit: contain; flex: none; filter: drop-shadow(0 8px 10px rgba(80, 10, 90, .25)); }
.small-felix .felix-img { width: 104px; height: 104px; }
.bubble { position: relative; flex: 1; background: var(--purple); color: #fff; border-radius: 20px 20px 20px 6px; padding: 12px 14px; margin-bottom: 18px; font-size: .97rem; box-shadow: var(--shadow); }
.bubble::before { content: ""; position: absolute; left: -8px; bottom: 0; border: 10px solid transparent; border-right-color: var(--purple); border-bottom-color: var(--purple); }
.bubble p:last-child { margin: 0; }
.bubble-hi { font: 400 1.25rem var(--f-title); letter-spacing: .02em; color: var(--lime); margin-bottom: .2em; }
.pl-sum .bubble-hi { color: var(--purple); }
.quote { text-align: center; font-style: italic; color: var(--muted); padding: 6px 12px; }
.quote span { display: block; font-style: normal; font-weight: 700; font-size: .85rem; margin-top: 4px; }

/* ---------- pas ---------- */
.steps-card { display: flex; gap: 16px; align-items: center; }
.ring-wrap { position: relative; width: 132px; height: 132px; flex: none; }
.ring { width: 100%; height: 100%; }
.ring-bg { fill: none; stroke: var(--purple-soft); stroke-width: 10; }
.ring-fg { fill: none; stroke: var(--purple); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset .8s ease; }
.ring-fg.full { stroke: var(--lime); }
.ring-txt { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-txt b { font: 400 1.6rem/1 var(--f-title); }
.ring-txt span { font-size: .78rem; color: var(--muted); font-weight: 600; }
.steps-side p { margin: 0 0 .2em; }
.steps-side b { font-size: 1.15rem; }

/* ---------- séance du jour ---------- */
.session-title { font: 400 1.55rem/1.15 var(--f-title); letter-spacing: .01em; }
.session-title span { font-family: var(--f-body); }
.done-list { background: color-mix(in srgb, var(--lime) 25%, transparent); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; }
.done-list p { margin: 0; }
.seg { display: flex; gap: 6px; background: var(--purple-soft); padding: 4px; border-radius: 14px; margin: 10px 0; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px 2px; border-radius: 10px; font: 700 .84rem var(--f-body); color: var(--ink); cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--card); color: var(--purple); box-shadow: 0 2px 8px -4px rgba(80, 10, 90, .5); }
.seg.wide { margin: 0; }

/* ---------- semaine ---------- */
.week-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.week-head h3 { margin: 0; }
.week-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: .78rem; font-weight: 700; color: var(--muted); }
.wd i { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-style: normal; background: var(--bg); border: 2px solid var(--line); color: var(--purple); font-size: .9rem; }
.wd.planned i { border-color: var(--purple); }
.wd.done i { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); font-weight: 900; }
.wd.missed i { border-style: dashed; color: var(--muted); }
.wd.today span { color: var(--purple); }
.wd.today i { box-shadow: 0 0 0 3px var(--purple-soft); }

/* ---------- FOODIZ ---------- */
.fz { border-left: 5px solid #c62828; }
.fz-row { display: flex; gap: 14px; flex-wrap: wrap; }
.fz-row div { flex: 1 1 120px; }
.fz-row b { font: 400 1.5rem var(--f-title); display: block; }
.fz-row span { font-size: .8rem; color: var(--muted); }

/* ---------- boutons et formulaires ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 14px; padding: 12px 18px; font: 800 1rem var(--f-body); cursor: pointer; text-decoration: none; color: inherit; }
.btn.big { width: 100%; padding: 16px; font-size: 1.1rem; }
.btn-small { padding: 7px 12px; font-size: .85rem; border-radius: 10px; }
.btn-lime { background: var(--lime); color: var(--lime-ink); box-shadow: 0 6px 0 -1px #8fb514; }
.btn-lime:active { transform: translateY(3px); box-shadow: 0 3px 0 -1px #8fb514; }
.btn-purple { background: var(--purple); color: #fff; }
.btn-ghost { background: var(--purple-soft); color: var(--purple); }
.btn-link, .btn.btn-link { background: none; border: 0; color: var(--purple); font: 700 .92rem var(--f-body); text-decoration: underline; cursor: pointer; padding: 8px 0; }
.btn:disabled, .btn-link:disabled { opacity: .45; }
.form { display: flex; flex-direction: column; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: .85rem; color: var(--muted); }
.field input, .field select, .field textarea, .login input {
  font: 500 1rem var(--f-body); color: var(--ink); background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 12px; width: 100%;
}
.field input[readonly] { background: var(--purple-soft); color: var(--muted); }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--purple); border-color: transparent; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--purple); }
.days-pick { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.days-pick input { position: absolute; opacity: 0; }
.days-pick span { display: block; text-align: center; padding: 10px 0; border-radius: 12px; background: var(--purple-soft); font-weight: 800; font-size: .85rem; cursor: pointer; }
.days-pick input:checked + span { background: var(--purple); color: #fff; }

/* ---------- programme ---------- */
.prog .btn { margin-top: 8px; }
.warm { font-size: .92rem; font-weight: 600; }
.ex-list { padding: 0; margin: 8px 0; list-style: none; counter-reset: ex; }
.ex-list li { counter-increment: ex; }
.ex-btn { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 9px 4px; border-bottom: 1px solid var(--line); font: 600 .97rem var(--f-body); color: var(--ink); text-align: left; cursor: pointer; }
.ex-btn::before { content: counter(ex); font: 400 1.1rem var(--f-title); color: var(--purple); width: 22px; text-align: center; }
.ex-btn span { font-size: 1.2rem; }
.ex-btn em { margin-left: auto; font-size: .72rem; font-style: normal; background: #fff3bf; color: #7a5a00; padding: 2px 7px; border-radius: 99px; }
.var-list { padding-left: 18px; }
.var-list li { margin-bottom: 6px; }
.var-list span { display: block; font-size: .88rem; color: var(--muted); }
.load { font-weight: 800; color: var(--purple); margin: 6px 0; }
.player .load { color: var(--lime); font-size: 1.05rem; }
.ex-load { display: block; font-weight: 600; font-size: .78rem; color: var(--muted); }
.notes ul, .ea { padding-left: 18px; margin: 0; }
.notes li, .ea li { margin-bottom: 6px; }
.ex-icon { font-size: 3rem; margin: 0; }
.pick { display: grid; grid-template-columns: 44px 1fr; gap: 0 10px; width: 100%; text-align: left; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); border-radius: 16px; padding: 12px; margin-bottom: 10px; cursor: pointer; font-family: var(--f-body); }
.pick span { grid-row: span 2; font-size: 2rem; }
.pick small { color: var(--muted); }

/* ---------- fenêtre du bas ---------- */
.sheet { border: 0; padding: 0; width: 100%; max-width: 560px; margin: auto auto 0; border-radius: 26px 26px 0 0; background: var(--card); color: var(--ink); max-height: 92vh; }
.sheet::backdrop { background: rgba(20, 5, 25, .55); }
.sheet[open] { animation: up .25s ease; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
#sheet-body { padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); position: relative; }
.sheet-close { position: absolute; top: 12px; right: 12px; border: 0; background: var(--purple-soft); color: var(--purple); width: 34px; height: 34px; border-radius: 50%; font-size: 1rem; cursor: pointer; }
.sheet-felix { width: 120px; display: block; margin: 0 auto; }
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-weight: 700; opacity: 0; pointer-events: none; transition: .25s; z-index: 100; max-width: 90vw; text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- séance guidée ---------- */
.player { position: fixed; inset: 0; z-index: 50; background: linear-gradient(170deg, var(--purple) 0%, var(--purple-dark) 55%, #3d0540 100%); color: #fff; display: flex; flex-direction: column; padding: calc(12px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom)); overflow-y: auto; }
.pl-top { display: flex; align-items: center; gap: 10px; }
.pl-bar { flex: 1; height: 8px; background: rgba(255, 255, 255, .2); border-radius: 99px; overflow: hidden; }
.pl-bar i { display: block; height: 100%; background: var(--lime); transition: width .4s; }
.pl-label { font-weight: 700; font-size: .82rem; opacity: .85; max-width: 40%; text-align: right; }
.pl-body { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 10px 0; position: relative; z-index: 1; }
.pl-body .eyebrow { color: var(--lime); }
.pl-title { font: 400 2.1rem/1.1 var(--f-title); letter-spacing: .01em; }
.pl-title span { font-family: var(--f-body); }
.pl-big { font: 400 6.5rem/1 var(--f-title); color: var(--lime); margin: 10px 0; font-variant-numeric: tabular-nums; }
.pl-big.reps small { display: block; font: 700 1rem var(--f-body); color: #fff; opacity: .85; }
.kind-rest .pl-big { color: #fff; }
.pl-text { font-size: 1.02rem; opacity: .95; }
.pl-next { font-size: 1.1rem; margin-top: 6px; }
.player .note { background: rgba(255, 255, 255, .14); color: #fff; }
.player .muted, .player .small { color: rgba(255, 255, 255, .8); }
.pl-felix { position: absolute; right: -10px; bottom: 120px; width: 46%; max-width: 240px; opacity: .95; pointer-events: none; z-index: 0; }
.pl-ctrl { display: grid; grid-template-columns: 64px 1fr 64px; gap: 10px; position: relative; z-index: 1; }
.pl-ctrl .btn-ghost { background: rgba(255, 255, 255, .16); color: #fff; font-size: 1.2rem; }
.pl-after { text-align: center; font-size: .85rem; opacity: .75; margin: 10px 0 0; }
.player .icon-btn { flex: none; }
.pl-sum { flex: 1; display: flex; flex-direction: column; justify-content: center; text-align: center; gap: 4px; }
.pl-sum h2 { font: 400 2rem var(--f-title); }
.sum-felix { width: 180px; margin: 0 auto -6px; }
.pl-sum .bubble-hi { color: var(--lime); }
.feel { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0 12px; }
.feel button { border: 2px solid rgba(255, 255, 255, .3); background: transparent; color: #fff; border-radius: 14px; padding: 12px 6px; font: 700 1rem var(--f-body); cursor: pointer; }
.feel button.on { background: var(--lime); color: var(--lime-ink); border-color: var(--lime); }
.player .field { color: rgba(255, 255, 255, .85); text-align: left; }
.player .field input, .player .field textarea { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .25); color: #fff; }
.player .btn-link { color: #fff; }

/* ---------- caméra ---------- */
.cam-box { position: relative; width: 100%; aspect-ratio: 3 / 4; max-height: 62vh; background: #000; border-radius: 22px; overflow: hidden; }
.cam-box video, .cam-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.cam-off { position: absolute; inset: 0; display: grid; place-items: center; font-size: 4rem; color: #fff; background: var(--purple-dark); }
.cam-hud { display: flex; align-items: center; gap: 14px; margin: 10px 0; }
.cam-count { display: flex; align-items: baseline; gap: 6px; }
.cam-count b { font: 400 4rem/1 var(--f-title); color: var(--purple); }
.cam-count span { font-weight: 700; color: var(--muted); }
.cam-status { margin: 0; font-weight: 700; font-size: .95rem; }
.cam-actions { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 8px; }

/* ---------- suivi ---------- */
.bars { width: 100%; height: 130px; display: block; }
.bars rect { fill: var(--purple); opacity: .85; }
.bars rect.ok { fill: var(--lime); opacity: 1; }
.bars .goal { stroke: var(--ink); stroke-width: .3; stroke-dasharray: 1.5 1; opacity: .6; }
.bar-labels { display: flex; font-size: .7rem; color: var(--muted); }
.bar-labels span { text-align: center; }
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.hist li div { flex: 1; }
.hist span { display: block; font-size: .85rem; color: var(--muted); }
.hist em { display: block; font-size: .85rem; }

/* ---------- réglages / raccourcis ---------- */
.steps { padding-left: 20px; margin: 10px 0; }
.steps li { margin-bottom: 10px; }
.keybox { background: var(--bg); border: 1.5px dashed var(--line); border-radius: 14px; padding: 10px 12px; margin: 10px 0; }
.keybox p { margin: 0 0 6px; }
.fresh { background: color-mix(in srgb, var(--lime) 30%, transparent); border-radius: 10px; padding: 8px; }
.fresh code { display: block; margin: 6px 0; background: var(--card); }
.copyline { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.copyline code { flex: 1; }

/* ---------- connexion ---------- */
.login-page { background: var(--purple); color: #fff; min-height: 100vh; overflow: hidden; padding: 0; }
.login { position: relative; z-index: 2; max-width: 380px; margin: 0 auto; padding: calc(56px + env(safe-area-inset-top)) 22px 40px; }
.login-sub { font: 400 1.3rem var(--f-title); color: var(--lime); margin: -6px 0 24px; letter-spacing: .04em; }
.login form { display: flex; flex-direction: column; gap: 12px; background: rgba(30, 5, 35, .35); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); padding: 18px; border-radius: 22px; }
.login label { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: .9rem; }
.login input { background: rgba(255, 255, 255, .95); color: #1e1022; border: 0; }
.login-hint { font-size: .82rem; opacity: .85; margin: 0; }
.login .err { color: #fff; background: rgba(0, 0, 0, .25); padding: 8px 12px; border-radius: 10px; }
.login-felix { position: fixed; right: 0; bottom: 0; width: min(90vw, 480px); z-index: 1; pointer-events: none; filter: drop-shadow(0 10px 24px rgba(40, 0, 50, .35)); }

/* ---------- page verrou ---------- */
.gate-page { background: linear-gradient(170deg, #b810be, #6d0872); color: #fff; min-height: 100vh; padding: 0; }
.gate { position: relative; z-index: 2; max-width: 480px; margin: 0 auto; padding: calc(24px + env(safe-area-inset-top)) 18px 30px; text-align: center; }
.gate-lock { font-size: 3rem; margin: 0; }
.gate-title { font: 400 2.2rem/1.1 var(--f-title); letter-spacing: .01em; }
.gate-sub { font-size: 1.15rem; }
.gate section { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.gate .btn-ghost { background: rgba(255, 255, 255, .16); color: #fff; }
.gate .btn-link { color: #fff; opacity: .85; }
.gate .cam-count b { color: var(--lime); }
.gate .cam-count span, .gate .cam-status { color: #fff; }
.gate-until { font-size: 1.2rem; }
.gate-hint { font-size: .85rem; opacity: .8; }
.gate-felix { position: fixed; right: -20px; bottom: 0; width: min(60vw, 340px); z-index: 1; opacity: .9; pointer-events: none; }
.gate #g-run ~ .gate-felix, .gate-page:has(#g-run:not([hidden])) .gate-felix { display: none; }

@media (max-width: 380px) {
  .felix-img { width: 108px; height: 108px; }
  .pl-big { font-size: 5.2rem; }
  .three { grid-template-columns: 1fr 1fr; }
}
