    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    :root {
      --font-display: 'Sora', sans-serif;
      --bg: #0b0e17;
      --s1: #141826;
      --s2: #1e2436;
      --border: #2a3046;
      --accent: #3e57a5;
      --accent-light: #8aa0e0; /* accent-as-TEXT tier — #3e57a5 is too dim for small text on the dark surfaces */
      --accent-dim: rgba(62,87,165,0.15);
      --green: #4ade80;
      --green-dim: rgba(74,222,128,0.15);
      --amber: #fbbf24;
      --amber-dim: rgba(251,191,36,0.15);
      --red: #f87171;
      --red-dim: rgba(248,113,113,0.15);
      --t1: #f1f4fb;
      --t2: #ccd5ea;
      --t3: #8a95b4;
      --r: 16px;
      --rsm: 10px;
      --rlg: 22px;
      /* Shared top gap for every screen — safe-area-aware (~20px in normal
         Safari, grows under a notch). All screen headers use this so the first
         element never shifts vertically when navigating between screens. */
      --screen-top: calc(env(safe-area-inset-top, 0px) + 20px);
      --screen-bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
    }

    html, body {
      height: 100%;
      background: var(--bg);
      color: var(--t1);
      font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', Arial, sans-serif;
      -webkit-font-smoothing: antialiased;
    }
    /* Scrolling belongs to the VIEWPORT only. overflow-x:hidden on body used
       to compute its overflow-y to auto — body (height:100%) became a nested
       scroll container, so tall screens grew a scrollbar INSIDE body's width
       and the centered #app column shifted ~7px between screens. Body must
       stay overflow:visible. overflow-y:scroll keeps the window track always
       on, so the centering width is constant from first paint on desktop;
       phones use overlay scrollbars, where both rules are no-ops.
       overscroll-behavior-y:none kills the iOS elastic bounce at the scroll
       BOUNDARIES only (obvious on short screens like the collapsed Skill Tree,
       which have zero scroll range) — real scrolling is untouched, and it also
       stops background scroll-chaining behind internally-scrolling modals. */
    html { overflow-x: hidden; overflow-y: scroll; overscroll-behavior-y: none; }

    #app {
      max-width: 430px;
      min-height: 100vh;
      min-height: 100dvh;
      margin: 0 auto;
      position: relative;
    }

    /* ── Screen System ── */
    .screen {
      display: none;
      min-height: 100vh;
      min-height: 100dvh;
      padding-bottom: var(--screen-bottom);
    }
    .screen.active { display: block; }
    /* One-shot entry animation, added by showScreen() on the activating screen */
    .screen-enter { animation: screenIn 0.2s ease-out both; }
    @keyframes screenIn {
      from { opacity: 0; transform: translateY(8px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    /* ── Modal — shared animation language ──
       Every modal opens/closes through animOpenModal/animCloseModal (.open →
       entry animation; .closing → exit, stripped on animationend). Default =
       bottom sheet (backdrop fade + sheet slide); .modal-center = centered
       dialog (scale+fade). .closing rules sit AFTER .open so they win while
       both classes briefly coexist during the close. */
    .modal-backdrop {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.7);
      z-index: 100;
      align-items: flex-end;
      justify-content: center;
    }
    .modal-backdrop.open    { display: flex; animation: mdlBackdropIn 0.25s ease both; }
    .modal-backdrop.open .modal-sheet { animation: mdlSheetUp 0.32s cubic-bezier(0.16,1,0.3,1) both; }
    .modal-backdrop.closing { display: flex; animation: mdlBackdropOut 0.22s ease both; }
    .modal-backdrop.closing .modal-sheet { animation: mdlSheetDown 0.24s cubic-bezier(0.4,0,1,1) both; }
    @keyframes mdlBackdropIn  { from { opacity: 0; } to { opacity: 1; } }
    @keyframes mdlBackdropOut { from { opacity: 1; } to { opacity: 0; } }
    @keyframes mdlSheetUp     { from { transform: translateY(100%); } to { transform: translateY(0); } }
    @keyframes mdlSheetDown   { from { transform: translateY(0); } to { transform: translateY(100%); } }
    /* Centered dialog variant (alert-style confirms) */
    .modal-backdrop.modal-center { align-items: center; padding: 24px; }
    .modal-backdrop.modal-center .modal-sheet { border-radius: var(--rlg); }
    .modal-backdrop.modal-center.open .modal-sheet    { animation: mdlPopIn 0.22s cubic-bezier(0.34,1.3,0.64,1) both; }
    .modal-backdrop.modal-center.closing .modal-sheet { animation: mdlPopOut 0.16s ease-in both; }
    @keyframes mdlPopIn  { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }
    @keyframes mdlPopOut { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(0.95); } }
    .modal-sheet {
      background: var(--s1);
      border: 1px solid var(--border);
      border-radius: var(--rlg) var(--rlg) 0 0;
      padding: 28px 24px 40px;
      width: 100%;
      max-width: 430px;
      text-align: center;
    }
    .modal-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
    .modal-sub { font-size: 14px; color: var(--t2); margin-bottom: 24px; }
    .modal-btns { display: flex; flex-direction: column; gap: 10px; }
    /* Choose-start options: leading icon + centered label. :not([hidden]) so the
       conditional Coach/Saved buttons still hide (a styled display beats the [hidden] attr). */
    #modal-choose-start .modal-btns button:not([hidden]) { display: flex; align-items: center; justify-content: center; gap: 10px; }
    #modal-choose-start .cs-ic { display: inline-flex; align-items: center; }
    /* Swap modal: the candidate list can be long (up to 12) — bound the sheet to
       the viewport and scroll ONLY the list, keeping the title, "I have" filter,
       and Cancel pinned. Scoped to #modal-alts so no other modal is affected. */
    #modal-alts .modal-sheet {
      max-height: 88vh;   /* fallback */
      max-height: 88dvh;
      display: flex;
      flex-direction: column;
    }
    #modal-alts #alts-title,
    #modal-alts #alts-sub,
    #modal-alts #alts-eqfilter,
    #modal-alts .modal-btns { flex: none; }
    #modal-alts #alts-list { flex: 1 1 auto; overflow-y: auto; min-height: 0; }

    /* Native date input — explicit sizing + dark color-scheme; unstyled it
       renders tiny/misaligned on mobile and the picker comes up light. */
    input[type="date"] {
      -webkit-appearance: none;
      appearance: none;
      display: block;
      width: 100%;
      min-height: 48px;
      padding: 12px 16px;
      font-family: inherit; font-size: 15px;
      background: var(--bg);
      border: 1px solid var(--border);
      color: var(--t1);
      border-radius: var(--rsm);
      outline: none;
      text-align: left;
      color-scheme: dark;
    }
    input[type="date"]::-webkit-date-and-time-value { text-align: left; }
    input[type="date"]::-webkit-calendar-picker-indicator { opacity: 0.7; cursor: pointer; }

    /* Log Activity — optional duration: quick-tap pills + free minutes input */
    .act-dur-row { display: flex; gap: 6px; }
    .act-dur-row .ppl-chip { flex: 1; padding: 12px 0; min-height: 44px; }
    .act-dur-free {
      flex: 1.2; min-width: 0; min-height: 44px;
      padding: 10px 4px;
      background: var(--bg);
      border: 1.5px solid var(--border);
      border-radius: var(--rsm);
      color: var(--t1);
      font-family: inherit; font-size: 13px; font-weight: 600;
      text-align: center; outline: none;
      -moz-appearance: textfield;
    }
    .act-dur-free::-webkit-outer-spin-button,
    .act-dur-free::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
    .act-dur-free:focus { border-color: var(--accent); }
    .act-dur-free::placeholder { color: var(--t3); }

    /* Injury form — themed native select (keep the native arrow; color-scheme
       makes the dropdown itself dark on mobile) */
    select.inj-select {
      display: block; width: 100%;
      min-height: 48px; padding: 12px 16px;
      font-family: inherit; font-size: 15px;
      background: var(--bg);
      border: 1px solid var(--border);
      color: var(--t1);
      border-radius: var(--rsm);
      outline: none;
      color-scheme: dark;
    }

    /* ── Shared ── */
    .screen-hd {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: var(--screen-top) 20px 20px;
    }
    .screen-hd h2 { font-size: 22px; font-weight: 700; }

    .back-btn {
      width: 40px; height: 40px;
      background: var(--s1);
      border: 1px solid var(--border);
      border-radius: 12px;
      display: flex; align-items: center; justify-content: center;
      cursor: pointer;
      flex-shrink: 0;
      color: var(--t1);
      transition: background 0.15s;
      -webkit-tap-highlight-color: transparent;
    }
    .back-btn:hover { background: var(--s2); }
    .back-btn:active { background: var(--s2); transform: scale(0.9); }

    .section-lbl {
      font-size: 11px; font-weight: 700;
      text-transform: uppercase; letter-spacing: 1.2px;
      color: var(--t3);
      padding: 0 20px;
      margin-bottom: 10px;
    }

    /* Tinted CTA, same recipe as .auth-submit (minus its glow) and .cc-cta — a
       translucent accent wash over a surface with a bright accent-light rim,
       rather than an opaque accent slab. Those two were already the app's CTA
       language; this was the last solid-fill holdout.
       15.4px + 1.6px border = the old 17px padding box (the rim rounds to whole
       device pixels, so the height can land ~1px either way — nothing shifts). */
    .btn-primary {
      width: 100%; padding: 15.4px;
      background: linear-gradient(0deg,
                    color-mix(in srgb, var(--accent) 16%, transparent),
                    color-mix(in srgb, var(--accent) 16%, transparent)), var(--s2);
      color: #fff;
      font-family: inherit; font-size: 16px; font-weight: 700;
      border: 1.6px solid color-mix(in srgb, var(--accent-light) 79%, transparent);
      border-radius: var(--r);
      cursor: pointer;
      letter-spacing: 0.2px;
      transition: opacity 0.15s, transform 0.1s;
    }
    .btn-primary:active { transform: scale(0.98); opacity: 0.9; }
    .btn-primary:disabled { opacity: 0.35; cursor: default; }

    .btn-ghost {
      width: 100%; padding: 15px;
      background: var(--s1);
      border: 1px solid var(--border);
      color: var(--t2);
      font-family: inherit; font-size: 15px; font-weight: 600;
      border-radius: var(--r);
      cursor: pointer;
      transition: background 0.15s, color 0.15s;
      -webkit-tap-highlight-color: transparent;
    }
    .btn-ghost:hover { background: var(--s2); color: var(--t1); }
    .btn-ghost:active {
      background: var(--s2); color: var(--t1);
      border-color: rgba(138,160,224,0.55);
      box-shadow: 0 0 10px rgba(138,160,224,0.22);
      transform: scale(0.98);
    }

    .btn-danger {
      width: 100%; padding: 15px;
      background: rgba(248,113,113,0.12);
      border: 1px solid rgba(248,113,113,0.25);
      color: #f87171;
      font-family: inherit; font-size: 15px; font-weight: 600;
      border-radius: var(--r);
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
    }
    .btn-danger:active {
      background: rgba(248,113,113,0.18);
      border-color: rgba(248,113,113,0.5);
      box-shadow: 0 0 10px rgba(248,113,113,0.25);
      transform: scale(0.98);
    }
    .btn-danger:disabled { opacity: 0.4; cursor: default; }
    /* Change-password + delete-account modal fields */
    .modal-input { width: 100%; margin-top: 12px; background: var(--s2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; color: var(--t1); font-family: inherit; font-size: 15px; outline: none; transition: border-color 0.15s; }
    .modal-input:focus { border-color: var(--accent-light); }
    .modal-err { color: #f87171; font-size: 13px; margin-top: 12px; line-height: 1.4; }
    .modal-err[hidden] { display: none; }
    .del-lbl { display: block; font-size: 13px; color: var(--t2); margin: 4px 0 8px; }
    .set-row.set-danger { color: var(--red); }
    /* :not(.disabled) lifts specificity above the generic .set-row press rule
       (Settings block) so the red press wins despite living earlier in the file */
    .set-row.set-danger:not(.disabled):active {
      background: linear-gradient(0deg, rgba(248,113,113,0.10), rgba(248,113,113,0.10)), var(--s1);
      border-color: rgba(248,113,113,0.45);
      box-shadow: 0 0 10px rgba(248,113,113,0.2);
    }

    .hidden { display: none !important; }

    /* ── Reward FX ── */
    .float-plus {
      position: absolute;
      pointer-events: none;
      font-size: 18px; font-weight: 800;
      color: var(--green);
      animation: floatUp 0.9s ease-out forwards;
      z-index: 50;
    }
    @keyframes floatUp {
      0%   { opacity: 0; transform: translateY(0) scale(0.6); }
      20%  { opacity: 1; transform: translateY(-8px) scale(1.1); }
      100% { opacity: 0; transform: translateY(-50px) scale(1); }
    }
    .ex-card.flash-done {
      animation: cardFlashGreen 0.6s ease;
    }
    @keyframes cardFlashGreen {
      0%   { box-shadow: 0 0 0 0 rgba(74,222,128,0.7); border-color: var(--green); }
      100% { box-shadow: 0 0 0 20px rgba(74,222,128,0); border-color: rgba(74,222,128,0.4); }
    }
    .ex-done-toast {
      position: fixed;
      top: 50%; left: 50%; transform: translate(-50%, -50%);
      pointer-events: none;
      background: var(--s2); border: 1.5px solid var(--green);
      color: var(--green);
      padding: 12px 22px; border-radius: var(--rsm);
      font-size: 14px; font-weight: 700;
      max-width: 380px; width: calc(100% - 40px);
      text-align: center;
      box-shadow: 0 10px 30px rgba(0,0,0,0.5);
      z-index: 120;
      animation: toastIn 0.3s ease, toastOut 0.3s ease 1.7s forwards;
    }
    /* Error variant (showErrorToast) — app-api/network failure copy. Same
       shape/position/lifecycle as the success pill, danger color language. */
    .ex-done-toast.is-error {
      border-color: var(--red);
      color: var(--red);
    }
    @keyframes toastIn {
      from { opacity: 0; transform: translate(-50%,-50%) scale(0.92); }
      to   { opacity: 1; transform: translate(-50%,-50%) scale(1); }
    }
    @keyframes toastOut {
      to { opacity: 0; transform: translate(-50%,-50%) scale(0.92); }
    }
    .milestone-overlay {
      position: fixed; inset: 0;
      /* centered by default (workout-% milestones); the streak celebration
         overrides align-items/padding-top inline to sit at eye level, just
         above the Last 14 Days card — see celebrateStreak(). */
      display: flex; align-items: center; justify-content: center;
      pointer-events: none;
      z-index: 130;
    }
    .milestone-card {
      background: var(--s2);
      color: #f5b942;
      border: 1px solid rgba(245,185,66,0.5);
      /* compact pill — sized a notch above .ex-done-toast so it sits light in
         the dots→CTA gap the overlay pins it into */
      padding: 14px 26px; border-radius: var(--rlg);
      font-size: 16px; font-weight: 800; letter-spacing: -0.3px;
      box-shadow: 0 0 28px rgba(245,185,66,0.45);
      /* 3.5s on screen total (entrance 0.5s + hold + fade-out starts at 3.15s +
         0.35s fade) — keep the out delay in sync with showMilestone's 3500ms
         removal timer + tap-dismiss. */
      animation: milestoneIn 0.5s cubic-bezier(0.175,0.885,0.32,1.275),
                 milestoneOut 0.35s ease 3.15s forwards;
    }
    /* Pattern level-up card sub-line ("+N points to spend") — inherits the tint. */
    .milestone-card .ms-sub { font-size: 13px; font-weight: 600; letter-spacing: 0; margin-top: 3px; opacity: 0.85; }
    @keyframes milestoneIn {
      from { opacity: 0; transform: scale(0.4); }
      to   { opacity: 1; transform: scale(1); }
    }
    @keyframes milestoneOut {
      to { opacity: 0; transform: scale(0.85); }
    }
    /* Celebration shown while a rest/hold timer overlay (z-index 1000, opaque) is
       up: lift it above the overlay and pin it as a top banner so it's visible and
       clears the centered countdown. Added by showMilestone()/showExerciseToast()
       only when a .rest-overlay.open is present. */
    .milestone-overlay.over-timer { z-index: 1100; align-items: flex-start; padding-top: calc(env(safe-area-inset-top, 0px) + 80px); }
    /* ══ Unified celebration card — the ONE shape for all 5 events (level-up,
       pattern level-up, workout milestone, streak, skill unlock). Non-persist
       cards reuse the old milestone lifecycle (overlay stays pointer-events:none,
       taps pass through, ~3.5s auto-dismiss). Persist (level-up) captures taps with
       a dim backdrop + a .btn-primary CTA and no timeout. --cc = the event color,
       --ccd = the same hue at ~15% alpha (disc bg + glow). */
    .celebrate-overlay{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;z-index:130;pointer-events:none;padding:24px}
    .celebrate-overlay.over-timer{z-index:1100;align-items:flex-start;padding-top:calc(env(safe-area-inset-top, 0px) + 80px)}
    .celebrate-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.5)}
    .celebrate-card{position:relative;background:var(--s1);border:1px solid var(--cc,#f5b942);border-radius:var(--rlg);padding:26px 24px 24px;width:100%;max-width:320px;text-align:center;box-shadow:0 0 34px var(--ccd,rgba(245,185,66,.15)),0 20px 50px rgba(0,0,0,.55);animation:mdlPopIn .32s cubic-bezier(.34,1.3,.64,1) both}
    .celebrate-card .cc-disc{width:60px;height:60px;border-radius:50%;margin:0 auto 14px;background:var(--ccd,rgba(245,185,66,.15));display:flex;align-items:center;justify-content:center;color:var(--cc,#f5b942)}
    .celebrate-card .cc-kick{font-size:11px;font-weight:700;letter-spacing:1.5px;text-transform:uppercase;color:var(--cc,#f5b942);margin-bottom:6px}
    .celebrate-card .cc-title{font-family:var(--font-display);font-size:19px;font-weight:700;letter-spacing:-.2px;color:var(--t1);line-height:1.25}
    .celebrate-card .cc-sub{font-size:14px;color:var(--t3);margin-top:8px;line-height:1.4}
    /* CTA mirrors the skill-detail unlock button (#modal-skilldetail .st-btn) — dark base,
       tinted border, glow on press; no branch here, so --b defaults to accent-light. */
    .celebrate-card .cc-cta{--b:var(--accent-light);width:100%;margin-top:18px;padding:16px;border-radius:16px;color:#fff;cursor:pointer;font-family:inherit;font-weight:700;font-size:15px;border:1.6px solid color-mix(in srgb,var(--b) 38%,transparent);background:linear-gradient(0deg,color-mix(in srgb,var(--b) 10%,transparent),color-mix(in srgb,var(--b) 10%,transparent)),var(--s2);box-shadow:none;transition:transform .2s,border-color .2s,background .2s,box-shadow .2s}
    .celebrate-card .cc-cta:active{transform:scale(.98);border-color:var(--b);background:linear-gradient(0deg,color-mix(in srgb,var(--b) 28%,transparent),color-mix(in srgb,var(--b) 28%,transparent)),var(--s2);box-shadow:0 0 26px color-mix(in srgb,var(--b) 55%,transparent),0 0 11px color-mix(in srgb,var(--b) 70%,transparent)}
    .ex-done-toast.over-timer {
      z-index: 1100;
      top: calc(env(safe-area-inset-top, 0px) + 80px);
      transform: translateX(-50%);
      animation: toastBannerIn 0.3s ease, toastBannerOut 0.3s ease 1.7s forwards;
    }
    @keyframes toastBannerIn {
      from { opacity: 0; transform: translateX(-50%) scale(0.92); }
      to   { opacity: 1; transform: translateX(-50%) scale(1); }
    }
    @keyframes toastBannerOut {
      to { opacity: 0; transform: translateX(-50%) scale(0.92); }
    }

    /* ══════════════════════════════════════
       HOME
    ══════════════════════════════════════ */
    .home-hd {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      padding: var(--screen-top) 20px 20px;
      position: relative;   /* anchor for the absolutely-centered coach pill */
    }
    .greeting { font-size: 14px; color: var(--t2); margin-bottom: 4px; }
    .client-name {
      font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', Arial, sans-serif;
      font-size: 30px; font-weight: 800; letter-spacing: -1px;
      white-space: nowrap;   /* never wrap — fitClientName() owns the sizing so a long name shrinks to clear the pill */
      background: linear-gradient(135deg, var(--accent-light), var(--accent));
      -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    }
    /* Coach message pill (home header) + sheet body */
    .coach-pill {
      position: absolute;                          /* centered over the header at its original height */
      top: calc(var(--screen-top) + 6px);          /* = the old flex-start + margin-top:6px */
      left: 50%; transform: translateX(-50%);
      display: flex; align-items: center; gap: 5px;
      width: fit-content; max-width: calc(100% - 150px);  /* clear the greeting (left) + gear (right) */
      padding: 8px 13.1px 8px 12.9px; min-height: 36px;   /* nudge icon+text 0.1px left to offset the SVG's edge */
      background: var(--accent-dim);
      border: 1px solid rgba(138,160,224,0.35);
      border-radius: 20px;
      color: #fff;
      font-family: inherit; font-size: 12px; font-weight: 700;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
      transition: transform 0.1s;
    }
    /* keep the horizontal centering while adding the press-scale */
    .coach-pill:active { transform: translateX(-50%) scale(0.95); }
    /* display:flex above beats the UA [hidden]{display:none} — restore it */
    .coach-pill[hidden] { display: none; }
    /* Menu button (home header, top-right) — hamburger that opens the dropdown.
       Reuses the .settings-btn box styling the old gear used. */
    .settings-btn {
      display: inline-flex; align-items: center; justify-content: center;
      width: 40px; height: 40px; flex-shrink: 0;
      background: var(--s1); border: 1px solid var(--border); border-radius: 11px;
      color: var(--t2); cursor: pointer;
      -webkit-tap-highlight-color: transparent;
      transition: background 0.15s, transform 0.1s;
    }
    .settings-btn:active { transform: scale(0.95); background: var(--s2); }
    .settings-btn svg { display: block; }   /* kill the inline-SVG baseline gap so the icon centers in the box */

    /* Hamburger → X morph (CSS-only; openMenu/closeMenu toggle #menu-btn aria-expanded).
       transform-box:view-box makes transform-origin:center resolve to the 24×24
       viewBox center (12,12); the top/bottom bars translate to center then rotate
       ±45° into an X while the middle bar fades. Reverses when aria-expanded flips. */
    .menu-btn-ic line {
      transition: transform .3s cubic-bezier(.4,0,.2,1), opacity .2s ease;
      transform-box: view-box;
      transform-origin: center;
    }
    #menu-btn[aria-expanded="true"] .menu-btn-ic line:nth-of-type(1) { transform: rotate(45deg) translateY(5px); }
    #menu-btn[aria-expanded="true"] .menu-btn-ic line:nth-of-type(2) { opacity: 0; }
    #menu-btn[aria-expanded="true"] .menu-btn-ic line:nth-of-type(3) { transform: rotate(-45deg) translateY(-5px); }
    @media (prefers-reduced-motion: reduce) {
      .menu-btn-ic line { transition: none; }
    }

    /* Home header menu — lightweight dropdown (intentionally separate from the
       bottom-sheet modal system). top is safe-area-aware: = the mockup's 75px
       at zero inset, and tracks env(safe-area-inset-top) so the caret stays
       just under the button on notched devices (the header uses --screen-top). */
    #menu-pop {
      /* absolute (not fixed) so it anchors to the #app column the button lives in —
         fixed pinned it to the VIEWPORT right edge, detaching from the button once
         the screen got wider than #app's 430px cap. right:18px now tracks the button
         at every width (≤430px viewport: #app fills it, so it matches the old fixed). */
      position: absolute; top: calc(env(safe-area-inset-top, 0px) + 75px); right: 18px; z-index: 130;
      display: flex; flex-direction: column; width: max-content;
      background: var(--s2); border: 1px solid #3a4570; border-radius: 14px; padding: 5px;
      box-shadow: 0 18px 50px rgba(0,0,0,.55), 0 2px 10px rgba(0,0,0,.4);
      transform-origin: top right;
      opacity: 0; visibility: hidden; transform: scale(.98) translateY(-8px);
      /* will-change keeps the popover on a persistent compositor layer. Without it
         the layer is created for the open transition and dropped when it ends, and
         the rows re-rasterize (grayscale→subpixel AA) — text/icons visibly snap
         slightly thinner ~0.2s after every open. */
      will-change: transform, opacity;
      transition: opacity .22s cubic-bezier(.4,0,.2,1), transform .24s cubic-bezier(.4,0,.2,1), visibility 0s linear .24s;
    }
    #menu-pop.open {
      opacity: 1; visibility: visible; transform: scale(1) translateY(0);
      transition: opacity .22s cubic-bezier(.4,0,.2,1), transform .24s cubic-bezier(.4,0,.2,1), visibility 0s linear 0s;
    }
    #menu-pop .menu-caret {
      position: absolute; top: -6px; right: 16px; width: 11px; height: 11px;
      background: var(--s2); border-left: 1px solid #3a4570; border-top: 1px solid #3a4570;
      transform: rotate(45deg);
    }
    .menu-row {
      display: flex; align-items: center; gap: 12px; min-height: 38px; padding: 0 6px 0 4px;
      border: none; background: none; white-space: nowrap; cursor: pointer;
      color: var(--t1); font-family: inherit; font-size: 14.5px; font-weight: 500;
      border-radius: 9px; text-align: left; transition: background .12s;
      -webkit-tap-highlight-color: transparent;
    }
    .menu-row:hover { background: rgba(255,255,255,.05); }
    .menu-row:active { background: var(--accent-dim); transform: scale(0.99); }
    .menu-row .menu-ic {
      flex: 0 0 23px; width: 23px; height: 23px;
      display: flex; align-items: center; justify-content: center; color: var(--accent-light);
    }
    .menu-row.logout { color: var(--t2); }
    /* The `logout` glyph's ink is off-center in its 24-viewBox (center ~x15 vs x12 for the
       other menu icons), so it rendered ~3px right of the icon column — nudge it back left. */
    .menu-row.logout .menu-ic { color: var(--t3); transform: translateX(-3px); }
    .menu-divider { height: 1px; background: var(--border); margin: 6px 12px; }
    /* Unspent skill-points dot on the Skill Tree row (renderSkillTreeDot). ⚠ the class
       sets a display, so the [hidden] guard is load-bearing (the styled-[hidden] trap). */
    .menu-dot {
      display: inline-block; flex: 0 0 auto; margin-left: auto;
      width: 7px; height: 7px; border-radius: 50%; background: var(--accent-light);
    }
    .menu-dot[hidden] { display: none; }
    .coach-note-body {
      font-size: 15px; color: var(--t1);
      line-height: 1.6; text-align: left;
      white-space: pre-wrap;
      background: var(--s2);
      border: 1px solid var(--border);
      border-radius: var(--rsm);
      padding: 14px 16px;
      margin-top: 4px;
    }
    /* When both sections show, divide the personal one from the general one above it. */
    #coach-note-general:not([hidden]) + #coach-note-personal:not([hidden]) { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
    /* Next-session section — same divider treatment when it follows a VISIBLE section
       (a hidden element still counts as a `+` sibling, so both arrangements need a rule). */
    #coach-note-personal:not([hidden]) + #coach-note-session:not([hidden]),
    #coach-note-general:not([hidden]) + #coach-note-personal[hidden] + #coach-note-session:not([hidden]) { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
    /* One "calendar invite" card: icon tile + uppercase date eyebrow + hero time +
       subtle note, with a single hairline-divided Add-to-calendar footer (one CTA). */
    .cn-session-card {
      background: linear-gradient(135deg, rgba(62,87,165,0.18), rgba(62,87,165,0.05));
      border: 1px solid rgba(138,160,224,0.30);
      border-radius: var(--r);
      text-align: left; overflow: hidden;
    }
    .cn-session-top { display: flex; align-items: center; gap: 13px; padding: 15px 16px; }
    .cn-session-tile {
      width: 42px; height: 42px; flex: none;
      display: flex; align-items: center; justify-content: center;
      background: rgba(138,160,224,0.13);
      border-radius: 11px; color: var(--accent-light);
    }
    .cn-session-main { min-width: 0; }
    .cn-session-date { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--t3); }
    .cn-session-time { font-family: var(--font-display); font-size: 22px; font-weight: 800; letter-spacing: -0.3px; line-height: 1.25; color: var(--t1); font-variant-numeric: tabular-nums; }
    .cn-session-note { margin-top: 2px; font-size: 13px; color: var(--t2); overflow-wrap: anywhere; }
    .cn-cal-add {
      display: flex; align-items: center; justify-content: center; gap: 8px;
      width: 100%; min-height: 46px; padding: 12px;
      background: transparent; border: none; border-top: 1px solid rgba(138,160,224,0.22);
      color: var(--accent-light); font-family: inherit; font-size: 15px; font-weight: 600;
      cursor: pointer; transition: opacity 0.15s ease, background 0.15s ease;
    }
    .cn-cal-add:active { background: rgba(138,160,224,0.10); opacity: 0.85; }

    /* Client → coach messaging: reply box (coach-message sheet) + post-workout feedback */
    .coach-reply { margin-top: 14px; }
    .coach-reply textarea, .done-fb textarea {
      width: 100%; padding: 12px 14px;
      background: var(--bg); border: 1px solid var(--border);
      color: var(--t1); border-radius: var(--rsm);
      font-family: inherit; font-size: 14px; outline: none; resize: vertical;
    }
    .coach-reply-sent {
      margin-top: 12px; font-size: 14px; color: var(--t2);
      background: var(--s1); border: 1px solid var(--border);
      border-radius: var(--rsm); padding: 10px 12px;
    }
    .done-fb { margin-top: 12px; margin-bottom: 12px; width: 100%; text-align: left; }
    .done-fb-label { font-size: 13px; color: var(--t2); margin-bottom: 8px; font-weight: 600; }
    .done-fb-done { margin-top: 8px; font-size: 14px; color: var(--green); }
    /* Empty note = nothing to send. Fading a ghost button has no headroom on this
       palette (its fill is barely off the page), so the gap is carried by the
       ACTIVE side: with text the button takes an accent tint; empty, it sits flat
       on the page as a quiet outline. Paint-only — same box either way. */
    #done-fb-send { transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s; }
    #done-fb-send:not(:disabled) {
      background: color-mix(in srgb, var(--accent) 22%, transparent);
      border-color: var(--accent-light);
      color: var(--t1);
    }
    #done-fb-send:not(:disabled):hover { background: color-mix(in srgb, var(--accent) 34%, transparent); }
    #done-fb-send:disabled {
      background: transparent;
      border-color: var(--s2);
      color: var(--t3);
      opacity: 0.7;
      cursor: default;
    }

    /* Home status banners (deload / injuries) */
    .home-banner {
      margin: 0 20px 14px;
      padding: 12px 14px;
      border-radius: var(--rsm);
      font-size: 13px; font-weight: 600;
      display: flex; align-items: center; gap: 8px;
      border: 1px solid var(--border);
      background: var(--s1); color: var(--t2);
      line-height: 1.4;
    }
    .home-banner .hb-arrow { margin-left: auto; color: inherit; opacity: 0.7; flex-shrink: 0; }
    .home-banner.tappable { cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background 0.15s; }
    .home-banner.tappable:active { background: var(--s2); }
    .home-banner.accent { background: var(--accent-dim); border-color: rgba(138,160,224,0.35); color: var(--accent-light); }
    .home-banner.danger { background: var(--red-dim); border-color: rgba(248,113,113,0.35); color: var(--red); }
    .home-banner.welcome-banner { background: var(--green-dim); border-color: var(--green); color: #f4f4f4; }
    .home-banner.welcome-banner svg { color: #f4f4f4; }
    .wb-x {
      flex-shrink: 0;
      display: flex; align-items: center; justify-content: center;
      /* `auto` left margin pushes the X to the far right of the banner. (The `margin`
         shorthand previously ended in `4px`, which reset the standalone margin-left:auto
         above it — leaving the X stuck next to the text. The -6px top/right/bottom tuck
         the 32px button against the banner's padding edge.) */
      width: 32px; height: 32px; margin: -6px -6px -6px auto;
      background: none; border: none; border-radius: 8px;
      color: #f4f4f4; opacity: 0.85; cursor: pointer;
      -webkit-tap-highlight-color: transparent;
    }
    .wb-x:active { opacity: 1; background: rgba(255,255,255,0.18); }

    /* Resume an unfinished workout — home card (renderResumeCard) */
    .resume{position:relative;display:flex;align-items:center;gap:13px;background:var(--accent-dim);
      border:1px solid rgba(138,160,224,.35);border-radius:16px;padding:15px 16px;margin:0 20px 16px;cursor:pointer;
      transition:border-color .2s,background .2s;-webkit-tap-highlight-color:transparent}
    .resume:hover{background:rgba(62,87,165,.22);border-color:var(--accent-light)}
    .resume:active{background:rgba(62,87,165,.28);border-color:var(--accent-light);
      box-shadow:0 0 12px rgba(138,160,224,.25);transform:scale(.99)}
    .resume .play{flex:0 0 auto;width:42px;height:42px;border-radius:11px;background:rgba(138,160,224,.16);
      display:flex;align-items:center;justify-content:center;color:var(--accent-light)}
    .resume .play svg{display:block}
    .resume .body{flex:1;min-width:0}
    .resume .eyebrow{font-size:10px;font-weight:800;letter-spacing:1.2px;text-transform:uppercase;color:var(--accent-light);margin:0 0 3px}
    .resume .ttl{font-family:var(--font-display);font-size:16px;font-weight:700;margin:0 0 3px;color:var(--t1)}
    .resume .meta{font-size:12.5px;color:var(--t2);margin:0}
    .resume .x{position:absolute;top:8px;right:8px;width:26px;height:26px;border:none;background:none;border-radius:7px;
      color:var(--t3);display:flex;align-items:center;justify-content:center;cursor:pointer;-webkit-tap-highlight-color:transparent}
    .resume .x:hover{background:var(--s2);color:var(--t1)}
    .resume .x:active{background:var(--s2);color:var(--t1);transform:scale(.9)}
    .resume .x svg{display:block}

    /* Smooth collapse for home banners + the resume card on removal — grid-rows
       0fr↔1fr (same technique as .cons-stats-wrap) so the block AND its bottom
       margin shrink together and the content below slides up instead of jumping.
       Each banner / the resume card is rendered wrapped in .b-collapse >
       .b-collapse-in at 1fr (entrance instant); removal adds .b-collapsed and the
       node is cleared once the transition finishes. */
    .b-collapse { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 0.24s cubic-bezier(.4,0,.2,1); }
    .b-collapse.b-collapsed { grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows 0.24s cubic-bezier(.4,0,.2,1), opacity 0.2s ease; }
    .b-collapse > .b-collapse-in { overflow: hidden; min-height: 0; }
    @media (prefers-reduced-motion: reduce) { .b-collapse { transition: none; } }

    /* Deload bottom-sheet bullet rows + select-screen chip */
    .deload-point {
      font-size: 13px; color: var(--t2); line-height: 1.55;
      padding: 9px 0;
      border-bottom: 1px solid var(--border);
    }
    .deload-point:last-of-type { border-bottom: none; }
    .deload-point b { color: var(--t1); }
    .deload-chip {
      margin: 0 20px 12px;
      padding: 9px 12px;
      border-radius: 8px;
      font-size: 12px; font-weight: 600;
      background: var(--accent-dim); color: var(--accent-light);
    }

    /* Consistency card */
    .card {
      margin: 0 20px 14px;
      background: var(--s1);
      border: 1px solid var(--border);
      border-radius: var(--r);
      padding: 20px;
    }
    /* The Last 14 Days card is a tap-to-expand accordion. Scoped to #cons-card so
       the shared .card rule stays untouched. */
    #cons-card { padding: 22px; cursor: pointer; }
    /* Full-width header block — pinned, no content-based re-centering (kills the
       horizontal drift as the numbers change). The dots/stats/log below stay
       full-width too. */
    .cons-head-wrap { width: 100%; }
    .card-lbl {
      font-size: 11px; font-weight: 700;
      text-transform: uppercase; letter-spacing: 1px;
      color: var(--t3); margin-bottom: 14px;
    }

    /* Streak-hero: ring badge left · streak label + volume subline right (reads
       left-to-right, no heading↔ring collision) · message full-width below. */
    .cons-top { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
    .cons-text { flex: 1; min-width: 0; }
    .cons-streak { font-size: 17px; font-weight: 800; line-height: 1.1; transition: color 0.45s ease; }   /* "N-day streak" — id="ring-cap", tier-colored by renderHome */
    .cons-count { font-size: 13px; font-weight: 600; color: var(--t3); margin-top: 4px; }                 /* "N sessions · N active days" — quiet volume subline */
    .cons-days { color: var(--t3); font-weight: 600; }
    .cons-msg { font-size: 13.5px; color: var(--t2); margin-bottom: 22px; line-height: 1.4; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; transition: color 0.45s ease; }   /* full-width; wrap up to 2 lines then clamp; tier recolor crossfades */

    /* Streak ring badge (left hero). 60px; center number = current streak,
       fill = min(streak/7, 1); stroke colored by the streak tier. */
    .ring-col { flex-shrink: 0; }
    .ring-wrap { position: relative; width: 60px; height: 60px; }
    .ring-wrap svg.bg-ring { position: absolute; top: 0; left: 0; }
    .ring-center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
    .ring-num { font-family: var(--font-display); font-size: 22px; font-weight: 800; color: var(--t1); line-height: 1; letter-spacing: -0.5px; }
    .cons-chev { color: var(--t3); display: inline-flex; transition: transform 0.3s ease; }
    .cons-chev svg { display: block; }
    #cons-card.expanded .cons-chev { transform: rotate(180deg); }

    /* Streak-ramp dot row: flex baseline, sizes/colors/glow set inline by
       renderHome (deepening ramp to today, hollow today ring, small grey
       rest/future dots). No .filled/.today-ring classes any more. */
    .dots-row { display: flex; justify-content: space-between; align-items: flex-end; height: 26px; }
    .dot { border-radius: 50%; flex-shrink: 0; transition: width 0.45s ease, height 0.45s ease, background 0.45s ease, box-shadow 0.45s ease, border-color 0.45s ease; }   /* dots persist across renders → tier/size changes crossfade */
    /* Dots stagger-in on fresh load (mirrors CRM). Animates only opacity+scale —
       the inline box-shadow glow is untouched; no forwards → rest state unchanged. */
    @keyframes dotPop { from { opacity: 0; transform: scale(0.3); } to { opacity: 1; transform: scale(1); } }
    .dot.dot-anim { animation: dotPop 0.4s ease backwards; }
    @media (prefers-reduced-motion: reduce) { .dot.dot-anim { animation: none; } }
    /* Inline "Log a session" link at the foot of the Last 14 Days card.
       The whole strip below the divider is its own tap zone (.cons-log-zone) so
       tapping ANYWHERE in it — divider, the gap above the link, the bottom padding,
       the side corners — opens Log a session and never the accordion toggle (the
       card itself is the toggle). The 22px top MARGIN (not padding) keeps the gap
       ABOVE the divider as part of the toggle region; the negative L/R/bottom
       margins bleed the zone to the card's padding edges so the bottom + side
       padding log too. */
    .cons-log-zone { margin: 22px -22px -22px; padding: 0 22px 22px; cursor: pointer; }
    .cons-log-sep { height: 1px; background: var(--border); margin: 0; }
    .cons-log-link {
      display: block; width: 100%;
      background: none; border: none;
      padding: 12px 0 0;
      font-family: inherit; font-size: 13px; font-weight: 600;
      color: var(--t2);
      cursor: pointer; text-align: center;
      -webkit-tap-highlight-color: transparent;
      transition: color 0.15s;
    }
    .cons-log-link:hover { color: var(--t1); }
    .cons-log-link:active { color: var(--t1); transform: scale(0.96); }

    /* Last 14 Days accordion — expandable stats panel (grid-rows 0fr↔1fr slide). */
    .cons-stats-wrap { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.32s cubic-bezier(.4,0,.2,1); }
    #cons-card.expanded .cons-stats-wrap { grid-template-rows: 1fr; }
    .cons-stats-inner { overflow: hidden; min-height: 0; }
    .cons-stats { display: flex; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }
    .cons-stat { flex: 1; text-align: center; border-left: 1px solid var(--border); }
    .cons-stat:first-child { border-left: none; }
    .cons-stat-v { font-family: var(--font-display); font-size: 21px; font-weight: 800; letter-spacing: -0.5px; }
    .cons-stat-l { font-size: 11px; color: var(--t3); font-weight: 500; margin-top: 3px; }
    @media (prefers-reduced-motion: reduce) { .cons-stats-wrap, .cons-chev { transition: none; } }

    /* Last session (inside the Last 14 Days card) */
    .lw-badges {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      align-items: center;
      gap: 5px;
      margin-bottom: 10px;
    }
    .badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 4px 6px;
      border-radius: 20px;
      font-size: 11px; font-weight: 700;
      line-height: 1.4;
      letter-spacing: -0.3px;
      white-space: nowrap;
    }
    .lw-sub { font-size: 13px; color: var(--t2); text-align: center; }
    .ls-lbl {
      font-size: 10px; font-weight: 700;
      text-transform: uppercase; letter-spacing: 1.2px;
      color: var(--t3);
      margin: 14px 0 9px;
    }
    /* badges + meta keep the .lw-* centered defaults (label stays left, like the card labels) */

    /* CTA */
    .home-cta { margin: 20px 20px 0; display: flex; flex-direction: column; gap: 20px; }   /* gap matches the 20px above the CTA (card → CTA) so all 3 are evenly spaced */
    .cta-main {
      width: 100%; padding: 20px;
      background: linear-gradient(0deg, rgba(62,87,165,0.16), rgba(62,87,165,0.16)), var(--s2);
      color: #fff;
      font-family: inherit; font-size: 18px; font-weight: 700;
      border: 1.6px solid rgba(138,160,224,0.79); border-radius: var(--rlg);
      cursor: pointer;
      display: flex; align-items: center; justify-content: center; gap: 10px;
      box-shadow: 0 0 19px rgba(138,160,224,0.38), 0 0 8px rgba(138,160,224,0.48);
      transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s, background 0.2s;
      letter-spacing: -0.2px;
    }
    .cta-main:active {
      transform: scale(0.98);
      background: linear-gradient(0deg, rgba(62,87,165,0.28), rgba(62,87,165,0.28)), var(--s2);
      border-color: rgba(138,160,224,1);
      box-shadow: 0 0 26px rgba(138,160,224,0.55), 0 0 11px rgba(138,160,224,0.7);
    }
    .cta-secondary {
      width: 100%; margin-top: 12px;
      padding: 14px;
      background: transparent;
      border: none;
      color: var(--t2);
      font-family: inherit; font-size: 15px; font-weight: 600;
      cursor: pointer;
      text-decoration: underline;
      text-decoration-color: var(--t3);
      text-underline-offset: 3px;
      transition: color 0.15s;
      -webkit-tap-highlight-color: transparent;
    }
    .cta-secondary:hover { color: var(--t1); }
    .cta-secondary:active { color: var(--t1); transform: scale(0.96); }

    /* Two-up rows — half-width secondary buttons (nav + quick actions).
       Icon ABOVE label, both centered — same fix as .type-pill: a horizontal
       icon+text group is geometrically centered but reads off-center (the
       emoji box shoves the label sideways); column stacking puts both glyph
       and text on one centered axis. */
    .two-up { display: flex; gap: 10px; }
    .btn-half {
      flex: 1; min-width: 0; min-height: 58px;
      padding: 9px 8px 10px;
      background: var(--s1);
      border: 1px solid var(--border);
      border-radius: var(--r);
      color: var(--t1);
      font-family: inherit; font-size: 14px; font-weight: 600;
      cursor: pointer;
      display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
      white-space: nowrap; text-align: center;
      transition: background 0.15s, border-color 0.15s, transform 0.1s;
      -webkit-tap-highlight-color: transparent;
    }
    .btn-half:active {
      transform: scale(0.97);
      border-color: var(--bh, var(--border));
      box-shadow: 0 0 0 1px var(--bh), 0 0 18px var(--bh-glow);
    }
    .bh-ic { font-size: 18px; line-height: 1; flex: 0 0 auto; }
    /* "Not feeling it?" battery glyph is a short/wide shape — render it larger than
       the bolt so it reads as noticeable. transform:scale (not width/height) keeps its
       22px layout box, so the buttons don't grow — zero layout change. Scoped to this
       one icon; bolt unchanged. 28/22 ≈ 1.27 → ~28px visual. */
    .bh-ic[data-icon="battery-low"] svg { transform: scale(1.27); transform-origin: center; }

    /* Secondary full-width entry (Log a session) */
    .cta-alt {
      width: 100%; padding: 17px;
      background: var(--s1); color: var(--t1);
      font-family: inherit; font-size: 16px; font-weight: 700;
      border: 1.5px solid var(--border); border-radius: var(--rlg);
      cursor: pointer;
      display: flex; align-items: center; justify-content: center; gap: 8px;
      transition: transform 0.15s, border-color 0.15s;
    }
    .cta-alt:active { transform: scale(0.98); }

    .energy-step {
      background: var(--s2);
      border: 1px solid var(--border);
      border-radius: var(--rsm);
      padding: 14px 16px;
      margin-bottom: 10px;
      display: grid;
      grid-template-columns: 36px 1fr auto;
      gap: 12px;
      align-items: flex-start;
    }
    .energy-icon { font-size: 24px; line-height: 1; }
    .energy-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
    .energy-desc  { font-size: 12px; color: var(--t2); line-height: 1.45; }
    .energy-dur {
      font-size: 10px; font-weight: 700;
      color: var(--accent-light);
      background: var(--accent-dim);
      padding: 4px 8px; border-radius: 8px;
      white-space: nowrap;
      align-self: center;
    }

    /* ══════════════════════════════════════
       SELECT
    ══════════════════════════════════════ */
    .type-section { padding: 0 20px; margin-bottom: 24px; }
    /* Top-level mode selector (Strength / Recovery / Skill) — int-card-style cards */
    .mode-cards { display: flex; flex-direction: column; gap: 10px; }
    .mode-card {
      background: var(--s1);
      border: 2px solid var(--border);
      border-radius: var(--r);
      padding: 16px 18px;
      cursor: pointer;
      display: flex; align-items: center; gap: 14px;
      font-family: inherit; color: var(--t1); text-align: left;
      transition: border-color 0.2s, background 0.2s, transform 0.1s;
      -webkit-tap-highlight-color: transparent;
    }
    .mode-card:active { transform: scale(0.98); }
    .mode-tx  { flex: 1; min-width: 0; }
    .mode-nm  { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
    .mode-sub { font-size: 13px; color: var(--t2); }
    .mode-card.selected { border-color: var(--accent); background: var(--s2); }
    .int-card > svg, .mode-card > svg { flex-shrink: 0; }
    .type-pills { display: flex; gap: 10px; }
    .type-pill {
      flex: 1; min-width: 0;
      background: var(--s1);
      border: 2px solid var(--border);
      border-radius: var(--r);
      padding: 16px 12px;
      cursor: pointer; text-align: center;
      font-family: inherit; color: var(--t1);
      display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
      transition: all 0.2s;
      -webkit-tap-highlight-color: transparent;
    }
    .type-pill:active { transform: scale(0.96); }
    .type-pill .type-icon { font-size: 26px; flex-shrink: 0; line-height: 1; }
    .type-pill .type-info { min-width: 0; }
    .type-pill .type-name { font-size: 15px; font-weight: 700; }
    .type-pill .type-desc { font-size: 11px; color: var(--t2); margin-top: 2px; line-height: 1.3; }

    .intensity-grid {
      display: flex; flex-direction: column;
      padding: 0 20px; margin-bottom: 28px;
    }
    .int-card {
      background: var(--s1);
      border: 2px solid var(--border);
      border-radius: var(--r);
      padding: 18px 18px;
      margin-bottom: 10px;
      overflow: hidden; max-height: 80px;
      cursor: pointer;
      display: flex; align-items: center; gap: 14px;
      transition: border-color 0.2s, background 0.2s, transform 0.1s,
                  opacity 0.34s cubic-bezier(0.4,0,0.2,1),
                  max-height 0.34s cubic-bezier(0.4,0,0.2,1),
                  margin 0.34s cubic-bezier(0.4,0,0.2,1),
                  padding 0.34s cubic-bezier(0.4,0,0.2,1),
                  border-width 0.34s cubic-bezier(0.4,0,0.2,1);
      -webkit-tap-highlight-color: transparent;
    }
    .intensity-grid > .int-card:last-child { margin-bottom: 0; }
    .int-card:active { transform: scale(0.98); }
    .int-text { flex: 1; min-width: 0; }
    .int-name { font-size: 17px; font-weight: 700; margin-bottom: 2px; }
    .int-check {
      width: 26px; height: 26px; border-radius: 50%;
      border: 2px solid var(--border);
      display: flex; align-items: center; justify-content: center;
      flex-shrink: 0;
      transition: all 0.2s;
    }
    .int-check svg { display: none; }
    .int-card.selected .int-check svg { display: block; }

    .muscle-section { padding: 0 20px; margin-bottom: 24px; }
    #step-skill .muscle-section { margin-bottom: 18px; }   /* tighter gap below the skill-picker hint */
    .muscle-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 8px;
    }
    .muscle-chip {
      padding: 12px 6px;
      background: var(--s1);
      border: 1.5px solid var(--border);
      border-radius: var(--rsm);
      color: var(--t2);
      font-family: inherit; font-size: 13px; font-weight: 600;
      cursor: pointer; text-align: center;
      transition: all 0.2s;
      -webkit-tap-highlight-color: transparent;
    }
    .muscle-chip:active { transform: scale(0.96); }
    .muscle-chip.selected {
      border-color: var(--accent);
      color: var(--accent-light);
      background: var(--accent-dim);
    }
    .muscle-chip.shake {
      animation: shakeX 0.4s ease;
    }
    @keyframes shakeX {
      0%,100% { transform: translateX(0); }
      20% { transform: translateX(-6px); }
      40% { transform: translateX(6px); }
      60% { transform: translateX(-4px); }
      80% { transform: translateX(4px); }
    }
    /* Collapsible focus sections (Skill Focus, 2026-07-25). New classes only —
       .muscle-section is SHARED (4× in index.html) and stays untouched. */
    .fsec { margin: 0 0 24px; }
    .fsec-hd { display: flex; align-items: center; gap: 8px; padding: 10px 0; cursor: pointer;
               -webkit-tap-highlight-color: transparent; }
    .fsec-hd:active { color: var(--accent-light); }
    .fsec-sum { color: var(--t3); font-weight: 600; text-transform: none; letter-spacing: 0; }
    .fsec-chev { color: var(--t3); display: inline-flex; margin-left: auto; transition: transform .3s ease; }
    .fsec-chev svg { display: block; }
    .fsec.open .fsec-chev { transform: rotate(180deg); }
    .fsec-wrap { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .32s cubic-bezier(.4,0,.2,1); }
    .fsec.open .fsec-wrap { grid-template-rows: 1fr; }
    /* the inline pair gives the over-cap shake room so overflow:hidden can't clip it */
    .fsec-inner { overflow: hidden; min-height: 0; margin-inline: -8px; padding-inline: 8px;
                  opacity: 0; transition: opacity .18s ease; }
    .fsec.open .fsec-inner { opacity: 1; transition: opacity .24s ease .08s; }
    /* the new skill chips reuse .ppl-chip, which has NO shake rule — add one */
    .ppl-chip.shake { animation: shakeX 0.4s ease; }
    @media (prefers-reduced-motion: reduce) { .fsec-wrap, .fsec-chev, .fsec-inner { transition: none; }
      .ppl-chip.shake { animation: none; } }
    /* the skill section carries .fsec alone (not .muscle-section) — own inset */
    #skillfocus-section { padding: 0 20px; }
    /* skill-focus chips carry "Label · Exercise" — 2 columns for readable text */
    #skillfocus-grid { grid-template-columns: repeat(2, 1fr); }
    .ppl-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 4px; }
    /* Training Day pickers (main + custom builder): 6 days as 2 rows of 3 */
    #ppl-grid, #builder-ppl-grid { grid-template-columns: repeat(3, 1fr); }
    .ppl-chip {
      padding: 10px 6px;
      border: 1.5px solid var(--border);
      border-radius: var(--rsm);
      background: var(--s1);
      color: var(--t2);
      font-family: inherit;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: border-color 0.15s, background 0.15s, color 0.15s;
      text-align: center;
    }
    .ppl-chip.selected {
      border-color: var(--accent);
      background: var(--s2);
      color: var(--accent-light);
    }
    #log-mode-row .ppl-chip[data-mode="injury"].selected,
    #injury-movements-row .ppl-chip.selected {
      border-color: var(--red); background: var(--red-dim); color: var(--red);
    }
    #log-mode-row .ppl-chip[data-mode="activity"].selected {
      border-color: var(--green); background: var(--green-dim); color: var(--green);
    }
    /* Activity-TYPE chips (Private Session, Yoga, …) light up green only when selected,
       same logic as the injury chips go red. Icon is currentColor so it follows. */
    #activity-chips .ppl-chip.selected {
      border-color: var(--green); background: var(--green-dim); color: var(--green);
    }
    /* Skill-picker chip: outline figure ABOVE label, both centered — same
       fix as .type-pill/.btn-half (keeping the icon beside the label inflates
       the chip's min-content and overflows the 4-col grid). */
    .skill-chip-in { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
    /* Activity-log chip: outline icon beside the label (label may wrap to 2 lines) */
    .act-chip-in { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
    /* Batch 3c: align inline UI-chrome icons with their text. The music-pill slot
       also needs color:inherit — .music-mode-pill span forces accent-light. */
    .mm-pill-ic, .mm-title-ic, .logmode-act-ic, .logmode-inj-ic,
    .setlog-check, .holdstop-check { display: inline-flex; align-items: center; vertical-align: middle; }
    .music-mode-pill .mm-pill-ic { color: inherit; }
    .ex-inter-rest svg, .ex-suggestion-icon svg, .ex-cue-icon svg, .skill-presc svg, #done-save-btn svg { vertical-align: middle; }
    /* Batch 3d: align inline icons in labels/hints/buttons + center the energy-step glyph */
    .warmup-label svg, .warmup-timer-btn svg, .sets-hint svg, .btn-primary svg { vertical-align: -2px; }
    /* Inline icons that must sit centered on the FIRST text line (cue bulb,
       overload target/suggestion, ramp barbell, rest clock). */
    .inline-ic, .ex-cue-icon, .ex-suggestion-icon { display: inline-flex; align-items: center; vertical-align: middle; position: relative; top: -2px; }
    .inline-ic svg, .ex-cue-icon svg, .ex-suggestion-icon svg { display: block; }
    .energy-icon { display: flex; align-items: center; }

    .dur-section { padding: 0 20px; margin-bottom: 28px; }
    .dur-pills { display: flex; gap: 10px; }
    .dur-pill {
      flex: 1;
      padding: 14px 8px;
      background: var(--s1);
      color: var(--t1);   /* explicit default: Blink (Chrome/Android) doesn't inherit color into a native <button>, so unselected .dur-num fell back to UA black */
      border: 2px solid var(--border);
      border-radius: var(--rsm);
      cursor: pointer; text-align: center;
      transition: all 0.2s;
      -webkit-tap-highlight-color: transparent;
    }
    .dur-pill:active { transform: scale(0.94); }
    /* Skeleton pills — hold the section layout while the engine probe runs
       (same flex:1 box as a real pill; text transparent, dim pulsing shell). */
    .dur-pill.skeleton { pointer-events: none; animation: durSkeleton 1.2s ease-in-out infinite; }
    .dur-pill.skeleton .dur-num, .dur-pill.skeleton .dur-lbl { color: transparent; }
    @keyframes durSkeleton { 0%, 100% { opacity: 0.45; } 50% { opacity: 0.85; } }
    @media (prefers-reduced-motion: reduce) { .dur-pill.skeleton { animation: none; opacity: 0.45; } }
    .dur-num { font-size: 24px; font-weight: 800; display: block; letter-spacing: -1px; }
    .dur-lbl { font-size: 11px; color: var(--t2); font-weight: 600; }
    .band-dot { display:inline-block; width:8px; height:8px; border-radius:50%; vertical-align:middle; margin-right:5px; flex-shrink:0; }

    .select-cta { padding: 0 20px; }
    /* ── Select-screen step wizard (Phase 1a): Mode → Type → Build ──
       Normal-flow model: exactly one .wiz-step is display:block at a time, Generate
       flows below it, and the screen scrolls at the viewport like every other screen
       (an absolute overlay never gets a bounded height here, so panels can't clip). */
    #wiz-stack { position: relative; }
    .wiz-step { display: none; }
    .wiz-step.active { display: block; }
    @keyframes wizInUp   { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
    @keyframes wizInLeft { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: none; } }
    .wiz-step.wiz-anim-up   { animation: wizInUp 0.40s cubic-bezier(0.22, 1, 0.36, 1); }
    .wiz-step.wiz-anim-left { animation: wizInLeft 0.38s cubic-bezier(0.22, 1, 0.36, 1); }
    @keyframes wizReveal { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
    .wiz-reveal { animation: wizReveal 0.34s cubic-bezier(0.22, 1, 0.36, 1); }
    @media (prefers-reduced-motion: reduce) { .wiz-step.wiz-anim-up, .wiz-step.wiz-anim-left, .wiz-reveal { animation: none; } .int-card { transition: none; } }
    /* Build step: once an intensity is picked, collapse to just the chosen card
       (fade + fold the others away smoothly; the spacing collapses with them). */
    #intensity-grid.int-collapsed .int-card:not(.selected) {
      opacity: 0; max-height: 0;
      margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0;
      border-top-width: 0; border-bottom-width: 0;
      pointer-events: none;
      transition-delay: 0.05s;   /* lets the chosen card light up first, THEN the others fold away */
    }
    /* Persistent footer: give Generate breathing room when it appears (hidden → no
       space, so the mode/type steps have no dead band above the bottom edge). */
    #generate-btn:not(.hidden) { margin-top: 14px; }
    /* P3: server round-trip busy state — dim + lock the button while app-api builds */
    .gen-busy { opacity: 0.55; pointer-events: none; }
    #wiz-crumb { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
    .wiz-crumb-pill {
      font-size: 11px; font-weight: 700;
      color: var(--accent-light); background: var(--accent-dim);
      padding: 4px 9px; border-radius: 999px; white-space: nowrap;
      border: none; cursor: pointer; font-family: inherit;
    }
    .wiz-crumb-pill:active { transform: scale(0.96); }
    .wiz-crumb-sep { color: var(--t3); font-size: 11px; font-weight: 700; }

    /* ══════════════════════════════════════
       WORKOUT
    ══════════════════════════════════════ */
    .wk-hd {
      padding: var(--screen-top) 20px 14px;
      display: flex; align-items: center; gap: 10px;
    }
    .wk-badges { display: flex; gap: 8px; flex: 1; }
    .wk-badge { padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
    .wk-badge svg { display: block; margin-left: -4px; }   /* glyphs have empty padding inside their 0 0 24 24 viewBox, so the icon's internal left-whitespace shoves the icon+label group ~2px right of the pill center; -4px cancels it and optically centers all 3 (light/medium/hard) sub-pixel. Scoped to icon-bearing badges only — the text-only dur/ppl badges have no svg, so they stay centered. */
    .wk-progress { font-size: 13px; color: var(--t2); font-weight: 600; white-space: nowrap; }

    .prog-bar-wrap {
      height: 3px; background: var(--border);
      margin: 0 20px 20px; border-radius: 3px; overflow: hidden;
    }
    .prog-bar-fill {
      height: 100%; background: var(--accent);
      border-radius: 3px; transition: width 0.4s ease; width: 0%;
    }

    .ex-list {
      padding: 0 20px;
      display: flex; flex-direction: column; gap: 12px;
      margin-bottom: 24px;
    }
    .ex-card {
      background: var(--s1); border: 1px solid var(--border);
      border-radius: var(--r); padding: 18px;
      transition: border-color 0.3s, opacity 0.3s;
    }
    .ex-card.all-done {
      border-color: rgba(74,222,128,0.4);
      opacity: 0.65;
    }
    .ex-card.warmup {
      border-color: rgba(212,176,106,0.45);
      background: rgba(212,176,106,0.05);
    }
    .ex-card.warmup .ex-part {
      background: rgba(212,176,106,0.18);
      color: #d4b06a;
      text-transform: none;   /* show "35s" not "35S" — the S reads like a 5 */
    }
    .warmup-label {
      font-size: 10px; font-weight: 800;
      letter-spacing: 1.4px; text-transform: uppercase;
      color: #d4b06a;
      margin-bottom: 8px;
    }
    .warmup-timer-btn {
      width: 100%; padding: 14px;
      background: rgba(212,176,106,0.12);
      border: 1.5px solid rgba(212,176,106,0.35);
      color: #d4b06a;
      font-family: inherit; font-size: 15px; font-weight: 700;
      border-radius: var(--rsm);
      cursor: pointer;
      transition: all 0.2s;
      -webkit-tap-highlight-color: transparent;
    }
    .warmup-timer-btn:active { transform: scale(0.97); }
    .warmup-timer-btn.running {
      background: rgba(212,176,106,0.2);
      border-color: #d4b06a;
    }
    .warmup-timer-btn.done {
      background: var(--green-dim);
      border-color: var(--green);
      color: var(--green);
    }
    .ex-hd {
      display: flex; justify-content: space-between;
      align-items: flex-start; margin-bottom: 14px;
    }
    .ex-name { font-size: 16px; font-weight: 700; flex: 1; margin-right: 10px; }
    .swap-btn {
      background: none; border: none;
      color: var(--t3); cursor: pointer;
      font-family: inherit; font-size: 11px; font-weight: 600;
      padding: 0; margin-top: 4px;
      text-decoration: underline;
      text-decoration-color: var(--t3);
      text-underline-offset: 2px;
      transition: color 0.15s;
      -webkit-tap-highlight-color: transparent;
    }
    .swap-btn:hover { color: var(--accent-light); }
    .swap-btn:active { color: var(--accent-light); transform: scale(0.96); }
    .alt-card {
      background: var(--s2); border: 1px solid var(--border);
      border-radius: var(--rsm); padding: 14px 16px;
      margin-bottom: 8px; text-align: left;
      display: flex; align-items: center; gap: 12px;
    }
    .alt-name { flex: 1; font-size: 14px; font-weight: 600; }
    .alt-use {
      background: var(--accent); color: white;
      border: none; padding: 8px 14px; border-radius: 8px;
      font-family: inherit; font-size: 12px; font-weight: 700;
      cursor: pointer; white-space: nowrap;
    }
    .alt-use:active { transform: scale(0.96); }
    /* Swap-list "Use this" — same tinted-CTA recipe as .btn-primary. Scoped to a
       modifier because bare .alt-use is also worn by the two injury chips, which
       override the fill inline and must not inherit the accent rim.
       7/13px + 1px rim = the base chip's 8/14px box; 1px rather than the button's
       1.6px, which overpowers a 12px chip. */
    .alt-use-primary {
      background: linear-gradient(0deg,
                    color-mix(in srgb, var(--accent) 16%, transparent),
                    color-mix(in srgb, var(--accent) 16%, transparent)), var(--s2);
      border: 1px solid color-mix(in srgb, var(--accent-light) 79%, transparent);
      padding: 7px 13px;
    }
    /* Pinned "back to original" row — visually distinct from .alt-card; NOT an
       .alt-card, so the "I have" equipment filter never hides it. */
    .alt-original {
      background: var(--accent-dim); border: 1px solid var(--accent);
      border-radius: var(--rsm); padding: 14px 16px;
      margin-bottom: 8px; text-align: left;
      display: flex; align-items: center; gap: 12px;
    }
    .alt-orig-eyebrow {
      display: block; font-size: 10px; text-transform: uppercase;
      letter-spacing: 0.5px; color: var(--accent-light); font-weight: 700; margin-bottom: 2px;
    }
    .alt-orig-equip { font-size: 11px; color: var(--t3); margin-left: 6px; font-weight: 400; }
    .alt-restore {
      background: var(--s2); color: var(--accent-light);
      border: 1px solid var(--accent); padding: 8px 14px; border-radius: 8px;
      font-family: inherit; font-size: 12px; font-weight: 700;
      cursor: pointer; white-space: nowrap;
    }
    .alt-restore:active { transform: scale(0.96); }
    .alt-eqfilter { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
    .alt-eqfilter label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--t3); }
    .alt-eqfilter select { flex: 1; padding: 8px 10px; background: var(--s2); border: 1px solid var(--border); border-radius: 8px; color: var(--t1); font-size: 14px; font-family: inherit; }
    .alt-eqfilter select:focus { outline: none; border-color: var(--border-hi); }
    .ex-part {
      font-size: 10px; font-weight: 700;
      text-transform: uppercase; letter-spacing: 0.8px;
      color: var(--t3); background: var(--s2);
      padding: 3px 8px; border-radius: 6px; flex-shrink: 0;
    }
    .ex-stats { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
    .ex-stat { display: flex; flex-direction: column; align-items: center; }
    .ex-stat-v { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; }
    .ex-stat-l { font-size: 11px; color: var(--t2); font-weight: 500; }
    .ex-div { width: 1px; height: 30px; background: var(--border); }
    /* Per-exercise weighted toggle (last stat-strip slot) + earned "weighted" tag */
    .ex-wtoggle { margin-left: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
    .ex-wtoggle .ex-sw { width: 42px; height: 24px; border-radius: 999px; background: var(--s2); border: 1px solid var(--border-hi); position: relative; transition: background .18s, border-color .18s; flex: 0 0 auto; }
    .ex-wtoggle .ex-sw-knob { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--t3); transition: transform .18s, background .18s; }
    .ex-wtoggle.on .ex-sw { background: var(--accent); border-color: var(--accent-light); }
    .ex-wtoggle.on .ex-sw-knob { transform: translateX(18px); background: #fff; }
    .ex-wtoggle .ex-stat-l { color: var(--t3); }
    .ex-wtoggle.on .ex-stat-l { color: var(--accent-light); }

    .sets-row { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
    .sets-lbl { font-size: 12px; color: var(--t3); margin-right: 2px; padding-top: 12px; }
    .set-cell { display: flex; flex-direction: column; align-items: center; gap: 6px; }
    .set-reps {
      width: 44px; padding: 6px 2px;
      background: var(--s2);
      border: 1.5px solid var(--border);
      border-radius: 8px;
      color: var(--t1);
      font-family: inherit; font-size: 13px; font-weight: 700;
      text-align: center; outline: none;
      -moz-appearance: textfield;
      transition: border-color 0.15s, opacity 0.15s;
    }
    .set-reps::-webkit-outer-spin-button,
    .set-reps::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
    .set-reps:focus { border-color: var(--accent); }
    .set-reps:disabled { opacity: 0.3; cursor: default; }
    .set-field { display: flex; flex-direction: column; align-items: center; gap: 3px; }
    .set-field-lbl {
      font-size: 9px; font-weight: 700;
      text-transform: uppercase; letter-spacing: 0.4px;
      color: var(--t3);
    }
    .set-weight {
      width: 44px; padding: 6px 2px;
      background: var(--s2);
      border: 1.5px solid var(--border);
      border-radius: 8px;
      color: var(--t1);
      font-family: inherit; font-size: 13px; font-weight: 700;
      text-align: center; outline: none;
      -moz-appearance: textfield;
      transition: border-color 0.15s, opacity 0.15s;
    }
    .set-weight::-webkit-outer-spin-button,
    .set-weight::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
    .set-weight:focus { border-color: var(--accent); }
    .set-weight:disabled { opacity: 0.3; cursor: default; }
    .sets-hint { font-size: 11px; color: var(--t3); margin-top: 10px; }
    .set-btn {
      width: 40px; height: 40px; border-radius: 12px;
      border: 2px solid var(--border);
      background: transparent;
      font-family: inherit; font-size: 12px; font-weight: 700;
      color: var(--t3); cursor: pointer;
      display: flex; align-items: center; justify-content: center;
      transition: all 0.18s;
      -webkit-tap-highlight-color: transparent;
    }
    .set-btn:active { transform: scale(0.85); }
    .set-btn:disabled { cursor: default; }
    /* NEXT set to log — lit / glowing border */
    .set-btn.active {
      border-color: var(--accent);
      color: var(--accent-light);
      box-shadow: 0 0 0 1px rgba(62,87,165,0.30), 0 0 9px rgba(138,160,224,0.30);
    }
    /* WAITING sets — dimmed (and disabled in markup → can't log out of order) */
    .set-btn.locked { opacity: 0.35; }
    .set-btn.done {
      background: var(--green-dim);
      border-color: var(--green);
      color: var(--green);
      opacity: 1;
    }

    .wk-cta { padding: 0 20px; }

    /* ── Set-logging dialog (steppers) ── */
    .setlog-row { display: flex; flex-direction: column; gap: 14px; align-items: center; }
    .setlog-field { width: 100%; max-width: 230px; }
    .setlog-lbl {
      font-size: 11px; font-weight: 700;
      text-transform: uppercase; letter-spacing: 0.8px;
      color: var(--t3); margin-bottom: 8px; text-align: center;
    }
    .stepper { display: flex; align-items: stretch; gap: 6px; }
    .stepper-btn {
      width: 44px; min-height: 50px; border-radius: var(--rsm);
      background: var(--s2); border: 1px solid var(--border);
      color: var(--t1); font-family: inherit; font-size: 22px; font-weight: 600;
      cursor: pointer; flex-shrink: 0; line-height: 1;
      -webkit-tap-highlight-color: transparent;
      transition: background 0.1s, transform 0.1s;
    }
    .stepper-btn:active { background: var(--border); transform: scale(0.94); }
    .stepper-val {
      flex: 1; min-width: 0; width: 100%; min-height: 50px;
      text-align: center; font-family: inherit; font-size: 20px; font-weight: 800;
      background: var(--bg); border: 1.5px solid var(--border); border-radius: var(--rsm);
      color: var(--t1); outline: none;
      -moz-appearance: textfield;
    }
    .stepper-val::-webkit-outer-spin-button,
    .stepper-val::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
    .stepper-val:focus { border-color: var(--accent); }

    /* ══════════════════════════════════════
       COMPLETE
    ══════════════════════════════════════ */
    .done-wrap {
      min-height: 100vh;
      min-height: calc(100dvh - var(--screen-bottom));
      display: flex; flex-direction: column;
      align-items: center; justify-content: flex-start;   /* top-align like the home screen — was `center`, which centered the tall stack → dead space top+bottom and the bottom buttons clipped on short phones */
      padding: var(--screen-top) 20px 0; text-align: center;
    }
    .done-icon {
      /* The glyph is a sized 40px SVG (icon(...,{size:40})). flex sizes the box to
         the glyph instead of the old vestigial `font-size:72px` ~96px line box,
         which left ~56px of empty halo around the 40px glyph. */
      display: flex; align-items: center; justify-content: center;
      margin-bottom: 14px;
      animation: pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
    @keyframes pop {
      from { transform: scale(0); opacity: 0; }
      to   { transform: scale(1); opacity: 1; }
    }
    .done-title { font-size: 30px; font-weight: 800; letter-spacing: -1px; margin-bottom: 8px; }
    .done-sub { font-size: 15px; color: var(--t2); margin-bottom: 16px; }
    .done-stats { display: flex; gap: 10px; width: 100%; margin-bottom: 16px; }
    .done-stat {
      flex: 1; background: var(--s1); border: 1px solid var(--border);
      border-radius: var(--r); padding: 16px; text-align: center;
    }
    .done-stat-v { font-size: 26px; font-weight: 800; letter-spacing: -1px; display: block; }
    .done-stat-l { font-size: 11px; color: var(--t2); margin-top: 3px; font-weight: 600; }
    .done-btns { display: flex; flex-direction: column; gap: 10px; width: 100%; }

    /* ══════════════════════════════════════
       HISTORY
    ══════════════════════════════════════ */
    .hist-list { padding: 0 20px; display: flex; flex-direction: column; gap: 10px; }
    .hist-pager { display:flex; align-items:center; justify-content:center; gap:10px; padding:14px 20px 24px; }
    .hist-pg-btn { width:36px; height:36px; border:1px solid var(--border); background:var(--s1); color:var(--t1); border-radius:8px; font-size:18px; line-height:1; cursor:pointer; -webkit-tap-highlight-color:transparent; }
    .hist-pg-btn:active { background:var(--s2); border-color:rgba(138,160,224,0.55); box-shadow:0 0 8px rgba(138,160,224,0.2); transform:scale(0.94); }
    .hist-pg-btn:disabled { opacity:.35; cursor:default; }
    .hist-pg-sel { padding:8px 12px; background:var(--s1); border:1px solid var(--border); color:var(--t1); border-radius:8px; font-family:inherit; font-size:14px; color-scheme:dark; cursor:pointer; }
    .hist-item {
      background: var(--s1); border: 1px solid var(--border);
      border-radius: var(--r); padding: 16px 18px;
      display: flex; align-items: center; gap: 14px;
    }
    .hist-date { text-align: center; min-width: 34px; }
    .hist-day { font-size: 22px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
    .hist-mon { font-size: 10px; color: var(--t3); text-transform: uppercase; font-weight: 700; }
    .hist-div { width: 1px; height: 36px; background: var(--border); flex-shrink: 0; }
    .hist-info { flex: 1; }
    .hist-badges { display: flex; gap: 6px; margin-bottom: 5px; flex-wrap: wrap; }
    .hist-badge { padding: 3px 9px; border-radius: 12px; font-size: 12px; font-weight: 700; }
    .hist-meta { font-size: 12px; color: var(--t3); }
    .no-hist {
      padding: 60px 20px; text-align: center;
      color: var(--t2);
    }
    .no-hist-icon { font-size: 40px; margin-bottom: 14px; }
    .no-hist-h { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
    .no-hist-s { font-size: 14px; color: var(--t3); }

    /* ── Last 14 Days card header ── */
    .cons-hd {
      display: flex; align-items: center; justify-content: space-between;
      margin-bottom: 14px;
    }
    .cons-hd .card-lbl { margin-bottom: 0; }

    /* ── Session stats row + session list (Last 14 + History) ── */
    .sh-stats-wrap { padding: 0 20px; }
    .sh-stats {
      display: flex;
      background: var(--s1); border: 1px solid var(--border); border-radius: 12px;
      padding: 14px 0; margin-bottom: 16px;
    }
    .sh-stat {
      flex: 1 1 0; text-align: center;
      background: transparent; border: none; border-radius: 0;
      border-left: 1px solid var(--border);
      padding: 0 8px;
    }
    .sh-stat:first-child { border-left: none; }
    .sh-stat-val {
      font-size: 17px; font-weight: 800; color: var(--t1);
      line-height: 1.1; font-variant-numeric: tabular-nums;
    }
    .sh-stat-lbl {
      font-size: 9px; color: var(--t3); margin-top: 3px; line-height: 1.2;
      text-transform: uppercase; letter-spacing: 0.2px;
      /* keep EVERY label on one line (incl. "Avg complete") so all four sit at
         the same height — slightly smaller + nowrap fits the 4-up pill width */
      white-space: nowrap;
    }
    .sh-item {
      background: var(--s1); border: 1px solid var(--border);
      border-radius: var(--r); padding: 14px 16px;
    }
    .sh-date {
      font-size: 11px; color: var(--t3); font-weight: 700;
      text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px;
    }
    .sh-main { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
    .sh-badge { font-size: 11px; padding: 3px 9px; border-radius: 12px; font-weight: 700; }
    .sh-type { background: var(--s2); color: var(--accent-light); border: 1px solid var(--border); display: inline-flex; align-items: center; gap: 4px; }
    .sh-ppl { background: var(--s1); color: var(--t2); border: 1px solid var(--border); }
    .sh-int { font-size: 11px; color: var(--t3); font-weight: 600; }
    .sh-dot { font-size: 11px; color: var(--t3); }
    .sh-dur { font-size: 11px; color: var(--t3); }
    .sh-pct { font-size: 11px; color: var(--t2); font-weight: 700; margin-left: auto; font-variant-numeric: tabular-nums; }
    .sh-sub { font-size: 12px; color: var(--t3); margin-top: 6px; line-height: 1.4; }

    /* ── Saved Workouts ── */
    .saved-list { padding: 0 20px; display: flex; flex-direction: column; gap: 10px; }
    .saved-item {
      background: var(--s1); border: 1px solid var(--border);
      border-radius: var(--r); padding: 14px 16px;
      display: flex; align-items: center; gap: 12px;
    }
    .saved-item-main {
      flex: 1; min-width: 0; cursor: pointer;
      -webkit-tap-highlight-color: transparent;
    }
    .saved-item-main:active { opacity: 0.7; }
    .saved-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
    .saved-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
    .saved-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 12px; font-size: 11px; font-weight: 700; }
    .saved-meta { font-size: 12px; color: var(--t3); }
    /* Custom-card type chip: icon + label never split; icon rides the text line
       (inline-block + vertical-align, no flex baseline problem). Custom cards only —
       the shared .saved-meta rule and the .saved-badge cards stay untouched. */
    .saved-meta .cw-type { white-space: nowrap; }
    .saved-meta .cw-type svg { display: inline-block; vertical-align: middle; margin-right: 4px; }
    .saved-del {
      width: 38px; height: 38px;
      background: transparent;
      border: 1px solid var(--border);
      border-radius: 10px;
      color: var(--t3); cursor: pointer;
      font-size: 16px; flex-shrink: 0;
      display: flex; align-items: center; justify-content: center;
      transition: all 0.15s;
      -webkit-tap-highlight-color: transparent;
    }
    .saved-del:hover { color: #f87171; border-color: rgba(248,113,113,0.4); }
    .saved-del:active { color: var(--red); border-color: rgba(248,113,113,0.4); background: var(--red-dim); transform: scale(0.94); }
    /* Builder drag-to-reorder — grip-only pointer drag. touch-action:none lives ONLY
       on the handle so vertical page scroll survives everywhere else on the row. */
    #builder-list .builder-grip {
      flex-shrink: 0; align-self: stretch;
      display: flex; align-items: center;
      margin: -14px 0 -14px -8px; padding: 0 8px;   /* bleed into the row padding → full-height tap target */
      color: var(--t3); cursor: grab;
      touch-action: none; user-select: none; -webkit-user-select: none;
      -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
    }
    #builder-list .saved-item.dragging {
      opacity: 0.88; border-color: var(--accent-light);
      box-shadow: 0 8px 20px rgba(0,0,0,0.45);
      position: relative; z-index: 2;
    }
    #builder-list .saved-item.dragging .builder-grip { cursor: grabbing; }

    /* ── Coaching cue ── */
    .ex-cue {
      font-size: 12px;
      color: var(--accent-light);
      line-height: 1.45;
      padding: 9px 12px;
      background: var(--accent-dim);
      border-radius: 10px;
      margin-bottom: 14px;
      border-left: 2px solid var(--accent);
    }
    .ex-cue-icon {
      font-style: normal;
      opacity: 0.75;
      margin-right: 4px;
    }
    /* ── Coaching-cue bulb (tappable) + cue modal ── */
    .ex-name-row{display:flex;align-items:flex-start;gap:5px}
    .ex-name-row .ex-name{flex:0 1 auto;min-width:0}
    .ex-name-row .cue-btn{top:-5px}
    .cue-btn{flex:0 0 auto;width:26px;height:26px;border:none;background:none;position:relative;top:-1.5px;left:-2px;color:var(--amber);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;padding:0;-webkit-tap-highlight-color:transparent}
    .cue-btn svg{display:block;transition:filter .15s}
    .cue-btn:hover svg{filter:drop-shadow(0 0 3px rgba(251,191,36,.55))}
    .cue-btn:active{transform:scale(.9)}
    .cue-btn:active svg{filter:drop-shadow(0 0 4px rgba(251,191,36,.95)) drop-shadow(0 0 8px rgba(251,191,36,.5))}
    .cue-btn.pulsing svg{animation:cueGlow 2.1s ease-out infinite}
    @keyframes cueGlow{0%{filter:drop-shadow(0 0 0 rgba(251,191,36,0))}50%{filter:drop-shadow(0 0 4px rgba(251,191,36,.95)) drop-shadow(0 0 8px rgba(251,191,36,.5))}100%{filter:drop-shadow(0 0 0 rgba(251,191,36,0))}}
    .cp-ic.pulsing svg{animation:coachGlow 2.1s ease-out infinite}
    @keyframes coachGlow{0%{filter:drop-shadow(0 0 0 rgba(255,255,255,0))}50%{filter:drop-shadow(0 0 4px rgba(255,255,255,.9)) drop-shadow(0 0 8px rgba(255,255,255,.45))}100%{filter:drop-shadow(0 0 0 rgba(255,255,255,0))}}
    .cue-btn.seen{opacity:.55}
    @media (prefers-reduced-motion: reduce){ .cue-btn.pulsing svg{ animation:none } .cp-ic.pulsing svg{ animation:none } }
    .cue-card{max-width:320px;padding:20px 22px 24px;position:relative;text-align:left}
    .cue-x{position:absolute;top:12px;right:12px;width:34px;height:34px;border-radius:9px;border:none;background:none;color:var(--t3);display:flex;align-items:center;justify-content:center;cursor:pointer;-webkit-tap-highlight-color:transparent}
    .cue-x:hover{background:var(--s2);color:var(--t1)}
    .cue-x:active{background:var(--s2);color:var(--t1);transform:scale(.9)}
    .cue-eyebrow{font-size:11px;font-weight:700;letter-spacing:1px;text-transform:uppercase;color:var(--amber);margin:0 0 9px}
    .cue-name{font-family:var(--font-display);font-size:18px;font-weight:600;margin:0 0 11px;color:var(--t1)}
    .cue-text{font-size:17px;line-height:1.6;color:var(--t2);margin:0}
    .cue-search{display:flex;align-items:center;justify-content:center;gap:8px;margin-top:18px;padding:12px;border-radius:var(--rsm);border:1px solid var(--border);color:var(--accent-light);font-size:15px;font-weight:600;text-decoration:none;transition:background .2s,border-color .2s}
    /* --border-hi is defined in coach-deploy but NOT in app-deploy; the literal
       fallback keeps the pressed border grey (an unresolved var() would compute
       to currentColor = --accent-light and flash blue). */
    .cue-search:active{background:var(--s2);border-color:var(--border-hi,#36364f)}
    .cue-search svg{display:block}
    /* styled-[hidden] trap: .cue-search sets display:flex, which beats the UA [hidden] rule. */
    #modal-cue .cue-search[hidden]{display:none}
    /* ── Progressive-overload hint (last session → today's target) ── */
    .ex-suggestion {
      font-size: 12px;
      color: var(--green);
      line-height: 1.5;
      padding: 9px 12px;
      background: var(--green-dim);
      border-radius: 10px;
      margin-bottom: 14px;
      border-left: 2px solid var(--green);
    }
    .ex-suggestion b { font-weight: 800; color: var(--green); }
    .ex-suggestion-icon { font-style: normal; opacity: 0.8; margin-right: 5px; }
    .ex-suggestion-arrow { opacity: 0.5; margin: 0 5px; font-weight: 700; }
    /* ── Skill session ── */
    .skill-ctx {
      font-size: 12px;
      color: var(--t3);
      font-weight: 600;
      margin-top: 3px;
    }
    .skill-presc {
      font-size: 12px;
      color: var(--accent-light);
      font-weight: 700;
      margin-top: 2px;
    }
    .skill-note {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      padding: 12px 14px;
      background: var(--s2);
      border-left: 3px solid var(--accent);
      border-radius: 12px;
      margin-bottom: 16px;
    }
    .skill-note-ic { font-size: 18px; line-height: 1.2; }
    .skill-note-t { font-size: 13px; font-weight: 800; color: var(--t1); margin-bottom: 2px; }
    .skill-note-s { font-size: 12px; color: var(--t2); line-height: 1.45; }
    /* ── Inter-exercise rest ── */
    .ex-inter-rest {
      margin-top: 16px;
      padding: 10px 14px;
      background: var(--s2);
      border: 1px dashed var(--border);
      border-radius: 10px;
      font-size: 12px;
      color: var(--t2);
      text-align: center;
      letter-spacing: 0.2px;
    }

    /* ── Rest Timer Overlay ── */
    .rest-overlay {
      position: fixed; inset: 0;
      height: 100vh;   /* fallback */
      height: 100dvh;  /* tracks the toolbar — kills the bottom gap */
      background: var(--bg);
      display: none;
      flex-direction: column;
      align-items: center; justify-content: center;
      gap: 14px;
      z-index: 1000;
      padding: 24px;
    }
    /* DELIBERATE exception to the shared modal language: mid-set timers must
       feel snappy — ≤120ms plain fade in, instant close, no slide. */
    .rest-overlay.open { display: flex; animation: overlayFade 0.1s ease-out both; }
    @keyframes overlayFade { from { opacity: 0; } to { opacity: 1; } }
    .rest-label {
      font-size: 13px; font-weight: 700;
      color: var(--t3);
      text-transform: uppercase;
      letter-spacing: 3px;
    }
    .rest-count {
      font-size: clamp(96px, 28vw, 160px);
      font-weight: 800;
      color: var(--accent-light);
      font-variant-numeric: tabular-nums;
      line-height: 1;
      margin: 6px 0;
    }
    .rest-sub {
      font-size: 14px; color: var(--t3);
    }
    .rest-skip {
      margin-top: 28px;
      padding: 14px 40px;
      background: var(--s1);
      border: 1px solid var(--border);
      border-radius: var(--r);
      color: var(--t1);
      font-family: inherit;
      font-size: 15px; font-weight: 700;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
    }
    .rest-skip:active { background: var(--s2); }

    /* ── Auth / login overlay (Supabase Auth) ──
       Full-screen overlay shown when there's no session. Same brand lockup as
       the splash; the card holds login / signup / forgot / verify-email /
       set-new-password states + an inline error line. Built to the locked spec. */
    #auth-screen {
      position: fixed; inset: 0;
      background: var(--bg);
      background-image: radial-gradient(ellipse 70% 55% at 50% 38%, rgba(62,87,165,0.12) 0%, transparent 70%);
      z-index: 1900;   /* just under the splash (2000) */
      display: flex; flex-direction: column; align-items: center;
      padding: calc(env(safe-area-inset-top, 0px) + 34px) 26px 40px;
      overflow-y: auto;
    }
    #auth-screen[hidden] { display: none; }
    .auth-inner { width: 100%; max-width: 440px; display: flex; flex-direction: column; align-items: center; }
    .auth-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 24px; }
    .auth-mark { width: auto; height: 48px; display: block; }
    .auth-word { font-size: 33px; font-weight: 700; letter-spacing: 2px; color: var(--accent-light); line-height: 1; }
    .auth-sub { font-size: 15px; font-weight: 400; color: var(--t3); letter-spacing: 0.5px; line-height: 1; }
    .auth-card { width: 100%; background: var(--s1); border: 1px solid var(--border); border-radius: 18px; padding: 31px 20px; }
    .auth-seg { display: flex; background: var(--s2); border: 1px solid var(--border); border-radius: 11px; padding: 4px; margin: 0 -8px 20px; }
    .auth-seg button { flex: 1; border: none; background: none; color: var(--t3); font-family: inherit; font-size: 14px; font-weight: 700; padding: 9px; border-radius: 8px; cursor: pointer; transition: all 0.15s; }
    .auth-seg button.on {
      background: transparent;
      color: var(--accent-light);
      box-shadow: 0 0 0 1px rgba(138,160,224,0.6);
    }
    .auth-title { font-size: 19px; font-weight: 700; color: var(--t1); margin-bottom: 20px; text-align: center; }
    .auth-card label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--t3); margin: 0 0 6px; }
    .auth-field { margin-bottom: 20px; }
    .auth-card input { width: 100%; background: var(--s2); border: 1px solid var(--border); border-radius: 10px; padding: 10px; color: var(--t1); font-family: inherit; font-size: 15px; outline: none; transition: border-color 0.15s; }
    .auth-card input:focus { border-color: var(--accent-light); }
    .auth-card input::placeholder { color: var(--t3); }
    .pw-wrap { position: relative; }
    .pw-wrap input { padding-right: 42px; }
    .pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; padding: 4px; cursor: pointer; color: var(--t3); display: flex; align-items: center; -webkit-tap-highlight-color: transparent; }
    .pw-toggle:hover { color: var(--t1); }
    /* keep the base translateY centering or the icon jumps on press */
    .pw-toggle:active { color: var(--t1); transform: translateY(-50%) scale(0.9); }
    .pw-toggle svg { width: 20px; height: 20px; display: block; }
    /* SAME treatment as the "Start a workout" CTA: dark + accent glow */
    .auth-submit { width: 100%; margin-top: 6px; padding: 14px; border-radius: 15px; color: #fff; font-family: inherit; font-size: 19px; font-weight: 700; cursor: pointer;
      background: linear-gradient(0deg, rgba(62,87,165,0.16), rgba(62,87,165,0.16)), var(--s2);
      border: 1.6px solid rgba(138,160,224,0.79);
      box-shadow: 0 0 19px rgba(138,160,224,0.38), 0 0 8px rgba(138,160,224,0.48);
      transition: transform 0.15s; }
    .auth-submit:active { transform: scale(0.98); }
    .auth-submit:disabled { opacity: 0.6; cursor: default; }
    .auth-oauth { margin-top: 4px; }
    .auth-or { display: flex; align-items: center; gap: 10px; color: var(--t3); font-size: 12px; margin: 18px 0 14px; }
    .auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
    .auth-oauth-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--s2); border: 1px solid var(--border); border-radius: 10px; padding: 11px; color: var(--t1); font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer; margin-bottom: 10px; transition: border-color 0.15s, background 0.15s; -webkit-tap-highlight-color: transparent; }
    .auth-oauth-btn:hover { border-color: var(--accent-light); }
    .auth-oauth-btn:active { background: linear-gradient(0deg, rgba(138,160,224,0.08), rgba(138,160,224,0.08)), var(--s2); border-color: var(--accent-light); box-shadow: 0 0 10px rgba(138,160,224,0.22); transform: scale(0.98); }
    .auth-oauth-btn svg { width: 18px; height: 18px; flex: none; }
    .auth-row-end { display: flex; justify-content: flex-end; margin: -4px 0 12px; }
    .auth-back-row { display: flex; justify-content: center; margin: 14px 0 0; }
    .auth-link { background: none; border: none; color: var(--accent-light); font-family: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 0; -webkit-tap-highlight-color: transparent; }
    .auth-link:active { color: var(--t1); transform: scale(0.96); }
    .auth-hint { font-size: 12px; color: var(--t3); line-height: 1.5; margin: 13px 2px 0; text-align: center; }
    .auth-msg { font-size: 14px; color: var(--t2); line-height: 1.55; margin: 2px 2px 14px; text-align: center; }
    .auth-error { font-size: 13px; color: #f87171; line-height: 1.45; margin: 0 2px 14px; text-align: center; }
    #auth-screen [hidden] { display: none; }

    /* ── Splash / loading overlay ──
       The overlay itself is OPAQUE from the first frame and must carry NO
       opacity animation: an animated entry (a) lets the home skeleton flash
       through while it fades up, and (b) its fill-mode value keeps applying at
       animation priority afterwards, overriding the .hide transition — the
       fade-out silently never plays. Only the wordmark animates in. */
    #splash {
      position: fixed; inset: 0;
      background: var(--bg);
      background-image: radial-gradient(ellipse 70% 55% at 50% 50%, rgba(62,87,165,0.10) 0%, transparent 70%);
      display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
      z-index: 2000;
      transition: opacity 0.6s cubic-bezier(0.4,0,0.2,1);
    }
    #splash.hide { opacity: 0; pointer-events: none; }
    .splash-mark {
      /* viewBox is tight-cropped to the glyph, so the box == the visible mark.
         Height ≈ 1.69× the wordmark cap-height to mirror the og-image lockup. */
      width: auto; height: clamp(43px, 10.6vw, 71px);
      animation: splashMarkIn 0.6s cubic-bezier(0.22,1,0.36,1) both;
    }
    @keyframes splashMarkIn {
      from { opacity: 0; transform: translateY(8px) scale(0.94); }
      to   { opacity: 1; transform: translateY(0) scale(1); }
    }
    .splash-word {
      font-size: clamp(36px, 9vw, 60px); font-weight: 700;
      letter-spacing: 2px;
      color: var(--accent-light);
      animation: splashWordIn 0.6s cubic-bezier(0.22,1,0.36,1) 0.1s both;
    }
    .splash-sub {
      font-size: clamp(14px, 3.5vw, 18px); font-weight: 400;
      color: var(--t3);
      letter-spacing: 0.5px;
      animation: splashWordIn 0.6s cubic-bezier(0.22,1,0.36,1) 0.2s both;
    }
    @keyframes splashWordIn {
      from { opacity: 0; transform: translateY(10px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    /* ── Generate/prepare wait overlay — the splash's visual language, smaller.
       Shown by beginGenerating() only after a 300ms delay (a prefetched-instant
       tap never flashes it); fades in/out via .show. Separate from #splash —
       that one is boot-only and gets removed. ── */
    #gen-overlay {
      position: fixed; inset: 0; z-index: 3000;
      display: flex; align-items: center; justify-content: center;
      background: var(--bg);
      background-image: radial-gradient(ellipse 70% 55% at 50% 50%, rgba(62,87,165,0.10) 0%, transparent 70%);
      opacity: 0;
      transition: opacity 0.16s ease;
    }
    #gen-overlay[hidden] { display: none; }   /* carries an author display — styled-[hidden] guard */
    #gen-overlay.show { opacity: 1; }
    .gen-card { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 24px; text-align: center; }
    .gen-spinner {
      width: 34px; height: 34px; border-radius: 50%;
      border: 3px solid var(--s2); border-top-color: var(--accent-light);
      animation: genSpin 0.9s linear infinite;
    }
    @keyframes genSpin { to { transform: rotate(360deg); } }
    .gen-line { font-size: 15.5px; font-weight: 600; color: var(--t2); letter-spacing: 0.3px; }

    /* ── Reduced motion: collapse every animation/transition to ~0ms.
       animationend still fires, so .closing handlers resolve instantly. ── */
    /* Music mode — home pill + in-sheet switch */
    .music-mode-pill {
      display: block; width: calc(100% - 40px); box-sizing: border-box;
      margin: -4px 20px 14px; padding: 14px;   /* -4px: tighten the gap to the name (header padding-bottom is 20px → 16px visual) */
      background: transparent; border: 1px solid var(--border); border-radius: var(--r);
      color: var(--t3); font-family: inherit; font-size: 13px; font-weight: 600;
      cursor: pointer; -webkit-tap-highlight-color: transparent;
      transition: background 0.15s, border-color 0.15s;
    }
    .music-mode-pill:active { background: var(--s1); }
    .music-mode-pill span { color: var(--accent-light); }
    .music-mode-pill.mm-on {
      border-color: var(--accent);
      color: var(--t2);
    }
    .music-mode-pill.mm-on span { color: var(--accent-light); }
    .music-mode-pill.mm-off span { color: var(--t3); }
    .mm-sounds { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 4px; }
    .mm-sound-pill { flex: 1; min-width: 60px; padding: 8px 4px; border: 1px solid var(--border); border-radius: var(--r); background: transparent; color: var(--t2); font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-align: center; -webkit-tap-highlight-color: transparent; transition: border-color 0.15s, color 0.15s; }
    .mm-sound-pill.active { border-color: var(--accent); color: var(--accent-light); }
    .mm-sound-pill:active { background: var(--s1); }
    .mm-switch-row {
      display: flex; align-items: center; justify-content: space-between; gap: 14px;
      padding: 14px 16px; margin-bottom: 16px;
      background: var(--s1); border: 1px solid var(--border); border-radius: var(--r);
      font-size: 15px; font-weight: 700; color: var(--t1); cursor: pointer;
      -webkit-tap-highlight-color: transparent;
    }
    .mm-switch { width: 48px; height: 28px; border-radius: 14px; background: var(--s2);
      border: 1px solid var(--border); position: relative; flex: 0 0 auto; transition: background 0.2s, border-color 0.2s; }
    .mm-switch.on { background: var(--accent); border-color: var(--accent); }
    .mm-knob { position: absolute; top: 2px; left: 2px; width: 22px; height: 22px;
      border-radius: 50%; background: #fff; transition: left 0.2s; }
    .mm-switch.on .mm-knob { left: 22px; }
    .mm-explain { font-size: 13.5px; line-height: 1.55; color: var(--t2); }
    .mm-explain p { margin: 0 0 10px; }
    .mm-explain b { color: var(--t1); }
    .mm-note { font-size: 12.5px; line-height: 1.5; color: var(--t3);
      background: var(--s1); border-radius: var(--rsm); padding: 11px 13px; margin-top: 4px; }

    /* Timer-finish visual cue — full-screen pulse; fires regardless of audio
       (mute switch / mix mode), so there's always a signal. */
    #finish-flash { position: fixed; inset: 0; z-index: 9999; pointer-events: none; opacity: 0;
      background: radial-gradient(circle at center, var(--accent-light) 0%, var(--accent) 70%); }
    #finish-flash.flash { animation: finishFlash 0.9s ease-out; }
    @keyframes finishFlash {
      0% { opacity: 0; } 12% { opacity: 0.5; } 30% { opacity: 0; }
      45% { opacity: 0; } 57% { opacity: 0.5; } 80% { opacity: 0; } 100% { opacity: 0; }
    }

    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
      }
      .gen-spinner { animation: none; }   /* static ring under reduced motion */
    }

    /* Display font (Sora) — wordmark, screen/section headings, and big numbers only.
       Placed last so it overrides the `font-family: inherit` on the number inputs.
       Everything else stays on the Segoe body stack. */
    h1, h2, .modal-title, .ex-name,
    .rest-count, .done-stat-v, .ex-stat-v, .dur-num,
    .hist-day, .sh-stat-val, .stepper-val, .set-reps, .set-weight {
      font-family: var(--font-display);
    }
    /* ── App Settings screen ── */
    .set-list{display:flex;flex-direction:column;gap:10px;padding:0 20px 24px}
    .set-section{background:var(--s1);border:1px solid var(--border);border-radius:var(--r);padding:14px 16px}
    .set-lbl{font-size:12px;color:var(--t3);text-transform:uppercase;letter-spacing:.05em}
    .set-name-row{display:flex;gap:8px;margin-top:8px}
    .set-name-row input{flex:1;padding:12px 14px;background:var(--bg);border:1px solid var(--border);color:var(--t1);border-radius:var(--rsm);font-family:inherit;font-size:15px;outline:none}
    .set-reset{margin-top:10px;background:none;border:none;color:var(--t3);font-size:13px;cursor:pointer;padding:0;-webkit-tap-highlight-color:transparent}
    .set-reset:active{color:var(--accent-light);transform:scale(.96)}
    .set-row{display:flex;align-items:center;gap:10px;width:100%;text-align:left;background:var(--s1);border:1px solid var(--border);border-radius:var(--r);padding:15px 16px;color:var(--t1);font-family:inherit;font-size:15px;font-weight:600;cursor:pointer;-webkit-tap-highlight-color:transparent}
    /* bg brighten (not scale) is the press cue on this wide row; :not(.disabled)
       keeps the inert "Soon" row dark, and the red .set-danger variant (defined
       with the modal styles) outranks this via its extra class */
    .set-row:not(.disabled):active{background:var(--s2);border-color:rgba(138,160,224,0.45);box-shadow:0 0 10px rgba(138,160,224,0.18)}
    .set-row>span:first-child{flex:1}
    .set-row-v{color:var(--t3);font-weight:400;font-size:14px}
    .set-chev{color:var(--t3);font-size:18px;line-height:1}
    .set-row.disabled{opacity:.55;cursor:default}
    .set-soon{font-size:11px;color:var(--t3);border:1px solid var(--border);border-radius:10px;padding:2px 8px;font-weight:600}
    /* ── Legal popup (centered; list → read in place) ── */
    .legal-modal-sheet{text-align:left;max-height:80vh;display:flex;flex-direction:column;padding:16px 18px 18px}
    .legal-modal-hd{display:flex;align-items:center;gap:8px;margin-bottom:12px;flex:0 0 auto}
    .legal-modal-hd .modal-title{flex:1;margin-bottom:0;text-align:left}
    .legal-modal-back,.legal-modal-close{width:32px;height:32px;display:flex;align-items:center;justify-content:center;flex:0 0 auto;background:none;border:none;color:var(--t2);cursor:pointer;border-radius:8px;-webkit-tap-highlight-color:transparent}
    .legal-modal-back:active,.legal-modal-close:active{background:var(--s2)}
    .legal-modal-back svg,.legal-modal-close svg{display:block}
    .legal-modal-back[hidden]{display:none}
    #legal-list{display:flex;flex-direction:column;gap:8px}
    #legal-list .set-row{background:var(--s2)}
    #legal-list[hidden],#legal-doc-view[hidden]{display:none}
    #legal-doc-view{flex:1;min-height:0;overflow-y:auto}
    .legal-meta{font-size:12px;color:var(--t3);margin-bottom:14px}
    .legal-doc{font-size:14px;line-height:1.6;color:var(--t2)}
    .legal-doc h1,.legal-doc h2,.legal-doc h3{color:var(--t1);font-weight:700;margin:18px 0 8px;line-height:1.3}
    .legal-doc h1{font-size:19px}.legal-doc h2{font-size:16px}.legal-doc h3{font-size:14px}
    .legal-doc p{margin:0 0 12px}
    .legal-doc ul,.legal-doc ol{margin:0 0 12px;padding-left:20px}
    .legal-doc li{margin:4px 0}
    .legal-doc a{color:var(--accent-light)}
    .legal-doc blockquote{margin:0 0 14px;padding:10px 14px;border-left:3px solid var(--amber);background:rgba(251,191,36,0.08);color:var(--t2);border-radius:0 var(--rsm) var(--rsm) 0}

    /* ═══ SKILL TREE (Stage B) — ported from Editing/skill-tree-rpg-mockup.html (LOCKED design).
       All rules are scoped under #screen-skilltree / #modal-skilldetail; hex-node rules shared by
       the tree AND the detail modal's hero live under the .stx scope class (on both containers).
       Load-bearing port notes: a hexagon is regular only at height/width = 1.1547 (--shex-h derives
       from --shex-w); the hive is THREE INDEPENDENT FLEX COLUMNS, not a grid; Composite is
       position:absolute (contributes zero height — syncCompSpace() reserves its open height);
       scale-to-fit uses `zoom`, never transform; .binner clips for the 0fr→1fr expand, so labels
       bleed via margin-inline/padding-inline. ═══ */
    :root{
      --push:#e17575; --pull:#38bdf8; --legs:#14b8a6; --core:#c084fc; --mob:#f472b6; --composite:#e2e8f0;
      --bhex-w:94px; --shex-w:60px; --shex-h:calc(var(--shex-w) * 1.1547);
      --child-off:44px;    /* how far a dependent skill breaks out sideways */
      --name-h:20px;       /* the .hex-name block under a hex (margin + one line) */
      --child-name-w:78px; /* child labels wrap, so they never reach the spine line */
      --col-w:94px; --col-gap:8px; --row-gap:54px;
      --row-lift:6px;      /* extra offset on Legs/Core, on top of --row-gap */
      --comp-off:84px;     /* Composite vertical offset */
      --glow:14px;
    }
    /* one continuous top-anchored glow behind the WHOLE screen (both tabs) — a viewport-FIXED
       layer, not an element background: the screen box's top edge sits below the true viewport
       top on iOS, so a background left a flat --bg seam above it. fixed+inset:0 bleeds behind
       the status bar; z-index:-1 keeps it under all content, pointer-events:none off taps.
       ⚠ the one-shot .screen-enter transform makes the screen the layer's containing block for
       ~0.2s (it settles 8px with the screen) — accepted transient on a .09-alpha glow; don't
       relocate the layer outside #screen-skilltree to "fix" it. */
    #screen-skilltree::before{
      content:"";
      position:fixed;
      inset:0;
      z-index:-1;
      pointer-events:none;
      background:radial-gradient(120% 40% at 50% 0%, rgba(62,87,165,.09), transparent 70%);
    }
    /* tabs (Stats · Skill Tree) */
    #screen-skilltree .tabs{display:flex;gap:6px;margin:6px 18px 4px;padding:6px;background:var(--s1);border:1px solid var(--border);border-radius:var(--r);position:sticky;top:8px;z-index:20;backdrop-filter:blur(6px)}
    #screen-skilltree .tab{flex:1;border:none;background:transparent;color:var(--t3);font-family:inherit;font-size:13.5px;font-weight:600;padding:10px 8px;border-radius:8px;cursor:pointer;transition:.15s;display:flex;align-items:center;justify-content:center;gap:7px}
    #screen-skilltree .tab.active{
      background: transparent;
      color: var(--accent-light);
      box-shadow: 0 0 0 1px rgba(138,160,224,0.6);
    }
    #screen-skilltree .tab svg{width:17px;height:17px}
    #screen-skilltree .panel{display:none;padding:0 18px;animation:stPanelFade .25s ease}
    #screen-skilltree .panel.active{display:block}
    @keyframes stPanelFade{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}
    /* stats wheel */
    #screen-skilltree .wheel-card{background:var(--s1);border:1px solid var(--border);border-radius:var(--r);padding:20px;margin-top:16px;text-align:center}
    #screen-skilltree .wheel-wrap{position:relative;width:min(340px,100%);margin:4px auto 0}
    #st-wheel{width:100%;height:auto;display:block}
    #screen-skilltree .legend{display:flex;flex-wrap:wrap;gap:10px 16px;justify-content:center;margin-top:14px}
    #screen-skilltree .lg{display:flex;align-items:center;gap:7px;font-size:13px;color:var(--t2)}
    #screen-skilltree .lg .lgdot{width:11px;height:11px;border-radius:3px}
    #screen-skilltree .lg b{font-family:var(--font-display);color:var(--t1)}
    #screen-skilltree .wheel-note{color:var(--t3);font-size:13px;margin-top:14px;line-height:1.5}
    #screen-skilltree .wheel-note b{color:var(--t2)}
    /* title-row bulbs — "Pattern Levels" (stats) + the standalone tree tip. Both open the
       existing #modal-cue via openCueWindow; the .cue-btn pulse/seen styling is global. */
    #screen-skilltree .st-hd-row{display:flex;align-items:center;justify-content:center;gap:6px}
    #screen-skilltree .st-tree-hd{display:flex;align-items:flex-start;gap:8px;margin:14px 2px 0}
    #screen-skilltree .st-tree-hd #st-empty-slot{flex:1;min-width:0}
    #screen-skilltree .st-tree-hd .cue-btn{flex:none}
    /* tree container (the top glow lives on #screen-skilltree so it spans BOTH tabs) */
    #screen-skilltree .tree{display:flex;flex-direction:column;gap:0;max-width:460px;margin:12px auto 0;padding-top:6px}
    /* hex nodes — shared by the tree spine and the modal hero (.stx on both containers) */
    .stx .hex{position:relative;width:var(--shex-w);height:var(--shex-h);cursor:pointer;transition:transform .12s;filter:drop-shadow(0 2px 3px rgba(0,0,0,.5))}
    .stx .hex::before{content:"";position:absolute;inset:0;clip-path:polygon(50% 0,100% 25%,100% 75%,50% 100%,0 75%,0 25%);background:color-mix(in srgb,var(--pat,#3a4570) 34%,transparent)}
    .stx .hex::after{content:"";position:absolute;inset:2.5px;clip-path:polygon(50% 0,100% 25%,100% 75%,50% 100%,0 75%,0 25%);background:linear-gradient(160deg,#242c42,#151a27)}
    .stx .hex .ic{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;z-index:1;color:color-mix(in srgb,var(--pat,#7b86a5) 42%,transparent)}
    .stx .hex .ic svg{width:calc(var(--shex-w) * .4545);height:calc(var(--shex-w) * .4545)}
    .stx .hex:active{transform:scale(.93)}
    .stx .hex.mastered::before{background:#f5b942}
    .stx .hex.mastered::after{background:linear-gradient(160deg,#2c2716,#181405)}
    .stx .hex.mastered{filter:drop-shadow(0 2px 3px rgba(0,0,0,.5)) drop-shadow(0 0 6px rgba(245,185,66,.32))}
    .stx .hex.mastered .ic{color:#f5b942}
    .stx .hex.unlocked::before{background:var(--pat)}
    .stx .hex.unlocked{filter:drop-shadow(0 2px 3px rgba(0,0,0,.5)) drop-shadow(0 0 7px var(--patglow))}
    .stx .hex.unlocked .ic{color:var(--pat)}
    .stx .hex.ready .ic{color:var(--pat)}          /* icon lit, ring stays faded, no glow */
    .stx .hex.locked{opacity:.85}                  /* ring + icon fade together */
    /* spine + branch-out children */
    #screen-skilltree .spine{display:flex;flex-direction:column;align-items:center;margin-top:6px}
    #screen-skilltree .hexwrap{--pt:12px;display:flex;flex-direction:column;align-items:center;position:relative;padding-top:var(--pt)}
    #screen-skilltree .hexwrap.has-child{padding-bottom:calc(var(--shex-h) + 68px)}
    #screen-skilltree .hexwrap.has-child::after{content:"";position:absolute;left:50%;bottom:0;transform:translateX(-50%);width:2px;height:calc(var(--shex-h) + 68px);background:var(--pat);opacity:.6}
    #screen-skilltree .hexwrap.has-child:last-child::after{display:none}   /* nothing below it to connect to */
    #screen-skilltree .hexwrap:first-child{--pt:2px}
    #screen-skilltree .hexwrap:not(:first-child)::before{content:"";position:absolute;top:0;left:50%;width:2px;height:12px;background:var(--pat,var(--border));opacity:.6;transform:translateX(-50%)}
    #screen-skilltree .hex-name{font-size:11px;font-weight:600;color:var(--t2);text-align:center;margin:6px 0 0;width:max-content;max-width:calc(var(--col-w) + 14px);line-height:1.2}
    #screen-skilltree .hexwrap.mastered .hex-name,#screen-skilltree .hexwrap.unlocked .hex-name{color:var(--t1)}
    #screen-skilltree .hexchild .hex-name{max-width:var(--child-name-w)}
    #screen-skilltree .hexchild{position:absolute;top:calc(var(--pt) + var(--shex-h) + 34px);left:50%;display:flex;flex-direction:column;align-items:center;width:max-content}
    #screen-skilltree .bcell.push .hexchild,#screen-skilltree .bcell.legs .hexchild{transform:translateX(calc(-50% - var(--child-off)))}
    #screen-skilltree .bcell.pull .hexchild,#screen-skilltree .bcell.core .hexchild{transform:translateX(calc(-50% + var(--child-off)))}
    /* Composite floats over the CENTER column with only --col-gap (8px) to each side — a
       side breakout child would reach into an open Pull/Push spine. Its child hangs
       CENTERED below the parent instead (stub connector, no elbow); side columns keep
       the sideways breakout. */
    #screen-skilltree .bcell.composite .hexchild{transform:translateX(-50%)}
    #screen-skilltree .elbow{position:absolute;top:calc(var(--pt) + var(--shex-h) + var(--name-h));width:calc(var(--child-off) - var(--shex-w) / 2);height:calc(34px + var(--shex-h) / 2 - var(--name-h));border-bottom:2.5px solid var(--pat);pointer-events:none}
    #screen-skilltree .bcell.push .elbow,#screen-skilltree .bcell.legs .elbow{right:50%;border-right:2.5px solid var(--pat);border-bottom-right-radius:8px}
    #screen-skilltree .bcell.pull .elbow,#screen-skilltree .bcell.core .elbow{left:50%;border-left:2.5px solid var(--pat);border-bottom-left-radius:8px}
    #screen-skilltree .bcell.composite .elbow{display:none}
    /* the centered child's stub connector: parent name bottom → child hex top (34px zone − --name-h) */
    #screen-skilltree .bcell.composite .hexwrap.has-child:last-child::after{display:block;bottom:auto;top:calc(var(--pt) + var(--shex-h) + var(--name-h));height:calc(34px - var(--name-h))}
    /* centered composite child has empty space both sides — the 78px sideways cap would break mid-word */
    #screen-skilltree .bcell.composite .hexchild .hex-name{max-width:none;white-space:nowrap}
    /* branch honeycomb — 2 / 1 / 2; each branch opens its skills under its OWN hex.
       THREE INDEPENDENT FLEX COLUMNS (push+legs / spacer / pull+core) — a grid would make an
       open Push spine drag Core down. */
    #screen-skilltree .hive{position:relative;display:flex;justify-content:center;align-items:flex-start;gap:var(--col-gap);margin:16px auto 0;transition:padding-bottom .34s cubic-bezier(.4,0,.2,1)}
    #screen-skilltree .hcol{flex:0 0 var(--col-w);width:var(--col-w);display:flex;flex-direction:column;align-items:center;row-gap:var(--row-gap)}
    #screen-skilltree .bcell{display:flex;flex-direction:column;align-items:center;width:100%;transition:margin-top .34s cubic-bezier(.4,0,.2,1)}
    #screen-skilltree .bcell.legs,#screen-skilltree .bcell.core{margin-top:var(--row-lift)}
    /* absolute: composite is OUT of the column flow, so opening it can never size a row */
    #screen-skilltree .bcell.composite{position:absolute;top:var(--comp-off);left:0;right:0;margin:0 auto;width:var(--col-w)}
    /* translateZ(0) layer-promotes the HEX (the leaf that carries the drop-shadow glow and
       actually slides on a sibling's collapse) so iOS repaints the filter per frame — no
       smear trail, and the glow ramps on its own .2s transition instead of waiting for the
       .34s panel expand (promoting .bcell coupled hex + panel onto one deferred layer).
       ⚠ translateZ must appear in EVERY .bhex transform value (:active, .open) or those
       states drop the promotion. */
    #screen-skilltree .bhex{position:relative;width:var(--bhex-w);height:calc(var(--bhex-w) * 1.1547);padding:0;border:none;background:none;cursor:pointer;flex-shrink:0;filter:drop-shadow(0 3px 5px rgba(0,0,0,.55)) drop-shadow(0 0 var(--glow) var(--patglow));transition:transform .18s,filter .2s,width .18s,height .18s;transform:translateZ(0);-webkit-transform:translateZ(0)}
    #screen-skilltree .bhex:active{transform:scale(.96) translateZ(0);-webkit-transform:scale(.96) translateZ(0)}
    #screen-skilltree .bhex::before{content:"";position:absolute;inset:0;clip-path:polygon(50% 0,100% 25%,100% 75%,50% 100%,0 75%,0 25%);background:var(--pat);opacity:.78;transition:opacity .2s}
    #screen-skilltree .bhex::after{content:"";position:absolute;inset:3px;clip-path:polygon(50% 0,100% 25%,100% 75%,50% 100%,0 75%,0 25%);background:linear-gradient(160deg,#1c2334,#0f131e);transition:background .2s}
    #screen-skilltree .bhex-txt{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;z-index:1;pointer-events:none}
    #screen-skilltree .bhex-txt b{font-family:var(--font-display);font-weight:700;font-size:12.5px;color:var(--pat);letter-spacing:.2px}
    #screen-skilltree .bhex-txt i{font-style:normal;font-family:var(--font-display);font-weight:700;font-size:10px;color:var(--t3)}
    #screen-skilltree .bcell.open .bhex::before{opacity:1}
    #screen-skilltree .bcell.open .bhex::after{background:linear-gradient(160deg,#28324a,#161d2e)}
    #screen-skilltree .bcell.open .bhex{transform:scale(1.03) translateZ(0);-webkit-transform:scale(1.03) translateZ(0);filter:drop-shadow(0 3px 5px rgba(0,0,0,.55)) drop-shadow(0 0 calc(var(--glow) * 2.2) var(--patglow))}
    /* smooth expand: 0fr → 1fr on the grid wrapper */
    #screen-skilltree .bwrap{display:grid;grid-template-rows:0fr;transition:grid-template-rows .34s cubic-bezier(.4,0,.2,1);width:100%}
    #screen-skilltree .bcell.open .bwrap{grid-template-rows:1fr}
    /* .binner clips for the expand — the margin/padding-inline bleed keeps overhanging labels unclipped */
    #screen-skilltree .binner{overflow:hidden;min-height:0;opacity:0;transition:opacity .18s ease;margin-inline:-46px;padding-inline:46px}
    #screen-skilltree .bcell.open .binner{opacity:1;transition:opacity .24s ease .08s}
    #screen-skilltree .bopen{width:100%;display:flex;flex-direction:column;align-items:center;padding-top:9px}
    #screen-skilltree .bmeta{font-family:var(--font-display);font-weight:600;font-size:11.5px;color:var(--t2);white-space:nowrap}
    #screen-skilltree .bexp{width:88px;height:5px;border-radius:20px;background:var(--s2);overflow:hidden;margin-top:5px}
    #screen-skilltree .bexp>i{display:block;height:100%;border-radius:20px;background:var(--pat)}
    #screen-skilltree .bopen .spine::before{content:"";display:block;width:2px;height:12px;background:var(--pat);opacity:.6;margin:0 auto}
    /* onboarding cues — nearest-target lines (empty tree / all-locked branch) */
    #screen-skilltree .bnext{margin-top:7px;font-size:11px;color:var(--t3);text-align:center;line-height:1.4;max-width:170px}
    #screen-skilltree .bnext b{color:var(--t2);font-weight:600}
    #screen-skilltree .st-empty{margin:0 auto;max-width:340px;padding:0 8px;font-size:12px;color:var(--t3);text-align:center;line-height:1.5}
    #screen-skilltree .st-empty b{color:var(--t2);font-weight:600}
    /* detail modal — rides the app's .modal-backdrop/.modal-center system */
    #modal-skilldetail .modal-sheet{max-width:360px;padding:22px 22px 24px;text-align:left;position:relative;border-radius:18px;box-shadow:0 20px 60px rgba(0,0,0,.5)}
    #modal-skilldetail .dmodal-x{position:absolute;top:12px;right:12px;width:30px;height:30px;border:none;background:var(--s2);color:var(--t3);border-radius:8px;cursor:pointer;font-size:15px;line-height:1;-webkit-tap-highlight-color:transparent}
    #modal-skilldetail .dmodal-x:active{background:linear-gradient(0deg,rgba(255,255,255,0.06),rgba(255,255,255,0.06)),var(--s2);color:var(--t1);transform:scale(.9)}
    #modal-skilldetail .dmodal-hd{display:flex;flex-direction:column;align-items:center;text-align:center}
    /* the hero hex re-derives --shex-h so the 1.1547 ratio holds at its own width */
    #modal-skilldetail .dmodal-hex{--shex-w:86px;--shex-h:calc(var(--shex-w) * 1.1547);margin:2px 0 13px;pointer-events:none}
    #modal-skilldetail .dmodal-hex .hex{cursor:default}
    #modal-skilldetail .dmodal-nm{font-family:var(--font-display);font-weight:700;font-size:19px;padding:0 26px;text-align:center;line-height:1.25}
    #modal-skilldetail .dmodal-chip{margin-top:9px;font-size:10px;font-weight:700;letter-spacing:.6px;text-transform:uppercase;padding:3px 10px;border-radius:20px;background:var(--s2)}
    #modal-skilldetail .dmodal-chip.mastered{color:#f5b942}
    #modal-skilldetail .dmodal-chip.unlocked{color:var(--green)}
    #modal-skilldetail .dmodal-chip.ready{color:var(--accent-light)}
    #modal-skilldetail .dmodal-chip.locked{color:var(--t3)}
    #modal-skilldetail .dmodal-sub{color:var(--t3);font-size:12.5px;margin-top:8px}
    #modal-skilldetail .dmodal-rule{height:1px;background:var(--border);margin:16px 0 2px}
    #modal-skilldetail .dmodal-lbl{font-size:10px;letter-spacing:.6px;text-transform:uppercase;color:var(--t3);font-weight:700;margin-top:14px}
    #modal-skilldetail .dmodal-lock{margin-top:8px;font-size:12.5px;color:var(--amber);line-height:1.4}
    #modal-skilldetail .dmodal-next{margin-top:10px;font-size:12px;color:var(--t3)}
    #modal-skilldetail .dmodal-next b{color:var(--t2);font-weight:600}
    #modal-skilldetail .split{display:flex;gap:5px;flex-wrap:wrap;margin-top:8px}
    #modal-skilldetail .sp{font-size:10.5px;padding:2px 7px;border-radius:6px;background:var(--s2);color:var(--t2)}
    #modal-skilldetail .req{display:inline-block;margin-top:8px;font-size:11px;color:var(--amber);background:rgba(251,191,36,.1);border-radius:6px;padding:2px 7px}
    #modal-skilldetail .req.ok{color:var(--green);background:rgba(74,222,128,.1)}
    #modal-skilldetail .stage-line{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:9px;font-size:12px;color:var(--t2)}
    #modal-skilldetail .bar{height:7px;border-radius:20px;background:var(--s2);margin-top:10px;overflow:hidden}
    #modal-skilldetail .bar > i{display:block;height:100%;border-radius:20px;background:var(--pat,var(--accent))}
    /* unlock button — resting = faded branch colour, no glow; pressed/firing = full colour + layered glow */
    #modal-skilldetail .st-btn{--b:var(--pat,var(--accent-light));margin-top:9px;width:100%;padding:16px;border-radius:16px;color:#fff;cursor:pointer;font-family:inherit;font-weight:700;font-size:15px;border:1.6px solid color-mix(in srgb,var(--b) 38%,transparent);background:linear-gradient(0deg,color-mix(in srgb,var(--b) 10%,transparent),color-mix(in srgb,var(--b) 10%,transparent)),var(--s2);box-shadow:none;transition:transform .2s,border-color .2s,background .2s,box-shadow .2s}
    #modal-skilldetail .st-btn.firing{pointer-events:none}
    #modal-skilldetail .st-btn:active,#modal-skilldetail .st-btn.firing{transform:scale(.98);border-color:var(--b);background:linear-gradient(0deg,color-mix(in srgb,var(--b) 28%,transparent),color-mix(in srgb,var(--b) 28%,transparent)),var(--s2);box-shadow:0 0 26px color-mix(in srgb,var(--b) 55%,transparent),0 0 11px color-mix(in srgb,var(--b) 70%,transparent)}
    #modal-skilldetail .st-btn.firing{transform:none}   /* released, but stays lit */
    #modal-skilldetail .st-btn.fading{opacity:0;box-shadow:none;transition:opacity .26s ease,box-shadow .22s ease}
    #modal-skilldetail .dmodal-reveal{animation:stRevealUp .34s cubic-bezier(.4,0,.2,1) both}
    @keyframes stRevealUp{from{opacity:0;transform:translateY(-6px)}to{opacity:1;transform:none}}
    @media(prefers-reduced-motion:reduce){
      #screen-skilltree .bwrap,#screen-skilltree .bcell,#screen-skilltree .binner,#screen-skilltree .bhex{transition:none}
      #modal-skilldetail .dmodal-reveal{animation:none}
      #modal-skilldetail .st-btn.fading{transition:none}
    }
    /* ═══ Ship F — onboarding self-assessment (#screen-assessment) ═══
       Ported from Editing/onboarding-assessment-mockup.html. Shared components
       (.ppl-chip/.cta-main/.stepper/.section-lbl/.muscle-section/.screen-hd/
       .back-btn) already exist — only the asm-* additions live here, all scoped.
       Hexes: the tree's are .stx-scoped, so these carry their own copy at 46px. */
    #screen-assessment .asm-prog { height: 3px; background: var(--s1); margin: 0 20px 22px; border-radius: 2px; overflow: hidden; }
    #screen-assessment .asm-prog-fill { height: 100%; background: var(--accent-light); border-radius: 2px; transition: width .28s cubic-bezier(.4,0,.2,1); }
    #screen-assessment .asm-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--t3); }
    #screen-assessment .asm-sub { font-size: 14px; color: var(--t3); line-height: 1.55; padding: 0 20px; margin: -8px 0 22px; }
    #screen-assessment .asm-stack { display: flex; flex-direction: column; gap: 8px; }
    #screen-assessment .asm-stack .ppl-chip { text-align: left; padding: 14px 14px; font-size: 14px; }
    #screen-assessment .asm-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
    #screen-assessment .asm-foot { padding: 8px 20px 0; }
    #screen-assessment .asm-skip { display: block; width: 100%; margin-top: 14px; background: none; border: none; color: var(--t3);
      font-family: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; padding: 8px; }
    #screen-assessment .asm-hint { font-size: 12.5px; color: var(--t3); padding: 0 20px; margin: -6px 0 12px; line-height: 1.5; }
    #screen-assessment .asm-empty { font-size: 13.5px; color: var(--t3); padding: 4px 20px 20px; line-height: 1.6; }
    #screen-assessment .asm-err { font-size: 13px; color: var(--red); padding: 10px 20px 0; line-height: 1.5; text-align: center; }
    #screen-assessment .asm-w-row { margin-bottom: 14px; }
    #screen-assessment .asm-w-name { font-size: 14px; color: var(--t2); margin-bottom: 8px; font-weight: 600; }
    #screen-assessment .asm-w-box { flex: 1; min-width: 0; min-height: 50px;
      display: flex; align-items: baseline; justify-content: center; gap: 4px;
      background: var(--bg); border: 1.5px solid var(--border); border-radius: var(--rsm);
      padding: 0 10px; transition: border-color 0.15s; }
    #screen-assessment .asm-w-box:focus-within { border-color: var(--accent); }
    #screen-assessment .asm-w-box .stepper-val { flex: 0 0 auto; width: 2ch; min-width: 0; min-height: 0; text-align: right;
      background: transparent; border: none; border-radius: 0; padding: 0; font-variant-numeric: tabular-nums; }
    #screen-assessment .asm-w-kg { font-size: 13px; font-weight: 600; color: var(--t3); flex: 0 0 auto; }
    #screen-assessment .asm-w-box.empty .asm-w-kg { color: #3d4560; }
    #screen-assessment .asm-kit-dots { display: flex; gap: 6px; padding: 0 20px; margin: -10px 0 18px; flex-wrap: wrap; }
    #screen-assessment .asm-kit-dot { font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
      color: var(--t3); background: var(--s1); border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; }
    #screen-assessment .asm-kit-dot.on { color: var(--accent-light); border-color: var(--accent); background: var(--s2); }
    #screen-assessment .asm-kit-dot.done { color: var(--green); border-color: rgba(74,222,128,.4); }
    /* Green = confirmed everywhere in the assessment (FIXED_DUR_STYLE.recovery glow). */
    #screen-assessment .ppl-chip { transition: border-color .15s, background .15s, color .15s, box-shadow .2s; }
    #screen-assessment .ppl-chip.selected { border-color: var(--green); background: var(--green-dim); color: var(--green);
      box-shadow: 0 0 24px rgba(74,222,128,0.32); }
    @keyframes asmChipPop { 0% { transform: scale(1); box-shadow: 0 0 0 rgba(74,222,128,0); }
      45% { transform: scale(1.06); box-shadow: 0 0 30px rgba(74,222,128,0.5); }
      100% { transform: scale(1); box-shadow: 0 0 24px rgba(74,222,128,0.32); } }
    #screen-assessment .ppl-chip.pop { animation: asmChipPop .34s cubic-bezier(.22,1,.36,1); }
    /* Hexes — ring + face + glyph, as the tree draws them; own 46px size. */
    #screen-assessment .asm-hex { --ahex-w: 46px; --ahex-h: 53.1px; position: relative; width: var(--ahex-w); height: var(--ahex-h);
      flex: 0 0 auto; filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); transition: filter .2s; }
    #screen-assessment .asm-hex::before { content:""; position:absolute; inset:0;
      clip-path: polygon(50% 0,100% 25%,100% 75%,50% 100%,0 75%,0 25%);
      background: color-mix(in srgb, var(--pat,#3a4570) 34%, transparent); transition: background .2s; }
    #screen-assessment .asm-hex::after { content:""; position:absolute; inset:2.5px;
      clip-path: polygon(50% 0,100% 25%,100% 75%,50% 100%,0 75%,0 25%);
      background: linear-gradient(160deg,#242c42,#151a27); }
    #screen-assessment .asm-hex .ic { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; z-index:1;
      color: color-mix(in srgb, var(--pat,#7b86a5) 42%, transparent); transition: color .2s; }
    #screen-assessment .asm-hex.lit::before { background: var(--pat); }
    #screen-assessment .asm-hex.lit .ic { color: var(--pat); }
    #screen-assessment .asm-hex.lit { filter: drop-shadow(0 0 8px color-mix(in srgb, var(--pat) 55%, transparent)); }
    @keyframes asmHexPop { 0% { transform: scale(.5); opacity: 0; } 60% { transform: scale(1.14); } 100% { transform: scale(1); opacity: 1; } }
    #screen-assessment .asm-hex.pop { animation: asmHexPop .45s cubic-bezier(.22,1,.36,1) both; }
    @keyframes asmHexLight { 0% { transform: scale(1); filter: drop-shadow(0 0 0 transparent); }
      45% { transform: scale(1.06); filter: drop-shadow(0 0 16px color-mix(in srgb, var(--pat) 80%, transparent)); }
      100% { transform: scale(1); filter: drop-shadow(0 0 8px color-mix(in srgb, var(--pat) 55%, transparent)); } }
    #screen-assessment .asm-hex.light { animation: asmHexLight .34s cubic-bezier(.22,1,.36,1); }
    #screen-assessment .asm-skill { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
    #screen-assessment .asm-skill-body { flex: 1; min-width: 0; }
    #screen-assessment .asm-skill-n { font-size: 14px; color: var(--t2); font-weight: 600; margin: 3px 0 8px; transition: color .2s; }
    #screen-assessment .asm-skill.on .asm-skill-n { color: var(--t1); }
    #screen-assessment .asm-skill-o { display: flex; flex-wrap: wrap; gap: 6px; }
    #screen-assessment .asm-skill-o .ppl-chip { flex: 0 1 auto; padding: 8px 11px; font-size: 12.5px; }
    /* Finish phase — the tick lands first, the nodes light behind it. */
    #screen-assessment .done-wrap { display: flex; flex-direction: column; align-items: center;
      min-height: 100dvh; padding: var(--screen-top) 24px var(--screen-bottom); text-align: center; }
    #screen-assessment .done-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--green-dim);
      display: flex; align-items: center; justify-content: center; margin-bottom: 14px;
      color: var(--green); animation: asmTickIn .42s cubic-bezier(.22,1,.36,1) both; }
    @keyframes asmTickIn { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }
    #screen-assessment .done-title { font-family: var(--font-display); font-size: 27px; font-weight: 700; margin-bottom: 8px; letter-spacing: -.5px; }
    #screen-assessment .done-sub { font-size: 15px; color: var(--t3); line-height: 1.6; margin-bottom: 22px; max-width: 300px; }
    #screen-assessment .done-sub b { color: var(--green); font-weight: 700; }
    #screen-assessment .done-hexrow { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 6px; }
    #screen-assessment .done-hexcell { display: flex; flex-direction: column; align-items: center; width: 68px; }
    #screen-assessment .done-hexname { font-size: 10px; font-weight: 600; color: var(--t2); margin-top: 5px; line-height: 1.2; }
    #screen-assessment .done-tree { width: 100%; background: var(--s1); border: 1px solid var(--border); border-radius: var(--r);
      padding: 18px 14px 16px; margin-bottom: 22px; }
