/* ── Thème SOMBRE (défaut) ─────────────────────────────────────────── */
:root {
  --bg: #0f1115;
  --bg-elev: #171a21;
  --bg-elev-2: #1f2430;
  --border: #2a303c;
  --text: #e7e9ee;
  --text-dim: #9aa3b2;
  --accent: #4f8cff;
  --accent-soft: rgba(79, 140, 255, 0.15);
  --green: #35c98a;
  --red: #ff5c72;
  --amber: #ffb84d;
  --surface-header: rgba(15, 17, 21, 0.9);
  --surface-tabbar: rgba(23, 26, 33, 0.96);
  --surface-tabbar-float: #1b1f27;
  --shadow-1: 0 10px 34px rgba(0, 0, 0, 0.55);
  --scroll-hover: #38404e;
  --warn-bg: #ffb84d;
  --warn-fg: #1a1205;
  color-scheme: dark;
  /* dimensions — indépendantes du thème */
  --radius: 14px;
  --radius-sm: 9px;
  --tabbar-h: 62px;
  --header-h: 54px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  font-size: 16px;
}

/* ── Thème CLAIR ───────────────────────────────────────────────────── */
/* jetons repris par les deux déclencheurs : OS clair (sauf choix « sombre »)
   et bascule manuelle [data-theme="light"]. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f6f9;
    --bg-elev: #ffffff;
    --bg-elev-2: #eceff4;
    --border: #d7dce4;
    --text: #161a20;
    --text-dim: #59616f;
    --accent: #2f6ede;
    --accent-soft: rgba(47, 110, 222, 0.12);
    --green: #17805a;
    --red: #d92341;
    --amber: #a86400;
    --surface-header: rgba(255, 255, 255, 0.88);
    --surface-tabbar: rgba(255, 255, 255, 0.96);
    --surface-tabbar-float: #ffffff;
    --shadow-1: 0 10px 30px rgba(20, 30, 55, 0.16);
    --scroll-hover: #c2c9d4;
    --warn-bg: #ffe6b0;
    --warn-fg: #6b4300;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f4f6f9;
  --bg-elev: #ffffff;
  --bg-elev-2: #eceff4;
  --border: #d7dce4;
  --text: #161a20;
  --text-dim: #59616f;
  --accent: #2f6ede;
  --accent-soft: rgba(47, 110, 222, 0.12);
  --green: #17805a;
  --red: #d92341;
  --amber: #a86400;
  --surface-header: rgba(255, 255, 255, 0.88);
  --surface-tabbar: rgba(255, 255, 255, 0.96);
  --surface-tabbar-float: #ffffff;
  --shadow-1: 0 10px 30px rgba(20, 30, 55, 0.16);
  --scroll-hover: #c2c9d4;
  --warn-bg: #ffe6b0;
  --warn-fg: #6b4300;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

/* Surfaces du navigateur : sélection, curseur, scrollbar, focus — tirées de la palette */
:root { accent-color: var(--accent); caret-color: var(--accent); }
::selection { background: var(--accent-soft); color: var(--text); }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-hover); }
::-webkit-scrollbar-track { background: transparent; }

/* Focus clavier visible partout ; rien de superflu à la souris */
:where(button, a, input, select, textarea, [tabindex], .row.clickable, .recipe-card, .chip):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
:focus:not(:focus-visible) { outline: none; }

/* Mouvement réduit : on coupe ce qui boucle ou surprend, on garde les changements d'état */
@media (prefers-reduced-motion: reduce) {
  .sync-dot[data-state="syncing"] { animation: none; }
  .set-check { transition: none; }
  /* Coupe le rebond d'appui — ciblé, jamais « * » : ':active' remonte aux
     ancêtres, donc « *:active { transform:none } » cassait le centrage de la
     barre d'onglets (translate) à chaque clic. */
  .btn:active, .icon-btn:active, .resume-pill:active,
  .recipe-card:active, .tab:active { transform: none !important; }
}

#app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(var(--safe-t) + 10px) 16px 10px;
  background: var(--surface-header);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.app-header h1 {
  font-size: 1.15rem; margin: 0; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.header-actions { display: flex; gap: 8px; flex: none; }

.icon-btn {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  width: 44px; height: 44px;
  border-radius: 10px;
  font-size: 1.05rem;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.icon-btn:active { transform: scale(0.94); }
@media (hover: hover) {
  .icon-btn:hover { border-color: var(--accent); }
}

#btn-sync { position: relative; }
.sync-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}
.sync-dot[data-state="idle"] { background: var(--green); }
.sync-dot[data-state="syncing"] { background: var(--amber); animation: pulse 1s ease-in-out infinite; }
.sync-dot[data-state="offline"] { background: var(--amber); }
.sync-dot[data-state="error"] { background: var(--red); }
.sync-dot[data-state="off"] { background: var(--text-dim); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* View */
.view {
  flex: 1;
  padding: 16px 16px calc(var(--tabbar-h) + var(--safe-b) + 24px);
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

/* Tabbar */
.tabbar {
  position: fixed;
  /* Centrage par left/right + marges auto — SANS transform : la règle
     « mouvement réduit » plus haut neutralise tout transform d'un élément
     :active (et ses ancêtres), ce qui faisait sauter la barre à chaque appui. */
  left: 0;
  right: 0;
  bottom: 0;
  margin-inline: auto;
  max-width: 520px;
  z-index: 30;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--surface-tabbar);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
}
@media (min-width: 560px) {
  .tabbar {
    bottom: 14px;
    border: 0;
    border-radius: 999px;
    height: var(--tabbar-h);
    background: var(--surface-tabbar-float);
    box-shadow: var(--shadow-1);
  }
  .view { padding-bottom: calc(var(--tabbar-h) + 40px); }
  .resume-pill { bottom: calc(var(--tabbar-h) + 30px); }
}
.tabbar::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 1 0;
  min-width: 0;
  background: none;
  border: 0;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  /* 10px : convention des barres d'onglets système (iOS 10px, Android ~12px) ;
     chaque onglet est identifié d'abord par son icône dédiée. */
  font-size: 10px;
  letter-spacing: -0.01em;
  cursor: pointer;
  padding: 0 2px;
  transition: color 120ms ease;
}
.tab-ico { display: flex; align-items: center; justify-content: center; line-height: 1; }
.tab-ico svg { width: 22px; height: 22px; display: block; }
.tab-lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab[aria-current="page"] { color: var(--accent); }
@media (hover: hover) {
  .tab:hover { color: var(--text); }
  .tab[aria-current="page"]:hover { color: var(--accent); }
}

/* Cards */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.card h2, .card h3 { margin: 0 0 10px; }
.card h3 { font-size: 1rem; }

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 12px;
}
.section-title h2 { font-size: 1.05rem; margin: 0; }

.muted { color: var(--text-dim); }
.small { font-size: 0.82rem; }
.center { text-align: center; }
.empty {
  text-align: center;
  color: var(--text-dim);
  padding: 40px 16px;
}

/* Écran de connexion (app entière verrouillée) */
.gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 18vh 24px 0;
}
.gate-logo { font-size: 3rem; }
.gate h2 { margin: 0; }
.gate p { margin: 0; max-width: 22rem; }

.resume-pill {
  position: fixed;
  right: 12px;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px);
  z-index: 28;
  background: var(--green);
  color: #06281c;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  cursor: pointer;
}
.resume-pill:active { transform: scale(0.96); }

body.logged-out .tabbar { display: none; }
body.logged-out .resume-pill { display: none; }
body.logged-out #syncbar { display: none; }
body.logged-out .view { padding-bottom: 24px; }

/* Bandeau de synchro : seulement hors ligne / erreur */
#syncbar {
  position: fixed;
  left: 0; right: 0;
  top: calc(var(--header-h) + var(--safe-t) + 6px);
  z-index: 19;
  padding: 7px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  color: var(--warn-fg);
  background: var(--warn-bg);
}
#syncbar[data-state="error"] { background: var(--red); color: #fff; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn { min-height: 44px; transition: border-color 120ms ease, background 120ms ease, filter 120ms ease; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn-ghost { background: transparent; }
.btn-block { display: flex; width: 100%; }
.btn-sm { padding: 9px 12px; font-size: 0.82rem; min-height: 44px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
@media (hover: hover) {
  .btn:hover { border-color: var(--accent); }
  .btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
  .btn-danger:hover { background: rgba(255, 92, 114, 0.12); }
  .btn-ghost:hover { background: var(--bg-elev-2); }
}

/* Bouton d'action principal, toujours visible au-dessus de la barre d'onglets */
.sticky-cta {
  position: sticky;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 8px);
  z-index: 15;
  margin: 12px -4px 0;
  padding: 8px 4px 0;
}
.sticky-cta::before {
  content: '';
  position: absolute;
  inset: -44px -16px 0;
  background: linear-gradient(transparent, var(--bg) 70%);
  pointer-events: none;
}
.sticky-cta .btn { position: relative; border-color: transparent; box-shadow: 0 8px 26px rgba(0, 0, 0, 0.55); }
/* laisse respirer la dernière carte au-dessus du CTA collant */
.view > .card:last-of-type { scroll-margin-bottom: 96px; }
/* Pendant le repos, le bandeau chrono occupe le bas : on remonte le CTA. */
body.resting .sticky-cta { bottom: calc(var(--tabbar-h) + var(--safe-b) + 74px); }

/* Forms */
label { display: block; font-size: 0.8rem; color: var(--text-dim); margin-bottom: 5px; }
input, select, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 11px 12px;
  font-size: 1rem;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { resize: vertical; min-height: 54px; }
.field { margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.stat {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.stat .val { font-size: 1.6rem; font-weight: 700; }
.stat .lbl { font-size: 0.78rem; color: var(--text-dim); margin-top: 2px; }

/* Onboarding (première utilisation) */
.onb-hero { text-align: center; padding: 8vh 8px 4px; }
.onb-logo { font-size: 2.6rem; }
.onb-step { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.onb-num {
  flex: none;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-weight: 700;
}

/* List rows */
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  color: var(--text);
  font: inherit;
}
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; }
.row .sub { font-size: 0.8rem; color: var(--text-dim); }
.row.clickable { cursor: pointer; transition: border-color 120ms ease, background 120ms ease; }
.row.clickable:active { background: var(--bg-elev-2); }
@media (hover: hover) {
  .row.clickable:hover { border-color: var(--accent); }
}

.tag {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.tag.strength { color: var(--accent); border-color: var(--accent); }
.tag.cardio { color: var(--amber); border-color: var(--amber); }

/* Exercise editor */
.ex-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 10px; background: var(--bg-elev); }
.ex-item.dragging { opacity: 0.5; }
.ex-item.drag-over { border-color: var(--accent); }
.ex-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ex-head .handle { cursor: grab; color: var(--text-dim); font-size: 1.1rem; touch-action: none; }
.ex-head .name { flex: 1; font-weight: 600; }
.order-btns { display: flex; flex-direction: column; gap: 4px; }
.order-btns button { width: 38px; height: 34px; line-height: 1; padding: 0; font-size: 0.8rem; }

/* Set tracker */
.set-line {
  display: grid;
  grid-template-columns: 20px 1fr 1fr 46px;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}
.set-line.cardio { grid-template-columns: 1fr 1fr; }
.set-line .idx { color: var(--text-dim); text-align: center; font-size: 0.8rem; }
.set-line.set-head {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 2px;
}
.set-line.set-head span:nth-child(2),
.set-line.set-head span:nth-child(3) { text-align: center; }
.set-line.done input { opacity: 0.55; }

/* Champ − [valeur] + : la valeur domine, les boutons s'effacent */
.step-field {
  display: flex; align-items: stretch; gap: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  overflow: hidden;
}
.step-field input {
  flex: 1; min-width: 0;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 10px 2px;
}
.step-field input:focus-visible { outline-offset: -2px; }
.step-btn {
  flex: none; width: 34px;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 1.25rem; line-height: 1;
  cursor: pointer;
  transition: color 120ms ease, background 120ms ease;
}
.step-btn:active { background: var(--bg-elev-2); color: var(--text); }
@media (hover: hover) {
  .step-btn:hover { color: var(--text); background: var(--bg-elev); }
}
.set-check {
  width: 46px; height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--green);
  font-size: 1.15rem;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
@media (hover: hover) {
  .set-check:not(.done):hover { border-color: var(--green); }
}
.set-check.done { background: var(--green); border-color: var(--green); color: #06281c; }

/* Rest timer */
.timer-bar {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-b));
  z-index: 25;
  background: var(--accent);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 9px 16px;
  font-weight: 700;
}
.timer-bar.hidden { display: none; }
.timer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.timer-bar button { background: rgba(255,255,255,0.2); border: 0; color: #fff; padding: 7px 12px; border-radius: 8px; font-weight: 700; cursor: pointer; }
.timer-big { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.timer-next {
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.92;
  text-align: center;
}

/* Chart */
.chart-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
svg.chart { display: block; width: 100%; height: auto; }
.chart-dot { fill: var(--accent); }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2; }
.chart-area { fill: var(--accent-soft); }
.chart-axis { stroke: var(--border); stroke-width: 1; }
.chart-lbl { fill: var(--text-dim); font-size: 10px; font-variant-numeric: tabular-nums; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  transform: translateX(-50%);
  background: #2b3242;
  border: 1px solid #39414f;
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.88rem;
  z-index: 50;
}

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 720px;
  padding: 18px 16px calc(18px + var(--safe-b));
  max-height: 88vh;
  overflow-y: auto;
}
.modal h3 { margin-top: 0; }

.modal-tall { min-height: 60vh; display: flex; flex-direction: column; }
.picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.cat-row.manual { border-style: dashed; }
.lightbox-instructions {
  color: #ddd;
  font-size: 0.9rem;
  line-height: 1.5;
  max-width: 640px;
  margin: 4px 0 0;
}

@media (min-width: 520px) {
  .modal-backdrop { align-items: center; }
  .modal { border-radius: var(--radius); }
}

/* Catalogue d'exercices */
.ex-thumb {
  width: 40px; height: 40px;
  border-radius: 8px;
  object-fit: cover;
  background: #fff;
  flex: none;
}
.cat-results {
  max-height: 260px;
  overflow-y: auto;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cat-results:empty { display: none; }
.cat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  color: var(--text);
  cursor: pointer;
}
.cat-row:active { background: var(--bg-elev-2); }
.cat-thumb {
  width: 46px; height: 46px;
  border-radius: 6px;
  object-fit: cover;
  background: #fff;
  flex: none;
}
.cat-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.zoomable { cursor: zoom-in; }

/* Visionneuse plein écran */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-t) + 8px) 8px calc(var(--safe-b) + 8px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.lightbox-close {
  position: sticky;
  top: 0;
  align-self: flex-end;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  flex: none;
}
.lightbox-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 0 20px;
}
.lightbox-title {
  color: #fff;
  font-weight: 600;
  text-align: center;
}
.lightbox-img {
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  border-radius: 10px;
  background: #fff;
}

/* Recettes */
.chip-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 10px;
  -webkit-overflow-scrolling: touch;
}
.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 120ms ease, color 120ms ease;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip .zdot { width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; flex: none; }
@media (hover: hover) {
  .chip:hover { border-color: var(--accent); color: var(--text); }
  .chip.active:hover { color: #fff; }
}

.recipe-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.recipe-card {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.recipe-card { transition: border-color 120ms ease, transform 120ms ease; }
.recipe-card:active { transform: scale(0.98); }
@media (hover: hover) {
  .recipe-card:hover { border-color: var(--accent); }
}
.recipe-thumb {
  aspect-ratio: 4 / 3;
  background: var(--bg-elev-2) center / cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}
.recipe-meta { padding: 8px 10px; }
.recipe-name { font-weight: 600; font-size: 0.88rem; line-height: 1.25; }
.recipe-fav {
  position: absolute; top: 6px; right: 8px;
  color: var(--amber); font-size: 1.1rem;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
.recipe-hero {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  background: var(--bg-elev-2) center / cover no-repeat;
}
.prog-thumb { aspect-ratio: 3 / 4; }
.prog-hero { aspect-ratio: 3 / 2; background-position: center; }
.zone-thumb { aspect-ratio: 1 / 1; position: relative; }
.zone-badge {
  position: absolute; top: 8px; right: 8px;
  min-width: 22px; height: 22px; padding: 0 6px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.prog-toggle {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.85rem; color: var(--text-dim);
  margin: 4px 0 2px;
}
.prog-toggle input { width: 18px; height: 18px; }
.prog-ex-line {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  cursor: pointer;
}
.prog-ex-line input[type="checkbox"] { width: 20px; height: 20px; flex: none; }
.prog-ex-line .ex-thumb { width: 34px; height: 34px; }
.prog-ex-line.mapped { background: var(--accent-soft); border-radius: 6px; }
.prog-ex-line .btn-sm { flex: none; padding: 4px 8px; }

.macro-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.macro { text-align: center; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 4px; }
.macro-val { font-size: 1.05rem; font-weight: 700; }
.macro-lbl { font-size: 0.7rem; color: var(--text-dim); }

.ing-line {
  display: flex; gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.ing-line:last-child { border-bottom: 0; }

.step-line {
  display: flex; gap: 10px;
  padding: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 0.92rem;
  line-height: 1.5;
  white-space: pre-wrap;
}
.step-num {
  flex: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700;
}

@media (min-width: 560px) {
  .recipe-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Liste de courses */
.shop-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
  cursor: pointer;
}
.shop-line input[type="checkbox"] { width: 20px; height: 20px; flex: none; }
.shop-line.checked .shop-name { text-decoration: line-through; color: var(--text-dim); }
.shop-qty { flex: none; font-size: 0.85rem; white-space: nowrap; }
.shop-del {
  flex: none;
  background: none; border: 0;
  color: var(--text-dim);
  font-size: 0.95rem;
  cursor: pointer;
  padding: 4px 6px;
}
.shop-src { display: block; }

hr.sep { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.spacer { height: 10px; }
.pr-badge { color: var(--green); font-weight: 700; }
.trend { flex: none; font-size: 0.82rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.row .chev { flex: none; color: var(--text-dim); }

/* ═══ Classement (#/rang) ═══════════════════════════════════════════════ */

.tier-iron      { --tc: #8b8f96; }
.tier-bronze    { --tc: #c98a4b; }
.tier-silver    { --tc: #d7dee6; }
.tier-gold      { --tc: #f0c04a; }
.tier-platinum  { --tc: #5cd0e0; }
.tier-diamond   { --tc: #e2a0f2; }
.tier-ascendant { --tc: #3ee08f; }
.tier-immortal  { --tc: #f0577f; }
.tier-radiant   { --tc: #ffe27a; }

.rank-badge-svg { display: block; }

/* En-tête : masquer réellement les boutons cachés (rang désactivé…) */
.header-actions [hidden] { display: none !important; }

/* En-tête : badge + libellé du rang (bouton dimensionné au contenu) */
.hdr-rank {
  width: auto;
  min-width: 42px;
  height: 42px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 12px 0 7px;
}
.hdr-rank .rank-badge { flex: none; }
.hdr-rank-lbl {
  font-size: 0.82rem; font-weight: 700; color: var(--text);
  white-space: nowrap; letter-spacing: 0.2px;
}

/* Carte du tableau de bord */
.rank-card {
  display: flex; align-items: center; gap: 12px;
  border-left: 3px solid var(--tc, var(--accent));
}
.rank-card.cta { border-left-color: var(--accent); }
.rank-card-badge { flex: none; line-height: 0; }
.rank-card .up { color: var(--green); }
.rank-card .down { color: var(--red); }

/* Vue Rang — héros */
.rank-hero {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 6px;
  padding: 22px 16px 18px;
  margin-bottom: 14px;
  border-radius: var(--radius);
  background:
    radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--tc, var(--accent)) 26%, transparent), transparent 70%),
    var(--bg-elev);
  border: 1px solid var(--border);
}
.rank-name {
  font-size: 1.7rem; font-weight: 800; letter-spacing: 0.5px;
  color: var(--tc, var(--text));
  text-shadow: 0 0 24px color-mix(in srgb, var(--tc, transparent) 45%, transparent);
}
.rank-sub { font-size: 0.85rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.rank-delta { font-size: 0.8rem; font-weight: 700; }
.rank-delta.up { color: var(--green); }
.rank-delta.down { color: var(--red); }

.rr-bar {
  width: 100%; max-width: 260px; height: 8px;
  background: var(--bg-elev-2); border-radius: 99px; overflow: hidden;
}
.rr-bar.sm { height: 6px; }
.rr-bar > span {
  display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--tc, var(--accent)) 60%, #fff), var(--tc, var(--accent)));
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.lives-row { display: flex; gap: 6px; margin-top: 4px; }
.lives-row .life { font-size: 1rem; }
.lives-row .life.on { color: var(--red); }
.lives-row .life.off { color: var(--border); }

.rank-note { border-left: 3px solid var(--accent); }
.rank-warn { border-left: 3px solid var(--amber); }
.life-prompt { border-left: 3px solid var(--red); }

/* Axes */
.axis { margin-top: 12px; }
.axis:first-of-type { margin-top: 6px; }
.axis-head { display: flex; justify-content: space-between; align-items: baseline; }
.axis-label { font-weight: 600; font-size: 0.92rem; }
.axis-score { font-weight: 800; font-variant-numeric: tabular-nums; }
.axis-track {
  height: 9px; margin-top: 4px;
  background: var(--bg-elev-2); border-radius: 99px; overflow: hidden;
}
.axis-track > span { display: block; height: 100%; border-radius: 99px; transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
.a-regularite > span  { background: linear-gradient(90deg, #4f8cff, #6ea8ff); }
.a-progression > span { background: linear-gradient(90deg, #35c98a, #5be0a8); }
.a-charge > span      { background: linear-gradient(90deg, #ffb84d, #ffd08a); }

/* Prestige */
.prestige-row { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.prestige-lvl {
  flex: none; width: 46px; height: 46px; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 1.3rem; font-weight: 800;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}

/* Trophées */
.trophy-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px; margin-top: 8px;
}
.trophy {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 10px 6px; text-align: center;
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2); border: 1px solid var(--border);
}
.trophy.locked { opacity: 0.4; }
.trophy.fresh { border-color: var(--tc, var(--accent)); box-shadow: 0 0 0 1px var(--tc, var(--accent)) inset; }
.trophy-ico { font-size: 1.3rem; }
.trophy-name { font-size: 0.72rem; font-weight: 600; line-height: 1.2; }
.trophy-date { font-size: 0.64rem; color: var(--text-dim); }

.badge-soon {
  flex: none; font-size: 0.72rem; font-weight: 700;
  padding: 3px 8px; border-radius: 99px;
  background: var(--bg-elev-2); color: var(--text-dim); border: 1px solid var(--border);
}

/* Activation */
.rank-activate {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 26px 18px; gap: 4px;
}
.rank-bullets {
  text-align: left; margin: 10px 0 4px; padding-left: 18px;
  color: var(--text-dim); font-size: 0.88rem; line-height: 1.7;
}

/* Écran de gains post-séance */
.gain-modal { text-align: center; }
.gain-modal .rank-badge-svg { margin: 0 auto; }
.gain-tier { font-size: 1.25rem; font-weight: 800; margin-top: 4px; }
.gain-rp { font-size: 2rem; font-weight: 800; margin: 2px 0; font-variant-numeric: tabular-nums; }
.gain-rp.up { color: var(--green); }
.gain-rp.down { color: var(--red); }
.gain-promo { color: var(--amber); font-weight: 800; letter-spacing: 0.5px; }
.gain-detail { margin: 12px 0 0; }
.gain-row {
  display: flex; justify-content: space-between;
  padding: 6px 2px; border-top: 1px solid var(--border);
  font-size: 0.9rem;
}
.gain-row .up { color: var(--green); font-weight: 700; }
.gain-row .down { color: var(--red); font-weight: 700; }
.gain-row .flat { color: var(--text-dim); }
.gain-trophy {
  margin-top: 12px; padding: 8px 10px; border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--text); font-size: 0.85rem; font-weight: 600;
}
.muted.small.up { color: var(--green); }
.muted.small.down { color: var(--red); }

/* ═══ VERSUS ═══════════════════════════════════════════════════════════ */

.vt-rookie     { --vc: #8b8f96; }
.vt-contender  { --vc: #3ee0b0; }
.vt-challenger { --vc: #5c9bff; }
.vt-rival      { --vc: #c07bf0; }
.vt-predator   { --vc: #ff6a5c; }
.vt-apex       { --vc: #ffe27a; }

.versus-hero {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 4px; padding: 14px; margin-bottom: 12px;
  border-radius: var(--radius-sm);
  background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--vc, var(--accent)) 24%, transparent), transparent 70%), var(--bg-elev-2);
}
.versus-tier { font-size: 1.3rem; font-weight: 800; color: var(--vc, var(--text)); }

.versus-board { display: flex; flex-direction: column; margin-top: 4px; }
.vb-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 4px; border-top: 1px solid var(--border);
  font-size: 0.9rem;
}
.vb-row.you { background: var(--accent-soft); border-radius: 6px; font-weight: 700; }
.vb-pos { width: 22px; text-align: right; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.vb-slot { flex: none; color: var(--text-dim); font-size: 0.82rem; }

/* ═══ Panneau admin ═══════════════════════════════════════════════════ */

.admin-table { display: flex; flex-direction: column; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); }
.admin-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; text-align: left; width: 100%;
  background: var(--bg-elev); border: 0; border-bottom: 1px solid var(--border);
  color: var(--text); cursor: pointer; font-size: 0.9rem;
}
.admin-row:last-child { border-bottom: 0; }
.admin-row.sus { border-left: 3px solid var(--amber); }
.ar-name { display: flex; align-items: center; gap: 6px; }
.ar-tag {
  font-size: 0.66rem; font-weight: 700; text-transform: uppercase;
  padding: 1px 6px; border-radius: 99px;
  background: var(--bg-elev-2); color: var(--text-dim);
}
.ar-tag.ex { background: color-mix(in srgb, var(--red) 25%, transparent); color: var(--red); }
.ar-rank { flex: none; font-size: 0.82rem; color: var(--text-dim); }
.ar-flags { flex: none; color: var(--amber); font-weight: 700; font-size: 0.82rem; }

.admin-detail { max-width: 560px; }
.admin-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px;
  margin: 10px 0; font-size: 0.85rem;
}
.admin-kv { display: flex; justify-content: space-between; gap: 8px; }
.admin-kv .k { color: var(--text-dim); }
.admin-kv .v { font-weight: 600; text-align: right; }

.flag-list, .sess-list { display: flex; flex-direction: column; gap: 4px; }
.flag-item {
  font-size: 0.82rem; padding: 6px 8px; border-radius: 6px;
  background: color-mix(in srgb, var(--amber) 12%, var(--bg-elev-2));
}
.sess-item { display: flex; gap: 8px; font-size: 0.82rem; padding: 4px 2px; border-top: 1px solid var(--border); }
.admin-detail h4 { font-size: 0.9rem; margin: 12px 0 4px; }
.slot-form {
  margin-top: 10px; padding: 10px; border-radius: var(--radius-sm);
  background: var(--bg-elev-2); border: 1px solid var(--border);
}
.slot-form select, .slot-form input { width: 100%; margin-bottom: 6px; }

/* ═══ Cartes de routine enrichies ══════════════════════════════════════ */

.routine-card .routine-open {
  background: none; border: 0; color: inherit; cursor: pointer; display: block;
}
.routine-thumbs { display: flex; gap: 6px; align-items: center; overflow: hidden; }
.rt-thumb {
  width: 44px; height: 44px; flex: none; border-radius: 8px;
  object-fit: cover; background: #fff; border: 1px solid var(--border);
}
.rt-thumb.rt-empty, .fav-thumb.rt-empty {
  display: grid; place-items: center; background: var(--bg-elev-2); font-size: 1.1rem;
}
.rt-more { flex: none; font-size: 0.8rem; font-weight: 700; color: var(--text-dim); padding-left: 2px; }
.routine-card .chev { align-self: center; color: var(--text-dim); }

/* ═══ « Mes exercices » (favoris) ══════════════════════════════════════ */

.fav-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.fav-card {
  position: relative; border-radius: var(--radius-sm);
  background: var(--bg-elev); border: 1px solid var(--border); overflow: hidden;
}
.fav-do {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 100%; padding: 12px 8px 10px; background: none; border: 0; color: var(--text); cursor: pointer;
}
.fav-thumb { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; background: #fff; }
.fav-name { font-size: 0.82rem; font-weight: 600; text-align: center; line-height: 1.2; }
.fav-go { font-size: 0.72rem; font-weight: 700; color: var(--green); }
.fav-do:active { background: var(--bg-elev-2); }
.fav-info, .fav-x {
  position: absolute; top: 4px; width: 24px; height: 24px; border-radius: 6px;
  background: rgba(0,0,0,0.45); color: #fff; border: 0; cursor: pointer; font-size: 0.8rem;
  display: grid; place-items: center;
}
.fav-info { left: 4px; }
.fav-x { right: 4px; }

/* ═══ Page / feuille d'un exercice ════════════════════════════════════ */

.ex-hero {
  position: relative;
  border-radius: var(--radius); overflow: hidden; background: var(--bg-elev-2);
  display: grid; place-items: center; margin-bottom: 12px;
}
.ex-hero-img { width: 100%; max-height: 340px; object-fit: contain; display: block; background: #fff; }
.ex-hero-img.placeholder { background: var(--bg-elev-2); font-size: 3rem; min-height: 180px; display: grid; place-items: center; }
.ex-title { font-size: 1.3rem; margin: 0 0 8px; }
.ex-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.ex-actions { display: flex; gap: 8px; margin-top: 4px; }
.ex-actions .grow { flex: 1; }
.ex-instructions { line-height: 1.6; color: var(--text); }
.ex-instructions.steps { padding-left: 20px; }
.ex-instructions.steps li { margin-bottom: 8px; }

.ex-sheet { position: relative; padding-top: 34px; }
.ex-sheet-close { position: absolute; top: 8px; right: 8px; z-index: 2; }

/* ═══ Sélecteur multi (cat-row2) ═════════════════════════════════════ */

.cat-row2 {
  display: flex; align-items: stretch; gap: 8px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); overflow: hidden;
}
.cat-row2 .cat-check {
  flex: none; width: 22px; height: 22px; margin: auto 0 auto 10px; accent-color: var(--accent);
}
.cat-body {
  display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0;
  background: none; border: 0; color: var(--text); text-align: left; cursor: pointer; padding: 7px 8px 7px 2px;
}
.cat-body:active { background: var(--bg-elev-2); }
.cat-chev { flex: none; color: var(--text-dim); }

/* ═══ Saisie express (quick log) ═════════════════════════════════════ */

.ql-sets { display: flex; flex-direction: column; gap: 8px; }
.ql-set { display: grid; grid-template-columns: 60px 1fr 1fr; gap: 8px; align-items: end; }
.ql-set label { font-size: 0.72rem; }
.ql-set .step-field { width: 100%; }

/* fiche cliquable dans l'éditeur de routine */
.ex-thumb-btn { background: none; border: 0; padding: 0; cursor: pointer; line-height: 0; }
.name-btn { background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.name-btn:hover { text-decoration: underline; }
.fav-card.done { border-color: color-mix(in srgb, var(--green) 45%, var(--border)); }
.fav-card.done .fav-go { color: var(--green); }
.fav-card:not(.done) .fav-go { color: var(--text-dim); }

/* ═══ Animation de promotion (passage de palier) ═════════════════════ */

.promo-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  background:
    radial-gradient(60% 45% at 50% 42%, color-mix(in srgb, var(--tc, var(--accent)) 34%, transparent), transparent 75%),
    rgba(8, 9, 12, 0.86);
  backdrop-filter: blur(3px);
  animation: promo-in 240ms ease-out both;
  overflow: hidden;
}
.promo-overlay.leaving { animation: promo-out 240ms ease-in both; }
.promo-stage {
  position: relative; display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 24px; max-width: 90vw;
}

.promo-rays {
  position: absolute; top: 50%; left: 50%; width: 150vmax; height: 150vmax;
  transform: translate(-50%, -50%);
  background: repeating-conic-gradient(from 0deg,
    color-mix(in srgb, var(--tc, #fff) 22%, transparent) 0deg 6deg,
    transparent 6deg 20deg);
  opacity: 0; mask: radial-gradient(circle, #000 8%, transparent 60%);
  animation: promo-rays 900ms 120ms ease-out forwards, promo-spin 22s linear 1s infinite;
}
.promo-burst {
  position: absolute; top: 50%; left: 50%; width: 40px; height: 40px;
  border-radius: 50%; transform: translate(-50%, -50%);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--tc, #fff) 60%, transparent);
  animation: promo-burst 700ms 150ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.promo-badge {
  line-height: 0;
  filter: drop-shadow(0 0 30px color-mix(in srgb, var(--tc, var(--accent)) 55%, transparent));
  animation: promo-badge 750ms 120ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.promo-overlay.cross .promo-badge { animation-duration: 900ms; }
.promo-badge::after {
  content: ''; position: absolute; inset: -6px; border-radius: 50%;
  animation: promo-halo 1400ms 500ms ease-in-out infinite;
}

.promo-kicker {
  margin-top: 14px; font-size: 0.8rem; font-weight: 800; letter-spacing: 3px;
  color: var(--tc, var(--accent));
  animation: promo-rise 500ms 380ms ease-out both;
}
.promo-tier {
  font-size: 2rem; font-weight: 800; letter-spacing: 0.5px; margin-top: 2px;
  color: #fff; text-shadow: 0 0 26px color-mix(in srgb, var(--tc, transparent) 60%, transparent);
  animation: promo-rise 500ms 460ms ease-out both;
}
.promo-sub { color: var(--text-dim); margin-top: 4px; animation: promo-rise 500ms 560ms ease-out both; }
.promo-tap { margin-top: 22px; opacity: 0; animation: promo-fade 400ms 1400ms ease-out forwards; }

.promo-sparks { position: absolute; top: 46%; left: 50%; width: 0; height: 0; }
.promo-sparks span {
  position: absolute; width: 7px; height: 7px; border-radius: 50%;
  background: color-mix(in srgb, var(--tc, #fff) 70%, #fff);
  transform: translate(-50%, -50%) rotate(var(--a)) translateY(0);
  opacity: 0;
  animation: promo-spark var(--t) 260ms ease-out forwards;
}

@keyframes promo-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes promo-out { to { opacity: 0; } }
@keyframes promo-rays { to { opacity: 0.5; } }
@keyframes promo-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes promo-burst {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--tc, #fff) 65%, transparent); opacity: 1; }
  100% { box-shadow: 0 0 0 44vmax color-mix(in srgb, var(--tc, #fff) 0%, transparent); opacity: 0; }
}
@keyframes promo-badge {
  0% { transform: scale(0.2) rotate(-24deg); opacity: 0; }
  60% { transform: scale(1.14) rotate(4deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}
@keyframes promo-halo {
  0%, 100% { box-shadow: 0 0 40px 4px color-mix(in srgb, var(--tc, transparent) 40%, transparent); }
  50% { box-shadow: 0 0 66px 12px color-mix(in srgb, var(--tc, transparent) 60%, transparent); }
}
@keyframes promo-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes promo-fade { to { opacity: 0.7; } }
@keyframes promo-spark {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--a)) translateY(0) scale(0.4); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--a)) translateY(calc(var(--d) * -1)) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .promo-overlay { animation: promo-in 150ms ease-out both; }
  .promo-overlay.leaving { animation: none; opacity: 0; }
  .promo-badge, .promo-kicker, .promo-tier, .promo-sub { animation: none; }
  .promo-tap { animation: none; opacity: 0.7; }
}

/* Signalement de contenu (exercice, programme, séance) */
.report-btn {
  flex: none;
  width: 32px; height: 32px; padding: 0; line-height: 30px;
  border: 1px solid var(--border); border-radius: 999px; cursor: pointer;
  font-size: 0.9rem; color: var(--text-dim);
  background: var(--bg-elev);
  opacity: 0.8; transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.report-btn:hover, .report-btn:focus-visible { opacity: 1; color: var(--red); border-color: var(--red); }
/* Sur la photo d'un exercice : épinglé dans le coin, translucide */
.ex-hero .report-btn {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 30px; height: 30px; border: 0; color: #fff;
  background: rgba(20, 22, 28, 0.55);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  opacity: 0.6;
}
.ex-hero .report-btn:hover, .ex-hero .report-btn:focus-visible { opacity: 1; background: var(--red); color: #fff; }
.report-ta {
  width: 100%; resize: vertical; min-height: 84px;
  font: inherit; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--border, #2a2f3a); background: var(--bg-elev-2); color: var(--text);
}
.report-ta:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* File des signalements (panneau admin) */
.report-list { display: flex; flex-direction: column; gap: 8px; }
.report-card {
  border: 1px solid var(--border, #2a2f3a); border-left: 3px solid var(--red);
  border-radius: 10px; padding: 10px 12px; background: var(--bg-elev-1, var(--bg-elev-2));
}
.report-card.done { border-left-color: var(--text-dim); opacity: 0.62; }
.report-msg { margin: 6px 0; white-space: pre-wrap; line-height: 1.45; }
.admin-notif {
  display: inline-block; margin-left: 8px; padding: 1px 8px;
  border-radius: 999px; background: var(--red); color: #fff;
  font-size: 0.78rem; font-weight: 700;
}

/* ── Séance : indice de progression, 1RM, calculateur de disques ─────── */
.hint { color: var(--green); }
.set-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.set-meta .ex-e1rm { font-variant-numeric: tabular-nums; }
.plate-cta { flex: none; }

.plate-out { margin-top: 10px; }
.plate-stack { display: flex; flex-direction: column; gap: 6px; }
.plate-row { display: flex; align-items: center; gap: 10px; }
.plate-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 62px; padding: 4px 8px;
  border: 1px solid var(--border); border-radius: 999px;
  font-weight: 700; font-variant-numeric: tabular-nums; background: var(--bg-elev-2);
}

/* ── Heatmap de régularité ──────────────────────────────────────────── */
.hm-wrap { overflow-x: auto; }
.heatmap { width: 100%; max-width: 520px; height: auto; }
.hm-cell { fill: var(--bg-elev-2); }
.hm-l0 { fill: var(--bg-elev-2); }
.hm-l2 { fill: rgba(53, 201, 138, 0.45); }
.hm-l3 { fill: rgba(53, 201, 138, 0.7); }
.hm-l4 { fill: var(--green); }

/* ── Séries par muscle (dashboard) ─────────────────────────────────── */
.ml-row {
  display: grid; grid-template-columns: 92px 1fr 30px;
  align-items: center; gap: 8px; margin-bottom: 6px;
}
.ml-lbl { font-size: 0.82rem; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-bar { height: 8px; border-radius: 4px; background: var(--bg-elev-2); overflow: hidden; }
.ml-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.ml-n { font-size: 0.82rem; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

/* ── Supersets ─────────────────────────────────────────────────────── */
.superset-group {
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 8px;
  margin-bottom: 12px;
  background: rgba(79, 140, 255, 0.04);
}
.superset-tag {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em;
  text-transform: uppercase; color: var(--accent);
  padding: 2px 4px 6px;
}
.superset-group .card { margin-bottom: 8px; }
.superset-group .card:last-child { margin-bottom: 0; }
.superset-badge {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 22px; padding: 0 6px;
  border-radius: 6px; background: var(--accent); color: #fff;
  font-size: 0.78rem; font-weight: 700;
}
/* éditeur de routine : exercice lié au précédent */
.ex-item.ss-linked { border-top-color: var(--accent); margin-top: -4px; }
.ss-connector {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 6px;
}

/* ── Séries d'échauffement ─────────────────────────────────────────── */
.set-line.warmup input { opacity: 0.75; }
.set-line.warmup .idx {
  color: var(--amber); font-weight: 700;
}
.set-line.warmup .set-check { border-color: var(--amber); }
.set-line.warmup .set-check.done { background: var(--amber); border-color: var(--amber); color: #2a1e05; }

/* ── Journal alimentaire ───────────────────────────────────────────── */
.jr-row { margin-bottom: 10px; }
.jr-row:last-child { margin-bottom: 0; }
.jr-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.jr-lbl { font-size: 0.85rem; font-weight: 600; }
.jr-val { font-size: 0.82rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.jr-bar { height: 8px; border-radius: 4px; background: var(--bg-elev-2); overflow: hidden; }
.jr-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.3s ease; }
.jr-bar > span.over { background: var(--amber); }

/* ── Sélecteur : filtres muscle / matériel ─────────────────────────── */
.cat-filters { flex-wrap: wrap; overflow: visible; }
.cat-filter-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; width: 100%; }
.cat-filter-lbl { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); margin-right: 2px; }
.cat-filters .chip { min-height: 32px; padding: 4px 10px; font-size: 0.76rem; }

/* ── Variantes d'exercice ──────────────────────────────────────────── */
.alt-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.alt-card {
  flex: 0 0 116px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px; background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); cursor: pointer; text-align: center;
}
.alt-card:active { transform: scale(0.97); }
.alt-thumb { width: 84px; height: 60px; object-fit: cover; border-radius: 6px; background: var(--bg-elev-2); }
.alt-thumb.rt-empty { display: grid; place-items: center; font-size: 1.4rem; }
.alt-name { font-size: 0.78rem; font-weight: 600; line-height: 1.2; }
.alt-eq { font-size: 0.7rem; }

/* ── Dashboard : tendance de la semaine ────────────────────────────── */
.wk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wk-val { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 6px; }
.up { color: var(--green); }
.down { color: var(--red); }

/* ── Vitrine profil (page Rang) ───────────────────────────────────── */
.showcase-id { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: none; border: 0; color: var(--text); cursor: pointer; padding: 0; }
.showcase-avatar { font-size: 2rem; line-height: 1; flex: none; }
.showcase-name { font-size: 1.1rem; font-weight: 700; }
.year-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.year-badge {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 8px; border-radius: 999px;
  background: var(--bg-elev-2); border: 1px solid var(--border);
  font-size: 0.78rem; line-height: 1.15;
}
.year-badge b { font-size: 0.82rem; }
.year-badge.live { border-color: var(--accent); }
.avatar-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 4px; }
.avatar-opt {
  aspect-ratio: 1; display: grid; place-items: center; font-size: 1.4rem;
  background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: 10px; cursor: pointer;
}
.avatar-opt.sel { border-color: var(--accent); background: var(--accent-soft); }

/* Programme suivi (carte tableau de bord) */
.program-run { border-color: var(--accent); }
.program-run .pr-head { display: flex; align-items: flex-start; gap: 8px; }
.program-run .pr-bar {
  margin-top: 10px; height: 6px; border-radius: 999px;
  background: var(--bg-elev-2); overflow: hidden;
}
.program-run .pr-bar > span {
  display: block; height: 100%; background: var(--accent);
  border-radius: 999px; transition: width .3s ease;
}

/* Recettes : grille de catégories (cohérent avec la grille de zones des programmes) */
.cat-thumb {
  aspect-ratio: 1 / 1; position: relative;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elev-2);
}
.cat-thumb .cat-emoji { font-size: 2.4rem; line-height: 1; }
.cat-thumb .zone-badge { background: var(--accent); }

/* Calculateur de besoins énergétiques */
.calc-out { margin-top: 10px; padding: 10px; border-radius: 10px; background: var(--bg-elev-2); text-align: center; }
.calc-out .calc-tdee { font-size: 0.8rem; color: var(--text-dim); }
.calc-out .calc-target { font-size: 1.5rem; font-weight: 800; margin: 2px 0; }
.calc-out .calc-macros { font-size: 0.8rem; color: var(--text-dim); }
.calc-out .calc-hint {
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border);
  text-align: left; line-height: 1.4;
}
