:root {
  --bg: #0f172a;
  --card: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #f97316;
  --accent2: #34d399;
  --ok: #22c55e;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overscroll-behavior: none;
}

/* ---------- Feed vertical ---------- */
.feed {
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
  scrollbar-width: none;
}
.feed::-webkit-scrollbar { display: none; }

.screen {
  position: relative;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
}

/* ---------- Intro (2 sections) ---------- */
.intro {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-y: auto;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  scrollbar-width: none;
}
.intro::-webkit-scrollbar { display: none; }
.intro-inner { width: 100%; max-width: 420px; margin: auto 0; }

.date {
  color: var(--muted);
  font-size: 15px;
  text-transform: capitalize;
  text-align: center;
  margin-bottom: 18px;
}

.block { margin-bottom: 20px; }
.block-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.badge {
  flex: 0 0 auto;
  width: 46px; height: 46px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-size: 24px; font-weight: 800; color: #0b1220;
  background: var(--accent);
  box-shadow: 0 8px 22px -8px var(--accent);
}
.badge.alt { background: var(--accent2); box-shadow: 0 8px 22px -8px var(--accent2); }
.block-head h2 { margin: 0; font-size: 18px; font-weight: 800; }
.block-head p { margin: 1px 0 0; color: var(--muted); font-size: 13px; }

.preview { list-style: none; margin: 0; padding: 0; }
.preview li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 2px;
  border-bottom: 1px solid #1e293b;
  font-size: 14px;
}
.preview li span:last-child { color: var(--muted); white-space: nowrap; }

.start {
  width: 100%;
  margin-top: 6px;
  padding: 16px;
  border: 0; border-radius: 16px;
  background: var(--accent); color: #0b1220;
  font-size: 18px; font-weight: 800; cursor: pointer;
  box-shadow: 0 10px 26px -10px var(--accent);
}
.start:active { transform: translateY(1px); }
.hint { margin: 12px 0 0; color: var(--muted); font-size: 13px; text-align: center; }

/* ---------- Écran d'exercice ---------- */
.player {
  position: absolute; inset: 0;
  background: #000;
  display: grid; place-items: center;
  overflow: hidden;
}
/* Zoom : on rogne ~15 % de chaque côté pour agrandir l'image (hauteur ↑). */
.player > * { grid-area: 1 / 1; width: 143%; aspect-ratio: 16 / 9; border: 0; }
.poster {
  background: #000 center/cover no-repeat;
  display: grid; place-items: center; cursor: pointer;
}
.poster .play {
  width: 68px; height: 68px; border-radius: 50%;
  background: #000000ab; color: #fff;
  display: grid; place-items: center;
}
.poster .play svg { width: 30px; height: 30px; margin-left: 4px; }

.overlay-top, .overlay-bottom {
  position: absolute; left: 0; right: 0;
  padding: 16px;
  pointer-events: none;
  z-index: 3;
}
.overlay-top {
  top: 0;
  padding-top: max(16px, env(safe-area-inset-top));
  display: flex; justify-content: space-between; gap: 10px;
  background: linear-gradient(180deg, #000000cc, #0000);
}
.overlay-bottom {
  bottom: 0;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: stretch;
  background: linear-gradient(0deg, #000000ec 62%, #0000);
}
.pill {
  pointer-events: auto;
  background: #00000073; backdrop-filter: blur(6px);
  border-radius: 999px; padding: 6px 12px;
  font-size: 13px; font-weight: 700;
}

/* Chrono (exercices en secondes), en haut à droite */
.chrono {
  display: inline-flex; align-items: center; gap: 7px;
  color: #fff; cursor: pointer; border: 0;
  font-variant-numeric: tabular-nums;
}
.chrono .tdot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.chrono.running { background: var(--accent); color: #0b1220; }
.chrono.running .tdot { background: #0b1220; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* Compteur de séries, centré en bas (cliquable → décrémente jusqu'à 0) */
.reps-badge {
  pointer-events: auto;
  align-self: center;
  margin: 16px 0 0;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 18px 8px 8px;
  border: 0; border-radius: 999px;
  background: #000000ad; backdrop-filter: blur(8px);
  color: #fff; cursor: pointer;
}
.reps-badge:active { transform: scale(.97); }
.rb-count {
  flex: 0 0 auto;
  min-width: 46px; height: 46px; padding: 0 6px;
  border-radius: 50%;
  background: var(--accent); color: #0b1220;
  display: grid; place-items: center;
  font-size: 22px; font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.rb-scheme { display: flex; flex-direction: column; text-align: left; font-size: 19px; font-weight: 800; line-height: 1.1; }
.rb-scheme small { margin-top: 2px; font-size: 12px; font-weight: 600; color: #cbd5e1; }
.reps-badge.done { background: var(--ok); color: #052e13; }
.reps-badge.done .rb-count { background: #052e13; color: var(--ok); }
.reps-badge.done .rb-scheme small { color: #052e13cc; }

.ex-head { width: 100%; pointer-events: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ex-name { margin: 0; flex: 1; min-width: 0; font-size: 22px; font-weight: 800; line-height: 1.15; }
.weight {
  flex: 0 0 auto; margin-top: 2px;
  color: var(--accent); font-weight: 800; font-size: 14px;
  background: #f973161f; border: 1px solid #f9731640;
  padding: 5px 11px; border-radius: 999px; white-space: nowrap;
}

/* ---------- Écran de fin ---------- */
.congrats {
  display: flex; justify-content: center; align-items: center; text-align: center;
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  background: var(--bg);
}
.section-inner { width: 100%; max-width: 320px; }
.emoji { font-size: 64px; }
.congrats h1 { margin: 10px 0 6px; font-size: 30px; font-weight: 800; }
.congrats p { margin: 0 0 24px; color: var(--muted); font-size: 16px; }

/* ---------- Rail de progression ---------- */
.rail {
  position: fixed; right: 10px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 9px; z-index: 5;
}
.rail.hidden { display: none; }
.rdot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #ffffff40; border: 0; padding: 0; cursor: pointer;
  transition: transform .15s, background .15s;
}
.rdot.active { background: var(--accent); transform: scale(1.6); }
