/* ── Reset & base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Prevent iOS text size adjust on orientation change */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* Prevent pull-to-refresh on the whole app */
body { overscroll-behavior-y: contain; }

/* ── Design tokens — Maison (ivoire + encre warm + carmin) ─────
   Inspiré de Claude Design "CaliOS Maison" — papeterie parisienne,
   un seul accent (carmin), pas d'ombres, pas d'arrondis agressifs.   */
:root {
  /* Fonds — palette ivoire */
  --bg:        #ede5d0;  /* crème principale */
  --bg2:       #fbf5e2;  /* fiche/carte */
  --bg3:       #e4d9bd;  /* ivoire */
  --bg4:       #d5c8a9;  /* ombre ivoire */

  /* Accent — un seul, le carmin */
  --accent:    #a8342b;
  --accent2:   #7d2520;
  --accent3:   #c64a3f;
  --accent-light: rgba(168,52,43,.08);
  --accent-glow:  rgba(168,52,43,.15);

  /* Secondaire — sépia (pour badges tonaux type "volume") */
  --warm:      #6b4f2a;
  --warm2:     #8a6838;
  --warm-light: rgba(107,79,42,.10);

  /* États — sage pour success, carmin sombre pour danger (distinct du carmin accent) */
  --green:     #3f6143;
  --red:       #7d2520;
  --danger:    #7d2520;

  /* Textes — encre warm. .70 pour text2 vise AA 4.5:1 sur crème. */
  --text:      #1c1814;
  --text2:     rgba(28,24,20,.70);
  --text3:     rgba(28,24,20,.42);
  --text-dim:  rgba(28,24,20,.22);

  /* Borders */
  --border:    rgba(28,24,20,.14);
  --border2:   rgba(28,24,20,.07);

  /* Rayon — plus contenus, esprit éditorial */
  --radius:    10px;
  --radius-sm: 6px;
  --nav-h:     83px;

  /* Families */
  --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-mono:  'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, 'Roboto Mono', Consolas, monospace;

  font-size: 16px;
}

/* ── Typographie globale ──────────────────────────────────────── */
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
/* Chaleur papier : radial très léger en haut de l'écran, esprit Maison.
   Invisible en dark (la formule rgba prend une teinte neutre). */
body {
  background-image: radial-gradient(ellipse 600px 300px at 50% -5%, var(--accent-light), transparent 70%);
  background-attachment: fixed;
}

/* Utilitaires typo Maison — serif italique pour les chiffres-clés et les
   emphases éditoriales ; mono capitales pour les étiquettes techniques. */
.mais-num {
  font-family: var(--font-serif);
  font-weight: 300;
  font-style: italic;
  letter-spacing: -.02em;
  line-height: .9;
}
.mais-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--text2);
}
.mais-quote {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--text);
}
.mais-quote em { color: var(--accent); font-style: italic; font-weight: 500; }

/* Titres — par défaut sans-serif robuste pour les hubs techniques
   (Skills, Plan, Workouts, Historique). Le ton éditorial italique
   est réservé aux pages "signature" via les overrides plus bas. */
h1 {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 28px;
  color: var(--text);
  letter-spacing: -.01em;
  line-height: 1.05;
  margin-bottom: 6px;
}
h2 {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 18px;
  color: var(--text);
  letter-spacing: -.005em;
  margin-bottom: 12px;
}
h3 {
  font-family: var(--font-sans);
  font-size: 14px; font-weight: 600;
  letter-spacing: .01em;
  color: var(--text);
}
.subtext {
  color: var(--text2); font-size: 13px;
  font-family: inherit;
  line-height: 1.45;
}

/* ── Layout ──────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 430px;
  margin: 0 auto;
  position: relative;
}

.page {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px calc(var(--nav-h) + 8px);
  -webkit-overflow-scrolling: touch;
}
.page.active { display: block; }

/* ── Bottom nav ──────────────────────────────────────────────── */
#bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: var(--nav-h);
  background: rgba(237,229,208,.97);
  backdrop-filter: saturate(160%) blur(20px);
  -webkit-backdrop-filter: saturate(160%) blur(20px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -1px 0 var(--border2), 0 -8px 24px rgba(28,24,20,.05);
  align-items: flex-start;
  padding-top: 8px;
  padding-bottom: env(safe-area-inset-bottom);
}
#bottom-nav.visible { display: flex; }

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  color: var(--text3);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  -webkit-tap-highlight-color: transparent;
  padding: 4px 0;
  transition: color .2s;
}
.nav-item.active { color: var(--accent); }
.nav-item span {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 2px;
}
.nav-item .icon {
  font-size: 22px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.nav-item .icon svg { transition: filter .2s, transform .2s; }
.nav-item .icon svg path, .nav-item .icon svg line,
.nav-item .icon svg polygon, .nav-item .icon svg circle,
.nav-item .icon svg rect, .nav-item .icon svg ellipse {
  transition: stroke .2s, fill .2s;
}
.nav-item.active .icon svg { filter: drop-shadow(0 0 4px var(--accent-glow)); transform: scale(1.06); }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(26,23,20,.06), 0 4px 16px rgba(26,23,20,.04);
  position: relative;
  overflow: hidden;
}

.card-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--warm);           /* sépia — moins saturé que carmin partout */
  margin-bottom: 12px;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 15px; border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px; font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  border: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .15s, transform .1s, box-shadow .15s, background .15s;
}
.btn:active { opacity: .82; transform: scale(.985); }

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border: 1px solid rgba(168,52,43,.20);
  box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:active { box-shadow: 0 1px 4px var(--accent-glow); }

/* iOS zoom fix : Safari iOS zoome automatiquement sur tout input
 * dont la font-size est < 16px quand il prend le focus.
 * On impose 16px minimum sur tous les inputs/textarea/select.
 * Les inputs avec font-size explicite > 16px gardent leur taille.
 */
@media (max-width: 768px) {
  input[type="text"],
  input[type="number"],
  input[type="search"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  input[type="url"],
  input[type="date"],
  input[type="datetime-local"],
  input[type="time"],
  input:not([type]),
  textarea,
  select {
    font-size: 16px !important;
  }
}

/* Bouton GO géant au centre du dashboard */
.giant-go-btn {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  border: 1px solid rgba(0,0,0,.15);
  box-shadow: 0 8px 32px var(--accent-glow), 0 0 0 8px var(--accent-light);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  letter-spacing: .2em;
  transition: transform .1s ease, box-shadow .15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.giant-go-btn:hover {
  box-shadow: 0 12px 40px var(--accent-glow), 0 0 0 14px var(--accent-light);
}
.giant-go-btn:active {
  transform: scale(.96);
  box-shadow: 0 4px 16px var(--accent-glow), 0 0 0 4px var(--accent-light);
}
@media (max-width: 360px) {
  .giant-go-btn { width: 180px; height: 180px; }
}

.btn-success {
  background: var(--green);
  color: #f0faf4;
  border: 1px solid rgba(45,122,74,.20);
  box-shadow: 0 2px 12px rgba(45,122,74,.15);
}

.btn-ghost {
  background: var(--bg3);
  color: var(--text2);
  border: 1px solid var(--border);
  font-size: 12px;
}

.btn-sm {
  width: auto; padding: 10px 16px;
  min-height: 44px; /* Apple HIG minimum touch target */
  font-size: 11px; font-weight: 700;
  border-radius: var(--radius-sm);
  letter-spacing: .5px;
}
.btn:disabled {
  background: var(--bg3); color: var(--text3);
  cursor: not-allowed; box-shadow: none;
}

/* ── Progress bars ───────────────────────────────────────────── */
.progress-bar-track {
  background: var(--bg3);
  border-radius: 99px;
  height: 5px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent3) 100%);
  transition: width .4s ease;
}

/* ── Gauge circle ────────────────────────────────────────────── */
.gauge { position: relative; width: 80px; height: 80px; }
.gauge svg { transform: rotate(-90deg); }
.gauge-val {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; line-height: 1;
  font-family: inherit;
  color: var(--accent);
}
.gauge-val small { font-size: 9px; font-weight: 600; color: var(--text2); font-family: inherit; }

/* ── Readiness card ──────────────────────────────────────────── */
.readiness-row { display: flex; align-items: center; gap: 16px; }
.readiness-num {
  font-size: 56px; font-weight: 900; line-height: 1;
  font-family: inherit;
  color: var(--accent);
}
.readiness-meta { color: var(--text2); font-size: 13px; margin-top: 4px; }

/* ── Stat row ────────────────────────────────────────────────── */
.stat-row { display: flex; gap: 0; }
.stat-item {
  flex: 1; text-align: center; padding: 10px 0;
  border-right: 1px solid var(--border2);
}
.stat-item:last-child { border-right: none; }
.stat-val {
  /* Cormorant roman (non-italic) pour les KPI : préserve l'identité Maison
     tout en gardant la lisibilité numérique (l'italique déforme les chiffres).
     tabular-nums aligne 0-9 sur une grille fixe → colonnes propres. */
  font-family: var(--font-serif);
  font-style: normal;
  font-weight: 500;
  font-size: 32px;
  letter-spacing: -.015em;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
@media (max-width: 360px) {
  .stat-val { font-size: 26px; }
}
.stat-lbl {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--text2);
  margin-top: 4px;
  font-weight: 500;
}

/* ── Week dots ───────────────────────────────────────────────── */
.week-row { display: flex; justify-content: space-between; }
.week-day { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; }
.week-dot {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: background .2s;
}
.week-dot.done {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}
.week-dot.today {
  border: 2px solid var(--warm);
  box-shadow: 0 0 0 3px var(--warm-light);
}
.week-lbl { font-size: 9px; color: var(--text3); font-family: inherit; letter-spacing: .4px; }

/* ── Skill row ───────────────────────────────────────────────── */
.skill-row {
  display: flex; flex-direction: column; gap: 6px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border2);
  cursor: pointer;
}
.skill-row:last-child { border-bottom: none; }
.skill-row-top { display: flex; justify-content: space-between; align-items: center; }
.skill-name { font-size: 14px; font-weight: 600; font-family: inherit; color: var(--accent); letter-spacing: .1px; }
.skill-lvl  { font-size: 12px; color: var(--text2); }
.skill-days { font-size: 12px; color: var(--warm); font-family: inherit; }

/* ── Exercise card ───────────────────────────────────────────── */
.ex-card {
  background: var(--bg2);
  border-radius: var(--radius-sm);
  padding: 14px 14px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border);
  transition: border-color .2s, background .2s, box-shadow .2s;
  position: relative;
  overflow: hidden;
}
.ex-card.active {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: 0 0 0 1px var(--accent-light);
}
.ex-card.done { opacity: .40; }

.ex-icon {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
  background: var(--bg3);
  border: 1px solid var(--border);
  overflow: hidden;
}
.ex-icon svg { width: 22px; height: 22px; }
.ex-icon.active {
  background: var(--accent);
  border-color: transparent;
}
.ex-icon.done {
  background: var(--green);
  border-color: transparent;
}
.ex-info { flex: 1; min-width: 0; }
.ex-name {
  font-size: 13px; font-weight: 600;
  font-family: inherit;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: .05px;
}
.ex-target { font-size: 12px; color: var(--text2); margin-top: 2px; }
.ex-note   { font-size: 11px; color: var(--warm); margin-top: 2px; }

/* ── RPE Sheet ───────────────────────────────────────────────── */
.sheet-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 100;
  background: rgba(26,23,20,.40);
  backdrop-filter: blur(4px);
  align-items: flex-end;
  justify-content: center;
}
.sheet-overlay.visible { display: flex; overscroll-behavior: contain; }
.sheet {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  padding: 20px 20px calc(32px + env(safe-area-inset-bottom));
  width: 100%; max-width: 430px;
  box-shadow: 0 -4px 32px rgba(26,23,20,.12);
  animation: slideUp .22s ease;
  /* Si le contenu dépasse la hauteur viewport (liste d'exos longue, recap
     avec accessoires, clavier iOS ouvert…), on laisse scroller dans le sheet. */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes levelUpPop {
  from { transform: scale(.6); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
/* Pop énorme + overshoot pour le level-up post-séance (effet "waouh") */
@keyframes levelUpBigPop {
  0%   { transform: scale(.3) translateY(40px); opacity: 0; }
  55%  { transform: scale(1.08) translateY(-4px); opacity: 1; }
  78%  { transform: scale(.97) translateY(1px); }
  100% { transform: scale(1) translateY(0); }
}
/* Halo qui pulse derrière la bannière */
@keyframes levelUpHaloPulse {
  0%, 100% { transform: scale(1);   opacity: .55; }
  50%      { transform: scale(1.18); opacity: .85; }
}
/* Rebond subtil de l'emoji 🏆 / 🏗️ */
@keyframes levelUpEmojiBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-6px) scale(1.08); }
}
.sheet-handle {
  width: 36px; height: 3px;
  background: var(--border);
  border-radius: 2px; margin: 0 auto 16px;
}
input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px;
  background: var(--bg3); border-radius: 2px; outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent);
  border: 2px solid rgba(255,255,255,.8);
  box-shadow: 0 1px 6px var(--accent-glow);
  cursor: pointer;
}

/* ── Skill tree SVG container ────────────────────────────────── */
.skill-tree-wrap {
  width: 100%;
  overflow-x: hidden;
  overflow-y: visible;
  position: relative;
  background: #f8f6f1;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 3px rgba(26,23,20,.04);
}
.skill-tree-wrap svg {
  display: block;
  width: 100%;
  overflow: visible;
}

/* ── Tooltip ─────────────────────────────────────────────────── */
.stree-tooltip {
  position: absolute;
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px 11px;
  width: 210px;
  box-shadow: 0 8px 32px rgba(26,23,20,.16);
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transform: scale(.90) translateY(-6px);
  transition: opacity .18s ease, transform .18s ease;
}
.stree-tooltip.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}
.stree-tooltip::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px; right: -1px; bottom: -1px;
  border-radius: 10px;
  pointer-events: none;
}
.stree-tooltip-title {
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .4px;
  margin-bottom: 5px;
  line-height: 1.3;
}
.stree-tooltip-sets {
  font-size: 11px;
  font-weight: 600;
  color: var(--warm);
  margin-bottom: 7px;
  letter-spacing: .1px;
  font-family: inherit;
}
.stree-tooltip-hint {
  font-size: 10px;
  color: var(--text3);
  line-height: 1.5;
  padding-top: 6px;
  border-top: 1px solid var(--border2);
  letter-spacing: .1px;
  font-family: inherit;
  font-style: italic;
}

/* ── Chart bars ──────────────────────────────────────────────── */
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 80px; }
.bar-wrap  { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bar {
  width: 100%; border-radius: 4px 4px 0 0;
  background: var(--accent);
  min-height: 4px; transition: height .4s ease;
  opacity: .75;
}
.bar-lbl { font-size: 9px; color: var(--text2); font-family: inherit; }

/* ── Onboarding ──────────────────────────────────────────────── */
.onboard-step { display: none; }
.onboard-step.active { display: block; }
.onboard-step .btn-primary,
.onboard-step .btn-success {
  position: sticky;
  bottom: 16px;
  margin-top: 16px;
  z-index: 10;
  box-shadow: 0 4px 20px var(--accent-glow);
}
.step-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 24px; }
.step-dot  { width: 6px; height: 6px; border-radius: 50%; background: var(--border); }
.step-dot.active { background: var(--accent); width: 18px; border-radius: 3px; }

.toggle-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.toggle-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .15s, background .15s;
}
.toggle-item input[type=checkbox] { display: none; }
.toggle-check {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
}
.toggle-item.selected {
  border-color: rgba(168,52,43,.25);
  background: var(--accent-light);
}
.toggle-item.selected .toggle-check {
  background: var(--accent);
  border-color: transparent;
}

.pill-group { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  padding: 9px 18px; border-radius: 99px;
  background: var(--bg2);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 12px; font-weight: 600;
  letter-spacing: .2px;
  color: var(--text2);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.pill.selected {
  background: var(--accent);
  color: var(--bg);
  border-color: transparent;
}

.goal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.goal-tile {
  padding: 18px 14px; border-radius: var(--radius-sm);
  background: var(--bg2);
  border: 1px solid var(--border);
  font-family: inherit;
  text-align: center; font-size: 12px; font-weight: 600;
  letter-spacing: .2px;
  color: var(--text2);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.goal-tile.selected {
  background: var(--accent);
  color: var(--bg);
  border-color: transparent;
}

/* ── Alerts / badges ─────────────────────────────────────────── */
.alert {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--warm-light);
  border: 1px solid rgba(196,114,74,.20);
  border-radius: var(--radius-sm);
  padding: 12px; margin-bottom: 10px;
  font-size: 13px;
}
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 99px;
  font-family: inherit;
  font-size: 10px; font-weight: 700;
  letter-spacing: .4px;
}
.badge-green  { background: rgba(45,122,74,.10);  color: var(--green);  border: 1px solid rgba(45,122,74,.18); }
.badge-orange { background: var(--warm-light);    color: var(--warm);   border: 1px solid rgba(196,114,74,.20); }
.badge-red    { background: rgba(192,64,64,.10);  color: var(--red);    border: 1px solid rgba(192,64,64,.18);  }

/* ── Goal tag ────────────────────────────────────────────────── */
.goal-tag {
  display: inline-block;
  font-family: inherit;
  font-size: 10px; font-weight: 700;
  color: var(--warm);
  background: var(--warm-light);
  border: 1px solid rgba(196,114,74,.20);
  border-radius: 5px;
  padding: 2px 7px;
  margin-top: 4px;
  letter-spacing: .3px;
}
.goal-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: inherit;
  font-size: 11px; font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid rgba(168,52,43,.12);
  border-radius: 99px;
  padding: 4px 10px;
}
.goal-pill-label { font-size: 10px; color: var(--text2); font-weight: 500; font-family: inherit; }

/* ── Progression tree (legacy rows) ─────────────────────────── */
.tree-row { display:flex; align-items:flex-start; gap:12px; padding:8px 0; border-bottom:1px solid var(--border2); }
.tree-row:last-child { border-bottom:none; }
.tree-dot { width:28px; height:28px; border-radius:50%; flex-shrink:0; display:flex; align-items:center; justify-content:center; font-size:13px; margin-top:2px; }
.tree-dot.done    { background: var(--accent); }
.tree-dot.current { background: var(--warm); }
.tree-dot.future  { background: var(--bg3); }
.tree-info { flex:1; }
.tree-name { font-size:13px; font-weight:600; font-family:inherit; color:var(--accent); }
.tree-hint { font-size:11px; color:var(--warm); margin-top:2px; font-style:italic; }

/* ── Utility ─────────────────────────────────────────────────── */
.mt-8  { margin-top: 8px;  }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.flex  { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8  { gap: 8px; }
.hidden { display: none !important; }

/* ── iOS / touch fixes ──────────────────────────────────────── */
/* Empêcher le zoom au double-tap sur les boutons */
button, select, input, textarea { touch-action: manipulation; font-family: inherit; }

/* Touch targets minimum 44px pour tous les éléments interactifs */
.plan-day-pick { min-height: 36px; display: flex; align-items: center; justify-content: center; }
.ex-skip-btn { min-height: 32px; }
.ex-info-btn { min-width: 32px; min-height: 32px; }

/* Fix input iOS : pas de zoom au focus */
input[type="number"], input[type="text"], select {
  font-size: 16px !important; /* iOS zoom si < 16px */
}

/* Fix scroll iOS : momentum scroll */
.page { -webkit-overflow-scrolling: touch; }

/* Fix position:fixed avec clavier iOS */
.sheet { max-height: calc(100dvh - env(safe-area-inset-top)); }

/* ── Dark mode — piloté par JS via [data-theme="dark"] ──────── */
/* Le bootstrap inline dans <head> translate 'system' → dark/light
   avant le premier paint, puis parameters.js et app.js maintiennent
   l'attribut à jour (y compris sur changement de thème OS).        */
:root[data-theme="dark"] {
  /* Maison nuit — encre warm en base, cream pour le texte, carmin vif */
  --bg:        #14110e;
  --bg2:       #1f1a14;
  --bg3:       #2a2219;
  --bg4:       #3d332a;

  --accent:    #d95a50;  /* carmin rétroéclairé */
  --accent2:   #b8413a;
  --accent3:   #e6776d;
  --accent-light: rgba(217,90,80,.14);
  --accent-glow:  rgba(217,90,80,.22);

  --warm:      #c6976a;
  --warm2:     #d9b089;
  --warm-light: rgba(198,151,106,.14);

  --green:     #8ab089;
  --red:       #f07a70;   /* rouge vif distinct du carmin accent */
  --danger:    #f07a70;

  --text:      #ede5d0;
  --text2:     rgba(237,229,208,.72);
  --text3:     rgba(237,229,208,.45);
  --text-dim:  rgba(237,229,208,.22);

  --border:    rgba(237,229,208,.12);
  --border2:   rgba(237,229,208,.06);
}

[data-theme="dark"] #bottom-nav { background: rgba(20,17,14,.97); }
[data-theme="dark"] .card { background: var(--bg2); border-color: var(--border); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
[data-theme="dark"] .btn-primary { background: var(--accent); color: var(--bg); }
[data-theme="dark"] .btn-success { background: var(--green); color: var(--bg); }
[data-theme="dark"] .btn-ghost { background: var(--bg3); color: var(--text2); border-color: var(--border); }
[data-theme="dark"] .sheet { background: var(--bg2); border-color: var(--border); }
[data-theme="dark"] .sheet-overlay { background: rgba(0,0,0,.50); }
[data-theme="dark"] .skill-tree-wrap { background: var(--bg2); border-color: var(--border); }
[data-theme="dark"] .progress-bar-fill { background: linear-gradient(90deg, var(--accent) 0%, var(--accent3) 100%); }
[data-theme="dark"] input[type=range] { background: var(--bg3); }
[data-theme="dark"] input[type=range]::-webkit-slider-thumb { background: var(--accent); }
[data-theme="dark"] .toggle-item { background: var(--bg2); border-color: var(--border); }
[data-theme="dark"] .toggle-item.selected { background: var(--accent-light); border-color: var(--accent-glow); }
[data-theme="dark"] .pill { background: var(--bg2); border-color: var(--border); color: var(--text2); }
[data-theme="dark"] .pill.selected { background: var(--accent); color: var(--bg); }
[data-theme="dark"] .goal-tile { background: var(--bg2); border-color: var(--border); color: var(--text2); }
[data-theme="dark"] .goal-tile.selected { background: var(--accent); color: var(--bg); }
[data-theme="dark"] .ex-card { background: var(--bg2); border-color: var(--border); }
[data-theme="dark"] .ex-card.active { background: var(--accent-light); border-color: var(--accent); }
[data-theme="dark"] .stree-tooltip { background: var(--bg2); border-color: var(--border); box-shadow: 0 8px 32px rgba(0,0,0,.3); }

/* ── Réduire les animations ─────────────────────────────────── */
/* Actif soit via OS (prefers-reduced-motion), soit via toggle Paramètres. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
[data-reduce-motion="1"] *,
[data-reduce-motion="1"] *::before,
[data-reduce-motion="1"] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

/* ── Parameters page ────────────────────────────────────────────── */
#parameters-list { display: flex; flex-direction: column; gap: 8px; }
.param-row {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  min-height: 56px;
  transition: background .15s ease, transform .05s ease;
}
.param-row:active { transform: scale(.99); background: var(--bg3); }
.param-icon { font-size: 20px; width: 28px; text-align: center; flex-shrink: 0; }
.param-label { flex: 1; font-size: 15px; font-weight: 500; color: var(--text); }
.param-chevron { color: var(--text2); font-size: 22px; line-height: 1; flex-shrink: 0; opacity: .6; }

/* Sections dans les sous-pages Paramètres (groupes iOS-like) */
.params-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px 16px;
  margin-bottom: 16px;
  overflow: hidden;
}
.params-section-title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .15em;
  color: var(--warm);           /* sépia — évite l'écran-rouge carmin saturé */
  padding: 12px 0 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.params-kv-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.params-kv-row:last-child { border-bottom: none; }
.params-kv-label { font-size: 14px; color: var(--text); }
.params-kv-value { font-size: 14px; color: var(--text2); text-align: right; }
.params-link-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 10px 0;
  text-decoration: none;
  color: var(--text);
}
.params-link-row .params-kv-value { color: var(--accent); }
.params-link-row:active { opacity: .7; }

/* Toggle switches (iOS-style) dans les sous-pages Paramètres */
.params-switch-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}
.params-switch-row:last-child { border-bottom: none; }
.params-switch-row:active { opacity: .8; }
.params-switch-label { font-size: 14px; color: var(--text); font-weight: 500; }
.params-silent-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  background: var(--bg3);
  color: var(--text2);
  border-radius: 4px;
  vertical-align: middle;
}
.params-switch-hint { font-size: 11px; color: var(--text3); margin-top: 2px; line-height: 1.35; }
.params-switch {
  position: relative;
  width: 46px; height: 28px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .2s ease, border-color .2s ease;
}
.params-switch::after {
  content: '';
  position: absolute;
  left: 2px; top: 1px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg2);
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
  transition: left .2s ease, background .2s ease;
}
.params-switch.on { background: var(--accent); border-color: var(--accent); }
.params-switch.on::after { left: 20px; background: #fff; }
.params-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Slider row */
.params-slider-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.params-slider-row:last-child { border-bottom: none; }

/* Action row (ouvre un picker / sous-navigation) */
.params-action-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.params-action-row:last-child { border-bottom: none; }
.params-action-row:active { opacity: .7; }

/* Input rows (text, number) */
.params-input-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.params-input-row:last-of-type { border-bottom: none; }
.params-input-row .params-switch-label { display: block; margin-bottom: 2px; }

/* Day picker (Lun/Mar/Mer/...) dans Plan */
.params-day-pick {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg3);
  color: var(--text3);
  border: 1px solid var(--border);
  min-height: 40px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, color .15s ease;
}
.params-day-pick.on {
  background: var(--accent);
  color: #1a1a1e;
  border-color: var(--accent);
}
.params-day-pick:active { opacity: .8; }

/* Grille de durée (45 / 60 / 70 / 90) */
.params-duration-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.params-duration-opt {
  text-align: center;
  padding: 12px 4px;
  border-radius: 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  cursor: pointer;
  min-height: 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: background .15s ease, color .15s ease;
}
.params-duration-opt.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1a1e;
}
.params-duration-val { font-size: 18px; font-weight: 800; line-height: 1; }
.params-duration-unit { font-size: 11px; opacity: .75; margin-top: 2px; }

/* Sélecteur semaine deload (6 colonnes 1-6) — même style que duration grid */
.params-deload-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.params-deload-opt {
  text-align: center;
  padding: 12px 4px;
  border-radius: 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  cursor: pointer;
  min-height: 48px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, color .15s ease;
}
.params-deload-opt.on {
  background: var(--warm);
  border-color: var(--warm);
  color: var(--bg);
}

/* Radio rows (block order) */
.params-radio-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.params-radio-row:last-child { border-bottom: none; }
.params-radio-row:active { opacity: .8; }
.params-radio {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  position: relative;
  /* bg3 garde le radio toujours plus clair que son parent .params-section (bg2)
     dans les deux thèmes — comportement iOS natif. */
  background: var(--bg3);
  transition: border-color .15s ease, background .15s ease;
}
.params-radio.on { border-color: var(--accent); }
.params-radio.on::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
}

/* ── Look unifié des <select> et <input type="date/time"> dans toute
   la zone Paramètres. Supprime le look natif hétérogène (iOS pill, Chrome
   3D, Firefox plat) et remplace par une bordure+chevron Maison.
   Ne set volontairement PAS font-family / font-size pour laisser les
   classes spécifiques (params-level-select en mono, etc.) garder leurs
   choix typographiques. ─────────────────────────────────────────────── */
[id^="page-params"] select,
[id^="page-params"] input[type="date"],
[id^="page-params"] input[type="time"] {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--bg3);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%23a8342b' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='2,2 6,6 10,2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 8px;
  padding-right: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}
/* En dark mode, chevron carmin vif pour rester visible sur encre warm */
[data-theme="dark"] [id^="page-params"] select,
[data-theme="dark"] [id^="page-params"] input[type="date"],
[data-theme="dark"] [id^="page-params"] input[type="time"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%23d95a50' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='2,2 6,6 10,2'/%3E%3C/svg%3E");
}
/* `input[type="date"]/time` sur Safari a un bouton calendrier natif qu'on
   peut masquer pour laisser place à notre chevron custom */
[id^="page-params"] input[type="date"]::-webkit-calendar-picker-indicator,
[id^="page-params"] input[type="time"]::-webkit-calendar-picker-indicator {
  opacity: 0;
  position: absolute;
  right: 0;
  width: 34px;
  height: 100%;
  cursor: pointer;
}
[id^="page-params"] input[type="date"],
[id^="page-params"] input[type="time"] {
  position: relative;
}

/* ── Picklist skills/cores (Paramètres → Plan) ────────────── */
.params-picklist { display: flex; flex-direction: column; gap: 4px; }
/* Ligne picklist minimaliste : transparente, fond hérité de la card.
   Seul un trait de séparation fin + chevron signalent le select. */
.params-picklist-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  border-bottom: 1px solid var(--border2);
}
.params-picklist-row:last-child { border-bottom: none; }
.params-picklist-row select {
  flex: 1;
  min-width: 0;
  padding: 10px 32px 10px 2px;
  border: none;
  border-radius: 0;
  background-color: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  min-height: 44px;
  cursor: pointer;
  background-position: right 4px center;
}
.params-picklist-remove {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border: none;
  background: transparent;
  color: var(--text3);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  touch-action: manipulation;
  opacity: .6;
  transition: opacity .15s, background .15s, color .15s;
}
.params-picklist-remove:active {
  opacity: 1;
  background: var(--accent-light);
  color: var(--danger);
}
.params-picklist-add { font-family: var(--font-mono); letter-spacing: .08em; }

/* ── Niveau actuel par exercice (Paramètres) ───────────────── */
.params-level-tree {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}
.params-level-tree > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  -webkit-tap-highlight-color: transparent;
}
.params-level-tree > summary::-webkit-details-marker { display: none; }
.params-level-tree > summary::after {
  content: '›';
  font-size: 22px;
  color: var(--text2);
  margin-left: 8px;
  transition: transform .2s ease;
  flex-shrink: 0;
}
.params-level-tree[open] > summary::after { transform: rotate(90deg); }
.params-level-tree-label {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
}
.params-level-tree-lvl {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--warm);
  font-weight: 600;
}
.params-level-tree-body {
  padding: 4px 16px 14px;
  border-top: 1px solid var(--border);
}

.params-level-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border2);
}
.params-level-row:last-child { border-bottom: none; }
.params-level-label { flex: 1; min-width: 0; }
.params-level-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.params-level-role {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text3);
  margin-top: 2px;
  font-weight: 500;
}
.params-level-select {
  font-family: var(--font-mono);   /* mono = chiffres alignés en colonne */
  font-size: 13px;
  font-weight: 400;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  min-width: 80px;
  min-height: 40px;
  cursor: pointer;
  flex-shrink: 0;
}

.params-level-actions {
  margin-top: 20px;
  padding-bottom: 20px;  /* pour laisser respirer au-dessus du bottom-nav */
}

/* Picker de niveau (dropdown en haut du body d'un tree) */
.params-level-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.params-level-picker-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--warm);
}
/* Compound `select.foo` → même specificité que la règle générique
   `[id^="page-params"] select` → l'ordre détermine le gagnant = celui-ci. */
/* Compound `select.foo` → même specificité que la règle générique
   `[id^="page-params"] select` → l'ordre détermine le gagnant = celui-ci.
   Bordure carmin pour signaler que c'est l'ancre du tree. */
select.params-level-picker-select {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 400;
  padding: 8px 10px;
  padding-right: 34px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background-color: var(--bg3);
  color: var(--accent);
  min-height: 40px;
  cursor: pointer;
}

/* Checkbox "ajuster au cap" — apparaît quand le niveau est augmenté */
.params-level-cap-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  margin: 4px 0 10px;
  background: rgba(168,52,43,.08);
  border: 1px solid var(--accent);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text);
}
.params-level-cap-toggle input[type=checkbox] {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--accent);
}
/* Variante reset : teinte sépia pour marquer le sens différent (step down) */
.params-level-reset-toggle {
  background: rgba(107,79,42,.08);
  border-color: var(--warm);
}
.params-level-reset-toggle input[type=checkbox] { accent-color: var(--warm); }

/* Note affichée quand "Reset" est coché (masque les dropdowns) */
.params-level-reset-note {
  padding: 12px;
  margin: 8px 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text2);
  font-style: italic;
  background: var(--bg3);
  border-radius: 8px;
}

/* Hint inline "Au-delà du seuil de passage → monter de niveau" */
.params-level-graduate-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin: -4px 0 6px;
  background: rgba(63,97,67,.08);
  border: 1px dashed var(--green);
  border-radius: 6px;
  font-size: 11px;
  color: var(--text2);
  line-height: 1.35;
}
.params-level-levelup {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 6px 10px;
  background: var(--green);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
}
.params-level-levelup:active { opacity: .8; }

/* ── Sidebar "feu" difficulté en séance guidée ─────────────── */
/* 3 cercles empilés verticalement, position absolue à droite de l'écran.
   Chaque cercle = bouton à pictogramme. Taille 44×44 pour respecter le
   touch target iOS, gap 10px entre cercles. L'état actif éclaire le cercle
   concerné (bg coloré + glow halo). */
.guided-diff-rail {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
  pointer-events: auto;
}
.guided-diff-dot {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1.5px solid var(--text3);
  background: var(--bg2);
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease, transform .1s ease;
  padding: 0;
}
.guided-diff-dot:active { transform: scale(.92); }
.guided-diff-dot svg { display: block; }

/* ── Rattrapage — séance manquée ───────────────────────────── */
.catchup-card {
  background: var(--bg2);
  border: 1px solid var(--accent);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 4px 0 16px;
  box-shadow: 1px 1px 0 var(--border), 2px 2px 0 var(--accent-light);
}
.catchup-card .mais-quote { color: var(--text); }
.catchup-card .mais-quote em { color: var(--accent); font-weight: 500; }

/* ── Maison : layout dashboard ─────────────────────────────── */

/* Effet "letterpress" : shadow décalée en accent-light au lieu du flou iOS.
   Appliqué uniquement à la carte Forme du jour (la plus visible) — ne pas
   généraliser sinon l'écran devient pesant. */
#dash-readiness {
  background: var(--bg2);
  border: 1px solid var(--text);
  box-shadow: 1px 1px 0 var(--border), 3px 3px 0 var(--accent-light);
}

/* Stats bar : cadre ink complet façon "tableau de journal", pas des
   séparateurs fantômes. Les chiffres sont déjà en Cormorant roman. */
#dash-stats {
  padding: 0;
  border: 1px solid var(--text);
}
#dash-stats .stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
}
#dash-stats .stat-item {
  padding: 14px 6px;
  text-align: center;
  border-right: 1px solid var(--text);
}
#dash-stats .stat-item:last-child { border-right: none; }
#dash-stats .stat-item .stat-val { color: var(--text); }
/* Emphase carmin italique sur le chiffre central (convention Maison) */
#dash-stats .stat-item:nth-child(2) .stat-val {
  color: var(--accent);
  font-style: italic;
}

/* Modal partage QR code */
.share-qr-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
}
.share-qr-card {
  position: relative;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 20px 18px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0,0,0,.35);
}
.share-qr-close {
  position: absolute; top: 6px; right: 6px;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--text2);
  cursor: pointer; user-select: none;
}
/* Force fond blanc derrière le SVG pour garantir un bon contraste de lecture
   même en thème sombre (certains scanners ratent un QR sur fond gris) */
.share-qr-svg {
  background: #fff;
  border-radius: 10px;
  padding: 12px;
  margin: 0 auto 14px;
  display: inline-block;
  line-height: 0;
}
.share-qr-svg svg {
  display: block;
  width: 100%;
  max-width: 240px;
  height: auto;
  aspect-ratio: 1;
}
.share-qr-url {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
  margin-bottom: 10px;
  max-width: 100%;
}
.share-qr-hint {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text2);
  margin-bottom: 14px;
}
.share-qr-copy { width: 100%; font-size: 12px; }
.share-qr-warn {
  background: rgba(255,179,0,.12);
  border: 1px solid rgba(255,179,0,.35);
  color: var(--warm);
  font-size: 11px;
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  text-align: left;
}

/* ── Fixes de débordement texte (audit UI) ─────────────────── */

/* H1 des hubs en ton Maison : Cormorant italic carmin.
   S'applique à dashboard, plan, workouts, skills & core, history, et au hub
   Paramètres. Les pages techniques avec un "← Retour" (sous-pages Paramètres,
   skill-detail, core-detail) gardent un H2 sans-serif plus sobre. */
#page-dashboard .flex-between > div:first-child { min-width: 0; flex: 1; }
#page-dashboard h1,
#page-plan h1,
#page-workout h1,
#page-skills h1,
#page-history h2 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-serif);
  font-weight: 400;
  font-style: italic;
  font-size: 32px;
  color: var(--accent);
  letter-spacing: -.02em;
  line-height: 1;
  margin-bottom: 0;
}
@media (max-width: 360px) {
  #page-dashboard h1,
  #page-plan h1,
  #page-workout h1,
  #page-skills h1,
  #page-history h2 { font-size: 26px; }
}

/* Titres des sous-pages Paramètres : sans-serif 16px solide (utilitaire).
   Le hub "Paramètres" garde l'italique serif pour la signature éditoriale. */
#page-params-user h2,
#page-params-plan h2,
#page-params-levels h2,
#page-params-guided h2,
#page-params-appearance h2,
#page-params-notifications h2,
#page-params-about h2 {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#page-parameters h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-style: italic;
  font-size: 32px;
  color: var(--accent);
  letter-spacing: -.02em;
  line-height: 1;
}

/* Link row (ex: email feedback) : permettre à la value de wrap sans pousser le label */
.params-link-row .params-kv-label { flex-shrink: 0; }
.params-link-row .params-kv-value { overflow-wrap: anywhere; min-width: 0; }

/* KV row avec contenu potentiellement long (permission notif) :
   passe en colonne pour laisser le texte s'étaler à gauche plutôt
   qu'être écrasé à droite. */
.params-kv-row.params-kv-row--stack {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.params-kv-row.params-kv-row--stack .params-kv-value {
  text-align: left;
  line-height: 1.4;
  white-space: normal;
}

/* Voice picker : noms longs type "Thomas (Amélioré) — Premium" */
.voice-option > div > div:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
