/* /cycle additions on top of the shared /course sheet */
:root, [data-theme="dark"] {
  /* signal ramp: data only. ice -> white -> amber -> coral. chrome stays green, the map stays graphite */
  --sig-0: #5fc8ff; --sig-1: #f2f6f8; --sig-2: #ffb547; --sig-3: #ff5a47;
  --speed-0: var(--sig-0); --speed-1: var(--sig-0); --speed-2: var(--sig-1);
  --hr-0: var(--sig-2);    --hr-1: var(--sig-3);    --hr-2: #ffd3ce;
  --cost-0: var(--sig-2);  --cost-1: var(--sig-2);  --cost-2: #fff5bf;
  --ext: var(--sig-0);    /* bike: ice */
  --int: var(--sig-3);    /* body: coral */
  --hot: var(--sig-3);
  --cool: var(--sig-0);
  --grid: #1b231c;
  --route-dim: #262b2f;
  --lay: var(--sig-3);
  --map-tint: #5c646b;
}
[data-theme="light"] {
  --sig-0: #1f7fc4; --sig-1: #5b6670; --sig-2: #c98a1c; --sig-3: #d1402d;
  --speed-0: var(--sig-0); --speed-1: var(--sig-0); --speed-2: var(--sig-1);
  --hr-0: var(--sig-2); --hr-1: var(--sig-3); --hr-2: #7a1a10;
  --cost-0: var(--sig-2); --cost-1: var(--sig-2); --cost-2: #6b4a00;
  --ext: var(--sig-0); --int: var(--sig-3); --hot: var(--sig-3); --cool: var(--sig-0);
  --grid: #e3e3d6;
  --route-dim: #c9cdbd;
  --sig-1: #5b6670; --sig-3: var(--hr-1);
  --map-tint: #6b7278;
}

/* hero */
.ride-hero { align-items: flex-end; }
.mono-sub { font-family: var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.ride-score { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.rs-label { font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: .18em; color: var(--ink-3); }
.rs-n { font-family: var(--font-mono); font-size: clamp(3rem, 2rem + 4vw, 5rem); font-weight: 700; line-height: 1; color: var(--ink); letter-spacing: -.02em; }
.rs-band { font-family: var(--font-mono); font-size: var(--text-sm); letter-spacing: .14em; color: var(--accent); }
.rs-band.solid { color: var(--accent); } .rs-band.steady { color: var(--sig-2); } .rs-band.costly { color: var(--hot); } .rs-band.none { color: var(--ink-3); }
@media (max-width: 860px) { .ride-score { align-items: flex-start; text-align: left; } }

/* four cards */
.cards-section { padding-bottom: var(--space-12); }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); }
@media (max-width: 860px) { .metric-grid { grid-template-columns: repeat(2, 1fr); } }
.metric {
  text-align: left; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
  padding: var(--space-5, 1.25rem) var(--space-4); display: flex; flex-direction: column; gap: var(--space-1);
  color: var(--ink); cursor: pointer; font-family: var(--font-body); transition: border-color .18s;
}
.metric:hover, .metric.on { border-color: var(--accent-dim); }
.m-label { font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: .16em; color: var(--ink-3); }
.m-n { font-family: var(--font-mono); font-size: clamp(1.9rem, 1.4rem + 1.6vw, 2.6rem); font-weight: 700; line-height: 1.05; margin-top: var(--space-1); }
.m-sub { font-size: var(--text-sm); color: var(--ink-2); }
.m-sub.good { color: var(--accent); } .m-sub.warn { color: var(--sig-2); } .m-sub.bad { color: var(--hot); }
.metric[data-k=cost] .m-n { color: var(--sig-2); } .metric[data-k=drift] .m-n { color: var(--sig-3); }
.metric-grid { grid-template-columns: repeat(2, 1fr); }
#overlayChips .lchip.on[data-ov] { color: var(--sig-1); border-color: var(--sig-2); background: color-mix(in oklab, var(--sig-2) 22%, var(--bg-2)); }
.bb-group [data-ext].on { color: var(--sig-1); border-color: var(--sig-0); background: color-mix(in oklab, var(--sig-0) 22%, var(--bg-2)); }
.bb-group [data-int].on { color: var(--sig-1); border-color: var(--sig-3); background: color-mix(in oklab, var(--sig-3) 22%, var(--bg-2)); }
.m-src { font-family: var(--font-mono); font-size: .68rem; color: var(--ink-3); margin-top: var(--space-2); letter-spacing: .04em; }
.metric-explain { margin-top: var(--space-3); border: 1px solid var(--accent-dim); border-radius: 12px; padding: var(--space-4) var(--space-5, 1.25rem); background: color-mix(in oklab, var(--accent) 5%, var(--bg-2)); font-size: var(--text-sm); color: var(--ink-2); }
.metric-explain[hidden] { display: none; }
.metric-explain b { color: var(--ink); font-weight: 700; }
.metric-explain .formula { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--ink); background: var(--bg-3); padding: var(--space-2) var(--space-3); border-radius: 8px; display: block; margin: var(--space-2) 0; overflow-x: auto; white-space: nowrap; }
.metric-explain .src { font-family: var(--font-mono); font-size: .68rem; color: var(--ink-3); display: block; margin-top: var(--space-2); letter-spacing: .04em; }

/* map */
#rideMap { display: block; width: 100%; height: auto; }
.f-route-dim { stroke: var(--route-dim); stroke-width: 6; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.f-route { fill: none; stroke-width: 3.2; stroke-linejoin: round; stroke-linecap: round; }
.f-stop { fill: var(--bg); stroke: var(--sig-1); stroke-opacity: .7; stroke-width: 1.6; }
.f-hot { fill: none; stroke: var(--hot); stroke-width: 1.4; opacity: .9; }
.f-start { fill: var(--sig-1); }
.f-mile { font-family: var(--font-mono); font-size: 10px; fill: var(--ink-3); }
.f-mile-dot { fill: var(--ink-3); }
.f-grid { stroke: var(--grid); stroke-width: 1; }
.f-scale { stroke: var(--ink-2); stroke-width: 1.5; }
.f-scale-t { font-family: var(--font-mono); font-size: 10px; fill: var(--ink-2); }
.f-north { font-family: var(--font-mono); font-size: 10px; fill: var(--ink-2); }
.f-wind { stroke: var(--cool); stroke-width: 1.6; fill: none; }
.f-wind-h { fill: var(--cool); }
.f-seg-lbl { font-family: var(--font-mono); font-size: 10px; fill: var(--ink-2); letter-spacing: .06em; }
/* basemap: phosphor streets */
.tile { opacity: 0; transition: opacity .9s ease; }
.tile.in { opacity: 1; }
.basemap-mute { fill: var(--bg); opacity: .7; pointer-events: none; }
[data-theme="light"] .basemap-mute { opacity: .55; }
.f-route-dim { opacity: .55; transition: stroke .6s ease, opacity .6s ease; }
/* what is still ahead in the replay: a faint dotted intent line */
.f-ahead { fill: none; stroke: var(--bg); stroke-width: 11; stroke-opacity: .6; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; transition: opacity .6s ease; }
.f-ahead-dot { fill: none; stroke: var(--sig-1); stroke-width: 1.3; stroke-opacity: .38; stroke-dasharray: 2 6; stroke-linecap: round; pointer-events: none; transition: opacity .6s ease; }
.ov-route { filter: none; }
[data-theme="light"] .ov-route { filter: none; }
.map-wrap.intro .f-ahead, .map-wrap.intro .f-ahead-dot, .map-wrap.intro #cursor, .map-wrap.intro .f-trail, .map-wrap.intro .ov-route { opacity: 0; }
.ov-route, #cursor, .f-trail { transition: opacity .6s ease; }
.map-wrap.intro .f-route-dim { opacity: 1; stroke: var(--sig-1); }
/* comet trail behind the marker */
.f-trail { fill: none; stroke: #fff; stroke-width: 3.2; stroke-linejoin: round; stroke-linecap: round; opacity: .92; pointer-events: none; filter: drop-shadow(0 0 4px rgba(255,255,255,.45)); }
[data-theme="light"] .f-trail { stroke: var(--ink); filter: none; }
/* the marker: beats at the recorded heart rate via --beat */
#cursor { --beat: 1s; }
.now-halo { fill: var(--lay); opacity: .5; transform-box: fill-box; transform-origin: center; animation: beatHalo var(--beat) ease-out infinite; }
.now-ring { fill: none; stroke: var(--lay); stroke-width: 2.4; filter: drop-shadow(0 0 6px rgba(0,0,0,.7)); }
.now-dot { fill: #fff; stroke: var(--lay); stroke-width: 2.4; transform-box: fill-box; transform-origin: center; animation: beatDot var(--beat) ease-in-out infinite; }
.now-lbl-bg { fill: var(--bg); opacity: .86; stroke: var(--line); stroke-width: 1; }
.now-lbl { font-family: var(--font-mono); fill: var(--ink); letter-spacing: .04em; }
[data-theme="light"] .now-ring { stroke: var(--ink); filter: none; }
@keyframes beatHalo { 0% { transform: scale(.55); opacity: .55; } 100% { transform: scale(2.6); opacity: 0; } }
@keyframes beatDot { 0%, 100% { transform: scale(1); } 18% { transform: scale(1.32); } 36% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .now-halo, .now-dot { animation: none; } }
.ov-legend { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line); font-family: var(--font-mono); font-size: var(--text-xs); color: var(--ink-2); flex-wrap: wrap; }
.ovl-bar { display: inline-block; width: 120px; height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--sig-0), var(--sig-1), var(--sig-2), var(--sig-3)); }
.ovl-name { margin-left: auto; color: var(--ink-3); letter-spacing: .08em; }
.ovl-attr { flex-basis: 100%; font-size: .6rem; color: var(--ink-3); letter-spacing: .04em; }
.ovl-attr a { color: var(--ink-3); }
/* replay length */
.dur-chips { display: inline-flex; gap: 4px; margin-left: 4px; }
.dchip { font-family: var(--font-mono); font-size: .62rem; letter-spacing: .06em; padding: 4px 8px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink-3); cursor: pointer; }
.dchip.on { color: var(--accent); border-color: var(--accent-dim); }
.lchip.all { border-style: dashed; }
/* every layer at once */
.layer-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--space-2); margin-top: var(--space-3); }
.layer-grid[hidden] { display: none; }
.lg-card { display: flex; flex-direction: column; text-align: left; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); color: var(--ink); cursor: pointer; overflow: hidden; transition: border-color .18s; }
.lg-card:hover, .lg-card.on { border-color: var(--accent-dim); }
.lg-map { display: block; width: 100%; height: auto; background: var(--bg); }
.lg-map .f-route-dim { stroke-width: 10; opacity: .5; }
.lg-map .f-start { r: 10; }
.lg-cap { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px 10px; font-family: var(--font-mono); font-size: .66rem; letter-spacing: .08em; }
.lg-name { color: var(--ink); text-transform: uppercase; }
.lg-range { color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.lg-range.off { color: var(--hot); opacity: .8; }
.lg-bar { display: inline-block; flex: 1; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--sig-0), var(--sig-1), var(--sig-2), var(--sig-3)); }
@media (max-width: 860px) { .layer-grid { grid-template-columns: repeat(2, 1fr); } .playback-bar { flex-wrap: wrap; } .dur-chips { flex-basis: 100%; justify-content: flex-end; margin: 0; } }

/* live strip under the map */
.live-strip { display: grid; grid-template-columns: repeat(11, 1fr); gap: 1px; margin-top: var(--space-3); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--line); }
.live-strip[hidden] { display: none; }
.ls { background: var(--bg-2); padding: var(--space-3) var(--space-3); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ls.wide { grid-column: span 2; }
.ls-l { font-family: var(--font-mono); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.ls-v { font-family: var(--font-mono); font-size: var(--text-sm); font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 860px) { .live-strip { grid-template-columns: repeat(4, 1fr); } .ls.wide { grid-column: span 4; } }
@media (max-width: 480px) { .live-strip { grid-template-columns: repeat(3, 1fr); } .ls.wide { grid-column: span 3; } }

/* body x bike */
.bb-section, .engine-section, .today-section, .more-section, .route-section, .env-section, .tiers-section, .prov-section { padding-bottom: var(--space-16); }
.sec-head { display: flex; justify-content: space-between; gap: var(--space-6); flex-wrap: wrap; }
.bb-controls { display: flex; gap: var(--space-6); flex-wrap: wrap; margin-top: var(--space-6); }
.bb-group { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.bb-group .mono-label { margin-right: var(--space-1); }
.bb-group [data-int].on { color: var(--int); border-color: var(--int); background: color-mix(in oklab, var(--int) 8%, var(--bg-2)); }
.bb-wrap { margin-top: var(--space-4); background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
#bbChart { display: block; width: 100%; height: 300px; }
@media (max-width: 600px) { #bbChart { height: 240px; } }
.bb-axis { display: flex; justify-content: space-between; padding: var(--space-2) var(--space-4); font-family: var(--font-mono); font-size: .68rem; color: var(--ink-3); border-top: 1px solid var(--line); }
.bb-ext { stroke: var(--ext); stroke-width: 1.6; fill: none; }
.bb-int { stroke: var(--int); stroke-width: 1.6; fill: none; }
.bb-div-hot { fill: var(--hot); opacity: .22; }
.bb-div-cool { fill: var(--ext); opacity: .18; }
.bb-stop { fill: var(--ink); opacity: .06; }
.bb-cursor { stroke: var(--accent); stroke-width: 1.2; }
.bb-lbl { font-family: var(--font-mono); font-size: 11px; fill: var(--ink-2); }
.bb-notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-3); margin-top: var(--space-4); }
.bb-note { border: 1px solid var(--line); border-radius: 12px; padding: var(--space-4); background: var(--bg-2); font-size: var(--text-sm); color: var(--ink-2); cursor: pointer; }
.bb-note:hover { border-color: var(--accent-dim); }
.bb-note b { display: block; font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: .1em; margin-bottom: var(--space-1); }
.bb-note.hot b { color: var(--hot); } .bb-note.cool b { color: var(--accent); } .bb-note.env b { color: var(--cool); }

/* what changed today */
.today-list { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-6); }
.today-item { display: grid; grid-template-columns: 96px 1fr; gap: var(--space-4); border: 1px solid var(--line); border-radius: 12px; padding: var(--space-4) var(--space-5, 1.25rem); background: var(--bg-2); align-items: start; }
@media (max-width: 600px) { .today-item { grid-template-columns: 1fr; gap: var(--space-2); } }
.today-item p { font-size: var(--text-base); color: var(--ink); line-height: 1.55; }
.today-item .sub { font-size: var(--text-sm); color: var(--ink-2); margin-top: var(--space-1); }
.tag { display: inline-block; font-family: var(--font-mono); font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.t-obs { color: var(--accent); border-color: var(--accent-dim); }
.t-calc { color: var(--ink); border-color: var(--ink-3); }
.t-inf { color: var(--int); border-color: var(--int); }
.tag-key { margin-top: var(--space-4); font-family: var(--font-mono); font-size: var(--text-xs); color: var(--ink-3); display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }

/* more metrics, road, env */
.more-grid, .road-grid, .env-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-3); margin-top: var(--space-6); }
.mm { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: var(--space-5, 1.25rem) var(--space-4); display: flex; flex-direction: column; gap: var(--space-1); }
.mm .m-n { font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); }
.mm .conf { font-family: var(--font-mono); font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; margin-top: var(--space-2); }
.conf.high { color: var(--accent); } .conf.med { color: var(--int); } .conf.exp { color: var(--hot); } .conf.needs { color: var(--ink-3); }
.mm p { font-size: var(--text-sm); color: var(--ink-2); }
.mm.needs { border-style: dashed; }
.road { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: var(--space-4); }
.road h4 { font-size: var(--text-base); font-weight: 700; }
.road .rd-meta { font-family: var(--font-mono); font-size: .68rem; color: var(--ink-3); letter-spacing: .06em; margin-top: 2px; }
.road .rd-line { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: var(--text-sm); padding: var(--space-2) 0; border-top: 1px solid var(--line); margin-top: var(--space-2); }
.road .rd-line:first-of-type { border-top: none; }
.road .delta.good { color: var(--accent); } .road .delta.bad { color: var(--hot); } .road .delta.flat { color: var(--ink-2); }
.road p { font-size: var(--text-sm); color: var(--ink-2); margin-top: var(--space-2); }

/* tiers */
.tier-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); margin-top: var(--space-6); }
@media (max-width: 860px) { .tier-grid { grid-template-columns: 1fr; } }
.tier { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: var(--space-6); }
.tier-n { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--accent); letter-spacing: .14em; }
.tier h3 { font-size: var(--text-lg); font-weight: 700; margin: var(--space-2) 0; }
.tier-has { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--ink-2); line-height: 1.6; }
.tier ul { list-style: none; margin-top: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); }
.tier li { font-size: var(--text-sm); color: var(--ink); padding-left: var(--space-4); position: relative; }
.tier li::before { content: ''; position: absolute; left: 0; top: .6em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* provenance */
.prov-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-3); margin-top: var(--space-6); }
.prov { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: var(--space-4); }
.prov h4 { font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: .14em; color: var(--ink); }
.prov .st { font-family: var(--font-mono); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; margin-top: 2px; }
.prov .st.on { color: var(--accent); } .prov .st.off { color: var(--ink-3); }
.prov ul { list-style: none; margin-top: var(--space-3); display: flex; flex-wrap: wrap; gap: 6px; }
.prov li { font-family: var(--font-mono); font-size: .68rem; color: var(--ink-2); padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; }
.prov.proto li { border-color: var(--accent-dim); color: var(--accent); }

/* phone */
@media (max-width: 860px) {
  .ride-hero { align-items: flex-start; }
  .ride-score { margin-top: var(--space-4); }
}
@media (max-width: 640px) {
  .f-seg-lbl, .f-scale-t, .f-north { font-size: 20px; } .f-mile { font-size: 16px; }
  .f-mile-dot { r: 5; }
  .f-stop { r: 9; }
  .f-route-dim { stroke-width: 13; }
  .f-ahead { stroke-width: 22; } .f-ahead-dot { stroke-width: 2.2; stroke-dasharray: 3 9; }
  .f-trail { stroke-width: 7; }
  .now-ring { stroke-width: 4; }
  .now-dot { stroke-width: 3; }
  .now-lbl-bg { stroke-width: 1.6; }
  .map-wrap .sample-badge { position: static; display: inline-block; margin: var(--space-3) var(--space-3) 0; font-size: .62rem; padding: 6px 10px; }
}

/* body terrain */
.terrain-wrap { margin-top: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--bg-2, var(--bg)); overflow: hidden; }
#terrain { display: block; width: 100%; height: auto; }
.tr-ring { fill: none; stroke: var(--grid); stroke-width: 1; stroke-dasharray: 2 5; }
.tr-ground { fill: none; stroke: var(--route-dim); stroke-width: 1.4; }
.tr-wall { fill-opacity: .82; stroke: var(--bg); stroke-width: .35; transition: fill-opacity .35s ease; }
.tr-wall.ahead { fill-opacity: .10; }
.tr-top { stroke-width: 1.6; stroke-opacity: .95; stroke-linecap: round; transition: stroke-opacity .35s ease; }
.tr-top.ahead { stroke-opacity: .3; }
.tr-plumb { stroke: #fff; stroke-width: 1; stroke-opacity: .55; stroke-dasharray: 2 3; }
.tr-foot { fill: #fff; opacity: .7; }
.tr-dot { transform-box: fill-box; transform-origin: center; fill: #fff; stroke: var(--sig-3); stroke-width: 2.5; animation: beatDot var(--beat, 1s) ease-in-out infinite; }
.tr-legend { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line); font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: .1em; color: var(--ink-3); }
.tr-legend .ovl-name { color: var(--ink-2); }
@media (max-width: 860px) {
  .tr-wall { stroke-width: .2; }
  .tr-top { stroke-width: 2.4; }
  .tr-dot { r: 8; stroke-width: 4; }
  .tr-lblg text { font-size: 15px; }
  .tr-lblg rect { height: 24px; y: -17px; }
}

.prov.note { grid-column: 1 / -1; } .prov.note p { margin: var(--space-2) 0 0; font-size: var(--text-sm); color: var(--ink-2); line-height: 1.5; }

/* Swiss cut: fewer things, each one louder */
.live-strip .ls[hidden] { display: none; }
.ls-v { color: var(--lay); }
.ls[data-k=hr] .ls-v, .ls[data-k=zone] .ls-v { color: var(--sig-3); } .ls[data-k=cost] .ls-v { color: var(--sig-2); } .ls[data-k=speed] .ls-v { color: var(--sig-0); }
.prov.fit h4 { color: var(--sig-2); }
.metric[hidden] { display: none; }

/* lanes, minus, ridge lines */
.ov-legend { flex-direction: column; align-items: stretch; gap: var(--space-2); }
.ovl-row { display: flex; align-items: center; gap: var(--space-3); }
.ovl-lane { color: var(--ink-3); font-size: .6rem; letter-spacing: .1em; min-width: 3.2em; }
.lchip[data-lane]:not([data-lane=""])::after { content: attr(data-lane); margin-left: .5em; font-size: .6rem; opacity: .7; }
.lchip.minus { border-style: dashed; } .lchip.minus.on { border-style: solid; color: var(--sig-1); border-color: var(--sig-3); background: color-mix(in oklab, var(--sig-3) 22%, var(--bg-2)); }
.lchip.wallet-lock { opacity: .55; border-style: dotted; }
.tr-ridge { fill: none; stroke-width: 1.6; stroke-opacity: .9; stroke-linejoin: round; filter: drop-shadow(0 0 3px rgba(0,0,0,.8)); }
@media (max-width: 720px) { .tr-ridge { stroke-width: 2.6; } }
.ovl-lane, .ovl-min, .ovl-max { white-space: nowrap; } .ovl-row .ovl-name { text-align: right; font-size: .62rem; }
.ovl-row .ovl-bar { width: 84px; flex: 0 0 84px; }

/* whoop: the night before */
.lchip.whoop { text-decoration: none; border-style: dashed; } .lchip.whoop.on { border-style: solid; border-color: var(--sig-0); color: var(--sig-0); }
.metric[data-k=night] .m-n.green { color: #7ee08a; } .metric[data-k=night] .m-n.yellow { color: var(--sig-2); } .metric[data-k=night] .m-n.red { color: var(--sig-3); }

/* proto connected chip */
.lchip.proto-on { border-color: var(--accent-dim); color: var(--accent); }
.lchip.proto-on::before { content: ''; display: inline-block; width: .45em; height: .45em; border-radius: 50%; background: var(--accent); margin-right: .55em; vertical-align: middle; }

/* one connection: proto */
.lchip.proto { text-decoration: none; border-style: dashed; }
.lchip.proto.on { border-style: solid; border-color: var(--accent-dim); color: var(--accent); }
.lchip.proto.on::before { content: ''; display: inline-block; width: .45em; height: .45em; border-radius: 50%; background: var(--accent); margin-right: .55em; vertical-align: middle; }
.lchip.proto[data-state=err] { opacity: .6; }

/* cardio engine · VO2 max anchor */
.eng-anchor { display: flex; flex-direction: column; align-items: flex-end; text-align: right; min-width: 240px; }
.eng-anchor .eng-n { font-family: var(--font-mono); font-size: var(--text-2xl); line-height: 1; color: var(--ink); margin-top: var(--space-2); }
.eng-anchor .eng-band { font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-top: var(--space-2); }
.eng-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); margin-top: var(--space-6); }
.eng-src { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); }
.eng-src h4 { font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: .14em; color: var(--ink); }
.eng-src .st { font-family: var(--font-mono); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; }
.eng-src .st.on { color: var(--accent); } .eng-src .st.off { color: var(--ink-3); }
.eng-src p { font-size: var(--text-sm); color: var(--ink-2); line-height: 1.5; flex: 1; }
.eng-src .eng-v { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--ink-3); letter-spacing: .06em; }
.eng-src .eng-v b { font-weight: 500; font-size: var(--text-lg); color: var(--ink); margin-right: 6px; }
.eng-src.lab { border-color: var(--accent-dim); }
.eng-src.lab h4 { color: var(--accent); }
.eng-src.proto .eng-v b { color: var(--accent); }
.eng-rule { margin-top: var(--space-4); font-size: var(--text-sm); color: var(--ink-2); line-height: 1.6; }
.eng-rule .mono-label { margin-right: var(--space-2); }
@media (max-width: 860px) {
  .eng-grid { grid-template-columns: repeat(2, 1fr); }
  .eng-anchor { align-items: flex-start; text-align: left; margin-top: var(--space-4); }
}
@media (max-width: 520px) {
  .eng-grid { grid-template-columns: 1fr; }
}
.eng-spark { width: 100%; height: auto; display: block; margin: 4px 0 2px; overflow: visible; }
.eng-spark .sp-grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.eng-spark .sp-grid.faint { stroke-dasharray: 2 4; opacity: .6; }
.eng-spark .sp-tick { stroke: var(--ink-3); stroke-width: 1; vector-effect: non-scaling-stroke; }
.eng-spark .sp-area { fill: var(--ink); opacity: .07; }
.eng-spark .sp-line { fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.eng-spark .sp-pt { fill: var(--bg-2); stroke: var(--ink); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.eng-spark .sp-pt.last { fill: var(--ink); }
.eng-spark .sp-pt.manual { stroke-dasharray: 2 2; stroke: var(--ink-3); }
.eng-spark text { font-family: var(--font-mono); fill: var(--ink-3); font-size: 10.5px; letter-spacing: .06em; }
.eng-spark .sp-v { fill: var(--ink); font-size: 13px; font-weight: 500; letter-spacing: 0; }
.eng-spark .sp-note { font-size: 8.5px; }
.eng-spark .sp-unit { font-size: 7.5px; }
.eng-rule + .eng-rule { margin-top: var(--space-2); }
/* desktop: map and terrain side by side */
@media (min-width: 1100px) {
  .map-section { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); align-items: stretch; }
  .map-section > .map-controls, .map-section > .layer-grid, .map-section > .live-strip { grid-column: 1 / -1; }
  .map-section > .terrain-wrap { margin-top: 0; display: flex; flex-direction: column; }
  .map-section > .terrain-wrap[hidden] { display: none; }
  .map-section > .terrain-wrap #terrain { flex: 1 1 0; min-height: 0; height: 100%; }
  .map-section > .map-wrap:has(+ .terrain-wrap[hidden]) { grid-column: 1 / -1; }
  .live-strip { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}

/* weather over the ride */
.wx-strip { margin-top: var(--space-3); border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); overflow: hidden; }
.wx-strip[hidden] { display: none; }
.wx-head { display: flex; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-3) 0; flex-wrap: wrap; }
.wx-head .ovl-attr { text-align: left; flex: 1 1 100%; }
#wxChart { display: block; width: 100%; height: 128px; }
.wx-grid { stroke: var(--line); stroke-width: 1; }
.wx-lbl { font-family: var(--font-mono); font-size: 10px; fill: var(--ink-3); letter-spacing: .06em; }
.wx-temp { fill: none; stroke: var(--sig-2); stroke-width: 1.8; stroke-linejoin: round; }
.wx-feels { fill: none; stroke: var(--sig-2); stroke-width: 1; stroke-dasharray: 2 3; opacity: .6; }
.wx-hw { fill: var(--sig-3); opacity: .55; }
.wx-tail { fill: var(--sig-0); opacity: .5; }
.wx-cursor { stroke: var(--ink); stroke-width: 1; opacity: .8; }
.wx-read { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px; background: var(--line); border-top: 1px solid var(--line); }
.wx-read .ls-v { color: var(--ink); white-space: normal; overflow: visible; text-overflow: clip; font-size: .82rem; line-height: 1.25; }
.wx-read .ls[data-k=wxt] .ls-v { color: var(--sig-2); } .wx-read .ls[data-k=wxd] .ls-v { color: var(--sig-3); }
@media (max-width: 860px) { .wx-read { grid-template-columns: repeat(3, 1fr); } .wx-head .ovl-attr { max-width: 100%; text-align: left; } }

/* ---------- workouts panel (Apple Health list) ---------- */
#workoutsPanel {
  position: absolute; inset: 8px 8px auto 8px; z-index: 20;
  background: rgba(10, 10, 10, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 10px 10px 8px;
  color: #e8e8e8;
  font-family: 'Satoshi', system-ui, sans-serif;
  max-height: 60vh;
  display: flex; flex-direction: column;
  backdrop-filter: blur(8px);
}
#workoutsPanel[hidden] { display: none; }
.wp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.wp-title { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255,255,255,0.62); }
.wp-close { background: transparent; border: none; color: rgba(255,255,255,0.62); font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px; }
.wp-close:hover { color: #fff; }
.wp-body { overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.wp-row {
  display: grid; grid-template-columns: 46px 1fr auto auto auto; gap: 10px;
  align-items: center; padding: 8px 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  color: #e8e8e8;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.wp-row:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.18); }
.wp-sport { text-transform: uppercase; font-size: 10px; letter-spacing: 0.08em; padding: 2px 6px; border-radius: 4px; text-align: center; }
.wp-sport-run  { background: rgba(120, 200, 120, 0.18); color: #7fc27f; }
.wp-sport-walk { background: rgba(200, 200, 120, 0.18); color: #c8c87f; }
.wp-sport-ride { background: rgba(120, 180, 220, 0.18); color: #7fb4dc; }
.wp-when { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: rgba(255,255,255,0.85); }
.wp-dur, .wp-dist, .wp-hr { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: rgba(255,255,255,0.55); white-space: nowrap; }
.wp-empty { padding: 14px; color: rgba(255,255,255,0.55); font-size: 12px; }
.wp-foot { margin-top: 8px; font-size: 10px; color: rgba(255,255,255,0.42); letter-spacing: 0.02em; }
@media (max-width: 520px) {
  .wp-row { grid-template-columns: 42px 1fr auto; }
  .wp-dist, .wp-hr { display: none; }
}

/* splits from the watch: one hairline table, same grid as the live strip */
.lap-strip { margin-top: var(--space-3); border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); overflow: hidden; }
.lap-strip[hidden] { display: none; }
.lap-grid { display: grid; grid-template-columns: 2.6rem repeat(calc(var(--lap-cols, 6) - 1), minmax(0, 1fr)); margin-top: var(--space-3); border-top: 1px solid var(--line); }
.lp-h { font-family: var(--font-mono); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--line); }
.lp-row { display: grid; grid-template-columns: subgrid; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 0; margin: 0; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.lp-row:last-child { border-bottom: 0; }
.lp-row > span { font-family: var(--font-mono); font-size: var(--text-sm); font-weight: 700; padding: var(--space-2) var(--space-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.lp-row > span:first-child { color: var(--ink-3); }
.lp-row:hover { background: var(--bg-3, rgba(255,255,255,.03)); }
.lp-row.on { box-shadow: inset 3px 0 0 var(--lay, #8fd18a); }
.lp-row.on > span:first-child { color: var(--lay, #8fd18a); }
.lp-row:focus-visible { outline: 2px solid var(--lay, #8fd18a); outline-offset: -2px; }
@media (max-width: 560px) { .lap-grid { grid-template-columns: 2.2rem repeat(calc(var(--lap-cols, 6) - 1), minmax(0, 1fr)); } .lp-h, .lp-row > span { padding: var(--space-2) 6px; font-size: .7rem; } .lp-h { font-size: .55rem; } }
