/* RepForge — feuille de style unique.
   Sombre par défaut, clair disponible. Contraste élevé : l'app se lit dans une salle
   mal éclairée, écran plein de sueur, avec le pouce. */

:root {
  --bg: #0A0C12;
  --bg-2: #0E1119;
  --surface: #141824;
  --surface-2: #1C2231;
  --surface-3: #262E40;
  --line: rgba(255, 255, 255, .075);
  --line-strong: rgba(255, 255, 255, .16);
  --sheen: rgba(255, 255, 255, .045);
  --text: #F2F5FA;
  --muted: #98A4B8;
  --faint: #6A788F;
  --accent: #FF6A2C;
  --accent-2: #FFA23A;
  --accent-ink: #FF8145;
  --accent-soft: rgba(255, 106, 44, .14);
  --ok: #3DDC97;
  --warn: #FFC23D;
  --danger: #FF6B6B;
  --t-strength: #FFB020;
  --t-wod: #FF5C6E;
  --t-accessory: #B48CFF;
  --t-gym: #3DDC97;
  --t-run: #45B7FF;
  --t-mobility: #8FA0BF;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 24px 60px rgba(0, 0, 0, .55);
  --card-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 12px 30px rgba(0, 0, 0, .28);
  --mesh:
    radial-gradient(1100px 520px at 12% -12%, rgba(255, 106, 44, .16), transparent 62%),
    radial-gradient(900px 500px at 92% 6%, rgba(69, 183, 255, .10), transparent 60%),
    radial-gradient(1000px 700px at 50% 108%, rgba(180, 140, 255, .09), transparent 65%);
  --nav-h: 66px;
  --nav-gap: 10px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #F6F7FB;
  --bg-2: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F2F4F9;
  --surface-3: #E7EBF3;
  --line: rgba(16, 22, 38, .09);
  --line-strong: rgba(16, 22, 38, .2);
  --sheen: rgba(255, 255, 255, .8);
  --text: #101626;
  --muted: #5B687D;
  --faint: #8593A8;
  --accent: #E64B12;
  --accent-2: #F5821F;
  --accent-ink: #D6440F;
  --accent-soft: rgba(230, 75, 18, .10);
  --ok: #0E9E6B;
  --warn: #B87A05;
  --danger: #DC3A3A;
  --t-strength: #C77E06;
  --t-wod: #DE3A4C;
  --t-accessory: #7A4FE0;
  --t-gym: #0E9E6B;
  --t-run: #0D82CC;
  --t-mobility: #64748B;
  --shadow: 0 24px 55px rgba(23, 32, 51, .14);
  --card-shadow: 0 1px 2px rgba(23, 32, 51, .04), 0 10px 26px rgba(23, 32, 51, .07);
  --mesh:
    radial-gradient(1100px 520px at 12% -12%, rgba(230, 75, 18, .09), transparent 62%),
    radial-gradient(900px 500px at 92% 6%, rgba(13, 130, 204, .07), transparent 60%),
    radial-gradient(1000px 700px at 50% 108%, rgba(122, 79, 224, .06), transparent 65%);
  color-scheme: light;
}

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

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--mesh), linear-gradient(180deg, var(--bg-2), var(--bg) 40%);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  letter-spacing: -.006em;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  /* La barre de navigation flotte : le contenu s'arrête au-dessus d'elle. */
  padding-bottom: calc(var(--nav-h) + var(--nav-gap) + 22px + var(--safe-b));
}

a { color: var(--accent-ink); text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.15; font-weight: 760; letter-spacing: -.035em; }
h1 { font-size: 1.62rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; letter-spacing: -.025em; }
p { margin: 0 0 .8em; }
small { font-size: .8rem; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -.04em; }

/* ---------- icônes ---------- */

.ic {
  width: 20px; height: 20px; flex: none; display: block;
  stroke: currentColor; fill: none;
  stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
}
.ichip {
  width: 38px; height: 38px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px; color: var(--t, var(--accent));
  background: color-mix(in srgb, var(--t, var(--accent)) 15%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--t, var(--accent)) 22%, transparent);
}
.ichip.lg { width: 46px; height: 46px; border-radius: 15px; }
.ichip.lg .ic { width: 24px; height: 24px; }
.ichip.sm { width: 28px; height: 28px; border-radius: 9px; }
.ichip.sm .ic { width: 16px; height: 16px; stroke-width: 2.1; }

/* ---------- mise en page ---------- */

.wrap { max-width: 720px; margin: 0 auto; padding: 16px 16px 28px; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  min-height: 60px;
  padding: calc(9px + var(--safe-t)) 16px 9px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(170%) blur(20px);
  -webkit-backdrop-filter: saturate(170%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.topbar .ttl { font-size: 1.2rem; font-weight: 790; line-height: 1.15; letter-spacing: -.04em; }
.topbar .sub { color: var(--muted); font-size: .76rem; font-weight: 550; }
#topBack { min-height: 36px; width: 36px; padding: 0; font-size: 1.5rem; line-height: 1; border-radius: 12px; }

.card {
  position: relative;
  background: linear-gradient(158deg, var(--sheen), transparent 42%), var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px;
  box-shadow: var(--card-shadow);
}
.card.tight { padding: 13px 14px; }
.card h2, .card h3 { margin-bottom: .5em; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap-r { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.center { text-align: center; }
.stack > * + * { margin-top: 10px; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }

.sec { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 24px 2px 11px; }
.sec h2 { margin: 0; font-size: 1.1rem; }
.sec .hint { color: var(--faint); font-size: .75rem; font-weight: 600; letter-spacing: .01em; }

/* ---------- carte d'en-tête « aujourd'hui » ---------- */

.hero-card {
  position: relative; overflow: hidden;
  border-radius: 24px; padding: 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--line));
  background:
    radial-gradient(420px 200px at 100% 0%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 70%),
    linear-gradient(155deg, color-mix(in srgb, var(--accent) 13%, var(--surface)), var(--surface) 62%);
  box-shadow: 0 16px 40px rgba(255, 106, 44, .12), var(--card-shadow);
  margin-bottom: 14px;
}
.hero-card .eyebrow { font-size: .68rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; color: var(--accent-ink); }
.hero-card .big { font-size: 1.55rem; font-weight: 800; letter-spacing: -.04em; margin: 3px 0 2px; text-transform: capitalize; }
.hero-card .say { color: var(--muted); font-size: .87rem; line-height: 1.4; }
.hero-card .ring { position: relative; width: 68px; height: 68px; flex: none; }
.hero-card .ring svg { width: 68px; height: 68px; transform: rotate(-90deg); }
.hero-card .ring .bgc { stroke: var(--surface-3); }
.hero-card .ring .fgc { stroke: url(#rfgrad); stroke-linecap: round; }
.hero-card .ring b {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; line-height: 1;
  font-size: 1.25rem; font-weight: 820; letter-spacing: -.04em;
}
.hero-card .ring b span {
  font-size: .46rem; font-weight: 750; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted); margin-top: 3px;
}

/* ---------- navigation ---------- */

.nav {
  position: fixed; z-index: 50;
  left: 10px; right: 10px; bottom: calc(var(--nav-gap) + var(--safe-b));
  display: flex; height: var(--nav-h); padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  box-shadow: 0 16px 44px rgba(0, 0, 0, .38), 0 1px 0 var(--sheen) inset;
  backdrop-filter: saturate(180%) blur(26px);
  -webkit-backdrop-filter: saturate(180%) blur(26px);
}
.nav a {
  position: relative; flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; border-radius: 19px;
  color: var(--faint); font-size: .61rem; font-weight: 700; letter-spacing: .005em;
  transition: color .18s ease, background .18s ease;
}
.nav a svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.95; stroke-linecap: round; stroke-linejoin: round; }
.nav a.on {
  color: #fff;
  background: linear-gradient(150deg, var(--accent-2), var(--accent));
  box-shadow: 0 6px 16px rgba(255, 106, 44, .34);
}
html[data-theme="light"] .nav a.on { color: #fff; }

/* ---------- contrôles ---------- */

button, .btn {
  font: inherit; font-weight: 700; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  border-radius: 15px; padding: 12px 15px; min-height: 48px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .12s ease, filter .12s ease, background .12s ease;
}
button:active, .btn:active { transform: scale(.97); filter: brightness(.94); }
.btn-primary {
  color: #fff; border-color: transparent;
  background: linear-gradient(140deg, var(--accent-2), var(--accent));
  box-shadow: 0 10px 26px rgba(255, 106, 44, .3), inset 0 1px rgba(255, 255, 255, .26);
}
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 38%, transparent); background: transparent; }
.btn-sm { min-height: 38px; padding: 7px 13px; font-size: .82rem; border-radius: 12px; }
.btn-sm .ic { width: 16px; height: 16px; }
.btn-icon { width: 38px; min-height: 38px; padding: 0; border-radius: 12px; }
.btn-block { width: 100%; }
button[disabled] { opacity: .45; pointer-events: none; }

input, select, textarea {
  font: inherit; width: 100%; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 15px;
  padding: 12px 14px; min-height: 50px;
  box-shadow: inset 0 1px rgba(255, 255, 255, .025);
}
textarea { min-height: 82px; resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 65%, transparent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 19px) 23px, calc(100% - 14px) 23px;
  background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px;
}
label.field { display: block; margin-bottom: 11px; }
label.field > span {
  display: block; margin: 0 0 7px 3px;
  font-size: .73rem; font-weight: 700; letter-spacing: .02em; color: var(--muted);
}
.field-row { display: flex; gap: 9px; }
.field-row > * { flex: 1; }
input[type="checkbox"], input[type="radio"] {
  width: auto; min-height: 0; padding: 0; box-shadow: none;
  accent-color: var(--accent); transform: scale(1.15);
}
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  border-radius: 999px; padding: 9px 15px; font-size: .82rem; font-weight: 680; min-height: 0;
}
.chip.on {
  background: var(--accent-soft); border-color: transparent; color: var(--accent-ink);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 52%, transparent);
}
.chip.sm { padding: 5px 11px; font-size: .74rem; }

/* échelle RPE : une seule tape */
.rpe { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.rpe button {
  min-height: 46px; padding: 0; border-radius: 12px; font-size: .85rem; font-weight: 780;
  background: var(--surface-2); color: var(--muted);
}
.rpe button.on { color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(0, 0, 0, .3); }
.rpe button.on[data-v="1"], .rpe button.on[data-v="2"], .rpe button.on[data-v="3"] { background: linear-gradient(150deg, #4BD8A0, #24A876); }
.rpe button.on[data-v="4"], .rpe button.on[data-v="5"], .rpe button.on[data-v="6"] { background: linear-gradient(150deg, #5FBEF5, #2E85C9); }
.rpe button.on[data-v="7"], .rpe button.on[data-v="8"] { background: linear-gradient(150deg, #FFC152, #E08A18); }
.rpe button.on[data-v="9"], .rpe button.on[data-v="10"] { background: linear-gradient(150deg, #FF8080, #DB3A3A); }

/* ---------- blocs typés ---------- */

.t-strength { --t: var(--t-strength); }
.t-wod { --t: var(--t-wod); }
.t-accessory { --t: var(--t-accessory); }
.t-gym { --t: var(--t-gym); }
.t-run { --t: var(--t-run); }
.t-mobility { --t: var(--t-mobility); }

.block-card {
  position: relative; overflow: hidden;
  border-color: color-mix(in srgb, var(--t) 18%, var(--line));
  background:
    radial-gradient(320px 140px at 0% 0%, color-mix(in srgb, var(--t) 11%, transparent), transparent 70%),
    linear-gradient(158deg, var(--sheen), transparent 42%), var(--surface);
}
.block-card .b-title { font-size: 1.04rem; font-weight: 740; letter-spacing: -.025em; }
.block-card .b-body { color: var(--muted); font-size: .88rem; margin-top: 2px; }
.block-card .b-foot {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line);
}
.block-card .b-foot .spacer { flex: 1; }

.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--t, var(--muted)); flex: none; }
.tag-type { color: var(--t, var(--muted)); font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; }

.type-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.type-grid button {
  position: relative; overflow: hidden;
  flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 8px;
  min-height: 104px; padding: 14px; text-align: left;
  border-color: color-mix(in srgb, var(--t) 16%, var(--line));
  background:
    radial-gradient(240px 120px at 100% 0%, color-mix(in srgb, var(--t) 13%, transparent), transparent 72%),
    linear-gradient(158deg, var(--sheen), transparent 45%), var(--surface);
}
.type-grid button b { font-size: 1rem; letter-spacing: -.025em; display: block; }
/* `:not(.ichip)` est indispensable : la pastille est elle aussi un <span>, et une règle
   descendante lui écraserait display:inline-flex — l'icône se décalerait dans son carré. */
.type-grid button > span:not(.ichip) { font-size: .73rem; color: var(--muted); font-weight: 500; line-height: 1.25; display: block; }

/* ---------- séries ---------- */

.sets { display: flex; flex-direction: column; gap: 7px; }
.set-row { display: grid; grid-template-columns: 24px 1fr 1fr 50px; gap: 7px; align-items: center; }
.set-row .idx { color: var(--faint); font-size: .8rem; font-weight: 780; text-align: center; }
.set-row input { min-height: 50px; text-align: center; font-weight: 750; padding: 8px 4px; font-size: 1.05rem; }
.set-row .tick { min-height: 50px; padding: 0; border-radius: 13px; background: var(--surface-2); color: var(--faint); }
.set-row .tick .ic { width: 18px; height: 18px; stroke-width: 2.6; }
.set-row .tick.on { background: color-mix(in srgb, var(--ok) 17%, transparent); border-color: color-mix(in srgb, var(--ok) 48%, transparent); color: var(--ok); }
.set-row.done input { border-color: color-mix(in srgb, var(--ok) 26%, transparent); }

/* ---------- chrono ---------- */

.timer-face {
  font-variant-numeric: tabular-nums; font-weight: 820; letter-spacing: -.045em;
  font-size: clamp(3.4rem, 19vw, 5.2rem); text-align: center; line-height: 1; margin: 8px 0 2px;
  background: linear-gradient(150deg, var(--text), color-mix(in srgb, var(--text) 55%, var(--muted)));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.timer-face.warn { background: none; color: var(--warn); }
.timer-face.over { background: none; color: var(--danger); }
.timer-sub { text-align: center; color: var(--muted); font-size: .85rem; margin-bottom: 14px; }
.timer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

/* ---------- listes ---------- */

.list { display: flex; flex-direction: column; gap: 8px; }
.item {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px;
  background: linear-gradient(158deg, var(--sheen), transparent 45%), var(--surface);
  border: 1px solid var(--line); border-radius: 16px;
  width: 100%; text-align: left; min-height: 0; font-weight: 500;
  box-shadow: var(--card-shadow);
}
.item b { font-weight: 720; letter-spacing: -.02em; }
.item .meta { color: var(--muted); font-size: .8rem; margin-top: 1px; }
.item .right { margin-left: auto; text-align: right; color: var(--muted); font-size: .82rem; flex: none; }
.item .chev { color: var(--faint); flex: none; font-size: 1.05rem; margin-left: 2px; }
.day-head { display: flex; align-items: baseline; gap: 8px; margin: 22px 2px 10px; }
.day-head h3 { margin: 0; text-transform: capitalize; }
.day-head .d { color: var(--faint); font-size: .78rem; }

/* ---------- statistiques ---------- */

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.kpi {
  background: linear-gradient(158deg, var(--sheen), transparent 45%), var(--surface);
  border: 1px solid var(--line); border-radius: 17px; padding: 14px 9px; text-align: center;
  box-shadow: var(--card-shadow);
}
.kpi .ichip { margin: 0 auto 8px; }
.kpi b {
  display: block; font-size: 1.55rem; font-weight: 800;
  font-variant-numeric: tabular-nums; letter-spacing: -.045em; line-height: 1.05;
}
.kpi > span:not(.ichip) { display: block; font-size: .6rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-top: 5px; font-weight: 700; }

.chart-card {
  background: linear-gradient(158deg, var(--sheen), transparent 42%), var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 17px 14px 13px; margin-bottom: 12px; box-shadow: var(--card-shadow);
}
.chart-card h3 { margin: 0 0 3px; padding: 0 2px; }
.chart-read { font-size: .82rem; color: var(--muted); margin: 0 2px 13px; line-height: 1.4; }
.chart-read b { color: var(--text); font-weight: 720; }
.chart-host { position: relative; touch-action: pan-y; }
.chart-host svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-host svg .grid { stroke: var(--line); stroke-width: 1; }
.chart-host svg .axis { fill: var(--faint); font-size: 10px; font-weight: 600; }
.chart-host svg .ser { fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.chart-host svg .dot-p { stroke: var(--surface); stroke-width: 2; }
.chart-host svg path.anim { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw .7s ease-out forwards; }
.chart-host svg .barz { animation: rise .5s cubic-bezier(.2, .8, .3, 1) backwards; transform-origin: bottom; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes rise { from { transform: scaleY(0); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .chart-host svg path.anim { animation: none; stroke-dashoffset: 0; }
  .chart-host svg .barz { animation: none; }
  .sheet, .pr-card, .toast { animation: none !important; }
}
.tip {
  position: absolute; pointer-events: none; z-index: 5; transform: translate(-50%, -115%);
  background: var(--surface-3); border: 1px solid var(--line-strong); border-radius: 11px;
  padding: 7px 11px; font-size: .76rem; font-weight: 680; white-space: nowrap; box-shadow: var(--shadow);
}
.legend { display: flex; flex-wrap: wrap; gap: 9px 14px; margin-top: 11px; padding: 0 2px; font-size: .73rem; color: var(--muted); font-weight: 600; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: baseline; }
.seg { display: flex; gap: 4px; background: var(--surface-2); border-radius: 13px; padding: 3px; }
.seg button { flex: 1; min-height: 34px; padding: 4px 8px; font-size: .78rem; border: 0; background: transparent; color: var(--muted); border-radius: 10px; box-shadow: none; }
.seg button.on { background: var(--surface-3); color: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }

/* Heatmap : 53 colonnes qui se partagent la largeur, une ligne par jour de semaine. */
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); grid-auto-columns: minmax(0, 1fr); gap: 2px; }
.heat i { aspect-ratio: 1; border-radius: 2px; background: var(--surface-2); display: block; min-width: 0; }
.heat i[data-l="1"] { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.heat i[data-l="2"] { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.heat i[data-l="3"] { background: color-mix(in srgb, var(--accent) 78%, transparent); }
.heat i[data-l="4"] { background: var(--accent); box-shadow: 0 0 6px color-mix(in srgb, var(--accent) 45%, transparent); }
.heat-scale { display: flex; align-items: center; gap: 4px; justify-content: flex-end; margin-top: 10px; font-size: .68rem; color: var(--faint); font-weight: 600; }
.heat-scale i { width: 9px; height: 9px; border-radius: 2px; display: block; }

/* ---------- grille de niveau ---------- */

.grid-lvl { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 8px; }
.grid-lvl div { padding: 9px 3px; text-align: center; background: var(--surface-2); border-radius: 11px; font-size: .63rem; color: var(--muted); font-weight: 650; }
.grid-lvl div b { display: block; font-size: .82rem; color: var(--text); font-variant-numeric: tabular-nums; margin-top: 3px; font-weight: 780; }
.grid-lvl div.on { background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, transparent); }
.grid-lvl div.on b { color: var(--accent-ink); }

/* ---------- overlays ---------- */

.sheet-bg { position: fixed; inset: 0; z-index: 90; background: rgba(4, 6, 11, .68); backdrop-filter: blur(7px); animation: fade .18s ease; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 91;
  max-height: 94dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 92%, white 8%), var(--surface) 22%);
  border: 1px solid var(--line-strong); border-bottom: 0;
  border-radius: 28px 28px 0 0;
  padding: 8px 16px calc(20px + var(--safe-b));
  box-shadow: 0 -28px 90px rgba(0, 0, 0, .5);
  animation: up .24s cubic-bezier(.2, .9, .3, 1);
  max-width: 720px; margin: 0 auto;
}
/* Toute feuille se referme : poignée au centre, croix à droite, toujours atteignable au pouce. */
.sheet-head { position: relative; display: flex; align-items: center; justify-content: center; height: 38px; margin-bottom: 8px; }
.sheet-head .handle { width: 42px; height: 5px; border-radius: 3px; background: var(--surface-3); }
.sheet-close {
  position: absolute; right: -4px; top: -1px;
  width: 40px; min-height: 40px; padding: 0; border-radius: 13px;
  background: var(--surface-2); border-color: var(--line); color: var(--muted);
}
.sheet-close .ic { width: 19px; height: 19px; stroke-width: 2.2; }
.sheet h2 { margin-bottom: .6em; padding-right: 44px; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--nav-gap) + 14px + var(--safe-b));
  transform: translateX(-50%); z-index: 95;
  background: var(--surface-3); border: 1px solid var(--line-strong); color: var(--text);
  padding: 12px 18px; border-radius: 15px; font-size: .86rem; font-weight: 680;
  box-shadow: var(--shadow); animation: fade .2s ease; max-width: 88vw; text-align: center;
}
.toast.ok { border-color: color-mix(in srgb, var(--ok) 55%, transparent); }
.toast.err { border-color: color-mix(in srgb, var(--danger) 55%, transparent); }

/* célébration de PR */
.pr-pop { position: fixed; inset: 0; z-index: 99; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(4, 6, 11, .74); backdrop-filter: blur(5px); animation: fade .2s ease; }
.pr-card {
  position: relative; overflow: hidden;
  background:
    radial-gradient(420px 220px at 50% -20%, color-mix(in srgb, var(--accent) 40%, transparent), transparent 70%),
    linear-gradient(160deg, color-mix(in srgb, var(--surface) 88%, var(--accent) 12%), var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 28px; padding: 30px 24px; text-align: center; max-width: 340px; width: 100%;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .55), 0 0 60px rgba(255, 106, 44, .18);
  animation: pop .45s cubic-bezier(.2, 1.5, .4, 1);
}
.pr-card .ichip { margin: 0 auto 12px; --t: var(--accent); }
.pr-card .kicker { font-size: .68rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--accent-ink); }
.pr-card .big { font-size: 2.8rem; font-weight: 840; letter-spacing: -.05em; margin-top: 6px; line-height: 1; }
.pr-card h2 { margin: 8px 0 2px; font-size: 1.15rem; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.confetti { position: fixed; inset: 0; z-index: 98; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; width: 8px; height: 13px; border-radius: 2px; opacity: .95; animation: fall 1.6s ease-in forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(560deg); opacity: 0; } }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 8px; font-size: .68rem; font-weight: 780; background: var(--surface-3); color: var(--muted); }
.badge .ic { width: 13px; height: 13px; stroke-width: 2.3; }
.badge.pr { background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 32%, transparent); }
.badge.rx { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.badge.late { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }

.bar-progress { height: 9px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.bar-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: 6px; transition: width .5s ease; box-shadow: 0 0 12px rgba(255, 106, 44, .35); }

.banner { border-radius: var(--radius-sm); padding: 13px 15px; font-size: .85rem; line-height: 1.45; border: 1px solid; margin-bottom: 12px; }
.banner.warn { background: color-mix(in srgb, var(--warn) 9%, transparent); border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn); }
.banner.info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 28%, transparent); }
.banner.danger { background: color-mix(in srgb, var(--danger) 9%, transparent); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--danger); }

.empty { text-align: center; padding: 42px 18px; color: var(--muted); }
.empty > svg { width: 46px; height: 46px; stroke: var(--faint); fill: none; stroke-width: 1.4; margin-bottom: 12px; }
.empty .ichip { margin: 0 auto 14px; --t: var(--accent); }

.fab {
  position: fixed; right: 18px; bottom: calc(var(--nav-h) + var(--nav-gap) + 14px + var(--safe-b)); z-index: 45;
  width: 60px; height: 60px; border-radius: 50%; color: #fff;
  background: linear-gradient(140deg, var(--accent-2), var(--accent));
  border: 1px solid rgba(255, 255, 255, .2);
  box-shadow: 0 14px 34px rgba(255, 106, 44, .42); font-size: 1.7rem; padding: 0;
}

/* ---------- page d'accueil publique ---------- */

.hero { padding: 46px 2px 18px; }
.hero .logo {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 9px 16px 9px 10px; margin-bottom: 26px;
  border: 1px solid var(--line); border-radius: 999px;
  background: linear-gradient(158deg, var(--sheen), transparent 45%), var(--surface);
  box-shadow: var(--card-shadow);
  font-weight: 820; font-size: 1rem; letter-spacing: -.03em;
}
.hero .logo .ichip { --t: var(--accent); width: 30px; height: 30px; border-radius: 10px; }
.hero .logo .ichip .ic { width: 17px; height: 17px; }
.hero .logo em { color: var(--accent-ink); font-style: normal; }
.hero h1 { max-width: 12ch; font-size: clamp(2.35rem, 10.5vw, 4.1rem); line-height: .98; letter-spacing: -.055em; margin-bottom: 18px; }
.hero h1 .grad {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { max-width: 50ch; font-size: 1.05rem; line-height: 1.55; color: var(--muted); }
.features { display: grid; gap: 10px; grid-template-columns: 1fr; margin: 22px 0; }
.feature {
  background: linear-gradient(158deg, var(--sheen), transparent 45%), var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--card-shadow);
}
.feature .ichip { margin-bottom: 12px; }
.feature b { display: block; margin-bottom: 6px; font-size: 1rem; letter-spacing: -.025em; }
.feature > span:not(.ichip) { color: var(--muted); font-size: .87rem; line-height: 1.5; }
#authCard { padding: 20px; box-shadow: var(--shadow); }
.auth-tabs { display: flex; gap: 4px; background: var(--surface-2); border-radius: 15px; padding: 4px; margin-bottom: 16px; }
.auth-tabs button { flex: 1; border: 0; background: transparent; color: var(--muted); min-height: 42px; border-radius: 11px; font-size: .8rem; padding: 6px 4px; white-space: nowrap; box-shadow: none; }
.auth-tabs button.on { background: var(--surface); color: var(--text); box-shadow: var(--card-shadow); }

footer.site { border-top: 1px solid var(--line); margin-top: 30px; padding-top: 18px; color: var(--faint); font-size: .8rem; }

/* ---------- structure d'un WOD ---------- */

.wod-line {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 11px 12px;
  margin-bottom: 9px;
}
.wod-line .idx { width: 22px; flex: none; text-align: center; color: var(--faint); font-size: .8rem; font-weight: 780; }
.wod-line .lmv {
  justify-content: flex-start; text-align: left;
  min-height: 42px; padding: 8px 12px; border-radius: 12px;
  background: var(--surface); font-weight: 600;
}
.wod-line .lmv b { font-weight: 720; letter-spacing: -.02em; }
.wod-line label.field { margin-bottom: 0; }
.wod-line label.field > span { font-size: .65rem; margin: 0 0 4px 2px; }
.wod-line input { min-height: 42px; padding: 8px 8px; font-size: .92rem; text-align: center; font-weight: 720; }

/* Résultat passage par passage : une ligne par station, une case par tour.
   La rangée défile plutôt que de se replier — les valeurs restent comparables entre elles. */
.iv-row { margin-bottom: 11px; }
.iv-name { display: block; font-size: .77rem; font-weight: 720; color: var(--muted); margin: 0 0 5px 3px; }
.iv-cells { display: flex; gap: 5px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: thin; }
.ivcell {
  width: 54px; flex: none; min-height: 44px; padding: 6px 2px;
  text-align: center; font-weight: 760; font-size: .95rem;
  font-variant-numeric: tabular-nums; border-radius: 12px;
}

.badge.kcal { background: color-mix(in srgb, var(--t-wod) 15%, transparent); color: var(--t-wod); }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .88em; padding: 1px 5px; border-radius: 6px;
  background: var(--surface-3); color: var(--text);
}

@media (min-width: 620px) {
  .wrap { padding-left: 22px; padding-right: 22px; }
  .features { grid-template-columns: 1fr 1fr; }
  .type-grid { grid-template-columns: repeat(3, 1fr); }
  .nav { left: 50%; right: auto; width: min(560px, calc(100% - 24px)); transform: translateX(-50%); }
}
