/* ==========================================================================
   Koach design system v2: tokens, type, components. Hebrew RTL, dark default.
   ========================================================================== */

/* ---------- fonts (Heebo variable, OFL, self-hosted: fonts/OFL.txt) ---------- */
@font-face {
  font-family: "Heebo"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/heebo-hebrew-wght.woff2") format("woff2");
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: "Heebo"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/heebo-latin-wght.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;
}

/* ---------- tokens: dark (default) ---------- */
:root {
  --bg-0: #0E1113; --bg-1: #171B1E; --bg-2: #20262A; --bg-3: #2A3136;
  --line: #2C3439; --line-strong: #6B767E;
  --text: #ECF0F2; --text-2: #AAB5BC; --text-3: #8F9AA2; --text-disabled: #5F6A72;
  --accent: #C8F560; --on-accent: #11200A; --accent-text: #C8F560;
  --accent-soft: color-mix(in srgb, var(--accent) 16%, var(--bg-1));
  --rest: #5CC8FF; --on-rest: #06202E; --muscle: #FF8A3D; --pr: #B79CFF; --warn: #FFC64D; --danger: #FF6B6B;
  --chart-1: var(--accent); --chart-ref: #8F9AA2; --chart-band: color-mix(in srgb, var(--text) 8%, transparent); --chart-grid: #2C3439;
  --toast-bg: var(--bg-3); --toast-fg: var(--text); --seg-on: var(--bg-3);
  --shadow-1: none;
  --shadow-2: inset 0 1px 0 rgba(255,255,255,.04), 0 8px 24px rgba(0,0,0,.45);
  --shadow-3: inset 0 1px 0 rgba(255,255,255,.05), 0 16px 40px rgba(0,0,0,.6);

  /* stage: identical in both themes (the animation stays dark) */
  --stage-top: #1F262B; --stage-bottom: #101417; --stage-floor: #1A2024; --stage-grid: #263036;
  --stage-prop: #3B444A; --stage-metal: #9AA3A8; --mannequin: #D9D3CA; --mannequin-far: #8E8880;
  --garment: #3A444C; --muscle-3d: #FF8A3D; --fig-ghost: rgba(255,255,255,.10);
  --stage-text: #ECF0F2;

  /* compatibility aliases read by js/anim.js and js/anim3d.js: do not remove */
  --bg2: var(--stage-bottom); --fig3d: var(--mannequin); --fig-hl: var(--muscle-3d);
  --floor3d: var(--stage-floor); --prop3d: var(--stage-prop);
  --fig: var(--mannequin); --fig-far: var(--mannequin-far); --ghost: var(--fig-ghost);
  --floor: var(--stage-floor); --prop: var(--stage-prop); --prop2: var(--stage-metal);

  /* shape, space, motion */
  --r-xs: 6px; --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 28px; --r-full: 999px;
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px;
  --dur-1: 100ms; --dur-2: 160ms; --dur-3: 240ms; --dur-4: 360ms;
  --ease-standard: cubic-bezier(.2,0,0,1); --ease-enter: cubic-bezier(.05,.7,.1,1); --ease-exit: cubic-bezier(.3,0,.8,.15);
  --tap: 44px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  --font: "Heebo", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  color-scheme: dark;
}

/* ---------- tokens: light ---------- */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg-0: #F3F5F1; --bg-1: #FFFFFF; --bg-2: #EDF0EA; --bg-3: #E2E7DF;
    --line: #D8DED4; --line-strong: #7D8890;
    --text: #11171A; --text-2: #48545C; --text-3: #5B676F; --text-disabled: #9AA3A9;
    --accent: #3F6B00; --on-accent: #FFFFFF; --accent-text: #3F6B00;
    --rest: #00649A; --on-rest: #FFFFFF; --muscle: #A84300; --pr: #6A43D0; --warn: #8A5A00; --danger: #B42525;
    --chart-ref: #5B676F; --chart-grid: #D8DED4;
    --toast-bg: #20262A; --toast-fg: #ECF0F2; --seg-on: var(--bg-1);
    --shadow-1: 0 1px 2px rgba(16,24,20,.06), 0 1px 1px rgba(16,24,20,.04);
    --shadow-2: 0 4px 12px rgba(16,24,20,.08), 0 1px 2px rgba(16,24,20,.06);
    --shadow-3: 0 12px 32px rgba(16,24,20,.14);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg-0: #F3F5F1; --bg-1: #FFFFFF; --bg-2: #EDF0EA; --bg-3: #E2E7DF;
  --line: #D8DED4; --line-strong: #7D8890;
  --text: #11171A; --text-2: #48545C; --text-3: #5B676F; --text-disabled: #9AA3A9;
  --accent: #3F6B00; --on-accent: #FFFFFF; --accent-text: #3F6B00;
  --rest: #00649A; --on-rest: #FFFFFF; --muscle: #A84300; --pr: #6A43D0; --warn: #8A5A00; --danger: #B42525;
  --chart-ref: #5B676F; --chart-grid: #D8DED4;
  --toast-bg: #20262A; --toast-fg: #ECF0F2; --seg-on: var(--bg-1);
  --shadow-1: 0 1px 2px rgba(16,24,20,.06), 0 1px 1px rgba(16,24,20,.04);
  --shadow-2: 0 4px 12px rgba(16,24,20,.08), 0 1px 2px rgba(16,24,20,.06);
  --shadow-3: 0 12px 32px rgba(16,24,20,.14);
  color-scheme: light;
}

/* ---------- base ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg-0); color: var(--text); }
body { font: 400 17px/26px var(--font); min-height: 100dvh; overscroll-behavior-y: none; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; }
a { color: var(--accent-text); }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.num { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.ic { width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: -4px; }

/* type scale (no negative letter-spacing on Hebrew) */
h1, .t-title1 { font-size: 28px; line-height: 34px; font-weight: 700; margin: 0; }
h2, .t-title2 { font-size: 22px; line-height: 28px; font-weight: 700; margin: 24px 0 12px; }
.t-title3 { font-size: 20px; line-height: 26px; font-weight: 700; }
h3, .t-headline { font-size: 17px; line-height: 24px; font-weight: 600; margin: 0 0 4px; }
.t-display { font-size: 34px; line-height: 40px; font-weight: 700; }
.small, .t-sub { font-size: 15px; line-height: 20px; }
.tiny, .t-foot { font-size: 13px; line-height: 18px; color: var(--text-3); }
.caption { font-size: 12px; line-height: 16px; font-weight: 500; }
.muted { color: var(--text-2); }

/* layout */
#app { max-width: 560px; margin: 0 auto; padding: calc(12px + var(--safe-t)) 16px calc(96px + var(--safe-b)); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 16px; min-height: var(--tap); }
.top .sub { color: var(--text-2); font-size: 15px; line-height: 20px; margin-top: 2px; }
.row { display: flex; align-items: center; gap: 8px; } .between { justify-content: space-between; } .wrap { flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card { background: var(--bg-1); border-radius: var(--r-lg); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow-1); }
.card.tap { cursor: pointer; display: block; color: inherit; text-decoration: none; transition: transform var(--dur-1) var(--ease-standard); }
.card.tap:active { transform: scale(.99); }
.hero { border: 1px solid var(--line); }
.empty { color: var(--text-3); text-align: center; padding: 16px 8px; font-size: 15px; line-height: 20px; }

/* chips / pills (non-interactive labels) */
.pill { display: inline-flex; align-items: center; gap: 4px; min-height: 24px; padding: 2px 10px; border-radius: var(--r-full); background: var(--bg-2); color: var(--text-2); font-size: 13px; line-height: 18px; font-weight: 500; }
.pill.acc { background: var(--accent-soft); color: var(--accent-text); }
.pill.hl { background: color-mix(in srgb, var(--muscle) 14%, var(--bg-1)); color: var(--muscle); }
.pill.pr { background: color-mix(in srgb, var(--pr) 14%, var(--bg-1)); color: var(--pr); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: var(--r-md); border: 0;
  background: var(--bg-3); color: var(--text); text-decoration: none;
  font: 600 17px/22px var(--font); cursor: pointer; user-select: none; -webkit-user-select: none;
  transition: transform var(--dur-1) var(--ease-standard), background-color var(--dur-2) var(--ease-standard);
}
a.btn, a.btn:visited { color: var(--text); }
.btn:active { transform: scale(.97); }
.btn:disabled { color: var(--text-disabled); cursor: default; transform: none; }
.btn.pri, a.btn.pri { background: var(--accent); color: var(--on-accent); min-height: 56px; }
.btn.pri:disabled { background: var(--bg-3); color: var(--text-disabled); }
.btn.big, .btn.cta { min-height: 60px; width: 100%; font-size: 18px; border-radius: var(--r-lg); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.sm { min-height: 44px; padding: 0 14px; font-size: 15px; border-radius: var(--r-sm); }
.btn.icon { width: 44px; min-height: 44px; height: 44px; padding: 0; border-radius: var(--r-full); }
.btn.icon.ghost { border: 0; }
.btn.danger, a.btn.danger { color: var(--danger); }

/* segmented control */
.seg { display: flex; background: var(--bg-2); border-radius: var(--r-md); padding: 3px; margin-bottom: 12px; gap: 2px; }
.seg button { flex: 1; min-height: 40px; border: 0; background: transparent; border-radius: 11px; font-size: 15px; font-weight: 500; cursor: pointer; color: var(--text-2); transition: background-color var(--dur-2) var(--ease-standard); }
.seg button.on { background: var(--seg-on); color: var(--text); font-weight: 600; box-shadow: var(--shadow-1); }

/* horizontally scrolling filter chips */
.chip-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 8px; padding: 2px 16px 6px; }
.chip-row::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 40px; padding: 0 16px; border-radius: var(--r-full); border: 1px solid var(--line); background: transparent; color: var(--text-2); font: 500 15px/20px var(--font); cursor: pointer; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg-0); border-color: var(--text); font-weight: 600; }

/* callouts */
.callout { display: flex; gap: 10px; align-items: flex-start; border-radius: var(--r-md); padding: 12px; margin: 12px 0; font-size: 15px; line-height: 21px; background: var(--bg-2); color: var(--text); }
.callout .ic { margin-top: 1px; }
.callout.tip .ic { color: var(--accent-text); }
.callout.warn { background: color-mix(in srgb, var(--warn) 12%, var(--bg-1)); }
.callout.warn .ic { color: var(--warn); }

/* disclosure */
details.disc { background: var(--bg-1); border-radius: var(--r-lg); margin: 12px 0; }
details.disc > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; padding: 0 16px; cursor: pointer; font-weight: 600; }
details.disc > summary::-webkit-details-marker { display: none; }
details.disc > summary .chev { transition: transform var(--dur-2) var(--ease-standard); color: var(--text-3); }
details.disc[open] > summary .chev { transform: rotate(-90deg); }
details.disc .disc-body { padding: 0 16px 12px; }
details.more > summary { list-style: none; cursor: pointer; }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary { display: none; }

/* ---------- bottom nav ---------- */
nav.tabs { position: fixed; inset: auto 0 0 0; display: flex; justify-content: center; background: color-mix(in srgb, var(--bg-1) 85%, transparent); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); z-index: 20; }
nav.tabs a { flex: 1; max-width: 112px; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 0; color: var(--text-3); text-decoration: none; font-size: 12px; line-height: 16px; font-weight: 600; }
nav.tabs a.on, nav.tabs a[aria-current="page"] { color: var(--accent-text); }
nav.tabs svg { width: 24px; height: 24px; }

/* ---------- animation stage (dark in both themes) ---------- */
.anim-box { position: relative; background: linear-gradient(var(--stage-top), var(--stage-bottom)); border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 260 / 220; color: var(--stage-text); }
.anim-box svg { width: 100%; height: 100%; display: block; }
.fig-floor { fill: var(--stage-floor); } .fig-floorline { stroke: var(--stage-grid); stroke-width: 1.5; }
.limb { stroke: var(--fig); fill: none; }
.limb.far { stroke: var(--fig-far); }
.limb.hl { stroke: var(--fig-hl); }
.limb.far.hl { stroke: color-mix(in srgb, var(--fig-hl) 55%, var(--fig-far)); }
.head { fill: var(--fig); }
.fig-ghost .limb, .fig-ghost .limb.far { stroke: var(--ghost); } .fig-ghost .head { fill: var(--ghost); }
.prop-bar { fill: var(--stage-metal); } .prop-jamb { fill: var(--stage-grid); }
.prop-handle { fill: var(--stage-prop); } .prop-couch { fill: var(--stage-prop); stroke: var(--stage-grid); }
.prop-mat { fill: var(--stage-prop); }
.db-plate { fill: var(--garment); stroke: var(--stage-metal); stroke-width: 1.5; } .db-hub, .db-handle { fill: var(--stage-metal); }
.anim-caption { position: absolute; top: 8px; inset-inline-start: 8px; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--stage-text); background: color-mix(in srgb, var(--stage-bottom) 72%, transparent); padding: 4px 10px; border-radius: var(--r-full); }
.anim-ctl { position: absolute; bottom: 8px; inset-inline-end: 8px; display: flex; gap: 6px; }
.anim-ctl button { border: 0; color: var(--stage-text); background: color-mix(in srgb, var(--stage-bottom) 72%, transparent); border-radius: var(--r-sm); min-width: 44px; height: 36px; font-size: 13px; font-weight: 600; cursor: pointer; font-variant-numeric: tabular-nums; }
.anim-box canvas.ex3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; cursor: grab; }
.anim-box .hint3d { position: absolute; bottom: 10px; inset-inline-start: 10px; font-size: 12px; line-height: 16px; color: color-mix(in srgb, var(--stage-text) 62%, transparent); pointer-events: none; }

/* ---------- lists ---------- */
.ex-item { display: flex; gap: 12px; align-items: center; min-height: 64px; padding: 8px 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.ex-item:last-child { border-bottom: 0; }
.ex-thumb { width: 72px; flex: none; }
.ex-thumb .anim-box { border-radius: var(--r-sm); }
.ex-meta { flex: 1; min-width: 0; }
.ex-meta b { display: block; font-weight: 600; }
.ex-meta .muted { font-size: 15px; line-height: 20px; }
.more-btn { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); color: var(--accent-text); font-weight: 600; font-size: 15px; }
.step-n { width: 32px; height: 32px; border-radius: 50%; background: var(--bg-2); display: grid; place-items: center; font-size: 15px; font-weight: 700; flex: none; }
.step-n.on { background: var(--accent); color: var(--on-accent); }

/* stat tile: label first, then value; aligned to start */
.stat { background: var(--bg-2); border-radius: var(--r-md); padding: 12px; }
.stat-l { font-size: 13px; line-height: 18px; color: var(--text-2); }
.stat-v { font-size: 28px; line-height: 34px; font-weight: 700; margin-top: 2px; }
.stat-v small { font-size: 15px; font-weight: 500; color: var(--text-2); }

/* today */
.weekdots { display: flex; gap: 6px; margin-top: 8px; }
.weekdots i { flex: 1; height: 36px; border-radius: var(--r-sm); background: var(--bg-2); display: grid; place-items: center; font-style: normal; font-size: 13px; font-weight: 500; color: var(--text-2); }
.weekdots i.done { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.weekdots i.today { box-shadow: inset 0 0 0 2px var(--accent-text); }
.hero-name { margin: 10px 0 2px; }
.hero .cta { margin: 16px 0 4px; }

/* empty state */
.empty-card { text-align: center; padding: 32px 20px; }
.empty-card .empty-ic { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 12px; background: var(--accent-soft); color: var(--accent-text); }
.empty-card .empty-ic .ic { width: 28px; height: 28px; }
.empty-card p { color: var(--text-2); margin: 4px 0 16px; font-size: 15px; line-height: 21px; }
.bigval { font-size: 34px; line-height: 40px; font-weight: 700; }

/* ---------- workout player ---------- */
.player-head { display: flex; align-items: center; gap: 4px; margin: 0 0 8px; }
.player-head .ttl { flex: 1; min-width: 0; text-align: center; font-size: 15px; line-height: 20px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prog { height: 4px; background: var(--bg-3); border-radius: var(--r-full); overflow: hidden; margin: 0 0 12px; }
.prog i { display: block; height: 100%; background: var(--accent); transition: width var(--dur-3) var(--ease-standard); }
.player .anim-box { aspect-ratio: 16 / 10; max-height: 32vh; width: 100%; }
.ex-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-top: 12px; }
.ex-head h2 { margin: 6px 0 2px; }
.ex-head .meta { color: var(--text-2); font-size: 15px; line-height: 20px; }

.cur-set { background: var(--bg-1); border-radius: var(--r-lg); padding: 14px 16px; margin-top: 12px; box-shadow: var(--shadow-1); }
.cur-set .lbl { font-size: 15px; line-height: 20px; color: var(--text-2); }
.cur-target { display: flex; align-items: center; gap: 8px; margin: 2px 0; }
.cur-target .big { font-size: 56px; line-height: 64px; font-weight: 800; }
.cur-target .unit { font-size: 17px; color: var(--text-2); font-weight: 500; }
.cur-target .load-chip { margin-inline-start: auto; }
.load-chip { display: inline-flex; align-items: baseline; gap: 4px; padding: 6px 12px; border-radius: var(--r-full); background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: 20px; line-height: 24px; }
.load-chip small { font-size: 13px; font-weight: 500; }
.cur-set .foot { font-size: 13px; line-height: 18px; color: var(--text-3); margin-top: 2px; }

.sets { margin-top: 12px; background: var(--bg-1); border-radius: var(--r-lg); overflow: hidden; }
.set-row { display: grid; grid-template-columns: 32px 1fr 1fr 56px; gap: 8px; align-items: center; min-height: 68px; padding: 8px 12px 8px 12px; border-bottom: 1px solid var(--line); border-inline-start: 3px solid transparent; }
.set-row:last-child { border-bottom: 0; }
.set-row.cur { background: var(--bg-2); border-inline-start-color: var(--accent); }
.set-n { width: 32px; height: 32px; border-radius: 50%; background: var(--bg-3); display: grid; place-items: center; font-size: 15px; font-weight: 700; color: var(--text-2); }
.set-row.cur .set-n { color: var(--text); }
.set-row.done .set-n { background: transparent; color: var(--text-3); }
.set-row.done .stepper .v { color: var(--text-2); }
.stepper { display: flex; align-items: center; background: var(--bg-3); border-radius: var(--r-md); overflow: hidden; height: 52px; min-width: 0; }
.set-row.cur .stepper { background: var(--bg-1); box-shadow: inset 0 0 0 1px var(--line); }
.stepper button { border: 0; background: transparent; width: 48px; flex: none; height: 100%; font-size: 24px; line-height: 1; cursor: pointer; color: var(--text-2); }
.stepper button:active { background: color-mix(in srgb, var(--text) 8%, transparent); }
.stepper .v { flex: 1; min-width: 0; text-align: center; font-weight: 700; font-size: 22px; line-height: 24px; display: flex; flex-direction: column; align-items: center; }
.stepper .u { font-size: 12px; line-height: 14px; color: var(--text-3); font-weight: 500; }
.bw-cell { text-align: center; color: var(--text-3); font-size: 13px; line-height: 18px; }
.check { width: 56px; height: 52px; border-radius: var(--r-md); border: 0; background: var(--bg-3); color: var(--text-2); display: grid; place-items: center; cursor: pointer; }
.check .ic { width: 24px; height: 24px; }
.set-row.done .check { background: var(--accent); color: var(--on-accent); }
.set-row .runbtn { min-height: 52px; padding: 0 10px; font-size: 15px; }
.player-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
ul.cues { margin: 4px 0 8px; padding-inline-start: 20px; } ul.cues li { margin: 4px 0; }

/* fixed bottom action bar */
.action-bar { position: fixed; inset-inline: 0; bottom: 0; z-index: 30; padding: 12px 16px calc(12px + var(--safe-b)); background: linear-gradient(to top, var(--bg-0) 75%, transparent); }
.action-bar .inner { max-width: 528px; margin: 0 auto; }
.action-bar .btn.done-cta { width: 100%; min-height: 64px; font-size: 19px; border-radius: var(--r-lg); }
.action-bar .btn.done-cta .ic { width: 24px; height: 24px; }
body.in-workout nav.tabs { display: none; }
body.in-workout #app { padding-bottom: calc(112px + var(--safe-b)); }

/* ---------- rest overlay ---------- */
.rest { position: fixed; inset: 0; background: var(--bg-0); z-index: 50; display: flex; flex-direction: column; align-items: stretch; padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b)); gap: 16px; animation: fade-in var(--dur-3) var(--ease-enter); }
.rest > * { width: 100%; max-width: 528px; margin-inline: auto; }
.rest-title { text-align: center; font-size: 17px; line-height: 24px; font-weight: 600; color: var(--text-2); margin-top: 8px; }
.rest-ring { position: relative; width: min(260px, 70vw); aspect-ratio: 1; }
.rest-ring svg { width: 100%; height: 100%; display: block; }
.rest-ring circle { fill: none; stroke-width: 12; }
.rest-ring .bg { stroke: var(--bg-3); }
.rest-ring .fg { stroke: var(--rest); stroke-linecap: round; transition: stroke-dashoffset 250ms linear, stroke var(--dur-2) var(--ease-standard); }
.rest-ring .t { position: absolute; inset: 0; display: grid; place-items: center; }
.rest-ring .t bdi { font-size: 72px; line-height: 1; font-weight: 800; }
.rest.ending .rest-ring .fg { stroke: var(--accent); }
.rest.ending .rest-ring { animation: pulse 1s var(--ease-standard) infinite; }
.rest-adj { display: flex; justify-content: center; gap: 12px; }
.rest-adj .btn { min-width: 88px; }
.next-card { display: flex; gap: 12px; align-items: center; background: var(--bg-1); border-radius: var(--r-lg); padding: 12px; }
.next-card .ex-thumb { width: 88px; }
.next-card .k { font-size: 13px; line-height: 18px; color: var(--text-3); }
.next-card b { display: block; font-weight: 600; }
.rest .spacer { flex: 1; }
@keyframes pulse { 50% { transform: scale(1.03); } }
@keyframes fade-in { from { opacity: 0; } }

/* ---------- forms ---------- */
label.fld { display: block; margin-bottom: 12px; }
label.fld span { display: block; font-size: 13px; line-height: 18px; color: var(--text-2); margin-bottom: 4px; }
input, select { width: 100%; min-height: 48px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--bg-2); color: var(--text); padding: 0 12px; font: 400 17px/22px var(--font); }
input::placeholder { color: var(--text-3); }
input[type=checkbox] { width: 24px; height: 24px; min-height: 24px; accent-color: var(--accent); flex: none; }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 52px; padding: 8px 0; border-bottom: 1px solid var(--line); }

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart .ax { fill: var(--text-3); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .lbl { fill: var(--text-2); font-size: 12px; font-family: var(--font); }
.chart .val { fill: var(--text); font-size: 11px; font-weight: 600; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .ln { fill: none; stroke: var(--chart-1); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--chart-1); } .chart .dot-muted { fill: var(--chart-ref); }
.chart .bar { fill: var(--chart-1); } .chart .band { fill: var(--chart-band); }
.chart .hm-on { fill: var(--chart-1); } .chart .hm-off { fill: var(--bg-3); }
.ringwrap { display: flex; align-items: center; gap: 16px; }
.miniring { width: 64px; height: 64px; flex: none; }
.miniring circle { fill: none; stroke-width: 8; } .miniring .bg { stroke: var(--bg-3); } .miniring .fg { stroke: var(--accent); stroke-linecap: round; }
.miniring text { font-family: var(--font); font-variant-numeric: tabular-nums; }
.pr-row { display: flex; align-items: center; gap: 8px; min-height: 44px; border-bottom: 1px solid var(--line); }
.pr-row:last-child { border-bottom: 0; }
.pr-row .ic { color: var(--pr); }
.pr-row .d { margin-inline-start: auto; }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: calc(76px + var(--safe-b)); inset-inline: 16px; max-width: 528px; margin: 0 auto; width: fit-content; background: var(--toast-bg); color: var(--toast-fg); padding: 12px 16px; border-radius: var(--r-md); z-index: 99; font-size: 15px; line-height: 21px; box-shadow: var(--shadow-3); animation: fade-in var(--dur-2) var(--ease-enter); }
body.in-workout .toast { bottom: calc(100px + var(--safe-b)); }

/* ---------- reduced motion: shorter, gentle fades instead of none ---------- */
@media (prefers-reduced-motion: reduce) {
  :root { --dur-1: 0ms; --dur-2: 0ms; --dur-3: 120ms; --dur-4: 120ms; }
  .btn:active, .card.tap:active { transform: none; }
  .rest.ending .rest-ring { animation: none; }
  .rest-ring .fg { transition: none; }
}

/* ---- animation engine v2: rep counter, model loading ---- */
.anim-rep { position: absolute; top: 8px; inset-inline-end: 10px; font-size: 12px; font-weight: 600; color: var(--text-2, #AAB5BC); background: color-mix(in srgb, var(--stage-bottom, #101417) 70%, transparent); padding: 3px 9px; border-radius: 999px; pointer-events: none; }
.anim-rep:empty { display: none; }
.anim-rep.pop { animation: rep-pop var(--dur-3, 240ms) var(--ease-enter, ease-out); }
@keyframes rep-pop { from { transform: scale(.85); opacity: .4; } to { transform: scale(1); opacity: 1; } }
.anim-box.loading::after { content: "טוען דמות…"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3, #8F9AA2); font-size: 13px; pointer-events: none; }

/* ---- list thumbnails: pre-rendered 3D stills (thumbs/, tools/make_thumbs.py), 2-frame cross-fade ---- */
.anim-box.th-box { background: radial-gradient(ellipse 70% 40% at 50% 92%, color-mix(in srgb, var(--stage-text, #fff) 9%, transparent), transparent 70%), linear-gradient(var(--stage-top), var(--stage-bottom)); }
.th-box img.th { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; border-radius: inherit; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.th-box img.th-b { opacity: 0; }
.th-box.on img.th-b { animation: th-flip 3.2s ease-in-out infinite; }
.th-box.on img.th:not(.th-b) { animation: th-flip-a 3.2s ease-in-out infinite; }
/* the frames are transparent PNG/WebP: the main frame must fade OUT while frame b fades in, or both show */
@keyframes th-flip { 0%, 44% { opacity: 0; } 50%, 94% { opacity: 1; } 100% { opacity: 0; } }
@keyframes th-flip-a { 0%, 44% { opacity: 1; } 50%, 94% { opacity: 0; } 100% { opacity: 1; } }
@media (hover: hover) { .ex-item:hover .th-box img.th, .next-card:hover .th-box img.th { animation-duration: 1.6s; } }
@media (prefers-reduced-motion: reduce) { .th-box.on img.th-b { animation: none; opacity: 0; } .th-box.on img.th { animation: none; } .th-box.on img.th:not(.th-b) { opacity: 1; } }

/* ==========================================================================
   v3: coach integration (readiness sheet, recommendations, RIR, captions,
   test day, milestones, sync status). Tokens only; 44px tap targets.
   ========================================================================== */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.chip { display: inline-flex; align-items: center; justify-content: center; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip-wrap .chip { min-height: 44px; }

/* status pills */
.pill.tempo-p { background: color-mix(in srgb, var(--rest) 14%, var(--bg-1)); color: var(--rest); }
.pill.warn-p { background: color-mix(in srgb, var(--warn) 14%, var(--bg-1)); color: var(--warn); }
.pill .ic { width: 14px; height: 14px; vertical-align: -2px; }
.pill.tr-rising { background: var(--accent-soft); color: var(--accent-text); }
.pill.tr-falling { background: color-mix(in srgb, var(--danger) 12%, var(--bg-1)); color: var(--danger); }
.pill.lvl-good { background: var(--accent-soft); color: var(--accent-text); }
.pill.lvl-moderate { background: color-mix(in srgb, var(--warn) 14%, var(--bg-1)); color: var(--warn); }
.pill.lvl-low { background: color-mix(in srgb, var(--danger) 12%, var(--bg-1)); color: var(--danger); }
.lvl-good { color: var(--accent-text); } .lvl-moderate { color: var(--warn); } .lvl-low { color: var(--danger); }

/* today */
ul.notes { margin: 8px 0 0; padding-inline-start: 18px; font-size: 15px; line-height: 21px; color: var(--text-2); }
ul.notes li { margin: 3px 0; }
.mini-stats { font-size: 15px; line-height: 20px; color: var(--text-2); margin-top: 2px; }
.test-card > .row > .ic { color: var(--pr); width: 24px; height: 24px; margin-top: 2px; }
a.sync-err { width: 44px; height: 44px; flex: none; display: grid; place-items: center; color: var(--danger); border-radius: var(--r-full); }
a.sync-err[hidden] { display: none; }
.recs { margin-top: 12px; border-top: 1px solid var(--line); }
.recs .k { font-size: 13px; line-height: 18px; color: var(--text-3); margin: 10px 0 0; }
details.rec { border-bottom: 1px solid var(--line); }
details.rec:last-child { border-bottom: 0; }
details.rec > summary { list-style: none; display: flex; align-items: center; gap: 10px; min-height: 48px; cursor: pointer; font-size: 15px; line-height: 20px; font-weight: 500; }
details.rec > summary::-webkit-details-marker { display: none; }
details.rec > summary > span { flex: 1; min-width: 0; }
details.rec .chev { color: var(--text-3); transition: transform var(--dur-2) var(--ease-standard); }
details.rec[open] .chev { transform: rotate(180deg); }
details.rec p { margin: 0 0 12px; padding-inline-start: 30px; font-size: 13px; line-height: 19px; color: var(--text-2); }
.sev-high > summary > .ic:first-child { color: var(--danger); }
.sev-med > summary > .ic:first-child { color: var(--warn); }
.sev-pos > summary > .ic:first-child { color: var(--accent-text); }
.sev-low > summary > .ic:first-child { color: var(--text-3); }

/* bottom sheet (readiness check-in) */
.sheet-bg { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .55); display: flex; align-items: flex-end; justify-content: center; animation: fade-in var(--dur-2) var(--ease-enter); }
.sheet { width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--bg-1); color: var(--text); border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 16px 16px calc(16px + var(--safe-b)); box-shadow: var(--shadow-3); animation: sheet-in var(--dur-3) var(--ease-enter); }
@keyframes sheet-in { from { transform: translateY(24px); opacity: .6; } }
.sheet-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sheet-h h2 { margin: 0; }
.sheet-actions { display: grid; gap: 8px; margin-top: 16px; }
.rd-q { padding: 10px 0; border-bottom: 1px solid var(--line); }
.rd-l { font-weight: 600; font-size: 15px; line-height: 20px; }
.rd-chips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 8px; }
.rd-chips .chip { min-height: 44px; padding: 0; font-size: 17px; }
.rd-score { display: flex; align-items: baseline; gap: 6px; margin: 8px 0 4px; }
.rd-score .num { font-size: 44px; line-height: 48px; font-weight: 800; }
.stepper.sm { height: 44px; }
.stepper.sm button { width: 44px; }
.stepper.sm .v { min-width: 40px; font-size: 18px; }

/* player */
.anim-wrap { position: relative; }
.coach-cap { position: absolute; inset-inline: 12px; bottom: 52px; margin: 0 auto; width: fit-content; max-width: calc(100% - 24px); padding: 6px 12px; border-radius: var(--r-md); background: color-mix(in srgb, var(--stage-bottom) 88%, transparent); color: var(--stage-text); font-size: 15px; line-height: 20px; font-weight: 600; text-align: center; opacity: 0; transform: translateY(4px); transition: opacity var(--dur-3) var(--ease-standard), transform var(--dur-3) var(--ease-standard); pointer-events: none; }
.coach-cap:empty { display: none; }
.coach-cap.on { opacity: 1; transform: none; }
.rest .coach-cap { position: static; background: var(--bg-2); color: var(--text); }
.coach-note { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; font-size: 15px; line-height: 20px; color: var(--text); }
.coach-note .ic, .rest-note .ic { color: var(--accent-text); flex: none; }
.cur-target .big-t { font-size: 22px; line-height: 28px; font-weight: 700; }
.player-head .btn.icon.snd-off { color: var(--text-3); }
.player-head .btn.icon.snd-beeps { color: var(--text-2); }
.player-head .btn.icon.snd-voice { color: var(--accent-text); }

/* rest overlay: RIR chips, coach note */
.rest { overflow-y: auto; }
.rir-box { text-align: center; }
.rir-box .k { font-size: 15px; line-height: 20px; color: var(--text-2); margin-bottom: 8px; }
.rir-chips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.rir-chips .chip { min-height: 48px; padding: 0; font-size: 17px; }
.rest-note { display: flex; gap: 8px; align-items: flex-start; justify-content: center; font-size: 15px; line-height: 20px; }
.rest-note[hidden] { display: none; }

/* finish: milestones, test results */
.ms-card { display: flex; gap: 12px; align-items: center; border: 1px solid color-mix(in srgb, var(--pr) 45%, var(--line)); animation: ms-pop var(--dur-4) var(--ease-enter); }
.ms-card .ms-ic { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--pr) 16%, var(--bg-1)); color: var(--pr); flex: none; }
.ms-card .ms-ic .ic { width: 26px; height: 26px; }
.ms-card .k { font-size: 13px; line-height: 18px; color: var(--text-2); }
@keyframes ms-pop { from { transform: scale(.94); opacity: 0; } 60% { transform: scale(1.02); opacity: 1; } }
.test-row { display: flex; align-items: center; gap: 8px; min-height: 52px; border-bottom: 1px solid var(--line); flex-wrap: wrap; padding: 6px 0; }
.test-row:last-of-type { border-bottom: 0; }
.test-v { font-size: 22px; line-height: 28px; font-weight: 700; }
.test-v small { font-size: 13px; font-weight: 500; color: var(--text-2); }

/* progress */
.lift-row { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 52px; padding: 6px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.lift-row:last-child { border-bottom: 0; }
.lift-row.static { cursor: default; }
.lift-row .nm { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lift-row .nm b { font-weight: 600; }
.lift-row[aria-pressed="true"] .nm b { color: var(--accent-text); }
.ms-next { padding: 8px 0; }
.bar-mini { height: 6px; background: var(--bg-3); border-radius: var(--r-full); overflow: hidden; margin-top: 4px; }
.bar-mini i { display: block; height: 100%; background: var(--accent); }

/* settings */
.sync-line.err { color: var(--danger); }
.fld-l { display: block; font-size: 13px; line-height: 18px; color: var(--text-2); margin-bottom: 4px; }
input[type=range] { padding: 0; min-height: 44px; background: transparent; border: 0; accent-color: var(--accent); }
#sndmode button { min-height: 44px; }
.switch-row .tiny { display: block; }
.player-head .ttl { display: flex; justify-content: center; gap: 4px; }
.player-head .ttl .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.player-head .ttl > span:last-child { flex: none; }
.set-row .stepper button { width: 44px; }
.set-row .stepper .v { overflow: visible; }
.set-row:has(.bw-cell) { grid-template-columns: 32px 1.4fr .6fr 56px; }
.set-row .stepper .u { white-space: nowrap; font-size: 11px; line-height: 13px; }
