/* Quwwa design system. Phone-first gym tool: big tap targets, Barlow Condensed for numbers and titles,
   Cairo for Arabic. All spacing uses logical properties so RTL works without overrides.
   Direction: deep navy and electric blue, quiet neutral surfaces, one dark "hero" block per screen,
   big condensed numbers for anything you lift, count or time.
   Agents: reuse these classes and tokens; put view-specific rules in your own CSS file. The token list and the rules
   (what each is for, do and don't) are in the round-8 TOKENS.md; the short version is in the comments below. */
:root{
  /* ---------- tokens: type ----------
     Ten sizes and nothing else. Body face (Barlow / Cairo): 12 14 16 18 20. Condensed face (numbers, titles): 24 28 36 44 60.
     Arabic words never get a condensed size of their own: an Arabic title steps one size down (Cairo is taller), numbers
     stay the same (Western digits are Barlow in both languages). Weights 400, 600, 700 only. */
  --t-xs:12px; --t-sm:14px; --t-md:16px; --t-lg:18px; --t-xl:20px;
  --d-sm:24px; --d-md:28px; --d-lg:36px; --d-xl:44px; --d-2xl:60px;
  /* three line heights: numbers and condensed caps, titles/labels/controls, running text (Arabic: 1 / 1.4 / 1.6) */
  --lh-tight:1; --lh-ui:1.2; --lh-body:1.45;
  /* the one small-caps label (.eyebrow): 12/700, tracked .08em, muted. Condensed caps track less as they grow. */
  --f-label:700 var(--t-xs)/var(--lh-ui) var(--font-body); --track-label:.08em;
  --track-d-sm:.05em; --track-d-md:.02em; --track-d-lg:.01em;
  /* ---------- tokens: space, shape, depth ---------- */
  --s-1:4px; --s-2:8px; --s-3:12px; --s-4:16px; --s-5:20px; --s-6:24px;
  /* radii: small (thumbs, plates, tags, calendar days, tooltips), medium (buttons, inputs, notes, tiles), large (cards,
     hero, sheets, the rest bar), pill. --radius is the card radius (old name, kept). */
  --r-sm:8px; --r-md:14px; --r-lg:20px; --r-pill:999px; --radius:var(--r-lg);
  /* two elevations, never coloured: e1 lies on the page (cards, tiles, the hero), e2 floats (sheet, toast, rest bar,
     sticky CTA). --shadow-1/-2/-hero are the old names; --shadow-accent is gone (a transparent no-op, safe in lists). */
  --e1:0 1px 2px rgb(15 23 42 / .06);
  --e2:0 12px 32px -12px rgb(15 23 42 / .35),0 2px 6px rgb(15 23 42 / .06);
  --shadow-1:var(--e1); --shadow-2:var(--e2); --shadow-hero:var(--e1); --shadow-accent:0 0 #0000;
  /* icons: one stroke at every size (1.75 px, ticks 2.5 px), three sizes */
  --ic-sm:16px; --ic-md:20px; --ic-lg:24px; --ic-stroke:1.75; --ic-stroke-bold:2.5;

  /* ---------- tokens: colour ----------
     Accent blue: the one main action per screen, the selected state, links. Not eyebrows, icons or decoration.
     Navy (--hero): the one hero block per screen and the rest timer. Green (--good, --done is the same green): done and
     on target. Teal (--st-high): "plenty" on the volume scale only. --warn: needs attention (in a .note.warn).
     --bad: errors, destructive actions, high pain. Gold: a record, only as a small solid element (medal disc, trophy,
     record pill); never a card or row fill. At most two hue families besides neutral and navy on one screen. */
  --bg:#f2f4f7; --surface:#ffffff; --surface-2:#eef1f5; --surface-3:#e3e7ee; --ink:#0c1220; --muted:#596374;
  --line:#dce1e8; --line-soft:#e9ecf1; --card-line:#e4e8ee;
  --accent:#2453f0; --accent-ink:#ffffff; --accent-soft:#e7edff; --accent-line:#bfcdfb;
  --good:#0f7c43; --good-ink:#ffffff; --good-soft:#dff3e7; --done:var(--good); --done-ink:var(--good-ink);
  /* warning is orange, celebration is gold: they no longer share a cream (light fills dE 7.9, dark text dE 17) */
  --warn:#9a4a08; --warn-soft:#fdeadb; --bad:#c0261a; --bad-soft:#fde7e4;
  /* Gold on light surfaces is under 3:1 for text, so gold text sits on --gold-soft in --ink, or --gold-ink on a gold fill.
     --gold-soft is for small record pills only. --gold-glow is retired (transparent): no coloured halos. */
  --gold:#c98a0b; --gold-soft:#fcf1d4; --gold-line:#efd28c; --gold-ink:#1f1500; --gold-glow:transparent;
  /* one status scale for weekly sets per muscle, on every screen (volume bars, Today's muscle figure, the Progress
     heat map): some (under the target) is a quiet green, on target is the full green, plenty (over the band, still
     sensible) is a deep teal. They step in lightness as well as hue, so they read apart without color vision.
     Legend words everywhere: "Some", "On target", "Plenty". Anatomy ("worked": m1 main, m2 also) is the accent blue, so
     green always means on target and red only ever means a problem. */
  --st-low:color-mix(in srgb,var(--good) 45%,var(--surface-3)); --st-ok:var(--good); --st-high:#0a4e63;
  /* the target zone behind the bars is neutral, so "some" never blends into it */
  --st-zone:color-mix(in srgb,var(--ink) 12%,transparent);
  --plenty:var(--st-high);
  /* 3:1 on bg, surface and surface-2: input borders, switch tracks, anything that must read as a control edge */
  --line-strong:#7d8797;
  /* the app's muscle figure drawn on the dark photo background (thumbnails without a photo) */
  --photo-fig:#dfe4ea; --photo-fig-2:#b2bbc6; --photo-glow:rgb(255 255 255 / .07);
  /* the dark hero block (Up next, today's target) and the floating rest timer */
  --hero:#0e1b47; --hero-2:#16275f; --hero-ink:#ffffff; --hero-muted:#b3bfe2; --hero-line:rgb(255 255 255 / .12); --hero-chip:rgb(255 255 255 / .1);
  --hero-cta:#ffffff; --hero-cta-ink:#0e1b47;
  --timer-bg:#0c1220; --timer-fill:#2453f0; --timer-ink:#ffffff; --timer-muted:rgb(255 255 255 / .72); --timer-btn:rgb(255 255 255 / .14);
  /* the exercise pictures' own black, in both themes, so a picture and its frame are one surface (no seams) */
  --photo-bg:#09090b; --overlay:rgb(10 14 22 / .62); --overlay-ink:#ffffff; --scrim:rgb(6 10 20 / .5);
  --knob:#ffffff; --shadow-knob:0 1px 3px rgb(15 23 42 / .3); --seg-on:#ffffff;
  --fig:#98a3af; --fig-far:#c8cfd6; --equip:#262c33; --equip-far:#8d96a0; --equip-soft:#a7b0ba;
  --m1:#2453f0; --m2:#86a0f7; --m0:#d3d9e0; --sil:#e7ebef;
  --plate-25:#c62828; --plate-20:#1f4fcf; --plate-15:#e2ab00; --plate-10:#2e7d32; --plate-5:#f4f4f4; --plate-2:#1d1d1f; --plate-1:#a9b1ba;
  --plate-ink-light:#ffffff; --plate-ink-dark:#111111;
  --chart-1:#2453f0; --chart-2:#e0453c; --chart-3:#0f7c43; --chart-4:#9a4a08; --chart-grid:#e3e7ec;
  --font-display:"Barlow Condensed","Cairo","Arial Narrow",system-ui,sans-serif;
  --font-body:"Barlow","Cairo",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  --tabbar-h:64px; --topbar-h:64px;
  color-scheme:light;
}
html[lang="ar"]{--lh-ui:1.4; --lh-body:1.6}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#080b10; --surface:#131922; --surface-2:#1b222d; --surface-3:#262e3b; --ink:#eef2f7; --muted:#99a3b3;
    --line:#2c3442; --line-soft:#1e2530; --card-line:#222a36; --st-high:#a8ecf5;
    --accent:#7d99ff; --accent-ink:#06091a; --accent-soft:#17214a; --accent-line:#2c3f86;
    --good:#4fd08a; --good-ink:#04150b; --good-soft:#0e271a;
    --warn:#ff9f5a; --warn-soft:#3a2110; --bad:#ff7b6f; --bad-soft:#3a1512;
    --gold:#f4c152; --gold-soft:#2b2210; --gold-line:#5a4618; --gold-ink:#1f1500; --line-strong:#737c8b;
    --photo-fig:#c9d0d9; --photo-fig-2:#97a1ae; --photo-glow:rgb(255 255 255 / .06);
    --hero:#13225a; --hero-2:#17275f; --hero-ink:#ffffff; --hero-muted:#aebbe3; --hero-line:rgb(255 255 255 / .1); --hero-chip:rgb(255 255 255 / .09);
    --hero-cta:#7d99ff; --hero-cta-ink:#06091a;
    --timer-bg:#18213a; --timer-fill:#2f4fc4; --timer-ink:#ffffff; --timer-muted:rgb(255 255 255 / .72); --timer-btn:rgb(255 255 255 / .12);
    --overlay:rgb(0 0 0 / .6); --overlay-ink:#ffffff; --scrim:rgb(0 0 0 / .62);
    --e1:inset 0 1px 0 rgb(255 255 255 / .05),0 1px 2px rgb(0 0 0 / .35); --e2:0 18px 44px -12px rgb(0 0 0 / .7);
    --knob:#eef2f7; --shadow-knob:0 1px 3px rgb(0 0 0 / .5); --seg-on:#313b4c;
    --fig:#7f8a98; --fig-far:#3e4752; --equip:#d9dfe6; --equip-far:#6b7580; --equip-soft:#56606c;
    --m1:#7d99ff; --m2:#3a4f99; --m0:#323a46; --sil:#1f252e;
    --chart-1:#7d99ff; --chart-2:#ff6a5c; --chart-3:#4fd08a; --chart-4:#ff9f5a; --chart-grid:#262e3a;
    color-scheme:dark;
  }
}
:root[data-theme="dark"]{
  --bg:#080b10; --surface:#131922; --surface-2:#1b222d; --surface-3:#262e3b; --ink:#eef2f7; --muted:#99a3b3;
  --line:#2c3442; --line-soft:#1e2530; --card-line:#222a36; --st-high:#a8ecf5;
  --accent:#7d99ff; --accent-ink:#06091a; --accent-soft:#17214a; --accent-line:#2c3f86;
  --good:#4fd08a; --good-ink:#04150b; --good-soft:#0e271a;
  --warn:#ff9f5a; --warn-soft:#3a2110; --bad:#ff7b6f; --bad-soft:#3a1512;
  --gold:#f4c152; --gold-soft:#2b2210; --gold-line:#5a4618; --gold-ink:#1f1500; --line-strong:#737c8b;
  --photo-fig:#c9d0d9; --photo-fig-2:#97a1ae; --photo-glow:rgb(255 255 255 / .06);
  --hero:#13225a; --hero-2:#17275f; --hero-ink:#ffffff; --hero-muted:#aebbe3; --hero-line:rgb(255 255 255 / .1); --hero-chip:rgb(255 255 255 / .09);
  --hero-cta:#7d99ff; --hero-cta-ink:#06091a;
  --timer-bg:#18213a; --timer-fill:#2f4fc4; --timer-ink:#ffffff; --timer-muted:rgb(255 255 255 / .72); --timer-btn:rgb(255 255 255 / .12);
  --overlay:rgb(0 0 0 / .6); --overlay-ink:#ffffff; --scrim:rgb(0 0 0 / .62);
  --e1:inset 0 1px 0 rgb(255 255 255 / .05),0 1px 2px rgb(0 0 0 / .35); --e2:0 18px 44px -12px rgb(0 0 0 / .7);
  --knob:#eef2f7; --shadow-knob:0 1px 3px rgb(0 0 0 / .5); --seg-on:#313b4c;
  --fig:#7f8a98; --fig-far:#3e4752; --equip:#d9dfe6; --equip-far:#6b7580; --equip-soft:#56606c;
  --m1:#7d99ff; --m2:#3a4f99; --m0:#323a46; --sil:#1f252e;
  --chart-1:#7d99ff; --chart-2:#ff6a5c; --chart-3:#4fd08a; --chart-4:#ff9f5a; --chart-grid:#262e3a;
  color-scheme:dark;
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;height:100%;background:var(--bg);
  /* keyboard focus and scrollIntoView stop clear of the fixed chrome: the top bar, and the tab bar plus the live workout
     pill; in a workout (focus mode) the exercise strip under the top bar and the rest timer at the bottom */
  scroll-padding-block-start:calc(var(--top-h,var(--topbar-h)) + 12px);scroll-padding-block-end:calc(var(--tabbar-h) + env(safe-area-inset-bottom,0px) + 72px)}
html:has(.shell.focus){scroll-padding-block-start:calc(var(--top-h,var(--topbar-h)) + 76px);scroll-padding-block-end:calc(var(--rest-h,0px) + 12px)}
/* No pull-to-refresh in a browser tab (it reloads the page and loses a weight being typed); the overscroll stretch stays */
html,body{overscroll-behavior-y:contain}
body{margin:0;min-height:100%;background:var(--bg);color:var(--ink);font-family:var(--font-body);font-size:var(--t-md);line-height:var(--lh-body);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-tap-highlight-color:transparent}
/* Letter-spacing breaks Arabic joining, and uppercase means nothing in Arabic. */
html[lang="ar"] body *{letter-spacing:normal!important;text-transform:none!important}
img{max-width:100%}
[hidden]{display:none!important}
button{font:inherit;color:inherit}
a{color:var(--accent)}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
/* seen by screen readers only. margin:-1px: it takes no room, so the two live regions at the end of the page never add
   a 1 px scroll to a screen that fits */
.sr{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
/* the skip link (index.html, first in #app): only beside the laptop rail, see the laptop shell below */
.skip-link{display:none}
::selection{background:var(--accent-soft)}

/* ---------- shell ---------- */
.shell{min-height:100vh;min-height:100dvh;display:flex;flex-direction:column}
.topbar{position:sticky;inset-block-start:0;z-index:20;background:color-mix(in srgb,var(--bg) 97%,transparent);-webkit-backdrop-filter:saturate(1.6) blur(14px);backdrop-filter:saturate(1.6) blur(14px);
  padding-block:calc(env(safe-area-inset-top,0px) + 10px) 10px;padding-inline:16px;border-block-end:1px solid var(--line-soft);display:flex;align-items:center;gap:12px;min-height:calc(var(--topbar-h) + env(safe-area-inset-top,0px))}
.topbar h1{flex:1;min-width:0;margin:0;font:700 var(--d-md)/var(--lh-tight) var(--font-display);letter-spacing:var(--track-d-md);text-transform:uppercase;text-wrap:balance;overflow-wrap:anywhere}
/* the title block: the h1 holds only the title, the eyebrow (.sub) shows above it whichever comes first in the markup */
.topbar .ttl{flex:1;min-width:0;display:flex;flex-direction:column}
.topbar .ttl>.sub{order:-1}
.topbar .sub{display:block;margin:0 0 var(--s-1);max-width:none;font:var(--f-label);letter-spacing:var(--track-label);text-transform:uppercase;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.topbar .btn-sm{flex:none}
.main{flex:1;width:100%;max-width:760px;margin:0 auto;padding-inline:16px;padding-block:16px calc(var(--tabbar-h) + env(safe-area-inset-bottom,0px) + 28px);display:flex;flex-direction:column;gap:16px;overflow-x:clip}
.shell.focus .main{padding-block-end:calc(env(safe-area-inset-bottom,0px) + 132px)}
.tabbar{position:fixed;inset-inline:0;inset-block-end:0;z-index:30;background:color-mix(in srgb,var(--surface) 92%,transparent);-webkit-backdrop-filter:saturate(1.6) blur(16px);backdrop-filter:saturate(1.6) blur(16px);
  border-block-start:1px solid var(--line-soft);padding-block-end:env(safe-area-inset-bottom,0px);display:grid;grid-template-columns:repeat(5,minmax(0,1fr))}
.shell.focus .tabbar{display:none}
/* First paint on a cold load (no service worker yet, a slow network): until the first screen renders, the page shows the
   tab bar's ground and a quiet hero-shaped block instead of a bare title on an empty page. Only matches before app.js
   has drawn anything (every screen fills <main>, and the blocked screen has its own content). */
.main:empty::before{content:"";display:block;block-size:min(42vh,320px);border-radius:var(--r-lg);background:linear-gradient(160deg,var(--hero-2),var(--hero) 62%);box-shadow:var(--e1)}
.main:empty::after{content:"";display:block;block-size:132px;border-radius:var(--r-lg);background:var(--surface);border:1px solid var(--card-line);box-shadow:var(--e1)}
.tabbar:empty{min-block-size:calc(var(--tabbar-h) + env(safe-area-inset-bottom,0px))}
.shell.focus .tabbar:empty{display:none}
.tab{display:grid;justify-items:center;align-content:center;gap:var(--s-1);min-height:var(--tabbar-h);border:0;background:none;color:var(--muted);font:600 var(--t-xs)/var(--lh-ui) var(--font-body);text-decoration:none;cursor:pointer;padding:var(--s-2) 2px;min-width:0}
/* the label clips for an ellipsis, so its line box must hold the descenders of y, g, p (at 1.1 they were cut) */
.tab span{max-inline-size:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:var(--lh-body)}
.tab svg{width:var(--ic-lg);height:var(--ic-lg);box-sizing:content-box;padding:var(--s-1) 18px;border-radius:var(--r-pill)}
.tab[aria-current="page"]{color:var(--accent);font-weight:700}
.tab[aria-current="page"] svg{background:var(--accent-soft)}
/* Icons: one optical stroke at every size (non-scaling, in CSS px): 1.75, ticks and checks 2.5 (.ic-bold). Sizes: 16 (in
   compact controls, chips, small text), 20 (buttons, rows, notes), 24 (tab bar, icon buttons). An icon in running text
   follows the text (1.25em). Never set a one-off icon size or stroke in a view's CSS. */
.ic{width:1.25em;height:1.25em;flex:none;vertical-align:-.2em;stroke-width:var(--ic-stroke)}
.ic *{vector-effect:non-scaling-stroke}
.ic.ic-bold{stroke-width:var(--ic-stroke-bold)}
.ic.ic-sm{width:var(--ic-sm);height:var(--ic-sm)} .ic.ic-md{width:var(--ic-md);height:var(--ic-md)} .ic.ic-lg{width:var(--ic-lg);height:var(--ic-lg)}
.btn .ic{width:var(--ic-md);height:var(--ic-md)}
/* the one icon disc: a 32 px circle with a 16 px icon (.lg: 44 px with 20 px, for a nudge or a state screen) */
.ic-disc{display:inline-grid;place-items:center;flex:none;inline-size:32px;block-size:32px;border-radius:50%;background:var(--surface-2);color:var(--ink)}
.ic-disc>.ic{width:var(--ic-sm);height:var(--ic-sm)}
.ic-disc.lg{inline-size:44px;block-size:44px}
.ic-disc.lg>.ic{width:var(--ic-md);height:var(--ic-md)}
.ic-disc.accent{background:var(--accent-soft);color:var(--accent)} .ic-disc.good{background:var(--good-soft);color:var(--good)}
.ic-disc.warn{background:var(--warn-soft);color:var(--warn)} .ic-disc.bad{background:var(--bad-soft);color:var(--bad)}
.ic-disc.gold{background:var(--gold);color:var(--gold-ink)}
.iconbtn{flex:none;width:44px;height:44px;border-radius:50%;border:0;background:var(--surface-2);display:grid;place-items:center;cursor:pointer;padding:0;color:var(--ink);text-decoration:none}
.iconbtn svg{width:var(--ic-lg);height:var(--ic-lg)}
.topbar .iconbtn{background:var(--surface);box-shadow:var(--shadow-1);border:1px solid var(--card-line)}
[dir="rtl"] .flip-rtl{transform:scaleX(-1)}
/* Saving failed (app.js saveAlert, role="alert"): a red-edged bar under the top bar that stays in view while the page
   scrolls, until a save works again. In a workout it sits in the page instead, so it never covers the exercise strip
   (the urgent toast still says it on every failure). */
.save-alert{position:sticky;inset-block-start:calc(var(--top-h,calc(var(--topbar-h) + env(safe-area-inset-top,0px) + 2px)) + 12px);z-index:19;
  display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;box-sizing:border-box;
  inline-size:calc(100% - 32px - env(safe-area-inset-left,0px) - env(safe-area-inset-right,0px));max-inline-size:728px;margin:12px auto 0;
  padding:var(--s-3) 14px;border-radius:var(--r-md);background:var(--bad-soft);color:var(--ink);
  border:1px solid color-mix(in srgb,var(--bad) 45%,transparent);box-shadow:var(--e2);font-weight:600;line-height:var(--lh-ui)}
.save-alert>span{flex:1 1 220px;min-width:0}
.save-alert .btn{flex:none}
.shell.focus .save-alert{position:relative;inset-block-start:auto;box-shadow:none}
/* Short screens (a phone on its side, or 400% zoom: 320 x 256 CSS px): the bars scroll away with the page instead of
   holding most of the screen, and the docked rest timer is one row, its time and its buttons. #app outranks the
   bar rules in views.css and workout.css, which load later. */
@media (max-height:500px){
  html,html:has(.shell.focus){scroll-padding-block-start:12px;scroll-padding-block-end:calc(var(--rest-h,0px) + 12px)}
  #app .topbar,#app .wk-steps{position:relative;inset-block-start:auto}
  #app .tabbar{position:static}
  #app .main{padding-block-end:calc(var(--rest-h,0px) + 16px)}
  #app .live-pill{position:static;margin:8px 16px}
  #app .lib-cta,#app .save-alert{position:static}
  .rest-bar:not(.is-full) :is(.rest-label,.rest-note,.rest-nextex){display:none}
  .rest-bar:not(.is-full) .rest-row{grid-template-areas:"left b1 b2 b3";padding-block:4px;min-block-size:0}
  .rest-bar:not(.is-full) .rest-left{font-size:var(--d-md)}
}
/* 400% zoom on a laptop (320 x 256 CSS px and smaller): the dock and the rest timer together would cover the whole
   window, so both sit in the page: the dock under its set, the timer after the page. A phone on its side is wider
   than this and keeps its bars (the rules above). */
@media (max-height:420px) and (max-width:599px){
  html,html:has(.shell.focus){scroll-padding-block-end:12px}
  #app .wk-card .list>li.eff-pick,#app .wk-card .wk-dock{position:static;max-inline-size:none;margin:0;padding-block-end:10px;box-shadow:inset 0 0 0 1px var(--line)}
  .rest-bar:not(.is-full){position:static;margin:0 10px 10px}
  #app .main,#app.focus .main{padding-block-end:16px}
}

/* ---------- type ---------- */
.h1{font:700 var(--d-lg)/var(--lh-tight) var(--font-display);letter-spacing:var(--track-d-lg);text-transform:uppercase;margin:0;text-wrap:balance}
/* section headers are sentence case in the body font, so the condensed caps of the hero, .h1, big numbers and the
   top bar title stand out. .display opts any element into the condensed caps look. */
.h2{font:700 var(--t-xl)/var(--lh-ui) var(--font-body);letter-spacing:0;text-transform:none;margin:0;text-wrap:balance}
.display{font-family:var(--font-display);letter-spacing:var(--track-d-md);text-transform:uppercase}
.h3{font:600 var(--t-lg)/var(--lh-ui) var(--font-body);margin:0}
/* the one small-caps label in the app: eyebrows, table heads, figure captions, set captions. Muted, never accent. */
.eyebrow{font:var(--f-label);letter-spacing:var(--track-label);text-transform:uppercase;color:var(--muted)}
/* the one "this is the current one" label on a screen (the next plan day): accent, at most once per screen */
.eyebrow.accent{color:var(--accent)}
.muted{color:var(--muted)}
.small{font-size:var(--t-sm)}
.tiny{font-size:var(--t-xs)}
.num,.tnum{font-variant-numeric:tabular-nums}
.big-num{font:700 var(--d-xl)/var(--lh-tight) var(--font-display);font-variant-numeric:tabular-nums;letter-spacing:0}
/* a compacted big number: "120k", "3.2M", "1.2 مليون", with the word set small so the number keeps the room */
.bn-u{font-size:.58em;margin-inline:.1em;letter-spacing:0}
html[lang="ar"] .bn-u{font-family:var(--font-body);font-size:.48em}
p{margin:0;max-width:65ch}
html[lang="ar"] .h1{font-size:var(--d-md);line-height:var(--lh-ui)}
html[lang="ar"] .h2{font-size:var(--t-lg)}
html[lang="ar"] .topbar h1{font-size:var(--d-sm);line-height:var(--lh-ui)}
/* In a workout the title stays on one line, so the bar keeps its height and the exercise strip under it in full
   (app.js also measures the bar into --top-h, where the strip sticks) */
.shell.focus .topbar h1{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-block:2px;margin-block:-2px}
@media (max-width:374px){html[lang="ar"] .shell.focus .topbar h1{font-size:var(--t-xl)}}
.topbar h1:focus{outline:none}
/* Cairo reaches far below the line: anything that clips (overflow:hidden) in Arabic keeps a 1.7 line box */
html[lang="ar"] .topbar .sub{line-height:1.7}
/* Arabic letters reach below the line (the dots of ي, the hamza of إ): with a tight line height and overflow:hidden
   they get cut, and "اليوم" reads as "البوم" */
html[lang="ar"] .tab span{line-height:1.7}

/* ---------- layout ---------- */
.stack{display:flex;flex-direction:column;gap:var(--s-3);min-width:0}
.stack-lg{display:flex;flex-direction:column;gap:var(--s-4);min-width:0}
.row{display:flex;align-items:center;gap:var(--s-2);flex-wrap:wrap;min-width:0}
.row-between{display:flex;align-items:center;justify-content:space-between;gap:var(--s-2);flex-wrap:wrap;min-width:0}
.grid-2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--s-2)}
.card{background:var(--surface);border:1px solid var(--card-line);border-radius:var(--r-lg);padding:var(--s-4);min-width:0;box-shadow:var(--e1)}
.card.flush{padding:0;overflow:hidden}
.list{list-style:none;margin:0;padding:0}
.list>li{border-block-start:1px solid var(--line-soft)}
.list>li:first-child{border-block-start:0}

/* ---------- the five card kinds (nothing else is a container) ----------
   1 .card            surface, hairline, e1, r-lg, padding 16. The only container.
   2 .hero            navy, r-lg, padding 20, e1, one per screen (Up next, the workout target, a finished workout).
   3 .list-group      a flush card of rows split by hairlines (History weeks, Plan days, settings rows); .lg-row is a row.
   4 .note            the inline tinted box with a tone, inside a card or between cards (tips, warnings, explanations).
   5 .tile            a number on top and a 12 px caption, on surface-2 (hero-chip inside a hero).
   Not allowed: accent, warn or gold card borders; coloured side stripes; gold card or row fills; a second hero. */
.hero{--ink:var(--hero-ink); --muted:var(--hero-muted); --line:var(--hero-line); --line-soft:var(--hero-line); --surface-2:var(--hero-chip);
  --accent:var(--hero-cta); --accent-ink:var(--hero-cta-ink);
  background:linear-gradient(160deg,var(--hero-2),var(--hero) 62%);color:var(--ink);border:0;border-radius:var(--r-lg);padding:var(--s-5);box-shadow:var(--e1)}
.list-group{list-style:none;margin:0;padding:0;background:var(--surface);border:1px solid var(--card-line);border-radius:var(--r-lg);box-shadow:var(--e1);overflow:hidden;min-width:0}
.list-group>li+li{border-block-start:1px solid var(--line-soft)}
/* a row: an optional 20 px icon (or an .ic-disc), a title with a muted line under it, then a value or a chevron */
.lg-row{display:flex;align-items:center;gap:var(--s-3);inline-size:100%;min-block-size:56px;padding:var(--s-3) var(--s-4);border:0;background:none;color:var(--ink);
  font:inherit;text-align:start;text-decoration:none;cursor:pointer}
.lg-row>.ic{width:var(--ic-md);height:var(--ic-md);color:var(--muted)}
.lg-main{flex:1;min-width:0;display:grid;gap:2px}
.lg-t{font-weight:600}
.lg-s{font-size:var(--t-sm);color:var(--muted)}
.lg-v{flex:none;color:var(--muted);font-size:var(--t-sm)}
.lg-row>.lg-chev{width:var(--ic-md);height:var(--ic-md);color:var(--muted)}
/* the note: ui.noteHtml(tone, text, {icon, title, act}) writes it. Tone sets only the fill and the icon colour; the text
   stays ink at 14 px. At most one bold lead line (.note-t). Coloured text only for a verdict of six words or fewer (.note-v). */
.note{display:flex;align-items:flex-start;gap:var(--s-2);padding:var(--s-3) 14px;border-radius:var(--r-md);background:var(--surface-2);color:var(--ink);
  font-size:var(--t-sm);line-height:var(--lh-body);min-width:0;max-width:none}
.note>.ic{width:var(--ic-md);height:var(--ic-md);margin-block-start:1px;color:var(--muted)}
.note-b{flex:1;min-width:0;display:grid;gap:var(--s-1)}
.note-b>p{max-width:none}
.note-t{font-weight:600}
.note-act{display:flex;flex-wrap:wrap;align-items:center;gap:var(--s-2);margin-block-start:var(--s-1)}
.note.accent{background:var(--accent-soft)} .note.accent>.ic,.note.accent .note-v{color:var(--accent)}
.note.good{background:var(--good-soft)} .note.good>.ic,.note.good .note-v{color:var(--good)}
.note.warn{background:var(--warn-soft)} .note.warn>.ic,.note.warn .note-v{color:var(--warn)}
.note.bad{background:var(--bad-soft)} .note.bad>.ic,.note.bad .note-v{color:var(--bad)}
.note-v{font-weight:700}
/* inside the navy hero every tone is the hero chip, and the icon takes the text colour */
.hero .note{background:var(--hero-chip)} .hero .note>.ic,.hero .note .note-v{color:inherit}
/* a card that leads with an icon disc (a reminder: backup, bodyweight, install): .card.has-ic, an .ic-disc.lg, then a
   .note-b body (.note-t bold line, muted lines, .note-act actions under the words) */
.card.has-ic{display:flex;align-items:flex-start;gap:var(--s-3)}
.card.has-ic>.note-b{gap:2px}
.card.has-ic .note-act{margin-block-start:var(--s-2)}
.tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(96px,1fr));gap:var(--s-2)}
.tile{display:grid;align-content:start;gap:var(--s-1);padding:var(--s-3);border-radius:var(--r-md);background:var(--surface-2);min-width:0}
.tile-n{font:700 var(--d-md)/var(--lh-tight) var(--font-display);font-variant-numeric:tabular-nums;white-space:nowrap}
.tile-n .bn-u{font-size:var(--t-md)}
.tile-c{font-size:var(--t-xs);line-height:var(--lh-ui);color:var(--muted)}

/* ---------- controls ---------- */
/* Buttons, one look per level (condensed caps only on the hero button, never on a secondary or compact one):
   .btn-primary 54 accent fill, one per screen | .btn-hero (or .btn-primary in a .hero) 58 condensed caps 24 |
   .btn 48 secondary, surface and hairline | .btn-quiet (= .btn-text) 44 accent text only | .btn-sm 44 compact pill |
   .btn-danger 48 red text and hairline | .btn-good green fill (Finish) | .iconbtn 44 circle, 24 px icon. */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:var(--s-2);min-height:48px;padding:10px var(--s-4);border-radius:var(--r-md);border:1px solid var(--line);background:var(--surface);color:var(--ink);font:600 var(--t-md)/var(--lh-ui) var(--font-body);cursor:pointer;text-decoration:none;text-align:center;-webkit-user-select:none;user-select:none}
.btn:disabled{opacity:.45;cursor:default}
.btn-primary{min-height:54px;background:var(--accent);border-color:var(--accent);color:var(--accent-ink);font:700 var(--t-lg)/var(--lh-ui) var(--font-body);letter-spacing:0;box-shadow:none}
/* the hero call to action keeps the condensed caps, so it is the loudest thing on the screen */
.btn-hero,.hero .btn-primary{min-height:58px;font:700 var(--d-sm)/var(--lh-tight) var(--font-display);letter-spacing:var(--track-d-sm);text-transform:uppercase}
.btn-hero{background:var(--accent);border-color:var(--accent);color:var(--accent-ink)}
.btn-good{background:var(--good);border-color:var(--good);color:var(--good-ink)}
.btn-quiet,.btn-text{min-height:44px;background:transparent;border-color:transparent;color:var(--accent)}
.btn-danger{color:var(--bad);border-color:color-mix(in srgb,var(--bad) 45%,transparent);background:transparent}
.btn-block{width:100%}
.btn-sm{min-height:44px;padding:var(--s-2) var(--s-4);font-size:var(--t-sm);border-radius:var(--r-pill);white-space:nowrap;gap:6px}
.btn-sm .ic{width:var(--ic-sm);height:var(--ic-sm)}
/* top-bar actions (Change plan, Edit, Finish) are secondary: sentence case in the body face, like every compact button */
.topbar .btn-sm{font-weight:600}
html[lang="ar"] :is(.btn-hero,.hero .btn-primary){font-family:var(--font-body);font-size:var(--t-xl);line-height:var(--lh-ui)}
/* chips: a 24 px status pill (12 px) and a 40 px action pill (button.chip, 14 px, hit area 44) */
.chip{display:inline-flex;align-items:center;gap:6px;min-height:24px;font:600 var(--t-xs)/var(--lh-ui) var(--font-body);padding:var(--s-1) 10px;border-radius:var(--r-pill);background:var(--surface-2);color:var(--muted);white-space:nowrap}
.chip .ic{width:var(--ic-sm);height:var(--ic-sm)}
.chip.accent{background:var(--accent-soft);color:var(--accent)}
.chip.good{background:var(--good-soft);color:var(--good)}
.chip.warn{background:var(--warn-soft);color:var(--warn)}
/* celebration icon: a trophy or star on a small solid gold disc (gold's only form besides the record pill) */
.ic.gold-ic{box-sizing:content-box;width:var(--ic-sm);height:var(--ic-sm);padding:var(--s-1);border-radius:50%;background:var(--gold);color:var(--gold-ink);vertical-align:middle}
/* interactive chips: a 40px pill with a hit area stretched to 44px */
button.chip{position:relative;min-height:40px;padding-inline:14px;border:0;cursor:pointer;font-size:var(--t-sm);color:var(--ink)}
button.chip::after{content:"";position:absolute;inset-block:-2px;inset-inline:0}
button.chip.accent,button.chip[aria-pressed="true"]{background:var(--accent);color:var(--accent-ink)}
p.chip{white-space:normal;line-height:var(--lh-body);padding:var(--s-2) var(--s-3);border-radius:var(--r-sm);max-width:none}
.field{display:grid;gap:var(--s-2);min-width:0}
.field>span{font-size:var(--t-sm);color:var(--muted);font-weight:600}
.input{width:100%;min-height:48px;font:600 var(--t-lg)/var(--lh-ui) var(--font-body);font-variant-numeric:tabular-nums;padding:10px 12px;border:1.5px solid var(--line-strong);border-radius:var(--r-md);background:var(--surface-2);color:var(--ink)}
/* a focused field shows the same 2 px ring as every other control (:focus-visible above), plus its accent border */
.input:focus{border-color:var(--accent);background:var(--surface)}
.input[aria-invalid="true"]{border-color:var(--bad)}
.input:disabled{opacity:1;color:var(--ink);-webkit-text-fill-color:var(--ink)}
.input::placeholder{color:var(--muted);opacity:1;font-weight:400}
textarea.input{font:var(--t-md)/var(--lh-body) var(--font-body);min-height:76px;resize:vertical}
select.input{font-size:var(--t-md)}
input[type="search"].input{font-size:var(--t-md);font-weight:400;border-radius:var(--r-pill);padding-inline:var(--s-4)}
/* Segments are equal columns that never grow past their box: a long label (Arabic, a big text size) wraps onto a
   second line inside its segment instead of pushing the page sideways, and the sliding pill below stays aligned. */
.seg{display:inline-grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:2px;padding:3px;border-radius:var(--r-md);background:var(--surface-2);border:1px solid var(--line-soft);max-inline-size:100%}
.seg button{border:0;background:none;padding:var(--s-2) 14px;min-height:42px;min-inline-size:0;border-radius:calc(var(--r-md) - 3px);cursor:pointer;font-weight:600;color:var(--muted);white-space:normal;line-height:var(--lh-ui);text-wrap:balance;overflow-wrap:break-word}
.seg-sm{padding:2px;flex:none}
.seg-sm button{min-height:40px;padding:6px var(--s-3);font-size:var(--t-sm)}
/* narrow screens: less padding so a label wraps later */
@media (max-width:419px){.seg button{padding-inline:8px}}
@media (max-width:340px){
  .seg button{padding-inline:6px}
  .topbar .seg-sm button{padding-inline:7px}
}
.seg button[aria-pressed="true"]{background:var(--seg-on);color:var(--ink);font-weight:700;box-shadow:var(--e1),0 0 0 1px var(--card-line)}
/* The chosen segment is one pill that slides to the segment you pick, on every segmented control, with no script:
   :has() reads which button is pressed (or selected, for tabs) into --i, and how many there are into --n.
   The pill moves the other way in RTL. Browsers without :has() keep the plain pressed background above. */
@supports selector(:has(a)){
  .seg{position:relative;isolation:isolate;--seg-pad:3px;--n:1;--i:0;--seg-dir:1}
  .seg-sm{--seg-pad:2px}
  [dir="rtl"] .seg{--seg-dir:-1}
  .seg:has(>:nth-child(2)){--n:2} .seg:has(>:nth-child(3)){--n:3} .seg:has(>:nth-child(4)){--n:4} .seg:has(>:nth-child(5)){--n:5} .seg:has(>:nth-child(6)){--n:6}
  .seg:has(>:nth-child(2):is([aria-pressed="true"],[aria-selected="true"])){--i:1}
  .seg:has(>:nth-child(3):is([aria-pressed="true"],[aria-selected="true"])){--i:2}
  .seg:has(>:nth-child(4):is([aria-pressed="true"],[aria-selected="true"])){--i:3}
  .seg:has(>:nth-child(5):is([aria-pressed="true"],[aria-selected="true"])){--i:4}
  .seg:has(>:nth-child(6):is([aria-pressed="true"],[aria-selected="true"])){--i:5}
  .seg:has(>:is([aria-pressed="true"],[aria-selected="true"]))::before{content:"";position:absolute;z-index:-1;pointer-events:none;
    inset-block:var(--seg-pad);inset-inline-start:var(--seg-pad);inline-size:calc((100% - 2 * var(--seg-pad) - (var(--n) - 1) * 2px) / var(--n));
    border-radius:calc(var(--r-md) - 3px);background:var(--seg-on);box-shadow:var(--e1),0 0 0 1px var(--card-line);
    transform:translateX(calc(var(--i) * (100% + 2px) * var(--seg-dir)))}
  .seg button[aria-pressed="true"],.seg button[aria-selected="true"]{background:transparent;box-shadow:none;color:var(--ink);font-weight:700}
}
.switch{position:relative;width:52px;height:32px;flex:none}
.switch input{position:absolute;inset:0;opacity:0;margin:0;cursor:pointer;z-index:1}
.switch span{position:absolute;inset:0;border-radius:var(--r-pill);background:var(--surface-3);box-shadow:inset 0 0 0 1.5px var(--line-strong);transition:background .15s}
.switch span::after{content:"";position:absolute;inset-block-start:3px;inset-inline-start:3px;width:26px;height:26px;border-radius:50%;background:var(--knob);box-shadow:var(--shadow-knob);transition:inset-inline-start .18s}
.switch input:checked+span{background:var(--accent);box-shadow:none}
.switch input:checked+span::after{inset-inline-start:23px}
.switch input:focus-visible+span{outline:2px solid var(--accent);outline-offset:2px}

/* ---------- plate chips ---------- */
.plates{display:flex;flex-wrap:wrap;align-items:center;gap:4px}
.plabel{font-size:var(--t-xs);color:var(--muted);margin-inline-end:var(--s-1)}
.plate{display:inline-flex;align-items:center;justify-content:center;min-width:32px;height:26px;padding:0 6px;border-radius:var(--r-sm);font:700 var(--t-xs)/1 var(--font-body);font-variant-numeric:tabular-nums}
.p25{background:var(--plate-25);color:var(--plate-ink-light)}
.p20{background:var(--plate-20);color:var(--plate-ink-light)}
.p15{background:var(--plate-15);color:var(--plate-ink-dark)}
.p10{background:var(--plate-10);color:var(--plate-ink-light)}
.p5{background:var(--plate-5);color:var(--plate-ink-dark);box-shadow:inset 0 0 0 1px var(--line)}
.p2_5{background:var(--plate-2);color:var(--plate-ink-light);box-shadow:inset 0 0 0 1px var(--line)}
.p1_25{background:var(--plate-1);color:var(--plate-ink-dark)}
.p0_5,.p0_25{background:var(--plate-1);color:var(--plate-ink-dark);min-width:26px}
/* an odd size (a change plate the table has no color for) */
.plate.px{background:var(--surface-3);color:var(--ink);box-shadow:inset 0 0 0 1px var(--line)}

/* ---------- exercise media (photo loop + muscle view) ---------- */
/* one family of pictures: every frame sits on the pictures' own black (--photo-bg), the stage takes the picture's shape
   (ui.js clamps it to 0.8-2.4) and the picture covers it; past 2.4:1 it is letterboxed on the same black, so no seam shows */
.media{position:relative;border-radius:var(--r-lg);overflow:hidden;background:var(--photo-bg);aspect-ratio:3/2;min-width:0;isolation:isolate}
.media .frames{position:absolute;inset:0}
.media .frames img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;background:var(--photo-bg)}
.media.fit-wide .frames img{object-fit:contain}
/* the two frames cross-fade (140 ms of a 2.6 s loop) instead of a hard cut every second */
.media .frames img+img{opacity:0;animation:loopfade 2.6s ease-in-out infinite}
@keyframes loopframe{0%{opacity:0}50%{opacity:1}}
@keyframes loopfade{0%,44.6%{opacity:0}50%,94.6%{opacity:1}100%{opacity:0}}
.media canvas{position:absolute;inset:0;width:100%;height:100%;background:var(--surface)}
.media .media-ctl{position:absolute;inset-inline-end:var(--s-2);inset-block-end:var(--s-2);display:flex;gap:var(--s-2);z-index:2}
.media .media-ctl button{display:inline-flex;align-items:center;gap:6px;border:0;background:var(--overlay);color:var(--overlay-ink);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);border-radius:var(--r-pill);font:600 var(--t-sm)/1 var(--font-body);padding:var(--s-2) var(--s-3);min-height:40px;min-width:40px;justify-content:center;cursor:pointer}
.media .media-ctl .ic{width:var(--ic-sm);height:var(--ic-sm)}
/* image credit: a small caption under the picture, never over it */
.media-credit{margin:var(--s-2) var(--s-1) 0;font-size:var(--t-xs);line-height:var(--lh-ui);color:var(--muted);max-width:none}
.media.paused .frames img+img{animation-play-state:paused}
/* reduced motion: the two frames side by side (tall pictures) or one above the other (wide ones, .stack), each with its
   "Start" / "End" label in its top corner, clear of the controls at the bottom */
.media-cap{display:none;position:absolute;inset:0;z-index:1;pointer-events:none;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:2px}
.media.stack .media-cap{grid-auto-flow:row;grid-auto-rows:minmax(0,1fr)}
.media-cap>span{align-self:start;justify-self:start;margin:var(--s-2);padding:2px var(--s-2);border-radius:var(--r-pill);background:var(--overlay);
  font:var(--f-label);letter-spacing:var(--track-label);text-transform:uppercase;color:var(--overlay-ink)}
/* thumbnails are square and filled: the lifter fills the tile, every row has the same shape */
.thumb{aspect-ratio:1;border-radius:var(--r-sm);overflow:hidden;background:var(--photo-bg)}
.thumb img{width:100%;height:100%;object-fit:cover;object-position:50% 40%;display:block}
/* no photo: the app's own figure, drawn light on the same dark ground as the photos so a list reads as one set */
.thumb-map{display:grid;place-items:center;padding:4% 0;--sil:var(--photo-fig);--m0:var(--photo-fig-2);
  background:radial-gradient(closest-side,var(--photo-glow),transparent),var(--photo-bg)}
.thumb-map .mfig{block-size:100%;inline-size:auto;max-inline-size:100%;display:block}
.thumb-map .mp{animation:none!important}
.mmap{display:flex;gap:12px;justify-content:center;align-items:flex-end;background:var(--surface);border:1px solid var(--line-soft);border-radius:var(--r-md);padding:12px}
.mmap figure{margin:0;display:grid;justify-items:center;gap:4px}
/* figure width: --mmap-w on any ancestor (the Progress heat map sets min(118px,32vw)) */
.mmap figure{min-width:0;flex:0 1 var(--mmap-w,68px)}
.mmap svg{width:var(--mmap-w,68px);max-width:100%;height:auto;display:block}
.mmap figcaption{font:var(--f-label);color:var(--muted);text-transform:uppercase;letter-spacing:var(--track-label)}
.sil{fill:var(--sil)} .mn{fill:var(--m0)} .ms{fill:var(--m2)} .mp{fill:var(--m1)}
.legend{display:flex;flex-wrap:wrap;gap:6px}
.mchip{font-size:var(--t-xs);font-weight:600;line-height:var(--lh-ui);padding:var(--s-1) 10px;border-radius:var(--r-pill);display:inline-flex;align-items:center;gap:6px;background:var(--surface-2)}
.mchip i{width:9px;height:9px;border-radius:50%;display:inline-block;flex:none}
.mchip.p i{background:var(--m1)} .mchip.s i{background:var(--m2)}
/* weekly sets per muscle (the --st-* scale): body shapes on a heat figure, and the one legend that names them.
   Untrained muscles keep the body color with a faint outline, so they never pass for "some". */
.hm{fill:var(--sil);stroke:var(--m0);stroke-width:.7}
.hm.s1{fill:var(--st-low);stroke:none} .hm.s2{fill:var(--st-ok);stroke:none} .hm.s3{fill:var(--st-high);stroke:none}
.st-legend{display:flex;flex-wrap:wrap;align-items:center;gap:var(--s-1) var(--s-3);max-width:none;font-size:var(--t-xs);line-height:var(--lh-ui);color:var(--muted)}
.st-legend>span{display:inline-flex;align-items:center;gap:6px}
.st-sw{display:inline-block;flex:none;inline-size:10px;block-size:10px;border-radius:50%;background:var(--st-ok)}
.st-sw.s1{background:var(--st-low)} .st-sw.s3{background:var(--st-high)}
.st-sw.zone{inline-size:18px;border-radius:var(--r-pill);background:var(--st-zone)}
.cues{margin:0;padding:0;list-style:none;counter-reset:cue;display:grid;gap:var(--s-3);max-width:65ch}
.cues>li{counter-increment:cue;display:grid;grid-template-columns:24px minmax(0,1fr);gap:var(--s-3);align-items:start;line-height:var(--lh-body)}
.cues>li::before{content:counter(cue);display:grid;place-items:center;inline-size:24px;block-size:24px;margin-block-start:1px;border-radius:50%;background:var(--surface-2);color:var(--ink);font:700 var(--t-sm)/1 var(--font-body)}

/* ---------- sheet (bottom drawer) and toast ---------- */
.sheet-backdrop{position:fixed;inset:0;z-index:60;background:var(--scrim);display:flex;align-items:flex-end;justify-content:center}
.sheet{width:100%;max-width:760px;max-height:90vh;max-height:min(90dvh,calc(100% - 8px));overflow:auto;overscroll-behavior:contain;background:var(--surface);border-radius:var(--r-lg) var(--r-lg) 0 0;padding:10px 16px calc(env(safe-area-inset-bottom,0px) + 20px);display:flex;flex-direction:column;gap:14px;box-shadow:var(--e2)}
.sheet>*{flex-shrink:0}
/* the handle: a full-width strip over the sheet's top edge that a finger can drag down (ui.js dragClose), with the
   title row under it; neither pans the page, so the drag reaches the script */
.sheet>.grab{flex:none;align-self:stretch;display:flex;justify-content:center;block-size:24px;margin-block:-10px -14px;margin-inline:-16px;padding-block-start:10px;touch-action:none;cursor:grab;-webkit-user-select:none;user-select:none}
.sheet>.grab::before{content:"";inline-size:40px;block-size:5px;border-radius:var(--r-pill);background:var(--line)}
.sheet>.grab+:is(.row-between,.h2){touch-action:none}
.sheet .row-between>.h2{flex:1;min-width:0}
/* a long name with no spaces (a lifter's own exercise, a plan day) breaks inside the sheet instead of widening it */
.sheet :is(.h2,.h3,p),.lg-t,.lg-s{overflow-wrap:anywhere;min-width:0}
.toast{position:fixed;z-index:80;inset-inline:16px;inset-block-end:calc(var(--tabbar-h) + env(safe-area-inset-bottom,0px) + 14px);max-width:520px;margin:0 auto;background:var(--ink);color:var(--bg);border-radius:var(--r-md);padding:var(--s-3) var(--s-4);font-weight:600;box-shadow:var(--e2)}
/* in a workout the toast clears the docked rest timer (rest.js sets --rest-h, its height and gap); over an open sheet
   ui.js dockToast places it above the sheet instead (an inline value, which wins) */
.shell.focus~.toast:not(.pwa-update){inset-block-end:calc(max(112px,var(--rest-h,0px) + 8px) + env(safe-area-inset-bottom,0px))}
/* a toast with a button (Undo): the words, then the button at the end */
.toast:has(.toast-act){display:flex;align-items:center;justify-content:space-between;gap:var(--s-3);padding-block:6px;padding-inline-end:6px}
.toast-act{flex:none;min-block-size:44px;padding-inline:var(--s-4);border:0;border-radius:var(--r-sm);background:color-mix(in srgb,var(--bg) 16%,transparent);color:inherit;font:700 var(--t-md)/1 var(--font-body);cursor:pointer}
.toast :focus-visible{outline-color:var(--bg)}
.empty{display:grid;gap:var(--s-3);justify-items:start;padding:var(--s-5);border:1.5px dashed var(--line);border-radius:var(--r-lg);color:var(--muted)}
.empty b{color:var(--ink)}

@media (prefers-reduced-motion: no-preference){
  .btn,.tab,.chip,.seg button,.iconbtn,.input{transition:background-color .15s,color .15s,border-color .15s,box-shadow .15s,transform .12s}
  .btn:active,button.chip:active,.iconbtn:active{transform:scale(.97)}
  /* the worked muscles breathe a few times when a map appears, then hold still */
  .mp{animation:mpulse 1.6s ease-in-out 1}
  @keyframes mpulse{50%{opacity:.62}}
  .sheet{animation:sheetup .26s cubic-bezier(.2,.9,.3,1)}
  .sheet-backdrop{animation:fadein .2s ease-out}
  @keyframes sheetup{from{transform:translateY(40px);opacity:.4}}
  @keyframes fadein{from{opacity:0}}
  .toast:not([hidden]){animation:toastin .22s cubic-bezier(.2,.9,.3,1)}
  @keyframes toastin{from{transform:translateY(12px);opacity:0}}
}
@media (prefers-reduced-motion: reduce){
  /* no loop: the start and end positions side by side (ui.js adds .still and the captions), no Pause button */
  .media .frames img+img{animation:none;opacity:0}
  .media.still .frames{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:2px;background:var(--line)}
  .media.still.stack .frames{grid-auto-flow:row;grid-auto-rows:minmax(0,1fr)}
  .media.still .frames img,.media.still .frames img+img{position:relative;inset:auto;min-width:0;min-height:0;opacity:1}
  .media.still .media-cap{display:grid}
  /* no squeeze on a tap: a dim instead, so a finger still sees what it pressed */
  :is(.btn,.iconbtn,button.chip,.seg button,.pick,.choice,.wk-step,.lib-card):active:not(:disabled),.tab:active svg{opacity:.7}
}
/* Rows of chips, the tab bar and the segmented controls are controls, not text: a long press does not select them */
.tabbar,.filter-row,.seg,button.chip,.wk-steps{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}

/* ===================== motion and feedback (fx.js) =====================
   Everything that moves animates transform or opacity only. Each effect has a static fallback below and in
   the reduced-motion block at the end. */
/* No moving light: the hero keeps one soft light (--fx-glow-1); the second blob and the glint across the Start button are
   retired (transparent, the old names kept so nothing breaks). */
:root{--fx-glow-1:rgb(61 110 255 / .55); --fx-glow-2:transparent; --fx-sheen:transparent; --fx-shade:rgb(15 23 42 / .08)}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){--fx-glow-1:rgb(98 130 255 / .42); --fx-shade:rgb(0 0 0 / .5)}
}
:root[data-theme="dark"]{--fx-glow-1:rgb(98 130 255 / .42); --fx-shade:rgb(0 0 0 / .5)}

/* progress ring: fx.ring(el, pct) puts the SVG in el; any other child (a number) sits in the middle */
.fx-ring{position:relative;display:inline-grid;place-items:center;inline-size:52px;block-size:52px;flex:none}
.fx-ring>*{grid-area:1/1}
.fx-ring-svg{inline-size:100%;block-size:100%;transform:rotate(-90deg)}
.fx-ring-svg circle{fill:none;stroke-width:5}
.fx-ring-bg{stroke:var(--surface-2)}
.fx-ring-fg{stroke:var(--accent);stroke-linecap:round}
.fx-ring.is-full .fx-ring-fg{stroke:var(--done)}
.fx-ring.is-empty .fx-ring-fg{visibility:hidden}
.fx-ring-n{font:700 var(--d-sm)/var(--lh-tight) var(--font-display);font-variant-numeric:tabular-nums;color:var(--ink)}
/* confetti canvas (fx.celebrate) floats above sheets, under toasts, and never takes a tap */
.fx-confetti{position:fixed;inset:0;inline-size:100%;block-size:100%;z-index:70;pointer-events:none}
/* ring burst from a tick button (fx.burst) */
.fx-burst{position:absolute;inset:-3px;border-radius:inherit;box-shadow:0 0 0 3px var(--done);pointer-events:none}
.fx-burst.gold{box-shadow:0 0 0 3px var(--gold)}

@media (prefers-reduced-motion: no-preference){
  /* page transitions (fx.transition): the page slides and fades a short way, mirrored in RTL by fx.js;
     the top bar and tab bar hold still and only cross-fade their contents */
  html[data-vt] .topbar{view-transition-name:fx-top}
  html[data-vt] .tabbar{view-transition-name:fx-tabs}
  ::view-transition-group(*){animation-duration:.3s;animation-timing-function:cubic-bezier(.2,.8,.2,1)}
  html[data-vt]::view-transition-old(root){animation:fx-vt-out .16s cubic-bezier(.4,0,1,1) both;mix-blend-mode:normal}
  html[data-vt]::view-transition-new(root){animation:fx-vt-in .3s cubic-bezier(.2,.8,.2,1) .04s both;mix-blend-mode:normal}
  ::view-transition-old(fx-top),::view-transition-new(fx-top),::view-transition-old(fx-tabs),::view-transition-new(fx-tabs){animation-duration:.2s}
  /* switching tabs is a 120 ms cross-fade and nothing else (iOS and Android tab bars switch in place); drilling in keeps the push */
  html[data-vt="tab"]::view-transition-group(*){animation-duration:.12s}
  html[data-vt="tab"]::view-transition-old(root){animation:fx-xfade-out .12s linear both}
  html[data-vt="tab"]::view-transition-new(root){animation:fx-xfade-in .12s linear both}
  html[data-vt="tab"]::view-transition-old(fx-top),html[data-vt="tab"]::view-transition-new(fx-top){animation-duration:.12s}
  @keyframes fx-xfade-out{to{opacity:0}}
  @keyframes fx-xfade-in{from{opacity:0}}
  /* an exercise photo morphs between its thumbnail and the big photo */
  ::view-transition-group(fx-morph){animation-duration:.36s}
  ::view-transition-old(fx-morph),::view-transition-new(fx-morph){block-size:100%;object-fit:cover;animation-duration:.36s}
  @keyframes fx-vt-out{to{opacity:0;transform:translateX(calc(var(--fx-vt-x,0px) * -1))}}
  @keyframes fx-vt-in{from{opacity:0;transform:translateX(var(--fx-vt-x,0px))}}

  /* entrances: fx.stagger sets --fx-i on each element (at most 4, first visit to a screen in a session only) */
  .fx-in{animation:fx-rise .28s cubic-bezier(.2,.8,.2,1) backwards;animation-delay:calc(var(--fx-i,0) * 30ms)}
  .fx-in.fx-in-pop{animation-name:fx-popin;animation-duration:.32s;animation-timing-function:cubic-bezier(.3,1.6,.5,1)}
  @keyframes fx-rise{from{opacity:0;transform:translateY(8px)}}
  /* Motion budget: ambient decoration (the hero's light, a ripple, a halo) plays on the first visit to a screen in a
     session only; app.js puts .fx-first on <main> then. Revisits and redraws open still. Views: give any new ambient
     effect a selector here, or scope it under .fx-first yourself, and play it once. */
  .main:not(.fx-first) :is(.hero,.target-card)::before,.main:not(.fx-first) .hero::after,.main:not(.fx-first) .hero .btn-primary::after,
  .main:not(.fx-first) .week-dots .wd-dot::after,.main:not(.fx-first) .pg-hero .pg-sh,.main:not(.fx-first) .install-card{animation:none!important}
  .fx-still{animation:none!important}
  @keyframes fx-popin{from{opacity:0;transform:scale(.55)}}
  @keyframes fx-grow-x{from{transform:scaleX(0)}}
  @keyframes fx-trophy{0%{opacity:0;transform:scale(.3) rotate(-25deg)}60%{opacity:1;transform:scale(1.12) rotate(6deg)}100%{transform:none}}

  /* press: a quick squeeze on touch, a springy release */
  .btn,.iconbtn,button.chip,.seg button{transition:background-color .15s,color .15s,border-color .15s,box-shadow .15s,transform .42s cubic-bezier(.3,1.6,.5,1)}
  .btn:active:not(:disabled),.iconbtn:active:not(:disabled),button.chip:active,.seg button:active{transform:scale(.95);transition-duration:.15s,.15s,.15s,.15s,.06s}
  .btn-primary:active:not(:disabled){transform:scale(.97)}
  .tab svg{transition:background-color .2s,transform .42s cubic-bezier(.3,1.6,.5,1)}
  .tab:active svg{transform:scale(.86);transition-duration:.2s,.06s}
  .switch span::after{transition:inset-inline-start .36s cubic-bezier(.3,1.5,.5,1),inline-size .2s ease}
  .switch input:active+span::after{inline-size:32px}
  .switch input:checked:active+span::after{inset-inline-start:17px}
  .fx-ring-fg{transition:stroke-dashoffset 1s cubic-bezier(.2,.8,.2,1) .15s}
  .seg::before{transition:transform .32s cubic-bezier(.3,1.3,.5,1)}
  /* bars grow from the start edge when a screen opens (.fx-enter is set on <main> by the router) */
  .fx-enter .vb-fill{animation:fx-grow-x .8s cubic-bezier(.2,.8,.2,1) .2s backwards;transform-origin:left center}
  [dir="rtl"] .fx-enter .vb-fill{transform-origin:right center}

  /* a soft shadow fades in under the top bar as the page scrolls (scroll-driven, so no JS and no jank) */
  @supports (animation-timeline: scroll()){
    .topbar::after{content:"";position:absolute;inset-inline:0;inset-block-start:100%;block-size:14px;pointer-events:none;
      background:linear-gradient(var(--fx-shade),transparent);opacity:0;animation:fx-fade-in linear both;animation-timeline:scroll(root);animation-range:0 96px}
    @keyframes fx-fade-in{to{opacity:1}}
  }
}
@media (prefers-reduced-motion: reduce){
  ::view-transition-group(*),::view-transition-old(*),::view-transition-new(*){animation:none!important}
  .fx-in,.fx-enter *,.fx-show *,.fx-burst{animation:none!important}
  .fx-confetti,.fx-burst{display:none}
  .fx-ring-fg,.switch span,.switch span::after,.seg::before{transition:none!important}
}

/* Forced colors (Windows High Contrast): the browser repaints every surface in system colors, which would erase the
   app's states (a switch that is on, the chosen segment or chip, a ticked set, calendar days, the timer's edge).
   These keep each state visible with system colors only. */
@media (forced-colors:active){
  .switch span{forced-color-adjust:none;background:Canvas;box-shadow:inset 0 0 0 2px CanvasText}
  .switch span::after{forced-color-adjust:none;background:CanvasText;box-shadow:none}
  .switch input:checked+span{background:Highlight}
  .switch input:checked+span::after{background:HighlightText}
  .seg::before{display:none}
  :root :is(.seg button[aria-pressed="true"],.seg button[aria-selected="true"],button.chip[aria-pressed="true"],button.chip.accent,.choice.on,.ob-tile.on,.day-n.on,.cal-day[aria-pressed="true"],.set-check[aria-pressed="true"]){
    forced-color-adjust:none;background:Highlight;color:HighlightText;border-color:Highlight}
  .set-row.is-next::after{forced-color-adjust:none;background:Highlight}
  .cal-day[class*="lv-"]{border:2px solid CanvasText}
  .cal-day.is-today{outline:2px dashed CanvasText;outline-offset:-4px}
  :is(.cal-pr,.cal-pr-k,.st-sw,.cal-sw i,.mchip i,.lp-dot){forced-color-adjust:none}
  .rest-bar,.live-pill,.save-alert{border:2px solid CanvasText}
  .rest-bar .btn,.media-ctl button{border:1px solid ButtonText}
}

/* ===================== laptop shell (round 9) =====================
   The phone layout above is untouched: every rule here sits behind a width or hover query.
   --rail-w is the side rail's width (0 on a phone, in a workout and in onboarding): anything fixed to the screen's
   inline-start edge adds it, calc(var(--rail-w) + 16px). app.js sets html[data-focus] on focus screens and
   html[data-wide] / main.wide when a screen calls ctx.wide(). Short screens (a phone on its side) keep the bottom bar. */
:root{--rail-w:0px}
/* the printed plan (print.css shows it, and hides everything else, on paper only) */
#print-root{display:none}
@media (min-width:900px) and (min-height:501px){
  :root{--rail-w:88px;--tabbar-h:0px}
  html[data-focus]{--rail-w:0px}
  /* the tab bar becomes a rail on the inline-start edge: the same element and the same five links, icon over label */
  .shell{padding-inline-start:var(--rail-w)}
  .tabbar{inset-inline:0 auto;inset-block:0;inline-size:var(--rail-w);grid-template-columns:minmax(0,1fr);grid-auto-rows:min-content;align-content:start;gap:var(--s-1);
    padding:0 var(--s-2) var(--s-2);overflow-y:auto;border-block-start:0;border-inline-end:1px solid var(--line-soft);background:var(--surface)}
  /* the app's name heads the rail, level with the top bar (app.js keeps it in data-brand, in the page's language) */
  .tabbar::before{content:attr(data-brand);display:grid;place-items:center;min-block-size:var(--topbar-h);margin-block-end:var(--s-2);
    font:700 var(--d-sm)/var(--lh-tight) var(--font-display);letter-spacing:var(--track-d-sm);text-transform:uppercase;color:var(--ink)}
  html[lang="ar"] .tabbar::before{font-size:var(--t-xl);line-height:var(--lh-ui);letter-spacing:normal;text-transform:none}
  .tab{min-height:64px;border-radius:var(--r-md)}
  /* the title starts at the content column's edge */
  .topbar{padding-inline:max(var(--s-4),calc((100% - 760px) / 2 + var(--s-4)))}
  /* fixed things clear the rail */
  .toast{inset-inline-start:calc(var(--rail-w) + var(--s-4))}
  #app .live-pill{inset-inline-start:calc(var(--rail-w) + var(--s-4))}
  /* a sheet is a dialog in the middle of the screen, not a drawer on the bottom edge (ui.js: no drag to close) */
  .sheet-backdrop{align-items:center}
  .sheet{max-width:560px;max-height:min(80dvh,720px);border-radius:var(--r-lg);padding:var(--s-4) var(--s-4) var(--s-5)}
  .sheet>.grab{display:none}
  /* the rail is first on screen and first in the tab order (app.js placeTabs), so the first Tab stop is a way past it:
     out of sight until it has focus */
  .skip-link{display:block;position:fixed;z-index:90;inset-block-start:var(--s-2);inset-inline-start:var(--s-2);padding:var(--s-3) var(--s-4);border-radius:var(--r-md);
    background:var(--surface);color:var(--ink);font-weight:600;text-decoration:none;box-shadow:var(--e2)}
  .skip-link:not(:focus){inline-size:1px;block-size:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;box-shadow:none}
  html[data-focus] .skip-link{display:none}
}
/* Lines stay near 70 characters on a wide screen. "ch" is the width of a 0, wider than the average letter in this face
   (65ch read as 87 letters), so the cap is 52ch. :where() keeps the weight of a bare p, so every rule that lets a
   paragraph run the full width (max-width:none, a flex row) still wins. Only paragraphs the 65ch cap already held are
   touched: any size in the single column, the small ones in a two-column screen. */
@media (min-width:900px) and (min-height:501px){
  :where(.main:not(.wide)) p,:where(.main.wide) p:where(.small){max-width:52ch}
  .cues{max-width:52ch}
  .note-b>p:not([class]){max-width:52ch}
}
@media (min-width:1200px) and (min-height:501px){
  /* room for the label beside the icon, the current screen on a tinted pill */
  :root{--rail-w:208px}
  .tabbar{padding-inline:var(--s-3)}
  .tabbar::before{justify-items:start;padding-inline:var(--s-3)}
  .tab{display:flex;align-items:center;gap:var(--s-3);min-height:48px;padding:var(--s-2) var(--s-3);font-size:var(--t-md)}
  .tab svg{padding:0}
  .tab[aria-current="page"]{background:var(--accent-soft)}
  .tab[aria-current="page"] svg{background:none}
  /* a screen that asked for two columns (ctx.wide) gets the wider column; every other screen stays 760 px */
  .main.wide{max-width:1160px;padding-inline:var(--s-6)}
  html[data-wide] .topbar{padding-inline:max(var(--s-6),calc((100% - 1160px) / 2 + var(--s-6)))}
}
@media (min-width:900px) and (min-height:501px) and (prefers-reduced-motion: no-preference){
  .sheet{animation:sheetpop .18s cubic-bezier(.2,.9,.3,1)}
  @keyframes sheetpop{from{transform:scale(.96);opacity:0}}
}
/* A mouse gets hover feedback (a touch screen never does): a faint tint of the control's own text colour over whatever
   it is filled with, so it works on every button level, in the hero and in both themes. No shadow, nothing hover-only. */
@media (hover:hover){
  :is(.btn,.iconbtn,button.chip,.slot-btn,.hist-row,a.lg-row,button.lg-row):hover:not(:disabled,[aria-disabled="true"]){
    background-image:linear-gradient(color-mix(in srgb,currentColor 7%,transparent),color-mix(in srgb,currentColor 7%,transparent))}
  .tab:hover:not([aria-current="page"]){color:var(--ink);background-image:linear-gradient(color-mix(in srgb,currentColor 6%,transparent),color-mix(in srgb,currentColor 6%,transparent))}
}
