/* Gym Form 3D
   VOICE     everyday training companion: calm, plain words, numbers you can read mid-set
   IDEA      the colour code of competition bumper plates: red works, blue helps, yellow cautions, green is done
   PICTURE   the 3D anatomy figure in a dark display case; on Today, the week drawn as a barbell that loads a plate per workout
   COLOUR    chalk ground #F2F0EA (night: graphite #1A1D23), ink #16181D, plate red #D9362B, blue #2F62D6, yellow #E8B321, green #2E9A57
   TYPE      Big Shoulders Display (titles, stamped numbers) + Atkinson Hyperlegible (text, chosen for legibility at any age)
   LAYOUT    phone: one column, tab bar at the bottom, exercise opens as a full sheet with the stage on top;
             laptop: rail on the left, exercise sheet splits stage | log
*/
:root {
  color-scheme: light dark;
  --bg: light-dark(#f2f0ea, #1a1d23);
  --card: light-dark(#ffffff, #23272f);
  --sunk: light-dark(#e8e5dd, #15171c);
  --ink: light-dark(#16181d, #eeebe4);
  --mute: light-dark(#5c616c, #a3a8b3);
  --line: light-dark(#d9d5cb, #353b46);
  --red: #d9362b; --blue: #2f62d6; --yellow: #e8b321; --green: #2e9a57;
  --red-ink: light-dark(#b3261c, #ff7a6e); --blue-ink: light-dark(#244fb3, #8fb0ff); --green-ink: light-dark(#1f7a43, #6fd39b);
  --stage: #17191e;
  --display: "Big Shoulders Display", "Big Shoulders", "Arial Narrow", "Roboto Condensed", sans-serif;
  --text: "Atkinson Hyperlegible", "Atkinson Hyperlegible Next", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1); --ease-io: cubic-bezier(0.65, 0, 0.35, 1); --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --tabh: 64px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
:root[data-theme=light] { color-scheme: light; }
:root[data-theme=dark] { color-scheme: dark; }
* { box-sizing: border-box; min-width: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 17px/1.5 var(--text); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
a { color: var(--blue-ink); }
h1, h2, h3 { margin: 0; font-weight: 800; }
.display { font-family: var(--display); letter-spacing: 0; line-height: 1.02; }
.num { font-family: var(--display); font-weight: 800; font-variant-numeric: tabular-nums; }
.mute { color: var(--mute); }
.small { font-size: 15px; }
.tiny { font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
.shell { height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) auto; }
#view { overflow-y: auto; overscroll-behavior: contain; padding: calc(var(--safe-t) + 20px) max(18px, env(safe-area-inset-right)) 32px max(18px, env(safe-area-inset-left)); }
#view:focus { outline: none; }
.page { max-width: 760px; margin: 0 auto; animation: pageIn 0.28s var(--ease-out); }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--card); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); position: relative; z-index: 5; }
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--tabh); color: var(--mute); text-decoration: none; font-size: 13px; font-weight: 700; }
.tabs a svg { width: 24px; height: 24px; }
.tabs a[aria-current=page] { color: var(--ink); }
.tabs a[aria-current=page] svg { color: var(--red); }
.tabs .rail-only { display: none; }

.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.top h1 { font-family: var(--display); font-size: clamp(40px, 11vw, 56px); line-height: 0.95; text-wrap: balance; }
.top .date { font-size: 15px; color: var(--mute); margin-bottom: 4px; }
.iconbtn { display: grid; place-items: center; width: 48px; height: 48px; flex: none; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.iconbtn svg { width: 22px; height: 22px; }
section.block { margin-top: 30px; }
.block > h2 { font-size: 21px; font-family: var(--text); font-weight: 700; margin-bottom: 12px; }
.block > h2 .mute { font-weight: 400; font-size: 15px; margin-left: 6px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 22px; border-radius: 14px; border: 0; background: var(--ink); color: var(--bg); font-weight: 700; font-size: 17px; text-decoration: none; transition: transform 0.12s var(--ease-out), background-color 0.15s; }
.btn:active { transform: scale(0.97); }
.btn.wide { width: 100%; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.soft { background: var(--sunk); color: var(--ink); }
.btn.red { background: var(--red); color: #fff; }
.btn.sm { min-height: 44px; padding: 0 16px; font-size: 15px; border-radius: 12px; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.linkbtn { background: none; border: 0; padding: 10px 0; min-height: 44px; color: var(--blue-ink); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- week barbell ---------- */
.week { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 14px 10px 10px; }
.week svg { display: block; width: 100%; height: 108px; overflow: visible; }
.week .bar { fill: light-dark(#b9bcc4, #737985); }
.week .sleeve { fill: light-dark(#9ea2ab, #8b919c); }
.week .plate { transition: fill 0.3s; }
.week .lbl { font: 700 13px var(--text); fill: var(--mute); text-anchor: middle; }
.week .lbl.today { fill: var(--ink); }
.week .loaded { animation: plateOn 0.55s var(--spring) both; transform-box: fill-box; transform-origin: center; }
@keyframes plateOn { from { transform: translateX(-22px) scaleY(0.6); opacity: 0; } }
.week-sum { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 8px 6px 2px; font-size: 15px; color: var(--mute); }
.week-sum b { color: var(--ink); }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.list > li + li { border-top: 1px solid var(--line); }
.item { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: center; width: 100%; padding: 12px 14px; background: none; border: 0; text-align: left; color: inherit; text-decoration: none; min-height: 76px; }
.item:hover { background: var(--sunk); }
.item b { display: block; font-size: 17px; line-height: 1.25; }
.item .sub { display: block; font-size: 15px; color: var(--mute); margin-top: 2px; }
.thumb { width: 56px; height: 56px; border-radius: 14px; background: var(--stage) no-repeat; background-size: cover; display: grid; place-items: center; color: #fff; font: 800 22px var(--display); }
.pips { display: flex; gap: 4px; }
.pips i { width: 8px; height: 22px; border-radius: 3px; background: var(--line); }
.pips i.on { background: var(--green); }
.tag { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 14px; background: var(--sunk); font-size: 13px; font-weight: 700; color: var(--ink); }
.tag .dot, .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.c-red { background: var(--red); } .c-blue { background: var(--blue); } .c-yellow { background: var(--yellow); } .c-green { background: var(--green); }

/* ---------- volume bars ---------- */
.vol { display: grid; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; }
.vrow { display: grid; grid-template-columns: 92px minmax(0, 1fr) 64px; gap: 12px; align-items: center; font-size: 15px; }
.vrow .track { position: relative; height: 14px; border-radius: 7px; background: var(--sunk); }
.vrow .band { position: absolute; top: 0; bottom: 0; border-radius: 7px; background: light-dark(#d9eadf, #23422f); }
.vrow .fill { position: absolute; left: 0; top: 3px; bottom: 3px; border-radius: 4px; background: var(--ink); transition: width 0.5s var(--ease-out); }
.vrow .fill.low { background: var(--blue); } .vrow .fill.ok { background: var(--green); } .vrow .fill.hi { background: var(--yellow); }
.vrow .val { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.legend-line { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--mute); margin-top: 4px; }

/* ---------- suggestions ---------- */
.tips { display: grid; gap: 10px; }
.tip { display: grid; grid-template-columns: 6px minmax(0, 1fr); gap: 14px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.tip .flag { border-radius: 3px; background: var(--blue); }
.tip.k-up .flag, .tip.k-streak .flag { background: var(--green); }
.tip.k-rest .flag, .tip.k-stall .flag { background: var(--yellow); }
.tip.k-plan .flag { background: var(--red); }
.tip b { display: block; }
.tip p { margin: 2px 0 0; color: var(--mute); font-size: 15px; }

/* ---------- filters ---------- */
.search { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--card); color: var(--mute); }
.search:focus-within { border-color: var(--ink); }
.search input { flex: 1; height: 100%; border: 0; outline: 0; background: none; color: var(--ink); font-size: 17px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 44px; padding: 0 16px; border-radius: 22px; border: 1.5px solid var(--line); background: var(--card); font-size: 15px; font-weight: 700; color: var(--ink); }
.chip[aria-pressed=true] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chips.small .chip { height: 38px; font-size: 14px; padding: 0 13px; }
.count { color: var(--mute); font-size: 15px; margin: 14px 2px 8px; }
.empty { padding: 28px 20px; text-align: left; background: var(--card); border: 1px dashed var(--line); border-radius: 18px; }
.empty b { display: block; font-size: 19px; margin-bottom: 4px; }

/* ---------- plan ---------- */
.day { background: var(--card); border: 1px solid var(--line); border-radius: 18px; margin-bottom: 12px; overflow: hidden; }
.day > header { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 16px; }
.day .plate-mark { width: 14px; height: 40px; border-radius: 4px; }
.day.rest .plate-mark { height: 14px; background: var(--line); }
.day h3 { font-size: 19px; font-weight: 700; }
.day .when { font-size: 15px; color: var(--mute); }
.day.is-today { border-color: var(--ink); border-width: 2px; }
.day .list { border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.day .item { min-height: 64px; grid-template-columns: 44px minmax(0, 1fr) auto; }
.day .thumb { width: 44px; height: 44px; border-radius: 11px; }
.why { background: var(--sunk); border-radius: 18px; padding: 16px 18px; font-size: 16px; }

/* ---------- progress ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.stat .num { display: block; font-size: 40px; line-height: 1; }
.stat span { font-size: 15px; color: var(--mute); }
.heat { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; overflow-x: auto; }
.heat-grid { display: grid; grid-template-rows: repeat(7, 16px); grid-auto-flow: column; grid-auto-columns: 16px; gap: 4px; }
.heat-grid i { border-radius: 4px; background: var(--sunk); }
.heat-grid i.l1 { background: light-dark(#a9d8b9, #2c5a3e); } .heat-grid i.l2 { background: var(--green); } .heat-grid i.l3 { background: light-dark(#14643a, #8be0ad); }
.heat-grid i.now { outline: 2px solid var(--ink); outline-offset: 1px; }
.chart { position: relative; height: 200px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; }
.chart svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.chart text { font: 13px var(--text); fill: var(--mute); }
.chart .val { font: 800 15px var(--display); fill: var(--ink); }
.prs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.pr { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; text-decoration: none; color: inherit; }
.pr .num { font-size: 30px; display: block; line-height: 1.05; }
.pr small { color: var(--mute); font-size: 13px; }
.histday { background: var(--card); border: 1px solid var(--line); border-radius: 16px; margin-bottom: 10px; }
.histday summary { list-style: none; display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px; cursor: pointer; min-height: 52px; align-items: center; }
.histday summary::-webkit-details-marker { display: none; }
.histday[open] summary { border-bottom: 1px solid var(--line); }
.histday table { width: 100%; border-collapse: collapse; font-size: 15px; }
.histday td { padding: 8px 16px; border-top: 1px solid var(--line); }
.histday tr:first-child td { border-top: 0; }
.histday td:last-child { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.export { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.bw { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }

/* ---------- forms ---------- */
.field { display: grid; gap: 8px; margin-bottom: 22px; }
.field > label, .field > .lab { font-weight: 700; }
.field .hint { font-size: 15px; color: var(--mute); margin-top: -4px; }
.opts { display: grid; gap: 8px; }
.opt { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 16px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--card); text-align: left; width: 100%; }
.opt[aria-pressed=true] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.opt .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; }
.opt[aria-pressed=true] .tick { border-color: var(--ink); background: var(--ink); }
.opt[aria-pressed=true] .tick::after { content: ""; width: 6px; height: 11px; border: solid var(--bg); border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg); }
.opt small { display: block; color: var(--mute); font-size: 15px; }
.daypick { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.daypick button { height: 52px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); font-weight: 700; }
.daypick button[aria-pressed=true] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.input { height: 52px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); font-size: 17px; width: 100%; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; }
.switch button { width: 56px; height: 32px; border-radius: 16px; border: 0; background: var(--line); position: relative; flex: none; transition: background-color 0.2s; }
.switch button::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform 0.25s var(--spring); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }
.switch button[aria-checked=true] { background: var(--green); }
.switch button[aria-checked=true]::after { transform: translateX(24px); }
.credits { font-size: 15px; color: var(--mute); }

/* ---------- exercise sheet ---------- */
.detail { position: fixed; inset: 0; z-index: 20; background: var(--bg); display: flex; flex-direction: column; transform: translateY(100%); visibility: hidden; transition: transform 0.38s var(--ease-out), visibility 0s 0.38s; }
.detail.open { transform: none; visibility: visible; transition: transform 0.38s var(--ease-out); }
.d-head { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: calc(var(--safe-t) + 6px) 12px 8px; }
.d-head h2 { font-family: var(--display); font-size: clamp(28px, 7.5vw, 38px); line-height: 1; text-wrap: balance; }
.d-head .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.d-sess { font-size: 13px; font-weight: 700; color: var(--mute); text-align: right; white-space: nowrap; }
.stage { position: relative; flex: none; height: clamp(250px, 40svh, 520px); margin: 0 12px; border-radius: 22px; overflow: hidden; background: radial-gradient(110% 85% at 50% 30%, #2b2e36 0%, #1b1d22 55%, #131418 100%); color: #eeebe4; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.stage canvas:active { cursor: grabbing; }
.stage .load { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 12px; padding: 24px; text-align: center; font-size: 15px; color: #b8bcc5; }
.stage .load .meter { width: 180px; height: 6px; border-radius: 3px; background: #2f333c; overflow: hidden; }
.stage .load .meter i { display: block; height: 100%; width: 0; background: #eeebe4; transition: width 0.2s; }
.stage .ov { position: absolute; }
.s-reset { top: 10px; right: 10px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(20, 21, 25, 0.72); color: #eeebe4; display: grid; place-items: center; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.s-tag { top: 14px; left: 14px; height: 30px; padding: 0 12px; display: inline-flex; align-items: center; border-radius: 6px; font-size: 13px; font-weight: 700; color: #16181d; background: repeating-linear-gradient(-45deg, var(--yellow) 0 10px, #f5d46a 10px 20px); }
.s-hint { top: 16px; left: 50%; transform: translateX(-50%); padding: 6px 12px; border-radius: 14px; background: rgba(20, 21, 25, 0.72); font-size: 13px; white-space: nowrap; transition: opacity 0.5s; pointer-events: none; }
.s-hint.off { opacity: 0; }
.s-cap { left: 10px; right: 10px; bottom: 10px; margin: 0; padding: 10px 14px; border-radius: 14px; background: rgba(16, 17, 21, 0.78); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 15px; display: flex; gap: 10px; align-items: center; }
.s-cap i { width: 9px; height: 9px; border-radius: 50%; background: var(--red); flex: none; }
.s-cap.bad i { background: var(--yellow); }
.s-legend { top: 62px; left: 12px; display: grid; gap: 4px; font-size: 13px; }
.s-legend span { display: flex; align-items: center; gap: 6px; text-shadow: 0 1px 2px #000; }
.d-ctrl { display: flex; align-items: center; gap: 10px; padding: 10px 14px 2px; }
.d-ctrl .play { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--ink); color: var(--bg); display: grid; place-items: center; flex: none; }
.d-ctrl .pill { height: 44px; min-width: 62px; padding: 0 12px; border-radius: 22px; border: 1.5px solid var(--line); background: var(--card); font-weight: 700; font-variant-numeric: tabular-nums; flex: none; }
input[type=range] { -webkit-appearance: none; appearance: none; flex: 1; height: 44px; margin: 0; background: none; --v: 0%; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--red) var(--v), var(--line) var(--v)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -9px; border-radius: 50%; border: 3px solid var(--card); background: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line); }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--red); }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--card); background: var(--ink); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 8px 14px 0; padding: 4px; border-radius: 16px; background: var(--sunk); }
.seg button { height: 44px; border: 0; border-radius: 12px; background: none; font-weight: 700; color: var(--mute); transition: background-color 0.2s, color 0.2s; }
.seg button[aria-pressed=true] { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
.seg #mBad[aria-pressed=true] { background: var(--yellow); color: #16181d; }
.d-tabs { display: flex; gap: 4px; padding: 12px 14px 0; border-bottom: 1px solid var(--line); }
.d-tabs button { height: 46px; padding: 0 14px; border: 0; background: none; font-weight: 700; color: var(--mute); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.d-tabs button[aria-selected=true] { color: var(--ink); border-color: var(--ink); }
.d-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px 16px calc(var(--safe-b) + 96px); }
.d-body h3 { font-size: 17px; font-weight: 700; margin: 20px 0 8px; }
.d-body h3:first-child { margin-top: 4px; }
.target { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 12px 14px; border-radius: 14px; background: var(--sunk); font-size: 15px; }
.target b { font-size: 17px; }
.advice { margin: 10px 0 0; font-size: 15px; color: var(--mute); }
.steppers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 12px; }
.stepper { background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; padding: 8px; }
.stepper label { display: block; font-size: 13px; font-weight: 700; color: var(--mute); text-align: center; }
.stepper .ctl { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; }
.stepper button { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--sunk); font-size: 24px; font-weight: 700; line-height: 1; }
.stepper input { width: 100%; border: 0; background: none; text-align: center; font: 800 40px/1.1 var(--display); padding: 0; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper .u { display: block; text-align: center; font-size: 13px; color: var(--mute); margin-top: -2px; }
.sets { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.sets li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 8px 8px 8px 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); animation: setIn 0.42s var(--spring) both; }
@keyframes setIn { from { opacity: 0; transform: translateY(-6px) scale(0.96); } }
.sets .n { width: 30px; height: 30px; border-radius: 8px; background: var(--green); color: #fff; display: grid; place-items: center; font: 800 18px var(--display); }
.sets .w { font: 800 24px var(--display); font-variant-numeric: tabular-nums; }
.sets .w small { font: 400 13px var(--text); color: var(--mute); margin-left: 4px; }
.sets button { width: 44px; height: 44px; border-radius: 12px; border: 0; background: none; color: var(--mute); display: grid; place-items: center; }
.next { margin-top: 18px; }
.muscles { display: flex; flex-wrap: wrap; gap: 8px; }
.steps { margin: 0; padding-left: 1.4em; }
.steps li { margin-bottom: 8px; padding-left: 4px; }
.steps li::marker { font-weight: 700; color: var(--red-ink); }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { position: relative; padding: 0 0 8px 30px; }
.checks li::before { content: ""; position: absolute; left: 6px; top: 4px; width: 7px; height: 13px; border: solid var(--green); border-width: 0 3px 3px 0; transform: rotate(45deg); }
.mistake { margin-top: 18px; padding: 4px 16px 14px; border-radius: 16px; background: var(--card); border: 1.5px solid var(--line); }
.mistake.on { border-color: var(--yellow); background: light-dark(#fdf6dc, #352f1a); }
.mistake p { margin: 0; font-size: 16px; }
.h-chart { height: 170px; margin-top: 6px; }
.pr-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pr-row .pr { padding: 10px 12px; }
.pr-row .num { font-size: 24px; }

/* ---------- timer, toast, dialog ---------- */
.timer { position: fixed; z-index: 30; left: 50%; bottom: calc(var(--tabh) + var(--safe-b) + 12px); white-space: nowrap; transform: translate(-50%, 0); display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; border-radius: 30px; background: var(--ink); color: var(--bg); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); transition: transform 0.35s var(--spring), opacity 0.2s; }
.detail.open ~ .timer { bottom: calc(var(--safe-b) + 14px); }
.timer[hidden] { display: flex !important; opacity: 0; transform: translate(-50%, 140%); pointer-events: none; }
.timer svg { width: 40px; height: 40px; transform: rotate(-90deg); }
.timer .t { font: 800 26px var(--display); font-variant-numeric: tabular-nums; min-width: 58px; }
.timer button { height: 40px; padding: 0 14px; border-radius: 20px; border: 0; background: rgba(127, 127, 127, 0.22); color: inherit; font-weight: 700; font-size: 15px; }
.timer.done { animation: ding 0.6s var(--spring) 2; }
@keyframes ding { 50% { transform: translate(-50%, 0) scale(1.06); } }
.toast { position: fixed; z-index: 40; left: 50%; top: calc(var(--safe-t) + 14px); transform: translate(-50%, -160%); max-width: min(92vw, 460px); display: flex; align-items: center; gap: 14px; padding: 10px 10px 10px 18px; border-radius: 16px; background: var(--ink); color: var(--bg); font-weight: 700; transition: transform 0.35s var(--ease-out); }
.toast.show { transform: translate(-50%, 0); }
.toast button { height: 40px; padding: 0 14px; border: 0; border-radius: 12px; background: rgba(127, 127, 127, 0.25); color: inherit; font-weight: 700; }
dialog.sheet { border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 640px; max-height: 92svh; border-radius: 26px 26px 0 0; background: var(--bg); color: var(--ink); }
dialog.sheet::backdrop { background: rgba(10, 11, 14, 0.5); }
dialog.sheet[open] { animation: sheetUp 0.38s var(--ease-out); }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } }
.sheet-in { padding: 22px 20px calc(var(--safe-b) + 20px); overflow-y: auto; max-height: 92svh; }
.sheet-in h2 { font-family: var(--display); font-size: 40px; line-height: 1; margin-bottom: 6px; }
.steps-dots { display: flex; gap: 6px; margin: 4px 0 18px; }
.steps-dots i { height: 6px; flex: 1; border-radius: 3px; background: var(--line); }
.steps-dots i.on { background: var(--ink); }
.sheet-foot { display: flex; gap: 10px; margin-top: 8px; }
.sheet-foot .btn { flex: 1; }
textarea.copy { width: 100%; min-height: 180px; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px; background: var(--card); font: 13px/1.45 ui-monospace, Menlo, monospace; }

/* ---------- wide screens ---------- */
@media (min-width: 1000px) {
  .shell { grid-template-columns: 232px minmax(0, 1fr); grid-template-rows: 100%; }
  .tabs { grid-template-columns: 1fr; grid-auto-rows: 60px; align-content: start; border-top: 0; border-right: 1px solid var(--line); padding: 28px 14px; gap: 4px; order: -1; }
  .tabs a { flex-direction: row; justify-content: flex-start; gap: 14px; height: 56px; padding: 0 16px; border-radius: 14px; font-size: 17px; }
  .tabs a[aria-current=page] { background: var(--sunk); }
  .tabs .brand { display: block; font: 800 30px/1 var(--display); padding: 0 16px 24px; }
  .tabs .rail-only { display: flex; }
  #view { padding: 40px 48px; }
  .page-today, .page-progress { max-width: 1180px; }
  .page-progress .prs { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .detail { left: 232px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(380px, 1fr); grid-template-rows: auto minmax(0, 1fr) auto auto; grid-template-areas: "head head" "stage body" "ctrl body" "seg body"; }
  .d-head { grid-area: head; padding: 22px 24px 14px; }
  .stage { grid-area: stage; height: auto; margin: 0 0 0 24px; }
  .d-ctrl { grid-area: ctrl; padding: 12px 0 0 24px; }
  .seg { grid-area: seg; margin: 10px 0 24px 24px; }
  .d-side { grid-area: body; display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); margin-left: 24px; }
  .d-body { padding-bottom: 40px; }
  .timer, .detail.open ~ .timer { left: auto; right: 28px; bottom: 28px; transform: none; }
  .timer[hidden] { transform: translateY(160%); }
  @keyframes ding { 50% { transform: scale(1.06); } }
  dialog.sheet { margin: auto; border-radius: 26px; }
}
@media (min-width: 1200px) {
  .cols { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 36px; align-items: start; }
  .cols > div > section.block:first-child { margin-top: 0; }
}
@media (max-width: 999px) { .tabs .brand { display: none; } .d-side { display: contents; } }
@media (max-width: 380px) { .steppers { gap: 6px; } .stepper input { font-size: 32px; } .vrow { grid-template-columns: 78px minmax(0, 1fr) 56px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; } }

/* ---------- exercise library: search + filter ---------- */
.searchrow { display: grid; grid-template-columns: minmax(0, 1fr) 52px; gap: 10px; }
.filterbtn { position: relative; width: 52px; height: 52px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); display: grid; place-items: center; transition: border-color 0.15s, transform 0.12s var(--ease-out); }
.filterbtn:active { transform: scale(0.95); }
.filterbtn[aria-pressed=true] { border-color: var(--ink); }
.filterbtn .badge { position: absolute; top: -7px; right: -7px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--red); color: #fff; font: 700 13px/22px var(--text); text-align: center; animation: pop 0.3s var(--spring); }
@keyframes pop { from { transform: scale(0.4); } }
.pills { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.pills:empty { display: none; }
.pill-x { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 8px 0 14px; border-radius: 18px; border: 0; background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 700; }
.pill-x svg { width: 16px; height: 16px; }
.pills .linkbtn { min-height: 36px; padding: 0 4px; font-size: 14px; }
.libgroup { margin-top: 22px; }
.group-h { display: flex; align-items: baseline; gap: 8px; font: 800 26px/1 var(--display); margin: 0 2px 10px; }
.group-h .mute { font: 400 15px var(--text); }
.chips.wrap { flex-wrap: wrap; overflow: visible; padding-top: 2px; }

/* ---------- exercise sheet: one scrolling page on phones, full-screen 3D ---------- */
.s-full { top: 10px; right: 62px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(20, 21, 25, 0.72); color: #eeebe4; display: grid; place-items: center; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.stage.full { position: fixed; inset: 0; z-index: 70; margin: 0; border-radius: 0; height: auto; animation: grow 0.3s var(--ease-out); }
@keyframes grow { from { opacity: 0.4; transform: scale(0.96); } }
.stage.full canvas { touch-action: none; }
.stage.full .s-reset, .stage.full .s-full { top: calc(var(--safe-t) + 12px); }
.stage.full .s-tag, .stage.full .s-legend { margin-top: var(--safe-t); }
.stage.full .s-cap { bottom: calc(var(--safe-b) + 14px); }
.d-head h2 { cursor: pointer; }
@media (max-width: 999px) {
  .detail { display: block; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .d-head { position: sticky; top: 0; z-index: 6; background: var(--bg); transition: box-shadow 0.2s; }
  .detail.scrolled .d-head { box-shadow: 0 1px 0 var(--line); padding-bottom: 6px; }
  .detail.scrolled .d-head .meta { display: none; }
  .detail.scrolled .d-head h2 { font-size: 26px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .stage canvas { touch-action: pan-y; }
  .d-tabs { position: sticky; top: var(--headH, 64px); z-index: 5; background: var(--bg); }
  .d-body { overflow: visible; min-height: 75svh; }
}
.s-hint { left: 14px; transform: none; }
