:root {
  --bg: #0f1012;
  --surface: #17191c;
  --surface-2: #1f2226;
  --line: #2a2e33;
  --text: #f1f0ec;
  --muted: #8d929a;
  --faint: #5b6068;
  --accent: #c8f53c;
  --accent-ink: #141a02;
  --up: #c8f53c;
  --down: #ff8a4c;
  --pr: #ffd25c;
  --danger: #ff5d5d;
  --radius: 14px;
  --display: 'Space Grotesk', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--body); -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 28px; line-height: 1.1; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 20px; }
[hidden] { display: none !important; }

#app { max-width: 560px; margin: 0 auto; padding: calc(20px + env(safe-area-inset-top, 0px)) 16px calc(96px + var(--safe-b)); }
.boot { display: grid; place-items: center; min-height: 80dvh; }
.logo-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--accent); mask: url(../icons/mark.svg) center/contain no-repeat; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .4; } }

/* Header */
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.eyebrow { font: 600 12px/1 var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.brand { font: 700 15px var(--display); display: flex; align-items: center; gap: 8px; }
.brand i { width: 18px; height: 18px; background: var(--accent); mask: url(../icons/mark.svg) center/contain no-repeat; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.hero { background: linear-gradient(160deg, #1d2312, var(--surface) 55%); border-color: #34401a; }
.card.flat { background: transparent; }
.card-link { display: block; text-decoration: none; }
.card-link:active { transform: scale(.995); }
.banner { border-radius: 12px; padding: 10px 12px; font-size: 13px; background: #23200f; border: 1px solid #4a4219; color: #f0dfa0; }
.banner.info { background: #121b22; border-color: #23384a; color: #a9cbe6; }

/* Buttons */
.btn { appearance: none; border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 12px 16px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; text-decoration: none; }
.btn:hover { border-color: #3a3f46; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn.icon { min-height: 36px; width: 36px; padding: 0; border-radius: 10px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 13px; }

/* Forms */
label.field { display: block; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.input, select.input { width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-height: 46px; outline: none; }
.input:focus { border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 9px 14px; cursor: pointer; font-weight: 500; font-size: 14px; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.choice { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.choice b { display: block; font-weight: 600; }
.choice small { color: var(--muted); }
.choice[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.choice-grid { display: grid; gap: 8px; }
.seg { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.seg button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; min-height: 40px; cursor: pointer; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.seg-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); margin-top: 4px; }

/* Auth */
.auth { min-height: 85dvh; display: flex; flex-direction: column; justify-content: center; }
.auth .hero-title { font-size: 40px; line-height: 1; margin: 18px 0 10px; }
.auth .hero-title em { font-style: normal; color: var(--accent); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 12px; padding: 4px; border: 1px solid var(--line); }
.tabs button { border: 0; background: transparent; padding: 9px; border-radius: 9px; font-weight: 600; cursor: pointer; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); }

/* Onboarding */
.progress-dots { display: flex; gap: 6px; }
.progress-dots i { height: 4px; flex: 1; border-radius: 2px; background: var(--line); }
.progress-dots i.on { background: var(--accent); }

/* Today */
.day-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.day-chips .chip { white-space: nowrap; }
.preview-list { list-style: none; margin: 0; padding: 0; }
.preview-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.preview-list li:first-child { border-top: 0; }
.preview-list .tgt { color: var(--muted); white-space: nowrap; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stat b { display: block; font: 700 22px/1.1 var(--display); }
.stat span { font-size: 12px; color: var(--muted); }

/* Workout */
.wk-top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); margin: -20px -16px 16px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.ex-card { padding: 14px; }
.ex-head { display: flex; align-items: flex-start; gap: 10px; }
.ex-title { font: 600 17px/1.2 var(--display); }
.ex-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.reasons { margin: 10px 0 0; padding: 0; list-style: none; }
.reasons li { font-size: 12.5px; color: #b9c3a4; background: #1a1f12; border-radius: 8px; padding: 7px 10px; margin-top: 6px; }
.sets { margin-top: 12px; width: 100%; border-collapse: separate; border-spacing: 0 6px; table-layout: fixed; }
.sets col.c-n { width: 26px; } .sets col.c-rpe { width: 22%; } .sets col.c-ok { width: 48px; }
.sets th { font: 600 11px var(--body); color: var(--faint); text-transform: uppercase; letter-spacing: .06em; text-align: left; padding: 0 4px; }
.sets td { padding: 0 3px; }
.sets td:first-child { color: var(--muted); font-weight: 600; text-align: center; }
.sets .input { padding: 8px 8px; min-height: 42px; text-align: center; border-radius: 10px; font-variant-numeric: tabular-nums; }
.sets select.input { padding: 8px 2px; }
.sets tr.done .input { background: #1c2310; border-color: #3a4a1a; }
.check { width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; display: grid; place-items: center; }
.check svg { width: 20px; height: 20px; stroke: var(--faint); fill: none; stroke-width: 2.5; }
tr.done .check { background: var(--accent); border-color: var(--accent); }
tr.done .check svg { stroke: var(--accent-ink); }
.ex-actions { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.target-hint { font-size: 11.5px; color: var(--faint); text-align: center; }

/* Rest timer */
.rest { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(76px + var(--safe-b)); z-index: 20; width: min(528px, calc(100% - 32px)); background: var(--text); color: var(--bg); border-radius: 16px; padding: 10px 12px 10px 16px; display: flex; align-items: center; gap: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.rest b { font: 700 24px var(--display); font-variant-numeric: tabular-nums; }
.rest .btn { background: #e3e2dd; border-color: transparent; color: var(--bg); min-height: 36px; padding: 6px 12px; }
.rest .bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent-ink); border-radius: 0 0 0 16px; transition: width 1s linear; }

body.no-tab .rest { bottom: calc(16px + var(--safe-b)); }

/* Summary */
.change { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.change:first-child { border-top: 0; }
.change .dot { width: 26px; height: 26px; border-radius: 8px; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--surface-2); color: var(--muted); }
.change .dot.up { background: #26310f; color: var(--up); }
.change .dot.down { background: #33200f; color: var(--down); }
.pr { background: #2a2410; border: 1px solid #574a17; border-radius: 12px; padding: 10px 12px; color: var(--pr); font-weight: 600; }

/* History */
.hist-item { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.pill { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.pill.deload { color: #a9cbe6; border-color: #23384a; }
table.log { width: 100%; border-collapse: collapse; font-size: 14px; }
table.log td { padding: 6px 0; border-top: 1px solid var(--line); }
table.log td:last-child { text-align: right; color: var(--muted); }

/* Progress */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--faint); font: 10px var(--body); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: url(#fade); }
.chart .pt { fill: var(--bg); stroke: var(--accent); stroke-width: 2; }
.vol-row { display: grid; grid-template-columns: 92px 1fr 40px; align-items: center; gap: 10px; font-size: 13px; padding: 5px 0; }
.vol-track { position: relative; height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.vol-band { position: absolute; top: 0; bottom: 0; background: #26310f; }
.vol-fill { position: absolute; top: 2px; bottom: 2px; left: 0; border-radius: 3px; background: var(--muted); }
.vol-fill.ok { background: var(--accent); }
.vol-fill.hi { background: var(--down); }
.lift-row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 14px; }
.lift-row:first-child { border-top: 0; }

/* Program editor */
.prog-day h3 { margin-bottom: 6px; }
.prog-ex { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }

/* Tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(4, 1fr); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 6px max(8px, calc((100% - 560px)/2)) calc(6px + var(--safe-b)); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; text-decoration: none; color: var(--faint); font-size: 11px; font-weight: 600; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.on { color: var(--text); }
.tabbar a.on svg { stroke: var(--accent); }

/* Modal */
.modal-back { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.modal { width: min(560px, 100%); max-height: 85dvh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + var(--safe-b)); animation: rise .2s ease-out; }
@media (min-width: 600px) { .modal-back { align-items: center; } .modal { border-radius: 20px; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: .5; } }

.toast { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 50; background: var(--surface-2); border: 1px solid var(--line); padding: 10px 14px; border-radius: 12px; font-size: 14px; max-width: calc(100% - 32px); box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.toast.err { border-color: #5a2626; color: #ffb3b3; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* v2: progression tag, prompts, cardio */
.style-tag { margin-top: 6px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 999px; padding: 3px 10px; font: 600 11.5px var(--body); cursor: pointer; }
.style-tag::after { content: '›'; font-size: 13px; }
.style-tag:hover { color: var(--text); border-color: #3a3f46; }
.prompt { margin-top: 10px; border: 1px solid #3b4a1c; background: #1a1f12; border-radius: 10px; padding: 10px 12px; }
.prompt p { margin: 0 0 8px; font-size: 13px; color: #d6e3b5; }
.cardio-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cardio-grid .field:first-child { grid-column: 1 / -1; }
button.lift-row { width: 100%; background: none; border: 0; border-top: 1px solid var(--line); color: inherit; font: inherit; cursor: pointer; align-items: center; text-align: right; }
button.lift-row:first-child { border-top: 0; }
button.lift-row:hover .grow { color: var(--accent); }
.choice .pill { margin-left: 4px; }

/* Personalisation */
.notes { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: 13.5px; color: #c9ccd1; }
fieldset.field { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.checks label { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.checks input { width: 18px; height: 18px; accent-color: var(--accent); }

/* v3: warm-ups, program tools */
.sets tr.warm td:first-child { color: var(--accent); font-size: 12px; }
.sets tr.warm .input { opacity: .8; border-style: dashed; }
.prog-tools { display: flex; align-items: center; gap: 2px; flex: none; }
.prog-tools .btn.icon { width: 32px; min-height: 32px; }
.prog-tools .btn:disabled { opacity: .25; }
.prog-ex .grow { min-width: 0; }
.check:not(:has(svg)) { color: var(--muted); font-size: 14px; }
.report-ctx { font-size: 11px; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 10px; overflow-x: auto; max-height: 200px; white-space: pre-wrap; word-break: break-word; }
textarea.input { resize: vertical; min-height: 110px; font: inherit; }

/* Sign in with Google */
.google-btn { background: var(--text); color: var(--bg); border-color: var(--text); }
.google-btn:hover { filter: brightness(.95); }
.or { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 12px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* iPhone fit: Safari zooms into any text field under 16px and stays zoomed,
   so every form control uses 16px. Nothing may push the page wider than the screen. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* clip (not hidden) so the sticky workout bar still sticks on iPhone */
html, body { overflow-x: clip; }
input, select, textarea, .input { font-size: 16px; }
.sets .input { font-size: 16px; }
.review-list li { align-items: center; }

/* Plans */
.plan-link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.plan-card { padding: 12px 14px; }
.plan-card.active { border-color: #3b4a1c; }

/* Plans tab */
.tabbar { grid-template-columns: repeat(5, 1fr); }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.week-day { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 4px; text-align: center; min-width: 0; }
.week-day b { display: block; font-size: 12px; }
.week-day span { display: block; font-size: 10.5px; color: var(--faint); margin-top: 3px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.week-day.on { border-color: #3b4a1c; background: #1a1f12; }
.week-day.on span { color: var(--accent); }
.weekday-picks { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.weekday-picks label { position: relative; }
.weekday-picks input { position: absolute; opacity: 0; inset: 0; pointer-events: none; }
.weekday-picks span { display: block; text-align: center; padding: 10px 0; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-size: 13px; font-weight: 600; cursor: pointer; }
.weekday-picks input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.weekday-picks input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.rest-list { display: grid; gap: 8px; }
.rest-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.rest-card { border-color: #23384a; background: linear-gradient(160deg, #121b22, var(--surface) 60%); }
.top .btn { flex: none; }
.danger-banner { background: #2a1414; border: 1px solid #5a2626; color: #ffb3b3; }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #1a0606; }

/* Finish screen */
.horse-hero { background: radial-gradient(120% 140% at 100% 0%, #26310f 0%, var(--surface) 60%); border-color: #3b4a1c; }
.horse-big { font: 700 44px/1.05 var(--display); color: var(--accent); margin: 6px 0 6px; letter-spacing: -0.02em; }
.horse-hero.slim .horse-big { font-size: 32px; }
.hp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hp-grid > div { background: var(--surface-2); border-radius: 12px; padding: 12px; min-width: 0; }
.hp-grid b { display: block; font: 700 28px/1.1 var(--display); }
.hp-grid span { display: block; font-size: 12px; color: var(--muted); }
.hp-grid small { display: block; font-size: 11.5px; color: var(--faint); margin-top: 4px; }
.share-preview { width: 100%; border-radius: 14px; border: 1px solid var(--line); display: block; }
.hp-grid .hp-main { background: #1a1f12; border: 1px solid #3b4a1c; }
.hp-grid .hp-main b { color: var(--accent); }
.horse-strong { background: #26310f; border: 1px solid #4a5d1d; border-radius: 12px; padding: 10px 12px; font-size: 13.5px; color: #e4f5b8; }
.horse-strong b { color: var(--accent); }

/* 0.8: workout bar, picker filters, rest/setup/RPE extras */
.wk-top { z-index: 20; top: 0; margin-top: calc(-20px - env(safe-area-inset-top, 0px)); padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
.wk-rest { position: relative; display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); overflow: hidden; }
.wk-rest[hidden] { display: none; }
.wk-rest .rest-time { font-family: 'Space Grotesk', sans-serif; font-size: 22px; }
.wk-rest .bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); transition: width .25s linear; }
/* Exercise picker filters */
.swap-filters { display: grid; gap: 10px; }
.seg-mini { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg-mini button { flex: 1; background: none; border: 0; border-radius: 7px; padding: 7px 4px; color: var(--muted); font: 500 13px/1.2 var(--body); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg-mini button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.04), 0 1px 3px rgba(0,0,0,.4); }
.filter-row { gap: 10px; }
select.input.select-sm { width: auto; min-height: 38px; padding: 6px 12px; font-size: 16px; }
.rest-link { color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; font: inherit; padding: 0; }
.setup-line { display: block; margin-top: 6px; background: none; border: 0; padding: 0; color: var(--muted); font-size: 13px; text-align: left; cursor: pointer; }
.setup-line.empty { opacity: .7; }
.th-info { background: none; border: 0; padding: 0; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.th-info span { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; border: 1px solid currentColor; font-size: 9px; font-style: italic; font-weight: 700; text-transform: none; }
.rpe-list { display: grid; gap: 6px; }
.rpe-row { display: flex; gap: 12px; align-items: center; padding: 8px 12px; background: var(--surface-2); border-radius: 10px; }
.rpe-row b { width: 24px; color: var(--accent); }
/* Exercise picker: a fixed-height sheet, only the results scroll */
.modal.tall { height: 85dvh; overflow: hidden; display: flex; flex-direction: column; padding-bottom: 0; }
.picker { display: flex; flex-direction: column; gap: 14px; min-height: 0; flex: 1; }
.picker-scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; margin: 0 -16px; padding: 0 16px calc(18px + var(--safe-b)); }
.fresh-row { display: flex; gap: 10px; align-items: center; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; font-size: 14px; cursor: pointer; }
.fresh-row input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }

/* 0.9.1 Today: one clean card */
.today-card { display: grid; gap: 14px; text-decoration: none; color: inherit; }
.today-title { font: 700 34px/1.05 var(--display, 'Space Grotesk', sans-serif); margin: 0; letter-spacing: -.01em; }
.today-pick { background: none; border: 0; padding: 0; color: inherit; text-align: left; cursor: pointer; display: inline-flex; align-items: baseline; gap: 8px; }
.today-pick span { font-size: 18px; color: var(--muted); }
.today-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.today-stats div { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.today-stats b { display: block; font: 700 22px/1.1 'Space Grotesk', sans-serif; }
.today-stats span { font-size: 12.5px; color: var(--muted); }
.today-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.today-foot .linkbtn { color: var(--accent); text-decoration: none; font-weight: 600; font-size: 14px; }
.mood { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mood button { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 4px; color: var(--muted); font: 500 14px var(--body); cursor: pointer; }
.mood button[aria-pressed="true"] { color: var(--text); border-color: var(--text); }
.week-line { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 0 2px; color: var(--muted); }
.week-line b { color: var(--text); }
/* 0.9.1 Plans: calm by default */
.plan-list { display: grid; gap: 8px; }
.plan-row { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.plan-row.active { border-color: var(--accent); }
.session-card { display: grid; gap: 8px; }
.session-list { margin: 0; padding-left: 20px; color: var(--muted); display: grid; gap: 3px; font-size: 14px; }
.session-list li::marker { color: var(--faint, var(--muted)); font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: var(--line); margin: 4px 0; }
.pill-spec { color: var(--muted); font-weight: 500; }
/* 0.10 How-to guides */
.ex-howto { background: none; border: 0; padding: 0; color: inherit; text-align: left; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.howto-i { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line); color: var(--muted); font: 600 11px var(--body); flex: none; }
.howto-imgs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 6px; }
.howto-imgs.one { grid-template-columns: minmax(0, 260px); justify-content: center; }
.howto-imgs figure { margin: 0; position: relative; }
.howto-imgs img { display: block; width: 100%; height: auto; aspect-ratio: 1; border-radius: 14px; background: var(--surface-2); }
.howto-imgs figcaption { position: absolute; left: 8px; top: 8px; font: 600 11px var(--body); letter-spacing: .04em; text-transform: uppercase; background: rgba(15,16,18,.72); color: #fff; padding: 3px 7px; border-radius: 6px; }
.howto-steps { margin: 10px 0 0; padding-left: 22px; display: grid; gap: 8px; font-size: 15px; }
.howto-tips { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; display: grid; gap: 4px; font-size: 13.5px; color: var(--muted); }
.howto-tips p { margin: 0; }
.linkish { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
details.card > summary { list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
/* 0.10.2 Heat map, zone style */
.hm-card { --z-start: #3f80f5; --z-grow: #5cc26a; --z-high: #f0c043; }
.hm { min-height: 300px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; align-items: center; }
.hm-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.hm-legend span { display: inline-flex; align-items: center; gap: 6px; }
.hm svg { width: 100%; height: 340px; display: block; }
.hm path { stroke: #0b0c0d; stroke-width: 1.6; stroke-linejoin: round; transition: fill .2s; }
.hm .hm-skin { fill: #1d1f22; }
.hm .hm-z-none { fill: #2a2d31; }
.hm .hm-z-start { fill: var(--z-start); cursor: pointer; }
.hm .hm-z-grow { fill: var(--z-grow); cursor: pointer; }
.hm .hm-z-high { fill: var(--z-high); cursor: pointer; }
.hm .hm-z-none[data-act] { cursor: pointer; }
.hm-loading { height: 300px; }
.hm-legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.hm-legend i.z-start { background: var(--z-start); } .hm-legend i.z-grow { background: var(--z-grow); } .hm-legend i.z-high { background: var(--z-high); }
.hm-list { display: grid; gap: 8px; }
.hm-row { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; display: grid; gap: 6px; }
.hm-row.flash { box-shadow: 0 0 0 2px var(--text) inset; }
.hm-bar { display: flex; gap: 4px; margin-top: 2px; }
.hm-bar i { flex: 1; height: 22px; border-radius: 6px; max-width: 18px; }
.hm-bar i.z-start { background: color-mix(in srgb, var(--z-start) 18%, transparent); }
.hm-bar i.z-grow { background: color-mix(in srgb, var(--z-grow) 16%, transparent); }
.hm-bar i.z-high { background: color-mix(in srgb, var(--z-high) 16%, transparent); }
.hm-bar i.z-start.on { background: var(--z-start); } .hm-bar i.z-grow.on { background: var(--z-grow); } .hm-bar i.z-high.on { background: var(--z-high); }
.z-start-t { color: var(--z-start); } .z-grow-t { color: var(--z-grow); font-weight: 600; } .z-high-t { color: var(--z-high); font-weight: 600; }

/* ── Supersets and drop sets ─────────────────────────────── */
:root { --drop: #f0c043; --drop-line: #5a4a1d; --drop-bg: #2a2410; }
.ss-group { border: 1px solid #3a4a1a; border-radius: calc(var(--radius) + 6px); padding: 6px; background: rgba(200, 245, 60, .04); display: grid; gap: 6px; }
.ss-group .card { border-radius: var(--radius); }
.ss-head { display: flex; align-items: center; gap: 8px; padding: 4px 4px 0 8px; font-size: 13px; color: var(--muted); }
.ss-head b { color: var(--accent); font: 600 11px/1 var(--body); letter-spacing: .08em; text-transform: uppercase; }
.ss-head .rest-link { text-align: left; text-decoration: none; }
.ss-head .btn.icon { min-height: 34px; width: 38px; }
.ss-link { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--accent); margin: -2px 0; font-weight: 600; }
.ss-link::before, .ss-link::after { content: ""; height: 1px; flex: 1; background: #3a4a1a; }
.ss-badge { display: inline-grid; place-items: center; min-width: 26px; height: 22px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); font: 700 12px/1 var(--body); margin-right: 8px; vertical-align: 2px; padding: 0 5px; }
.set-n { background: none; border: 0; color: inherit; font: inherit; padding: 10px 0; width: 100%; cursor: pointer; }
.sets tr.next .input { border-color: var(--accent); }
.sets tr.drop td:first-child { color: var(--drop); }
.sets tr.drop td:nth-child(2) { padding-left: 12px; }
.sets tr.drop .input { border-style: dashed; border-color: var(--drop-line); }
.sets tr.drop.done .input { background: var(--drop-bg); border-color: #6b5a20; border-style: solid; }
.sets tr.drop.next .input { border-color: var(--drop); }
.sets tr.drop select.input { opacity: .35; }
.sets tr.drop-add td { padding-top: 0; }
.drop-add button { background: none; border: 0; color: var(--drop); font-weight: 600; font-size: 13px; padding: 0 0 6px 12px; cursor: pointer; }
.drop-tag { display: inline-block; font: 600 11px/1 var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--drop); border: 1px solid var(--drop-line); border-radius: 999px; padding: 5px 8px; margin-top: 8px; }
.wk-next { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 8px 10px; border-radius: 12px; background: #1c2310; border: 1px solid #3a4a1a; }
.wk-next .tiny { color: var(--muted); font-weight: 600; }
.wk-next .arrow { font-size: 20px; color: var(--accent); }
.wk-next b { display: block; }
.wk-next.drop { background: var(--drop-bg); border-color: var(--drop-line); }
.wk-next.drop .arrow { color: var(--drop); }
.rest-lbl { opacity: .6; font-weight: 600; line-height: 1.3; text-transform: uppercase; }
.choice.ss-pick { display: flex; align-items: center; gap: 12px; text-align: left; line-height: 1.3; }
.ss-pick small { display: block; margin-top: 3px; }
.ss-pick .box { width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--line); flex: none; display: grid; place-items: center; }
.ss-pick .box.plus { border-style: dashed; color: var(--muted); }
.ss-pick[aria-pressed="true"] .box { background: var(--accent); border-color: var(--accent); }
.set-sheet .btn { justify-content: flex-start; text-align: left; }
.set-sheet .btn small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; margin-top: 2px; }
.log tr.log-drop td { color: var(--drop); padding-left: 14px; }
.ss-eyebrow { color: var(--accent); }
.session-list li.ss { border-left: 2px solid var(--accent); padding-left: 8px; margin-left: -10px; }
.ss-mini { font: 600 10px/1 var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-left: 8px; }

/* Guest mode */
.guest-cta { padding-top: 18px; border-top: 1px solid var(--line); }
.guest-banner { display: grid; gap: 10px; }
.drop-btn { color: var(--drop); }

/* Today: one way in. "Start a workout" opens the chooser. */
.go-btn { min-height: 60px; font-size: 18px; border-radius: 16px; }
.start-sheet .pick-sec { font: 600 12px/1 var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 8px 0 -2px; }
.plan-pick { display: block; width: 100%; text-align: left; border: 1px solid var(--accent); background: #1c2310; border-radius: 16px; padding: 14px 16px; cursor: pointer; color: inherit; }
.plan-pick .eyebrow { color: var(--accent); margin-bottom: 6px; }
.plan-pick b { font-size: 22px; display: block; margin-bottom: 4px; }
.plan-pick small { color: var(--muted); font-size: 14px; line-height: 1.4; }
.sess { display: flex; gap: 12px; align-items: center; text-align: left; width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px; cursor: pointer; color: inherit; }
.sess .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font: 700 13px/1 var(--body); flex: none; }
.sess .ic.kb { background: #2a2410; color: #f0c043; }
.sess .ic.core { background: #10222a; color: #5cc2f0; }
.sess b { display: block; }
.sess small { color: var(--muted); font-size: 13px; }
.sess .go { margin-left: auto; color: var(--muted); }
.tile-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { display: flex; flex-direction: column; text-align: left; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px; cursor: pointer; color: inherit; }
.tile b { display: block; }
.tile small { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ── Quick sessions ─────────────────────────────────────── */
.sess .ic.hiit { background: #2a1414; color: #f07a5c; }
.sess .ic.free { background: #1c2310; color: var(--accent); }
.ghost-sess { background: transparent; border-style: dashed; }
.back-link { text-decoration: none; }
.rounds { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 8px; }
.rounds button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 10px 6px; cursor: pointer; text-align: center; color: inherit; }
.rounds button b { display: block; font-size: 18px; }
.rounds button small { color: var(--muted); font-size: 12px; }
.rounds button[aria-pressed="true"] { border-color: var(--accent); background: #1c2310; }
.bells { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bells label span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.rmoves { list-style: none; padding: 0; margin: 8px 0 0; }
.rmoves li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 15px; }
.rmoves li .n { width: 20px; flex: none; color: var(--muted); font-size: 13px; text-align: right; }
.rmoves li .grow { min-width: 0; }
.rmoves li small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.rmoves li .t { margin-left: auto; color: var(--muted); font-size: 13.5px; text-align: right; flex: none; max-width: 48%; }
.rmoves .linkish { text-align: left; }
.bell-lv { color: #f0c043; font-weight: 600; letter-spacing: .04em; }
.name-input { font-size: 22px; font-weight: 700; }
.fmt { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fmt button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 10px 12px; text-align: left; color: inherit; cursor: pointer; }
.fmt button b { display: block; }
.fmt button small { color: var(--muted); font-size: 12.5px; }
.fmt button[aria-pressed="true"] { border-color: var(--accent); background: #1c2310; }
.step { display: flex; align-items: center; gap: 6px; }
.step button { width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: inherit; font-size: 18px; cursor: pointer; }
.step b { min-width: 54px; text-align: center; font-size: 18px; }
.wk-block { padding: 10px 2px 0; }
.wk-block h3 { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.wk-block p { margin: 4px 0 0; }
.timer-card { border-color: #1f3a4a; background: linear-gradient(180deg, #10222a, var(--surface)); }
.timer-done { font-weight: 600; color: var(--accent); }

/* Interval timer */
.player { position: fixed; inset: 0; z-index: 40; background: #0b0d0f; display: flex; flex-direction: column; gap: 14px;
  padding: calc(env(safe-area-inset-top) + 14px) 20px calc(env(safe-area-inset-bottom) + 22px); max-width: 560px; margin: 0 auto; }
.ptop { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ptop-info { text-align: center; }
.segbar { display: flex; gap: 3px; }
.segbar i { height: 4px; flex: 1; border-radius: 2px; background: var(--line); }
.segbar i.on { background: var(--accent); }
.segbar i.cur { background: #f0c043; }
.ring { position: relative; width: min(68vw, 270px); aspect-ratio: 1; margin: 2px auto 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 12; }
.ring .ring-bg { stroke: #22262b; }
.ring .ring-fg { stroke-linecap: round; transition: stroke-dashoffset .2s linear; }
.ring-t { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-t .ph { font: 700 13px/1 var(--body); letter-spacing: .12em; }
.ring-t .tt { font: 600 clamp(52px, 17vw, 76px)/1.05 'Space Grotesk', sans-serif; display: block; }
.now { display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 10px; min-height: 104px; }
.now img { width: 84px; height: 84px; border-radius: 12px; object-fit: contain; background: #dceefa; flex: none; }
.now-n { font-size: 20px; display: block; line-height: 1.2; }
.now-l { font-weight: 600; letter-spacing: .06em; }
.pnext { text-align: center; min-height: 20px; }
.ctrls { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 10px; margin-top: auto; }
.ctrls .btn { min-height: 56px; font-size: 17px; }

/* 0.15.1 */
/* Start a workout opens as its own full page, not a sheet over Today */
.modal-back:has(> .modal.full) { background: var(--bg); align-items: stretch; animation: none; }
.modal.full { width: min(560px, 100%); height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; background: var(--bg);
  padding: calc(18px + env(safe-area-inset-top, 0px)) 16px calc(24px + var(--safe-b)); animation: fade .15s; }
/* Quick remove in the workout editor */
.rmoves.edit li { gap: 8px; }
.rm-x { width: 34px; height: 34px; flex: none; border-radius: 10px; border: 1px solid #4a2626; background: transparent; color: var(--danger); font-size: 15px; cursor: pointer; }
/* Toasts clear the iPhone status bar; undo button inside */
.toast { top: calc(12px + env(safe-area-inset-top, 0px)); }
.toast.with-undo { display: flex; align-items: center; gap: 14px; }
.toast-undo { background: none; border: 0; color: var(--accent); font-weight: 700; font-size: 14px; padding: 2px 0; cursor: pointer; }
/* Keep page content from showing through the status bar when scrolled */
body::before { content: ""; position: fixed; top: 0; left: 0; right: 0; height: env(safe-area-inset-top, 0px); background: var(--bg); z-index: 35; pointer-events: none; }
/* Timer icons and change-of-phase flash (helps when the phone is on silent) */
.ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; display: block; }
.ctrls .ico { width: 26px; height: 26px; }
.player.flash { animation: flash-work .6s ease-out; }
.player.flash-rest { animation: flash-rest .6s ease-out; }
@keyframes flash-work { from { background: #2c3a0c; } to { background: #0b0d0f; } }
@keyframes flash-rest { from { background: #0f2a38; } to { background: #0b0d0f; } }
/* Plans: sets × reps and next weight beside each exercise */
.session-list { gap: 0; }
.session-list li { padding: 7px 0; border-top: 1px solid var(--line); }
.session-list li:first-child { border-top: 0; }
.session-list li > .grow { display: inline; }
.sl-rx { float: right; margin-left: 10px; text-align: right; color: var(--text); font-size: 13.5px; line-height: 1.3; }
.sl-rx small { display: block; color: var(--muted); font-size: 12px; }
