/* ===================== tokens ===================== */
:root {
  --window: #ffffff; --content: #fbfbfd; --sidebar: rgba(240, 240, 245, 0.78);
  --group: #ffffff; --group-border: rgba(0, 0, 0, 0.07);
  --fill: rgba(120, 120, 128, 0.1); --fill-strong: rgba(120, 120, 128, 0.18);
  --label: #1d1d1f; --secondary: #6e6e73; --tertiary: #aeaeb2; --sep: rgba(0, 0, 0, 0.08);
  --accent: #0071e3; --accent-fill: rgba(0, 113, 227, 0.12);
  --green: #28cd41; --red: #ff3b30; --orange: #ff9500; --yellow: #ffcc00;
  --shadow: 0 30px 80px rgba(20, 30, 60, 0.22), 0 0 0 0.5px rgba(0, 0, 0, 0.18);
  --sheet-shadow: 0 24px 70px rgba(0, 0, 0, 0.28), 0 0 0 0.5px rgba(0, 0, 0, 0.12);
  --z0: #8e8e93; --z1: #0a84ff; --z2: #30d158; --z3: #ffcc00; --z4: #ff9f0a; --z5: #ff453a;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  --rounded: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
      --window: #1e1e1e; --content: #1e1e1e; --sidebar: rgba(44, 44, 46, 0.72);
    --group: #2a2a2c; --group-border: rgba(255, 255, 255, 0.06);
    --fill: rgba(120, 120, 128, 0.2); --fill-strong: rgba(120, 120, 128, 0.32);
    --label: #f5f5f7; --secondary: #98989d; --tertiary: #636366; --sep: rgba(255, 255, 255, 0.08);
    --accent: #0a84ff; --accent-fill: rgba(10, 132, 255, 0.18);
    --shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 0 0.5px rgba(255, 255, 255, 0.12);
    --sheet-shadow: 0 24px 70px rgba(0, 0, 0, 0.6), 0 0 0 0.5px rgba(255, 255, 255, 0.12);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --window: #1e1e1e; --content: #1e1e1e; --sidebar: rgba(44, 44, 46, 0.72);
  --group: #2a2a2c; --group-border: rgba(255, 255, 255, 0.06);
  --fill: rgba(120, 120, 128, 0.2); --fill-strong: rgba(120, 120, 128, 0.32);
  --label: #f5f5f7; --secondary: #98989d; --tertiary: #636366; --sep: rgba(255, 255, 255, 0.08);
  --accent: #0a84ff; --accent-fill: rgba(10, 132, 255, 0.18);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 0 0.5px rgba(255, 255, 255, 0.12);
  --sheet-shadow: 0 24px 70px rgba(0, 0, 0, 0.6), 0 0 0 0.5px rgba(255, 255, 255, 0.12);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 13px; color: var(--label); background: var(--window);
  -webkit-font-smoothing: antialiased; overflow: hidden; user-select: none; -webkit-user-select: none; cursor: default;
}
input, textarea { user-select: text; -webkit-user-select: text; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
.hidden { display: none !important; }
.ic svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; display: block; }
.ic.fill svg { fill: currentColor; stroke: none; }

/* ===================== window ===================== */
.window {
  position: relative; width: 100vw; height: 100vh; overflow: hidden; background: var(--window);
  display: grid; grid-template-columns: 228px 1fr;
}
.sidebar {
  background: var(--sidebar); backdrop-filter: blur(40px) saturate(180%); -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-right: 0.5px solid var(--sep); padding: 14px 10px; display: flex; flex-direction: column; gap: 4px;
}
.app-name { font-weight: 600; font-size: 12px; color: var(--secondary); padding: 0 10px 10px; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 6px 10px; border-radius: 7px; font-size: 13px; color: var(--label); text-align: left; width: 100%; }
.nav-item .ic { color: var(--accent); }
.nav-item:hover { background: var(--fill); }
.nav-item.active { background: var(--fill-strong); font-weight: 500; }
.side-spacer { flex: 1; }
.side-status { display: flex; flex-direction: column; gap: 2px; padding: 8px 4px 2px; border-top: 0.5px solid var(--sep); }
.side-dev { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 7px; width: 100%; text-align: left; }
.side-dev:hover { background: var(--fill); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tertiary); flex-shrink: 0; display: inline-block; }
.dot.ok { background: var(--green); } .dot.wait { background: var(--orange); animation: blink 1.1s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }
.side-dev b { font-weight: 500; font-size: 12px; } .side-dev small { display: block; color: var(--secondary); font-size: 11px; }

.content { background: var(--content); overflow-y: auto; position: relative; }
.view { padding: 26px 34px 40px; max-width: 980px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.head-caption { color: var(--secondary); font-size: 12px; line-height: 1.45; margin: -10px 0 16px; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.sub { color: var(--secondary); margin: 4px 0 0; font-size: 13px; display: flex; align-items: center; gap: 6px; }
h2.section { font-size: 15px; font-weight: 600; margin: 26px 0 10px; }
.section-row { display: flex; align-items: baseline; justify-content: space-between; }
.link { color: var(--accent); font-size: 13px; }
.link:hover { text-decoration: underline; }

.btn { height: 28px; padding: 0 14px; border-radius: 7px; font-size: 13px; font-weight: 500; background: var(--group); box-shadow: 0 0.5px 1px rgba(0,0,0,.15), 0 0 0 0.5px var(--group-border); white-space: nowrap; }
.btn.primary { background: var(--accent); color: #fff; box-shadow: none; }
.btn.primary:disabled { opacity: 0.4; cursor: default; }
.btn.lg { height: 36px; padding: 0 20px; border-radius: 9px; font-size: 14px; }
.btn.danger { color: var(--red); }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 14px; background: var(--fill); font-size: 12px; font-weight: 500; }
.pill:hover { background: var(--fill-strong); }
.pill .ic svg { width: 14px; height: 14px; }
.badge-soft { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px; background: var(--fill); color: var(--secondary); }

.notice { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; background: var(--accent-fill); margin-bottom: 6px; }
.notice .ic { color: var(--accent); } .notice p { margin: 0; flex: 1; } .notice b { font-weight: 600; }
.notice.warn { background: rgba(255, 149, 0, 0.14); } .notice.warn .ic { color: var(--orange); }
.notice .ic svg { width: 20px; height: 20px; }

/* workout cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
/* Workouts page: three per row, so presets, custom workouts and the ramp test line up. */
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.wcard { text-align: left; border-radius: 12px; background: var(--group); overflow: hidden; box-shadow: 0 0 0 0.5px var(--group-border), 0 1px 3px rgba(0,0,0,.05); transition: transform .15s ease, box-shadow .15s ease; display: flex; flex-direction: column; }
.wcard:hover { transform: translateY(-2px); box-shadow: 0 0 0 0.5px var(--group-border), 0 8px 24px rgba(0,0,0,.1); }
.wcard-art { height: 92px; padding: 14px 14px 0; background: var(--fill); display: flex; align-items: flex-end; }
.wcard-art svg { width: 100%; height: 72px; display: block; }
.wcard-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 3px; }
.wcard-title { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.wcard-meta { color: var(--secondary); font-size: 12px; }
.wcard-stats { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; font-size: 12px; color: var(--secondary); }
.wcard-stats span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.wcard-stats .hs { color: #c99700; font-weight: 600; margin-left: auto; }
.hs-line { display: flex; align-items: center; gap: 6px; margin: 12px 0 0; font-size: 13px; color: var(--secondary); }
.hs-line .ic { color: #c99700; } .hs-line b { color: var(--label); }
.wcard-stats .ic svg, .m-label .ic svg, .sheet-foot .note .ic svg { width: 13px; height: 13px; }
.wcard.custom { background: transparent; box-shadow: inset 0 0 0 1.5px var(--fill-strong); }
.wcard.custom .wcard-art { background: transparent; align-items: center; justify-content: center; color: var(--accent); }
.wcard.custom .wcard-art .ic svg { width: 34px; height: 34px; stroke-width: 1.5; }

/* grouped lists */
.group { background: var(--group); border-radius: 10px; box-shadow: 0 0 0 0.5px var(--group-border); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; min-height: 44px; position: relative; width: 100%; text-align: left; }
.row + .row::before { content: ''; position: absolute; left: 14px; right: 0; top: 0; border-top: 0.5px solid var(--sep); }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-size: 13px; }
.row .detail { font-size: 12px; color: var(--secondary); }
.row .value { color: var(--secondary); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.row .chev { color: var(--tertiary); } .row .chev svg { width: 14px; height: 14px; }
.tile-icon { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.tile-icon .ic svg { width: 16px; height: 16px; }
.group-caption { font-size: 12px; color: var(--secondary); margin: 6px 14px 0; }
.group-title { font-size: 13px; font-weight: 600; margin: 22px 0 8px; }

.switch { width: 38px; height: 22px; border-radius: 11px; background: var(--fill-strong); position: relative; transition: background .2s; flex-shrink: 0; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch.on { background: var(--green); } .switch.on::after { transform: translateX(16px); }
.stepper { display: inline-flex; border-radius: 7px; box-shadow: 0 0 0 0.5px var(--group-border), 0 0.5px 1px rgba(0,0,0,.12); overflow: hidden; background: var(--group); }
.stepper button { width: 30px; height: 26px; display: grid; place-items: center; }
.stepper button + button { border-left: 0.5px solid var(--sep); }
.stepper button:hover { background: var(--fill); }
.stepper .ic svg { width: 13px; height: 13px; stroke-width: 2; }
.segmented { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--fill); gap: 2px; }
.segmented button { padding: 5px 14px; border-radius: 6px; font-size: 13px; }
.segmented button.on { background: var(--group); box-shadow: 0 1px 3px rgba(0,0,0,.14), 0 0 0 0.5px var(--group-border); font-weight: 500; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 4px 11px; border-radius: 12px; background: var(--fill); font-size: 12px; }
.chip.on { background: var(--accent); color: #fff; }
.num-field { width: 86px; height: 40px; border-radius: 8px; border: 0; text-align: center; font: 600 24px var(--rounded); color: var(--label); background: var(--group); box-shadow: inset 0 0 0 0.5px var(--group-border), 0 0.5px 1px rgba(0,0,0,.1); }
.num-field:focus { outline: 3px solid var(--accent-fill); }
.select { height: 28px; max-width: 240px; border-radius: 7px; border: 0; padding: 0 8px; font: 13px var(--font); color: var(--label); background: var(--group); box-shadow: inset 0 0 0 0.5px var(--group-border), 0 0.5px 1px rgba(0,0,0,.1); }
.stepper button:disabled { opacity: .35; cursor: default; background: none; }
.intensity-val { min-width: 48px; text-align: right; color: var(--label); font: 600 15px var(--rounded); font-variant-numeric: tabular-nums; }

/* focus multi-select */
.focus-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.focus { text-align: left; border-radius: 10px; padding: 10px 12px; background: var(--fill); box-shadow: inset 0 0 0 1.5px transparent; display: flex; flex-direction: column; gap: 3px; position: relative; }
.focus:hover { background: var(--fill-strong); }
.focus.on { background: var(--accent-fill); box-shadow: inset 0 0 0 1.5px var(--accent); }
.focus b { font-size: 13px; font-weight: 600; } .focus small { color: var(--secondary); font-size: 11px; }
.focus .check { position: absolute; top: 9px; right: 9px; width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--tertiary); display: grid; place-items: center; color: #fff; }
.focus.on .check { background: var(--accent); box-shadow: none; }
.focus .check svg { width: 11px; height: 11px; stroke-width: 3; }
.focus .zbar { height: 4px; border-radius: 2px; margin-top: 6px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat { background: var(--fill); border-radius: 10px; padding: 10px 12px; }
.stat small { display: block; color: var(--secondary); font-size: 11px; font-weight: 500; }
.stat b { font: 600 22px var(--rounded); letter-spacing: -0.01em; }
.stat b span { font-size: 13px; color: var(--secondary); font-weight: 500; margin-left: 2px; }
.zonebar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; }
.zonebar i { display: block; height: 100%; }
.zonelegend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: 11px; color: var(--secondary); }
.zonelegend span { display: inline-flex; align-items: center; gap: 5px; }
.zonelegend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

/* ===================== sheets ===================== */
.sheet-bd { position: absolute; inset: 0; background: rgba(0,0,0,.18); z-index: 20; display: flex; justify-content: center; align-items: flex-start; }
.sheet { width: min(660px, calc(100% - 40px)); max-height: calc(100% - 40px); overflow-y: auto; background: var(--window); border-radius: 0 0 12px 12px; box-shadow: var(--sheet-shadow); padding: 22px 24px 18px; animation: drop .28s cubic-bezier(.2,.9,.3,1.1); }
@keyframes drop { from { transform: translateY(-40px); opacity: 0; } }
.sheet h3 { font-size: 17px; font-weight: 700; margin: 0; }
.sheet .sheet-sub { color: var(--secondary); margin: 3px 0 16px; line-height: 1.45; }
.sheet-foot { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 20px; }
.sheet-foot .note { margin-right: auto; color: var(--secondary); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.sheet-foot .note .link { font-size: 12px; white-space: nowrap; }
.big-profile { background: var(--fill); border-radius: 10px; padding: 14px 14px 6px; }
.big-profile svg { width: 100%; height: 130px; display: block; }
.axis { display: flex; justify-content: space-between; font-size: 10px; color: var(--tertiary); margin-top: 4px; }
details.intervals { margin-top: 14px; }
details.intervals summary { cursor: pointer; color: var(--accent); font-size: 13px; list-style: none; }
details.intervals summary::-webkit-details-marker { display: none; }
.iv-table { margin-top: 10px; max-height: 200px; overflow-y: auto; }
.iv { display: grid; grid-template-columns: 18px 1fr 80px 70px 54px; gap: 8px; padding: 6px 4px; font-size: 12px; border-top: 0.5px solid var(--sep); align-items: center; }
.iv i { width: 8px; height: 8px; border-radius: 2px; }
.iv span:not(:nth-child(2)) { color: var(--secondary); text-align: right; font-variant-numeric: tabular-nums; }
.howto { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.howto div { background: var(--fill); border-radius: 10px; padding: 12px; font-size: 12px; color: var(--secondary); line-height: 1.45; }
.howto b { display: block; color: var(--label); font-size: 13px; margin-bottom: 3px; }

/* ===================== ride ===================== */
.ride {
  --rb: #000; --rp: #1c1c1e; --rp2: #2c2c2e; --rt: #fff; --rs: #8e8e93;
  --rgreen: #30d158; --rgreen-bg: rgba(48, 209, 88, 0.13); --ramber: #ffd60a; --rorange: #ff9f0a; --rred: #ff453a; --rpink: #ff375f;
  position: absolute; inset: 0; z-index: 30; background: var(--rb); color: var(--rt);
  display: grid; grid-template-rows: auto 1fr auto auto; padding: 16px 28px 18px; gap: 10px; transition: background .3s;
}
.ride.light {
  --rb: #f2f2f7; --rp: #ffffff; --rp2: #e5e5ea; --rt: #1d1d1f; --rs: #6e6e73;
  --rgreen: #1f9d44; --rgreen-bg: rgba(31, 157, 68, 0.12); --ramber: #b88700; --rorange: #c76a00; --rred: #d70015; --rpink: #d6264f;
}
.ride-top { display: flex; align-items: center; justify-content: space-between; padding-left: 70px; gap: 12px; }
.ride-title b { font-size: 15px; font-weight: 600; } .ride-title small { color: var(--rs); font-size: 12px; margin-left: 8px; }
.ride-time { display: flex; align-items: center; gap: 14px; color: var(--rs); font: 500 13px var(--rounded); font-variant-numeric: tabular-nums; }
.ride-time b { color: var(--rt); font-weight: 600; }
.icon-btn { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--rp); color: var(--rt); }
.icon-btn:hover { background: var(--rp2); }
.icon-btn .ic svg { width: 16px; height: 16px; }

/* The interval ring and the two target dials share one size. */
.ride { --d: clamp(150px, min(30vh, 22vw), 270px); }
.ride-main { display: grid; grid-template-columns: auto auto; justify-content: center; align-items: start; gap: 44px; align-self: center; min-height: 0; position: relative; }
.ring-col { display: flex; flex-direction: column; align-items: center; gap: 12px; padding-top: 16px; width: calc(var(--d) + 50px); position: relative; }
.ring { position: relative; width: var(--d); aspect-ratio: 1; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); position: relative; z-index: 1; }
.ring .halo { position: absolute; inset: 5%; border-radius: 50%; transition: box-shadow .6s, opacity .6s; z-index: 0; }
.ring.fire .halo { animation: firepulse 1.1s ease-in-out infinite; }
@keyframes firepulse { 50% { opacity: .55; } }
.ring-center { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.ring-zone { font: 600 11px var(--font); letter-spacing: .06em; text-transform: uppercase; }
.ring-name { font: 600 17px var(--font); margin-top: 2px; }
.ring-time { font: 700 calc(var(--d) * .21) var(--rounded); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.05; }
.ring-of { color: var(--rs); font: 500 12px var(--rounded); }

/* Heart rate, calories and on-target % under the countdown. */
.vitals { display: flex; gap: 8px; width: 100%; }
.vital { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 6px; border-radius: 14px; background: var(--rp); color: var(--rs); font-size: 11px; white-space: nowrap; }
.vital b { font: 700 21px var(--rounded); color: var(--rt); font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 5px; }
.vital-hr .ic { color: var(--rpink); }
.vital .ic svg { width: 14px; height: 14px; }
.next { display: flex; align-items: center; gap: 10px; background: var(--rp); border-radius: 12px; padding: 8px 14px; font-size: 13px; color: var(--rs); width: 100%; }
.next b { color: var(--rt); font-weight: 600; } .next i { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }

/* One group: the targets and the streak bar, lit from behind by the underglow. */
/* The glow is a sibling under the panel (not a negative z-index child), so WebKit draws it too. */
.group-wrap { position: relative; }
#r-group { position: relative; z-index: 1; border-radius: 28px; padding: 16px; background: var(--rp); }
#r-group.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.group-ambient { position: absolute; inset: -40px; border-radius: 56px; pointer-events: none; z-index: 0; will-change: transform, filter; opacity: 0; transition: opacity .8s, background .8s, inset .8s; filter: blur(40px); }
.group-ambient.flash { animation: ambflash .6s ease-out; }
@keyframes ambflash { 0% { opacity: 1; } }
.page-ambient { position: absolute; inset: 0; pointer-events: none; z-index: -1; opacity: 0; transition: opacity .8s; }
.ride-main, .ride-top, .ride-chart, .ride-controls { position: relative; z-index: 1; }

/* Target dials: band in green, a tick at the target, an arc from the target to you. */
.dials { display: flex; gap: 22px; }
.dial { position: relative; width: var(--d); aspect-ratio: 1; }
.dial svg { width: 100%; height: 100%; overflow: visible; }
.dial-track { stroke: var(--rp2); }
.dial-band { stroke: color-mix(in srgb, var(--rgreen) 45%, transparent); transition: d .3s; }
.dial-tick { stroke: var(--rt); stroke-opacity: .7; }
.dial-knob { stroke: var(--rp); transition: cx .3s, cy .3s, fill .3s; }
.dial path { transition: d .3s, stroke .3s; }
.dial-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding-top: 4%; }
.dial-label { color: var(--rs); font: 600 11px var(--font); letter-spacing: .07em; text-transform: uppercase; }
.dial-now { position: relative; font: 700 calc(var(--d) * .25) var(--rounded); letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 2px; margin-top: 2px; transition: color .25s; }
.dial-now .u { font: 700 15px var(--rounded); color: var(--rs); }
.dial-now .ar { font-size: .45em; position: absolute; left: 100%; bottom: .15em; margin-left: 2px; }
.dial.on .dial-now > span:first-child { color: var(--rgreen); }
.dial-tgt { font: 600 13px var(--rounded); color: var(--rs); margin-top: 4px; font-variant-numeric: tabular-nums; }
.dial-tgt b { color: var(--rt); }
.dial-range { font: 500 11px var(--rounded); color: var(--rs); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dial .pill-wrap { position: absolute; left: 0; right: 0; bottom: 3%; display: flex; justify-content: center; }
.dial-ends { position: absolute; left: 8%; right: 8%; bottom: 13%; display: flex; justify-content: space-between; font-size: 10px; color: var(--rs); }
.state-pill { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 10px; white-space: nowrap; display: inline-block; min-width: 112px; text-align: center; }

/* Streak bar: level badge, name, multiplier, the band's five levels, points. */
.streak { margin-top: 14px; background: var(--rp2); border-radius: 18px; padding: 12px 16px 11px; }
.ride.light .streak { background: #f2f2f7; }
.streak-top { display: flex; align-items: center; gap: 12px; }
.lvl { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font: 800 18px var(--rounded); color: var(--rs); background: var(--rp); flex-shrink: 0; transition: background .4s, color .4s, box-shadow .4s; font-variant-numeric: tabular-nums; }
.lvl.bump { animation: bump .6s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes bump { 40% { transform: scale(1.35); } }
.lvl.flicker { animation: flicker .9s steps(1) infinite; }
@keyframes flicker { 0% { opacity: 1; } 12% { opacity: .55; } 18% { opacity: .95; } 40% { opacity: .7; } 46% { opacity: 1; } 70% { opacity: .5; } 76% { opacity: .9; } }
.stxt { flex: 1; min-width: 0; }
.stxt b { display: block; font: 700 16px var(--font); transition: color .3s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stxt small { color: var(--rs); font: 600 12px var(--rounded); font-variant-numeric: tabular-nums; }
.stxt small .mx { color: var(--rt); }
.score { text-align: right; position: relative; }
.score b { display: block; font: 800 24px var(--rounded); font-variant-numeric: tabular-nums; line-height: 1.1; }
.score small { color: var(--rs); font-size: 11px; }
.pop { position: absolute; right: 0; top: -6px; font: 800 15px var(--rounded); pointer-events: none; animation: popup 1.1s ease-out forwards; white-space: nowrap; }
@keyframes popup { 0% { opacity: 0; transform: translateY(4px) scale(.8); } 20% { opacity: 1; transform: translateY(-6px) scale(1.12); } 100% { opacity: 0; transform: translateY(-36px) scale(1); } }
.pips { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: 11px; border-radius: 4px; overflow: hidden; }
.pip { position: relative; height: 8px; border-radius: 4px; background: var(--rp); overflow: hidden; }
.pip i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; transition: width .35s, background .4s; }
.pips .sheen { position: absolute; inset: 0; background: linear-gradient(100deg, transparent 35%, rgba(255,255,255,.5) 50%, transparent 65%); transform: translateX(-100%); animation: sheen var(--sd, 2.4s) linear infinite; pointer-events: none; }
.streak.cold .pips .sheen { display: none; }
@keyframes sheen { to { transform: translateX(100%); } }
/* At risk: the band's progress turns amber and drains over the grace period, and springs back on recovery. */
.pips.draining .pip i { transition: width 1s linear, background .3s; }
.pips.refill .pip i { transition: width .45s cubic-bezier(.3, 1.5, .5, 1), background .3s; }
.sfoot { display: flex; justify-content: space-between; gap: 10px; color: var(--rs); font-size: 11px; margin-top: 7px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sfoot .beat { color: #ffd60a; font-weight: 700; }
.testcard { margin-top: 14px; background: var(--rp2); border-radius: 14px; padding: 12px 14px; font-size: 12px; color: var(--rs); line-height: 1.45; max-width: calc(var(--d) * 2 + 22px); }
.testcard b { color: var(--rt); font-size: 14px; display: block; margin-bottom: 2px; }

/* Centre-screen moments, on the line through the ring and the dials. */
.center-moment { position: absolute; left: 0; right: 0; top: 40%; height: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 9; }
.cel, .gcard, .lost, .quick { background: color-mix(in srgb, var(--rp) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 20px 60px rgba(0,0,0,.45); text-align: center; }
.cel { padding: 22px 40px; border-radius: 28px; opacity: 0; }
.cel small { display: block; font: 700 12px var(--font); letter-spacing: .14em; text-transform: uppercase; color: var(--rs); }
.cel b { display: block; font: 800 46px var(--rounded); letter-spacing: -0.01em; line-height: 1.1; margin: 2px 0; white-space: nowrap; }
.cel span { font: 600 15px var(--rounded); color: var(--rs); }
.cel.lv { animation: celSmall 1.15s ease-out forwards; }
.cel.band { animation: celBig 2.3s ease-out forwards; padding: 30px 56px; }
.cel.band b { font-size: 64px; }
@keyframes celSmall { 0% { opacity: 0; transform: scale(.6); } 20% { opacity: 1; transform: scale(1.05); } 30% { transform: scale(1); } 70% { opacity: 1; } 100% { opacity: 0; transform: scale(1.03); } }
@keyframes celBig { 0% { opacity: 0; transform: scale(.5); } 14% { opacity: 1; transform: scale(1.08); } 22% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(1.04); } }
.gcard { padding: 18px 34px 20px; border-radius: 26px; animation: gin .2s ease-out; }
@keyframes gin { from { opacity: 0; transform: scale(.9); } }
.gcard .gn { font: 800 84px var(--rounded); line-height: 1; color: var(--ramber); font-variant-numeric: tabular-nums; }
.gcard .gn.tickanim { animation: gtick .5s ease-out; }
@keyframes gtick { 0% { transform: scale(1.35); opacity: .4; } 100% { transform: scale(1); opacity: 1; } }
.gcard b { display: block; font: 700 22px var(--font); margin-top: 4px; }
.gcard span { font: 600 14px var(--rounded); color: var(--rs); font-variant-numeric: tabular-nums; }
.quick { font: 800 30px var(--rounded); padding: 12px 28px; border-radius: 20px; animation: celSmall .9s ease-out forwards; }
.lost { padding: 20px 38px; border-radius: 26px; animation: celBig 2.2s ease-out forwards; }
.lost b { display: block; font: 800 34px var(--rounded); color: var(--rred); }
.lost span { font: 600 15px var(--rounded); color: var(--rs); }
.lost span em { font-style: normal; color: var(--rt); }
.burst { position: absolute; inset: 0; pointer-events: none; z-index: 8; }
.ember { position: absolute; width: var(--sz, 6px); height: var(--sz, 6px); border-radius: 50%; animation: rise var(--dur, 1.4s) ease-out forwards; }
@keyframes rise { 0% { opacity: 0; transform: translate(0, 0) scale(.5); } 12% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx, 0px), var(--dy, -110px)) scale(1.1); } }

/* Workout terrain with the heart-rate ridge underneath. */
.ride-chart { background: var(--rp); border-radius: 12px; padding: 10px 12px 8px; }
.ride.light .ride-chart { box-shadow: 0 0 0 .5px rgba(0,0,0,.06); }
.ride-chart svg { width: 100%; display: block; overflow: visible; }
.ride-chart text { font-family: var(--rounded); }

.lg-dots { width: 16px; border-top: 2px dotted var(--rt); display: inline-block; }
.lg-hr { width: 16px; height: 8px; border-radius: 2px; background: linear-gradient(90deg, #0a84ff, #30d158, #ff9f0a, #ff453a); display: inline-block; }

.ride-controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.ride-controls .end { justify-self: start; color: var(--rred); font-size: 14px; font-weight: 500; padding: 8px 14px; border-radius: 18px; background: var(--rp); }
.ride-controls .end:hover { background: var(--rp2); }
.ride-controls .center { display: flex; align-items: flex-start; gap: 22px; }
.round { width: 52px; height: 52px; border-radius: 50%; background: var(--rp); display: grid; place-items: center; color: var(--rt); }
.round:hover { background: var(--rp2); }
.round .ic svg { width: 20px; height: 20px; stroke-width: 2.2; }
.round-label { font-size: 11px; color: var(--rs); text-align: center; margin-top: 4px; }
.ctl { display: flex; flex-direction: column; align-items: center; }
.pause-btn { width: 66px; height: 66px; border-radius: 50%; background: #30d158; color: #000; display: grid; place-items: center; }
.pause-btn.paused { background: var(--rt); color: var(--rb); }
.pause-btn .ic svg { width: 26px; height: 26px; }
.ride-controls .right { justify-self: end; display: flex; gap: 18px; color: var(--rs); font: 500 12px var(--rounded); text-align: right; }
.ride-controls .right b { color: var(--rt); font-size: 18px; display: block; font-variant-numeric: tabular-nums; }

.headsup { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); z-index: 8; display: flex; align-items: center; gap: 14px; padding: 9px 22px 9px 10px; border-radius: 20px; box-shadow: 0 12px 34px rgba(0,0,0,.35); animation: hu .3s ease-out; color: #000; white-space: nowrap; }
.headsup.easy { background: var(--rp2); color: var(--rt); }
.headsup .hu-n { width: 44px; height: 44px; border-radius: 50%; background: rgba(0,0,0,.16); display: grid; place-items: center; font: 800 24px var(--rounded); }
.headsup.easy .hu-n { background: var(--rp); }
.headsup small { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; opacity: .7; }
.headsup b { font: 700 18px var(--font); } .headsup span { opacity: .8; margin-left: 8px; font-weight: 600; font-size: 14px; }
@keyframes hu { from { transform: translate(-50%, -12px); opacity: 0; } }


.overlay { position: absolute; inset: 0; background: color-mix(in srgb, var(--rb) 72%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; z-index: 10; }
.countdown { font: 800 180px var(--rounded); animation: pop .9s ease; }
@keyframes pop { from { transform: scale(1.4); opacity: 0; } 30% { opacity: 1; } }
.overlay h2 { font: 700 34px var(--rounded); margin: 0; }
.overlay p { color: var(--rs); margin: 0; font-size: 14px; }
.overlay .row-btns { display: flex; gap: 12px; }
.obtn { height: 40px; padding: 0 22px; border-radius: 20px; font-size: 15px; font-weight: 600; background: var(--rp2); color: var(--rt); }
.obtn.go { background: #30d158; color: #000; } .obtn.stop { color: var(--rred); }

/* summary (dark) */
.summary { position: absolute; inset: 0; z-index: 31; background: #000; color: #fff; overflow-y: auto; padding: 24px 0; }
.summary-inner { max-width: 760px; margin: 0 auto; padding: 0 28px; }
.badge-done { width: 64px; height: 64px; border-radius: 50%; background: #30d158; color: #000; display: grid; place-items: center; margin-bottom: 14px; flex: none; }
.badge-done .ic svg { width: 32px; height: 32px; stroke-width: 2.6; }
.summary h1 { font: 700 34px var(--rounded); }
/* Recap header: badge, title and Done on one line. */
.sum-head { display: flex; align-items: center; gap: 14px; }
.sum-head .grow { flex: 1; min-width: 0; }
.sum-head .badge-done { width: 44px; height: 44px; margin: 0; } .sum-head .badge-done .ic svg { width: 22px; height: 22px; }
.sum-head h1 { font-size: 26px; margin: 0; line-height: 1.15; } .sum-head .sub { margin: 2px 0 0; }
.sum-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 10px; }
.sum-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: #1c1c1e; border-radius: 14px; overflow: hidden; margin: 12px 0 10px; }
@media (min-width: 700px) { .summary .sum-grid { grid-template-columns: repeat(6, 1fr); } .summary .sum-grid:has(> div:nth-child(3):last-child) { grid-template-columns: repeat(3, 1fr); } }
.sum-grid div { background: #111; padding: 10px 14px; }
.sum-grid small { color: #8e8e93; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.sum-grid b { display: block; font: 700 24px var(--rounded); margin-top: 2px; }
.sum-grid b span { font-size: 13px; margin-left: 3px; }
.sum-card { background: #111; border-radius: 14px; padding: 12px 16px; margin-bottom: 10px; }
.sum-card h4 { margin: 0 0 8px; font-size: 13px; color: #8e8e93; text-transform: uppercase; letter-spacing: .05em; }
.pb-banner { display: flex; align-items: center; gap: 12px; background: linear-gradient(90deg, rgba(255,214,10,.18), rgba(255,159,10,.12)); border-radius: 12px; padding: 8px 14px; margin: 10px 0 0; color: #ffd60a; font-weight: 600; }
.pb-banner .ic svg { width: 22px; height: 22px; }
.sum-points { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: #1c1c1e; border-radius: 14px; overflow: hidden; margin: 14px 0 0; }
.sum-points > div { background: #111; padding: 10px 14px; }
.sum-points small { color: #8e8e93; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sum-points b { display: inline-block; font: 800 32px var(--rounded); margin-top: 2px; color: #ffd60a; font-variant-numeric: tabular-nums; }
.sum-points span { margin-left: 10px; color: #8e8e93; font-size: 13px; font-weight: 600; }
.sum-points span.new { color: #30d158; }
.streak-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.streak-sum div b { display: block; font: 700 20px var(--rounded); }
.streak-sum div small { color: #8e8e93; font-size: 12px; }
.zrow { display: grid; grid-template-columns: 70px 1fr 48px; gap: 8px; align-items: center; font-size: 12px; margin: 3px 0; }
.zrow .bar { height: 10px; border-radius: 5px; background: #1c1c1e; overflow: hidden; }
.zrow .bar i { display: block; height: 100%; border-radius: 5px; }
.zrow span:last-child { color: #8e8e93; text-align: right; font-variant-numeric: tabular-nums; }
.ftp-result { font: 800 96px var(--rounded); letter-spacing: -0.03em; line-height: 1; margin: 10px 0 6px; }
.ftp-result span { font-size: 32px; margin-left: 8px; color: #8e8e93; }

/* history / trends */
.pb-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.pb { background: var(--group); border-radius: 12px; padding: 12px 14px; box-shadow: 0 0 0 0.5px var(--group-border); }
.pb small { color: var(--secondary); font-size: 11px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.pb small .ic svg { width: 13px; height: 13px; }
.pb b { display: block; font: 600 24px var(--rounded); margin-top: 4px; }
.pb span { color: var(--secondary); font-size: 11px; }
.trend { background: var(--group); border-radius: 12px; padding: 14px 16px 10px; box-shadow: 0 0 0 0.5px var(--group-border); }
.trend-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.trend-head b { font: 600 22px var(--rounded); display: block; } .trend-head small { color: var(--secondary); }
.trend svg { width: 100%; height: 150px; display: block; }

/* devices */
.dev-head { display: flex; align-items: center; gap: 14px; padding: 14px; }
.dev-head .tile-icon { width: 44px; height: 44px; border-radius: 10px; }
.dev-head .tile-icon .ic svg { width: 24px; height: 24px; }
.dev-head .grow { flex: 1; min-width: 0; }
.dev-head .grow b { font-size: 15px; font-weight: 600; display: block; }
.status-text { font-size: 12px; display: inline-flex; align-items: center; gap: 6px; color: var(--secondary); }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--fill-strong); border-top-color: var(--secondary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.bars { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; }
.bars i { width: 3px; border-radius: 1px; background: var(--fill-strong); }
.bars i.on { background: var(--label); }

/* ===================== compact views ===================== */
/* Top bar: a slim, full-width strip with the whole workout profile */
.tbar { position: fixed; top: 10px; left: 10px; right: 10px; height: 108px; z-index: 60; border-radius: 16px; color: #fff; user-select: none;
  display: grid; grid-template-columns: 200px minmax(0, 1fr) auto auto; gap: 18px; align-items: center; padding: 10px 14px 10px 18px;
  background: rgba(22, 22, 24, 0.88); backdrop-filter: blur(30px) saturate(160%); -webkit-backdrop-filter: blur(30px) saturate(160%);
  box-shadow: 0 18px 50px rgba(0,0,0,.45), 0 0 0 .5px rgba(255,255,255,.14); }
.tb-now { min-width: 0; }
.tb-zone { font: 700 10px var(--font); letter-spacing: .08em; text-transform: uppercase; }
.tb-name { font: 600 15px var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.tb-left { font: 700 36px var(--rounded); font-variant-numeric: tabular-nums; line-height: 1.05; }
.tb-mid { min-width: 0; }
.tb-mid svg { width: 100%; display: block; }
#tb-plan { height: 50px; } #tb-hr { height: 12px; margin-top: 3px; border-radius: 2px; }
.tb-caption { display: flex; justify-content: space-between; gap: 10px; font: 600 11px var(--rounded); color: #8e8e93; margin-top: 5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tb-caption b { color: #fff; font-weight: 600; } .tb-caption i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: 0; }
.tb-metrics { display: flex; gap: 8px; align-items: stretch; }
/* Fixed widths so changing values (99 → 100 W, ×1 → On Fire) never shift the profile chart. */
.tb-m { flex: none; padding: 8px 12px; border-radius: 12px; background: rgba(255,255,255,.07); transition: background .3s, box-shadow .3s; }
#tb-pm { width: 134px; } #tb-cm { width: 160px; } .tb-hrm { width: 112px; }
.tb-m b > span:first-child { display: inline-block; min-width: 3ch; }
.tb-m.on { background: rgba(48,209,88,.16); box-shadow: inset 0 0 0 1px rgba(48,209,88,.5); }
.tb-m small { display: block; color: #8e8e93; font: 600 10px var(--font); letter-spacing: .06em; text-transform: uppercase; }
.tb-m b { font: 700 26px var(--rounded); font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 5px; margin-top: 2px; }
.tb-m.on b > span:first-child { color: #30d158; }
.tb-m em { font: 600 12px var(--rounded); font-style: normal; color: #8e8e93; white-space: nowrap; }
.tb-streak { flex: none; width: 88px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px; padding: 8px 12px; border-radius: 12px; background: rgba(255,255,255,.07); white-space: nowrap; font: 700 13px var(--rounded); color: #8e8e93; transition: box-shadow .5s, color .4s; }
.tb-streak svg { width: 18px; height: 18px; fill: currentColor; }
.tb-streak small { font: 600 11px var(--rounded); color: #8e8e93; font-variant-numeric: tabular-nums; }
.tb-btns { display: flex; flex-direction: column; gap: 6px; }
.tb-btns button { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #c7c7cc; background: rgba(255,255,255,.08); }
.tb-btns button:hover { background: rgba(255,255,255,.16); }
.tb-btns .ic svg { width: 14px; height: 14px; }
@media (max-width: 980px) { .tbar { grid-template-columns: 150px minmax(0, 1fr) auto; } .tb-metrics .tb-hrm, .tb-streak { display: none; } }
.mini { position: fixed; top: 48px; right: 48px; width: 350px; border-radius: 18px; z-index: 60; overflow: hidden; color: #fff; user-select: none;
  background: rgba(22, 22, 24, 0.86); backdrop-filter: blur(30px) saturate(160%); -webkit-backdrop-filter: blur(30px) saturate(160%);
  box-shadow: 0 24px 60px rgba(0,0,0,.5), 0 0 0 .5px rgba(255,255,255,.14); }
.mini-head { display: flex; align-items: center; gap: 8px; padding: 9px 10px 4px 14px; cursor: grab; font-size: 12px; color: #8e8e93; }
.mini-head b { color: #fff; font-weight: 600; } .mini-head .sp { flex: 1; }
.mini-head button { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #c7c7cc; background: rgba(255,255,255,.08); }
.mini-head button:hover { background: rgba(255,255,255,.16); }
.mini-head .ic svg { width: 13px; height: 13px; }
.mini-body { display: grid; grid-template-columns: 92px 1fr; gap: 14px; padding: 6px 14px 10px; align-items: center; }
.mini-ring { position: relative; width: 92px; height: 92px; }
.mini-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.mini-ring .c { position: absolute; inset: 0; display: grid; place-items: center; font: 700 22px var(--rounded); font-variant-numeric: tabular-nums; }
.mini-rows { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mini-rows .iname { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-rows .line { display: flex; align-items: baseline; gap: 6px; font: 600 13px var(--rounded); color: #8e8e93; font-variant-numeric: tabular-nums; }
.mini-rows .line b { font: 700 22px var(--rounded); color: #fff; transition: color .25s; }
.mini-rows .line b.on { color: #30d158; }
.mini-foot { display: flex; align-items: center; gap: 10px; padding: 0 14px 12px; font: 600 12px var(--rounded); color: #8e8e93; }
.mini-foot .mstreak { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 10px; background: rgba(255,255,255,.08); }
.mini-foot .mstreak svg { width: 13px; height: 13px; fill: currentColor; }
#mi-hr { display: inline-flex; align-items: center; gap: 5px; transition: color .4s; }
#mi-hr b { font: 700 14px var(--rounded); font-variant-numeric: tabular-nums; }
#mi-hr .ic svg { width: 12px; height: 12px; }
.tb-hrm, #tb-hrv, #tb-hrz { transition: color .4s, background .4s, box-shadow .4s; }
.tb-m small { white-space: nowrap; }
/* Full-workout timeline: elapsed | progress | time left (fixed widths so it never jitters) */
.mini-time { display: flex; align-items: center; gap: 10px; padding: 0 14px 8px; font: 600 12px var(--rounded); color: #c7c7cc; font-variant-numeric: tabular-nums; }
.mini-time #mi-el { min-width: 40px; }
.mini-time #mi-rem { min-width: 72px; text-align: right; color: #8e8e93; }
.mini-time .mprog { flex: 1; height: 4px; border-radius: 2px; background: rgba(255,255,255,.14); overflow: hidden; }
.mini-time .mprog i { display: block; height: 100%; background: #fff; }
/* ===================== app shell ===================== */
.sidebar { padding-top: 18px; }
/* Native window: the real traffic lights sit over the sidebar and a 28 px
   drag strip runs along the top, so nothing clickable goes there. */
body.native .sidebar { padding-top: 44px; }
body.native .view { padding-top: 38px; }
body.native .ride { padding-top: 34px; }
body.native .ride-top { padding-left: 70px; }
body:not(.native) .ride-top { padding-left: 0; }
body:not(.native) .compact-only { display: none !important; }

.error-bar { position: fixed; top: 36px; left: 50%; transform: translateX(-50%); z-index: 90; max-width: min(620px, calc(100vw - 32px));
  display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 14px; border-radius: 12px; font-size: 13px;
  background: var(--group); color: var(--label); box-shadow: 0 12px 40px rgba(0,0,0,.25), 0 0 0 .5px var(--group-border); animation: hu .25s ease-out; }
.error-bar .ic { color: var(--orange); } .error-bar.ok .ic { color: var(--green); } .error-bar p { margin: 0; flex: 1; line-height: 1.4; }
.error-bar button { color: var(--secondary); font-size: 16px; padding: 0 4px; }

.empty { padding: 22px 14px; text-align: center; color: var(--secondary); }
.row .del { color: var(--tertiary); font-size: 15px; padding: 2px 6px; border-radius: 5px; visibility: hidden; }
.row:hover .del { visibility: visible; } .row .del:hover { color: var(--red); background: var(--fill); }
.picker-row.weak .title { color: var(--secondary); }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--secondary); }
.btn:disabled { opacity: .45; cursor: default; }

/* Compact views fill the whole (native) window. */
body.compact .window, body.compact .error-bar { display: none !important; }
body.compact { background: #161618; }
body.compact .mini, body.compact .tbar { position: fixed; inset: 0; width: auto; height: auto; border-radius: 0; box-shadow: none; background: #161618; }
body.compact .mini { display: flex; flex-direction: column; justify-content: space-between; }
body.compact .tbar { padding: 10px 14px 10px 18px; }
.tb-now { cursor: grab; }

/* Short windows: let the ride screen scroll rather than overlap. */
@media (max-height: 640px) {
  .ride { overflow-y: auto; grid-template-rows: auto auto auto auto; align-content: start; }
}

@media (max-width: 760px) {
  .window { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar, body.native .sidebar { flex-direction: row; overflow-x: auto; padding: 8px; align-items: center; }
  .app-name, .side-spacer, .side-status { display: none; }
  .nav-item { width: auto; white-space: nowrap; }
  .view, body.native .view { padding: 18px 16px 120px; }
  .stats, .pb-tiles { grid-template-columns: 1fr 1fr; }
  .focus-grid, .howto { grid-template-columns: 1fr; }
  .sheet-foot { flex-wrap: wrap; } .sheet-foot .note { flex-basis: 100%; }
  .ride { padding: 12px 16px 20px; overflow-y: auto; grid-template-rows: auto auto auto auto; align-content: start; }
  .ride-top, body.native .ride-top { padding-left: 0; flex-wrap: wrap; }
  .ride { --d: clamp(130px, 40vw, 220px); }
  .ride-main { grid-template-columns: 1fr; justify-items: center; gap: 16px; }
  .ring-col { padding-top: 0; }
  .dials { gap: 8px; } #r-group { padding: 12px; }
  .cel b { font-size: 30px; } .cel.band b { font-size: 38px; }
  .ride-controls { grid-template-columns: 1fr; justify-items: center; gap: 12px; }
  .ride-controls .end, .ride-controls .right { justify-self: center; }
  .headsup { top: 10px; }
}

/* ===================== browser version: quick start + full-app drawer ===================== */
/* Design: mockups/splash.html. The full app (.window) slides in from the left over the quick start. */
body:not(.web) .web-only { display: none !important; }
.side-top { display: flex; align-items: center; gap: 2px; }
body.web .side-top { margin: -4px 0 8px; }
body.web .side-top .app-name { padding: 0 6px; }
.side-close { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--secondary); flex: none; }
.side-close:hover { background: var(--fill); color: var(--label); }
.side-close .ic svg { width: 19px; height: 19px; }

body.web .window { position: fixed; inset: 0; z-index: 10; transform: translateX(-100%); visibility: hidden; box-shadow: 0 0 60px rgba(0, 0, 0, .25);
  transition: transform .45s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .45s; }
body.web.app-open .window, body.web.riding .window { transform: none; visibility: visible; transition: transform .45s cubic-bezier(.2, .8, .2, 1); }
body.web.riding .window, body.instant .window { transition: none !important; }

.app-btn { position: fixed; top: 14px; left: 14px; z-index: 5; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--secondary); transition: background .15s, color .15s; }
.app-btn:hover { background: var(--fill); color: var(--label); }
.app-btn .ic svg { width: 22px; height: 22px; stroke-width: 1.8; }
.fs-btn { left: auto; right: 14px; }
/* Subtle label under an icon button on hover (data-label). */
.lbl { position: relative; }
.app-btn.lbl { position: fixed; }
.lbl::after { content: attr(data-label); position: absolute; top: calc(100% + 4px); right: 0; white-space: nowrap; font-size: 12px; color: var(--secondary);
  padding: 3px 8px; border-radius: 6px; background: var(--group); box-shadow: 0 0 0 0.5px var(--group-border), 0 2px 8px rgba(0, 0, 0, .08);
  opacity: 0; transform: translateY(-2px); transition: opacity .15s, transform .15s; pointer-events: none; }
.lbl:hover::after, .lbl:focus-visible::after { opacity: 1; transform: none; }
.ride .lbl::after { z-index: 5; }
.fs-btn .ic svg { width: 20px; height: 20px; }

.splash { position: fixed; inset: 0; overflow-y: auto; background: var(--content); font-size: 15px; line-height: 1.45; }
.sp-stage { min-height: 100%; display: grid; place-items: center; padding: 56px 16px 64px; }
.sp-step { width: min(620px, 100%); opacity: 0; transform: translateY(10px); transition: opacity .32s ease, transform .32s ease; }
.sp-step.on { opacity: 1; transform: none; }
.sp-step[hidden] { display: none; }

.sp-q { font-size: clamp(30px, 6.4vw, 46px); line-height: 1.1; letter-spacing: -0.025em; text-align: center; margin: 0 0 32px; }
.sp-durations { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.sp-dur { aspect-ratio: 1; border-radius: 18px; background: var(--group); box-shadow: 0 0 0 1px var(--group-border), 0 1px 2px rgba(0, 0, 0, .04);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; transition: transform .15s, box-shadow .15s; }
.sp-dur:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px var(--group-border), 0 6px 18px rgba(0, 0, 0, .08); }
.sp-dur b { font: 700 30px/1 var(--rounded); }
.sp-dur span { color: var(--secondary); font-size: 13px; }
.sp-dur.custom b { font-size: 17px; }
.sp-dur.custom .ic { color: var(--accent); margin-bottom: 4px; } .sp-dur.custom .ic svg { width: 22px; height: 22px; }

.sp-back { color: var(--accent); font-size: 14px; display: inline-flex; align-items: center; gap: 4px; margin-bottom: 18px; }
.sp-back .ic { transform: rotate(180deg); } .sp-back .ic svg { width: 15px; height: 15px; }
.sp-fade > * { opacity: 0; transform: translateY(8px); transition: opacity .4s ease, transform .4s ease; }
.on .sp-fade > * { opacity: 1; transform: none; }
.on .sp-fade > :nth-child(2) { transition-delay: .06s; } .on .sp-fade > :nth-child(3) { transition-delay: .12s; }
.on .sp-fade > :nth-child(4) { transition-delay: .18s; } .on .sp-fade > :nth-child(5) { transition-delay: .24s; }
.on .sp-fade > :nth-child(6) { transition-delay: .3s; } .on .sp-fade > :nth-child(7) { transition-delay: .36s; }

.sp-label { font-weight: 600; } .sp-label span { color: var(--secondary); font-weight: 400; }
.sp-duration { background: var(--group); border-radius: 18px; box-shadow: 0 0 0 1px var(--group-border); padding: 16px 18px 12px; margin-bottom: 22px; }
.sp-duration[hidden] { display: none; }
.sp-d-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sp-num { display: inline-flex; align-items: baseline; gap: 4px; cursor: text; }
.sp-num input { width: 3.2ch; font: 700 34px/1 var(--rounded); color: var(--label); background: transparent; border: 0; border-radius: 8px; text-align: right; padding: 2px 4px;
  -moz-appearance: textfield; transition: background .15s, box-shadow .15s; }
.sp-num input::-webkit-inner-spin-button, .sp-num input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.sp-num input:hover { background: var(--fill); }
.sp-num input:focus { outline: none; background: var(--fill); box-shadow: 0 0 0 2px var(--accent); }
.sp-num span { color: var(--secondary); font-size: 15px; }
.sp-num.sm input { font-size: 22px; width: 3.4ch; background: var(--group); }
.sp-duration input[type="range"] { width: 100%; accent-color: var(--accent); margin: 10px 0 0; }
.sp-ticks { display: flex; justify-content: space-between; color: var(--tertiary); font-size: 12px; }

.sp-title { font-size: clamp(26px, 5.5vw, 36px); line-height: 1.15; letter-spacing: -0.02em; margin: 0; }
.sp-meta { color: var(--secondary); margin: 4px 0 18px; }
.sp-profile { background: var(--group); border-radius: 18px; box-shadow: 0 0 0 1px var(--group-border); padding: 16px 16px 10px; }
.sp-profile svg { width: 100%; height: 130px; display: block; }
#sp-profile { position: relative; }
.sp-ftp-line { position: absolute; left: 0; right: 0; border-top: 1.5px dashed var(--secondary); opacity: .7; pointer-events: none; }
.sp-ftp-line span { position: absolute; right: 0; bottom: 3px; font-size: 11px; font-weight: 600; color: var(--secondary); background: var(--group); padding: 0 4px; border-radius: 4px; }
.sp-axis { display: flex; justify-content: space-between; color: var(--tertiary); font-size: 11px; margin-top: 6px; }
.sp-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 12px 0 22px; }
.sp-fact { background: var(--fill); border-radius: 14px; padding: 10px 12px; }
.sp-fact small { display: block; color: var(--secondary); font-size: 12px; }
.sp-fact b { font: 700 20px var(--rounded); } .sp-fact b span { font: 500 13px var(--font); color: var(--secondary); margin-left: 2px; }

.sp-adjust { margin: -10px 0 22px; }
.sp-adj-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--secondary); flex-wrap: wrap; }
.sp-adj-line b { color: var(--label); font-weight: 600; }
.sp-adj-panel { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .3s ease, opacity .25s ease; }
.sp-adj-panel > div { overflow: hidden; }
.sp-adjust.open .sp-adj-panel { grid-template-rows: 1fr; opacity: 1; }
.sp-adj-inner { margin-top: 10px; padding: 14px 16px; border-radius: 14px; background: var(--fill); display: grid; gap: 10px; }
.sp-adj-row { display: flex; align-items: center; justify-content: space-between; }
.sp-adj-or { font-size: 13px; color: var(--secondary); }
.sp-levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sp-level { padding: 10px; border-radius: 12px; background: var(--group); text-align: left; display: grid; gap: 1px; box-shadow: 0 0 0 1px var(--group-border); }
.sp-level b { font-size: 13px; } .sp-level small { color: var(--secondary); font-size: 12px; }
.sp-level.on { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-fill); }

.sp-focus-block { margin: 0 0 26px; }
.sp-focuses { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.sp-focus { text-align: left; padding: 12px; border-radius: 12px; background: var(--fill); display: grid; gap: 2px; position: relative; transition: background .15s, box-shadow .15s; }
.sp-focus b { font-size: 14px; font-weight: 600; }
.sp-focus small { color: var(--secondary); font-size: 12px; line-height: 1.3; }
.sp-focus i { position: absolute; top: 12px; right: 12px; width: 10px; height: 10px; border-radius: 3px; }
.sp-focus.on { background: var(--accent-fill); box-shadow: inset 0 0 0 2px var(--accent); }

.sp-cta { width: 100%; height: 52px; border-radius: 14px; background: var(--accent); color: #fff; font-size: 17px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 10px; transition: filter .15s, transform .1s; }
.sp-cta:hover { filter: brightness(1.08); } .sp-cta:active { transform: scale(.99); }
.sp-cta.big { height: 60px; font-size: 19px; border-radius: 16px; }
.sp-cta .ic svg { width: 22px; height: 22px; stroke-width: 2; }
.sp-cta.go { background: var(--green); }
.sp-cta[disabled] { opacity: .6; cursor: default; filter: none; transform: none; }
.sp-spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: spin .8s linear infinite; }
.sp-perm { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--fill); color: var(--secondary); font-size: 13px; line-height: 1.45; }
.sp-perm .ic { color: var(--accent); flex: none; margin-top: 1px; }
.sp-perm b { color: var(--label); font-weight: 600; }
.sp-compat { color: var(--tertiary); font-size: 12px; text-align: center; margin: 14px 8px 0; line-height: 1.5; }
.sp-compat b { color: var(--secondary); font-weight: 600; }
.sp-warn { display: flex; gap: 10px; padding: 14px; border-radius: 14px; background: rgba(255, 149, 0, 0.13); font-size: 14px; line-height: 1.45; }
.sp-warn .ic { color: var(--orange); flex: none; } .sp-warn b { display: block; }
.sp-link { color: var(--accent); font-size: 14px; font-weight: 500; margin-top: 8px; }
.sp-link.sm { font-size: 13px; font-weight: 600; margin: 0; }
.sp-connected { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--green); font-weight: 600; margin-bottom: 12px; }
.sp-connected.sm { margin: 14px 0 0; font-size: 14px; }
.sp-subtle { display: flex; align-items: center; gap: 6px; margin: 12px auto 0; color: var(--accent); font-size: 14px; }
.sp-subtle .ic svg { width: 15px; height: 15px; }
.sp-age { font-size: 13px; color: var(--secondary); margin-top: 6px; display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.sp-stepper { display: inline-flex; align-items: center; border-radius: 8px; background: var(--fill); }
.sp-stepper button { width: 30px; height: 26px; color: var(--label); font-size: 16px; }
.sp-stepper b { min-width: 28px; text-align: center; color: var(--label); }

/* Recap: "targets for next time" (learning the FTP from the ride). */
.sum-ftp p { color: #c7c7cc; margin: 0 0 14px; line-height: 1.5; } .sum-ftp p b { color: #fff; }
.sum-feels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sum-feel { padding: 12px 6px; border-radius: 14px; background: #1c1c1e; color: #fff; display: grid; gap: 4px; font-weight: 600; font-size: 14px; justify-items: center; }
.sum-feel:hover { background: #2c2c2e; }
.sum-feel span { font-size: 28px; }
.sum-ftp .row-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.sum-ftp .done { color: #30d158; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sum-ftp .done button { color: #0a84ff; font-weight: 600; }
.sum-ftp .ramp { margin: 14px 0 0; font-size: 13px; color: #8e8e93; } .sum-ftp .ramp button { color: #0a84ff; font-weight: 600; }

@media (max-width: 760px) {
  body.web .side-top { margin: 0; } body.web .side-top .app-name { display: none; }
}
@media (max-width: 520px) {
  .sp-durations { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sp-dur { aspect-ratio: auto; height: 84px; }
  .sp-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sp-levels, .sp-focuses { grid-template-columns: 1fr; }
}

/* About (browser version) */
.about { max-width: 680px; }
.about .lead { font-size: 16px; line-height: 1.5; margin: 0 0 18px; }
.about p, .about li { color: var(--secondary); line-height: 1.55; font-size: 14px; }
.about ul { padding-left: 18px; margin: 0; } .about li b { color: var(--label); }
.about a { color: var(--accent); }

/* Feedback (browser version) */
.fb-box { padding: 12px 14px; max-width: 680px; position: relative; }
.fb-text { display: block; width: 100%; min-height: 170px; resize: vertical; border: 0; background: transparent; color: var(--label); font: 14px/1.5 var(--font); outline: none; }
.fb-text::placeholder { color: var(--tertiary); }
.fb-trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.fb-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; border-top: 0.5px solid var(--sep); padding-top: 10px; margin-top: 6px; }
.fb-status { margin-right: auto; color: var(--secondary); font-size: 12px; }
.fb-done { display: flex; align-items: center; gap: 12px; padding: 8px 2px; }
.fb-done > .ic { color: var(--green); } .fb-done > .ic svg { width: 24px; height: 24px; }
.fb-done div { flex: 1; color: var(--secondary); line-height: 1.5; } .fb-done div b:first-child { display: block; color: var(--label); }
#v-feedback .group-caption { max-width: 680px; }

/* Quick start: age, asked when a heart-rate strap connects */
.sp-age-ask { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; padding: 10px 14px; border-radius: 12px; background: var(--accent-fill); font-size: 13px; color: var(--secondary); }
.sp-age-ask b { color: var(--label); }
.sp-perm .sp-hint { display: block; margin-top: 6px; }
