/*
  Well Woman · v2. Palette adoucie tirée du feed de Cat (turquoise ≈ #2BB5BF, teinte 186°).
  Pour ajuster toute la couleur de base : changer --h (teinte) et --s (saturation) ci-dessous.
*/
:root {
  --h: 186;
  --s: 34%;

  --teal: hsl(var(--h) var(--s) 34%);
  --teal-deep: hsl(var(--h) calc(var(--s) - 4%) 25%);
  --teal-soft: hsl(var(--h) calc(var(--s) - 8%) 85%);
  --teal-mist: hsl(var(--h) calc(var(--s) - 12%) 94%);
  --sand: hsl(34 46% 83%);
  --sand-soft: hsl(36 50% 93%);
  --sand-ink: hsl(28 38% 28%);
  --cream: hsl(38 48% 97%);
  --card: hsl(40 60% 99.5%);
  --ink: hsl(172 22% 16%);
  --muted: hsl(172 9% 34%);
  --line: hsl(38 22% 87%);
  --board: hsl(172 15% 21%);
  --board-line: hsl(172 10% 34%);
  --chalk: hsl(40 40% 95%);
  --chalk-muted: hsl(172 10% 78%);
  --focus: hsl(28 70% 42%);

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --radius: 24px;
  --radius-sm: 16px;
  --shadow: 0 1px 2px hsl(172 22% 16% / .04), 0 8px 24px hsl(172 22% 16% / .06);
  --nav-h: 68px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--cream); color: var(--ink);
  font: 400 17px/1.5 var(--sans); overflow-x: hidden; -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-weight: 750; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
p { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--teal-deep); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 10px; }
[hidden] { display: none !important; }
img { max-width: 100%; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; z-index: 50; }
.skip:focus { left: 8px; }

.app { max-width: 480px; margin: 0 auto; padding: 0 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; gap: 12px; padding: calc(12px + env(safe-area-inset-top)) 0 12px; }
.logo { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: #fff; flex: none; }
.wordmark { display: block; width: 150px; height: auto; }
main, main:focus, main:focus-visible { outline: none; }
main > * + * { margin-top: 16px; }
.foot { text-align: center; color: var(--muted); font-size: 16px; padding: 32px 8px 8px; }
.storage-note { background: var(--sand-soft); border: 1px solid var(--sand); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 12px; font-size: 16px; }

/* Navigation du bas : le padding de .app garantit qu'elle ne masque jamais le contenu */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: hsl(40 60% 99.5% / .96); border-top: 1px solid var(--line);
  padding: 4px max(4px, env(safe-area-inset-left)) calc(4px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-right));
  backdrop-filter: blur(10px);
}
.tabbar a {
  min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: 16px; line-height: 1.1; border-radius: 16px; min-width: 0;
}
.tabbar svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--teal-deep); font-weight: 700; }
.tabbar a[aria-current="page"] svg { background: var(--teal-soft); border-radius: 12px; width: 48px; padding: 0 12px; }
@media (min-width: 520px) { .tabbar { max-width: 480px; margin: 0 auto; border: 1px solid var(--line); border-bottom: 0; border-radius: 24px 24px 0 0; } }

/* Blocs */
.card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card.mist { background: var(--teal-mist); box-shadow: none; }
.eyebrow { font-size: 16px; font-weight: 700; color: var(--teal-deep); }
.muted { color: var(--muted); }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.example {
  display: inline-block; font: 650 16px/1.2 var(--sans); color: var(--sand-ink);
  background: var(--sand-soft); border-radius: 999px; padding: 3px 12px; white-space: nowrap; vertical-align: middle;
}
.note { font-size: 16px; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 22px; border-radius: 999px; border: 0;
  background: var(--teal); color: #fff; font-weight: 700; text-decoration: none; font-size: 17px;
}
.btn:hover { background: var(--teal-deep); }
.btn.ghost { background: var(--card); color: var(--teal-deep); border: 1.5px solid var(--teal-soft); }
.btn.ghost:hover { background: var(--teal-mist); }
.btn.block { width: 100%; }
.link-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; margin-top: 6px;
  background: none; border: 0; border-radius: 999px; color: var(--teal-deep); font-weight: 650; font-size: 16px; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--teal-soft);
}

/* Bandeau photo (ou dégradé teal doux si aucune photo) */
.photo {
  position: relative; overflow: hidden; border-radius: var(--radius); color: #fff;
  background: radial-gradient(120% 90% at 85% 10%, hsl(var(--h) calc(var(--s) - 6%) 36% / .9), transparent 60%),
              linear-gradient(160deg, hsl(var(--h) var(--s) 33%), hsl(var(--h) calc(var(--s) - 6%) 28%));
}
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo.has-img::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, hsl(var(--h) var(--s) 20% / .05) 30%, hsl(var(--h) var(--s) 18% / .72) 100%);
}
.photo > .txt { position: relative; z-index: 1; padding: 22px 20px; }
.photo h1, .photo h2 { color: #fff; }
.photo p { color: hsl(var(--h) 30% 94%); }
.hero { min-height: 196px; display: flex; align-items: flex-end; }
.hero h1 { font-size: 30px; line-height: 1.15; }
.hero .sub { font-size: 18px; margin-top: 8px; }
.prog-head { min-height: 132px; display: flex; align-items: flex-end; }
/* Sans photo, les en-têtes de programme restent clairs : un seul bloc teal plein par écran (le bandeau d'accueil) */
.prog-head:not(.has-img) { min-height: 0; background: var(--teal-soft); color: var(--ink); }
.prog-head:not(.has-img) h1, .prog-head:not(.has-img) h2 { color: var(--teal-deep); }
.prog-head:not(.has-img) p { color: var(--ink); }

/* Programmes */
.programs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; }
.programs::-webkit-scrollbar { display: none; }
.programs::after { content: ""; flex: 0 0 8px; }
.chip {
  flex: none; min-height: 44px; padding: 8px 18px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--card); color: var(--ink); font-size: 16px; font-weight: 600;
}
.chip[aria-pressed="true"] { background: var(--teal-deep); border-color: var(--teal-deep); color: #fff; }

/* Progression du programme : 12 traits doux */
.weeks12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 5px; margin-top: 14px; }
.weeks12 i { height: 10px; border-radius: 999px; background: var(--teal-soft); }
.weeks12 i.done { background: var(--teal); }
.weeks12 i.now { background: var(--sand); outline: 2px solid var(--teal); outline-offset: 1px; }
.big-num { font: 600 32px/1 var(--serif); color: var(--teal-deep); }

/* Carte du jour */
.today-card h2 { font-size: 24px; margin-top: 6px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 18px 0; }
.stats div + div { border-left: 1px solid var(--line); padding-left: 14px; }
.stats dt { font-size: 16px; color: var(--muted); }
.stats dd { margin: 4px 0 0; font-size: 20px; font-weight: 750; }
.stats dd small { font-size: 16px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.tag-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.short-tag { display: inline-block; font-size: 16px; font-weight: 650; color: var(--teal-deep); background: var(--teal-mist); border-radius: 999px; padding: 3px 12px; }
.done-badge { display: inline-flex; align-items: center; gap: 6px; color: var(--sand-ink); background: var(--sand-soft); border-radius: 999px; padding: 4px 12px; font-weight: 700; font-size: 16px; }

/* Semaine façon tableau de Cat : L-M-X-J-V-S-D, Calidad / Fuerza / Descanso */
/* 7 jours ≥ 44 px dès 360 px : le tableau déborde légèrement dans la marge */
.board { background: var(--board); color: var(--chalk); border-radius: var(--radius); padding: 18px 6px 16px; margin-left: -8px; margin-right: -8px; }
.board h2, .board .legend { padding: 0 10px; }
.board h2 { color: var(--chalk); font-size: 20px; }
.board .legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 4px; color: var(--chalk-muted); font-size: 16px; }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; margin-top: 14px; }
.day {
  min-height: 76px; min-width: 0; border-radius: 16px; border: 1.5px solid var(--board-line); background: transparent; color: var(--chalk);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px 0;
}
.day .l { font-weight: 750; font-size: 18px; }
.day .k { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; line-height: 1; }
.day.calidad .k { background: hsl(var(--h) 30% 62%); }
.day.fuerza .k { background: hsl(16 45% 72%); }
.day.suave .k { background: transparent; border: 2px solid hsl(var(--h) 30% 62%); }
.day.descanso .k { background: transparent; border: 2px dashed var(--board-line); }
.day.done { background: var(--sand); border-color: var(--sand); color: var(--sand-ink); }
.day.done .k { background: var(--sand-ink); color: var(--sand); border: 0; }
.day.today { border-color: var(--chalk); border-width: 2px; }
.day[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--chalk) inset; }
.day-detail { margin: 12px 4px 0; background: hsl(172 15% 26%); border-radius: var(--radius-sm); padding: 14px 16px; }
.day-detail p { color: var(--chalk-muted); font-size: 16px; }
.day-detail strong { color: var(--chalk); font-size: 18px; display: block; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.dot.calidad { background: hsl(var(--h) 30% 62%); }
.dot.fuerza { background: hsl(16 45% 72%); }
.dot.suave { border: 2px solid hsl(var(--h) 30% 62%); }
.dot.descanso { border: 2px dashed var(--chalk-muted); }

/* Listes simples */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .ic { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--teal-mist); color: var(--teal-deep); display: grid; place-items: center; }
.bubble { background: var(--teal-mist); border-radius: 20px 20px 20px 6px; padding: 14px 16px; }

/* Sesión : minuteur */
.player { text-align: center; }
.ring { position: relative; width: min(250px, 70vw); aspect-ratio: 1; margin: 8px auto 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { stroke: var(--teal-mist); }
.ring .bar { stroke: var(--teal); stroke-linecap: round; transition: stroke-dashoffset .25s linear; }
.ring .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring .time { font: 600 52px/1 var(--serif); font-variant-numeric: tabular-nums; color: var(--teal-deep); }
.ring .left { font-size: 16px; color: var(--muted); margin-top: 6px; }
.now-step { margin-top: 14px; }
.now-step .label { font-size: 16px; color: var(--muted); }
.now-step .step { font-size: 22px; font-weight: 750; }
.now-step .next { font-size: 16px; color: var(--muted); }
.controls { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.controls .btn { min-width: 130px; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.steps li { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.steps li:first-child { border-top: 0; }
.steps li::before {
  counter-increment: s; content: counter(s); flex: none; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; background: var(--teal-mist); color: var(--teal-deep); font-weight: 700; font-size: 16px;
}
.steps li.on::before { background: var(--teal); color: #fff; }
.steps li.past::before { content: "✓"; background: var(--sand); color: var(--sand-ink); }
.steps .s-txt { flex: 1; min-width: 0; }
.steps .s-name { font-weight: 700; }
.steps .s-how { font-size: 16px; color: var(--muted); }
.steps .d { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.finish { background: var(--sand-soft); border-radius: var(--radius-sm); padding: 18px; margin-top: 16px; text-align: center; }

/* Progreso */
.gauge { position: relative; width: 168px; aspect-ratio: 1; margin: 6px auto 0; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge .track { stroke: var(--teal-mist); }
.gauge .bar { stroke: var(--teal); stroke-linecap: round; }
.gauge .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.gauge .center b { font: 600 36px/1 var(--serif); color: var(--teal-deep); }
.gauge .center span { font-size: 16px; color: var(--muted); }
.wk-list { list-style: none; margin: 0; padding: 0; }
.wk-list li { display: grid; grid-template-columns: 104px minmax(0, 1fr) 48px; align-items: center; gap: 10px; min-height: 44px; }
.wk-list .w { font-weight: 650; }
.wk-list .bar { height: 12px; border-radius: 999px; background: var(--teal-mist); overflow: hidden; }
.wk-list .bar span { display: block; height: 100%; border-radius: 999px; background: var(--teal); }
.wk-list li.now .w { color: var(--teal-deep); }
.wk-list li.now .bar span { background: var(--teal-deep); }
.wk-list li.future { color: var(--muted); }
.wk-list .n { text-align: right; font-variant-numeric: tabular-nums; }
.kind { background: var(--sand-soft); border-radius: var(--radius); padding: 18px 20px; }
.kind p + p { margin-top: 6px; }

/* Check-in */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-weight: 700; padding: 0; margin-bottom: 8px; font-size: 18px; }
.q + .q { margin-top: 22px; }
.scale { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.scale input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.scale label {
  min-height: 52px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--card);
  display: grid; place-items: center; font-size: 18px; font-weight: 650; cursor: pointer;
}
.scale input:checked + label { background: var(--teal); color: #fff; border-color: var(--teal); }
.scale input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.scale-ends { display: flex; justify-content: space-between; font-size: 16px; color: var(--muted); margin-top: 4px; }
.saved-msg { color: var(--teal-deep); font-weight: 700; text-align: center; margin-top: 12px; min-height: 26px; }
.last { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 12px; text-align: center; }
.last div { background: var(--teal-mist); border-radius: var(--radius-sm); padding: 10px 2px; min-width: 0; }
.last b { display: block; font: 600 24px/1.1 var(--serif); color: var(--teal-deep); }
.last span { font-size: 16px; color: var(--muted); overflow-wrap: anywhere; }

.fade-in { animation: fade .25s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
