/* =====================================================================
   Rodillo visual system: a bike computer, not a gaming dashboard.
   - Light "screen" background, black ink. Color is reserved for data:
     power zones, grade. There is no brand accent color.
   - One typeface, Archivo, used across its width axis:
     compressed + heavy for every number (race-number numerals),
     normal width for text, extra-wide for the wordmark.
   - "Now" is inverted: the current interval, the main button.
   - Today's card in the home carousel is a dome in its zone color that
     fades into the sheet (Nov 9). Still data color, no decoration.
   ===================================================================== */
@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  --paper: #e6e9e5;      /* screen background */
  --sheet: #f7f9f6;      /* raised surfaces */
  --sheet2: #eef1ed;     /* hover / inset */
  --rule: #cdd2cc;       /* hairlines */
  --ink: #16181b;        /* text and the only "accent" */
  --muted: #5f666c;
  --faint: #8d949a;     /* decoration and disabled only, never text that carries meaning (2.9:1) */

  --good: #127c43;
  --warn: #946200;
  --bad: #cf2f3b;
  --info: var(--ink);     /* cadence chips and cadence traces: ink, no hue (zone hues mean zones only) */
  --info-line: var(--rule);
  --warn-line: #e2c98f;
  --bad-line: #ebb5b9;
  --hi: #ffffff;         /* hover / pressed surface */
  --press: #000000;      /* pressed primary */
  --ok-bg: #dff3e6; --ok-ink: #0f6e3a;
  --bad-bg: #fbe1e3;
  --flash: #fff1c9;
  --overlay: rgba(230, 233, 229, .72);
  --scrim: rgba(22, 24, 27, .22); /* behind side panels (settings, controls) */
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.5 6 6l4.5-4.5' fill='none' stroke='%235f666c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --shadow: rgba(22, 24, 27, .16);
  --hatch: rgba(22, 24, 27, .035);
  --log: #33383d;
  /* text on inverted surfaces (today, current interval) */
  --inv-muted: #a9b0b6; --inv-good: #6fd39b; --inv-yellow: #ffd166; --inv-red: #ff8a92; --inv-info: var(--inv-muted);
  /* text on zone-colored blocks: always dark, whatever the theme */
  --on-zone: #16181b; --on-zone-inv: #f7f9f6;
  /* canvas */
  --ftp-line: rgba(22, 24, 27, .32);
  --hr-line: #c4196e;  /* heart rate only */
  /* Training load chart: hues no zone uses */
  --fitness: #12a4b8; --fatigue: #7048e8; /* Training load chart; form takes the color of whichever is ahead */
  /* grade scale (slope mode): steeper = redder; flat is sand, not blue, so it never reads as Z2 */
  --g-down: #3fa596; --g0: #aeb2ad; --g1: #d2a531; --g2: #e27a35; --g3: #d9434b; --g4: #9e1f2b;
  --underlay: #dde1dc;
  --dim: rgba(247, 249, 246, .72); /* ride page: everything outside the selected interval */
  /* today's card: the zone color fades into this, and this is its lift shadow */
  --today-end: #ffffff; --today-shadow: rgba(22, 24, 27, .28);

  /* zones (kept in sync with ZC in js/app.js) */
  --z1: #a3a9ae; --z2: #2d7ff9; --z3: #1fa855; --z4: #f4be1a; --z5: #f47b20; --z6: #e23b44;

  --num: "Archivo", system-ui, sans-serif;
  --r: 6px;
  font-family: "Archivo", system-ui, -apple-system, sans-serif;
  font-stretch: 100%;
  color-scheme: light;
}

/* Dark: same system, lights off. "Now" stays inverted, so today and the
   current interval become light cards. Zone colors are unchanged. */
:root[data-theme="dark"] {
  --paper: #0c0e0d;
  --sheet: #181b19;
  --sheet2: #1f2320;
  --rule: #2c312d;
  --ink: #eef1ec;
  --muted: #98a09a;
  --faint: #69716b;
  --good: #3fcf7e; --warn: #f0b429; --bad: #ff5c66;
  --info: var(--ink); --info-line: var(--rule); --warn-line: #5a4614; --bad-line: #5e252b;
  --hi: #242925; --press: #ffffff;
  --ok-bg: #12301f; --ok-ink: #7be3a6;
  --bad-bg: #3a1519;
  --flash: #4a3a0e;
  --overlay: rgba(12, 14, 13, .74);
  --scrim: rgba(0, 0, 0, .55);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.5 6 6l4.5-4.5' fill='none' stroke='%2398a09a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --shadow: rgba(0, 0, 0, .55);
  --hatch: rgba(238, 241, 236, .035);
  --log: #c9d1c9;
  --inv-muted: #5f666c; --inv-good: #15894a; --inv-yellow: #a86f00; --inv-red: #cf2f3b; --inv-info: var(--inv-muted);
  --ftp-line: rgba(238, 241, 236, .35);
  --hr-line: #ff5fa8;
  --fitness: #3fcfe0; --fatigue: #a48bff;
  --underlay: #262b27;
  --dim: rgba(24, 27, 25, .74);
  --today-end: #181b19; --today-shadow: rgba(255, 255, 255, .32);
  color-scheme: dark;
}

/* Home screens (premium look: phone Nov 12, desktop Nov 13, Agustín; mocks: project doc claude/rodillo-premium-look.md):
   lighter paper, near-black dark, soft card shadows, the raised segment track. Only while the home screen is up
   (`html:has(#home.active)`), so the ride screen and the panels its pause screen opens keep the tokens above.
   --glass, --glass-sheen, --lens, --lens-edge and --nav-text are the phone nav pill's liquid glass (desktop keeps text tabs).
   The rules below are the desktop look; the phone block overrides them. Not carried over to the desktop (Agustín agreed):
   the coach card (the call stays in the hero line), the glass nav pill, glows under calendar chips, 24-28 px corners
   (16 there). */
html:not([data-theme="dark"]):has(#home.active) {
  --paper: #eceeeb; --sheet: #fbfcfa; --sheet2: #eef1ed; --rule: #dfe3de; --hi: #ffffff; --today-end: #fbfcfa; --track: #e2e6e1;
  --card-shadow: 0 1px 2px rgba(22, 24, 27, .04), 0 10px 30px rgba(22, 24, 27, .06);
  --card-drop: drop-shadow(0 6px 16px rgba(22, 24, 27, .07));
  --seg-on: #ffffff; --seg-shadow: 0 1px 2px rgba(22, 24, 27, .08), 0 2px 8px rgba(22, 24, 27, .08);
  --glass: linear-gradient(180deg, rgba(255, 255, 255, .52) 0%, rgba(255, 255, 255, .26) 100%);
  --glass-edge: inset 0 1px 0 rgba(255, 255, 255, .95), inset 0 -1px 0 rgba(255, 255, 255, .45), inset 0 0 0 .5px rgba(255, 255, 255, .6), 0 12px 32px rgba(22, 24, 27, .14), 0 1px 3px rgba(22, 24, 27, .1);
  --glass-sheen: rgba(255, 255, 255, .6);
  --lens: linear-gradient(180deg, rgba(255, 255, 255, .85) 0%, rgba(255, 255, 255, .55) 100%);
  --lens-edge: inset 0 1px 0 #fff, inset 0 -1px 0 rgba(22, 24, 27, .05), 0 2px 10px rgba(22, 24, 27, .12);
  --nav-text: #3c4247;
  --hero-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22), 0 1px 2px rgba(22, 24, 27, .04), 0 10px 30px rgba(22, 24, 27, .06);
}
html[data-theme="dark"]:has(#home.active) {
  --paper: #050606; --sheet: #111413; --sheet2: #1b1f1d; --rule: #202523; --hi: #1f2422; --underlay: #1c201e; --today-end: #111413; --track: #111413;
  --card-shadow: none; --card-drop: none;
  --seg-on: #2a302d; --seg-shadow: none;
  --glass: linear-gradient(180deg, rgba(255, 255, 255, .12) 0%, rgba(255, 255, 255, .05) 100%);
  --glass-edge: inset 0 1px 0 rgba(255, 255, 255, .28), inset 0 -1px 0 rgba(255, 255, 255, .08), inset 0 0 0 .5px rgba(255, 255, 255, .16), 0 12px 32px rgba(0, 0, 0, .5);
  --glass-sheen: rgba(255, 255, 255, .14);
  --lens: linear-gradient(180deg, rgba(255, 255, 255, .22) 0%, rgba(255, 255, 255, .1) 100%);
  --lens-edge: inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 -1px 0 rgba(0, 0, 0, .2), 0 2px 10px rgba(0, 0, 0, .35);
  --nav-text: #c3c9c4;
  --hero-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink); }
body { -webkit-font-smoothing: antialiased; font-size: 15px; line-height: 1.4; }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
h2, h3, h4 { margin: 0 0 8px; font-weight: 700; letter-spacing: -0.01em; }
h4 { font-size: 15px; }
b { font-weight: 650; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* numbers everywhere share one voice */
.t-val, .ride-clock, .stat .v, .rp-count, .rp-pval, .rp-v, .rp-top > div > span:last-child,
.rp-target, .seg-r .big, .seg-name .big, .t-pct, .cal-num, .pct {
  font-family: var(--num); font-stretch: 68%; font-variant-numeric: tabular-nums;
}
/* ...but on the home screens halfway between that heavy condensed voice and a wide semibold (Nov 12, 11:18 pm, Agustín
   picked 80% / 720 from a side-by-side of 100/620, 80/720 and 68/800). The rides list is the phone's (.rl-s), the table
   the desktop's (#ride-table td: its date and name columns stay text); each is hidden on the other layout. */
#home :is(.stat .v, .hs .v, .cal-num, .wo-meta .n, .d-meta .n, .hero-nums .v, .rl-s .v, #ride-table td) {
  font-family: var(--num); font-stretch: 80%; font-weight: 720; letter-spacing: -0.01em; font-variant-numeric: tabular-nums;
}
#home #ride-table td:nth-child(2) { font-family: Archivo, system-ui, sans-serif; font-stretch: 100%; font-weight: 600; letter-spacing: -0.01em; }
#home #ride-table td:nth-child(1) { font-family: Archivo, system-ui, sans-serif; font-stretch: 100%; font-weight: 500; color: var(--muted); }

/* ---------- buttons ---------- */
button { cursor: pointer; border-radius: 999px; border: 1.5px solid var(--rule); background: var(--sheet); padding: 9px 18px; font-weight: 600; transition: background .12s, border-color .12s, color .12s; }
button:hover { border-color: var(--ink); }
button:active { transform: translateY(1px); }
button.primary { background: var(--ink); border-color: var(--ink); color: var(--sheet); }
button.primary:hover { background: var(--press); border-color: var(--press); }
button.ghost, .ghost { background: transparent; }
button.small, .small { padding: 6px 13px; font-size: 13.5px; }
button.danger { color: var(--bad); }
button.danger:hover { border-color: var(--bad); }
.file-btn { display: inline-block; cursor: pointer; border-radius: 999px; border: 1.5px solid var(--rule); padding: 9px 18px; font-weight: 600; }
.file-btn:hover { border-color: var(--ink); }
.file-btn.small { padding: 6px 13px; font-size: 13.5px; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }

.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }

/* ---------- home ---------- */
#home { max-width: 1180px; margin: 0 auto; padding: 22px 28px 64px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.brand { font-size: 26px; font-weight: 850; font-stretch: 125%; letter-spacing: -0.035em; display: flex; align-items: center; gap: 11px; line-height: 1; }
/* mark: a rolling pin (rodillo), tilted as if rolling. Masked so it takes --ink in both themes. */
.logo { width: 46px; height: 19px; flex: none; margin-bottom: 2px; background: var(--ink);
  -webkit-mask: url("../icons/pin.svg") center / contain no-repeat; mask: url("../icons/pin.svg") center / contain no-repeat; }
.top-actions { display: flex; gap: 4px; }
.top-actions button { border-color: transparent; }
.top-actions button:hover { border-color: var(--rule); }
/* theme toggle: just the half-filled circle, no label */
#btn-theme::before, .theme-btn::before { content: ""; width: 16px; height: 16px; margin: 2px; border-radius: 50%; border: 2px solid currentColor; background: linear-gradient(90deg, currentColor 50%, transparent 50%); }

/* connections: a link button in the top bar (one status dot per sensor) opens a popover with one row per sensor */
.topbar { position: relative; }
#btn-devices { display: inline-flex; align-items: center; gap: 7px; padding-left: 12px; padding-right: 13px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; padding: 8px 10px; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#btn-devices svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
#btn-devices[aria-expanded="true"] { background: var(--ink); border-color: var(--ink); color: var(--sheet); }
.ldots { display: inline-flex; gap: 4px; }
.ldots i { width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--faint); }
.ldots i.on { background: var(--good); border-color: var(--good); }
.ldots i.wait { background: var(--warn); border-color: var(--warn); animation: pulse 1s infinite; }
#btn-devices[aria-expanded="true"] .ldots i:not(.on):not(.wait) { border-color: var(--sheet); opacity: .6; }
.devpop { position: absolute; top: calc(100% + 8px); right: 0; z-index: 25; width: 400px; max-width: calc(100vw - 28px);
  background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); box-shadow: 0 18px 44px var(--shadow); }
.devpop-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--rule); }
.devpop-head h3 { margin: 0; font-size: 16px; }
.devices { display: flex; flex-direction: column; }
.device { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 3px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--rule); }
.device:first-child { border-top: none; }
.device > :not(button):not(.row-btns) { grid-column: 1; }
.device > button { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
.device .row-btns { grid-column: 1 / -1; gap: 6px; margin-top: 6px; }
.dev-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); font-weight: 500; }
.dot { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--faint); flex: none; }
.device.connected .dot { background: var(--good); border-color: var(--good); }
.device.connecting .dot { background: var(--warn); border-color: var(--warn); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.dev-name { font-weight: 650; font-size: 16px; }
.device.connected .dev-name { color: var(--ink); }
.dev-meta { font-size: 13px; color: var(--muted); }
.dev-name:empty, .dev-meta:empty { display: none; }
.devpop-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 12px 8px 16px; border-top: 1px solid var(--rule); font-size: 13px; }
.device.demo { background-image: repeating-linear-gradient(135deg, transparent 0 7px, var(--hatch) 7px 8px); }
/* home look (premium, Nov 13, Agustín; mocked on the canvas page "Panels"): a frosted glass popover, rows as soft inner cards. Only while the home
   screen is up, like every panel's home look: from the ride pause screen they keep the ride look. */
html:has(#home.active) .devpop-head button { border-color: transparent; background: var(--sheet); }
html:has(#home.active) .devpop { border: none; border-radius: 16px; background: color-mix(in srgb, var(--sheet) 88%, transparent);
  -webkit-backdrop-filter: blur(24px) saturate(1.7); backdrop-filter: blur(24px) saturate(1.7);
  box-shadow: var(--glass-edge), 0 24px 60px var(--shadow); padding: 4px 0 8px; }
html:has(#home.active) .devpop-head { border-bottom: none; padding: 12px 14px 8px 18px; }
html:has(#home.active) .devpop-head h3 { font-size: 18px; font-weight: 650; }
html:has(#home.active) .devices { gap: 6px; padding: 0 8px; }
html:has(#home.active) .device { border-top: none; border-radius: 12px; background: color-mix(in srgb, var(--sheet2) 75%, transparent); padding: 12px 14px; }
html:has(#home.active) .devpop :is(button.ghost, button:not(.primary)) { border-color: transparent; background: color-mix(in srgb, var(--ink) 7%, transparent); }
html:has(#home.active) .devpop-foot { border-top: none; margin: 6px 8px 0; padding: 8px 6px 4px 10px; }

.tabs { position: relative; display: flex; gap: 22px; border-bottom: 1px solid var(--rule); margin-bottom: 16px; }
.tabs button { border: none; background: none; border-radius: 0; padding: 10px 0 13px; color: var(--muted); font-size: 16px; font-weight: 600; transition: color .2s ease; }
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--ink); }
/* the underline is one bar that slides to the active tab (js placeInk sets --ink-x / --ink-w) */
.tabs::after { content: ""; position: absolute; left: 0; bottom: -1px; height: 3px; width: var(--ink-w, 0); transform: translateX(var(--ink-x, 0)); background: var(--ink); pointer-events: none; }
.tabs.ink-ready::after { transition: transform .32s cubic-bezier(.2, .7, .2, 1), width .32s cubic-bezier(.2, .7, .2, 1); }
/* a newly shown tab or ERG/Slope pane drifts in from the side it came from */
.slide-in { animation: slide-in .26s cubic-bezier(.2, .7, .2, 1); }
@keyframes slide-in { from { opacity: 0; transform: translateX(var(--from, 0)); } to { opacity: 1; transform: none; } }
.tab { display: none; }
.tab.active { display: block; }

/* main nav (UX roadmap item 4): Today / Workouts / Calendar / Training are separate screens.
   Desktop: text tabs in the top bar, sliding underline. Phone: floating pill at the bottom (below). */
#home[data-tab="today"] .tab-body { display: none; }
#home:not([data-tab="today"]) :is(#today, #overview, #week) { display: none !important; }
.topbar .topnav { border-bottom: none; margin: 0 auto 0 48px; gap: 28px; }
.topbar .topnav button { padding: 8px 0 10px; }
.topnav svg { display: none; }

/* workout library: a stage list, not a card grid */
.workout-list { display: block; background: var(--sheet); border-radius: var(--r); }
.workout-list:empty { display: none; }
/* compact rows: name, mini profile, duration. Tap for tags, description and Start. */
.wo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 30%) 130px; grid-template-areas: "name prof meta" "more more more";
  column-gap: 22px; row-gap: 3px; align-items: center; padding: 11px 22px; border-top: 1px solid var(--rule); cursor: pointer; outline: none; position: relative; }
.wo:first-child { border-top: none; }
.wo:hover { background: var(--sheet2); }
.wo.focus { box-shadow: inset 4px 0 0 var(--ink); }
.wo-top { display: contents; }
.wo-name { grid-area: name; font-weight: 620; font-size: 15.5px; letter-spacing: -0.01em; }
.wo-name .tag { margin-left: 4px; vertical-align: 1px; }
.wo-meta { grid-area: meta; font-family: Archivo, system-ui, sans-serif; font-stretch: 100%; font-size: 13px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; align-self: center; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.wo-meta .n { font-size: 15px; color: var(--ink); } /* duration and TSS in the home numbers voice (numbers section) */
.wo .profile { grid-area: prof; align-self: center; height: 26px; }
/* tap to open: tags, description and Start slide down (0fr -> 1fr rows animate the real height) */
.wo { transition: background .2s ease; }
.wo-more { grid-area: more; display: grid; grid-template-rows: 0fr; margin-top: -3px; /* cancel the row gap while closed */
  transition: grid-template-rows .26s cubic-bezier(.2, .7, .2, 1), margin-top .26s cubic-bezier(.2, .7, .2, 1); }
.wo-more-in { min-height: 0; overflow: hidden; opacity: 0; transform: translateY(-4px); transition: opacity .18s ease, transform .26s cubic-bezier(.2, .7, .2, 1); }
.wo.expanded { background: var(--sheet2); }
.wo.expanded .wo-more { grid-template-rows: 1fr; margin-top: 0; }
.wo.expanded .wo-more-in { opacity: 1; transform: none; transition-delay: .04s; }
.wo-tags { padding-top: 6px; }
.wo-tags:empty { display: none; }
.wo-desc { font-size: 13.5px; color: var(--muted); line-height: 1.45; max-width: 72ch; margin-top: 4px; }
.wo .start-row { display: flex; gap: 8px; padding: 10px 0 2px; }
.wo .start-row button[data-start] { padding: 8px 20px; }
/* real climbs: detail slider under the open chart (right = finer stretches) */
.wo-detail { display: flex; align-items: center; gap: 12px; padding-top: 10px; font-size: 13.5px; }
.wo-detail label { font-weight: 650; }
.wo-detail input[type=range] { flex: 0 1 260px; min-width: 120px; accent-color: var(--ink); }
.wo-det-v { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wo-detail button[hidden] { display: none; }
/* slope workouts: steepest / lowest grade vs the trainer's range */
.wo-grades { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding-top: 10px; font-size: 13.5px; color: var(--muted); }
.wo-grades b { color: var(--ink); font-family: var(--num); font-stretch: 68%; font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
.wo-grades .over, .wo-grades .over b { color: var(--warn); }
.wo-grades .ico-warn { width: 15px; height: 15px; margin-left: 4px; vertical-align: -2px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.wo-gnote { color: var(--muted); flex-basis: 100%; }
.wo-gnote.warn { color: var(--warn); }
.wo-gnote .ico-warn { margin: 0 6px 0 0; }
/* open row: the mini profile gives way to a full-width one with the hover/tap readout (.prof-hover).
   Once open, the panel stops clipping so the readout tag can sit above the chart. */
.wo > .profile { transition: opacity .2s ease; }
.wo.expanded > .profile { opacity: 0; }
.wo-prof { height: 110px; margin-top: 14px; }
.wo .wo-prof .profile { height: 100%; } /* beats the mini-profile heights, phone included */
.wo.expanded .wo-more-in { animation: wo-unclip 0s .3s forwards; }
@keyframes wo-unclip { to { overflow: visible; } }
/* Start in the library and "Ride it now" in the calendar grow on hover like the hero buttons. They're small, so 8% instead of 5%,
   and they grow from the left edge: the library one sits in the clipped expand panel (.wo-more-in) */
@media (prefers-reduced-motion: no-preference) {
  button[data-start], button[data-startday] { transform-origin: left center; transition: background .12s, border-color .12s, color .12s, transform .4s cubic-bezier(.3, 1.6, .5, 1); }
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  button[data-start]:hover, button[data-startday]:hover { transform: scale(1.08); }
  button[data-start]:hover:active, button[data-startday]:hover:active { transform: scale(1.03); transition-duration: .12s; }
}
@media (prefers-reduced-motion: reduce) { .wo, .wo-more, .wo-more-in { transition: none; } }
/* library groups (UX roadmap item 10): a muted label over each group's sheet */
.workout-list:has(> .wo-sec) { background: none; border-radius: 0; }
.wo-sec + .wo-sec { margin-top: 22px; }
.wo-gh { font-size: 15px; font-weight: 650; color: var(--ink); margin: 0 0 8px 6px; letter-spacing: 0; }
/* each group a round card without lines */
.wo-sheet { background: var(--sheet); border-radius: 16px; box-shadow: var(--card-shadow); }
.wo-sheet .wo { border-top: none; }
.wo-sheet .wo:first-child { border-radius: 16px 16px 0 0; }
.wo-sheet .wo:last-child { border-radius: 0 0 16px 16px; }
.wo-sheet .wo:only-child { border-radius: 16px; }
/* open row: description left, facts under the profile + meta columns */
.wo-info { display: grid; grid-template-columns: minmax(0, 1fr) calc(max(200px, 30%) + 152px); column-gap: 22px; align-items: start; }
.wo-info.nofacts { grid-template-columns: minmax(0, 1fr); }
.wo-facts { display: grid; gap: 10px; padding-top: 8px; font-size: 13.5px; }
.wo-facts .f { display: grid; grid-template-columns: 96px 1fr; align-items: baseline; column-gap: 12px; }
.wo-facts .fl { color: var(--muted); }
.wo-facts .fv { font-weight: 700; }
.wo-facts .zbar { row-gap: 6px; align-items: center; }
.wo-facts .zb { display: flex; height: 10px; border-radius: 3px; overflow: hidden; gap: 1px; }
.wo-facts .zb i { display: block; }
.wo-facts .zl { grid-column: 2; display: flex; flex-wrap: wrap; gap: 2px 12px; font-weight: 600; font-size: 12.5px; }
.wo-facts .zl i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
.wo-prof { margin-top: 8px; }
.profile { width: 100%; height: 54px; display: block; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 4px; border: 1px solid var(--rule); color: var(--muted); margin-right: 4px; line-height: 1.5; }
.tag.sim { color: var(--info); border-color: var(--info-line); }
.tag.coach { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
.tag.warn { color: var(--warn); border-color: var(--warn-line); }
.import-row { margin-top: 14px; display: flex; gap: 12px; align-items: center; font-size: 13.5px; }
.import-row button, .import-row .btn, .import-row label { border-color: transparent; background: var(--sheet2); }

/* rider overview (Agustín, Nov 13): one card of three tiles under the hero, each a label on top, the number, one small
   visual (week dots, form scale, FTP trend) and a line under it; markup: overviewHtml() in js/today.js. The Recovery
   tile left Nov 28 (no more WHOOP). The phone shows the daily coach's call as a card above the tiles (phone block). */
.overview.stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; background: var(--sheet); border: none; border-radius: 16px; margin: 16px 0 28px; box-shadow: var(--card-shadow); }
.overview:empty { display: none; }
.coach-card { display: none; } /* phone only (phone block) */
.overview > .stat { position: relative; }
.overview.stats > .stat.ov2 { border: none; display: flex; flex-direction: column; gap: 6px; padding: 16px 20px 16px; }
.overview.stats > .stat:nth-child(n + 2) { box-shadow: inset 1px 0 0 color-mix(in srgb, var(--rule) 70%, transparent); }
.overview .info { top: 12px; right: 12px; }
.ov2 .ol { font-size: 13px; font-weight: 600; color: var(--muted); }
.overview .ov2 .v { font-size: 34px; line-height: 1; }
.overview .ov2 .v .of { font-family: Archivo, system-ui, sans-serif; font-stretch: 100%; font-size: 15px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.ov2 .v .of b { font-family: var(--num); font-stretch: 80%; font-weight: 720; color: var(--ink); font-size: 17px; }
.ov2 .os { font-size: 12.5px; color: var(--muted); }
.ov2 .os b { font-family: var(--num); font-stretch: 80%; font-weight: 720; font-size: 14px; color: var(--ink); }
.ov2 .os b.up { color: var(--good); }
.ov2 .none { font-family: Archivo, system-ui, sans-serif; font-stretch: 100%; font-size: 22px; font-weight: 600; color: var(--muted); }
/* this week, Monday to Sunday: a ring in the planned workout's color, filled once ridden; strength / rest = a small dot */
.ov-week { display: flex; justify-content: space-between; margin-top: 2px; max-width: 220px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.wd i { width: 12px; height: 12px; border-radius: 50%; }
.wd.plan i { border: 2px solid var(--c); }
.wd.done i { background: var(--c); }
.wd.off i { width: 5px; height: 5px; margin: 3.5px 0; background: var(--faint); }
.wd em { font-style: normal; font-size: 10.5px; font-weight: 600; color: var(--muted); }
.wd.today em { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; }
.ov-form { position: relative; height: 6px; border-radius: 3px; background: var(--sheet2); margin: 7px 0 4px; }
.ov-form .band { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--ink) 10%, transparent); }
.ov-form .zero { position: absolute; top: -3px; bottom: -3px; width: 1.5px; background: var(--muted); }
.ov-form .mk { position: absolute; top: 50%; width: 13px; height: 13px; border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 0 0 2px var(--sheet); }
.ov-form .mk.fit { background: var(--fitness); }
.ov-form .mk.fat { background: var(--fatigue); }
.ov-ftp { position: relative; height: 24px; margin-top: 6px; }
.ov-ftp svg { display: block; width: 100%; height: 100%; overflow: visible; }
.ov-ftp path { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.ov-ftp path.ar { fill: color-mix(in srgb, var(--ink) 7%, transparent); stroke: none; }
.ov-ftp i { position: absolute; right: -2px; width: 9px; height: 9px; border-radius: 50%; background: var(--ink); transform: translateY(-50%); box-shadow: 0 0 0 2px var(--sheet); }
/* Free ride bicycle (inline SVG in BIKE_ICO, currentColor so it follows both themes).
   Hover / controller focus: the bike tilts back onto its rear wheel and the crank spins.
   The spin is paused rather than removed on leave, so the crank stops where it is instead of snapping back. */
.bike-ico { width: 33px; height: 20px; flex: none; overflow: visible;
  transform: translateY(-2px); /* center on the capitals, not the line box */
  transform-origin: 21% 93%; /* rear tyre contact */
  transition: transform .4s cubic-bezier(.3, 1.6, .5, 1); }
.bike-ico .crank { transform-origin: 73px 64.5px; animation: bike-crank .6s linear infinite paused; }
@keyframes bike-crank { to { transform: rotate(360deg); } }
/* ...and the hero buttons (Start workout too) grow a little with the same springy curve (press shrinks them back a touch) */
@media (prefers-reduced-motion: no-preference) {
  .hero-btns button { transition: background .12s, border-color .12s, color .12s, transform .4s cubic-bezier(.3, 1.6, .5, 1); }
  .hero-btns button.focus { transform: scale(1.05); }
  .hero-free.focus .bike-ico { transform: translateY(-2px) rotate(-12deg); }
  .hero-free.focus .bike-ico .crank { animation-play-state: running; }
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .hero-btns button:hover { transform: scale(1.05); }
  .hero-btns button:hover:active { transform: scale(1.02); transition-duration: .12s; }
  .hero-free:hover .bike-ico { transform: translateY(-2px) rotate(-12deg); }
  .hero-free:hover .bike-ico .crank { animation-play-state: running; }
}
/* Workouts tab (and the builder's palette): ERG / Slope / Mine as a raised segment switch on a track */
.seg-tg { position: relative; display: inline-flex; background: var(--track); border-radius: 22px; padding: 4px; }
.seg-tg button { position: relative; z-index: 1; background: transparent; border: none; color: var(--muted); font-size: 14.5px; font-weight: 700; padding: 8px 22px; border-radius: 999px; touch-action: manipulation; transition: color .22s ease; }
.seg-tg button:hover { color: var(--ink); }
.seg-tg button.on, .seg-tg button.on:hover { color: var(--ink); }
/* the raised pill is one shape that slides under the chosen option (js placeInk) */
.seg-tg::before { content: ""; position: absolute; top: 4px; bottom: 4px; left: 0; width: var(--ink-w, 0); transform: translateX(var(--ink-x, 0)); background: var(--seg-on); box-shadow: var(--seg-shadow); border-radius: 999px; }
.seg-tg.ink-ready::before { transition: transform .3s cubic-bezier(.3, .8, .25, 1), width .3s cubic-bezier(.3, .8, .25, 1); }
@media (prefers-reduced-motion: reduce) { .tabs::after, .seg-tg::before { transition: none !important; } .slide-in { animation: none; } }
.seg-tg button.focus { outline: 2px solid var(--ink); outline-offset: 2px; }
.wo-kind { margin-bottom: 10px; }
.list-sub { font-size: 13.5px; margin: 0 0 12px; }
.empty-list { padding: 14px 18px; margin: 0; font-size: 14px; }
.card { background: var(--sheet); border-radius: var(--r); padding: 18px 20px; }
.card p { font-size: 14px; line-height: 1.5; }
#home .card { border-radius: 16px; padding: 22px 24px; box-shadow: var(--card-shadow); } /* home cards are round and soft; the ride page keeps .card */

.ride-table table, table.ints { width: 100%; border-collapse: collapse; font-size: 14px; }
.ride-table td, .ride-table th, table.ints td, table.ints th { padding: 8px 6px; border-bottom: 1px solid var(--rule); text-align: left; font-variant-numeric: tabular-nums; }
.ride-table th, table.ints th { color: var(--muted); font-weight: 500; font-size: 13px; }
/* the rides table (desktop; the phone shows .ride-list instead): no hairlines, rows as soft bands */
.ride-list { display: none; }
.ride-table td, .ride-table th { border-bottom: none; padding: 10px 10px; }
.ride-table th { font-size: 12.5px; font-weight: 600; }
.ride-table tr[data-ride] td:first-child { border-radius: 12px 0 0 12px; }
.ride-table tr[data-ride] td:last-child { border-radius: 0 12px 12px 0; }
.ride-table tr[data-ride]:nth-child(odd) td { background: color-mix(in srgb, var(--sheet2) 55%, transparent); }
table.ints { margin-bottom: 14px; }
.nowrap { white-space: nowrap; }
.pct { font-weight: 750; font-size: 1.1em; }
.pct.ok { color: var(--good); } .pct.low { color: var(--warn); } .pct.high { color: var(--bad); }
.sync-status { font-size: 13.5px; margin-bottom: 10px; line-height: 2; }
.sync-status button { margin-left: 8px; }
/* signed out: ride history is private, only the sign-in line shows */
#tab-training.locked > :not(#sync-status) { display: none; }
/* Training: the six numbers on one round card (premium look) */
.stats.tcards { grid-template-columns: repeat(6, 1fr); margin: 0 0 18px; padding: 20px 8px; border: none; border-radius: 16px; background: var(--sheet); box-shadow: var(--card-shadow); }
.stats.tcards > .stat { position: relative; }
.stats.tcards > .stat:nth-child(n) { border: none; padding: 0 18px 0 20px; }
.stats.tcards .stat .v { font-size: 36px; }
.stats.tcards .stat .l { font-size: 13px; color: var(--ink); font-weight: 600; margin-top: 4px; }
.stats.tcards .info { top: 0; right: 14px; }
.stat .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.tgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.tgrid .wide { grid-column: 1 / -1; }
.tgrid h3, .card h3 { font-size: 16px; }
.tgrid h3 .muted { font-weight: 400; font-size: 13px; margin-left: 6px; }
/* weekly load legend (svgWeekly in js/app.js) */
.wk-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.wk-legend .wk-key { flex-basis: 100%; }
.wk-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.wk-legend i.hr { background: repeating-linear-gradient(45deg, var(--faint) 0 2px, var(--underlay) 2px 5px); }
/* time in zones (Coggan Z1-Z7, js/zones.js) */
.zcols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 40px; }
.zcols h4 .muted { font-weight: 400; font-size: 13px; margin-left: 6px; }
.zbars { display: grid; grid-template-columns: auto auto 1fr auto 2.8em; align-items: center; gap: 7px 12px; font-size: 14px; font-variant-numeric: tabular-nums; margin-bottom: 14px; }
.zb-z { font-weight: 800; }
.zb-n { white-space: nowrap; }
.zb-n span { color: var(--muted); font-size: 12.5px; margin-left: 8px; }
.zb-bar { height: 12px; min-width: 40px; background: var(--underlay); border-radius: 2px; overflow: hidden; }
.zb-bar i { display: block; height: 100%; }
#home .zb-bar { height: 10px; border-radius: 5px; background: var(--sheet2); overflow: visible; }
#home .zb-bar i { border-radius: 5px; } /* no glow (Nov 16) */
.zb-t { text-align: right; font-weight: 700; }
.zb-p { text-align: right; font-size: 12.5px; color: var(--muted); }
.svgchart { width: 100%; height: auto; display: block; font-family: var(--num); }
/* power curve legend, on the card's title row */
.pc-legend { display: flex; justify-content: flex-end; gap: 14px; margin: -30px 0 18px; font-size: 12px; color: var(--muted); }
.pc-legend span { display: inline-flex; align-items: center; gap: 6px; }
.pc-legend i { display: inline-block; width: 14px; }
.pc-legend i.solid { height: 2.5px; border-radius: 2px; background: var(--z5); }
.pc-legend i.dash { border-top: 2px dashed var(--muted); }

/* ---------- panels ---------- */
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: 470px; max-width: 100vw; background: var(--sheet); border-left: 1px solid var(--rule); padding: 20px; overflow: auto; z-index: 32; box-shadow: -24px 0 48px var(--shadow); }
/* dim layer behind an open side panel (above the phone nav pill, z 30); a click closes the panel */
.scrim { position: fixed; inset: 0; z-index: 31; background: var(--scrim); backdrop-filter: blur(1.5px); -webkit-backdrop-filter: blur(1.5px); }
@media (prefers-reduced-motion: no-preference) {
  .scrim:not(.hidden) { animation: modal-fade .2s ease-out; }
}
/* in-app replacement for alert()/confirm(): ask() in js/app.js */
.modal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--overlay); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.modal-box { width: 420px; max-width: 100%; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); box-shadow: 0 18px 44px var(--shadow); padding: 20px 20px 16px; }
.modal-box h3 { margin: 0 0 6px; font-size: 18px; }
.modal-box p { margin: 0 0 18px; color: var(--muted); line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.modal-box h3:empty { display: none; }
.modal-btns { display: flex; justify-content: flex-end; gap: 8px; }
/* bike check before a slope workout or free ride: the garage's tiles inside the modal */
.modal-box.wide { width: 560px; }
.modal-body { margin: 0 0 18px; }
.modal-btns button:disabled { opacity: .4; cursor: default; }
.modal-btns button.focus { outline: 2px solid var(--ink); outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) {
  .modal:not(.hidden) { animation: modal-fade .15s ease-out; }
  .modal:not(.hidden) .modal-box { animation: modal-pop .22s cubic-bezier(.3, 1.6, .5, 1); }
}
@keyframes modal-fade { from { opacity: 0; } }
@keyframes modal-pop { from { transform: scale(.94); } }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.panel h4 { margin-top: 8px; }
/* home look (premium, Nov 13, Agustín; mocked on the canvas page "Panels"): Settings, Garage and Controls on paper, their content on round sheets,
   no hairlines; the pause screen opens them over the ride, where they keep the plain look above */
html:has(#home.active) :is(#settings, #controls, #garage).panel { background: var(--paper); border-left: none; }
html:has(#home.active) :is(#settings, #controls, #garage) .panel-head h3 { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
html:has(#home.active) :is(#settings, #controls, #garage) .panel-head button { border-color: transparent; background: var(--sheet); }
.settings-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 14px; align-items: start; margin-bottom: 22px; font-size: 14px; }
/* one field = label on top, control, optional help; .full spans both columns */
.settings-form .fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.settings-form .fld.full, .settings-form > .help, .settings-form .dt-fields > .help, .settings-form .bike-fields > .help { grid-column: 1 / -1; }
.settings-form .fld > label { font-size: 13px; font-weight: 650; color: var(--ink); }
.settings-form input, .settings-form select { background: var(--paper); border: 1px solid var(--rule); border-radius: 4px; padding: 0 10px; height: 36px; width: 100%; min-width: 0; }
.settings-form select { appearance: none; -webkit-appearance: none; padding-right: 30px; background-image: var(--chev); background-repeat: no-repeat; background-position: right 11px center; background-size: 12px 8px; text-overflow: ellipsis; cursor: pointer; }
.settings-form input:focus, .settings-form select:focus { border-color: var(--ink); outline: none; }
.settings-form .dt-fields, .settings-form .bike-fields { display: contents; }
.settings-form .help a { color: inherit; }
.settings-form .help { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.settings-form > .help, .settings-form .dt-fields > .help, .settings-form .bike-fields > .help { margin-top: -6px; }
/* home look: the Settings fields on one round sheet; filled inputs, no outlines */
html:has(#home.active) #settings .settings-form { background: var(--sheet); border-radius: 16px; padding: 18px 16px; box-shadow: var(--card-shadow); }
html:has(#home.active) .settings-form input, html:has(#home.active) .settings-form select { border: none; border-radius: 12px; background: var(--sheet2); height: 46px; }
html:has(#home.active) #garage .settings-form input, html:has(#home.active) #garage .settings-form select { background: var(--sheet); }
html:has(#home.active) .settings-form input:focus, html:has(#home.active) .settings-form select:focus { box-shadow: 0 0 0 2px var(--ink); }
html:has(#home.active) .settings-form .fld > label { font-weight: 600; }
html:has(#home.active) .panel .settings-form button.ghost, html:has(#home.active) .panel .settings-form .ghost { border-color: transparent; background: var(--sheet2); }
html:has(#home.active) #garage .settings-form button.ghost { background: var(--sheet); }
/* Garage: a centered popup (not a side drawer) with a square tile per bike and a "+" tile (Nov 12, Agustín).
   It keeps the .panel class so the scrim, Close, Esc / B and the pause screen work as for the other panels. */
#garage.panel { top: 50%; left: 50%; right: auto; bottom: auto; transform: translate(-50%, -50%); width: min(780px, calc(100vw - 32px)); max-height: calc(100vh - 48px); border: 1px solid var(--rule); border-radius: var(--r); box-shadow: 0 18px 44px var(--shadow); }
#garage.panel:not(.hidden) { animation: modal-fade .18s ease-out, gar-pop .24s cubic-bezier(.2, .7, .2, 1); }
@keyframes gar-pop { from { transform: translate(-50%, -50%) scale(.95); } }
@media (prefers-reduced-motion: reduce) { #garage.panel:not(.hidden) { animation: none; } }
.gar-tabs { margin-bottom: 18px; }
.settings-form .gar-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.gar-tile, .gar-add { aspect-ratio: 1; min-width: 0; display: flex; flex-direction: column; border: 1px solid var(--rule); border-radius: var(--r); background: var(--paper); color: var(--ink); overflow: hidden; transition: transform .4s cubic-bezier(.3, 1.6, .5, 1), background .2s ease; }
.gar-pick, .gar-add { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 14px 12px 6px; border: 0; border-radius: 0; background: transparent; color: inherit; font: inherit; text-align: center; cursor: pointer; }
.gar-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; line-height: 1.2; }
.gar-line { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.gar-tile { position: relative; }
.gar-riding { position: absolute; top: 10px; left: 10px; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--sheet); color: var(--ink); }
.gar-more { flex: none; background: transparent; border: 0; border-radius: 0; color: var(--muted); font: inherit; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; padding: 8px 10px 12px; cursor: pointer; }
.gar-tile.on { background: var(--ink); border-color: var(--ink); color: var(--sheet); }
.gar-tile.on .gar-line, .gar-tile.on .gar-more { color: var(--inv-muted); }
.gar-tile.gone { border-style: dashed; background: transparent; }
.gar-add { border: 1.5px dashed var(--faint); background: transparent; padding: 14px 12px; }
.gar-plus { font-size: 64px; font-weight: 300; line-height: .9; margin-bottom: 8px; }
.gar-pick:focus-visible, .gar-add:focus-visible, .gar-pick.focus, .gar-add.focus { outline: 2px solid var(--ink); outline-offset: -4px; }
.gar-tile.on .gar-pick:focus-visible { outline-color: var(--sheet); }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .gar-tile:hover, .gar-add:hover { transform: scale(1.03); }
  .gar-tile:not(.on):hover, .gar-add:hover { background: var(--sheet2); }
  .gar-more:hover { color: var(--ink); } .gar-tile.on .gar-more:hover { color: var(--sheet); }
}
.settings-form .gar-grid + .help { margin-top: 2px; }
.settings-form .gar-hero { grid-column: 1 / -1; display: flex; justify-content: center; padding: 6px 0 2px; }
.gar-tile .bike-photo { width: 94%; height: auto; flex: none; margin-bottom: 8px; }
.gar-hero .bike-photo { width: min(460px, 86%); height: auto; }
.gar-tile.gone .bike-photo { opacity: .35; }
.settings-form .gar-acts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
.settings-form .gar-acts .help { margin: 0; }
.settings-form .gar-head { grid-column: 1 / -1; margin-bottom: -6px; }
.settings-form .section.gar-title { margin-top: 0; font-size: 18px; }
.settings-form .gar-dl { grid-column: 1 / -1; display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 0; margin: 0; border-top: 1px solid var(--rule); }
.gar-dl dt, .gar-dl dd { margin: 0; padding: 9px 0; border-bottom: 1px solid var(--rule); font-size: 14px; }
.gar-dl dt { color: var(--muted); }
.gar-dl dd { color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.settings-form .gear-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
/* gearings are text only: wide, short tiles instead of squares */
.gar-tile.gear-tile, .gar-add.gear-tile { aspect-ratio: auto; min-height: 104px; }
.gear-tile .gar-pick { padding: 26px 10px 10px; }
.gar-add.gear-tile { flex-direction: row; gap: 8px; padding: 12px; }
.gar-add.gear-tile .gar-plus { font-size: 34px; margin: 0; }
.gar-add.gear-tile .gar-name { text-align: left; }
.gar-add.gear-tile .gar-line { display: none; }
/* home look: a round popup, tiles as soft cards */
html:has(#home.active) #garage.panel { border: none; border-radius: 16px; }
html:has(#home.active) .gar-tile { border: none; border-radius: 14px; background: var(--sheet); box-shadow: var(--card-shadow); }
html:has(#home.active) .gar-tile.on { background: var(--ink); }
html:has(#home.active) .gar-add { border-radius: 14px; border: 1.5px dashed color-mix(in srgb, var(--faint) 70%, transparent); }
html:has(#home.active) .gar-more { text-decoration: none; font-weight: 600; }
html:has(#home.active) .gar-riding { background: var(--seg-on); }
html:has(#home.active) .settings-form .gar-dl { border-top: none; background: var(--sheet); border-radius: 14px; padding: 6px 16px; }
html:has(#home.active) .gar-dl dt, html:has(#home.active) .gar-dl dd { border-bottom: none; padding: 8px 0; }
.settings-form .section { grid-column: 1 / -1; font-size: 15px; color: var(--ink); margin-top: 14px; font-weight: 700; padding-top: 12px; border-top: 1px solid var(--rule); }
/* settings: one tab per section (same sliding underline as the home tabs); scrolls sideways if it doesn't fit */
.set-tabs { gap: 18px; overflow-x: auto; scrollbar-width: none; margin-bottom: 18px; }
.set-tabs::-webkit-scrollbar { display: none; }
.set-tabs button { font-size: 15px; white-space: nowrap; flex: none; }
.stab-pane { margin-bottom: 0; }
.stab-pane .help:last-child { margin-bottom: 0; }
/* home look: Settings' tabs become the raised segment switch from Workouts (the Garage's stay plain, except on the phone) */
html:has(#home.active) .tabs.set-tabs { border-bottom: none; background: var(--track); border-radius: 22px; padding: 4px; gap: 0; margin: 0 0 14px; }
html:has(#home.active) .set-tabs button { position: relative; z-index: 1; flex: 1 0 auto; padding: 8px 12px; font-size: 14px; }
html:has(#home.active) .set-tabs::after { top: 4px; bottom: 4px; height: auto; border-radius: 18px; background: var(--seg-on); box-shadow: var(--seg-shadow); z-index: 0; }
.pane-intro { grid-column: 1 / -1; font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.ctl-style { font-size: 13.5px; margin: 0 0 10px; }
.keys-group td { padding-top: 14px; font-weight: 700; font-size: 14px; color: var(--ink); }
.keys tr.keys-group:first-of-type td, .keys tr:nth-child(2).keys-group td { padding-top: 8px; }
.keys { width: 100%; border-collapse: collapse; font-size: 13px; }
.keys td, .keys th { padding: 6px 4px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.keys th { color: var(--muted); font-weight: 500; }
/* home look: Controls on one round sheet, rows without lines, groups as headings */
html:has(#home.active) .ctl-style a { color: var(--ink); font-weight: 600; }
html:has(#home.active) .keys { background: var(--sheet); border-radius: 16px; border-collapse: separate; border-spacing: 0; overflow: hidden; box-shadow: var(--card-shadow); font-size: 14px; }
html:has(#home.active) .keys td, html:has(#home.active) .keys th { border-bottom: none; padding: 8px 16px; }
html:has(#home.active) .keys th { padding-top: 14px; font-size: 12.5px; }
html:has(#home.active) .keys td:first-child { color: var(--muted); }
html:has(#home.active) .keys td:nth-child(2) { font-weight: 600; }
html:has(#home.active) .keys-group td { padding-top: 18px; font-size: 15px; font-weight: 650; color: var(--ink) !important; }
.build-id { font-size: 11.5px; font-weight: 500; margin-left: 6px; }

#log-body { font: 12px/1.5 ui-monospace, Menlo, monospace; white-space: pre-wrap; color: var(--log); }
/* home look (Nov 13, Agustín: "do the changes to the log and workout editor"): paper ground, the text on one round sheet.
   From the ride pause screen (Connections > Log) it keeps the plain look. */
html:has(#home.active) #log.panel { background: var(--paper); border-left: none; }
html:has(#home.active) #log .panel-head h3 { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
html:has(#home.active) #log .panel-head button { border-color: transparent; background: var(--sheet); }
html:has(#home.active) #log-body { background: var(--sheet); border-radius: 14px; padding: 14px 16px; margin: 0; box-shadow: var(--card-shadow); }

/* ---------- ride ---------- */
#ride { padding: 16px 22px; display: none; flex-direction: column; gap: 12px; height: 100vh; position: relative; overflow: hidden; background: var(--paper); }
#ride.active { display: flex; }
/* top row (Nov 10 rework): Elapsed | current interval (the protagonist, centered) | Next.
   Side cards share one width so the interval card sits dead center; the data cards line up under it. */
.ride-top { --rt-side: 182px; display: grid; grid-template-columns: var(--rt-side) minmax(0, 1fr) var(--rt-side); gap: 12px; align-items: center; }
.rt-card { background: var(--sheet); border-radius: var(--r); padding: 10px 16px 12px; min-height: 104px; min-width: 0; display: flex; flex-direction: column; justify-content: center; overflow: hidden; container-type: inline-size; }
.rt-k { font-size: 13px; color: var(--muted); font-weight: 600; }
.ride-clock { font-size: min(46px, 24cqi); font-weight: 850; line-height: 1.05; margin-top: 2px; }
.ride-trip { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; margin-top: 2px; }
.ride-trip b { color: var(--ink); font-weight: 700; }
.ride-trip:empty { display: none; }
/* Next: only duration @ target (+ cadence target). Sheet + zone-colored edge so the current card stays dominant. */
.rt-next { --nc: var(--rule); border-left: 10px solid var(--nc); }
.rt-next.none { visibility: hidden; }
.rt-next .amt { font-size: min(44px, 21cqi); font-weight: 850; line-height: 1.05; margin-top: 2px; white-space: nowrap; }
.rt-next .amt .num { font-family: var(--num); font-stretch: 68%; font-variant-numeric: tabular-nums; }
.rt-next .amt .at { font-size: .55em; font-weight: 650; color: var(--muted); margin: 0 .2em; }
.rt-next .amt .u { font-size: .5em; font-weight: 750; margin-left: .06em; }
.rt-next .cad { font-size: 15px; font-weight: 650; color: var(--info); margin-top: 2px; }
.rt-next .cad:empty { display: none; }
.rt-next.finish .amt { color: var(--muted); }
/* interval change: the old Next card grows over the current card (.rt-mover), the old current card is frozen under it (.rt-ghost) */
#ride > .rt-mover, #ride > .rt-ghost { position: absolute; margin: 0; pointer-events: none; transform: none; }
#ride > .rt-ghost { z-index: 7; animation: none !important; }
#ride > .rt-mover { z-index: 8; box-shadow: 0 14px 34px var(--shadow); }
/* connection status: quiet dots in the bottom bar, red when a device is off */
.rb-left { display: flex; align-items: center; gap: 16px; min-width: 0; }
.ride-status { display: flex; gap: 10px; align-items: center; font-size: 12.5px; color: var(--muted); font-weight: 600; flex: none; white-space: nowrap; }
.ride-status span { display: inline-flex; align-items: center; gap: 5px; }
.ride-status .cx::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.ride-status .off { color: var(--bad); }
.ride-status .cx.off::before { background: var(--bad); }

/* the interval card is the one big block of color: it is the zone */
.interval { --zc: var(--z2); position: relative; overflow: hidden; container-type: inline-size; text-align: center; background: var(--zc); color: var(--on-zone); border-radius: var(--r); padding: 14px 14px 24px; min-height: 168px; display: flex; flex-direction: column; justify-content: center; transition: background .4s; }
.int-head { font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.int-head b { font-weight: 800; font-size: 18px; }
.int-head span:not(:empty)::before { content: " \00b7  "; opacity: .6; }
.int-head span { opacity: .82; }
.rep-badge { position: absolute; left: 22px; top: 16px; text-align: left; line-height: 1; pointer-events: none; }
.rep-badge:empty { display: none; }
.rep-badge .rk { font-size: 13px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; opacity: .72; margin-right: 6px; vertical-align: 4px; }
.rep-badge .rn { font-family: var(--num); font-stretch: 68%; font-weight: 850; font-size: 34px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.rep-badge .rn i { font-style: normal; font-size: .52em; opacity: .62; margin-left: .04em; }
.rep-badge .pips { display: flex; gap: 4px; margin-top: 6px; }
.rep-badge .pips b { width: 13px; height: 6px; border-radius: 3px; background: currentColor; opacity: .22; }
.rep-badge .pips b.on { opacity: 1; }
.rep-badge .pips.bar { position: relative; width: 98px; height: 6px; border-radius: 3px; }
.rep-badge .pips.bar::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: .22; }
.rep-badge .pips.bar b { position: relative; display: block; height: 100%; border-radius: inherit; opacity: 1; }
.interval:has(#r-rep:not(:empty)) .int-head { padding: 0 120px; } /* the label stays centred and clear of the counter */
.rt-next .nrep { font-size: 15px; font-weight: 650; color: var(--muted); margin-top: 2px; }
.int-big { font-size: min(96px, 14cqi); line-height: 1; font-weight: 850; margin-top: 6px; white-space: nowrap; letter-spacing: -0.01em; }
.int-big .num { font-family: var(--num); font-stretch: 68%; font-variant-numeric: tabular-nums; }
.int-big .w { font-size: .46em; font-weight: 650; letter-spacing: 0; margin: 0 .28em; opacity: .78; }
.int-big .u { font-size: .5em; font-weight: 750; margin-left: .08em; }
.int-big .msg { font-size: .62em; font-weight: 800; letter-spacing: -0.015em; }
.int-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 9px; background: color-mix(in srgb, var(--on-zone) 16%, transparent); }
.int-bar i { display: block; height: 100%; width: 0; background: var(--on-zone); opacity: .85; transition: width .3s linear; }
.int-bar.hidden { display: none; }
/* interval card pulse: zone-color ripple + small bump (js pulseCard). One beat when an interval
   starts, one per second in its last 10 s. The one-shot wins over the steady beat while it runs. */
.interval.int-ending, .rp-hero.int-ending { animation: int-beat 1s ease-out infinite; }
.interval.int-fresh, .rp-hero.int-fresh { animation: int-fresh .75s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes int-beat {
  0% { transform: scale(1); box-shadow: 0 0 0 0 color-mix(in srgb, var(--zc) 75%, transparent); }
  18% { transform: scale(1.035); }
  100% { transform: scale(1); box-shadow: 0 0 0 16px color-mix(in srgb, var(--zc) 0%, transparent); }
}
@keyframes int-fresh {
  0% { transform: scale(1); box-shadow: 0 0 0 0 color-mix(in srgb, var(--zc) 85%, transparent); }
  30% { transform: scale(1.06); }
  100% { transform: scale(1); box-shadow: 0 0 0 24px color-mix(in srgb, var(--zc) 0%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .interval.int-ending, .rp-hero.int-ending, .interval.int-fresh, .rp-hero.int-fresh { animation: none; } }

/* tiles: bike-computer data fields on one surface */
.tiles { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1.35fr 1fr 1fr; background: var(--sheet); border-radius: var(--r); }
.tile { padding: 12px 18px 14px; position: relative; overflow: hidden; container-type: inline-size; min-width: 0; border-left: 1px solid var(--rule); }
.tiles > .tile:first-child { border-left: none; border-radius: var(--r) 0 0 var(--r); }
.t-label { font-size: 14px; color: var(--muted); font-weight: 500; }
.t-val { font-size: min(96px, 46cqi); font-weight: 850; line-height: 1; letter-spacing: -0.01em; margin-top: 2px; }
.tile.power .t-val { font-size: min(150px, 50cqi); }
.t-sub { font-size: 15px; color: var(--muted); min-height: 20px; font-variant-numeric: tabular-nums; }
.t-sub b { color: var(--ink); }
.unit { font-size: .38em; color: var(--muted); margin-left: 3px; letter-spacing: 0; font-weight: 700; }
.tile.power.low, .tile.power.high { box-shadow: inset 0 -7px 0 var(--rule); }
.tile.power.ok { box-shadow: inset 0 -7px 0 var(--good); }
.tile.gear.flash { animation: flash .35s; }
@keyframes flash { from { background: var(--flash); } }
.tile.gear.dim { opacity: .4; }

.ride-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px 18px; }
.ride-body.with-segs { grid-template-columns: 232px minmax(0, 1fr); }
/* workouts (UX roadmap item 3, Nov 12): top row centered on the screen and capped, tiles under it,
   interval list and chart start on one line. .ride-main dissolves so its children sit in this grid. */
.ride-body.with-segs { grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "top top" "tiles tiles" "segs chart"; }
.ride-body.with-segs .ride-main { display: contents; }
.ride-body.with-segs .ride-top { grid-area: top; width: min(100% - 96px, 1146px); justify-self: center; } /* 48 px each side keeps it clear of the theme switch */
.ride-body.with-segs .tiles { grid-area: tiles; }
.ride-body.with-segs .chart-box { grid-area: chart; }
.ride-body.with-segs #r-segs { grid-area: segs; }
.ride-main { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.chart { width: 100%; flex: 1; min-height: 140px; background: var(--sheet); border-radius: var(--r); }
/* timed workout messages: floating text over the top of the ride chart (desktop) */
.chart-box { position: relative; flex: 1; min-height: 140px; }
.chart-box > .chart { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; }
.r-msg { position: absolute; top: 14px; left: 0; right: 0; padding: 0 64px; text-align: center; pointer-events: none;
  font-size: clamp(22px, 2.3vw, 32px); font-weight: 800; line-height: 1.15; letter-spacing: -0.005em; color: var(--ink); text-wrap: balance;
  text-shadow: 0 0 2px var(--sheet), 0 0 6px var(--sheet), 0 0 14px var(--sheet), 0 0 24px var(--sheet);
  opacity: 0; transform: translateY(-6px); transition: opacity .5s, transform .5s; }
.r-msg.show { opacity: 1; transform: none; animation: msg-in .55s cubic-bezier(.3, 1.6, .5, 1), msg-pulse 1.3s ease-in-out .55s 3; }
@keyframes msg-in { from { opacity: 0; transform: translateY(-10px) scale(.9); } }
@keyframes msg-pulse { 0%, 100% { transform: scale(1); } 45% { transform: scale(1.045); } }
@media (prefers-reduced-motion: reduce) { .r-msg, .r-msg.show { animation: none; transform: none; } }
.ride-bottom { display: flex; justify-content: space-between; align-items: center; gap: 12px; position: relative; z-index: 6; } /* above .paused-overlay so End ride / Resume stay clickable while paused */
.hints { font-size: 13px; color: var(--muted); }
.hints b { color: var(--ink); font-weight: 650; }
.ride-btns { display: flex; gap: 8px; }
.mute-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.mute-btn.hidden { display: none; }
.mute-ico { width: 18px; height: 18px; flex: none; }

.toast { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); background: var(--ink); color: var(--sheet); border-radius: 10px; padding: 16px 30px; font-size: 32px; font-weight: 800; font-stretch: 75%; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 10; }
.toast.show { opacity: 1; }
/* hold-to-confirm: big key in a ring that fills over --hold-ms; release early cancels */
/* ramp test coach: the interval card grows to fill the window for a moment (clip-path animated from js) */
.takeover { --zc: var(--z5); position: fixed; inset: 0; z-index: 34; background: var(--zc); color: var(--on-zone); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2vh; text-align: center; pointer-events: none; padding: 0 6vw; }
.takeover.dark { background: var(--ink); color: var(--sheet); }
.to-line { font-size: clamp(30px, 4.4vw, 68px); font-weight: 850; line-height: 1.08; letter-spacing: -0.01em; text-wrap: balance; }
.to-big { font-family: var(--num); font-stretch: 68%; font-variant-numeric: tabular-nums; font-size: clamp(110px, 19vw, 300px); font-weight: 850; line-height: .88; letter-spacing: -0.02em; white-space: nowrap; }
.to-sub { font-size: clamp(17px, 1.9vw, 28px); font-weight: 650; opacity: .78; }
.hold { position: absolute; inset: 0; z-index: 35; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; pointer-events: none; }
/* skip gets a lighter scrim than end so the label reads over the chart (UX roadmap item 7) */
.hold { background: color-mix(in srgb, var(--paper) 62%, transparent); backdrop-filter: blur(1.5px); -webkit-backdrop-filter: blur(1.5px); }
.hold.end { background: var(--overlay); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.hold-msg { font-size: 34px; font-weight: 800; font-stretch: 75%; color: var(--ink); }
.hold-msg:empty, .hold-sub:empty { display: none; }
.hold-sub { font-size: 17px; font-weight: 650; color: var(--muted); }
.hold-ring { position: relative; width: 200px; height: 200px; border-radius: 50%; background: var(--sheet); box-shadow: 0 18px 44px var(--shadow); }
.hold-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.hold-ring circle { fill: none; stroke-width: 10; }
.hold-track { stroke: var(--rule); }
.hold-fill { stroke: var(--ink); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; }
.hold.end .hold-fill { stroke: var(--bad); }
.hold.run .hold-fill { animation: hold-fill var(--hold-ms, 3000ms) linear forwards; }
@keyframes hold-fill { to { stroke-dashoffset: 0; } }
@keyframes hold-dim { from { background-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; } }
.hold-key { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 104px; font-weight: 900; font-stretch: 68%; line-height: 1; color: var(--ink); }
.hold-key.word { font-size: 40px; font-stretch: 75%; }
@media (prefers-reduced-motion: no-preference) {
  .hold.run .hold-ring { animation: modal-pop .22s cubic-bezier(.3, 1.6, .5, 1); }
  .hold.run { animation: hold-dim .2s ease-out; }
}
.paused-overlay { position: absolute; inset: 0; background: var(--overlay); display: flex; align-items: center; justify-content: center; text-align: center; z-index: 5; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.paused-overlay .big { font-size: 72px; font-weight: 900; font-stretch: 68%; line-height: 1; }
.paused-overlay .muted { font-size: 17px; margin-top: 6px; }
/* pause screen actions: connections, garage, controls, settings (same panels as the home top bar) */
.pz-acts { display: flex; justify-content: center; gap: 10px; margin-top: 28px; }
.pz-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 108px; padding: 14px 12px 11px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); color: var(--ink); font-size: 14px; font-weight: 650; }
.pz-ico svg { display: block; width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pz-btn .ldots { margin-top: -1px; }
.pz-btn .ldots i { width: 6px; height: 6px; }
.pz-btn[aria-expanded="true"] { background: var(--ink); border-color: var(--ink); color: var(--sheet); }
@media (hover: hover) {
  .pz-btn { transition: transform .4s cubic-bezier(.3, 1.6, .5, 1), border-color .2s; }
  .pz-btn:hover { transform: scale(1.05); border-color: var(--ink); }
  .pz-btn:hover:active { transform: scale(1.01); }
}
@media (prefers-reduced-motion: reduce) { .pz-btn, .pz-btn:hover { transition: none; transform: none; } }
/* the connections popover, opened from the pause screen: centered over it */
.paused-overlay > .devpop.on-ride { top: 50%; left: 50%; right: auto; transform: translate(-50%, -50%); width: min(400px, calc(100% - 24px)); max-height: calc(100% - 32px); overflow: auto; overscroll-behavior: contain; text-align: left; }
/* light / dark switch in the top right corner of the ride screen; above the pause overlay like the bottom bar */
#r-theme { position: absolute; top: 14px; right: 16px; z-index: 6; border-color: transparent; }
#r-theme:hover { border-color: var(--rule); }
/* time of day next to it (Nov 18, Agustín: 12 h, e.g. "8:02 PM"); same height as the switch so the two sit on one line */
.r-tod { position: absolute; top: 14px; right: 62px; height: 38px; display: flex; align-items: center; z-index: 6; font-family: var(--num); font-stretch: 80%; font-weight: 720; font-size: 17px; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; pointer-events: none; }
.r-tod:empty { display: none; }

/* ---------- ride page (one completed ride; js/ridepage.js) ---------- */
#ridepage { max-width: 1180px; margin: 0 auto; padding: 22px 28px 64px; }
.rd-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.rd-acts { display: flex; gap: 8px; }
.rd-back { display: inline-flex; align-items: center; gap: 6px; }
.rd-back svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.rd-msg { font-size: 15px; }
.rd-head { display: grid; grid-template-columns: 1fr 260px; gap: 28px; align-items: end; }
.rd-head.noprof { grid-template-columns: 1fr; }
.rd-head h2 { font-size: 30px; letter-spacing: -0.02em; margin-bottom: 4px; }
.rd-sub { color: var(--muted); font-size: 14.5px; }
.rd-sub .tag { margin: 0 0 0 4px; vertical-align: 1px; }
.rd-thumb .profile { display: block; width: 100%; height: 46px; }
.rd-stats { display: grid; grid-template-columns: repeat(var(--n, 8), 1fr); margin: 18px 0 16px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.rd-stats .stat { padding: 11px 14px; }
.rd-stats .stat:first-child { border-left: none; padding-left: 0; }
.rd-stats .stat .v { font-size: 36px; }
.rd-stats .stat .v small, .rd-best .v small { font-size: 18px; font-weight: 750; margin-left: 2px; }
.rd-charts { padding: 14px 18px 10px; }
.rd-chhead { display: flex; justify-content: space-between; align-items: center; min-height: 30px; margin-bottom: 6px; gap: 12px; }
.rd-hint { font-size: 13px; color: var(--muted); }
.rd-sel { display: none; align-items: center; gap: 6px 12px; flex-wrap: wrap; font-size: 14px; }
.rd-sel.on { display: flex; }
.rd-sel b { font-weight: 700; }
.rd-sel .num { font-family: var(--num); font-stretch: 68%; font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 800; }
.rd-wrap { position: relative; touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.rd-chart { display: block; width: 100%; overflow: visible; font-family: var(--num); }
.rd-chart .rd-lane { font-family: "Archivo", system-ui, sans-serif; font-stretch: 100%; font-size: 12px; font-weight: 650; fill: var(--muted); }
.rd-chart .rd-lane tspan { font-weight: 400; }
.rd-chart .rd-tick { font-size: 11.5px; font-stretch: 80%; fill: var(--muted); }
.rd-chart .rd-strip rect { cursor: pointer; }
.rd-tip { position: absolute; top: 0; left: 0; z-index: 3; padding: 8px 12px 9px; border-radius: 6px; background: var(--ink); color: var(--sheet);
  white-space: nowrap; font-size: 13px; line-height: 1.35; pointer-events: none; opacity: 0; transition: opacity .12s; box-shadow: 0 8px 18px -8px rgba(0,0,0,.45); }
.rd-tip.on { opacity: 1; }
.rd-tip .pt-row { font-variant-numeric: tabular-nums; font-weight: 650; }
.rd-tip .pt-row span { color: var(--inv-muted); font-weight: 500; }
.rd-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 14px; margin-top: 14px; }
.rd-grid:has(> :only-child) { grid-template-columns: 1fr; }
.rd-sum { margin: 0 0 14px; }
/* side by side the taller card sets the row height: the zone rows spread out to fill the zones card */
.rd-sum > .card { display: flex; flex-direction: column; }
.rd-sum .zbars { flex: 1; grid-auto-rows: 1fr; }
.rd-grid .card { padding: 16px 18px; }
.rd-grid .card h3 .muted { font-weight: 400; font-size: 13px; margin-left: 6px; }
.rd-grid .zbars { margin-bottom: 0; }
#rd-ints td, #rd-ints th { padding: 7px 6px; }
#rd-ints .r { text-align: right; }
#rd-ints .num { font-family: var(--num); font-stretch: 80%; font-variant-numeric: tabular-nums; }
#rd-ints tr.rec td { color: var(--muted); }
#rd-ints tr[data-i] { cursor: pointer; }
@media (hover: hover) { #rd-ints tr[data-i]:hover td { background: var(--sheet2); } }
#rd-ints tr.sel td, #rd-ints tr.sel:hover td { background: var(--ink); color: var(--sheet); }
#rd-ints tr.sel .pct, #rd-ints tr.sel .cadin { color: inherit; }
#rd-ints .zdot { display: inline-block; width: 4px; height: 15px; border-radius: 2px; vertical-align: -3px; margin-right: 8px; }
#rd-ints .cadin { color: var(--muted); font-size: 12.5px; margin-left: 5px; font-family: "Archivo", system-ui, sans-serif; font-stretch: 100%; }
.rd-best { display: grid; grid-template-columns: repeat(4, 1fr); }
.rd-best > div { padding: 2px 12px; border-left: 1px solid var(--rule); }
.rd-best > div:first-child { border-left: none; padding-left: 0; }
.rd-best .v { font-family: var(--num); font-stretch: 68%; font-variant-numeric: tabular-nums; font-size: 30px; font-weight: 850; line-height: 1.05; }
.rd-best .l { font-size: 13px; color: var(--muted); }
.rd-best .sub { font-size: 12px; color: var(--muted); }
.rd-best .pr { color: var(--good); font-weight: 700; }
.rd-curve { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--rule); }
.rd-ckey { display: flex; justify-content: flex-end; gap: 14px; font-size: 12px; color: var(--muted); }
.rd-ckey span { display: inline-flex; align-items: center; gap: 6px; }
.rd-ckey i { display: inline-block; width: 14px; }
.rd-ckey .k-ride { height: 2.5px; border-radius: 2px; background: var(--z5); }
.rd-ckey .k-90 { height: 1.5px; background: color-mix(in srgb, var(--ink) 50%, var(--sheet)); }
.rd-ckey .k-all { border-top: 1.5px dashed var(--muted); }
.rd-curve svg { display: block; width: 100%; height: auto; overflow: visible; }
.rd-curve polyline { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.rd-curve .c-ride { stroke: var(--z5); stroke-width: 2.5; }
.rd-curve .c-90 { stroke: color-mix(in srgb, var(--ink) 50%, var(--sheet)); stroke-width: 1.5; }
.rd-curve .c-all { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 4; }
.rd-curve .c-fill { fill: url(#rd-pc-fill); }
.rd-curve .c-f0 { stop-color: var(--z5); stop-opacity: .22; }
.rd-curve .c-f1 { stop-color: var(--z5); stop-opacity: 0; }
.rd-curve .c-base { stroke: var(--rule); }
.rd-curve .c-dot { fill: var(--z5); stroke: var(--sheet); stroke-width: 1.5; }
.rd-curve .c-val { font-family: var(--num); font-stretch: 80%; font-size: 12px; font-weight: 700; fill: var(--ink); text-anchor: middle; }
.rd-curve .c-x { font-size: 11px; fill: var(--muted); text-anchor: middle; }
.rd-foot { display: none; }
/* end of ride: done bar on top of the ride page (green = done, like the workout complete card) */
.rd-done { background: var(--ok-bg); border-radius: var(--r); padding: 18px 20px; margin-bottom: 22px; }
.dn-main { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; }
.dn-check { width: 40px; height: 40px; align-self: start; }
.dn-check circle { fill: var(--good); }
.dn-check path { fill: none; stroke: var(--ok-bg); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.dn-h { font-size: 26px; letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 4px; }
.dn-eff { font-size: 15px; font-weight: 650; margin-bottom: 6px; }
#rd-ints .effn { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.dn-vs { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 15px; margin-bottom: 6px; }
.dn-vs-l { color: var(--muted); }
.dn-vs b { font-family: var(--num); font-stretch: 68%; font-weight: 850; font-size: 18px; font-variant-numeric: tabular-nums; }
.dn-vs b.up { color: var(--good); }
.dn-vs .was { color: var(--muted); }
.dn-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 14px; color: var(--muted); }
.dn-garmin { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 650; }
.dn-ico { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.dn-sync { display: inline-flex; align-items: center; gap: 6px; }
.dn-sync::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.dn-sync.ok::before { background: var(--good); }
.dn-sync.busy::before { background: var(--warn); animation: dn-pulse 1s ease-in-out infinite alternate; }
.dn-sync.err::before { background: var(--bad); }
@keyframes dn-pulse { to { opacity: .3; } }
.dn-btns { display: flex; gap: 8px; align-items: center; }
.dn-btns .primary { min-width: 120px; }
.dn-ftp { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin: 14px 0 0 56px; padding-top: 12px; border-top: 1px solid var(--rule); font-size: 14.5px; }
.dn-ftp-btns { display: flex; gap: 8px; flex: none; }
@media (prefers-reduced-motion: reduce) { .dn-sync.busy::before { animation: none; } }
#ride-table tr[data-ride] { cursor: pointer; }
@media (hover: hover) { #ride-table tr[data-ride]:hover td { background: var(--sheet2); } }
.cal-ride .cal-see { margin-left: 10px; padding: 3px 11px; font-size: 13px; vertical-align: 1px; color: var(--ink); }
.cal-see .see-ico { width: 14px; height: 14px; margin-right: 5px; vertical-align: -2px; }

/* ---------- summary ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); margin: 22px 0; background: var(--sheet); border-radius: var(--r); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.stat { padding: 12px 14px; border-left: 1px solid var(--rule); }
.stats > .stat:nth-child(4n+1) { border-left: none; }
.stat .v { font-size: 38px; font-weight: 850; line-height: 1.05; }
.stat .l { font-size: 13px; color: var(--muted); }
.info { position: absolute; top: 9px; right: 10px; z-index: 6; }
.info:hover, .info.open, .info:focus-within { z-index: 7; }
.info-btn { width: 17px; height: 17px; padding: 0; border-radius: 50%; border: 1.5px solid var(--muted); background: transparent; color: var(--muted);
  display: grid; place-items: center; cursor: help; }
.info-btn svg { width: 14px; height: 14px; fill: currentColor; display: block; }
.info:hover .info-btn, .info.open .info-btn, .info-btn:focus-visible { border-color: var(--ink); color: var(--ink); }
.tip { display: none; position: absolute; top: 24px; left: -8px; width: 280px; max-width: calc(100vw - 32px); padding: 10px 12px; border-radius: var(--r);
  background: var(--ink); color: var(--sheet); font-size: 13px; line-height: 1.45; font-weight: 400; text-align: left; box-shadow: 0 10px 28px var(--shadow); }
.tip b { font-weight: 700; }
.info:hover .tip, .info.open .tip, .info-btn:focus-visible + .tip { display: block; }

@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(3, 1fr); }
}

.sync-form { grid-template-columns: 1fr; }
.sync-actions { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; font-size: 13.5px; }
/* the account row (Settings > Sync): signed in as, Sign out / Sign in again, or Continue with Google; the import's rule
   below separates them */
.acct-row { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 13.5px; }
.import-intro { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--rule); }
#imp-btn.busy { opacity: .5; pointer-events: none; }

.t-val.combo { font-size: min(70px, 28cqi); padding: 8px 0 6px; white-space: nowrap; }
.gearviz { height: 26px; display: block; margin-bottom: 2px; max-width: 100%; }

/* ---------- today hero ----------
   Today's session as a dome in the color of its main effort (--c, the same
   zone color as the stripe on the next-days cards): lit from the top left,
   a sheen band across the top, fading into white at the bottom. Dark text on
   the zone color. Start is the big button; Free ride is the second choice.
   Days without a ride (strength, rest) are an ink card with Free ride as the
   main action. */
#today { margin-bottom: 16px; }
.hero { border-radius: 16px; padding: 26px 30px 22px; color: var(--on-zone);
  background:
    linear-gradient(180deg, rgba(255,255,255,.32) 0%, rgba(255,255,255,0) 22%),
    radial-gradient(110% 120% at 15% 0%, color-mix(in oklab, var(--c), #fff 30%) 0%, var(--c) 26%, color-mix(in oklab, var(--c), var(--today-end) 45%) 42%, color-mix(in oklab, var(--c), var(--today-end) 88%) 56%, var(--today-end) 70%);
  box-shadow: var(--hero-shadow); } /* no lift shadow (Agustín, Nov 13): a thin bright rim, the cards' soft shadow in light */
:root[data-theme="dark"] .hero:not(.nowo):not(.done) { /* fade later so dark text stays on the zone color */
  background:
    linear-gradient(180deg, rgba(255,255,255,.32) 0%, rgba(255,255,255,0) 22%),
    radial-gradient(110% 130% at 15% 0%, color-mix(in oklab, var(--c), #fff 30%) 0%, var(--c) 36%, color-mix(in oklab, var(--c), var(--today-end) 45%) 52%, color-mix(in oklab, var(--c), var(--today-end) 88%) 64%, var(--today-end) 76%); }
.hero-main { display: flex; flex-wrap: wrap; gap: 18px 32px; align-items: flex-start; }
.hero-text { flex: 1 1 420px; min-width: 0; }
.hero-top { display: flex; gap: 8px; font-size: 15px; font-weight: 650; color: color-mix(in oklab, var(--on-zone), transparent 28%); }
.hero-top b { color: var(--on-zone); font-weight: 750; }
.hero-top span::before { content: "\00b7"; margin-right: 8px; }
.hero-name { margin: 6px 0 0; font-size: 40px; line-height: 1.05; font-weight: 650; letter-spacing: -0.025em; }
.hero-name .tag { font-size: 13px; vertical-align: 10px; letter-spacing: 0; }
.hero-meta { margin-top: 6px; font-family: var(--num); font-stretch: 68%; font-weight: 800; font-size: 21px; font-variant-numeric: tabular-nums; color: color-mix(in oklab, var(--on-zone), transparent 22%); }
/* the main set as big numbers (premium look); they replace the meta line */
.hero.has-nums .hero-meta { display: none; }
.hero-nums { display: flex; align-items: flex-end; gap: 34px; margin-top: 16px; }
.hn { display: flex; flex-direction: column; gap: 3px; }
.hn .v { font-size: 32px; line-height: .95; color: var(--on-zone); }
.hn.main .v { font-size: 56px; line-height: .9; }
.hn .v small { font-family: Archivo, system-ui, sans-serif; font-size: 15px; font-weight: 500; letter-spacing: 0; margin-left: 4px; color: color-mix(in oklab, var(--on-zone), transparent 28%); }
.hn.main .v small { font-size: 18px; }
.hn .l { font-size: 14px; font-weight: 500; color: color-mix(in oklab, var(--on-zone), transparent 28%); }
.hero-desc { margin: 14px 0 0; font-size: 15px; line-height: 1.45; max-width: 64ch; color: color-mix(in oklab, var(--on-zone), transparent 18%);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hero-desc b { color: var(--on-zone); }
/* a ride already done today (free ride on a workout day): a sheet pill, so it reads on any dome color in both themes */
.hero-done { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 3px 3px 3px 12px; border-radius: 999px;
  background: var(--sheet); color: var(--ink); font-size: 14px; font-weight: 700; box-shadow: 0 1px 2px var(--shadow); }
.hero-done .ck { color: var(--good); font-weight: 900; }
.hero-done-see { margin-left: 6px; padding: 3px 12px; font-size: 13px; font-weight: 650; color: var(--ink); border-color: var(--rule); }
.hero-done-see:hover { border-color: var(--ink); background: rgba(127, 127, 127, .14); }
/* a day with several sessions (launch session 9): the other entries under the hero, each a sheet row (reads on any
   dome color and on the done sheet), a dot in its zone color, its own Start or Done + See ride; strength a plain row */
.hero-more { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.hm-head { font-size: 13px; font-weight: 700; letter-spacing: .02em; color: color-mix(in oklab, var(--on-zone), transparent 28%); }
.hero.done .hm-head { color: var(--muted); }
.hm-row { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 14px; border-radius: 14px; background: var(--sheet); color: var(--ink); box-shadow: 0 1px 2px var(--shadow); }
.hero.done .hm-row { background: var(--sheet2); box-shadow: none; }
.hm-dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--c); }
.hm-row.plain .hm-dot { background: transparent; box-shadow: inset 0 0 0 2px var(--muted); }
.hm-text { flex: 1 1 auto; min-width: 0; }
.hm-name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.hm-meta { font-size: 13px; color: var(--muted); }
.hm-done { font-size: 13.5px; font-weight: 700; white-space: nowrap; }
.hm-done .ck { color: var(--good); font-weight: 900; }
.hm-start, .hm-see { flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; font-size: 14px; }
.hm-start .play-ico { width: 11px; height: 12px; fill: currentColor; }
.hm-start.focus, .hm-see.focus { outline: 2px solid var(--ink); outline-offset: 3px; }
.stat .v .none { color: var(--muted); }
.hero-btns { flex: 0 0 280px; display: flex; flex-direction: column; gap: 10px; }
.hero-btns button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; font-weight: 750; letter-spacing: -0.01em; }
.hero-start { height: 64px; font-size: 20px; }
.hero-free { height: 48px; font-size: 15px; }
/* secondary buttons: filled, no outline, on the zone color and on the done sheet */
.hero:not(.nowo):not(.done) .ghost, .hero.done .ghost { background: var(--sheet2); border-color: transparent; color: var(--ink); }
.hero:not(.nowo):not(.done) .ghost:hover { background: var(--sheet); border-color: transparent; }
.hero-btns button.focus { outline: 2px solid var(--ink); outline-offset: 3px; }
.play-ico { width: 15px; height: 17px; fill: currentColor; flex: none; }
/* Start workout launch (launchFrom() in js/app.js): the pill clips the melting letters and the sprinting icon */
.hero-btns button.launching { position: relative; overflow: hidden; }
.lz-fx { position: absolute; pointer-events: none; }
.lz-dust { border-radius: 50%; background: currentColor; filter: blur(.4px); }
.lz-line { height: 2px; border-radius: 1px; background: currentColor; transform-origin: 100% 50%; }
.hero-free.pedal .bike-ico .crank { animation-play-state: running; animation-duration: .4s; }
.hero-start .play-ico { transform-origin: 50% 60%; }
.hs-label { display: inline-block; line-height: 1; }
/* while launching, the label's bottom edge (just under the letters) hides anything that falls past it; the wave can rise above */
.hero-start.launching .hs-label { clip-path: inset(-1em -0.5em 0.06em -0.5em); }
.hs-label i { display: inline-block; font-style: normal; }
.launch-cover { position: fixed; inset: 0; z-index: 9999; pointer-events: all; will-change: clip-path; }
.hero-free .bike-ico { width: 28px; height: 17px; }
/* top-bar icons come alive on hover (Nov 12, Agustín), same springy curve as the Garage bicycle:
   link = the two halves snap together and the status dots wave, gamepad = a short rumble,
   light/dark = the half-filled circle turns over (a preview of the switch), gear = turns a third */
#btn-devices svg path, #btn-settings svg, #btn-controls svg { transform-box: fill-box; transform-origin: center; }
#btn-theme::before, .theme-btn::before { transition: transform .5s cubic-bezier(.3, 1.6, .5, 1); }
#btn-settings svg { transition: transform .6s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes link-snap-a { 0%, 100% { transform: none; } 35% { transform: translate(1.6px, -1.6px); } 65% { transform: translate(-.6px, .6px); } }
@keyframes link-snap-b { 0%, 100% { transform: none; } 35% { transform: translate(-1.6px, 1.6px); } 65% { transform: translate(.6px, -.6px); } }
@keyframes dot-wave { 0%, 100% { transform: none; } 40% { transform: translateY(-3px); } }
@keyframes pad-rumble { 0%, 100% { transform: none; } 15% { transform: rotate(-9deg); } 35% { transform: rotate(8deg); } 55% { transform: rotate(-5deg); } 75% { transform: rotate(3deg); } }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  #btn-devices:hover svg path:first-child { animation: link-snap-a .5s cubic-bezier(.3, 1.3, .5, 1); }
  #btn-devices:hover svg path:last-child { animation: link-snap-b .5s cubic-bezier(.3, 1.3, .5, 1); }
  #btn-devices:hover .ldots i:not(.wait) { animation: dot-wave .45s ease-in-out; }
  #btn-devices:hover .ldots i:nth-child(2):not(.wait) { animation-delay: .07s; }
  #btn-devices:hover .ldots i:nth-child(3):not(.wait) { animation-delay: .14s; }
  #btn-controls:hover svg { animation: pad-rumble .5s ease-in-out; }
  #btn-theme:hover::before, .theme-btn:hover::before { transform: rotate(180deg); }
  #btn-settings:hover svg { transform: rotate(120deg); }
}
/* top-bar Garage button: the Free ride bicycle; it pedals on hover like the Free ride button */
.icon-btn .bike-ico { width: 28px; height: 17px; transition: transform .4s cubic-bezier(.3, 1.6, .5, 1); }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  #btn-garage:hover .bike-ico { transform: translateY(-1px) rotate(-12deg); }
  #btn-garage:hover .bike-ico .crank { animation-play-state: running; }
}
.hero-prof { height: 120px; margin-top: 24px; }
.hero-prof .profile { height: 100%; display: block; }
/* Hover readout on today's profile: the interval under the pointer stays full color, the rest fades,
   and an ink tag above it gives watts and time. */
/* elevation profile (slope-only workouts): ink line along the top of the road */
.profile .prof-line { fill: none; stroke: var(--ink); stroke-opacity: .55; stroke-width: 1.25; vector-effect: non-scaling-stroke; stroke-linejoin: round; pointer-events: none; }
.prof-hover { position: relative; touch-action: pan-y; }
.prof-hover .profile [data-i] { transition: opacity .15s; cursor: crosshair; }
.prof-hover.hov .profile [data-i] { opacity: .35; }
.prof-hover.hov .profile [data-i].on { opacity: 1; }
.prof-tip { position: absolute; bottom: calc(100% + 8px); left: 0; transform: translateX(-50%); z-index: 3;
  padding: 8px 12px 9px; border-radius: 6px; background: var(--ink); color: var(--sheet); white-space: nowrap;
  font-size: 13px; line-height: 1.35; pointer-events: none; opacity: 0; transition: opacity .12s;
  box-shadow: 0 8px 18px -8px rgba(0,0,0,.45); }
.prof-hover.hov .prof-tip { opacity: 1; }
.prof-tip .pt-lbl, .rd-tip .pt-lbl { font-weight: 700; color: var(--inv-muted); }
.prof-tip .pt-tgt, .rd-tip .pt-tgt { font-family: var(--num); font-stretch: 68%; font-weight: 800; font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.prof-tip .pt-tgt span, .rd-tip .pt-tgt span { font-size: 16px; color: var(--inv-muted); }
.prof-tip .pt-time { font-variant-numeric: tabular-nums; font-weight: 650; }
.prof-tip .pt-time span { color: var(--inv-muted); font-weight: 500; }
@media (prefers-reduced-motion: reduce) { .prof-hover .profile [data-i], .prof-tip { transition: none; } }
.hero-coach { display: flex; align-items: center; margin-top: 14px; font-size: 15px; line-height: 1.45; color: var(--muted); }
.hero-coach > span { flex: 1 1 220px; min-width: 0; }
.hero-coach .tag { margin-right: 6px; }
.hero.nowo { color: var(--sheet); background: linear-gradient(180deg, rgba(255,255,255,.12) 0%, rgba(255,255,255,0) 22%), var(--ink); }
.hero.nowo .hero-top, .hero.nowo .hero-desc, .hero.nowo .hero-coach { color: var(--inv-muted); }
.hero.nowo .hero-top b, .hero.nowo .hero-name { color: var(--sheet); }
.hero.nowo .primary { background: var(--sheet); border-color: var(--sheet); color: var(--ink); }
.hero.nowo .primary:hover { background: var(--hi); }
.hero.nowo .hero-btns { align-self: center; }

/* Done today: the dome steps back to a sheet with a faint tint of the day's zone color.
   The headline is the result, the numbers are the ride's own; Next days below shows what's next. */
.hero.done { color: var(--ink); padding: 22px 28px 20px;
  background: radial-gradient(60% 160% at 0% 0%, color-mix(in oklab, var(--c), var(--sheet) 78%) 0%, var(--sheet) 70%);
  box-shadow: 0 6px 16px -8px var(--shadow), 0 1px 2px var(--shadow); }
.hero.done .hero-top { color: var(--muted); flex-wrap: wrap; }
.hero.done .hero-top b { color: var(--ink); }
.hero.done .hero-name { display: flex; align-items: center; gap: 12px; margin-top: 8px; font-size: 32px; line-height: 1.1; }
.hero.done .hero-name .ok { color: var(--good); }
.done-ico { width: 32px; height: 32px; flex: none; }
.done-ico circle { fill: var(--good); }
.done-ico path { fill: none; stroke: var(--sheet); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.hero.done .hero-desc { color: var(--muted); }
.hero.done .hero-btns { flex-basis: 220px; gap: 8px; }
.hero.done .hero-btns button { height: 46px; font-size: 15px; gap: 8px; }
.hero.done .hero-see { border-color: var(--ink); }
.see-ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.hero-stats { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--rule); }
.hs + .hs { border-left: 1px solid var(--rule); padding-left: 16px; }
.hs .v { font-family: var(--num); font-stretch: 68%; font-weight: 800; font-size: 30px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.hs .v.ok { color: var(--good); }
.hs .v.warn { color: var(--warn); }
.hs .l { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hs .l b { color: var(--ink); font-weight: 650; }
.hero.done .hero-prof { height: 36px; margin-top: 16px; }

#ride-table tr.flash td { animation: flash 2.4s ease-out; }
@media (prefers-reduced-motion: reduce) { #ride-table tr.flash td { animation: none; background: var(--flash); } }

/* ---------- week carousel ---------- */
.week { margin-bottom: 18px; }
.week-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.eyebrow { font-size: 17px; font-weight: 650; letter-spacing: -0.02em; color: var(--ink); margin: 0; }
.week-strip { display: flex; align-items: stretch; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  /* room around the cards so a hovered card can grow without being clipped by the scroller; the negative margin keeps the layout where it was */
  padding: 6px 8px 8px; margin: -4px -8px -4px; scroll-padding-inline: 8px; }
.week-strip::-webkit-scrollbar { display: none; } /* arrows + trackpad scroll it; no bar */
/* seven days fill the row on a wide screen; the arrows page to week two */
/* round cards with the zone bar on the left (Agustín, Nov 13: like the calendar chips); no bar on strength / rest */
.day { flex: 0 0 calc((100% - 48px) / 7); scroll-snap-align: start; position: relative; background: var(--sheet); border-radius: 14px; padding: 13px 15px 13px 26px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-height: 96px; box-shadow: var(--card-shadow); outline: none; }
.day::before { content: ""; position: absolute; left: 12px; top: 13px; bottom: 13px; width: 4px; border-radius: 2px; background: var(--c); }
.day:hover { background: var(--hi); }
.day.nowo { padding-left: 15px; box-shadow: none; }
.day.nowo, .day.nowo:hover { background: color-mix(in srgb, var(--sheet) 55%, transparent); }
.day.nowo::before { display: none; }
.day.past:not(.done) { opacity: .5; }
.day.focus { outline: 2px solid var(--ink); outline-offset: 2px; }
/* Next days cards grow a little on hover / controller focus, same springy curve as the hero buttons */
@media (prefers-reduced-motion: no-preference) {
  .day { transition: background .12s, transform .4s cubic-bezier(.3, 1.6, .5, 1); }
  .day.focus { transform: scale(1.05); }
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .day:hover { transform: scale(1.05); }
  .day:hover:active { transform: scale(1.02); transition-duration: .12s; }
}
.d-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); font-weight: 600; padding-top: 4px; }
.d-dow { color: var(--ink); font-weight: 750; }
.d-name { font-weight: 700; font-size: 14.5px; line-height: 1.2; margin-top: 2px; }
.d-name.muted { font-weight: 500; }
.d-meta { font-size: 13px; color: var(--muted); }
.d-meta .n { font-size: 16px; color: var(--ink); }
.d-done { font-size: 13px; color: var(--good); font-weight: 650; }
.d-missed { font-size: 13px; color: var(--muted); }
/* a day with several sessions: each entry stacked, a ridden one faded; the day's state under them */
.d-entry + .d-entry { margin-top: 4px; }
.d-entry.ridden { opacity: .55; }
.week-head button { border: none; background: var(--sheet2); }
.week-head button:disabled { cursor: default; color: var(--faint); background: transparent; }
/* plan source notice (public copy / coach plan failed to load) */
.plan-src { margin: 0 2px 10px; padding: 9px 14px; border-radius: var(--r); background: var(--sheet); border-left: 4px solid var(--warn); color: var(--muted); font-size: 14px; line-height: 1.45; }
.plan-src b { color: var(--ink); }
a[data-open-settings] { color: var(--ink); font-weight: 650; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }

/* ---------- calendar ---------- */
/* one month card with a round title row; zone-bar chips, today as a circle, the selected day as an ink ring */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cal-head h3 { order: -1; flex: 0 0 auto; min-width: 0; margin: 0 auto 0 0; text-align: left; font-size: 28px; font-weight: 650; letter-spacing: -0.022em; }
.cal-head button { width: 38px; height: 38px; padding: 0; border: none; background: var(--sheet2); font-size: 20px; display: inline-flex; align-items: center; justify-content: center; }
.cal-head #cal-today { width: auto; padding: 0 16px; font-size: 14px; }
.cal-layout { display: grid; grid-template-columns: 1fr 360px; gap: 18px; align-items: start; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; background: var(--sheet); border-radius: 16px; padding: 14px 12px 12px; box-shadow: var(--card-shadow); }
.cal-dow { font-size: 13px; color: var(--muted); font-weight: 600; padding: 0 8px 8px; }
.cal-cell { background: transparent; border-radius: 14px; min-height: 100px; padding: 7px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.cal-cell:hover, .cal-cell.sel:hover { background: var(--sheet2); }
.cal-cell.other .cal-num, .cal-cell.other .cal-done { color: var(--muted); } /* other month: readable text, faded chips */
.cal-cell.other .cal-chip { opacity: .38; }
.cal-cell.today .cal-num { background: var(--ink); color: var(--sheet); border-radius: 14px; padding: 0; align-self: flex-start; }
.cal-cell.sel { box-shadow: inset 0 0 0 2px var(--ink); }
.cal-num { font-size: 16px; font-weight: 800; height: 28px; min-width: 28px; display: flex; align-items: center; justify-content: center; align-self: flex-start; }
.cal-chip { font-size: 12px; line-height: 1.25; padding: 3px 6px; border-radius: 3px; background: var(--paper); border-left: 4px solid var(--c); display: flex; justify-content: space-between; gap: 4px; font-weight: 600; }
.cal-chip span { color: var(--muted); white-space: nowrap; font-weight: 500; }
.cal-chip.ghost { border-left-color: transparent; color: var(--muted); background: transparent; padding-left: 2px; font-weight: 500; }
.cal-done { font-size: 12px; color: var(--good); font-weight: 650; }
.cal-missed { font-size: 12px; color: var(--muted); }
.cal-detail { background: radial-gradient(80% 45% at 0% 0%, color-mix(in srgb, var(--c, transparent) 18%, transparent), transparent 70%), var(--sheet); } /* a soft glow in the day's color */
.cal-detail h3 { font-size: 14px; font-weight: 600; color: var(--muted); }
.cal-detail .wo-name { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; }
.cal-detail .wo-meta .n { font-size: 16px; }
.cal-detail p { font-size: 14px; line-height: 1.5; }
.cal-prof { margin-top: 8px; } /* profile of the selected day: same hover/tap readout as the today hero */
.cal-ride { font-size: 13.5px; padding: 8px 0; border-top: 1px solid var(--rule); color: var(--good); }
.cal-ride b { color: var(--ink); }
/* Calendar day whose planned workout was ridden: result first (same stat row as the done hero) */
.cal-done-head { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.cal-done-head .done-ico { width: 26px; height: 26px; }
.cal-done-name { font-size: 20px; font-weight: 750; line-height: 1.2; }
.cal-done-name .ok { color: var(--good); }
.cal-done-sub { font-size: 14px; color: var(--muted); margin-top: 2px; }
.cal-stats { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 10px; margin-top: 14px; padding-top: 12px; }
.cal-stats .hs .v { font-size: 26px; }
.cal-stats .hs + .hs { padding-left: 12px; }
.cal-stats .hs:nth-child(3n + 1) { border-left: 0; padding-left: 0; }
.cal-stats .wide-only { display: none; }
.cal-done-wo .cal-prof { margin-top: 14px; }
.cal-see-main { margin-top: 12px; }
.cal-see-main .see-ico { width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px; }
.cal-missed-line { color: var(--muted); }
/* name with duration / TSS under it (the narrow detail column made the meta wrap to a right-aligned line of its own) */
.cal-wo .wo-top { display: block; }
.cal-wo .wo-top .wo-meta { width: auto; text-align: left; margin-top: 2px; color: var(--muted); }
/* a day with several sessions: each ride its own block, a rule between them */
.cal-wo + .cal-wo, .cal-strength + .cal-wo, .cal-wo + .cal-strength { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--rule); }

/* ERG: gears, grade and speed are irrelevant (speed + distance sit in the Elapsed card as #r-trip).
   The three cards are a compact group centered under the interval card: HR | Power | Cadence (Nov 10, Agustín). */
.tiles.erg { grid-template-columns: clamp(196px, 15vw, 260px) clamp(300px, 23vw, 400px) clamp(196px, 15vw, 260px); width: fit-content; margin: 0 auto; }
.tiles.erg .tile.gear, .tiles.erg .tile.climb, .tiles.erg .tile.speed { display: none; }
.tiles.erg .tile.hr { order: 1; border-left: none; border-radius: var(--r) 0 0 var(--r); }
.tiles.erg .tile.power { order: 2; border-left: 1px solid var(--rule); border-radius: 0; text-align: center; }
.tiles.erg .tile.cad { order: 3; border-radius: 0 var(--r) var(--r) 0; }
.tiles.erg .tile.power .t-label { text-align: left; }
.tiles.erg .t-val { font-size: min(76px, 36cqi); }
.tiles.erg .tile.power .t-val { font-size: min(96px, 26cqi); } /* stays a notch below the interval card's numbers */

/* ---------- segment list ---------- */
.segs { display: none; background: var(--sheet); border-radius: var(--r); min-height: 0; overflow: hidden; flex-direction: column; }
.ride-body.with-segs .segs { display: flex; }
.seg-rows { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 6px; scrollbar-width: none; }
.seg-rows::-webkit-scrollbar { display: none; }
#r-segs .seg-head { flex: none; box-shadow: 0 1px 0 var(--rule); padding: 9px 14px; gap: 10px; align-items: baseline; }
#r-segs .seg-head .wname { color: var(--ink); font-weight: 750; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#r-segs .seg-head .cnt { flex: none; font-variant-numeric: tabular-nums; }
.seg-foot { flex: none; font-size: 14px; color: var(--muted); font-weight: 600; padding: 8px 14px; display: flex; justify-content: space-between; align-items: baseline; box-shadow: 0 -1px 0 var(--rule); }
.seg-foot b { color: var(--ink); font-size: 24px; font-weight: 850; font-family: var(--num); font-stretch: 68%; font-variant-numeric: tabular-nums; }
#r-segs .seg-name { white-space: nowrap; min-width: 0; }
.seg { position: relative; display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px 10px 8px 12px; border-radius: 4px; border-left: 5px solid var(--c); margin-bottom: 3px; background: var(--paper); overflow: hidden; }
.seg.todo { background: transparent; box-shadow: inset 0 -1px 0 var(--rule); border-radius: 0; }
.seg.done { opacity: .55; }
.seg.current { background: var(--ink); color: var(--sheet); }
.seg.current .muted, .seg.current .seg-tgt { color: var(--inv-muted); }
.seg-name { font-weight: 650; font-size: 14px; display: flex; gap: 6px; align-items: center; }
.seg-tgt { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.seg-r { text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.seg-r .big { font-size: 18px; font-weight: 750; }
.seg-r .muted { font-size: 12.5px; }
.seg .check { color: var(--good); font-weight: 700; }
.seg .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--c); transform: scaleX(0); transform-origin: left; transition: transform .3s linear; will-change: transform; } /* scaled, not resized, and eased between the 4 Hz ticks (writeSegRows) */
.seg-head { font-size: 14px; color: var(--muted); font-weight: 600; padding: 8px 8px 8px; display: flex; justify-content: space-between; }

/* cadence target; a slope step's power aim looks the same on the power tile (Nov 20) */
.tile.cad, .tile.power { transition: background .2s, box-shadow .2s; }
.tile.cad.ok, .tile.power.aim-ok { background: var(--ok-bg); box-shadow: inset 0 -7px 0 var(--good); }
.tile.cad.ok .t-val, .tile.power.aim-ok .t-val { color: var(--ok-ink); }
.tile.cad.bad, .tile.power.aim-bad { background: var(--bad-bg); box-shadow: inset 0 0 0 3px var(--bad); animation: cadpulse 0.9s ease-in-out infinite; }
.tile.cad.bad .t-val, .tile.cad.bad .t-sub b, .tile.power.aim-bad .t-val, .tile.power.aim-bad .t-sub b { color: var(--bad); }
@keyframes cadpulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }
.cad-chip { font-size: 12px; font-weight: 650; padding: 0 6px; border-radius: 3px; border: 1px solid currentColor; color: var(--info); margin-left: 6px; white-space: nowrap; line-height: 1.5; }
.seg.current .cad-chip { color: var(--inv-info); }
.seg.erg { padding-top: 9px; padding-bottom: 9px; }
.seg.erg .big { font-size: 19px; font-weight: 750; }

/* ERG effort: shown only when it isn't 100% (UX roadmap item 7); a status, not a button */
.t-pct { position: absolute; top: 12px; right: 16px; font-size: 20px; font-weight: 800; padding: 1px 10px; border-radius: 4px; color: var(--sheet); background: var(--ink); }

/* the daily coach's call (Calendar day detail; hero line via .hero-coach) */
.coach-call { margin: 8px 2px 0; font-size: 14.5px; line-height: 1.5; color: var(--ink); }
.coach-call .tag { margin-right: 6px; }

@media (prefers-reduced-motion: reduce) {
  .tile.cad.bad, .tile.power.aim-bad, .rp-m.bad, .rp-power.bad, .device.connecting .dot, .ldots i.wait { animation: none !important; }
  * { transition: none !important; }
}

/* ---------- workout builder (js/builder.js): a wide panel, live profile on top ---------- */
.mine-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.mine-head .list-sub { flex: 1; margin: 0; }
.mine-head #btn-new-wo { flex: none; }
.mine-empty { padding: 18px 0 6px; }
.panel.builder { width: 880px; padding-bottom: 0; display: flex; flex-direction: column; }
.panel.builder .panel-head { margin-bottom: 10px; }
.b-name { width: 100%; font-size: 22px; font-weight: 750; letter-spacing: -0.01em; background: transparent; border: none; border-bottom: 1.5px solid var(--rule); border-radius: 0; padding: 4px 0 6px; }
.b-name:focus { outline: none; border-bottom-color: var(--ink); }
.b-meta { display: flex; gap: 6px 14px; align-items: baseline; flex-wrap: wrap; margin-top: 8px; font-size: 13.5px; min-height: 22px; }
.b-selinfo { color: var(--muted); font-variant-numeric: tabular-nums; }
/* palette: tiles you drag onto the timeline (tap adds too). The bin covers it while a block is dragged. */
.b-pal-row { display: flex; align-items: center; gap: 12px; margin: 14px 0 8px; }
.b-pal-row .b-kind { margin-bottom: 0; background: var(--paper); }
.b-pal-hint { font-size: 13px; }
.b-undo { margin-left: auto; }
.b-undo:disabled { opacity: .3; cursor: default; background: transparent; }
.b-pal-wrap { position: relative; margin-bottom: 12px; }
.b-pal { display: flex; gap: 8px; flex-wrap: wrap; }
.b-tile { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px 7px 9px; border-radius: var(--r); border: 1.5px solid var(--rule); background: var(--sheet); font-size: 13.5px; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.b-tile svg { color: var(--muted); }
.b-tile:hover svg { color: var(--ink); }
.b-trash { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1.5px dashed var(--bad-line); border-radius: var(--r); background: var(--sheet); color: var(--bad); font-weight: 650; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .12s, background .12s; }
.b-trash.on { opacity: 1; }
.b-trash.hot { background: var(--bad-bg); border-color: var(--bad); }
/* timeline: bars on the same 0-150% FTP scale as the library profiles, dashed line at FTP */
.b-tl { position: relative; height: 150px; overflow-x: auto; overflow-y: hidden; border-bottom: 1.5px solid var(--ink); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  background: linear-gradient(to top, transparent calc(100% / 1.5 - 1px), var(--ftp-line) calc(100% / 1.5 - 1px), var(--ftp-line) calc(100% / 1.5), transparent calc(100% / 1.5)); }
.tl-in { position: relative; display: flex; align-items: stretch; height: 100%; min-width: 100%; width: max-content; }
.tl-b, .tl-c { position: relative; flex: none; height: 100%; cursor: grab; }
.tl-b + .tl-b { margin-left: 1px; }
.tl-bar { position: absolute; inset: 0; transition: opacity .15s; }
.tl-b:hover > .tl-bar, .tl-c:hover > .tl-bar { filter: brightness(1.08); }
.tl-b.sel > .tl-bar, .tl-c.sel > .tl-bar { box-shadow: inset 0 0 0 2px var(--ink); }
.b-tl:has(.sel) .tl-bar { opacity: .45; }
.b-tl:has(.sel) .sel > .tl-bar, .b-tl .tl-rep.sel .tl-bar { opacity: 1; }
.tl-b.dragging, .tl-c.dragging { opacity: .25; }
.tl-rep { display: flex; flex-direction: column; }
.tl-rep-in { position: relative; display: flex; flex: 1; gap: 0; }
.tl-rep-k { position: absolute; z-index: 2; top: 3px; left: 3px; padding: 0 6px; border-radius: 3px; background: var(--ink); color: var(--sheet); font-size: 11.5px; font-weight: 750; line-height: 18px; cursor: grab; white-space: nowrap; }
.tl-rep::before { content: ""; position: absolute; z-index: 1; left: 0; right: 0; top: 0; height: 3px; background: var(--ink); opacity: .55; }
.tl-rep.sel::before { opacity: 1; }
.tl-empty { margin: auto; font-size: 14px; }
.tl-mark { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; background: var(--ink); border-radius: 2px; z-index: 3; pointer-events: none; }
.tl-mark.inner { top: 22px; }
.tl-mark::before { content: ""; position: absolute; top: -1px; left: -4px; border: 5.5px solid transparent; border-top-color: var(--ink); }
/* edges of the selected block: top = power / grade, right = length */
.tl-h { position: absolute; z-index: 4; touch-action: none; }
.tl-hy { left: 0; right: 0; height: 18px; transform: translateY(50%); cursor: ns-resize; }
.tl-hy::after { content: ""; position: absolute; left: 50%; top: 50%; width: 22px; height: 6px; margin: -3px 0 0 -11px; border-radius: 3px; background: var(--ink); box-shadow: 0 0 0 2px var(--sheet); }
.tl-hy[data-h="from"], .tl-hy[data-h="to"] { right: auto; width: 22px; }
.tl-hy[data-h="to"] { left: auto; right: 0; }
.tl-hy[data-h="from"]::after, .tl-hy[data-h="to"]::after { width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; }
.tl-hx { top: 0; bottom: 0; right: -7px; width: 14px; cursor: ew-resize; }
.tl-hx::after { content: ""; position: absolute; left: 5px; top: 50%; width: 4px; height: 26px; margin-top: -13px; border-radius: 2px; background: var(--ink); box-shadow: 0 0 0 2px var(--sheet); }
.b-ghost { position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; padding: 5px 10px; margin: -44px 0 0 -20px; border-radius: var(--r); background: var(--ink); color: var(--sheet); font-size: 13px; font-weight: 650; white-space: nowrap; box-shadow: 0 8px 20px var(--shadow); }
body.b-dragging, body.b-dragging * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
body.b-drag-x, body.b-drag-x * { cursor: ew-resize !important; user-select: none; }
body.b-drag-y, body.b-drag-y * { cursor: ns-resize !important; user-select: none; }
.b-hint { font-size: 13.5px; margin: 4px 0; }
@media (prefers-reduced-motion: no-preference) {
  .b-pop > .tl-bar { animation: b-pop .35s cubic-bezier(.3, 1.6, .5, 1); transform-origin: bottom; }
}
@keyframes b-pop { from { transform: scaleY(.6); } }
.b-tot { font-family: var(--num); font-stretch: 68%; font-weight: 750; font-size: 17px; font-variant-numeric: tabular-nums; }
.b-cap { color: var(--warn); }
.b-steps { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 10px; }
.b-in { background: var(--paper); border: 1px solid var(--rule); border-radius: 4px; padding: 6px 8px; min-width: 0; font-size: 14px; }
.b-in:focus { border-color: var(--ink); outline: none; }
.b-in.bad, .b-in.bad:focus { border-color: var(--bad); background: var(--bad-bg); }
.b-step, .b-rep { border: 1px solid var(--rule); border-radius: var(--r); background: var(--sheet); padding: 8px 8px 8px 10px; transition: border-color .12s, box-shadow .12s; }
.b-step.sel, .b-rep.sel { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.b-line1 { display: flex; align-items: center; gap: 8px; }
.b-line2 { display: grid; grid-template-columns: 1fr 1.6fr; gap: 8px; margin: 6px 0 0 14px; }
.b-line2 .b-in { font-size: 13px; padding: 4px 8px; background: transparent; border-color: transparent; border-bottom-color: var(--rule); border-radius: 0; }
.b-line2 .b-in:focus { border-bottom-color: var(--ink); }
.b-line2 .b-msgs-k { grid-column: 1 / -1; font-size: 12px; margin: 6px 0 -6px 8px; }
.b-line2 .b-msgs { grid-column: 1 / -1; resize: vertical; line-height: 1.45; font-family: inherit; }
.b-sw { width: 6px; align-self: stretch; min-height: 30px; border-radius: 3px; flex: none; }
.b-type { width: 104px; flex: none; }
.b-len { display: inline-flex; flex: none; }
.b-dur { width: 70px; text-align: right; border-radius: 4px 0 0 4px; font-family: var(--num); font-stretch: 68%; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.b-unit { width: 48px; border-left: none; border-radius: 0 4px 4px 0; color: var(--muted); font-weight: 600; padding: 6px 0; }
.b-unit:hover { color: var(--ink); border-color: var(--rule); }
.b-tgt { display: inline-flex; align-items: center; gap: 5px; flex: 1; min-width: 0; }
.b-n { width: 58px; text-align: right; font-family: var(--num); font-stretch: 68%; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.b-u { font-size: 13px; color: var(--muted); }
.b-w { font-size: 13px; margin-left: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.b-cad { width: 66px; flex: none; text-align: right; }
.b-acts { display: inline-flex; gap: 2px; flex: none; margin-left: auto; }
.b-ico { padding: 6px; border: none; background: transparent; color: var(--muted); border-radius: 4px; line-height: 0; }
.b-ico:hover { color: var(--ink); background: var(--sheet2); }
.b-ico[data-act="del"]:hover { color: var(--bad); }
.brep-head { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.b-rep-k { font-weight: 750; }
.b-sum { font-family: var(--num); font-stretch: 68%; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.brep-body { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 2px 6px; padding-left: 10px; border-left: 2px solid var(--rule); }
.brep-body .b-step { background: var(--paper); }
.b-add-in { align-self: flex-start; }
.b-lab { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.b-desc { width: 100%; resize: vertical; font: inherit; font-size: 14px; background: var(--paper); border: 1px solid var(--rule); border-radius: 4px; padding: 8px; }
.b-desc:focus { border-color: var(--ink); outline: none; }
.b-problems { margin-top: 12px; padding: 10px 12px; border-radius: var(--r); background: var(--bad-bg); color: var(--bad); font-size: 13.5px; }
.b-foot { position: sticky; bottom: 0; margin: auto -20px 0; padding: 12px 20px; background: var(--sheet); border-top: 1px solid var(--rule); display: flex; align-items: center; gap: 8px; z-index: 2; }
.b-foot-r { margin-left: auto; display: flex; gap: 8px; }
.b-foot button:disabled { opacity: .5; cursor: progress; }
#builder-body { padding-bottom: 18px; }
/* home look (Nov 13, Agustín): paper ground, the name as a filled field, palette tiles and steps as soft cards, filled
   inputs, no lines */
html:has(#home.active) #builder.panel { background: var(--paper); border-left: none; }
html:has(#home.active) #builder .panel-head h3 { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
html:has(#home.active) #builder .panel-head button { border-color: transparent; background: var(--sheet); }
html:has(#home.active) .b-name { background: var(--sheet); border: none; border-radius: 16px; padding: 10px 14px; font-weight: 700; }
html:has(#home.active) .b-name:focus { box-shadow: 0 0 0 2px var(--ink); }
html:has(#home.active) .b-pal-row .b-kind { background: var(--track); }
html:has(#home.active) .b-tile { border: none; border-radius: 14px; background: var(--sheet); box-shadow: var(--card-shadow); }
html:has(#home.active) .b-trash { border-radius: 14px; }
html:has(#home.active) .b-tl { border-bottom: none; border-radius: 0; background: var(--sheet); box-shadow: var(--card-shadow); } /* square corners: Agustín, Nov 13 */
html:has(#home.active) :is(.b-step, .b-rep) { border: none; border-radius: 14px; background: var(--sheet); box-shadow: var(--card-shadow); }
html:has(#home.active) :is(.b-step, .b-rep).sel { box-shadow: 0 0 0 2px var(--ink); }
html:has(#home.active) .brep-body { border-left-color: color-mix(in srgb, var(--rule) 70%, transparent); }
html:has(#home.active) .brep-body .b-step { background: var(--sheet2); box-shadow: none; }
html:has(#home.active) :is(.b-in, .b-desc) { border: none; border-radius: 10px; background: var(--sheet2); }
html:has(#home.active) .b-desc { background: var(--sheet); border-radius: 16px; padding: 10px 12px; }
html:has(#home.active) :is(.b-in, .b-desc):focus { box-shadow: 0 0 0 2px var(--ink); }
html:has(#home.active) .b-in.bad, html:has(#home.active) .b-in.bad:focus { background: var(--bad-bg); box-shadow: 0 0 0 2px var(--bad); }
html:has(#home.active) .b-dur { border-radius: 10px 0 0 10px; }
html:has(#home.active) .b-unit { border-radius: 0 10px 10px 0; margin-left: 1px; }
html:has(#home.active) .b-line2 .b-in { border-bottom: none; border-radius: 10px; background: var(--sheet2); }
html:has(#home.active) .b-problems { border-radius: 16px; }
html:has(#home.active) :is(.b-tot, .b-dur, .b-n, .b-sum) { font-stretch: 80%; font-weight: 720; }
html:has(#home.active) .b-foot { border-top: none; background: color-mix(in srgb, var(--paper) 86%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.6); backdrop-filter: blur(16px) saturate(1.6); }
html:has(#home.active) .b-foot button:not(.primary) { border-color: transparent; background: var(--sheet); }

/* ---- first-run setup (js/setup.js): one question per screen over the home screen, for a new rider */
.setup { position: fixed; inset: 0; z-index: 36; overflow: auto; background: var(--paper); display: flex; justify-content: center; align-items: flex-start; padding: 8vh 20px 40px; }
html.setup-on { overflow: hidden; }
.su-card { width: 100%; max-width: 540px; background: var(--sheet); border-radius: 16px; box-shadow: var(--card-shadow, none); padding: 28px 28px 24px; }
.su-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.su-step { font-size: 13.5px; font-weight: 650; color: var(--muted); }
.su-dots { display: flex; gap: 6px; }
.su-dots i { width: 22px; height: 4px; border-radius: 2px; background: var(--rule); }
.su-dots i.on { background: var(--ink); }
.su-card h2 { margin: 0 0 8px; font-size: 26px; font-weight: 800; font-stretch: 112%; letter-spacing: -0.02em; line-height: 1.12; }
.su-help { margin: 0 0 20px; color: var(--muted); font-size: 15px; line-height: 1.45; }
.su-body { display: flex; flex-direction: column; gap: 12px; }
.su-text { width: 100%; font-size: 20px; font-weight: 650; padding: 13px 16px; border-radius: 12px; border: 1.5px solid var(--rule); background: var(--paper); }
.su-num { display: flex; align-items: center; gap: 10px; }
.su-num > button { flex: none; width: 54px; height: 54px; padding: 0; font-size: 26px; font-weight: 700; line-height: 1; }
.su-field { flex: 1; min-width: 0; display: flex; align-items: baseline; justify-content: center; gap: 6px; border-radius: 12px; border: 1.5px solid var(--rule); background: var(--paper); padding: 6px 14px; }
.su-field input { width: 5ch; min-width: 0; border: 0; background: transparent; text-align: right; font-family: var(--num); font-size: 36px; font-weight: 720; font-stretch: 80%; font-variant-numeric: tabular-nums; padding: 0; }
.su-field input:focus { outline: none; }
.su-field span { font-size: 17px; font-weight: 650; color: var(--muted); }
.su-field:focus-within { border-color: var(--ink); }
.su-alt { align-self: flex-start; }
.su-alt.on { border-color: var(--ink); }
.su-list { display: flex; flex-direction: column; gap: 14px; max-height: 48vh; overflow: auto; margin: -6px; padding: 6px; } /* room for the 4 px focus ring inside the scroll area */
.su-group { display: flex; flex-direction: column; gap: 6px; }
.su-gh { font-size: 12.5px; font-weight: 700; letter-spacing: .04em; color: var(--muted); margin: 2px 2px 0; }
.su-choice { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; text-align: left; border-radius: 12px; padding: 12px 16px; background: var(--paper); }
.su-choice.on { border-color: var(--ink); background: var(--sheet); }
.su-cn { font-weight: 650; }
.su-cl { flex: none; font-size: 13.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.su-connect { align-self: flex-start; }
.su-btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.su-btns button { padding: 12px 24px; }
.su-btns button:disabled { opacity: .45; cursor: default; transform: none; }
.setup button.focus { outline: 2px solid var(--ink); outline-offset: 2px; }
/* starter block questions (launch session 6): the same panel; blocks list name over line, the days as 7 toggles */
.su-choice.tall { flex-direction: column; align-items: flex-start; gap: 3px; }
.su-choice.tall .su-cl { flex: 1; font-size: 14px; font-weight: 550; line-height: 1.4; }
.su-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.su-day { min-height: 52px; padding: 0; border-radius: 12px; font-weight: 700; background: var(--paper); }
.su-day.on { background: var(--ink); border-color: var(--ink); color: var(--sheet); }
/* Today's "No plan yet": Pick a starter block under the text */
.hero-starter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 14px; }
.hero-pick-note { font-size: 13.5px; color: var(--inv-muted); }
/* Settings > Account: export and delete sit in the pane's grid; the typed confirmation in the modal */
.acct-data, .acct-delete, .acct-import { display: contents; }
.acct-data .sync-actions { flex-wrap: wrap; row-gap: 6px; }
.acct-data .sync-actions button { flex: none; white-space: nowrap; }
.modal-typed { display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--muted); }
.modal-typed input { font: inherit; font-size: 17px; font-weight: 650; letter-spacing: .04em; padding: 11px 13px; border-radius: var(--r); border: 1.5px solid var(--rule); background: var(--paper); color: var(--ink); }
.modal-typed input:focus { outline: none; border-color: var(--ink); }
#modal-ok.danger:not(:disabled) { background: var(--bad); border-color: var(--bad); color: #fff; }
#modal-ok:disabled { opacity: .45; cursor: default; transform: none; }

/* =====================================================================
   PHONE (touch screens only, so desktop Chrome never changes).
   Keep this query identical to PHONE_MQ in js/app.js.
   ===================================================================== */
.rp { display: none; }
@media (pointer: coarse) and (max-width: 760px), (pointer: coarse) and (max-height: 520px) {
  /* first-run setup: the whole screen, safe areas, big targets */
  .setup { padding: max(16px, env(safe-area-inset-top)) 0 0; background: var(--sheet); }
  .su-card { max-width: none; border-radius: 0; box-shadow: none; padding: 16px 18px 0; min-height: 100%; display: flex; flex-direction: column; }
  .su-card h2 { font-size: 25px; }
  .su-body { flex: 1; }
  .su-list { max-height: none; overflow: visible; }
  .su-choice { padding: 14px 16px; }
  .su-btns { position: sticky; bottom: 0; margin: 18px -18px 0; padding: 12px 18px max(12px, env(safe-area-inset-bottom)); background: var(--sheet); }
  .su-btns button { flex: 1; padding: 14px 18px; }
  .su-days { gap: 5px; }
  .su-day { min-height: 56px; font-size: 14px; }
  .hero-starter { margin-top: 12px; }
  .hero-pick { width: 100%; }
  .hero-pick-note { display: none; }
  .modal-typed input { font-size: 18px; }
  /* iPhone haptics (js/sound.js): an invisible label over each tappable control, pointing at one hidden native switch.
     The finger lands on the label, the switch ticks, the control gets the tap. Only present on iPhones. */
  :where(.hx-host) { position: relative; }
  .hx { position: absolute; inset: 0; margin: 0; border-radius: inherit; -webkit-tap-highlight-color: transparent; }
  .hx-switch { position: fixed; top: 0; left: 0; margin: 0; opacity: 0; pointer-events: none; z-index: -1; }
  .wo-detail { flex-wrap: wrap; gap: 6px 12px; }
  .wo-detail input[type=range] { order: 3; flex: 1 1 100%; height: 32px; }
  /* ride page: one column, actions at the bottom, chart edge to edge */
  #ridepage { padding: calc(12px + env(safe-area-inset-top)) 14px calc(30px + env(safe-area-inset-bottom)); }
  .rd-nav { margin-bottom: 12px; }
  .rd-nav .rd-acts { display: none; }
  .rd-head { grid-template-columns: 1fr; gap: 10px; }
  .rd-head h2 { font-size: 23px; }
  .rd-sub { font-size: 13.5px; }
  .rd-thumb .profile { height: 34px; }
  .rd-stats { grid-template-columns: repeat(4, 1fr); margin: 12px 0; }
  .rd-stats .stat { padding: 8px 8px; }
  .rd-stats .stat:nth-child(4n+1) { border-left: none; padding-left: 0; }
  /* the line between the rows hangs off the first row, so it spans all four columns even when the second row is short */
  .rd-stats:has(> .stat:nth-child(5)) > .stat:nth-child(-n+4) { border-bottom: 1px solid var(--rule); }
  .rd-stats .stat .v { font-size: 25px; }
  .rd-stats .stat .v small { font-size: 14px; }
  .rd-stats .stat .l { font-size: 12px; }
  .rd-stats .stat .sub { display: none; }
  .rd-charts { padding: 10px 12px 6px; margin: 0 -14px; border-radius: 0; }
  .rd-hint { font-size: 12px; }
  .rd-sel { font-size: 13px; }
  .rd-grid { grid-template-columns: 1fr; }
  .rd-grid .card { padding: 14px; }
  #rd-ints { font-size: 13.5px; }
  #rd-ints td, #rd-ints th { padding: 7px 4px; }
  #rd-ints .rd-wide, #rd-ints .cadin { display: none; }
  .rd-grid .zbars { grid-template-columns: auto 1fr auto 2.6em; gap: 6px 8px; font-size: 13px; }
  .rd-grid .zb-n { display: none; }
  .rd-best .v { font-size: 24px; }
  .rd-best > div { padding: 2px 8px; }
  .rd-curve { display: none; }
  .rd-foot { display: flex; gap: 10px; margin-top: 16px; }
  .rd-done { padding: 14px; margin: 0 0 16px; }
  .dn-main { grid-template-columns: auto 1fr; gap: 10px 12px; }
  .dn-check { width: 30px; height: 30px; }
  .dn-h { font-size: 21px; }
  .dn-vs { font-size: 13.5px; gap: 2px 14px; }
  .dn-vs-l { flex-basis: 100%; }
  .dn-vs b { font-size: 16px; }
  .dn-meta { font-size: 13px; flex-direction: column; }
  .dn-btns { grid-column: 1 / -1; }
  .dn-btns button { flex: 1; white-space: nowrap; padding-left: 10px; padding-right: 10px; }
  .dn-btns .primary { order: -1; flex: 1.6; min-width: 0; }
  .dn-ftp { margin-left: 0; flex-direction: column; align-items: stretch; }
  .dn-ftp-btns button { flex: 1; }
  .rd-foot button { flex: 1; }
  body { -webkit-tap-highlight-color: transparent; }

  /* ---------- home ---------- */
  #home { padding: calc(12px + env(safe-area-inset-top)) 14px calc(96px + env(safe-area-inset-bottom)); } /* room for the nav pill */
  .topbar { margin-bottom: 14px; }
  .brand { font-size: 21px; }
  .top-actions { gap: 0; }
  .top-actions button { padding: 6px 9px; }
  @media (max-width: 375px) { .top-actions button { padding: 6px 7px; } } /* five top-bar buttons fit at 360 */
  /* connections popover: full width under the top bar */
  .devpop { left: 0; right: 0; width: auto; max-width: none; max-height: calc(100dvh - 90px - env(safe-area-inset-top)); overflow: auto; overscroll-behavior: contain; }
  #btn-devices { padding: 6px 9px; gap: 5px; }
  #btn-devices svg { width: 17px; height: 17px; }
  .ldots { gap: 3px; }
  .brand { gap: 8px; }
  .logo { width: 36px; height: 15px; }
  .device { padding: 10px 14px; }
  .dev-head, .dev-meta { font-size: 12.5px; }
  .dev-name { font-size: 15px; }
  @media (orientation: landscape) { .devpop { left: auto; width: 420px; } }
  /* tiny phones (320 px): logo only, so the actions never clip */
  @media (max-width: 340px) { .brand { font-size: 0; gap: 0; } }
  .tabs { margin: 0 -14px 12px; padding: 0 14px; gap: 18px; }
  .tabs button { white-space: nowrap; font-size: 15px; }
  /* the main nav floats at the bottom as a liquid glass pill, always visible on the home screens; the sliding ink
     (::after) becomes a brighter glass lens behind the active section */
  .topbar .topnav { position: fixed; z-index: 30; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom)); transform: translateX(-50%);
    margin: 0; gap: 0; padding: 5px; border-radius: 999px; border: none; background: var(--glass); box-shadow: var(--glass-edge);
    -webkit-backdrop-filter: blur(14px) saturate(1.9) brightness(1.04); backdrop-filter: blur(14px) saturate(1.9) brightness(1.04); }
  .topbar .topnav::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: .7;
    background: radial-gradient(70% 120% at 18% -30%, var(--glass-sheen) 0%, transparent 55%), radial-gradient(60% 90% at 90% 140%, var(--glass-sheen) 0%, transparent 60%); }
  .topnav button { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 76px;
    padding: 7px 10px 6px; font-size: 11.5px; font-weight: 650; color: var(--nav-text); border-radius: 999px; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
  .topnav button.active { color: var(--ink); }
  .topnav svg { display: block; width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
  .topbar .topnav::after { top: 5px; bottom: 5px; left: 0; height: auto; border-radius: 999px; z-index: 0; background: var(--lens); box-shadow: var(--lens-edge); }
  .topnav button:hover { color: var(--nav-text); }
  .topnav button.active:hover { color: var(--ink); }
  .wo { grid-template-columns: minmax(0, 1fr) 104px; grid-template-areas: "name prof" "meta prof" "more more"; padding: 11px 16px 11px 18px; row-gap: 3px; column-gap: 12px; }
  .wo-name { font-size: 15px; }
  .wo-meta { font-size: 12.5px; text-align: left; }
  .wo-meta .n { font-size: 14px; }
  .wo .profile { height: 30px; }
  .wo-more { margin-top: -1px; } /* phone row gap is 1px */
  .wo-prof { height: 80px; margin-top: 12px; }
  .wo-sec + .wo-sec { margin-top: 18px; }
  .wo-gh { font-size: 13.5px; color: var(--muted); margin-left: 4px; }
  .wo-sheet { border-radius: 24px; }
  .wo-sheet .wo:first-child { border-radius: 24px 24px 0 0; }
  .wo-sheet .wo:last-child { border-radius: 0 0 24px 24px; }
  .wo-sheet .wo:only-child { border-radius: 24px; }
  .wo .start-row button[data-start] { padding: 6px 13px; }
  .wo-info { grid-template-columns: minmax(0, 1fr); }
  .wo-facts { padding-top: 10px; gap: 8px; }
  .wo-facts .f { grid-template-columns: 88px 1fr; }
  /* today hero: text, chart, then the buttons across the bottom */
  #today { margin-bottom: 14px; }
  .hero { display: flex; flex-direction: column; padding: 20px 20px 18px; border-radius: 28px;
    background:
      linear-gradient(180deg, rgba(255,255,255,.32) 0%, rgba(255,255,255,0) 22%),
      radial-gradient(125% 95% at 20% 0%, color-mix(in oklab, var(--c), #fff 30%) 0%, var(--c) 30%, color-mix(in oklab, var(--c), var(--today-end) 45%) 46%, color-mix(in oklab, var(--c), var(--today-end) 88%) 58%, var(--today-end) 70%); }
  :root[data-theme="dark"] .hero:not(.nowo):not(.done) {
    background:
      linear-gradient(180deg, rgba(255,255,255,.32) 0%, rgba(255,255,255,0) 22%),
      radial-gradient(125% 100% at 20% 0%, color-mix(in oklab, var(--c), #fff 30%) 0%, var(--c) 42%, color-mix(in oklab, var(--c), var(--today-end) 45%) 62%, color-mix(in oklab, var(--c), var(--today-end) 85%) 78%, var(--today-end) 94%); }
  .hero.nowo { background: linear-gradient(180deg, rgba(255,255,255,.12) 0%, rgba(255,255,255,0) 22%), var(--ink); }
  .hero-main { display: contents; }
  .hero-text { order: 1; flex: none; }
  .hero-prof { order: 2; height: 72px; margin-top: 16px; }
  .hero .hero-coach { display: none; } /* the call lives in the coach card */
  .hero-btns { order: 4; flex: none; flex-direction: row; margin-top: 14px; }
  .hero-top { justify-content: space-between; font-size: 13px; }
  .hero-top span::before { content: none; }
  .hero-name { font-size: 27px; line-height: 1.12; letter-spacing: -0.022em; margin-top: 4px; }
  .hero-name .tag { vertical-align: 5px; }
  .hero-meta { font-size: 17px; margin-top: 4px; }
  .hero-nums { gap: 22px; margin-top: 14px; }
  .hn { gap: 2px; flex: none; min-width: 0; }
  .hn.main { flex: 0 1 auto; }
  .hn .v { font-size: 30px; }
  .hn.main .v { font-size: 60px; }
  .hn .v small { font-size: 13px; margin-left: 3px; }
  .hn.main .v small { font-size: 17px; margin-left: 4px; }
  .hn .l { font-size: 12.5px; }
  .hero-desc { margin-top: 6px; font-size: 14.5px; }
  .hero-btns button { height: 54px; }
  .hero-start { flex: 1 1 auto; font-size: 17px; gap: 10px; white-space: nowrap; padding: 0 16px; min-width: 0; }
  .hero-start.primary { box-shadow: 0 10px 20px -10px var(--today-shadow), 0 2px 4px -1px var(--shadow); }
  .hero-free { flex: none; padding: 0 16px; gap: 8px; white-space: nowrap; }
  .hero.nowo .hero-free { flex: 1 1 auto; font-size: 17px; }
  .hero.nowo .hero-btns { align-self: stretch; }
  .hero:not(.nowo):not(.done) .ghost:hover { background: rgba(255,255,255,.8); border-color: var(--on-zone); }
  /* done today: headline, numbers in rows of three, then the two buttons; the next ride carries the chart */
  .hero.done { padding: 16px 16px 14px;
    background: radial-gradient(90% 120% at 0% 0%, color-mix(in oklab, var(--c), var(--sheet) 78%) 0%, var(--sheet) 70%); }
  .hero.done .hero-name { font-size: 23px; gap: 10px; }
  .done-ico { width: 26px; height: 26px; }
  .hero-stats { order: 2; grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 10px; margin-top: 12px; padding-top: 10px; }
  .hs + .hs { padding-left: 12px; }
  .hs:nth-child(3n + 1) { border-left: none; padding-left: 0; }
  .hs .v { font-size: 24px; }
  .hs .l { font-size: 12.5px; }
  .hs .wide-only, .hero-lib .wide-only { display: none; }
  .hero.done .hero-prof { display: none; }
  .hero.done .hero-btns { flex: none; }
  .hero.done .hero-btns button { flex: 1 1 0; height: 48px; padding: 0 12px; }
  .hero-more { order: 5; margin-top: 14px; }
  .hm-row { padding: 8px 8px 8px 12px; gap: 10px; }
  .hm-name { font-size: 14.5px; }
  .hm-meta, .hm-done { font-size: 12.5px; }
  .hm-start, .hm-see { min-height: 44px; padding: 0 14px; }
  .hm-row { flex-wrap: wrap; row-gap: 6px; }
  .hm-text { flex: 1 1 calc(100% - 22px); }
  .hm-done { margin-left: 22px; margin-right: auto; }
  .hm-start { margin-left: 22px; }
  /* overview: the coach card on top, then This week / Form / FTP as one card (one shadow for the joined
     tiles, no seams); the tiles are the desktop's, smaller, and the week has no day letters (too crowded, Agustín) */
  .overview.stats { grid-template-columns: repeat(3, minmax(0, 1fr)); background: transparent; border-radius: 0; margin: 22px 0 18px; box-shadow: none; filter: var(--card-drop); }
  .overview > .coach-card { order: -1; grid-column: 1 / -1; margin-bottom: 12px; }
  .overview.stats > .stat:nth-child(n) { background: var(--sheet); padding: 14px 12px 14px 14px; gap: 5px; box-shadow: none; }
  .overview.stats > .stat:nth-child(1) { border-radius: 24px 0 0 24px; }
  .overview.stats > .stat:nth-child(3) { border-radius: 0 24px 24px 0; }
  .ov2 .ol { font-size: 12.5px; }
  .overview .ov2 .v { font-size: 25px; white-space: nowrap; }
  .overview .ov2 .v .of { font-size: 14px; }
  .ov2 .os { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .overview .info { right: 8px; }
  .overview > .stat:nth-child(n+2) .tip { left: auto; right: -8px; }
  .ov-week { align-items: flex-start; margin-top: 6px; padding-right: 4px; max-width: none; }
  .wd { gap: 4px; width: 10px; }
  .wd i { width: 10px; height: 10px; }
  .wd.off i { width: 4px; height: 4px; margin: 3px 0; }
  .wd em { display: none; }
  .wd.today::after { content: ""; width: 10px; height: 2px; border-radius: 1px; background: var(--ink); } /* today: a short ink tick */
  .ov-form { height: 5px; margin: 8px 0 5px; }
  .ov-form .mk { width: 11px; height: 11px; }
  .ov-ftp { height: 20px; margin-top: 4px; margin-right: 4px; }
  .ov-ftp i { right: -4px; width: 8px; height: 8px; }
  /* coach card (Nov 28, replaced the recovery ring): the daily coach's call, text only */
  .coach-card { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; background: var(--sheet); border-radius: 24px; }
  .cc-l { font-size: 12.5px; color: var(--muted); }
  .cc-t { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.35; letter-spacing: -0.01em; }

  .seg-tg { display: flex; background: var(--sheet2); }
  .seg-tg button { flex: 1; padding: 9px 10px; }
  .import-row { flex-wrap: wrap; }
  .week-head { gap: 8px; align-items: flex-start; }
  .eyebrow { font-size: 15px; }
  .week-head > :last-child { display: flex; gap: 6px; flex-shrink: 0; }
  .week-head > .row-btns { display: none; } /* swipe */
  .day { flex-basis: 150px; min-height: 78px; padding: 12px 14px 12px 24px; border-radius: 20px; }
  .day::before { left: 11px; top: 12px; bottom: 12px; }
  .day.nowo { flex-basis: 88px; padding-left: 14px; }
  .day.nowo:hover { background: var(--hi); }
  .d-name { font-size: 14px; }
  .d-meta, .d-done, .d-missed { font-size: 12.5px; }
  .cal-layout { grid-template-columns: 1fr; gap: 14px; }
  .cal-head h3 { flex: 1; margin-right: 0; font-size: 25px; }
  .cal-head #cal-today { padding: 0 15px; }
  .cal-grid { border-radius: 24px; padding: 12px 8px 10px; gap: 2px 0; }
  .cal-cell { min-height: 52px; padding: 5px 0 4px; align-items: center; gap: 5px; }
  .cal-cell:hover { background: transparent; }
  .cal-cell.sel { box-shadow: none; background: var(--sheet2); }
  .cal-num { font-size: 15px; height: 26px; min-width: 26px; align-self: auto; }
  .cal-cell.today .cal-num { border-radius: 13px; align-self: center; }
  .cal-chip { font-size: 0; padding: 0; width: 22px; height: 5px; border-left: none; background: var(--c); border-radius: 3px; align-self: center; } /* no glow (Nov 13) */
  .cal-chip.ghost { display: none; }
  .cal-done, .cal-missed { font-size: 0; }
  .cal-done::before { content: "\2713"; font-size: 12px; }
  .cal-dow { font-size: 11px; padding: 0 0 6px; text-align: center; }
  .cal-detail h3 { font-size: 13px; }
  .cal-detail .wo-name { font-size: 21px; }
  .cal-detail .wo-meta .n { font-size: 15px; }
  .stats.tcards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 12px; padding: 18px; border-radius: 24px; margin-bottom: 14px; }
  .stats.tcards > .stat:nth-child(n) { padding: 0 16px 0 0; }
  .stats.tcards .stat .v { font-size: 26px; }
  .stats.tcards .stat .l { font-size: 12.5px; font-weight: 550; margin-top: 3px; }
  .stats.tcards .stat .sub { font-size: 11.5px; }
  .stats.tcards .info { right: 0; }
  .stats.tcards > .stat:nth-child(n) .tip { left: -8px; right: auto; }
  .stats.tcards > .stat:nth-child(3n + 2) .tip { left: -110px; }
  .stats.tcards > .stat:nth-child(3n) .tip { left: auto; right: -8px; }
  #home .card { border-radius: 24px; padding: 18px; }
  #home .zb-bar { height: 8px; border-radius: 4px; }
  #home .zb-bar i { border-radius: 4px; }
  .pc-legend { gap: 12px; font-size: 11px; }
  .pc-legend span { gap: 5px; }
  .pc-legend i { width: 12px; }
  .tgrid { grid-template-columns: 1fr; }
  .zcols { grid-template-columns: 1fr; }
  .zbars { gap: 6px 8px; font-size: 13px; }
  .zb-n span { display: block; margin-left: 0; font-size: 11.5px; }
  .card { padding: 14px; }
  .ride-table { overflow-x: auto; }
  /* the rides as a list of small cards instead of the table */
  .ride-table table { display: none; }
  .ride-list { display: flex; flex-direction: column; gap: 4px; }
  .rl { padding: 10px 0; cursor: pointer; }
  .rl-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
  .rl-name { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-size: 15px; font-weight: 620; letter-spacing: -0.01em; }
  .rl-date { font-size: 11.5px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
  .rl-right { flex: none; font-size: 12px; }
  .rl-right b { font-family: var(--num); font-stretch: 80%; font-weight: 720; color: var(--ink); }
  .rl-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
  .rl-s { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
  .rl-s .v { font-size: 16px; }
  .rl-s .v small { font-family: Archivo, system-ui, sans-serif; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
  .rl-s .l { font-size: 10.5px; color: var(--muted); }
  .rl-btns { display: flex; gap: 8px; margin-top: 8px; }
  .panel { width: 100vw; padding: calc(14px + env(safe-area-inset-top)) 14px calc(20px + env(safe-area-inset-bottom)); }
  #garage.panel { width: calc(100vw - 20px); max-height: calc(100dvh - 24px); padding: 14px; }
  .settings-form .gar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .gar-name { font-size: 13px; } .gar-plus { font-size: 48px; margin-bottom: 4px; }
  .gar-pick, .gar-add { padding: 10px 8px 4px; gap: 2px; }
  .gar-tile .bike-photo { width: 76%; margin-bottom: 3px; }
  .gar-name { line-height: 1.15; }
  .gar-line { font-size: 11.5px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .gar-more { font-size: 12px; padding: 4px 8px 9px; }
  .gar-riding { top: 7px; left: 7px; font-size: 10.5px; padding: 1px 7px; }
  .settings-form { grid-template-columns: 1fr; gap: 14px; }
  .settings-form input, .settings-form select { height: 42px; font-size: 16px; }
  .set-tabs { gap: 15px; }
  /* home look: rounder corners; the Garage's tabs are a segment switch too */
  html:has(#home.active) .tabs.gar-tabs { border-bottom: none; background: var(--track); border-radius: 22px; padding: 4px; gap: 0; margin: 0 0 14px; }
  html:has(#home.active) .gar-tabs button { position: relative; z-index: 1; flex: 1 0 auto; padding: 8px 12px; font-size: 14px; }
  html:has(#home.active) .gar-tabs::after { top: 4px; bottom: 4px; height: auto; border-radius: 18px; background: var(--seg-on); box-shadow: var(--seg-shadow); z-index: 0; }
  html:has(#home.active) #settings .settings-form { border-radius: 24px; }
  html:has(#home.active) #garage.panel { border-radius: 28px; }
  html:has(#home.active) :is(.gar-tile, .gar-add) { border-radius: 22px; }
  html:has(#home.active) .settings-form .gar-dl { border-radius: 20px; }
  html:has(#home.active) .devpop { border-radius: 26px; }
  html:has(#home.active) .device { border-radius: 18px; }
  html:has(#home.active) .keys { border-radius: 24px; }
  html:has(#home.active) #log-body { border-radius: 20px; }
  /* no keyboard on the phone */
  .keys th:nth-child(3), .keys td:nth-child(3) { display: none; }
  .keys { font-size: 13px; }
    .stats { grid-template-columns: repeat(2, 1fr); }
  .stats > .stat:nth-child(odd) { border-left: none; }
  .stats > .stat:nth-child(n+3) { border-top: 1px solid var(--rule); }
  table.ints { font-size: 12.5px; }

  /* workout builder: each step is two rows (type, rpm, buttons / length, target) */
  .mine-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .panel.builder { width: 100vw; padding-bottom: 0; }
  .b-tl { height: 120px; }
  .b-pal-hint { display: none; }
  .b-tile { padding: 8px 11px 8px 8px; font-size: 14px; }
  .tl-hy { height: 26px; }
  .tl-hy[data-h="from"], .tl-hy[data-h="to"] { width: 30px; }
  .tl-hx { right: -11px; width: 22px; }
  .tl-hx::after { left: 9px; }
  .b-step, .b-rep { padding: 8px 6px 8px 8px; }
  html:has(#home.active) :is(.b-step, .b-rep) { border-radius: 18px; }
  .b-line1 { display: grid; grid-template-columns: 6px minmax(0, 1fr) auto auto; grid-template-areas: "sw type cad acts" "sw len tgt tgt"; gap: 8px; align-items: center; }
  .b-sw { grid-area: sw; height: auto; align-self: stretch; }
  .b-type { grid-area: type; width: 100%; }
  .b-cad { grid-area: cad; width: 64px; }
  .b-acts { grid-area: acts; margin-left: 0; }
  .b-len { grid-area: len; }
  .b-tgt { grid-area: tgt; flex-wrap: wrap; row-gap: 2px; }
  .b-in, .b-desc, .b-name { font-size: 16px; } /* under 16px iOS zooms the page on focus */
  .b-n, .b-dur { font-size: 17px; }
  .b-n { width: 52px; }
  .b-dur { width: 66px; }
  .b-unit { width: 50px; }
  .b-ico { padding: 6px; }
  .b-line2 { grid-template-columns: 1fr 1fr; margin-left: 14px; }
  .b-line2 .b-in { font-size: 16px; padding: 4px 2px; }
  .brep-head { flex-wrap: wrap; row-gap: 6px; }
  .brep-head .b-acts { margin-left: auto; }
  .brep-body { margin-left: 2px; padding-left: 6px; }
  .b-foot { margin: auto -14px 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  .b-foot button { padding: 9px 14px; }

  /* ---------- ride: hide the desktop layout, show .rp ---------- */
  #ride { padding: 0; height: 100dvh; }
  #ride > :not(.rp):not(.toast):not(.paused-overlay):not(.hold):not(.pain) { display: none !important; }
  #ride :is(.rp-top, #rp-hero, #rp-power-box, .rp-metrics, .rp-btns) { position: relative; z-index: 5; } /* above .pain: only the chart and Next blur */
  #ride.pain-on #rp-chart { filter: drop-shadow(calc(var(--pain) * 3.5px) 0 0 rgb(255 0 70 / .5)) drop-shadow(calc(var(--pain) * -3.5px) 0 0 rgb(0 190 255 / .5)); }
  /* hold ring above the ··· sheet, which covers the lower half */
  .hold { justify-content: flex-start; padding-top: calc(36px + env(safe-area-inset-top)); gap: 10px; }
  .hold-ring { width: 170px; height: 170px; }
  .hold-key { font-size: 88px; }
  .hold-key.word { font-size: 36px; }
  .hold-msg { font-size: 28px; }
  .toast { font-size: 24px; padding: 12px 22px; top: auto; bottom: calc(150px + env(safe-area-inset-bottom)); transform: translateX(-50%); }
  .paused-overlay { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .paused-overlay .big { font-size: 56px; }
  .pz { width: 100%; padding: 0 12px; }
  .pz-acts { gap: 6px; margin-top: 20px; }
  .pz-btn { flex: 1 1 0; min-width: 0; max-width: 96px; padding: 12px 2px 9px; font-size: 12px; }
  .pz-ico svg { width: 24px; height: 24px; }
  .pz-l { font-stretch: 78%; } /* five buttons: "Connections" fits at 360 px */

  .rp {
    display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 0;
    padding: calc(8px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left));
    --zc: var(--z2);
    font-variant-numeric: tabular-nums;
  }
  .rp-k { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); }
  .rp-top { display: grid; grid-template-columns: auto 1fr auto; align-items: end; gap: 10px; }
  .rp-top > div > span:last-child { font-size: 26px; font-weight: 800; line-height: 1; }
  .rp-name { text-align: center; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-bottom: 2px; }
  .rp-left { text-align: right; }

  /* the interval is a block of its zone's color */
  .rp-hero { background: var(--zc); color: var(--on-zone); border-radius: 8px; padding: 8px 14px 12px; text-align: center; transition: background .4s; }
  .rp-int-label { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rp-hero { position: relative; }
  .rp-hero .rep-badge { left: 14px; top: 10px; }
  .rp-hero .rep-badge .rk { display: none; }
  .rp-hero .rep-badge .rn { font-size: 26px; }
  .rp-hero .rep-badge .pips { gap: 3px; margin-top: 5px; }
  .rp-hero .rep-badge .pips b { width: 9px; height: 4px; border-radius: 2px; }
  .rp-hero .rep-badge .pips.bar { width: 69px; height: 4px; border-radius: 2px; }
  .rp-hero:has(#rp-rep:not(:empty)) .rp-int-label { padding: 0 64px; }
  .rp-count { font-size: clamp(64px, 22vw, 116px); font-weight: 900; line-height: .9; margin: 2px 0 8px; }
  .rp-target-row { display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; }
  .rp-target { background: var(--on-zone); color: var(--on-zone-inv); font-weight: 800; font-size: 26px; padding: 2px 14px; border-radius: 6px; line-height: 1.25; }
  .rp-target:empty { display: none; }
  .rp-target-sub { font-size: 17px; font-weight: 750; line-height: 1.25; }

  .rp-power { text-align: center; }
  .rp-pval { font-size: clamp(80px, 29vw, 160px); font-weight: 900; line-height: .86; letter-spacing: -0.01em; }
  .rp-unit { font-size: .26em; color: var(--muted); margin-left: 4px; letter-spacing: 0; font-weight: 800; }
  .rp-gauge { position: relative; height: 8px; margin: 8px auto 0; width: 72%; border-radius: 2px;
    background: linear-gradient(90deg, var(--rule) 0 30%, var(--good) 30% 70%, var(--rule) 70% 100%); }
  .rp-gauge b { position: absolute; top: -5px; width: 5px; height: 18px; border-radius: 2px; background: var(--ink); left: 50%; transform: translateX(-50%); transition: left .25s; box-shadow: 0 0 0 2px var(--paper); }
  .rp-gauge i { position: absolute; top: -2px; bottom: -2px; left: 50%; width: 2px; background: var(--paper); }
  .rp-gauge.off { visibility: hidden; }

  .rp-metrics { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--sheet); border-radius: 8px; }
  .rp-m { padding: 7px 6px 8px; text-align: center; transition: background .2s; border-left: 1px solid var(--rule); }
  .rp-m:first-child { border-left: none; border-radius: 8px 0 0 8px; }
  .rp-m:last-child { border-radius: 0 8px 8px 0; }
  .rp-v { display: block; font-size: 34px; font-weight: 850; line-height: 1.02; }
  .rp-s { display: block; font-size: 12px; color: var(--muted); min-height: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rp-m.ok { background: var(--ok-bg); } .rp-m.ok .rp-v { color: var(--ok-ink); }
  .rp-m.bad { background: var(--bad-bg); animation: cadpulse .9s ease-in-out infinite; } .rp-m.bad .rp-v { color: var(--bad); }
  .rp-power { border-radius: var(--r); transition: background .2s; }
  .rp-power.ok { background: var(--ok-bg); } .rp-power.ok .rp-pval { color: var(--ok-ink); }
  .rp-power.bad { background: var(--bad-bg); animation: cadpulse .9s ease-in-out infinite; } .rp-power.bad .rp-pval, .rp-power.bad #rp-power-sub { color: var(--bad); }
  #rp-power-sub { display: block; margin-top: 6px; } #rp-power-sub:empty { display: none; }
  

  .rp-chart-wrap { flex: 1; min-height: 100px; display: flex; flex-direction: column; gap: 4px; }
  .rp-view-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
  .rp-view-head .rp-k { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
  .rp-view-tg { display: flex; background: var(--sheet); border-radius: 999px; padding: 2px; flex: none; }
  .rp-view-tg button { background: transparent; border: none; color: var(--muted); font-size: 13.5px; font-weight: 700; padding: 5px 14px; border-radius: 999px; touch-action: manipulation; }
  .rp-view-tg button.on { background: var(--ink); color: var(--sheet); }
  .rp-chart-wrap.no-segs .rp-view-head { display: none; }
  .rp-view-body { flex: 1; min-height: 0; position: relative; }
  .rp-chart { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
  .rp-segs { display: none; position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; background: var(--sheet); border-radius: 8px; padding: 4px; }
  .rp-chart-wrap.as-list .rp-chart { display: none; }
  .rp-chart-wrap.as-list .rp-segs { display: block; }
  .rp-segs .seg { padding: 7px 10px 7px 12px; }
  .rp-segs .seg:last-child { margin-bottom: 0; }
  .rp-next { font-size: 15px; color: var(--muted); text-align: center; min-height: 18px; }
  .rp-next b { color: var(--ink); font-family: var(--num); font-stretch: 75%; font-size: 18px; }
  .rp-next .sw { display: inline-block; width: 11px; height: 11px; border-radius: 2px; margin: 0 6px 0 2px; vertical-align: -1px; }

  .rp-btns { display: grid; grid-template-columns: 1fr 1.6fr 1fr; grid-auto-columns: auto; grid-auto-flow: column; gap: 8px; }
  .rp-btns button { background: var(--sheet); border: none; border-radius: 999px; padding: 15px 8px; font-size: 19px; font-weight: 800; font-stretch: 80%; touch-action: manipulation; }
  .rp-btns button:active { background: var(--hi); }
  .rp-btns .rp-main { background: var(--ink); color: var(--sheet); }
  .rp-btns .rp-main:active { background: var(--press); }
  #rp-more { padding: 15px 16px; letter-spacing: 1px; }
  #rp-mute { padding: 15px 14px; }
  #rp-mute .mute-ico { width: 23px; height: 23px; }
  .rp-sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--sheet); border-radius: 14px 14px 0 0; padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; box-shadow: 0 -18px 40px var(--shadow); }
  .rp-sheet button { padding: 15px; font-size: 16px; font-weight: 650; border-radius: 999px; background: var(--paper); border: none; }
  .rp-sheet button.danger { color: var(--sheet); background: var(--bad); }
  .rp-sheet-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .rp-sheet button.ghost { background: transparent; color: var(--muted); }
  /* hold-to-confirm buttons: fill left to right while held, release early empties */
  .rp-sheet .hold-btn { position: relative; overflow: hidden; isolation: isolate; touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
  .rp-sheet .hold-btn::before { content: ""; position: absolute; inset: 0; z-index: -1; transform: scaleX(0); transform-origin: left; background: color-mix(in srgb, var(--ink) 16%, transparent); }
  .rp-sheet .hold-btn.danger::before { background: color-mix(in srgb, var(--ink) 38%, transparent); }
  .rp-sheet .hold-btn.filling::before { animation: hold-bar var(--hold-ms, 1000ms) linear forwards; }
@keyframes hold-bar { to { transform: scaleX(1); } }
}

/* phone held sideways: numbers left, workout right */
@media (pointer: coarse) and (max-height: 520px) and (orientation: landscape) {
  .rp { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); grid-template-rows: auto auto auto 1fr auto auto;
    grid-template-areas: "top top" "hero chart" "power chart" "metrics chart" "metrics next" "btns btns"; gap: 8px 14px; }
  .rp-top { grid-area: top; }
  .rp-top > div > span:last-child { font-size: 20px; }
  .rp-hero { grid-area: hero; padding: 4px 12px 7px; }
  .rp-int-label { font-size: 13px; }
  .rp-hero .rep-badge { top: 6px; left: 10px; }
  .rp-hero .rep-badge .rn { font-size: 18px; }
  .rp-hero .rep-badge .pips { margin-top: 3px; }
  .rp-count { font-size: clamp(34px, 10vh, 58px); margin: 0 0 3px; }
  .rp-target { font-size: 17px; padding: 0 9px; }
  .rp-target-sub { font-size: 14px; }
  .rp-power { grid-area: power; }
  .rp-pval { font-size: clamp(38px, 12.5vh, 72px); }
  .rp-gauge { margin-top: 4px; height: 6px; }
  .rp-metrics { grid-area: metrics; align-self: start; }
  .rp-m { padding: 3px 6px 4px; }
  .rp-k { font-size: 11px; }
  .rp-v { font-size: 22px; }
  .rp-s { font-size: 10.5px; min-height: 12px; }
  .rp-chart-wrap { grid-area: chart; }
  .rp-next { grid-area: next; }
  .rp-btns { grid-area: btns; }
  .rp-btns button { padding: 9px 8px; }
  .rp-m.bad { animation: none; }
}

/* Pain vision (Nov 25): js/pain.js sets --pain 0..1 and --beat on #ride. Edges blur, grey and darken; the interval
   card and tiles sit above it. Heart-rate throb, a clear flash when a hard rep ends. */
@property --pain { syntax: '<number>'; inherits: true; initial-value: 0; }
#ride { transition: --pain .45s linear; --vig: #07080a; }
.pain { position: absolute; inset: 0; z-index: 4; pointer-events: none; visibility: hidden; transition: visibility 0s .5s; }
#ride.pain-on .pain, #ride.pain-release .pain { visibility: visible; transition-delay: 0s; }
.pain > i { position: absolute; inset: 0; }
.pain-blur {
  backdrop-filter: blur(7px) saturate(.25); -webkit-backdrop-filter: blur(7px) saturate(.25); opacity: min(1, calc(var(--pain) * 1.3));
  -webkit-mask-image: radial-gradient(ellipse 70% 64% at 50% 50%, transparent calc(74% - var(--pain) * 50%), #000 calc(108% - var(--pain) * 38%));
  mask-image: radial-gradient(ellipse 70% 64% at 50% 50%, transparent calc(74% - var(--pain) * 50%), #000 calc(108% - var(--pain) * 38%));
}
.pain-vig { background: radial-gradient(ellipse 80% 74% at 50% 50%, transparent calc(64% - var(--pain) * 30%), color-mix(in srgb, var(--vig) 90%, transparent) 100%); opacity: min(1, calc(var(--pain) * 1.15)); }
.pain-throb { opacity: var(--pain); }
.pain-throb::after { content: ""; position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse 80% 74% at 50% 50%, transparent calc(50% - var(--pain) * 22%), color-mix(in srgb, var(--vig) 80%, transparent) 100%); }
#ride.pain-on:not(.pain-nohr) .pain-throb::after { animation: pain-beat var(--beat, .8s) linear infinite; } /* runs only while it shows, and only with an HR strap */
@keyframes pain-beat { 0% { opacity: 1; } 14% { opacity: .15; } 24% { opacity: .7; } 42% { opacity: 0; } 100% { opacity: 0; } }
.pain-flash { background: var(--paper); opacity: 0; }
#ride.pain-release .pain-flash { animation: pain-clear .7s ease-out; }
@keyframes pain-clear { 0% { opacity: .7; } 100% { opacity: 0; } }
#ride.pain-on #r-chart { filter: drop-shadow(calc(var(--pain) * 3.5px) 0 0 rgb(255 0 70 / .5)) drop-shadow(calc(var(--pain) * -3.5px) 0 0 rgb(0 190 255 / .5)); }
#ride :is(#r-interval, .tiles, .rt-elapsed, .rt-next):not(.rt-mover, .rt-ghost) { position: relative; z-index: 5; } /* above .pain; not the slide's copies, which stay absolute */
@media (prefers-reduced-motion: reduce) { .pain-throb::after, #ride.pain-release .pain-flash { animation: none; } }
:root[data-theme="dark"] .pain-blur { backdrop-filter: blur(9px) saturate(.2) brightness(.55); -webkit-backdrop-filter: blur(9px) saturate(.2) brightness(.55); } /* a dark vignette barely shows on a dark screen: dim instead */
