/* ---- fonts (bundled, so they work offline; SIL OFL, see fonts/) --------- */

@font-face { font-family: 'Anton'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/anton-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Anton'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/anton-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/inter-latin-wght-normal.woff2) format('woff2-variations'), url(fonts/inter-latin-wght-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/inter-latin-ext-wght-normal.woff2) format('woff2-variations'), url(fonts/inter-latin-ext-wght-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

/* ---- tokens ------------------------------------------------------------ */

:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #efefec;
  --surface-3: #e4e4e0;
  --line: rgba(0, 0, 0, .07);
  --edge: rgba(0, 0, 0, .11);
  --text: #111113;
  --muted: #6c6c72;
  --faint: #b4b4b9;
  --accent: #c8f53a;
  --accent-ink: #111113;
  --accent-text: #4a7c00;
  --accent-soft: rgba(132, 196, 0, .14);
  --orb: #7fb800;
  --pr: #c98200;
  --pr-soft: rgba(230, 160, 0, .16);
  --toast-action: #a8d81c;
  --down: #d6453a;
  --warn: #e58a00;
  --shadow: 0 10px 30px rgba(0, 0, 0, .10), 0 2px 6px rgba(0, 0, 0, .05);
  --radius: 18px;
  --display: 'Anton', 'Bebas Neue', Impact, 'Arial Narrow', sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --tabs-h: 64px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: light;
}

/* Dark palette: follows the system setting unless the host forces a theme
   with data-theme, which wins in both directions. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0b;
    --surface: #141416;
    --surface-2: #1c1c1f;
    --surface-3: #27272b;
    --line: rgba(255, 255, 255, .07);
    --edge: rgba(255, 255, 255, .10);
    --text: #f2f2f3;
    --muted: #8b8b92;
    --faint: #4a4a50;
    --accent: #d4ff3a;
    --accent-ink: #0a0a0b;
    --accent-text: #d4ff3a;
    --accent-soft: rgba(212, 255, 58, .10);
    --orb: #d4ff3a;
    --pr: #ffc53d;
    --pr-soft: rgba(255, 197, 61, .13);
    --toast-action: #4a7c00;
    --down: #ff6b5e;
    --warn: #ffb547;
    --shadow: 0 12px 34px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0a0b;
  --surface: #141416;
  --surface-2: #1c1c1f;
  --surface-3: #27272b;
  --line: rgba(255, 255, 255, .07);
  --edge: rgba(255, 255, 255, .10);
  --text: #f2f2f3;
  --muted: #8b8b92;
  --faint: #4a4a50;
  --accent: #d4ff3a;
  --accent-ink: #0a0a0b;
  --accent-text: #d4ff3a;
  --accent-soft: rgba(212, 255, 58, .10);
  --orb: #d4ff3a;
  --pr: #ffc53d;
  --pr-soft: rgba(255, 197, 61, .13);
  --toast-action: #4a7c00;
  --down: #ff6b5e;
  --warn: #ffb547;
  --shadow: 0 12px 34px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

/* ---- base -------------------------------------------------------------- */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--body);
  font-feature-settings: 'cv11', 'ss03'; /* Inter: open digits, single-storey a */
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--tabs-h) + 12px + env(safe-area-inset-bottom));
  transition: padding-bottom .3s var(--ease);
}
body.timer-on { padding-bottom: calc(var(--tabs-h) + 104px + env(safe-area-inset-bottom)); }

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { opacity: .35; cursor: default; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }

/* Display face: titles and the big numbers. Anton has one (heavy) weight. */
.topbar h1, .sheet h2, .hero h2, .title-input, .focus-title b, .timer-clock,
.tile b, .week-head b, .chart-head .big b, .date-block b, .focus-weight b, .orb-num {
  font-family: var(--display); font-weight: 400; letter-spacing: .01em;
}
a { color: inherit; text-decoration: none; }
svg { display: block; }
.num { font-variant-numeric: tabular-nums; }

/* every tappable thing gives way a little under the thumb */
.btn, .chip, .icon-btn, .row-item, .check, .day, .pick, .seg-opt, .tabs a {
  transition: transform .15s var(--ease), background-color .2s, color .2s, opacity .2s;
}
.btn:active, .chip:active, .icon-btn:active, .row-item:active, .pick:active { transform: scale(.96); }

/* ---- top bar ----------------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: calc(14px + env(safe-area-inset-top)) 16px 12px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
}
.titles { flex: 1; min-width: 0; }
.topbar h1 {
  margin: 0; font-size: 1.85rem; line-height: 1.1; text-transform: uppercase;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.subtitle { font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: 6px; min-height: 0; }
.subtitle:empty { display: none; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: live 2s infinite; }
#top-actions { display: flex; gap: 6px; align-items: center; }

.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--line); opacity: 0; transition: opacity .3s; }
.progress.on { opacity: 1; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 0 2px 2px 0; transition: width .6s var(--ease); }

/* ---- layout ------------------------------------------------------------ */

main { padding: 8px 16px 16px; max-width: 640px; margin: 0 auto; outline: none; }
main.enter > * { animation: rise .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms); }

.section-title {
  margin: 26px 4px 10px; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .09em; color: var(--muted);
}
.section-title:first-child { margin-top: 8px; }
.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 12px; }
.empty b { color: var(--text); display: block; font-size: 1.05rem; margin-bottom: 4px; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.stack > * + * { margin-top: 10px; }

.group { background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.group + .group { margin-top: 12px; }

/* list row used by sheets, history, records, settings */
.row-item {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 14px 16px; min-height: 60px; text-align: left; background: var(--surface);
}
.group .row-item + .row-item { box-shadow: inset 0 1px 0 var(--line); }
.row-item .t { font-weight: 650; letter-spacing: -.01em; }
.row-item .m { font-size: .85rem; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { width: 18px; height: 18px; fill: none; stroke: var(--faint); stroke-width: 2; flex: none; }
.row-item.danger .t { color: var(--down); }

/* ---- buttons ----------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 20px; border-radius: 14px;
  background: var(--surface-2); font-weight: 650; letter-spacing: -.01em;
  box-shadow: inset 0 0 0 1px var(--edge);
}
/* Filled buttons: no outline, a faint lower edge for depth instead. */
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .14), inset 0 1px 0 rgba(255, 255, 255, .35); }
.btn.danger { background: var(--down); color: #fff; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .16); }
.btn.ghost { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--edge); }
.btn.block { width: 100%; }
.btn.small { min-height: 38px; padding: 0 14px; border-radius: 12px; font-size: .9rem; }
.btn svg, .icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.solid { background: var(--accent); color: var(--accent-ink); }

.chip {
  min-height: 38px; padding: 0 16px; border-radius: 999px;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--edge); font-weight: 650; font-size: .9rem; font-variant-numeric: tabular-nums;
}
.chip.on { background: var(--accent); color: var(--accent-ink); box-shadow: none; }

/* ---- week strip (start screen) ----------------------------------------- */

.week { background: var(--surface); border-radius: var(--radius); padding: 16px; }
.week-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.week-head b { font-size: 1.7rem; line-height: 1; font-variant-numeric: tabular-nums; }
.week-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .7rem; color: var(--muted); font-weight: 600; }
.day i { width: 100%; max-width: 34px; aspect-ratio: 1; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; }
.day.on i { background: var(--accent); animation: pop .5s var(--spring) both; animation-delay: calc(var(--i) * 50ms + 150ms); }
.day.on i::after { content: ""; width: 10px; height: 6px; border: solid var(--accent-ink); border-width: 0 0 2.5px 2.5px; transform: translateY(-1px) rotate(-45deg); }
.day.today { color: var(--text); }
.day.today i { box-shadow: inset 0 0 0 2px var(--surface-3); }
.day.today.on i { box-shadow: none; }

.play { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.play svg { width: 16px; height: 16px; fill: currentColor; margin-left: 2px; }

/* ---- active workout ---------------------------------------------------- */

.ex { background: var(--surface); border-radius: var(--radius); margin-bottom: 12px; scroll-margin-top: 96px; transition: box-shadow .4s; }
.ex.just-done { animation: done-flash 1s var(--ease); }
.ex-head { display: flex; align-items: center; gap: 10px; padding: 14px 8px 12px 16px; cursor: pointer; user-select: none; }
.ex-head h3 { margin: 0; font-size: 1.05rem; font-weight: 700; letter-spacing: -.015em; }
.ex-meta { font-size: .82rem; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-badge { display: none; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); place-items: center; flex: none; }
.ex-badge svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.ex.complete .ex-badge { display: grid; }
.ex.complete .ex-head h3 { color: var(--muted); }

.dots { display: flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--surface-3); transition: background .3s, transform .3s var(--spring); }
.dots i.on { background: var(--accent); }
.dots i.pr { background: var(--pr); }
.ex.complete .dots { display: none; }

.ex-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .45s var(--ease), opacity .3s; }
.ex.collapsed .ex-body { grid-template-rows: 0fr; opacity: 0; }
.ex-inner { overflow: hidden; min-height: 0; padding: 0 12px 2px; }
.ex.collapsed .ex-inner { pointer-events: none; }

.set-row {
  position: relative;
  display: grid; grid-template-columns: 26px minmax(60px, 1fr) minmax(64px, 1.15fr) minmax(52px, 1fr) 46px;
  gap: 8px; align-items: center; padding: 5px 6px; border-radius: 14px; margin-bottom: 4px;
  transition: background-color .35s;
}
.set-row.head { font-size: .68rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding-bottom: 2px; }
.set-row.head span:nth-child(n+3) { text-align: center; }
.set-row.done { background: var(--accent-soft); }
.set-row.next::before {
  content: ""; position: absolute; left: -6px; top: 12px; bottom: 12px; width: 3px; border-radius: 3px;
  background: var(--accent); animation: rise .4s var(--ease) both;
}

.n { text-align: center; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; font-size: .9rem; }
.set-row.next .n { color: var(--text); }
.pr-tag {
  display: inline-block; font-size: .6rem; font-weight: 800; letter-spacing: .04em; color: var(--pr);
  background: var(--pr-soft); border-radius: 6px; padding: 2px 3px;
}
.pr-tag.pop { animation: pr-pop .7s var(--spring) both; }

.prev {
  display: flex; align-items: center; gap: 5px; min-height: 44px; text-align: left;
  font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.tr { width: 0; height: 0; border: 4.5px solid transparent; flex: none; }
.tr.up { border-bottom: 6px solid var(--accent-text); border-top-width: 0; animation: nudge-up .5s var(--spring) both; }
.tr.down { border-top: 6px solid var(--down); border-bottom-width: 0; animation: nudge-down .5s var(--spring) both; }
.tr.same { width: 8px; height: 2px; border: 0; background: var(--faint); border-radius: 2px; }

.set-row input {
  width: 100%; min-height: 44px; padding: 6px 4px; text-align: center;
  border: 0; border-radius: 12px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--edge);
  font-size: 1.05rem; font-weight: 650; font-variant-numeric: tabular-nums;
  transition: background-color .25s, box-shadow .2s;
}
.set-row input::placeholder { color: var(--faint); font-weight: 500; }
.set-row input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent-text); background: var(--surface); }
.set-row.done input { background: transparent; box-shadow: none; }

.check {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  background: var(--surface-2); color: transparent; justify-self: end;
  box-shadow: inset 0 0 0 1px var(--edge);
}
.check svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; stroke-dashoffset: 0; }
.set-row.next .check { box-shadow: inset 0 0 0 2px var(--accent-text); }
.check.on { background: var(--accent); color: var(--accent-ink); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .14); }
.check.on.pop { animation: pop .45s var(--spring); }
.check.on.pop svg { animation: draw .35s .08s var(--ease) both; }

.add-set { width: 100%; min-height: 44px; margin: 4px 0 12px; border-radius: 12px; color: var(--muted); font-weight: 600; font-size: .9rem; }
.add-set:active { background: var(--surface-2); }

.add-ex { display: flex; gap: 10px; margin: 16px 0 12px; }
.add-ex input {
  flex: 1; min-height: 50px; padding: 0 16px; border-radius: 14px;
  border: 1px solid var(--edge); background: transparent; font-weight: 600;
}
.add-ex input:focus { outline: none; border-color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent-text); }

/* ---- floating rest timer ----------------------------------------------- */

.timer {
  position: fixed; z-index: 6; left: 12px; right: 12px; max-width: 616px; margin: 0 auto;
  bottom: calc(var(--tabs-h) + 10px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 12px;
  border-radius: 22px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(20px) saturate(1.5); -webkit-backdrop-filter: blur(20px) saturate(1.5);
  box-shadow: var(--shadow), inset 0 0 0 1px var(--line);
  transform: translateY(calc(100% + 30px)) scale(.96); opacity: 0; pointer-events: none;
  transition: transform .45s var(--spring), opacity .25s, background-color .3s;
}
.timer.show { transform: none; opacity: 1; pointer-events: auto; }
.ring { width: 48px; height: 48px; flex: none; }
.ring svg { width: 48px; height: 48px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4.5; }
.ring .track { stroke: var(--surface-3); }
.ring .arc { stroke: var(--accent-text); stroke-linecap: round; stroke-dasharray: 125.66; transition: stroke-dashoffset .3s linear, stroke .3s; }
.timer-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.timer-label { font-size: .72rem; color: var(--muted); font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer-clock { font-size: 1.9rem; line-height: 1.05; font-variant-numeric: tabular-nums; }
.timer .chip { padding: 0 12px; }
.timer.warn .arc { stroke: var(--warn); }
.timer.warn .timer-clock { color: var(--warn); animation: beat 1s infinite; }
.timer.done { background: var(--accent); color: var(--accent-ink); }
.timer.done .timer-label, .timer.done .icon-btn { color: var(--accent-ink); }
.timer.done .chip { background: rgba(0, 0, 0, .1); }
.timer.done .arc { stroke: var(--accent-ink); }
.timer.done .track { stroke: rgba(0, 0, 0, .15); }
.timer.done .timer-clock { animation: pop .5s var(--spring); }

.glow { position: fixed; inset: 0; z-index: 4; pointer-events: none; opacity: 0; box-shadow: inset 0 0 0 0 var(--accent); }
.glow.go { animation: glow 1.4s var(--ease); }

/* ---- tabs -------------------------------------------------------------- */

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 7;
  display: flex; height: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  padding: 0 8px env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
  box-shadow: inset 0 1px 0 var(--line);
}
.tabs a {
  position: relative; z-index: 1; flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--muted); font-size: .7rem; font-weight: 650;
}
.tabs a svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s var(--spring); }
.tabs a.on { color: var(--text); }
.tabs a.on svg { transform: translateY(-1px) scale(1.06); }
.tabs a.live::after {
  content: ""; position: absolute; top: 10px; left: calc(50% + 10px);
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: live 2s infinite;
}
.tab-ind {
  position: absolute; top: 8px; left: 8px; width: calc((100% - 16px) / 4); height: 32px;
  display: flex; justify-content: center; pointer-events: none;
  transform: translateX(calc(var(--tab, 0) * 100%)); transition: transform .45s var(--spring);
}
.tab-ind::before { content: ""; width: 58px; height: 32px; border-radius: 999px; background: var(--accent-soft); }

/* ---- bottom sheet ------------------------------------------------------ */

.sheet-wrap { position: fixed; inset: 0; z-index: 20; }
.scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); opacity: 0; transition: opacity .3s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: 640px; margin: 0 auto;
  max-height: 85vh; overflow: auto;
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
  background: var(--surface); border-radius: 24px 24px 0 0; box-shadow: var(--shadow);
  transform: translateY(100%); transition: transform .4s var(--ease);
}
.sheet::before { content: ""; display: block; width: 38px; height: 4px; border-radius: 4px; background: var(--surface-3); margin: 0 auto 14px; }
.sheet-wrap.open .scrim { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.sheet h2 { margin: 0 4px 8px; font-size: 1.45rem; line-height: 1.15; }
.sheet p { margin: 0 4px 18px; color: var(--muted); }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px; }
.menu { display: flex; flex-direction: column; margin-top: 6px; }
.menu button { display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 0 6px; border-radius: 12px; font-weight: 600; text-align: left; }
.menu button:active { background: var(--surface-2); }
.menu button svg { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.menu button.danger { color: var(--down); }
.menu button.danger svg { stroke: var(--down); }
.picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0 4px; }
.pick { min-height: 54px; border-radius: 14px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--edge); font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.pick.on { background: var(--accent); color: var(--accent-ink); box-shadow: none; }

/* ---- toast ------------------------------------------------------------- */

.toast {
  position: fixed; z-index: 25; left: 50%;
  bottom: calc(var(--tabs-h) + 18px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 14px; max-width: calc(100% - 32px);
  padding: 12px 16px; border-radius: 14px; background: var(--text); color: var(--bg);
  font-size: .9rem; font-weight: 600; box-shadow: var(--shadow);
  transform: translate(-50%, 20px) scale(.95); opacity: 0; pointer-events: none;
  transition: transform .35s var(--spring), opacity .2s;
}
body.timer-on .toast { bottom: calc(var(--tabs-h) + 100px + env(safe-area-inset-bottom)); }
.toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast.pr { background: var(--pr); color: #1a1200; }
.toast-undo { color: var(--toast-action); font-weight: 750; text-transform: uppercase; font-size: .8rem; letter-spacing: .06em; }

/* ---- history / progress ------------------------------------------------ */

.seg { display: flex; position: relative; background: var(--surface-2); border-radius: 12px; padding: 3px; margin: 4px 0 6px; }
.seg a { flex: 1; position: relative; z-index: 1; text-align: center; padding: 8px; font-weight: 650; font-size: .9rem; color: var(--muted); transition: color .25s; }
.seg a.on { color: var(--text); }
.seg::before {
  content: ""; position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px);
  background: var(--surface); border-radius: 9px; box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
  transform: translateX(calc(var(--seg, 0) * 100%)); transition: transform .4s var(--spring);
}

.date-block { width: 42px; flex: none; text-align: center; }
.date-block b { display: block; font-size: 1.5rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.date-block span { font-size: .68rem; text-transform: uppercase; color: var(--muted); font-weight: 700; letter-spacing: .06em; }

.delta { font-size: .78rem; font-weight: 700; padding: 3px 7px; border-radius: 8px; font-variant-numeric: tabular-nums; flex: none; }
.delta.up { color: var(--accent-text); background: var(--accent-soft); }
.delta.down { color: var(--down); background: color-mix(in srgb, var(--down) 12%, transparent); }
.delta.same { color: var(--muted); background: var(--surface-2); }
.pr-pill { font-size: .7rem; font-weight: 800; color: var(--pr); background: var(--pr-soft); padding: 3px 7px; border-radius: 8px; flex: none; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tile { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; }
.tile span { display: block; font-size: .72rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.tile b { display: block; font-size: 2rem; line-height: 1.1; font-variant-numeric: tabular-nums; margin-top: 2px; }
.tile b small { font-family: var(--body); font-size: .9rem; color: var(--muted); font-weight: 600; margin-left: 4px; letter-spacing: 0; }
.tile.pr b { color: var(--pr); }

.hero { text-align: center; padding: 18px 0 22px; }
.hero-check { width: 76px; height: 76px; margin: 0 auto 12px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; animation: pop .6s var(--spring) both; }
.hero-check svg { width: 38px; height: 38px; fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; animation: draw .5s .25s var(--ease) both; }
.hero h2 { margin: 0; font-size: 2rem; line-height: 1.1; text-transform: uppercase; }
.hero p { margin: 4px 0 0; color: var(--muted); }

.log { padding: 14px 16px; }
.log + .log { box-shadow: inset 0 1px 0 var(--line); }
.log-sets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.log-sets span { font-size: .85rem; padding: 4px 9px; border-radius: 8px; background: var(--surface-2); font-variant-numeric: tabular-nums; font-weight: 600; }
.log-sets span.pr { background: var(--pr-soft); color: var(--pr); }

/* trend chart */
.chart { background: var(--surface); border-radius: var(--radius); padding: 16px 16px 10px; }
.chart-head span { font-size: .72rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.chart-head .big { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; }
.chart-head .big b { font-size: 2.2rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.plot { position: relative; margin-top: 10px; touch-action: pan-y; }
.plot svg { width: 100%; overflow: visible; }
.plot .grid line { stroke: var(--line); stroke-width: 1; }
.plot .axis text { fill: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.plot .line { fill: none; stroke: var(--accent-text); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.plot .line.draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: line-draw 1s .1s var(--ease) forwards; }
.plot .area { fill: var(--accent-soft); }
.plot .last { fill: var(--accent-text); stroke: var(--surface); stroke-width: 2.5; }
.plot .cross { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 3 3; }
.plot .hover-dot { fill: var(--surface); stroke: var(--accent-text); stroke-width: 2.5; }
.tip {
  position: absolute; top: -6px; transform: translate(-50%, -100%); pointer-events: none;
  background: var(--text); color: var(--bg); border-radius: 8px; padding: 5px 8px; font-size: .78rem; font-weight: 650;
  white-space: nowrap; font-variant-numeric: tabular-nums; opacity: 0; transition: opacity .15s;
}
.tip.on { opacity: 1; }
.spark { width: 64px; height: 26px; flex: none; }
.spark path { fill: none; stroke: var(--accent-text); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spark circle { fill: var(--accent-text); }

/* ---- sheet editor ------------------------------------------------------ */

.title-input {
  width: 100%; border: 0; background: transparent; padding: 6px 4px; border-radius: 10px;
  font-size: 1.85rem; line-height: 1.15; text-transform: uppercase;
}
.title-input:focus { outline: none; background: var(--surface); }
.tpl { background: var(--surface); border-radius: var(--radius); padding: 8px 10px 14px 16px; margin-bottom: 12px; }
.tpl .name { flex: 1; min-width: 0; border: 0; background: transparent; font-weight: 700; font-size: 1.05rem; padding: 8px 0; }
.tpl .name:focus { outline: none; }
.tpl .name::placeholder { color: var(--faint); }
.tpl-nums { display: flex; gap: 10px; padding-right: 6px; }
.mini { flex: 1; display: flex; align-items: baseline; gap: 6px; background: var(--surface-2); border-radius: 12px; padding: 0 12px; box-shadow: inset 0 0 0 1px var(--edge); }
.mini input { width: 100%; min-width: 0; border: 0; background: transparent; padding: 10px 0; font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.mini input:focus { outline: none; }
.mini:focus-within { box-shadow: inset 0 0 0 2px var(--accent-text); }
.mini span { font-size: .78rem; color: var(--muted); font-weight: 600; white-space: nowrap; }

/* ---- settings ---------------------------------------------------------- */

.toggle { position: relative; width: 50px; height: 30px; flex: none; }
.toggle input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.toggle i { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); transition: background-color .25s; pointer-events: none; }
.toggle i::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .35s var(--spring);
}
.toggle input:checked + i { background: var(--accent); }
.toggle input:checked + i::after { transform: translateX(20px); }
.toggle input:focus-visible + i { outline: 2px solid var(--accent-text); outline-offset: 2px; }

.seg-mini { display: flex; gap: 2px; background: var(--surface-2); border-radius: 11px; padding: 3px; flex: none; box-shadow: inset 0 0 0 1px var(--edge); }
.seg-mini label { position: relative; }
.seg-mini input { position: absolute; opacity: 0; }
.seg-mini span { display: block; padding: 6px 14px; border-radius: 8px; font-weight: 700; font-size: .9rem; color: var(--muted); transition: background-color .2s, color .2s; }
.seg-mini input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.value { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- motion ------------------------------------------------------------ */

@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes draw { from { stroke-dashoffset: 24; } to { stroke-dashoffset: 0; } }
@keyframes pr-pop { 0% { transform: scale(0) rotate(-20deg); } 60% { transform: scale(1.35) rotate(6deg); } 100% { transform: none; } }
@keyframes nudge-up { from { transform: translateY(5px); opacity: 0; } }
@keyframes nudge-down { from { transform: translateY(-5px); opacity: 0; } }
@keyframes live { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }
@keyframes beat { 0%, 100% { transform: none; } 15% { transform: scale(1.08); } }
@keyframes glow { 0% { opacity: 0; box-shadow: inset 0 0 0 0 var(--accent); } 20% { opacity: 1; box-shadow: inset 0 0 50px 6px var(--accent); } 100% { opacity: 0; box-shadow: inset 0 0 80px 0 var(--accent); } }
@keyframes done-flash { 0% { box-shadow: 0 0 0 0 var(--accent); } 30% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes line-draw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}

/* ---- guided mode ------------------------------------------------------- */

.guided-cta {
  display: flex; align-items: center; gap: 14px; margin-bottom: 14px; padding: 16px;
  border-radius: var(--radius); background: var(--accent-soft);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent-text) 35%, transparent);
  transition: transform .15s var(--ease);
}
.guided-cta:active { transform: scale(.98); }
.guided-cta b { display: block; font-size: 1.05rem; letter-spacing: -.01em; }
.guided-cta .grow > span { font-size: .85rem; color: var(--muted); }
.guided-cta .play { animation: live 2.4s infinite; }

body.focus-on { overflow: hidden; }
body.focus-on .timer, body.focus-on .toast-undo { display: none; }
body.focus-on .toast { bottom: calc(150px + env(safe-area-inset-bottom)); }

.focus {
  position: fixed; inset: 0; z-index: 15; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  height: 100vh; height: 100dvh;
  padding: calc(10px + env(safe-area-inset-top)) 20px calc(16px + env(safe-area-inset-bottom));
  background: var(--bg);
  opacity: 0; transform: translateY(24px) scale(.98);
  transition: opacity .3s var(--ease), transform .4s var(--ease), background-color .6s;
}
.focus.show { opacity: 1; transform: none; }
.focus > * { width: 100%; max-width: 480px; flex: none; }

.focus-top { display: flex; align-items: center; gap: 6px; }
.focus-title { flex: 1; min-width: 0; text-align: center; }
.focus-title b { display: block; font-size: 1.4rem; line-height: 1.15; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.focus-title span { font-size: .8rem; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
#f-voice .slash { display: none; }
#f-voice.off .slash { display: block; }
#f-voice.off .wave { display: none; }

/* Two equal halves: movement demo / timer. Each half sizes its content to
   fit with container units, so nothing overflows on short screens. */
.focus-stage {
  flex: 1 1 0; min-height: 0;
  display: grid; grid-template-rows: 1fr 1fr; gap: 14px;
}
.focus-media, .focus-timer { min-height: 0; container-type: size; }
.focus-media { display: grid; place-items: center; }
.focus-timer { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
@media (orientation: landscape) and (min-aspect-ratio: 5/4) {
  .focus > * { max-width: 920px; }
  .focus-stage { grid-template-rows: 1fr; grid-template-columns: 1fr 1fr; }
}

.media-frame {
  position: relative; margin: 0; width: min(46vw, 210px); aspect-ratio: 1; border-radius: 22px; overflow: hidden;
  background: #fff; box-shadow: 0 0 0 1px var(--line);
  animation: rise .5s var(--ease) both;
}
.focus-media .media-frame, .focus-media .find-demo { width: min(100cqw, 100cqh); max-width: 100%; }
.media-frame :is(img, video) { width: 100%; height: 100%; object-fit: contain; display: block; }
.media-frame figcaption {
  position: absolute; right: 8px; bottom: 6px; font-size: .58rem; font-weight: 700; letter-spacing: .04em;
  color: #6c6c72; background: rgba(255, 255, 255, .85); padding: 2px 6px; border-radius: 6px;
}
.media-frame.big { width: 100%; max-width: 320px; margin: 4px auto 14px; }
.focus[data-kind="rest"] .media-frame { animation: rise .5s var(--ease) both; box-shadow: 0 0 0 2px var(--accent-text); }

.find-demo {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  aspect-ratio: 1; border-radius: 22px; color: var(--muted);
  border: 1px solid var(--edge); font-weight: 600; font-size: .85rem;
}
.find-demo svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }

/* the breath orb: fits its half, leaving room for the two lines under it */
.orb-wrap {
  position: relative; display: block; flex: none; container-type: inline-size;
  width: min(100cqw, calc(100cqh - 64px), 300px); aspect-ratio: 1; border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
}
.orb-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.orb-ring circle { fill: none; stroke-width: 2.5; }
.orb-ring .track { stroke: var(--surface-3); }
.orb-ring .arc { stroke: var(--accent-text); stroke-linecap: round; stroke-dasharray: 289.03; stroke-dashoffset: 289.03; transition: stroke .3s; }
.orb {
  position: absolute; inset: 9%; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--orb) 55%, transparent), color-mix(in srgb, var(--orb) 14%, transparent) 70%);
  box-shadow: 0 0 60px -10px color-mix(in srgb, var(--orb) 60%, transparent);
  transform: scale(.35); will-change: transform;
}
.focus[data-phase="exhale"] .orb { background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--orb) 40%, transparent), color-mix(in srgb, var(--orb) 8%, transparent) 70%); }
.focus[data-kind="rest"] .orb, .focus[data-kind="lead"] .orb {
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--text) 16%, transparent), color-mix(in srgb, var(--text) 4%, transparent) 70%);
  box-shadow: none;
}
/* The number sits on the exact centre; its label hangs below it. */
.orb-num {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  font-size: 26cqw; line-height: 1; font-variant-numeric: tabular-nums;
}
.orb-label {
  position: absolute; left: 0; right: 0; top: calc(50% + 15cqw); text-align: center; pointer-events: none;
  font-size: max(.7rem, 4.6cqw); color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .1em;
}
.focus.warn .orb-ring .arc { stroke: var(--warn); }
.focus.warn .orb-num { color: var(--warn); animation: beat 1s infinite; }
.focus[data-status="paused"] .orb-num { opacity: .45; }

.focus-phase { margin-top: 10px; text-align: center; font-size: 1.2rem; font-weight: 700; letter-spacing: -.015em; min-height: 1.6rem; }
.focus-next { text-align: center; color: var(--muted); font-size: .88rem; min-height: 1.25rem; font-variant-numeric: tabular-nums; }

.focus-adjust { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 4px; }
.focus-weight { display: flex; align-items: center; gap: 20px; }
.focus-weight b { font-size: 2rem; font-variant-numeric: tabular-nums; }
.focus-weight span { color: var(--muted); font-weight: 600; }
.focus-weight > div { min-width: 110px; text-align: center; }
.round { width: 52px; height: 52px; border-radius: 50%; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--edge); font-size: 1.4rem; font-weight: 600; transition: transform .15s var(--ease); }
.round:active { transform: scale(.9); background: var(--surface-3); }
.focus-rest { display: flex; gap: 12px; }
.focus-controls { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; }
.focus-controls .btn[hidden] + .btn { grid-column: 1 / -1; }

/* ---- demos in lists & editor -------------------------------------------- */

.thumb {
  width: 40px; height: 40px; flex: none; border-radius: 11px; overflow: hidden; background: #fff;
  box-shadow: 0 0 0 1px var(--line); display: grid; place-items: center;
}
.thumb :is(img, video) { width: 100%; height: 100%; object-fit: cover; }
.thumb.none { background: var(--surface-2); color: var(--muted); box-shadow: none; }
.thumb.none svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.ex.complete .thumb { opacity: .5; }

.tpl-move { margin-top: 10px; align-items: center; }
.tpl-move .mini.rest { flex: 1; }
.tpl-move .mini.tempo { flex: 1.3; }
.tpl-move .seg-mini span { padding: 6px 11px; }
.mini.tempo input { font-variant-numeric: tabular-nums; letter-spacing: .02em; }

.inline-input {
  width: 96px; min-height: 42px; padding: 0 12px; border: 0; border-radius: 11px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--edge);
  text-align: center; font-weight: 700; font-variant-numeric: tabular-nums;
}
.inline-input.wide { width: 100%; text-align: left; font-weight: 600; font-size: .9rem; }
.inline-input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent-text); }

.edb-search input {
  width: 100%; min-height: 48px; padding: 0 14px; border: 0; border-radius: 14px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--edge); font-weight: 600;
}
.edb-search input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent-text); }
.edb-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; min-height: 120px; }
.edb-item { display: flex; flex-direction: column; gap: 6px; text-align: left; animation: rise .35s var(--ease) both; animation-delay: calc(var(--i) * 30ms); }
.edb-item :is(img, video) { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 14px; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.edb-item span { font-size: .75rem; font-weight: 600; line-height: 1.25; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.edb-item:active img { box-shadow: 0 0 0 3px var(--accent-text); }
.edb-msg { grid-column: 1 / -1; text-align: center; padding: 24px 8px; margin: 0; }
.edb-loading { grid-column: 1 / -1; display: flex; justify-content: center; gap: 6px; padding: 40px 0; }
.edb-loading i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-text); animation: bounce 1s infinite; }
.edb-loading i:nth-child(2) { animation-delay: .15s; }
.edb-loading i:nth-child(3) { animation-delay: .3s; }
.credit { margin: 12px 4px 0 !important; font-size: .72rem; text-align: center; }
.demo-target { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 4px 12px !important; }
.demo-target span { font-size: .78rem; font-weight: 700; padding: 4px 9px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-text); text-transform: capitalize; }
.demo-steps { margin: 0 0 18px; padding-left: 22px; color: var(--muted); font-size: .9rem; }
.demo-steps li + li { margin-top: 6px; }
.sheet-actions .btn svg { width: 18px; height: 18px; }

@keyframes bounce { 0%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-8px); opacity: 1; } }

/* ---- offline ------------------------------------------------------------ */

.net-pill {
  flex: none; align-self: center; padding: 4px 10px; border-radius: 999px;
  font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--edge);
  animation: rise .35s var(--ease) both;
}
.net-pill::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--warn); vertical-align: 1px; }
.missing-art {
  width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--muted); background: var(--surface-2); font-size: .75rem; font-weight: 600; text-align: center; padding: 8px;
}
.missing-art svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.thumb .missing-art svg { width: 18px; height: 18px; }
.media-frame.missing, .thumb.missing, .edb-item.missing { background: var(--surface-2); }
.media-frame.missing figcaption { display: none; }
.edb-item .missing-art { aspect-ratio: 1; height: auto; border-radius: 14px; }

/* ---- past workouts (manual entry) ----------------------------------------- */

.when {
  display: flex; align-items: center; gap: 14px; width: 100%; margin: 4px 0 6px; padding: 14px 16px;
  border-radius: var(--radius); background: var(--surface); text-align: left; box-shadow: inset 0 0 0 1px var(--edge);
  transition: transform .15s var(--ease);
}
.when:active { transform: scale(.98); }
.when > svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.when .t { display: block; font-weight: 650; }
.when .m { display: block; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.when-date {
  width: 52px; height: 52px; flex: none; border-radius: 14px; background: var(--accent); color: var(--accent-ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
}
.when-date b { font-family: var(--display); font-weight: 400; font-size: 1.5rem; }
.when-date span { font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; margin-top: 2px; }
.hint-line { margin: 4px 4px 14px; font-size: .82rem; color: var(--muted); }

.set-row.filled { background: var(--accent-soft); }
.set-row.filled input { box-shadow: none; background: transparent; }
.set-row.filled input:focus { background: var(--surface); box-shadow: inset 0 0 0 2px var(--accent-text); }
.set-del { width: 44px; height: 44px; justify-self: end; color: var(--faint); }
.set-del:not(:disabled):hover, .set-del:not(:disabled):active { color: var(--down); }

.draft-cta { margin-top: 6px; }
.draft-cta > svg.chev { margin-left: auto; }
.draft-cta .play svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; margin: 0; }

.when-form { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.field-pair { display: grid; grid-template-columns: 1.3fr 1fr; gap: 12px; }
.field-row { display: flex; flex-direction: column; gap: 6px; }
.field-row > span { font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding-left: 2px; }
.field-row input, .field-row select {
  width: 100%; min-height: 50px; padding: 0 14px; border: 0; border-radius: 14px;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--edge);
  font-weight: 600; font-variant-numeric: tabular-nums; appearance: none; -webkit-appearance: none;
}
.field-row select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px;
}
.field-row input:focus, .field-row select:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent-text); }
.when-form .sheet-actions { margin-top: 6px; }

/* Switching theme by hand cross-fades instead of snapping. */
.theme-fade, .theme-fade * { transition: background-color .35s ease, color .35s ease, border-color .35s ease, box-shadow .35s ease !important; }
.tpl-move .seg-mini span, .seg-mini span { white-space: nowrap; }
.btn.small svg { width: 16px; height: 16px; }

.tpl .seg-mini.kind { flex: none; }
.tpl .seg-mini.kind span { padding: 5px 10px; font-size: .82rem; }
.chart-note { margin: 10px 0 2px; font-size: .78rem; color: var(--muted); line-height: 1.45; }

/* ---- home trend card ------------------------------------------------------ */

.trend-card { background: var(--surface); border-radius: var(--radius); padding: 16px; margin-top: 12px; display: flex; flex-direction: column; gap: 14px; }
.trend-head { display: flex; flex-direction: column; gap: 2px; }
.trend-head .big { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.trend-head .big b { font-family: var(--display); font-weight: 400; font-size: 2.2rem; line-height: 1.05; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.trend-head .big small { color: var(--muted); font-weight: 600; font-size: .9rem; }
.trend-head .m { font-size: .8rem; color: var(--muted); }
.eyebrow { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

.bars { position: relative; touch-action: pan-y; }
.bars svg { width: 100%; display: block; overflow: visible; }
.bars .bar { fill: var(--accent-text); opacity: .45; transition: opacity .2s; }
.bars .bar.now { opacity: 1; }
.bars .stub { fill: var(--surface-3); }
.bars .dim { opacity: .2; }
.bars .bar.now.dim { opacity: .35; }
.bars .guide { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; }
.bars .lbl { fill: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.bars .bar { transform-box: fill-box; transform-origin: bottom; animation: grow .6s var(--ease) both; }
@keyframes grow { from { transform: scaleY(0); } }

.trend-list { display: flex; flex-direction: column; }
.trend-list .eyebrow { margin-bottom: 4px; }
.trend-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; box-shadow: inset 0 1px 0 var(--line); }
.trend-row .t { display: block; font-weight: 650; }
.trend-row .m { display: block; font-size: .8rem; color: var(--muted); }
.trend-row .delta { min-width: 58px; text-align: center; }
.trend-row .tag { display: block; font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 1px; }

/* ---- home: start buttons --------------------------------------------------- */
/* Three per line (sheets, then Empty); more sheets scroll sideways. */
.start-row {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(calc((100% - 20px) / 3), 1fr);
  gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  margin: 0 -16px; padding: 2px 16px; scroll-padding: 0 16px;
}
.start-row::-webkit-scrollbar { display: none; }
.start-btn {
  scroll-snap-align: start; min-width: 0; min-height: 68px;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px;
  padding: 12px; border-radius: var(--radius); text-align: left;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--edge);
  transition: transform .15s var(--ease), box-shadow .2s;
}
.start-btn:active { transform: scale(.96); }
.start-btn b { font-weight: 700; font-size: .98rem; line-height: 1.2; letter-spacing: -.01em; width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.start-btn .m { font-size: .76rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }
.start-btn.empty-start { background: transparent; }
.start-btn.empty-start b { color: var(--muted); }
.start-row + .trend-card, .start-row + .hint-line + .trend-card { margin-top: 16px; }

/* ---- body map (sheet page) -------------------------------------------------- */

.bodymap { background: var(--surface); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.bodymap .figs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bodymap figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bodymap svg { width: 100%; max-width: 150px; height: auto; display: block; overflow: visible; }
.bodymap figcaption { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.bodymap polygon { stroke: var(--surface); stroke-width: .6; stroke-linejoin: round; transition: fill .3s, opacity .3s; }
.bodymap polygon.base { fill: var(--surface-3); opacity: .55; }
.bodymap polygon.m { cursor: pointer; }
.bodymap .lv0 { fill: var(--surface-3); }
.bodymap .lv1 { fill: var(--accent-text); opacity: .3; }
.bodymap .lv2 { fill: var(--accent-text); opacity: .52; }
.bodymap .lv3 { fill: var(--accent-text); opacity: .76; }
.bodymap .lv4 { fill: var(--accent-text); opacity: 1; }
.bodymap polygon.sel { stroke: var(--text); stroke-width: 1.4; opacity: 1; }
.bodymap polygon.lv0.sel { fill: var(--surface-3); }
.map-legend { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 6px; font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.map-legend span { margin-right: 4px; font-weight: 650; }
.map-legend i { width: 14px; height: 10px; border-radius: 3px; background: var(--accent-text); margin-left: 6px; }
.map-legend i.lv1 { opacity: .3; } .map-legend i.lv2 { opacity: .52; } .map-legend i.lv3 { opacity: .76; } .map-legend i.lv4 { opacity: 1; }
.map-detail { margin: 0; text-align: center; font-size: .86rem; color: var(--muted); min-height: 2.6em; }
.map-detail b { color: var(--text); }
.map-note { margin: 0; font-size: .78rem; color: var(--muted); text-align: center; }

/* ---- demo matching (sheet page) --------------------------------------------- */

.row-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.link-btn { color: var(--accent-text); font-weight: 700; font-size: .78rem; letter-spacing: .02em; text-transform: none; padding: 4px 0; }
.all-ok { color: var(--muted); font-weight: 650; font-size: .76rem; letter-spacing: .02em; text-transform: none; }
.all-ok::before { content: "✓ "; color: var(--accent-text); }

.demo-line {
  display: flex; align-items: center; gap: 10px; width: calc(100% - 6px); margin-top: 10px; padding: 6px 10px 6px 6px;
  border-radius: 12px; text-align: left; font-size: .84rem; color: var(--muted); background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--edge);
}
.demo-line b { color: var(--text); font-weight: 650; }
.demo-line .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.demo-line .mini { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; background: #fff; flex: none; }
.demo-line .missing-art { width: 30px; height: 30px; border-radius: 8px; flex: none; }
.demo-line > svg:first-child { width: 30px; height: 30px; padding: 6px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.demo-line .chev { width: 16px; height: 16px; }
.demo-line.none { background: transparent; border: 1px dashed var(--edge); box-shadow: none; }
.demo-line .find { color: var(--accent-text); font-weight: 700; }

.match-list { display: flex; flex-direction: column; gap: 16px; margin: 4px 0 16px; }
.match .m { font-size: .82rem; color: var(--muted); margin-top: 2px; }
.match .edb-grid { min-height: 0; margin-top: 8px; }
.match.done:not(:has(.edb-item)) b { color: var(--muted); }
.edb-item.chosen img { box-shadow: 0 0 0 3px var(--accent-text); }
.match.done .edb-item:not(.chosen) { opacity: .45; }
.sheet-actions.one { grid-template-columns: 1fr; }
.map-detail .src { font-style: normal; font-size: .7rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; margin-left: 2px; }
.map-detail .src.demo { color: var(--accent-text); background: var(--accent-soft); }
.map-detail .src.builtin { color: var(--muted); background: var(--surface-2); }
.row-item .m a { color: var(--accent-text); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* Free Exercise DB: start and end photos flip like a slow animation */
.flip { position: relative; display: block; width: 100%; height: 100%; }
.flip img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.flip img + img { animation: flip 2.4s steps(1, end) infinite; }
@keyframes flip { 0% { opacity: 0; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .flip img + img { animation: none; opacity: 0; } }
.credit a { color: var(--accent-text); font-weight: 600; }

/* ---- home: compact, so everything fits on one screen ---------------------- */
.week { padding: 12px 14px; }
.week-head { margin-bottom: 8px; }
.week-head b { font-size: 1.35rem; }
.week-days { gap: 6px; }
.day { gap: 3px; font-size: .66rem; }
.day i { max-width: 28px; border-radius: 8px; }
.week + .section-title { margin-top: 14px; margin-bottom: 8px; }
.start-btn { min-height: 54px; padding: 8px 10px; gap: 1px; }
.start-btn b { font-size: .92rem; }
.start-btn .m { font-size: .72rem; }
.start-row + .trend-card, .start-row + .hint-line + .trend-card { margin-top: 12px; }
.trend-card { padding: 12px 14px; gap: 8px; }
.trend-head .big b { font-size: 1.8rem; }
.trend-row { padding: 6px 0; }
.trend-row .t { font-size: .92rem; }
.trend-list .spark { height: 22px; }
.trend-row .m .tag { display: inline; margin: 0; font-size: .64rem; }
.trend-row .m { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- home: start buttons look like buttons -------------------------------- */
/* Sheets are filled like the app's primary buttons; Empty is a ghost button. */
.start-btn {
  align-items: center; text-align: center; border-radius: 14px;
  background: var(--accent); color: var(--accent-ink);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .14), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.start-btn b { color: inherit; }
.start-btn .m { color: inherit; opacity: .62; font-weight: 600; }
.start-btn.empty-start { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--edge); }
.start-btn.empty-start b { color: inherit; }
.start-btn.empty-start .m { color: var(--muted); opacity: 1; }

/* ---- after-workout stretches --------------------------------------------- */
.stretch-group { margin-top: 14px; }
.stretch-group .eyebrow { display: block; margin: 0 2px 6px; }
.stretch-item { background: var(--surface-2); border-radius: 14px; margin-bottom: 8px; overflow: hidden; }
.stretch-item summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 8px; cursor: pointer; }
.stretch-item summary::-webkit-details-marker { display: none; }
.stretch-item summary .mini, .stretch-item summary .missing-art { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: #fff; flex: none; }
.stretch-item summary b { display: block; font-weight: 650; text-transform: capitalize; }
.stretch-item summary small { display: block; color: var(--muted); font-size: .8rem; }
.stretch-item summary svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; transition: transform .2s var(--ease); }
.stretch-item[open] summary svg { transform: rotate(90deg); }
.stretch-item .media-frame.big { margin: 4px auto 10px; max-width: 260px; }
.stretch-item .demo-steps { margin: 0 14px 14px; }
.btn svg { flex: none; }

/* Two sheets share the row with a narrow + (empty workout); more scroll. */
.start-row { display: flex; grid-auto-flow: initial; }
.start-row .start-btn { flex: 1 0 calc((100% - 76px) / 2); }
.start-row .start-btn.empty-start { flex: 0 0 56px; align-items: center; justify-content: center; padding: 0; }
.start-btn.empty-start svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }

/* Tab icons sit at a fixed height (labels below them), so the highlight can
   be centred on the icon exactly, whatever the label's font or text size:
   icon 22px from 12px → centre at 23px; pill 32px tall → top 7px. */
.tabs a { justify-content: flex-start; padding-top: 12px; }
.tabs a.on svg { transform: scale(1.06); }
.tab-ind { top: 7px; }
