/* ══════════════════════════════════════════════════════════════════
   TRAINING MODE — flagship "living instrument" (Slice 1: layout shell)
   Full-screen immersive overlay, one exercise / one set at a time.
   Deep-dark instrument base (holds regardless of the viewer's light/dark
   preference — this is a cinematic mode, not a themed page); every accent
   effect derives from --accent via color-mix, so it survives any trainer /
   gym theme. Visual truth: handoff/mockups/repchitect-workout-flagship.html
   and repchitect-workout-actions.html. Locked vertical order (all states):
   demo → Cues + Form check → weight/reps → Previous/Next at the bottom.
══════════════════════════════════════════════════════════════════ */
@property --tm-p { syntax:'<number>'; inherits:true; initial-value:0 }

#trainingMode{
  /* Accent-derived tones (mirror the mockup, from the live --accent token). */
  --tm-accent: var(--accent, #6E9BFF);
  --tm-hi:   color-mix(in srgb, var(--tm-accent), #fff 30%);
  --tm-lo:   color-mix(in srgb, var(--tm-accent), #000 30%);
  --tm-soft: color-mix(in srgb, var(--tm-accent) 16%, transparent);
  --tm-glow: color-mix(in srgb, var(--tm-accent) 48%, transparent);
  --tm-bg:#070a11; --tm-txt:#f3f6fc; --tm-muted:#98a3ba; --tm-dim:#5f6b82;
  /* --tm-ink is the RGB triplet every translucent surface, rim and divider is
     built from. On a dark base those overlays are white; on a light base they
     have to become black, or every "subtle lighter surface" turns invisible.
     Flipping this one value re-tones the whole screen. */
  --tm-ink: 255,255,255;
  --tm-solid:#121722;                                   /* reduced-effects fallback */
  --tm-sheet-bg: #10151f;
  --tm-sheet-veil: rgba(3,5,10,.55);
  --tm-vig-c: rgba(0,0,0,.55);
  --tm-scrim-a: rgba(5,7,12,.3); --tm-scrim-b: rgba(5,7,12,.62);
  --tm-glass: transparent;
  --tm-e3: none;

  position:fixed; inset:0; z-index:var(--z-fullscreen); overflow:hidden;
  background:var(--tm-bg); color:var(--tm-txt);
  font-family: var(--font-family, system-ui, sans-serif); font-weight:400;
  display:flex; flex-direction:column;
}
#trainingMode[hidden]{ display:none }

/* These sit on media or on an accent fill, never on the app background, so their
   highlights stay white in both themes. Scoping --tm-ink here is what lets the
   global flip above be a single value rather than a list of exceptions. */
.tm-demo, .tm-next, .tm-sheet-btn.tm-primary, .tm-plate { --tm-ink: 255,255,255; }

/* Shared bits */
.tm-num{ font-variant-numeric:tabular-nums; letter-spacing:-.025em; font-weight:900 }
.tm-eyebrow{ font-size:.75rem; font-weight:600; letter-spacing:0; text-transform:none; color:var(--tm-dim) }

/* Ambient depth layers */
.tm-aurora{ display:none }   /* gradient removed app-wide; layer retired */
/* Battery: the aurora is now STATIC. A continuously-animating blurred layer under
   the backdrop-filter glass forced the compositor to repaint every frame for the
   whole workout (screen on) — the biggest steady GPU drain. The glow stays; the
   costly per-frame motion is gone. (The old drift keyframes are intentionally
   removed.) */
.tm-grain{ position:absolute; inset:0; z-index:1; pointer-events:none; opacity:.5; mix-blend-mode:overlay;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E") }
.tm-vig{ position:absolute; inset:0; z-index:1; pointer-events:none; display:none }
.tm-scrim{ position:absolute; inset:0; z-index:1; pointer-events:none; display:none }

.tm-scr{ position:relative; z-index:2; flex:1; display:flex; flex-direction:column; min-height:0 }
.tm-body{ flex:1; display:flex; flex-direction:column; min-height:0; gap:12px;
  padding: calc(var(--safe-top, env(safe-area-inset-top, 0px)) + 14px) 16px calc(env(safe-area-inset-bottom, 0px) + 16px) }

/* Glass recipe (tonal surface + lit rim + tiered shadow) */
/* 5b: the glass recipe flattens to a hard-edged tonal panel. The 1px rim in
   ::before survives as the border; blur and elevation are gone. */
.tm-glass{ position:relative; border-radius:var(--radius-md); background:var(--tm-glass);
  box-shadow:none }
.tm-glass::before{ content:""; position:absolute; inset:0; border-radius:inherit; padding:1px;
  background:rgba(var(--tm-ink), .16);
  -webkit-mask:linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite:xor;
  mask-composite:exclude; pointer-events:none }

/* Top bar: close · eyebrow+set · overflow */
.tm-topbar{ display:flex; align-items:center; justify-content:space-between; gap:8px; padding:2px 2px 0; flex:none }
/* The middle column is a flex child, so it needs min-width:0 or a long routine
   name pushes past the icons instead of truncating. Both lines are clamped to
   one line each — the header used to run to three lines and wrap mid-separator. */
.tm-topbar .tm-mid{ flex:1; min-width:0; text-align:center }
.tm-topbar .tm-mid .tm-eyebrow,
.tm-topbar .tm-mid .tm-set{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
.tm-topbar .tm-mid .tm-set{ font-weight:600; font-size:.8125rem; letter-spacing:-.01em; margin-top:3px }
.tm-ic{ width:40px; height:40px; border-radius:var(--radius-md); display:grid; place-items:center; color:var(--tm-txt);
  background:rgba(var(--tm-ink), .06); box-shadow:inset 0 0 0 1px rgba(var(--tm-ink), .14);
   border:0; cursor:pointer }
.tm-ic svg{ width:18px; height:18px }
.tm-ic{ transition: transform var(--dur-1) var(--ease-out) }
.tm-ic:active{ transform:scale(.94) }

.tm-prog{ height:4px; border-radius:var(--radius-pill); background:rgba(var(--tm-ink), .09); overflow:hidden; flex:none }
.tm-prog > i{ display:block; height:100%; border-radius:var(--radius-pill); background:var(--tm-accent);
  transition:width .35s cubic-bezier(.2,.7,.1,1) }

/* Entrance stagger */
.tm-rise{ opacity:0; transform:translateY(15px) scale(.99); animation:tm-rise .8s cubic-bezier(.2,.7,.1,1) forwards }
.tm-d1{animation-delay:.04s}.tm-d2{animation-delay:.14s}.tm-d3{animation-delay:.26s}.tm-d4{animation-delay:.38s}
@keyframes tm-rise{ to{opacity:1; transform:none} }

/* Demo image — fills remaining space at the top */
.tm-demo{ position:relative; flex:1; min-height:180px; border-radius:var(--radius-lg); overflow:hidden }
/* Battery: the demo is fully covered by the video (or the opaque placeholder), so
   the inherited glass backdrop-blur samples nothing and only costs GPU. The lit
   rim and tiered shadow — the parts you can actually see — stay. */
.tm-demo.tm-glass{  }
.tm-demo .tm-ph{ position:absolute; inset:0; background:var(--surface-3) }
.tm-demo .tm-vid{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; background:#0e1422 }
/* The demo video shows in its natural source colors — no accent tint. (The old
   .tm-duo accent color-blend overlay was removed.) A neutral bottom scrim stays
   only so the exercise name over the video is legible. */
.tm-demo .tm-sc{ position:absolute; inset:0; background:linear-gradient(180deg, transparent 55%, rgba(0,0,0,.6)) }
.tm-demo .tm-fig{ position:absolute; right:16px; bottom:8px; line-height:1; opacity:.14; filter:grayscale(1) }
.tm-demo .tm-fig svg{ width:118px; height:118px }
.tm-demo .tm-chip{ position:absolute; left:14px; top:14px; display:flex; align-items:center; gap:8px; font-size:.75rem;
  font-weight:600; color:#fff; background:rgba(0,0,0,.32);  padding:6px 12px; border-radius:var(--radius-sm);
  border:1px solid rgba(var(--tm-ink), .16) }
.tm-demo .tm-chip svg{ width:14px; height:14px }
.tm-demo .tm-info{ position:absolute; left:18px; right:18px; bottom:16px }
.tm-demo .tm-info .tm-cur{ font-size:.75rem; font-weight:600; letter-spacing:0; text-transform:none; color:rgba(var(--tm-ink), .85) }
.tm-demo .tm-info h2{ font-family:var(--font-display); font-weight:800; font-size:1.75rem; letter-spacing:-.02em; color:#fff; margin-top:3px; line-height:1.05 }
.tm-swapped{ display:inline-block; vertical-align:middle; margin-left:8px; padding:2px 8px; border-radius:var(--radius-sm);
  font-size:.75rem; font-weight:700; letter-spacing:0; color:var(--accent-contrast, #06140d);
  background:var(--tm-accent) }

/* Button row: Exercise Cues + Form check (2-up, locked) */
/* These are utility affordances, not the main act. They used to be filled glass
   at the same weight as the demo and telemetry surfaces, which left six boxes of
   near-equal presence stacked down the screen. Outlined and slightly smaller,
   they sit a rung below the surfaces and the primary action. */
.tm-btnrow{ flex:none; display:grid; grid-template-columns:1fr 1fr; gap:12px }
.tm-softbtn{ display:flex; align-items:center; justify-content:center; gap:8px; height:44px; border-radius:var(--radius-md);
  font-weight:800; font-size:.75rem; color:var(--tm-txt); background:transparent;
  box-shadow:inset 0 0 0 1px rgba(var(--tm-ink), .2); letter-spacing:0; text-transform:none;
  border:0; cursor:pointer; font-family:inherit }
.tm-softbtn svg{ width:17px; height:17px; color:var(--tm-accent) }
.tm-softbtn{ transition: transform var(--dur-1) var(--ease-out) }
.tm-softbtn:active{ transform:scale(.985) }

/* Weight / reps telemetry */
.tm-tele{ flex:none; display:flex; justify-content:space-around; align-items:flex-start; padding:16px 0 12px }
/* Unboxed (Drew, 2026-08-18): the weight/reps topic gets no box - the rim
   pseudo is suppressed and the column seam is the only line. */
.tm-tele.tm-glass::before{ content:none }
.tm-tele .tm-col + .tm-col{ border-left:1px solid rgba(var(--tm-ink), .12) }
.tm-tele .tm-col{ text-align:center; flex:1 }
.tm-tele .tm-k{ font-size:.75rem; font-weight:600; letter-spacing:0; text-transform:none; color:var(--tm-dim) }
.tm-tele .tm-v{ font-weight:900; font-size:50px; letter-spacing:-.025em; line-height:1; margin-top:6px;
  background:var(--tm-txt);
  -webkit-background-clip:text; background-clip:text; color:transparent;
  font-variant-numeric:tabular-nums }
.tm-tele .tm-v small{ font-size:.8125rem; -webkit-text-fill-color:var(--tm-muted); color:var(--tm-muted); font-weight:500; margin-left:2px }
.tm-tele .tm-div{ width:1px; align-self:stretch; margin:4px 0; background:rgba(var(--tm-ink), .12) }
.tm-steps{ display:flex; gap:8px; justify-content:center; margin-top:12px }
/* Set position under the rest ring (5b layout — Drew, 2026-08-17). */
.tm-setpos{ text-align:center; margin-top:8px; font-size:.75rem; font-weight:800;
  letter-spacing:0; text-transform:none; color:var(--tm-muted) }
.tm-steps b{ width:44px; height:44px; border-radius:50%; display:grid; place-items:center; font-size:1.15rem; color:var(--tm-txt);
  font-weight:900; cursor:pointer; background:transparent; border:2px solid rgba(var(--tm-ink), .18);
  box-shadow:none; transition:transform .1s }
.tm-steps b:active{ transform:scale(.94) }
/* 5b: the accent marks + as a BORDER, not as glyph color. */
.tm-steps b.tm-plus{ border-color:var(--tm-accent) }

/* Previous / Next at the very bottom.
   These are a matched pair, so they share geometry and type: equal columns,
   centred content, one size, one radius. Hierarchy is carried entirely by fill
   (accent vs. quiet glass), never by width or alignment. Previously Previous was
   left-aligned at 13px in a 1fr column while Next was centred at 16px in a 1.3fr
   column, so two adjacent buttons set their labels on different axes. */
.tm-nav{ flex:none; display:grid; grid-template-columns:1fr 1fr; gap:12px }
.tm-prev, .tm-next{ display:flex; align-items:center; justify-content:center; gap:8px; height:56px;
  border-radius:var(--radius-md); font-weight:900; font-size:.8125rem; letter-spacing:0; text-transform:none;
  border:0; cursor:pointer; font-family:inherit }
.tm-prev{ background:transparent; box-shadow:inset 0 0 0 1px rgba(var(--tm-ink), .2); color:var(--tm-txt) }
.tm-prev svg{ width:18px; height:18px; color:var(--tm-muted) }
.tm-next{ position:relative; overflow:hidden; color:var(--accent-contrast, #fff);
  background:var(--tm-accent);
  box-shadow:none; transition:transform .12s }
.tm-next:active{ transform:scale(.98) }
.tm-next svg{ width:18px; height:18px }
/* Battery: the Next-button sheen no longer loops (it repainted full-time on the
   active screen). A single sweep plays each time the button (re)appears. */
.tm-next::after{ content:""; position:absolute; top:0; left:-60%; width:48%; height:100%; transform:skewX(-20deg);
  background:rgba(var(--tm-ink), .18) }
@keyframes tm-sheen{ 0%{left:-60%} 100%{left:130%} }
/* Next spans the row whenever it is alone — on the very first set there is no
   Previous, and Next was stranded in the narrow column with ~190px of dead space
   beside it. tm-solo is set by training.js; tm-finish is the last-set variant. */
.tm-next.tm-finish, .tm-next.tm-solo{ grid-column:1 / -1 }

.tm-dim{ opacity:.42; pointer-events:none }

/* ── Resting state: countdown gauge replaces the demo (Slice 2) ── */
.tm-gauge{ position:relative; flex:1; min-height:180px; display:flex; flex-direction:column; align-items:center; justify-content:center }
.tm-ring{ position:relative; width:208px; height:208px }
/* Battery: --tm-p is a registered animatable property so the ring can update on a
   1s timer (down from 4×/s) yet still sweep smoothly via a CSS transition. */
@property --tm-p{ syntax:'<number>'; inherits:true; initial-value:0 }
.tm-track{ position:absolute; inset:0; border-radius:50%;
  background:conic-gradient(from -90deg, var(--tm-accent) calc(var(--tm-p)*1%), rgba(var(--tm-ink), .07) 0);
  -webkit-mask:radial-gradient(farthest-side, transparent calc(100% - 14px), #000 calc(100% - 13px));
  mask:radial-gradient(farthest-side, transparent calc(100% - 14px), #000 calc(100% - 13px));
  transition:--tm-p 1s linear }
.tm-lblc{ position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center }
.tm-big{ font-weight:900; font-size:56px; letter-spacing:-.025em; line-height:1; font-variant-numeric:tabular-nums;
  background:var(--tm-txt);
  -webkit-background-clip:text; background-clip:text; color:transparent }
.tm-gauge .tm-sub{ font-size:.75rem; font-weight:600; letter-spacing:0; text-transform:none; color:var(--tm-dim); margin-top:8px }

/* Bodyweight: single centered telemetry column (weight hidden). */
.tm-tele.tm-bw .tm-div{ display:none }

/* ── Bottom-sheet dialog (empty-field flow; Slice 4 reuses for actions) ── */
/* v115 FOLLOW-ALONG: the trainer's video, pinned above the exercise body.
   Outside .tm-body on purpose — the body is rebuilt on every Next, and an
   iframe rebuilt with it would restart the video. */
.tm-follow{ flex:none; margin:0 0 8px; }
.tm-follow .od-player{ border-radius:var(--radius-lg); }
.tm-follow-note{ padding:8px 12px; margin-bottom:8px; border-radius:var(--radius-md); background:rgba(var(--tm-ink), .06) }
.tm-follow-note .tm-cur{ display:flex; align-items:center; gap:6px; color:var(--tm-muted); font-size:.75rem; font-weight:600; letter-spacing:0; text-transform:none }
.tm-follow-note .tm-cur svg{ width:13px; height:13px }
.tm-follow-note h2{ margin:4px 0 0; font-size:1.15rem; font-weight:800; color:var(--tm-txt) }
.tm-sheet{ position:absolute; inset:0; z-index:5; display:flex; align-items:flex-end; justify-content:center;
  background:var(--tm-sheet-veil);  padding:16px }
.tm-sheet-card{ width:100%; max-width:420px; border-radius:var(--radius-lg);
  padding:16px 16px calc(env(safe-area-inset-bottom, 0px) + 16px);
  background:var(--tm-sheet-bg);
  /* A FULL border, not a top seam: .tm-sheet pads the card 16px off every
     edge, so it floats, and a one-edge border under a radius curves into two
     hooks at the top corners. */
  border:1px solid rgba(var(--tm-ink), .16); animation:tm-sheetup .32s cubic-bezier(.2,.7,.1,1) }
@keyframes tm-sheetup{ from{transform:translateY(24px); opacity:.6} to{transform:none; opacity:1} }
.tm-sheet-title{ font-weight:900; font-size:.9rem; letter-spacing:0; text-transform:none }
/* Every Training Mode sheet has its X top right (Drew, 2026-10-11); it does
   what tapping outside the card does. The title keeps clear of it. */
.tm-sheet-card{ position:relative }
.tm-sheet-x{ position:absolute; top:6px; right:6px; width:44px; height:44px; display:inline-flex; align-items:center; justify-content:center;
  background:none; border:0; border-radius:50%; color:rgba(var(--tm-ink), .62); cursor:pointer }
.tm-sheet-x svg{ width:20px; height:20px }
.tm-sheet-x + .tm-sheet-title, .tm-sheet-x + .tm-sheet-sub{ padding-right:44px }
.tm-sheet-sub{ color:var(--tm-muted); font-size:.8125rem; margin-top:6px; line-height:1.5 }
.tm-sheet-actions{ display:flex; flex-direction:column; gap:8px; margin-top:16px }
.tm-sheet-btn{ height:52px; border-radius:var(--radius-md); border:0; font-family:inherit; font-weight:800; font-size:.8125rem; letter-spacing:0; text-transform:none; cursor:pointer }
.tm-sheet-btn.tm-primary{ color:var(--accent-contrast, #fff); background:var(--tm-accent);
 }
.tm-sheet-btn.tm-ghost{ color:var(--tm-txt); background:transparent; box-shadow:inset 0 0 0 1px rgba(var(--tm-ink), .2) }

/* ── Overflow menu + settings + plate calculator (Slice 4) ── */
/* ── what else this exercise records (v133) ── */
.tm-extras{ display:grid; grid-template-columns:repeat(auto-fit, minmax(120px, 1fr)); gap:8px;
  padding:12px 12px; margin-top:8px; border-radius:var(--radius-lg) }
.tm-extra{ display:flex; flex-direction:column; gap:4px; min-width:0 }
.tm-extra-k{ font-size:.75rem; font-weight:800; letter-spacing:0; text-transform:none;
  color:var(--tm-muted) }
.tm-extra-k i{ font-style:normal; opacity:.7 }
.tm-extra-in{ width:100%; min-height:44px; padding:0 8px; font-family:inherit; font-size:1.15rem;
  font-weight:700; color:var(--tm-txt); background:transparent; border:0; border-radius:var(--radius-md);
  box-shadow:inset 0 0 0 2px rgba(var(--tm-ink), .2) }
.tm-extra-in:focus{ outline:none; box-shadow:inset 0 0 0 2px var(--tm-accent) }

.tm-menu-list{ display:flex; flex-direction:column; gap:2px; margin-top:12px }
.tm-menu-item{ display:flex; align-items:center; gap:12px; width:100%; text-align:left; border:0; cursor:pointer;
  font-family:inherit; font-size:.9rem; font-weight:500; color:var(--tm-txt); background:transparent;
  padding:12px 6px; border-radius:var(--radius-md) }
.tm-menu-item:active{ background:rgba(var(--tm-ink), .05) }
.tm-menu-item svg{ width:20px; height:20px; color:var(--tm-accent); flex:none }
.tm-menu-item.tm-danger{ color:#ff7089 } .tm-menu-item.tm-danger svg{ color:#ff7089 }

/* ── the exercise picker, shared by Swap and Add (2026-09-07) ── */
.tm-sheet-label{ margin-top:16px; font-size:.75rem; font-weight:800; letter-spacing:0; text-transform:none;
  color:var(--tm-muted) }
.tm-ex-search{ width:100%; margin-top:8px; height:44px; padding:0 12px; font-family:inherit; font-size:.9rem;
  color:var(--tm-txt); background:transparent; border:0; border-radius:var(--radius-md);
  box-shadow:inset 0 0 0 2px rgba(var(--tm-ink), .2) }
.tm-ex-search:focus{ outline:none; box-shadow:inset 0 0 0 2px var(--tm-accent) }
/* A capped, scrolling list: forty rows would push Cancel off the bottom of
   the card on a phone, which is where every one of these is read. */
.tm-ex-results{ max-height:38vh; overflow-y:auto; -webkit-overflow-scrolling:touch; margin-top:6px }
.tm-ex-txt{ display:flex; flex-direction:column; min-width:0; gap:2px }
.tm-ex-name{ line-height:1.25 }
.tm-ex-sub{ font-size:.75rem; color:var(--tm-muted) }
.tm-sheet-close{ margin-top:12px; width:100%; height:48px; border-radius:var(--radius-md); border:0; cursor:pointer;
  font-family:inherit; font-weight:800; font-size:.8125rem; letter-spacing:0; text-transform:none;
  color:var(--tm-txt); background:transparent; box-shadow:inset 0 0 0 2px rgba(var(--tm-ink), .2) }

/* settings rows */
.tm-set-row{ padding:12px 2px; border-top:1px solid rgba(var(--tm-ink), .06); display:flex; flex-direction:column; gap:8px }
.tm-set-row:first-of-type{ border-top:0 }
.tm-set-head{ display:flex; align-items:center; justify-content:space-between; gap:12px }
.tm-set-label{ font-size:.75rem; font-weight:800; letter-spacing:0; text-transform:none; color:var(--tm-dim) }
.tm-seg{ display:flex; gap:6px; flex-wrap:wrap }
.tm-seg b{ font-weight:600; font-size:.8125rem; padding:8px 12px; border-radius:var(--radius-sm); cursor:pointer; color:var(--tm-muted);
  background:rgba(var(--tm-ink), .05); box-shadow:inset 0 0 0 1px rgba(var(--tm-ink), .08); min-width:44px; text-align:center }
.tm-seg b.on{ color:var(--tm-txt); background:transparent; box-shadow:inset 0 0 0 2px var(--tm-accent) }
/* toggle pill */
.tm-tog{ width:50px; height:30px; border-radius:var(--radius-pill); border:0; cursor:pointer; position:relative;
  background:rgba(var(--tm-ink), .12); transition:background .18s }
.tm-tog.on{ background:var(--tm-accent) }
.tm-tog::after{ content:""; position:absolute; top:3px; left:3px; width:24px; height:24px; border-radius:50%;
  background:#fff; transition:transform .18s }
.tm-tog.on::after{ transform:translateX(20px) }

/* plate calculator */
.tm-plate-in{ display:flex; gap:8px; margin-top:12px; align-items:stretch }
.tm-plate-in input{ flex:1 1 0; min-width:0; height:50px; border-radius:var(--radius-md); border:0; padding:0 16px; font-family:inherit;
  background:transparent; box-shadow:inset 0 0 0 2px rgba(var(--tm-ink), .2); text-align:center;
  color:var(--tm-txt); font-size:1.15rem; font-weight:800; font-variant-numeric:tabular-nums }
.tm-plate-in > button{ flex:none }   /* keep "Calc" inside the sheet (was overflowing) */
.tm-plate-in input:focus{ outline:2px solid var(--tm-accent); outline-offset:0 }
/* THE BARBELL (Drew, 2026-08-18): one side, drawn to scale - shaft, collar,
   then plates whose height and thickness follow their weight. Flat and
   hard-edged like everything else; the plate face is a well with a fg rim,
   the artifact plate grammar. */
.tm-bar{ margin-top:16px; min-height:124px; display:flex; align-items:center; justify-content:center; gap:3px; padding:0 4px }
.tm-bar:empty{ min-height:0; margin-top:0 }
.tm-bar-shaft{ flex:1; max-width:96px; height:7px; background:rgba(var(--tm-ink), .28) }
.tm-bar-collar{ width:12px; height:30px; background:rgba(var(--tm-ink), .28); flex:none }
.tm-bar-tip{ width:26px; height:7px; background:rgba(var(--tm-ink), .28); flex:none }
.tm-bp{ flex:none; display:grid; place-items:center; border-radius:var(--radius-md);
  background:rgba(var(--tm-ink), .08); box-shadow:inset 0 0 0 2px var(--tm-txt);
  color:var(--tm-txt); font-weight:800; font-size:.75rem; font-variant-numeric:tabular-nums }
.tm-bp-thin{ writing-mode:vertical-rl; font-size:.75rem; letter-spacing:0 }
.tm-plate-note{ text-align:center; color:var(--tm-muted); font-size:.8125rem; margin-top:12px; line-height:1.5 }
.tm-plate-note.tm-warn{ color:#ffb060 }

/* ── C1: "reduce effects" — drop the GPU-heavy layers ── */
#trainingMode.tm-reduced .tm-aurora{ animation:none; opacity:.5; filter:blur(46px) }
#trainingMode.tm-reduced .tm-grain{ display:none }
#trainingMode.tm-reduced .tm-next::after{ animation:none; display:none }
#trainingMode.tm-reduced .tm-glass{   background:var(--tm-solid) }
#trainingMode.tm-reduced .tm-rise{ animation:none; opacity:1; transform:none }

/* ── C6: wide screens (laptop / tablet / desktop) ──
   The layout is portrait-phone; full-bleed on a wide screen stretches it and
   pushes the bottom off. Present it as a centered, phone-proportioned card
   with the ambient aurora filling the space behind it (matches the mockups). */
@media (min-width: 720px){
  #trainingMode{ align-items:center; justify-content:center; }
  #trainingMode .tm-scr{
    flex:none; width:430px; max-width:92vw; height:min(94vh, 920px);
    border-radius:var(--radius-lg); overflow:hidden;
    box-shadow:0 0 0 1px rgba(var(--tm-ink), .06);
  }
  /* Keep the sheets (menu, settings, plate calc) contained within the card. */
  #trainingMode .tm-sheet{ border-radius:var(--radius-lg); }
}

/* ── LANDSCAPE TRAINING (2026-08-26) ──────────────────────────────────────
   Training Mode is `position:fixed; inset:0`, NOT a `.page` — so css/wide.css
   never reaches it, and the rule above was its only wide behaviour: a 430px
   phone card centred in the screen. On a 1440px laptop that used 30% of the
   width with 505px of empty black either side. Fine as a fallback, wrong as
   the answer for someone training with a laptop or tablet propped up.

   Landscape only, and only from 900px. A tablet in PORTRAIT keeps the card,
   because a tall narrow column is what portrait is for; it is landscape where
   the stacked phone layout strands the screen.

   THE DEMO GETS THE SPACE. It is the thing a client actually looks at
   mid-set, and in the column layout it was capped by the height left over
   after the steppers and the Next button. Here it takes the whole left column
   and the controls stack down the right, so nothing had to move in the DOM —
   the six children of .tm-body are simply placed into grid areas. */
@media (min-width: 900px) and (orientation: landscape){
  #trainingMode .tm-scr{
    width: min(1180px, 94vw); height: min(92vh, 780px);
  }
  /* 5f: three children now (the demo with its pills, the main column, the
     bar), so three areas; the demo keeps the larger column. */
  #trainingMode .tm-body{
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(300px, 1fr);
    grid-template-rows: 1fr auto;
    grid-template-areas:
      "demo main"
      "demo nav";
    column-gap: 16px;
  }
  #trainingMode .tm-demo{ grid-area: demo; min-height: 0; height: auto }
  #trainingMode .tm5-main{ grid-area: main; align-self: center }
  #trainingMode .tm-nav{ grid-area: nav }
  /* The rest screen is a single centred column in both layouts: there is
     nothing to put beside a countdown. */
  #trainingMode .tm-rest{ grid-area: demo / demo / nav / nav }
}

@media (prefers-reduced-motion: reduce){
  .tm-aurora, .tm-next::after, .tm-prog > i, .tm-track{ animation:none; transition:none }
  .tm-rise, .tm-sheet-card{ opacity:1; transform:none; animation:none }
  /* also shed the GPU-heavy blur composites for reduced-motion users */
  .tm-glass, .tm-softbtn, .tm-chip{  }
}

/* Rest screen: what you just logged vs. what's up next (Slice — clarity fix) */
/* Stacked, not 2-up. Side by side, each card got ~170px and every real exercise
   name truncated to the same unreadable stub ("Cable Lateral …" twice), which
   defeats the whole point of showing what you just did vs. what's coming. */
.tm-restcards{ flex:none; display:grid; grid-template-columns:1fr; gap:8px; padding:0 2px }
/* min-width:0 is load-bearing: grid items default to min-width:auto, so a long
   unbreakable exercise name forced the two columns wider than the row and the
   "Up next" card ran off the right edge — the ellipsis on .tm-rex never engaged. */
/* 5b: outlined cards, no fills — the approved rest screen draws "just logged"
   on a hairline and "up next" on a full accent border. */
.tm-rcard{ min-width:0; box-shadow:inset 0 0 0 1px rgba(var(--tm-ink), .12); border-radius:var(--radius-md); padding:12px 12px }
.tm-rcard.tm-rnext{ box-shadow:inset 0 0 0 1px var(--tm-accent) }
.tm-rk{ font-size:.75rem; font-weight:700; letter-spacing:0; text-transform:none; color:var(--tm-dim) }


.tm-rex{ font-weight:600; font-size:.9rem; letter-spacing:-.01em; color:var(--tm-txt); margin-top:6px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
.tm-rv{ font-size:.8125rem; color:var(--tm-muted); margin-top:3px; font-variant-numeric:tabular-nums }
/* Full width lets the label and the numbers share a row instead of stacking. */
.tm-rcard{ display:flex; align-items:baseline; gap:8px; flex-wrap:wrap }
.tm-rcard .tm-rk{ flex:0 0 100%; }
.tm-rcard .tm-rex{ flex:1 1 auto; margin-top:5px }
.tm-rcard .tm-rv{ flex:none; margin-top:5px }

/* Skip Rest is the bottom action on this screen, so it gets the same 56px slot as
   Previous/Next — on every screen the last row is what moves you forward. It stays
   outlined because skipping is optional, unlike Next. */
.tm-skiprow .tm-softbtn{ height:56px; font-size:.9rem}

/* Bodyweight readout + the switch between weighted and bodyweight */
.tm-tele .tm-v.tm-bwv{ font-size:1.75rem; letter-spacing:0; color:var(--tm-muted) }
.tm-bwlink{ margin-top:8px; border:0; background:transparent; cursor:pointer; font-family:inherit;
  font-size:.75rem; font-weight:600; letter-spacing:0; color:var(--tm-accent); padding:4px 8px; border-radius:var(--radius-sm) }
.tm-bwlink:active{ background:rgba(var(--tm-ink), .06) }

/* Total session time, shown under the rest countdown. Quiet by design — the
   countdown is the number you act on; this is orientation, not a target. */
.tm-elapsed{ margin-top:6px; font-size:.75rem; font-weight:600; letter-spacing:0;
  text-transform:none; color:var(--tm-dim); font-variant-numeric:tabular-nums }


/* ══════════════════════════════════════════════════════════════════
   LIGHT MODE
   Training Mode was built as a deliberately cinematic dark surface that
   held regardless of the viewer's preference. In practice that read as a
   bug: the rest of the app switches, this screen did not. It now follows
   the same data-mode the rest of the app uses.

   Only the local --tm-* tokens are redefined — every rule above consumes
   them, so nothing else needed touching. --tm-ink flipping to black is what
   re-tones all 36 translucent surfaces at once; the four contexts that sit
   on media or an accent fill keep their white highlights via the scoped
   override near the top of this file.
   ══════════════════════════════════════════════════════════════════ */
html[data-mode="light"] #trainingMode{
  --tm-ink: 0,0,0;
  --tm-bg:#EEF1F6;
  --tm-txt:#14181F; --tm-muted:#5A6475; --tm-dim:#8A93A3;
  --tm-solid:#FFFFFF;
  --tm-glass: transparent;
  /* Shadows carry the elevation that a lit rim carries on dark. */
  --tm-e3: none;
  --tm-sheet-bg: #FBFCFE;
  --tm-sheet-veil: rgba(20,24,31,.32);
  /* Ambient layers invert: they darkened a bright aurora, now they lighten it. */
  --tm-vig-c: rgba(255,255,255,.55);
  --tm-scrim-a: rgba(244,246,250,.45); --tm-scrim-b: rgba(244,246,250,.78);
}
/* The aurora is a saturated glow designed to bloom out of black. At full
   strength on a light ground it turns the screen into a wash, so it is
   pulled back rather than removed — the accent still tints the surface. */
html[data-mode="light"] #trainingMode .tm-aurora{ opacity:.30; filter:blur(56px) saturate(1.05) }
html[data-mode="light"] #trainingMode .tm-grain{ opacity:.22; mix-blend-mode:multiply }
/* The lit rim reads as a highlight on dark and as grime on light. */
html[data-mode="light"] #trainingMode .tm-glass::before{
  background:rgba(255,255,255,.5);
}
/* Icon buttons need a real edge once the surface is no longer luminous. */
html[data-mode="light"] #trainingMode .tm-ic{
  box-shadow:inset 0 0 0 1px rgba(20,24,31,.14);
}

/* Plate-calc steppers: the same 44px ghost cells as the telemetry steppers. */
.tm-pstep{ flex:none; width:44px; height:44px; border-radius:50%; border:0; cursor:pointer; font-family:inherit;
  background:transparent; box-shadow:inset 0 0 0 2px rgba(var(--tm-ink), .2);
  color:var(--tm-txt); font-size:1.15rem; font-weight:900 }
.tm-pstep-plus{ box-shadow:inset 0 0 0 2px var(--tm-accent) }
/* Target / Bar / Per side — unboxed stat columns, the approved sheet's row. */
.tm-plate-stats{ display:grid; grid-auto-flow:column; grid-auto-columns:minmax(0,1fr); gap:8px;
  text-align:center; margin-top:16px }
.tm-plate-stats em{ display:block; font-style:normal; font-size:.75rem; font-weight:800;
  letter-spacing:0; text-transform:none; color:var(--tm-dim) }
.tm-plate-stats b{ display:block; font-weight:900; font-size:1.75rem; letter-spacing:-.025em;
  font-variant-numeric:tabular-nums; margin-top:2px }

/* Shown when a demo video fails to load — offline, or not yet uploaded. The
   panel is otherwise an empty tinted box, which reads as a broken app during
   the one thing this PWA promises to survive: no signal. Deliberately quiet:
   the workout is unaffected, so this must not look like an error. */
.tm-demo .tm-novid{
  position:absolute; left:0; right:0; top:50%; transform:translateY(-50%);
  text-align:center; padding:0 1rem;
  font-family:var(--font-display); font-weight:900; font-size:.75rem;
  letter-spacing:0; text-transform:none; color:var(--text-dim);
}

/* ══════════ 5f (approved client-n-<look>-tm, -tmsuperset, -rest) ══════════
   The demo fills the top with the controls as pills on it; under it the
   exercise, its sets and two big steppers; a bar at the bottom. Colours come
   from the --tm tokens (dark, or light when the app is light) and the
   accent; faces from the look (5f.css's type roles). */
#trainingMode .tm-body{ gap:0; padding:0 }
.tm5-demo{ flex:none; height:min(38vh, 330px); min-height:220px; border-top-left-radius:0; border-top-right-radius:0; background:#fff }
.tm5-demo .tm-vid{ object-fit:contain; background:#fff }
.tm5-top, .tm5-bot{ position:absolute; left:12px; right:12px; display:flex; align-items:center; gap:8px; z-index:2 }
.tm5-top{ top:calc(var(--safe-top, env(safe-area-inset-top, 0px)) + 12px); justify-content:space-between }
.tm5-bot{ bottom:12px }
.tm5-pill{ position:relative; display:inline-flex; align-items:center; justify-content:center; gap:6px; min-height:38px; min-width:38px;
  padding:0 13px; border:0; border-radius:var(--radius-pill); font:inherit; font-size:.8125rem; font-weight:700; color:#fff; background:rgba(14,17,22,.72);
  cursor:pointer; white-space:nowrap; font-variant-numeric:tabular-nums }
.tm5-pill::after{ content:''; position:absolute; left:50%; top:50%; width:100%; min-width:44px; height:44px; transform:translate(-50%,-50%) }
.tm5-pill svg{ width:16px; height:16px }
.tm5-pill--ic{ padding:0; width:38px; border-radius:50% }
.tm5-pill--go{ background:var(--tm-accent); color:var(--accent-contrast, #fff) }
.tm5-pill--tag{ cursor:default }
.tm5-play{ margin-left:auto; width:44px; height:44px }
.tm5-follow{ position:relative; padding:calc(var(--safe-top, env(safe-area-inset-top, 0px)) + 64px) 16px 8px }
.tm5-follow .tm5-top{ left:12px; right:12px }
.tm5-main{ flex:1; min-height:0; overflow-y:auto; padding:14px 20px 8px; display:flex; flex-direction:column; gap:12px }
.tm5-title{ margin:0; font-family:var(--font-brand, var(--font-display)); font-weight:var(--face-weight, 800); text-transform:var(--face-case, none);
  font-size:1.75rem; line-height:1.05; color:var(--tm-txt) }
.tm5-titlerow{ display:flex; align-items:center; justify-content:space-between; gap:10px }
.tm5-line{ margin-top:4px; font-size:.9rem; color:var(--tm-muted) }
.tm5-strip{ display:grid; grid-template-columns:repeat(var(--n, 4), minmax(0,1fr)); gap:6px }
.tm5-set{ display:flex; flex-direction:column; align-items:center; gap:2px; padding:7px 4px; text-align:center; font-size:.75rem;
  color:var(--tm-muted); border:1px solid rgba(var(--tm-ink), .12); border-radius:var(--radius-sm); background:rgba(var(--tm-ink), .03) }
.tm5-set b{ font-size:.9rem; color:var(--tm-txt) }
.tm5-set--done{ background:color-mix(in srgb, var(--tm-accent) 22%, transparent); border-color:transparent }
.tm5-set--now{ border:2px solid var(--tm-accent) }
.tm5-tele{ display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:10px; padding:0; justify-content:stretch }
.tm5-box{ display:flex; flex-direction:column; align-items:center; gap:6px; padding:12px; border:1px solid rgba(var(--tm-ink), .12); border-radius:var(--radius-md) }
.tm5-k{ font-size:.8125rem; font-weight:600; color:var(--tm-muted) }
.tm5-v{ font-size:2.6rem; font-weight:900; line-height:1; color:var(--tm-txt); font-variant-numeric:tabular-nums }
.tm5-steps{ display:grid; grid-template-columns:1fr 1fr; gap:8px; width:100%; margin-top:6px }
.tm5-steps b{ width:auto; height:48px; border-radius:var(--radius-sm); font-size:1.15rem; border:1px solid rgba(var(--tm-ink), .18) }
/* An outline in the main color (2026-11-15): Complete set is the screen's one filled button. */
.tm5-steps b.tm-plus{ background:transparent; border:2px solid var(--tm-accent) }
.tm5-link{ min-height:44px; padding:0 10px; border:0; background:none; color:var(--tm-txt); font:inherit; font-weight:700; text-decoration:underline; cursor:pointer }
.tm5-dots{ display:flex; gap:5px }
.tm5-dots i{ width:16px; height:6px; border-radius:var(--radius-pill); background:rgba(var(--tm-ink), .2) }
.tm5-dots i.done, .tm5-dots i.on{ background:var(--tm-accent) }
.tm5-dots i.on{ width:22px }
.tm5-sslist{ display:flex; flex-direction:column; gap:8px }
.tm5-ss, .tm5-nextcard{ display:flex; align-items:center; gap:12px; padding:10px 12px; border:1px solid rgba(var(--tm-ink), .12); border-radius:var(--radius-md) }
.tm5-ss.is-now{ border:2px solid var(--tm-accent) }
.tm5-tag{ flex:none; padding:3px 7px; border-radius:var(--radius-sm); font-size:.75rem; font-weight:800; background:var(--tm-accent); color:var(--accent-contrast, #fff) }
.tm5-ss-main{ flex:1; min-width:0; display:flex; flex-direction:column; gap:2px }
.tm5-ss-main b{ font-size:.9rem; color:var(--tm-txt) }
.tm5-ss-main small{ font-size:.8125rem; color:var(--tm-muted) }
.tm5-still{ flex:none; width:44px; height:44px; border-radius:var(--radius-sm); overflow:hidden; background:#fff }
.tm5-still video{ width:100%; height:100%; object-fit:contain; display:block }
.tm5-bar{ display:grid; grid-template-columns:52px minmax(0,1fr) 52px; gap:8px; padding:12px 16px calc(env(safe-area-inset-bottom, 0px) + 14px);
  border-top:1px solid rgba(var(--tm-ink), .1) }
.tm5-sq{ height:56px; border-radius:var(--radius-md); border:1px solid rgba(var(--tm-ink), .2); background:transparent; color:var(--tm-txt); display:grid; place-items:center; cursor:pointer }
.tm5-sq svg{ width:18px; height:18px }
.tm5-sq:disabled{ opacity:.35; cursor:default }
.tm5-go{ height:56px; font-size:.9rem}
.tm5-bar--rest{ grid-template-columns:1fr; gap:10px }
.tm5-rest{ flex:1; min-height:0; display:flex; flex-direction:column; align-items:center; padding:calc(var(--safe-top, env(safe-area-inset-top, 0px)) + 14px) 16px 8px; gap:12px }
.tm5-rtop{ align-self:stretch; display:flex; align-items:center; justify-content:space-between; gap:8px }
.tm5-rtop .tm5-pill--ic{ background:transparent; color:var(--tm-txt); box-shadow:inset 0 0 0 1px rgba(var(--tm-ink), .25) }
.tm5-rlabel{ font-family:var(--label-font, var(--font-family)); font-size:.75rem; letter-spacing:var(--label-track, .08em); text-transform:var(--label-case, uppercase); color:var(--tm-muted); font-variant-numeric:tabular-nums }
.tm5-textbtn{ min-height:44px; padding:0 4px; border:0; background:none; font:inherit; font-weight:800; color:var(--tm-accent); cursor:pointer }
.tm5-rk{ margin-top:14px; font-family:var(--label-font, var(--font-family)); font-size:.75rem; letter-spacing:var(--label-track, .08em); text-transform:var(--label-case, uppercase); color:var(--tm-muted) }
.tm5-ring{ width:min(78vw, 290px); height:min(78vw, 290px) }
/* The accent arc is the time LEFT (approved): it starts at twelve o’clock
   and runs clockwise, so the gap left by the rest that has passed opens
   just before twelve. */
.tm5-ring .tm-track{ background:conic-gradient(var(--tm-accent) calc((100 - var(--tm-p))*1%), rgba(var(--tm-ink), .1) 0) }
.tm5-ring .tm-big{ font-size:4.4rem }
.tm5-of{ margin-top:6px; font-size:.9rem; color:var(--tm-muted) }
.tm5-adj{ align-self:stretch; display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:10px }
.tm5-adj button{ min-height:48px; border-radius:var(--radius-sm); border:1px solid rgba(var(--tm-ink), .18); background:transparent; color:var(--tm-txt); font:inherit; font-weight:800; cursor:pointer }
.tm5-nextcard{ background:rgba(var(--tm-ink), .03) }


/* ── UX review step 2 (2026-11-15): the top row, typing, last time ─────────
   The centre of the top row is progress, the menu is a ⋯ that looks like a
   button, and Finish is an outline until the last set. */
.tm5-top-r{ display:flex; align-items:center; gap:8px; flex:none }
.tm5-pill--prog{ cursor:default; overflow:hidden; min-width:0; flex:0 1 auto; text-overflow:ellipsis }
.tm5-pill--prog::after{ display:none }
.tm5-progbar{ position:absolute; left:0; bottom:0; height:3px; background:var(--tm-accent) }
.tm5-pill--quiet{ background:rgba(14,17,22,.72); color:#fff; box-shadow:inset 0 0 0 1.5px rgba(255,255,255,.55) }
/* The number is a button: tap it to type. */
.tm5-vbtn{ min-width:44%; min-height:48px; padding:2px 10px; border:1px dashed rgba(var(--tm-ink), .3); border-radius:var(--radius-sm); background:none;
  font-family:inherit; cursor:pointer; -webkit-tap-highlight-color:transparent }
.tm5-vbtn:focus-visible{ outline:2px solid var(--tm-accent); outline-offset:4px }
.tm5-last{ display:flex; flex-wrap:wrap; gap:4px 16px; justify-content:center; font-size:.9rem; color:var(--tm-muted) }
.tm5-last b{ font-weight:700; color:var(--tm-txt) }
/* The number pad. */
.tm-pad-v{ margin:6px 0 2px; text-align:center; font-size:3rem; font-weight:900; line-height:1.1; color:var(--tm-txt); font-variant-numeric:tabular-nums }
.tm-pad-v.is-old{ opacity:.38 }
.tm-pad-plates{ display:flex; align-items:center; justify-content:center; gap:6px; margin:0 auto; text-decoration:none }
.tm-pad-plates svg{ width:18px; height:18px }
.tm-pad{ display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:8px; margin:10px 0 12px }
.tm-pad-k{ min-height:56px; border:1px solid rgba(var(--tm-ink), .16); border-radius:var(--radius-md); background:rgba(var(--tm-ink), .04);
  color:var(--tm-txt); font:inherit; font-size:1.75rem; font-weight:700; cursor:pointer; -webkit-tap-highlight-color:transparent; touch-action:manipulation }
.tm-pad-k:active{ background:rgba(var(--tm-ink), .12) }
/* A short line that says something happened, then goes. */
.tm-flash{ position:absolute; left:50%; top:calc(var(--safe-top, env(safe-area-inset-top, 0px)) + 64px); transform:translateX(-50%); z-index:6;
  padding:10px 16px; border-radius:var(--radius-lg); background:var(--tm-accent); color:var(--accent-contrast, #fff);
  font-size:.9rem; font-weight:800; white-space:nowrap; pointer-events:none }

/* A superset is logged from one screen: each member has its own tick. */
.tm5-ss[data-tm]{ cursor:pointer }
.tm5-ss-tick{ flex:none; width:44px; height:44px; display:grid; place-items:center; padding:0; border-radius:50%; cursor:pointer;
  border:1.5px solid rgba(var(--tm-ink), .3); background:none; color:var(--tm-txt) }
.tm5-ss.is-now .tm5-ss-tick{ border-color:var(--tm-accent) }
.tm5-ss-tick.is-done{ border-color:transparent; background:color-mix(in srgb, var(--tm-accent) 22%, transparent); cursor:default }
.tm5-ss-tick svg{ width:18px; height:18px }
/* The clock for a timed set. */
.tm5-clock{ text-decoration:none; border:1px solid rgba(var(--tm-ink), .2); border-radius:var(--radius-sm); width:100% }
/* The demo is a white clip in a dark screen: round the corners it shares
   with the page so it reads as a frame, not a hard band. */
.tm5-demo{ border-bottom-left-radius:var(--radius-lg); border-bottom-right-radius:var(--radius-lg); overflow:hidden }

/* The UX review (2026-11-16): the white demo clip sits on a neutral mat so its
   edge is not harsh; tapped, it opens full size with the cues. */
.tm5-demo{ background:#E6E8EA }
.tm5-demo .tm-vid{ background:#fff; cursor:pointer }

/* ── A FOLLOW-ALONG WITH THE PHONE TURNED (the UX review, workout.14.2) ────
   The video takes the screen's height on the left and the set, its steppers
   and Complete set stay on screen on the right. A phone only: from 900px the
   landscape layout above already places everything. */
@media (orientation: landscape) and (max-height: 540px) {
  #trainingMode .tm-scr:has(> .tm-follow) { flex-direction: row; }
  #trainingMode .tm-scr > .tm-follow { flex: 1 1 60%; margin: 0; min-width: 0; display: flex; flex-direction: column; justify-content: center; background: #000; }
  #trainingMode .tm-scr > .tm-follow .od-player { aspect-ratio: auto; flex: 1 1 auto; border-radius: var(--radius-sm); }
  #trainingMode .tm-scr > .tm-follow .od-player video { width: 100%; height: 100%; object-fit: contain; }
  #trainingMode .tm-scr > .tm-follow .od-speed { padding: 4px 8px calc(env(safe-area-inset-bottom, 0px) + 4px); margin: 0; }
  #trainingMode .tm-scr:has(> .tm-follow) > .tm-body { flex: 1 1 40%; min-width: 0; overflow-y: auto; }
}

/* ── THE THREE-TAB LAYOUT (approved 2026-11-22, design-reference/approved-tm-tabs) ──
   A taller demo with the exercise name on its lower left; the menu button in
   the accent (Finish lives in the menu); under the demo three tabs: This set,
   All sets, Cues. The numbers lose their boxes and grow; − and + are round. */
.tm5-demo{ height:min(52vh, 460px); min-height:240px }
.tm6-menu{ background:var(--tm-accent); color:var(--accent-contrast, #fff) }
.tm5-bot{ flex-direction:column; align-items:flex-start; gap:2px }
.tm5-bot .tm6-title{ color:#10171E; text-align:left; overflow-wrap:anywhere }
.tm5-bot .tm6-line{ margin:0; text-align:left; color:#55616B }
.tm5-main{ gap:0; padding-top:4px }
.tm6-tabs{ display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); flex:none; border-bottom:1px solid rgba(var(--tm-ink), .14) }
.tm6-tabs button{ min-height:46px; padding:0 4px; background:none; border:0; border-bottom:3px solid transparent; color:var(--tm-muted); font:inherit; font-size:.9rem; font-weight:700; cursor:pointer }
.tm6-tabs button.on{ color:var(--tm-txt); border-bottom-color:var(--tm-accent) }
.tm6-tabs button:focus-visible{ outline:2px solid var(--tm-accent); outline-offset:-2px }
.tm6-pane{ display:flex; flex-direction:column; gap:8px; padding-top:12px }
.tm6-pane .tm5-box{ border:0; padding:0 }
.tm6-pane .tm5-v{ font-size:4rem }
.tm6-pane .tm5-vbtn{ border:0; min-height:68px; padding:0 10px }
.tm6-pane .tm5-steps{ display:flex; justify-content:center; gap:14px; width:auto; margin-top:2px }
.tm6-pane .tm5-steps b{ width:52px; height:52px; border-radius:50% }
.tm6-line{ text-align:center; font-size:.9rem; color:var(--tm-muted); margin-top:4px }
.tm6-rest{ min-height:44px; padding:0 2px; background:none; border:0; color:inherit; font:inherit; text-decoration:underline; text-underline-offset:3px; cursor:pointer }
.tm6-lastbtn{ width:100%; min-height:44px; margin-top:4px; background:none; border:0; font:inherit; font-size:.9rem; cursor:pointer; align-items:center }
.tm6-lastbtn i{ font-style:normal; color:var(--tm-muted) }
.tm6-rows{ display:flex; flex-direction:column; gap:4px }
.tm6-row{ display:grid; grid-template-columns:3.6rem minmax(0,1fr) auto; align-items:center; gap:10px; min-height:48px; padding:0 12px; border:2px solid transparent; border-radius:var(--radius-md); font-size:.9rem; color:var(--tm-muted) }
.tm6-row b{ color:var(--tm-txt) }
.tm6-row small{ font-size:.8125rem }
.tm6-row--now{ border-color:var(--tm-accent); color:var(--tm-txt) }
.tm6-row--done b{ color:var(--tm-muted) }
.tm6-cues{ margin:0; padding-left:1.15rem; display:flex; flex-direction:column; gap:8px; font-size:.9rem; line-height:1.45; color:var(--tm-txt) }
.tm6-nocues{ margin:0; font-size:.9rem; color:var(--tm-muted) }
.tm6-restgrid{ display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:8px; margin:14px 0 }
.tm6-restopt{ min-height:48px; border:1px solid rgba(var(--tm-ink), .18); border-radius:var(--radius-md); background:none; color:var(--tm-txt); font:inherit; font-weight:700; cursor:pointer }
.tm6-restopt.on{ border:2px solid var(--tm-accent) }
/* The clip is drawn a quarter larger in the taller panel: the clips carry
   white margins either side, and at "contain" the figure stayed the size it
   was. Not in the landscape layout, where the panel is already wide. */
.tm5-demo .tm-vid{ transform:scale(1.25); transform-origin:50% 45% }
@media (min-width:900px) and (orientation:landscape){ #trainingMode .tm5-demo .tm-vid{ transform:none } }

/* How hard was it? on the rest screen (2026-11-22): optional, five round buttons. */
.tm6-eff{ margin-top:18px; text-align:center }
.tm6-eff b{ display:block; margin-bottom:10px; font-size:.9rem; color:var(--tm-txt) }
.tm6-eff div{ display:flex; justify-content:center; gap:10px }
.tm6-eff button{ width:48px; height:48px; border-radius:50%; border:1.5px solid rgba(var(--tm-ink), .25); background:none; color:var(--tm-txt); font:inherit; font-weight:700; cursor:pointer }
.tm6-eff button.on{ border:2px solid var(--tm-accent); box-shadow:inset 0 0 0 2px var(--tm-accent) }
.tm6-eff small{ display:flex; justify-content:space-between; max-width:280px; margin:8px auto 0; font-size:.75rem; color:var(--tm-muted) }
