/* Palier 12 — salle de sport : sol bleu terrain, plots jaunes, lignes rouges. */

@font-face {
  font-family: 'Archivo';
  src: url('/assets/fonts/archivo-wdth.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --floor: #EDF1F5;
  --card: #FFFFFF;
  --ink: #13202F;
  --muted: #586A7F;
  --line: #D4DDE7;
  --court: #16396A;
  --court-ink: #FFFFFF;
  --court-soft: #E2EAF4;
  --cone: #F2B300;
  --cone-ink: #2E2300;
  --cone-soft: #FFF2C7;
  --mark: #C42F3B;
  --mark-soft: #FBE6E8;
  --chart: #2A5FA6;
  --chart-ref: #A87400;
  --strava: #FC4C02;

  --gut: 16px;
  --tabbar: 62px;
  --r-s: 6px;
  --r-m: 12px;
  --narrow: 62%;
  --cond: 75%;
}

@media (prefers-color-scheme: dark) {
  :root {
    --floor: #0B1726;
    --card: #12233A;
    --ink: #E6EDF5;
    --muted: #97A7BB;
    --line: #233850;
    --court: #A8C5EE;
    --court-ink: #0B1726;
    --court-soft: #1A3050;
    --cone: #F2B300;
    --cone-ink: #2E2300;
    --cone-soft: #3A3110;
    --mark: #F27985;
    --mark-soft: #3C1C24;
    --chart: #5B8FE0;
    --chart-ref: #B88700;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--floor);
  color: var(--ink);
  font-family: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.45;
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--court); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--cone); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
main {
  max-width: 34rem;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 18px) var(--gut) calc(var(--tabbar) + env(safe-area-inset-bottom) + 28px);
  min-height: 100vh;
}
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  display: grid; justify-items: center; gap: 2px;
  padding: 9px 0 8px; min-height: var(--tabbar);
  color: var(--muted); text-decoration: none;
  font-size: 11px; font-weight: 600; letter-spacing: .01em;
}
.tabbar a[aria-current='page'] { color: var(--court); }
.tabbar a[aria-current='page'] svg { stroke-width: 2.2; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- type ---------- */
h1, h2, h3 { margin: 0; line-height: 1.1; font-weight: 750; }
h1 { font-size: 31px; font-stretch: var(--cond); letter-spacing: -.005em; }
h2 { font-size: 20px; font-stretch: var(--cond); margin: 30px 0 10px; }
h3 { font-size: 16px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- page head ---------- */
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.weekname { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.weekname b { font-size: 20px; font-stretch: var(--narrow); font-weight: 800; color: var(--court); }
.weekname span { color: var(--muted); font-size: 14px; font-weight: 600; }
.countdown { text-align: right; flex: none; }
.countdown b { display: block; font-size: 31px; line-height: .95; font-stretch: var(--narrow); font-weight: 800; color: var(--court); }
.countdown span { font-size: 12px; color: var(--muted); }
.countdown a { font-size: 13px; }

.chip {
  display: inline-block; padding: 2px 8px; border-radius: 99px;
  font-size: 12px; font-weight: 650; line-height: 1.5;
  background: var(--court-soft); color: var(--court);
  white-space: nowrap;
}
.chip.cone { background: var(--cone-soft); color: var(--ink); }
.chip.red { background: var(--mark-soft); color: var(--mark); }

/* ---------- week strip : 7 plots on a 20 m line ---------- */
.strip {
  position: relative; display: grid; grid-template-columns: repeat(7, 1fr);
  margin: 6px 0 24px; padding-top: 2px;
}
.strip::after {
  content: ''; position: absolute; left: 7%; right: 7%; bottom: 13px; height: 2px; background: var(--line); z-index: 0;
}
.strip a { position: relative; z-index: 1; display: grid; justify-items: center; gap: 2px; text-decoration: none; color: var(--muted); padding-bottom: 2px; }
.strip .dn { font-size: 12px; font-weight: 650; }
.strip .dd { font-size: 15px; font-weight: 700; color: var(--ink); width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; font-variant-numeric: tabular-nums; }
.strip .today .dd { background: var(--cone); color: var(--cone-ink); }
.strip svg { width: 22px; height: 24px; }
.cone-out { fill: var(--card); stroke: var(--court); stroke-width: 1.6; }
.cone-fill { fill: var(--court); }
.cone-none { fill: var(--floor); stroke: var(--line); stroke-width: 1.6; }

/* ---------- day sequence ---------- */
.dayhead { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 6px; }
.notes { margin: 0 0 10px; padding: 0; list-style: none; }
.notes li { padding: 8px 12px; border-left: 3px solid var(--cone); background: var(--card); border-radius: 0 var(--r-s) var(--r-s) 0; margin-bottom: 6px; font-size: 14px; }

.seq { list-style: none; margin: 0; padding: 0; position: relative; }
.seq::before { content: ''; position: absolute; left: 21px; top: 26px; bottom: 26px; width: 2px; background: var(--line); }
.step { position: relative; display: grid; grid-template-columns: 44px 1fr; column-gap: 8px; align-items: start; }
.node {
  width: 44px; height: 52px; display: grid; place-items: center; padding: 0;
  border: 0; background: none; cursor: pointer;
}
.node i {
  width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%;
  border: 2px solid var(--court); background: var(--floor);
}
.node svg { width: 15px; height: 15px; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.step[data-status='done'] .node i { background: var(--court); }
.step[data-status='done'] .node svg { stroke: var(--court-ink); }
.step[data-status='skipped'] .node i { border-color: var(--mark); }
.step[data-status='skipped'] .node svg { stroke: var(--mark); }
.step[data-kind='mob'] .node i { width: 18px; height: 18px; border-width: 2px; }
.step[data-kind='mob'] .node svg { width: 11px; height: 11px; }
.step.optional .node i { border-style: dashed; }

.rowbtn {
  display: block; width: 100%; text-align: left; background: none; border: 0; padding: 13px 0 12px; cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.step:last-child .rowbtn { border-bottom: 0; }
.rowbtn .t { display: block; font-weight: 700; font-size: 17px; line-height: 1.25; }
.rowbtn .spec { display: block; font-weight: 500; color: var(--ink); margin-top: 1px; }
.rowbtn .meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 13px; color: var(--muted); }
.rowbtn .meta .ok { color: var(--court); font-weight: 650; }
.step[data-kind='mob'] .rowbtn { padding: 9px 0; }
.step[data-kind='mob'] .rowbtn .t { font-size: 15px; font-weight: 650; color: var(--muted); }
.step[data-kind='mob'][data-status='done'] .rowbtn .t { color: var(--ink); }
.step[data-status='skipped'] .rowbtn .t { text-decoration: line-through; text-decoration-color: var(--mark); color: var(--muted); }

/* the treadmill readout: the one loud thing */
.readout { display: flex; align-items: baseline; gap: 6px; margin: 6px 0 2px; color: var(--court); }
.readout b { font-size: 54px; line-height: .88; font-weight: 820; font-stretch: var(--narrow); letter-spacing: -.01em; }
.readout b.single { font-size: 60px; }
.readout span { font-size: 15px; font-weight: 650; color: var(--muted); }
.readout + .pace { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- expanded panel ---------- */
.panel {
  grid-column: 2; background: var(--card); border-radius: var(--r-m);
  padding: 14px 14px 16px; margin: 2px 0 14px;
  border: 1px solid var(--line);
}
.panel .detail { margin: 0 0 12px; padding-left: 18px; font-size: 15px; }
.panel .detail li { margin-bottom: 4px; }
.target { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; margin: 0 0 14px; font-size: 15px; }
.target dt { color: var(--muted); }
.target dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; }
.hint { padding: 9px 11px; background: var(--court-soft); border-radius: var(--r-s); font-size: 14px; margin: 0 0 12px; }

.activity { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.activity .an { font-weight: 700; }
.stats { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 4px 0 6px; font-variant-numeric: tabular-nums; }
.stats span { font-size: 15px; }
.stats small { color: var(--muted); font-size: 12px; margin-left: 2px; }
.laps { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; margin: 6px 0 8px; }
.laps th { text-align: right; color: var(--muted); font-weight: 600; padding: 3px 4px; border-bottom: 1px solid var(--line); }
.laps td { text-align: right; padding: 3px 4px; border-bottom: 1px solid var(--line); }
.laps th:first-child, .laps td:first-child { text-align: left; }
.strava-link { color: var(--strava); font-weight: 650; font-size: 14px; text-decoration: none; }
.linkrow { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: 14px; }
.linkrow select { flex: 1; min-width: 0; }

/* ---------- forms ---------- */
form.log { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px 12px; margin-bottom: 10px; }
label.f { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
input[type='text'], input[type='number'], input[type='date'], input[type='password'], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: var(--r-s);
  background: var(--floor); color: var(--ink); font-size: 17px;
}
textarea { min-height: 64px; resize: vertical; font-size: 16px; }
.check { display: flex; gap: 10px; align-items: center; font-size: 15px; min-height: 40px; margin-bottom: 6px; }
.check input { width: 22px; height: 22px; accent-color: var(--court); }
.rpe { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin: 4px 0 12px; }
.rpe label { position: relative; }
.rpe input { position: absolute; opacity: 0; inset: 0; }
.rpe span { display: grid; place-items: center; height: 36px; border-radius: var(--r-s); background: var(--floor); border: 1px solid var(--line); font-weight: 700; font-variant-numeric: tabular-nums; }
.rpe input:checked + span { background: var(--court); color: var(--court-ink); border-color: var(--court); }
.rpe input:focus-visible + span { outline: 3px solid var(--cone); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: var(--r-s);
  border: 1px solid var(--court); background: var(--court); color: var(--court-ink);
  font-weight: 700; font-size: 15px; cursor: pointer; text-decoration: none;
}
.btn.ghost { background: transparent; color: var(--court); }
.btn.quiet { background: transparent; border-color: var(--line); color: var(--ink); font-weight: 600; }
.btn.danger { background: transparent; border-color: var(--mark); color: var(--mark); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.wide { width: 100%; }

/* ---------- misc blocks ---------- */
.alert { border-left: 4px solid var(--mark); background: var(--mark-soft); padding: 10px 12px; border-radius: 0 var(--r-s) var(--r-s) 0; margin: 0 0 12px; font-size: 15px; }
.alert.info { border-color: var(--court); background: var(--court-soft); }
.block { background: var(--card); border-radius: var(--r-m); padding: 14px; border: 1px solid var(--line); margin-bottom: 12px; }
.block h3 { margin-bottom: 8px; }
.extras { margin-top: 18px; }
.extras .act { padding: 10px 0; border-top: 1px solid var(--line); }
.tomorrow { margin-top: 22px; font-size: 15px; color: var(--muted); }
.tomorrow b { color: var(--ink); font-weight: 650; }
.empty { padding: 26px 0; color: var(--muted); }

details.more { border-top: 1px solid var(--line); }
details.more:last-child { border-bottom: 1px solid var(--line); }
details.more > summary { list-style: none; padding: 14px 0; font-weight: 700; font-size: 17px; cursor: pointer; display: flex; justify-content: space-between; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: '+'; color: var(--muted); font-weight: 500; font-size: 22px; line-height: 1; }
details.more[open] > summary::after { content: '−'; }
details.more > div { padding-bottom: 14px; }
.list { margin: 0; padding-left: 18px; }
.list li { margin-bottom: 5px; }

/* check-in */
.checkin { margin-top: 26px; }
.checkin summary { cursor: pointer; min-height: 28px; }
.checkin form { margin-top: 12px; }
.fatigue { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }

/* ---------- plan list ---------- */
.phase { margin: 26px 0 6px; display: flex; align-items: baseline; gap: 8px; }
.phase h2 { margin: 0; }
.weeks { list-style: none; margin: 0; padding: 0; }
.weeks a {
  display: grid; grid-template-columns: 46px 1fr auto; gap: 2px 10px; align-items: center;
  padding: 11px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; position: relative;
}
.weeks .wn { font-size: 24px; font-weight: 800; font-stretch: var(--narrow); color: var(--court); grid-row: span 2; }
.weeks .wr { font-weight: 650; }
.weeks .wc { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.weeks .bar { grid-column: 2 / 4; height: 4px; border-radius: 2px; background: var(--court-soft); overflow: hidden; }
.weeks .bar span { display: block; height: 100%; background: var(--court); border-radius: 2px; }
.weeks .current { box-shadow: inset 4px 0 0 var(--cone); padding-left: 12px; margin-left: -12px; }
.weeks .future { color: var(--muted); }

/* week view */
.weeknav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.weeknav a { min-width: 44px; min-height: 44px; display: grid; place-items: center; text-decoration: none; font-size: 22px; }
.weeknav a[aria-disabled='true'] { visibility: hidden; }
.summary { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 6px 0 18px; font-size: 15px; }
.summary b { font-variant-numeric: tabular-nums; }
.wday { margin-top: 18px; }
.wday h3 { display: flex; justify-content: space-between; align-items: baseline; font-size: 17px; font-stretch: var(--cond); margin-bottom: 2px; }
.wday h3 a { font-size: 14px; font-stretch: 100%; font-weight: 600; text-decoration: none; }
.wday.is-today h3::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--cone); align-self: center; margin-right: 8px; }
.wday.is-today h3 { justify-content: flex-start; }
.wday.is-today h3 a { margin-left: auto; }

/* ---------- progress ---------- */
.goals { list-style: none; margin: 0 0 8px; padding: 0; }
.goals li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.goals .g { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.goals .gv { font-size: 28px; font-weight: 800; font-stretch: var(--narrow); color: var(--court); line-height: 1; }
.goals .gt { font-size: 14px; color: var(--muted); text-align: right; }
.meter { height: 6px; border-radius: 3px; background: var(--court-soft); margin-top: 8px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--court); border-radius: 3px; }

.chart { position: relative; margin: 6px 0 4px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-tick { fill: var(--muted); font-size: 10px; font-family: inherit; font-variant-numeric: tabular-nums; }
.ch-line { fill: none; stroke: var(--chart); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch-dot { fill: var(--chart); stroke: var(--card); stroke-width: 2; }
.ch-dot.base { fill: var(--card); stroke: var(--chart); stroke-width: 2; }
.ch-bar { fill: var(--chart); }
.ch-bar.light { fill-opacity: .45; }
.ch-ref { stroke: var(--chart-ref); stroke-width: 2; }
.ch-band { fill: var(--chart-ref); fill-opacity: .12; }
.ch-label { fill: var(--ink); font-size: 11px; font-weight: 700; font-family: inherit; }
.ch-reflabel { fill: var(--muted); font-size: 10px; font-weight: 600; font-family: inherit; }
.ch-hit { fill: transparent; cursor: pointer; }
.ch-hit:focus { outline: none; }
.ch-hit:focus-visible { stroke: var(--cone); stroke-width: 2; }
.tip {
  position: absolute; z-index: 5; pointer-events: none; transform: translate(-50%, calc(-100% - 10px));
  background: var(--ink); color: var(--floor); padding: 6px 9px; border-radius: var(--r-s); font-size: 13px; white-space: nowrap;
}
.tip strong { display: block; font-size: 15px; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-top: 26px; }
.chart-head h2 { margin: 0; }
.chart-head span { font-size: 13px; color: var(--muted); }
details.values { font-size: 13px; color: var(--muted); }
details.values summary { cursor: pointer; padding: 4px 0; }
details.values table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; color: var(--ink); }
details.values td { padding: 3px 0; border-bottom: 1px solid var(--line); }
details.values td:last-child { text-align: right; }

/* ---------- reference tables ---------- */
.zones { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.zones th, .zones td { padding: 10px 6px; border-bottom: 1px solid var(--line); text-align: right; }
.zones th:first-child, .zones td:first-child { text-align: left; padding-left: 0; }
.zones th { font-size: 13px; color: var(--muted); font-weight: 600; }
.zones td b { font-size: 18px; }
.zones td:not(:first-child) { white-space: nowrap; }
.zones + .refs { margin-top: 22px; }
.zones tr.me td { background: var(--cone-soft); }
.zones tr.me td:first-child { box-shadow: inset 3px 0 0 var(--cone); padding-left: 8px; }
.scroll { overflow-x: auto; margin: 0 calc(-1 * var(--gut)); padding: 0 var(--gut); }

/* ---------- settings ---------- */
.setrow { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.setrow:last-child { border-bottom: 0; }
.setrow span:last-child { text-align: right; font-weight: 600; }
.ok { color: var(--court); }
.bad { color: var(--mark); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 14px); transform: translateX(-50%);
  z-index: 20; background: var(--ink); color: var(--floor); padding: 10px 16px; border-radius: 99px; font-size: 15px; font-weight: 600;
  max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
}
.toast.err { background: var(--mark); color: #fff; }
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: rise .2s ease-out; }
  @keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }
  .panel { animation: open .16s ease-out; }
  @keyframes open { from { opacity: 0; transform: translateY(-4px); } }
}

/* ---------- login ---------- */
.login { max-width: 22rem; margin: 0 auto; padding: 18vh var(--gut) 40px; }
.login .brand { font-size: 72px; line-height: .85; font-weight: 850; font-stretch: var(--narrow); color: var(--court); margin: 0 0 6px; }
.login p { color: var(--muted); margin-bottom: 26px; }
.login form { display: grid; gap: 12px; }

.loading { padding: 40px 0; color: var(--muted); }
