/* Gym Coach — design system.
 * Light by default, dark via the OS or Settings. Large, legible type (17px base),
 * 44px tap targets, one accent colour; status colours carry meaning only.
 * View-specific CSS lives in each view (OG.style), prefixed with .page-<view>. */

:root {
  --bg: #f4f5f2;
  --surface: #ffffff;
  --surface-2: #eef0ec;
  --surface-3: #e2e5df;
  --fg: #141714;
  --fg-2: #4b524b;
  --fg-3: #5f665f;           /* secondary text: ≥ 5:1 on --bg, --surface and --surface-2 */
  --line: rgba(20, 30, 20, .12);
  --line-2: rgba(20, 30, 20, .2);
  --acc: #15803d;
  --acc-2: #166534;
  --on-acc: #ffffff;
  --acc-text: #166534;       /* accent-coloured text on tinted backgrounds (≥ 4.5:1) */
  --acc-soft: rgba(21, 128, 61, .10);
  --acc-line: rgba(21, 128, 61, .35);
  --good: #15803d; --good-soft: rgba(21, 128, 61, .11);
  --ok: #0369a1;   --ok-soft: rgba(3, 105, 161, .10);
  --warn: #b45309; --warn-soft: rgba(217, 119, 6, .13);
  --bad: #c62828;  --bad-soft: rgba(198, 40, 40, .10);
  --info: #1d4ed8; --info-soft: rgba(29, 78, 216, .09);
  --on-bad: #ffffff;         /* text on a solid --bad fill */
  /* small status tags: text a shade darker than the status colour so 12–13 px labels pass AA */
  --tag-good: #166534; --tag-ok: #075985; --tag-warn: #92400e; --tag-bad: #b11f1f; --tag-info: var(--info);
  /* hero card (Golf): accent gradient by day, a deep green at night */
  --hero-a: var(--acc); --hero-b: var(--acc-2); --on-hero: var(--on-acc); --hero-ink: var(--acc-2);
  --bm-sil: #d9ddd6; --bm-muscle: #c3cac0; --bm-stroke: #f4f5f2;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 16px rgba(0, 0, 0, .05);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .18);
  --r-sm: 8px; --r: 12px; --r-lg: 18px;
  --fs: 1.0625rem;           /* 17 px at the browser default, and follows the reader's own text-size setting */
  --sidebar: 248px;
  --sab: env(safe-area-inset-bottom, 0px);
  --sat: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0f0d; --surface: #171a17; --surface-2: #1f231f; --surface-3: #2a2f2a;
    --fg: #f0f3ef; --fg-2: #b4bcb3; --fg-3: #858d84;
    --line: rgba(255, 255, 255, .09); --line-2: rgba(255, 255, 255, .16);
    --acc: #4ade80; --acc-2: #22c55e; --on-acc: #04210f;
    --acc-soft: rgba(74, 222, 128, .12); --acc-line: rgba(74, 222, 128, .4);
    --good: #4ade80; --good-soft: rgba(74, 222, 128, .13);
    --ok: #38bdf8; --ok-soft: rgba(56, 189, 248, .13);
    --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .13);
    --bad: #f87171; --bad-soft: rgba(248, 113, 113, .13);
    --info: #60a5fa; --info-soft: rgba(96, 165, 250, .13);
    --acc-text: var(--acc); --on-bad: #2a0707;
    --tag-good: var(--good); --tag-ok: var(--ok); --tag-warn: var(--warn); --tag-bad: var(--bad); --tag-info: var(--info);
    --hero-a: #14532d; --hero-b: #166534; --on-hero: #f0fdf4; --hero-ink: #14532d;
    --bm-sil: #2b302b; --bm-muscle: #3c443b; --bm-stroke: #0d0f0d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 10px 40px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d0f0d; --surface: #171a17; --surface-2: #1f231f; --surface-3: #2a2f2a;
  --fg: #f0f3ef; --fg-2: #b4bcb3; --fg-3: #858d84;
  --line: rgba(255, 255, 255, .09); --line-2: rgba(255, 255, 255, .16);
  --acc: #4ade80; --acc-2: #22c55e; --on-acc: #04210f;
  --acc-soft: rgba(74, 222, 128, .12); --acc-line: rgba(74, 222, 128, .4);
  --good: #4ade80; --good-soft: rgba(74, 222, 128, .13);
  --ok: #38bdf8; --ok-soft: rgba(56, 189, 248, .13);
  --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .13);
  --bad: #f87171; --bad-soft: rgba(248, 113, 113, .13);
  --info: #60a5fa; --info-soft: rgba(96, 165, 250, .13);
  --acc-text: var(--acc); --on-bad: #2a0707;
  --tag-good: var(--good); --tag-ok: var(--ok); --tag-warn: var(--warn); --tag-bad: var(--bad); --tag-info: var(--info);
  --hero-a: #14532d; --hero-b: #166534; --on-hero: #f0fdf4; --hero-ink: #14532d;
  --bm-sil: #2b302b; --bm-muscle: #3c443b; --bm-stroke: #0d0f0d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 10px 40px rgba(0, 0, 0, .6);
  color-scheme: dark;
}
:root[data-text="large"] { --fs: 1.1875rem; }

/* ------------------------------------------------------------- base -- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* Scrolling to an element (scrollIntoView, keyboard focus) stops clear of the sticky top bar and the
   tab bar. A default margin rather than html scroll-padding, so a view's own scroll-margin replaces it
   instead of adding to it. */
@media (max-width: 959px) { .main * { scroll-margin-top: calc(76px + var(--sat)); scroll-margin-bottom: calc(72px + var(--sab)); } }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 var(--fs)/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.85em; font-weight: 750; letter-spacing: -.02em; }
h2 { font-size: 1.3em; font-weight: 700; }
h3 { font-size: 1.08em; font-weight: 650; }
h4 { font-size: 1em; font-weight: 650; }
p { margin: 0 0 .8em; }
ul, ol { margin: 0 0 .8em; padding-left: 1.3em; }
li { margin: .2em 0; }
a { color: var(--acc); text-underline-offset: 2px; }
img, svg { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2em 0; }
small, .small { font-size: .86em; }
.muted { color: var(--fg-2); }
.faint { color: var(--fg-3); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--acc); outline-offset: 2px; border-radius: 6px; }
h1[tabindex="-1"]:focus, .main:focus { outline: none; }   /* focus moved here on page change, not by the reader */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { position: fixed; left: 8px; top: 8px; z-index: 300; background: var(--surface); color: var(--acc-text); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 650; }

.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -.25em; }
.icon.big { width: 64px; height: 64px; color: var(--acc); }

/* ------------------------------------------------------------ layout -- */
.app { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px;
  padding: calc(10px + var(--sat)) 16px 10px; background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 1.08em; color: var(--fg); text-decoration: none; letter-spacing: -.01em; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--acc); color: var(--on-acc); display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 22px; height: 22px; }
.brand small { display: block; font-weight: 500; color: var(--fg-3); font-size: .7em; letter-spacing: 0; }
.topbar .spacer { flex: 1; }

.sidebar { display: none; }
.main { padding: 18px 16px calc(96px + var(--sab)); max-width: 1080px; margin: 0 auto; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding-bottom: var(--sab);
}
.tabbar a, .tabbar button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px;
  color: var(--fg-2); text-decoration: none; font: inherit; font-size: max(13px, calc(var(--fs) * .76)); font-weight: 650; background: none; border: 0; cursor: pointer; min-height: 54px;
}
.tabbar .icon { width: 24px; height: 24px; }
.tabbar .on { color: var(--acc); }

@media (min-width: 960px) {
  .topbar { display: none; }
  .tabbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: var(--sidebar);
    padding: 22px 14px; border-right: 1px solid var(--line); background: var(--surface); overflow-y: auto;
  }
  .sidebar .brand { padding: 4px 10px 18px; }
  .nav-group { margin-bottom: 14px; }
  .nav-label { font-size: .72em; text-transform: uppercase; letter-spacing: .08em; color: var(--fg-3); font-weight: 650; padding: 6px 12px; }
  .nav-link {
    display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--fg-2);
    text-decoration: none; font-weight: 550; font-size: 15.5px;
  }
  .nav-link:hover { background: var(--surface-2); color: var(--fg); }
  .nav-link.on { background: var(--acc-soft); color: var(--acc-text); }
  .sidebar-foot { margin-top: auto; padding: 12px; font-size: .8em; color: var(--fg-3); }
  .main { margin-left: var(--sidebar); padding: 32px 40px 60px; max-width: calc(1080px + var(--sidebar)); }
  .app-wide .main { max-width: none; }
}

/* ------------------------------------------------------------- pages -- */
.page { animation: pageIn .25s ease; }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-head { margin: 4px 0 20px; }
.page-head h1 { margin-bottom: .2em; }
.page-head .sub { color: var(--fg-2); font-size: 1.04em; margin: 0; max-width: 62ch; }
.page-head .actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.section { margin: 28px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.kicker { font-size: .74em; text-transform: uppercase; letter-spacing: .09em; color: var(--acc); font-weight: 700; margin-bottom: 4px; }
.app-foot { margin: 48px 0 0; padding-top: 18px; border-top: 1px solid var(--line); color: var(--fg-2); font-size: .86em; }
.app-foot p { margin: 0 0 .5em; }

/* -------------------------------------------------------------- grid -- */
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

/* ------------------------------------------------------------- cards -- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 18px; box-shadow: var(--shadow); min-width: 0;
}
.card > :last-child { margin-bottom: 0; }
.card-title { font-size: 1.05em; font-weight: 700; margin: 0 0 .35em; display: flex; align-items: center; gap: 8px; }
.card-title .icon { color: var(--acc); }
.card-sub { color: var(--fg-2); font-size: .94em; margin: 0 0 .8em; }
.card-flat { box-shadow: none; background: var(--surface-2); border-color: transparent; }
.card-acc { border-color: var(--acc-line); background: linear-gradient(180deg, var(--acc-soft), transparent 70%), var(--surface); }
.card-link { display: block; color: inherit; text-decoration: none; transition: transform .12s ease, border-color .12s ease; cursor: pointer; }
.card-link:hover { border-color: var(--acc-line); transform: translateY(-1px); }
.card-hero {
  background: linear-gradient(135deg, var(--hero-a) 0%, var(--hero-b) 100%); color: var(--on-hero); border: 0;
  /* inside the hero, "on accent" means "on the hero" (views' light buttons and chips follow) */
  --on-acc: var(--on-hero); --acc-2: var(--hero-ink);
}
.card-hero .muted, .card-hero .card-sub { color: color-mix(in srgb, var(--on-acc) 78%, transparent); }

/* ------------------------------------------------------------ buttons -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px;
  border-radius: 12px; border: 1px solid transparent; font: inherit; font-weight: 650; font-size: .96em; cursor: pointer;
  text-decoration: none; line-height: 1.2; transition: filter .12s ease, background .12s ease; text-align: center; max-width: 100%;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--acc); color: var(--on-acc); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.07); }
.btn-ghost { background: var(--surface-2); color: var(--fg); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); }
.btn-outline { background: transparent; color: var(--acc); border-color: var(--acc-line); }
.btn-danger { background: var(--bad); color: var(--on-bad); }
.btn-sm { min-height: 44px; padding: 8px 14px; font-size: .9em; border-radius: 11px; }
.btn-lg { min-height: 54px; padding: 14px 26px; font-size: 1.05em; border-radius: 14px; }
.btn-block { display: flex; width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 0;
  background: transparent; color: var(--fg-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--fg); }
.link-btn { background: none; border: 0; padding: 4px 0; min-height: 44px; color: var(--acc); font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
a.link-btn { text-decoration: none; }
a.link-btn:hover { text-decoration: underline; }
/* "← All sports"-style link back to a list, at the top of a detail page */
.back-link { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; font-weight: 600; text-decoration: none; margin: -6px 0 2px; }
.back-link:hover { text-decoration: underline; }

/* ------------------------------------------------------- chips & tags -- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 15px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--fg); font: inherit; font-size: .92em; font-weight: 550; cursor: pointer;
}
.chip:hover { border-color: var(--acc-line); }
.chip.on, .chip[aria-pressed="true"] { background: var(--acc); border-color: var(--acc); color: var(--on-acc); }
.chip .icon { width: 1.1em; height: 1.1em; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .78em; font-weight: 650;
  background: var(--surface-2); color: var(--fg-2); white-space: nowrap; line-height: 1.6;
}
.tag-good { background: var(--good-soft); color: var(--tag-good); }
.tag-ok { background: var(--ok-soft); color: var(--tag-ok); }
.tag-warn { background: var(--warn-soft); color: var(--tag-warn); }
.tag-bad { background: var(--bad-soft); color: var(--tag-bad); }
.tag-info { background: var(--info-soft); color: var(--tag-info); }
.tag-acc { background: var(--acc-soft); color: var(--acc-text); }

/* -------------------------------------------------------------- forms -- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { font-weight: 600; font-size: .92em; color: var(--fg-2); }
.field .hint { font-size: .82em; color: var(--fg-3); }
.input, .select, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--fg); font: inherit; font-size: 1em;
}
.input:focus, .select:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
.input:focus-visible, .select:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }
textarea.input { min-height: 110px; resize: vertical; line-height: 1.45; }
.input-unit { position: relative; display: flex; align-items: center; }
.input-unit .input { padding-right: 52px; }
.input-unit .unit { position: absolute; right: 12px; color: var(--fg-3); font-size: .88em; pointer-events: none; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button {
  border: 0; background: transparent; color: var(--fg-2); font: inherit; font-size: .92em; font-weight: 600;
  padding: 8px 14px; border-radius: 9px; cursor: pointer; min-height: 44px; min-width: 44px;
}
.seg button.on, .seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
input[type="range"] { width: 100%; accent-color: var(--acc); height: 32px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--acc); width: 20px; height: 20px; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 6px 0; }
.check input { margin-top: 3px; flex: none; }

/* ------------------------------------------------------------ metrics -- */
.metric {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; min-width: 0;
}
.metric-label { font-size: .84em; color: var(--fg-2); font-weight: 600; }
.metric-value { font-size: 1.6em; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.25; }
.metric-unit { font-size: .55em; font-weight: 600; color: var(--fg-3); margin-left: 2px; }
.metric-delta { font-size: .82em; font-weight: 600; color: var(--fg-3); }
.metric.tone-good .metric-value { color: var(--good); }
.metric.tone-ok .metric-value { color: var(--ok); }
.metric.tone-warn .metric-value { color: var(--warn); }
.metric.tone-bad .metric-value { color: var(--bad); }
.delta-good { color: var(--good); }
.delta-bad { color: var(--bad); }

/* range meter */
.meter { margin: 8px 0 4px; container-type: inline-size; }
.meter-bar { position: relative; height: 10px; border-radius: 99px; background: var(--surface-3); overflow: visible; }
.meter-z { position: absolute; top: 0; bottom: 0; }
.meter-z:first-child { border-radius: 99px 0 0 99px; }
.meter-z:last-of-type { border-radius: 0 99px 99px 0; }
.tone-good.meter-z { background: color-mix(in srgb, var(--good) 55%, transparent); }
.tone-ok.meter-z { background: color-mix(in srgb, var(--ok) 45%, transparent); }
.tone-warn.meter-z { background: color-mix(in srgb, var(--warn) 50%, transparent); }
.tone-bad.meter-z { background: color-mix(in srgb, var(--bad) 50%, transparent); }
.tone-info.meter-z { background: color-mix(in srgb, var(--info) 40%, transparent); }
.meter-mark {
  position: absolute; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%;
  background: var(--fg); border: 3px solid var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
/* Zone labels are centred under their zone and never clipped; ui.js moves a label that would collide
   to a second row (p1 = phone width, w1 = wide meter) or leaves it out (px / wx; the zone keeps its tooltip). */
.meter-labels { position: relative; height: 1.45em; font-size: .72em; color: var(--fg-3); margin-top: 4px; line-height: 1.35; }
.meter-labels span { position: absolute; top: 0; display: flex; justify-content: center; white-space: nowrap; padding: 0 2px; }
.meter-labels span.first { justify-content: flex-start; }
.meter-labels span.last { justify-content: flex-end; }
.meter-labels.p2 { height: 2.8em; }
.meter-labels .p1 { top: 1.35em; }
.meter-labels .px { display: none; }
@container (min-width: 540px) {
  .meter-labels.p2 { height: 1.45em; }
  .meter-labels.w2 { height: 2.8em; }
  .meter-labels .p1 { top: 0; }
  .meter-labels .px { display: flex; }
  .meter-labels .w1 { top: 1.35em; }
  .meter-labels .wx { display: none; }
}

/* ----------------------------------------------------------- callouts -- */
.callout { display: flex; gap: 12px; padding: 13px 15px; border-radius: var(--r); margin: 0 0 12px; font-size: .95em; }
.callout > .icon { margin-top: 2px; }
.callout > div > :last-child { margin-bottom: 0; }
.callout-info { background: var(--info-soft); }
.callout-info > .icon { color: var(--info); }
.callout-good { background: var(--good-soft); }
.callout-good > .icon { color: var(--good); }
.callout-warn { background: var(--warn-soft); }
.callout-warn > .icon { color: var(--warn); }
.callout-bad { background: var(--bad-soft); }
.callout-bad > .icon { color: var(--bad); }

/* -------------------------------------------------------------- lists -- */
.list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--line); color: inherit; text-decoration: none; background: none; border-left: 0; border-right: 0; border-bottom: 0; font: inherit; text-align: left; width: 100%; }
.list-item:first-child { border-top: 0; }
button.list-item, a.list-item { cursor: pointer; }
button.list-item:hover, a.list-item:hover { background: var(--surface-2); }
.list-item.on { background: var(--acc-soft); }
.list-item.on b { color: var(--acc-text); }
.more-sub { margin: 18px 0 8px; }
.list-item .grow > :last-child { margin-bottom: 0; }
.bullets { padding-left: 1.2em; }
.bullets li::marker { color: var(--acc); }
.steps li { margin: .35em 0; }

/* exercise rows */
.ex-list { display: flex; flex-direction: column; gap: 8px; }
.ex-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 11px 12px 11px 14px;
  border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); color: var(--fg);
  font: inherit; cursor: pointer; min-height: 52px;
}
.ex-item:hover { border-color: var(--acc-line); background: var(--acc-soft); }
.ex-num { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: .8em; font-weight: 700; color: var(--fg-2); flex: none; }
.ex-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ex-name { font-weight: 650; }
.ex-note { font-size: .84em; color: var(--fg-2); }
.ex-dose { font-size: .86em; color: var(--fg-2); font-weight: 600; text-align: right; max-width: 45%; }
.ex-go { color: var(--fg-3); }
.ex-sheet h3 { margin-top: 1.1em; }
.ex-sheet-dose { display: flex; gap: 8px; align-items: center; background: var(--acc-soft); padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; }
.ex-sheet-dose .icon { color: var(--acc); }
.ex-why { font-size: 1.02em; }
.ex-meta { display: grid; gap: 8px; margin: 14px 0 6px; }
.ex-meta div { display: flex; gap: 10px; }
.ex-meta dt { font-weight: 650; color: var(--fg-2); min-width: 86px; }
.ex-meta dd { margin: 0; }
.ex-links { display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 520px) { .ex-item { flex-wrap: wrap; } .ex-dose { max-width: none; text-align: left; order: 3; width: 100%; padding-left: 0; } .ex-num + .ex-main + .ex-dose { padding-left: 38px; } }

/* ------------------------------------------------------- accordions -- */
details.acc { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); margin-bottom: 10px; }
details.acc > summary {
  list-style: none; cursor: pointer; padding: 14px 16px; font-weight: 650; display: flex; align-items: center; gap: 10px; min-height: 52px;
}
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::after { content: ''; margin-left: auto; width: 9px; height: 9px; border-right: 2px solid var(--fg-3); border-bottom: 2px solid var(--fg-3); transform: rotate(45deg); transition: transform .15s; flex: none; }
details.acc[open] > summary::after { transform: rotate(-135deg); }
details.acc > .acc-body { padding: 0 16px 16px; }

/* --------------------------------------------------------------- tabs -- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 0; background: none; font: inherit; font-weight: 600; color: var(--fg-2); padding: 10px 14px; cursor: pointer;
  border-bottom: 2.5px solid transparent; margin-bottom: -1px; white-space: nowrap; min-height: 44px;
}
.tab.on, .tab[aria-selected="true"] { color: var(--acc); border-bottom-color: var(--acc); }

/* -------------------------------------------------------------- table -- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
table.table { border-collapse: collapse; width: 100%; font-size: .92em; }
.table th, .table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { font-size: .86em; color: var(--fg-2); font-weight: 650; background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; }

/* -------------------------------------------------------------- empty -- */
.empty { text-align: center; padding: 32px 16px; border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); }
.empty h3 { margin-bottom: .3em; }

/* -------------------------------------------------------------- modal -- */
.modal-back {
  position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity .2s ease;
}
.modal-back.in { opacity: 1; }
.modal {
  background: var(--surface); width: 100%; max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column;
  border-radius: 20px 20px 0 0; box-shadow: var(--shadow-lg); transform: translateY(30px); transition: transform .22s ease;
  padding-bottom: var(--sab);
}
.modal-back.in .modal { transform: none; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 12px 8px 20px; }
.modal-head h2 { margin: 0; flex: 1; font-size: 1.25em; }
.modal-body { padding: 4px 20px 16px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
@media (min-width: 640px) {
  .modal-back { align-items: center; padding: 24px; }
  .modal { max-width: 560px; border-radius: 20px; padding-bottom: 0; }
  .modal-wide { max-width: 860px; }
}

/* -------------------------------------------------------------- toast -- */
#toasts { position: fixed; left: 50%; bottom: calc(84px + var(--sab)); transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: 92vw; }
.toast { background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: .92em; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(8px); transition: all .25s ease; }
.toast.in { opacity: 1; transform: none; }
.toast-good { background: var(--good); color: var(--on-acc); }
.toast-bad { background: var(--bad); color: var(--on-bad); }
@media (min-width: 960px) { #toasts { bottom: 28px; left: calc(50% + var(--sidebar) / 2); } }

/* ------------------------------------------------------------- player -- */
.player { position: fixed; inset: 0; z-index: 150; background: var(--bg); overflow-y: auto; }
.player-in { max-width: 640px; margin: 0 auto; padding: calc(16px + var(--sat)) 20px calc(28px + var(--sab)); min-height: 100%; display: flex; flex-direction: column; }
.player-top { display: flex; justify-content: space-between; align-items: center; }
.player-progress { height: 5px; background: var(--surface-3); border-radius: 9px; margin: 8px 0 28px; overflow: hidden; }
.player-progress span { display: block; height: 100%; background: var(--acc); transition: width .3s ease; }
.player-name { font-size: 2em; margin-bottom: .2em; }
.player-dose { color: var(--fg-2); font-size: 1.1em; }
.player-clock { font-size: clamp(72px, 22vw, 128px); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.04em; text-align: center; margin: 18px 0; color: var(--fg); }
.player-clock.on { color: var(--acc); }
.player-clock.rest, .player-clock.on.rest { color: var(--fg-3); }
.player-status { text-align: center; font-weight: 700; color: var(--acc); margin: 18px 0 -10px; font-size: 1.05em; }
.player-status.rest { color: var(--fg-3); }
.player-clock.reps { font-size: 1.2em; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--fg-2); padding: 28px 0; }
.player-clock.reps .icon { width: 48px; height: 48px; color: var(--acc); }
.player-note { background: var(--surface-2); padding: 10px 14px; border-radius: 12px; }
.player-cues { color: var(--fg-2); font-size: 1.02em; }
.player-ctrl { display: flex; gap: 10px; justify-content: center; margin-top: auto; padding-top: 20px; flex-wrap: wrap; }
.player-next { text-align: center; margin-top: 12px; }
.player-done { align-items: center; justify-content: center; text-align: center; gap: 8px; }
.player-keys { text-align: center; margin: 8px 0 0; display: none; }
@media (hover: hover) and (pointer: fine) { .player-keys { display: block; } }

/* ------------------------------------------------------------- charts -- */
.chart { display: block; overflow: visible; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-ylab, .chart-xlab { fill: var(--fg-2); font-size: 12.5px; font-family: inherit; }
.chart-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { stroke: var(--surface); stroke-width: 1.5; }
.chart-last { fill: none; stroke-width: 2; opacity: .5; }
.chart-goal { stroke: var(--fg-3); stroke-dasharray: 5 5; stroke-width: 1.4; }
.chart-goal-lab { fill: var(--fg-2); font-size: 12.5px; font-weight: 600; }
.chart-empty { padding: 40px 0; text-align: center; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82em; color: var(--fg-2); margin-top: 6px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }

/* ----------------------------------------------------------- body map -- */
.bodymap { display: flex; gap: 8px; justify-content: center; align-items: flex-start; }
.bm-view { flex: 1; max-width: 250px; margin: 0; text-align: center; }
.bm-view svg { width: 100%; height: auto; display: block; }
.bm-view figcaption { font-size: .8em; color: var(--fg-3); font-weight: 600; margin-top: 2px; }
.bm-sil { fill: var(--bm-sil); }
.bm-r { fill: var(--bm-muscle); stroke: var(--bm-stroke); stroke-width: 2; transition: fill .12s ease; }
.bm-pick .bm-r { cursor: pointer; }
.bm-r.h1 { fill: color-mix(in srgb, var(--acc) 28%, var(--bm-muscle)); }
.bm-r.h2 { fill: color-mix(in srgb, var(--acc) 50%, var(--bm-muscle)); }
.bm-r.h3 { fill: color-mix(in srgb, var(--acc) 75%, var(--bm-muscle)); }
.bm-r.h4 { fill: var(--acc); }
.bm-r.hov { fill: color-mix(in srgb, var(--acc) 45%, var(--bm-muscle)); }
.bm-r.mark { fill: color-mix(in srgb, var(--bad) 70%, var(--bm-muscle)); }
.bm-r.sel { fill: var(--acc); }
.bm-r.mark.sel { fill: var(--bad); }

/* -------------------------------------------------------------- print -- */
@media print {
  .sidebar, .topbar, .tabbar, .no-print, #toasts, .app-foot { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; max-width: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .card { box-shadow: none; break-inside: avoid; border-color: #ccc; }
  .ex-item { border-color: #ddd; min-height: 0; padding: 6px 10px; }
  .ex-go { display: none; }
  a { color: #000; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
