/* ————— LA FONTE — esthétique fonte & acier, volt sur charbon ————— */

:root {
  --bg: #0b0c0a;
  --surface: #14160f;
  --surface2: #1b1e14;
  --line: #2b2f20;
  --text: #edefe4;
  --muted: #969b87;
  --volt: #c8f52e;
  --volt-dim: #91b41f;
  --ember: #ff6b2b;
  --danger: #ff4d3d;
  --disp: "Anton", sans-serif;
  --body: "Barlow Semi Condensed", sans-serif;
  --mono: "IBM Plex Mono", monospace;
  --hazard: repeating-linear-gradient(-45deg, var(--volt) 0 7px, transparent 7px 14px);
}

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

html { font-size: 16px; }

body {
  background: var(--bg);
  background-image: radial-gradient(ellipse 120% 60% at 50% -10%, #191c10 0%, transparent 60%);
  color: var(--text);
  font-family: var(--body);
  min-height: 100dvh;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  overscroll-behavior-y: none;
}

.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 50; opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ——— Topbar ——— */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: linear-gradient(180deg, rgba(11,12,10,0.97) 75%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 22px; height: 22px; background: var(--hazard); border: 2px solid var(--volt); }
.brand h1 { font-family: var(--disp); font-size: 1.35rem; letter-spacing: 0.06em; font-weight: 400; }
.topbar-meta { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); text-align: right; line-height: 1.5; }
.topbar-meta .deload { color: var(--ember); font-weight: 700; }

/* ——— Vue ——— */
.view { padding: 6px 14px 24px; max-width: 560px; margin: 0 auto; animation: rise 0.25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ——— Sélecteur de jour ——— */
.day-chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 12px; scrollbar-width: none; }
.day-chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); border-radius: 4px; padding: 8px 13px;
  font-family: var(--body); font-weight: 600; font-size: 0.85rem; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 62px;
}
.chip b { font-family: var(--disp); font-weight: 400; font-size: 1rem; letter-spacing: 0.04em; color: var(--text); }
.chip small { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.08em; }
.chip.sel { border-color: var(--volt); background: var(--surface2); box-shadow: 0 0 0 1px var(--volt); }
.chip.sel b { color: var(--volt); }
.chip.today::after { content: "●"; color: var(--ember); font-size: 0.5rem; line-height: 0.4; }

/* ——— En-tête de séance ——— */
.day-head { margin: 6px 0 14px; }
.day-head .stripe { height: 6px; width: 88px; background: var(--hazard); margin-bottom: 10px; }
.day-head h2 { font-family: var(--disp); font-weight: 400; font-size: 2.1rem; letter-spacing: 0.03em; line-height: 1; text-transform: uppercase; }
.day-head h2 span { color: var(--volt); }
.day-head .sub { color: var(--muted); font-size: 0.9rem; margin-top: 6px; }

.banner {
  border: 1px solid var(--line); border-left: 4px solid var(--volt);
  background: var(--surface); padding: 10px 12px; margin-bottom: 12px;
  font-size: 0.88rem; color: var(--text); line-height: 1.45; border-radius: 3px;
}
.banner.ember { border-left-color: var(--ember); }
.banner.dim { color: var(--muted); border-left-color: var(--line); }
.banner b { color: var(--volt); }

/* ——— Carte exercice ——— */
.section-title {
  font-family: var(--disp); font-weight: 400; font-size: 0.95rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted); margin: 20px 2px 10px;
  display: flex; align-items: center; gap: 10px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.excard {
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  margin-bottom: 12px; overflow: hidden;
}
.excard.done-all { border-color: var(--volt-dim); }
.exhead { padding: 12px 14px 8px; display: flex; align-items: center; gap: 11px; }
.exhead-main { flex: 1; min-width: 0; }
.exhead .row1 { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.exbody { width: 56px; height: 58px; flex: 0 0 auto; }
.exbody polygon { stroke: #0f110c; stroke-width: 0.5; stroke-linejoin: round; }
.exbody .base { fill: #3b4230; }
.exbody .m { fill: var(--danger); }
.exbody .m2 { fill: var(--danger); opacity: 0.4; }
.exname { font-weight: 700; font-size: 1.05rem; line-height: 1.2; }
.exmeta { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); margin-top: 4px; }
.exmeta .rest { color: var(--text); }
.badge-up {
  flex: 0 0 auto; font-family: var(--mono); font-size: 0.68rem; font-weight: 700;
  background: var(--volt); color: #10120a; padding: 3px 7px; border-radius: 3px;
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(200,245,46,0.5); } 50% { box-shadow: 0 0 0 6px rgba(200,245,46,0); } }
.exnote { font-size: 0.8rem; color: var(--ember); padding: 0 14px 6px; }
.exlast { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); padding: 0 14px 10px; }
.exlast b { color: var(--text); font-weight: 500; }
.exhint { font-family: var(--body); font-size: 0.76rem; color: var(--volt-dim); margin-top: 3px; }
.exhint.warn { color: var(--ember); }

/* ——— Lignes de séries ——— */
.setrows { border-top: 1px solid var(--line); }
.setrow {
  display: grid; grid-template-columns: 26px 1fr 1fr 52px; align-items: center;
  gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line);
}
.setrow:last-child { border-bottom: none; }
.setrow .sno { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); text-align: center; }
.setrow.done { background: rgba(200,245,46,0.05); }
.setrow.done .sno { color: var(--volt); }

.stepper { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 4px; background: var(--surface2); overflow: hidden; }
.stepper button {
  width: 40px; border: none; background: transparent; color: var(--muted);
  font-size: 1.25rem; font-family: var(--mono); cursor: pointer; padding: 8px 0;
}
.stepper button:active { background: var(--line); color: var(--volt); }
.stepper .val {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0;
}
.stepper .val input {
  width: 100%; border: none; background: transparent; color: var(--text); text-align: center;
  font-family: var(--mono); font-size: 1.02rem; font-weight: 700; padding: 2px 0 0; outline: none;
}
.stepper .val small { font-size: 0.55rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; padding-bottom: 3px; }
.setrow.done .stepper { opacity: 0.75; }
.setrow .reps-ok input { color: var(--volt) !important; }

.btn-check {
  height: 44px; border-radius: 4px; border: 1px solid var(--line);
  background: var(--surface2); color: var(--muted); font-size: 1.15rem; cursor: pointer;
}
.btn-check.valid { background: var(--volt); border-color: var(--volt); color: #10120a; font-weight: 700; }

.addset {
  width: 100%; padding: 9px; background: none; border: none; border-top: 1px dashed var(--line);
  color: var(--muted); font-family: var(--body); font-weight: 600; font-size: 0.8rem; cursor: pointer;
}

/* ——— Boutons génériques ——— */
.btn-primary {
  width: 100%; padding: 15px; border: none; border-radius: 5px;
  background: var(--volt); color: #10120a; font-family: var(--disp); font-weight: 400;
  font-size: 1.05rem; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; margin-top: 6px;
}
.btn-primary:active { transform: scale(0.99); }
.btn-ghost {
  width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 5px;
  background: none; color: var(--muted); font-family: var(--body); font-weight: 600; font-size: 0.9rem; cursor: pointer; margin-top: 10px;
}

/* ——— Résumé fin de séance ——— */
.summary { text-align: center; padding: 30px 10px; }
.summary .stripe { height: 6px; width: 120px; background: var(--hazard); margin: 0 auto 18px; }
.summary h2 { font-family: var(--disp); font-weight: 400; font-size: 1.9rem; letter-spacing: 0.04em; }
.summary .stats { display: flex; justify-content: center; gap: 26px; margin-top: 20px; }
.summary .stat b { display: block; font-family: var(--mono); font-size: 1.6rem; color: var(--volt); }
.summary .stat span { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }

/* ——— Repos / hero jour off ——— */
.resthero { text-align: center; padding: 40px 16px 20px; }
.resthero h2 { font-family: var(--disp); font-weight: 400; font-size: 2.4rem; color: var(--muted); }
.resthero p { color: var(--muted); margin-top: 10px; font-size: 0.95rem; }
.resthero b { color: var(--volt); }

/* ——— Timer ——— */
.timer-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(8,9,7,0.96);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px;
  backdrop-filter: blur(4px);
}
.timer-overlay.hidden { display: none; }
.timer-label { font-family: var(--disp); font-size: 1rem; letter-spacing: 0.5em; color: var(--muted); }
.timer-ring { position: relative; width: 240px; height: 240px; }
.timer-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 7; }
.ring-fg {
  fill: none; stroke: var(--volt); stroke-width: 7; stroke-linecap: butt;
  stroke-dasharray: 565.5; stroke-dashoffset: 0; transition: stroke-dashoffset 0.9s linear;
}
.timer-ring.ending .ring-fg { stroke: var(--ember); }
.timer-digits {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 3.6rem; font-weight: 700; letter-spacing: -0.02em;
}
.timer-next { color: var(--muted); font-size: 0.9rem; max-width: 300px; text-align: center; }
.timer-next b { color: var(--text); }
.timer-actions { display: flex; gap: 10px; }
.timer-actions button {
  padding: 12px 18px; border-radius: 5px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-family: var(--mono); font-size: 0.85rem; cursor: pointer;
}
.timer-actions .skip { background: var(--volt); color: #10120a; border-color: var(--volt); font-weight: 700; }

/* ——— Suivi ——— */
.wlist { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.wrow {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 10px 13px;
}
.wrow .l b { font-family: var(--disp); font-weight: 400; letter-spacing: 0.04em; margin-right: 8px; color: var(--volt); }
.wrow .l span { font-size: 0.85rem; }
.wrow .l small { display: block; color: var(--muted); font-family: var(--mono); font-size: 0.68rem; margin-top: 2px; }
.wrow .r { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); text-align: right; line-height: 1.5; }
.wrow .r b { color: var(--text); }

.exsel {
  width: 100%; padding: 12px; border-radius: 5px; border: 1px solid var(--line);
  background: var(--surface2); color: var(--text); font-family: var(--body); font-size: 0.95rem; margin-bottom: 14px;
}

.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 14px; margin-bottom: 14px; }
.chart-card h3 { font-size: 0.95rem; margin-bottom: 4px; }
.chart-card .cc-sub { font-family: var(--mono); font-size: 0.68rem; color: var(--muted); margin-bottom: 10px; }
.chart-card svg { width: 100%; height: 120px; display: block; }
.spark-line { fill: none; stroke: var(--volt); stroke-width: 2.5; }
.spark-dot { fill: var(--volt); }
.spark-area { fill: rgba(200,245,46,0.08); }
.spark-txt { fill: var(--muted); font-family: var(--mono); font-size: 9px; }

.htable { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.htable th { text-align: left; color: var(--muted); font-weight: 600; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.htable td { padding: 7px 8px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 0.75rem; }
.htable td:first-child { font-family: var(--body); }
.htable tr:last-child td { border-bottom: none; }

/* ——— Poids ——— */
.bw-entry { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.bw-entry button { grid-column: 1 / -1; }
.bw-compo { font-size: 0.68rem; color: var(--muted); margin-top: 3px; }
.bw-compo .delta { display: inline; }
.bw-entry input {
  padding: 12px 10px; border-radius: 5px; border: 1px solid var(--line);
  background: var(--surface2); color: var(--text); font-family: var(--mono); font-size: 0.95rem; min-width: 0;
}
.bw-entry input::-webkit-calendar-picker-indicator { filter: invert(0.7); }
.bw-entry button {
  padding: 12px 18px; border: none; border-radius: 5px; background: var(--volt);
  color: #10120a; font-weight: 700; font-family: var(--body); font-size: 0.95rem; cursor: pointer;
}
.bw-week {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 10px 13px; margin-bottom: 8px;
}
.bw-week .wl { font-size: 0.85rem; }
.bw-week .wl small { display: block; color: var(--muted); font-family: var(--mono); font-size: 0.65rem; }
.bw-week .wr { text-align: right; font-family: var(--mono); }
.bw-week .wr b { font-size: 1.05rem; }
.bw-week .delta { font-size: 0.7rem; display: block; }
.delta.ok { color: var(--volt); }
.delta.hot { color: var(--ember); }
.delta.low { color: var(--muted); }
.bw-log { margin-top: 18px; }
.bw-log .bwrow { display: flex; justify-content: space-between; padding: 7px 4px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 0.8rem; }
.bw-log .bwrow button { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 0.9rem; }

/* ——— Programme ——— */
.prog h2 { font-family: var(--disp); font-weight: 400; font-size: 1.25rem; letter-spacing: 0.05em; margin: 22px 0 10px; text-transform: uppercase; }
.prog h2:first-child { margin-top: 4px; }
.prog ul { list-style: none; }
.prog li { padding: 7px 0 7px 18px; position: relative; font-size: 0.9rem; line-height: 1.45; border-bottom: 1px solid var(--line); }
.prog li::before { content: "▸"; position: absolute; left: 0; color: var(--volt); }
.prog table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-bottom: 8px; }
.prog th { text-align: left; color: var(--muted); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; padding: 5px 6px; border-bottom: 1px solid var(--line); }
.prog td { padding: 6px; border-bottom: 1px solid var(--line); }
.prog td.num { font-family: var(--mono); font-size: 0.75rem; white-space: nowrap; }
.prog .pnote { color: var(--muted); font-size: 0.82rem; font-style: italic; margin: 6px 0 2px; }

/* ——— Tabbar ——— */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; background: rgba(15,17,11,0.97); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); backdrop-filter: blur(8px);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 10px 0 8px; background: none; border: none; color: var(--muted); cursor: pointer;
  font-family: var(--body); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
}
.tab svg { width: 22px; height: 22px; fill: currentColor; }
.tab.active { color: var(--volt); }
.tab.active::before { content: ""; position: absolute; margin-top: -10px; width: 30px; height: 3px; background: var(--volt); }

/* ——— Carte circuit gainage ——— */
.circuit-card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; margin-bottom: 12px; padding: 14px; }
.circuit-card .cc-title { font-family: var(--disp); font-weight: 400; font-size: 1rem; letter-spacing: 0.06em; text-transform: uppercase; }
.circuit-card .cc-exos { color: var(--muted); font-size: 0.85rem; margin: 4px 0 12px; }
.circuit-card .cc-last { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); margin-bottom: 10px; }
.circuit-card .cc-last b { color: var(--volt); }
.cc-cfg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.cc-cfg .stepper .val input { font-size: 0.95rem; }
.cc-presets { display: flex; gap: 8px; margin-bottom: 12px; }
.cc-presets button {
  flex: 1; padding: 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface2);
  color: var(--muted); font-family: var(--mono); font-size: 0.8rem; font-weight: 700; cursor: pointer;
}
.cc-presets button.sel { border-color: var(--volt); color: var(--volt); }

/* ——— Overlay circuit ——— */
.circuit-overlay {
  position: fixed; inset: 0; z-index: 110; background: #0a0b08;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 24px; text-align: center; transition: background 0.4s;
}
.circuit-overlay.hidden { display: none; }
.circuit-overlay.ph-effort { background: radial-gradient(ellipse 100% 70% at 50% 100%, #1e240c 0%, #0a0b08 65%); }
.circuit-overlay.ph-trans { background: radial-gradient(ellipse 100% 70% at 50% 100%, #2a1509 0%, #0a0b08 65%); }
.c-top { position: absolute; top: calc(20px + env(safe-area-inset-top)); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.c-round { font-family: var(--disp); font-size: 1rem; letter-spacing: 0.3em; color: var(--muted); }
.c-dots { display: flex; gap: 5px; }
.c-dots span { width: 22px; height: 5px; background: var(--line); border-radius: 2px; }
.c-dots span.done { background: var(--volt); }
.c-dots span.cur { background: var(--ember); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.4; } }
.c-phase { font-family: var(--disp); font-size: 0.95rem; letter-spacing: 0.45em; color: var(--muted); }
.ph-effort .c-phase { color: var(--volt); }
.ph-trans .c-phase { color: var(--ember); }
.c-ex { font-family: var(--disp); font-weight: 400; font-size: 2.2rem; line-height: 1.05; text-transform: uppercase; max-width: 340px; }
.c-cue { color: var(--muted); font-size: 0.85rem; line-height: 1.4; max-width: 320px; min-height: 2.4em; }
.c-time { font-family: var(--mono); font-size: 7.5rem; font-weight: 700; line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.ph-trans .c-time { color: var(--ember); }
.c-time.last3 { animation: throb 0.5s infinite; }
@keyframes throb { 50% { transform: scale(1.06); } }
.c-next { color: var(--muted); font-size: 0.9rem; min-height: 1.3em; }
.c-next b { color: var(--text); }
.c-actions { position: absolute; bottom: calc(26px + env(safe-area-inset-bottom)); display: flex; gap: 10px; }
.c-actions button {
  padding: 13px 18px; border-radius: 5px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font-family: var(--mono); font-size: 0.85rem; font-weight: 700; cursor: pointer;
}
.c-actions #cPause.paused { border-color: var(--volt); color: var(--volt); }

/* ——— Toast ——— */
.toast {
  position: fixed; bottom: calc(88px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  background: var(--surface2); border: 1px solid var(--volt); color: var(--text);
  padding: 10px 18px; border-radius: 5px; font-size: 0.85rem; z-index: 90; white-space: nowrap;
}
.toast.hidden { display: none; }
