/* =========================================================
   Elenath • Body Lift & Sculpt — feuille de style
   Thème sombre sportif, pensé mobile d'abord
   ========================================================= */

:root {
  color-scheme: dark;

  /* Couleurs */
  --bg: #0d1014;
  --surface: #161b21;
  --surface-2: #1e252d;
  --line: #2a323c;
  --ink: #f2f5f7;
  --muted: #8d99a6;
  --accent: #750ada;
  --accent-ink: #ffffff;
  --hot: #2bff00;
  --warn: #ffb547;

  /* Typo */
  --font-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed",
    Impact, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Divers */
  --radius: 18px;
  --radius-sm: 12px;
  --tap: 48px; /* taille mini des zones tactiles */
  --timer-h: 84px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font-body);
  overscroll-behavior-y: none;
}

main {
  max-width: 680px;
  margin: 0 auto;
  padding: calc(12px + var(--safe-top)) 16px
    calc(var(--timer-h) + var(--safe-bottom) + 24px);
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1;
  margin: 0;
}

p {
  margin: 8px 0;
}

.muted {
  color: var(--muted);
}

.label {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  font-weight: 700;
  transition:
    transform 0.1s,
    background 0.15s;
}

.btn:active {
  transform: scale(0.96);
}

.btn--go {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-family: var(--font-display);
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 128px;
}

.btn--go.is-running {
  background: var(--hot);
  border-color: var(--hot);
  color: var(--bg);
}

.btn--icon {
  width: var(--tap);
  padding: 0;
}

.btn--icon svg {
  width: 22px;
  height: 22px;
}

.btn--danger {
  width: 100%;
  margin-top: 8px;
  color: var(--hot);
  border-color: color-mix(in srgb, var(--hot) 45%, transparent);
  background: transparent;
}

.btn--block {
  width: 100%;
  margin-top: 12px;
}

.btn--block.is-done {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 22px 20px 20px;
  border-radius: var(--radius);
  background:
    repeating-linear-gradient(
      -55deg,
      transparent 0 18px,
      rgba(255, 255, 255, 0.025) 18px 36px
    ),
    linear-gradient(135deg, #1b2a12 0%, #10161b 55%, #2a140c 100%);
  border: 1px solid var(--line);
}

.hero::after {
  /* barre diagonale "sport" */
  content: "";
  position: absolute;
  right: -40px;
  top: -20px;
  width: 140px;
  height: 260px;
  background: linear-gradient(var(--accent), var(--hot));
  transform: rotate(28deg);
  opacity: 0.16;
  pointer-events: none;
}

.hero__kicker {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero__title {
  font-size: clamp(40px, 12vw, 60px);
  font-weight: 800;
  font-style: italic;
  line-height: 0.9;
}

.hero__title span {
  color: var(--accent);
}

.hero__tagline {
  margin: 10px 0 18px;
  color: var(--muted);
  font-weight: 500;
}

.hero__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hero__stats li {
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
  text-align: center;
}

.hero__stats strong {
  display: block;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.hero__stats span {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---------- Cartes ---------- */
.card {
  margin: 14px 0;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}

/* ---------- Semaine + progression ---------- */
.week-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}

.week-card__percent {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  font-style: italic;
  color: var(--accent);
  line-height: 1;
}

.weeks {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

.weeks button {
  min-height: var(--tap);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-family: var(--font-display);
  padding: 0 2px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.weeks button small {
  font-family: var(--font-body);
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
}

.weeks button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.weeks button.active small {
  color: var(--accent-ink);
}

.week-card__note {
  margin: 12px 0;
  padding-left: 12px;
  border-left: 3px solid var(--hot);
  font-size: 14px;
  color: #c9d1d9;
}

.progress {
  height: 10px;
  margin-bottom: 6px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #7dff8a);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 60%, transparent);
}

/* ---------- Onglets séances (barre collante, défilante) ---------- */
.tabs {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  gap: 8px;
  margin: 0 -16px;
  padding: calc(10px + var(--safe-top)) 16px 8px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  background: linear-gradient(var(--bg) 85%, transparent);
  cursor: grab;
  /* Fondu sur les bords quand il reste des onglets à voir */
  --fade-l: 0px;
  --fade-r: 0px;
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 var(--fade-l),
    #000 calc(100% - var(--fade-r)),
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 var(--fade-l),
    #000 calc(100% - var(--fade-r)),
    transparent 100%
  );
}

.tabs.can-left {
  --fade-l: 28px;
}

.tabs.can-right {
  --fade-r: 40px;
}

.tabs.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
}

.tabs::-webkit-scrollbar {
  height: 4px;
}

.tabs::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 99px;
}

.tabs::-webkit-scrollbar-track {
  background: transparent;
}

.tab {
  flex: 0 0 auto;
  min-width: 132px;
  min-height: 60px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.tab__num {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  font-style: italic;
  line-height: 1;
}

.tab__name {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.tab.active .tab__name {
  color: var(--accent-ink);
}

/* ---------- Séance ---------- */
.session__head {
  padding: 6px 2px 4px;
}

.session__title {
  font-size: clamp(30px, 9vw, 40px);
  font-weight: 800;
  font-style: italic;
}

.session__sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 500;
}

.warmup {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 14px 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--hot) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--hot) 35%, transparent);
  font-size: 14px;
}

.warmup b {
  font-family: var(--font-display);
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--hot);
  white-space: nowrap;
}

/* Carte exercice */
.exercise {
  position: relative;
  margin: 10px 0;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  transition:
    border-color 0.2s,
    background 0.2s;
}

.exercise.is-complete {
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}

.exercise__top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.badge {
  flex: 0 0 auto;
  min-width: 42px;
  height: 42px;
  padding: 0 8px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

.badge--core {
  font-size: 13px;
  color: var(--hot);
}

.badge--superset {
  color: var(--accent);
}

.exercise.is-complete .badge {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.exercise__name {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 700;
  color: var(--hot);
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.25;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.chip {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 600;
  color: #c9d1d9;
}

.chip--kg {
  color: var(--accent);
}

/* Séries */
.sets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.set {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--surface-2);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  transition:
    transform 0.1s,
    background 0.15s,
    border-color 0.15s;
}

.set:active {
  transform: scale(0.9);
}

.set.done {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* Charge / notes */
.field {
  display: block;
  margin-top: 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  min-height: var(--tap);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg);
  font-size: 16px; /* évite le zoom auto sur iOS */
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.field input::placeholder {
  color: #5b6672;
}

/* Bloc cardio de fin */
.finisher {
  margin-top: 16px;
}

.finisher h3 {
  font-size: 22px;
  font-weight: 800;
  font-style: italic;
  margin-bottom: 6px;
}

.finisher h3 span {
  color: var(--hot);
}

.finisher p {
  color: #c9d1d9;
  font-size: 15px;
}

/* ---------- Infos repliables ---------- */
.info summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.info summary::-webkit-details-marker {
  display: none;
}

.info summary::after {
  content: "+";
  font-size: 26px;
  color: var(--accent);
  transition: transform 0.2s;
}

.info[open] summary::after {
  transform: rotate(45deg);
}

.info p {
  font-size: 15px;
  color: #c9d1d9;
}

.info .warning {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--warn) 10%, transparent);
  border-left: 3px solid var(--warn);
}

.planning {
  margin: 12px 0;
  padding: 0;
  list-style: none;
}

.planning li {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}

.planning b {
  width: 44px;
  font-family: var(--font-display);
  font-size: 18px;
  text-transform: uppercase;
  color: var(--accent);
}

.planning .rest b,
.planning .rest span {
  color: var(--muted);
}

.motto {
  margin: 24px 8px;
  text-align: center;
  font-family: var(--font-display);
  font-size: 18px;
  font-style: italic;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Chronomètre (barre fixe en bas) ---------- */
.timer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  background: rgba(13, 16, 20, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bottom);
}

.timer__bar {
  height: 4px;
  background: transparent;
}

.timer__bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--hot);
}

.timer__inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 10px 16px 12px;
}

.timer__main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.timer__display {
  flex: 1;
  min-width: 0;
  padding: 4px 8px 4px 0;
  border: 0;
  background: none;
  text-align: left;
  border-radius: var(--radius-sm);
}

.timer__display small {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

#timerlabel {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chev {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 10px;
  letter-spacing: 0;
  transition: transform 0.2s;
}

.timer.is-open .chev {
  transform: rotate(180deg);
}

.clock {
  display: block;
}

.clock {
  font-family: var(--font-display);
  font-size: 46px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.timer.is-running .clock {
  color: var(--hot);
}

.timer.is-ending .clock {
  color: var(--warn);
}

.timer.is-finished .clock {
  color: var(--warn);
}

.timer.is-finished .timer__bar span {
  background: var(--warn);
}

/* Fond sombre derrière le panneau ouvert */
.timer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9;
  background: rgba(0, 0, 0, 0.55);
}

/* Panneau de réglage */
.timer__panel {
  padding: 4px 0 14px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
  max-height: calc(100dvh - 140px - var(--safe-top) - var(--safe-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.btn--ghost {
  border-color: transparent;
  background: var(--surface-2);
}

.presets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.presets button {
  min-height: 64px;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.presets b {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
}

.presets small {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.presets button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.presets button.active small {
  color: var(--accent-ink);
}

.adjust {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.adjust .btn {
  border-radius: var(--radius-sm);
  font-size: 18px;
}

.adjust .btn:disabled {
  opacity: 0.35;
}

/* Interrupteurs */
.switch {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch__track {
  flex: 0 0 auto;
  position: relative;
  width: 50px;
  height: 30px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: background 0.2s;
}

.switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--muted);
  transition:
    transform 0.2s,
    background 0.2s;
}

.switch input:checked + .switch__track {
  background: var(--accent);
  border-color: var(--accent);
}

.switch input:checked + .switch__track::after {
  transform: translateX(20px);
  background: #fff;
}

.switch input:focus-visible + .switch__track {
  outline: 3px solid var(--hot);
  outline-offset: 2px;
}

.switch__text b {
  display: block;
  font-size: 15px;
}

.switch__text small {
  display: block;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
}

/* ---------- Sauvegarde ---------- */
.backup-actions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.backup-actions .btn {
  width: 100%;
}

.backup-msg {
  min-height: 1.5em;
  font-size: 14px;
  font-weight: 600;
  color: var(--hot);
}

.backup-msg.is-error {
  color: var(--warn);
}

/* ---------- Petits écrans ---------- */
@media (max-width: 360px) {
  main {
    padding-left: 12px;
    padding-right: 12px;
  }
  .tabs {
    margin: 0 -12px;
    padding-left: 12px;
    padding-right: 12px;
  }
  .weeks button {
    font-size: 19px;
  }
  .clock {
    font-size: 38px;
  }
  .btn--go {
    min-width: 108px;
  }
  .set {
    width: 48px;
    height: 48px;
  }
}

/* ---------- Écrans larges ---------- */
@media (min-width: 640px) {
  main {
    padding-top: calc(24px + var(--safe-top));
  }
  .hero {
    padding: 32px 28px;
  }
  .tabs {
    margin: 0;
    padding-left: 0;
    padding-right: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    overflow: visible;
    cursor: auto;
    -webkit-mask-image: none;
    mask-image: none;
  }
  .tab {
    min-width: 0;
  }
}

/* ---------- Animations ---------- */
@media (prefers-reduced-motion: no-preference) {
  .progress span {
    transition: width 0.35s ease-out;
  }
  .timer__bar span {
    transition: width 0.2s linear;
  }
  .timer.is-finished .clock {
    animation: pulse 0.6s ease-in-out 4;
  }
  .set.done {
    animation: pop 0.25s ease-out;
  }
}

@keyframes pulse {
  50% {
    transform: scale(1.08);
  }
}

@keyframes pop {
  50% {
    transform: scale(1.15);
  }
}
