
:root {
  color-scheme: light;
  --bg: #E6ECE9;
  --surface: #F7F9F8;
  --surface-2: #DCE4E0;
  --ink: #17221D;
  --ink-2: #45534D;
  --muted: #5E6B65;
  --line: #C3CEC9;
  --faint: #B4C0BA;
  --contour: #2C5E4A;
  --contour-op: 0.12;
  --contour-op-hdr: 0.10;
  --plate-shadow: rgba(23,34,29,.16);
  --spruce: #2C5E4A;
  --spruce-soft: #D3E3DB;
  --on-spruce: #FFFFFF;
  --glacier: #1F6F96;
  --glacier-soft: #D3E7F1;
  --red: #CE1F2A;
  --mark-white: #FFFFFF;
  --amber: #9A5A12;
  --sign: #F2C300;
  --sign-ink: #14120A;
  --sign-rim: #1C1A12;
  --shadow-soft: 0 1px 0 rgba(23,34,29,.05), 0 4px 12px -8px rgba(23,34,29,.18);
  --font-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --font-body: "Overpass", "Segoe UI", system-ui, sans-serif;
  --font-num: "Overpass Mono", ui-monospace, "SF Mono", Menlo, monospace;
  /* Wegweiser face: DIN 1451 Mittelschrift stand-in */
  --font-sign: "Barlow Semi Condensed", "DIN Alternate", "Bahnschrift", "Arial Narrow", sans-serif;
  --contour-op-card: 0.075;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0E1613;
    --surface: #15201C;
    --surface-2: #1D2A25;
    --ink: #E2E9E5;
    --ink-2: #AAB8B1;
    --muted: #8F9D96;
    --line: #2B3A34;
    --faint: #34443E;
    --contour: #7FBCD9;
    --contour-op: 0.10;
    --contour-op-hdr: 0.085;
    --contour-op-card: 0.065;
    --plate-shadow: rgba(0,0,0,.5);
    --spruce: #6DB592;
    --spruce-soft: #1C3A2E;
    --on-spruce: #0E1613;
    --glacier: #7CC0E0;
    --glacier-soft: #173244;
    --red: #EE3E44;
    --mark-white: #F1F4F2;
    --amber: #E0A458;
    --sign: #D9AE1E;
    --sign-ink: #14120A;
    --sign-rim: #060807;
    --shadow-soft: 0 1px 0 rgba(0,0,0,.25), 0 6px 14px -10px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0E1613;
  --surface: #15201C;
  --surface-2: #1D2A25;
  --ink: #E2E9E5;
  --ink-2: #AAB8B1;
  --muted: #8F9D96;
  --line: #2B3A34;
  --faint: #34443E;
  --contour: #7FBCD9;
  --contour-op: 0.10;
  --contour-op-hdr: 0.085;
  --contour-op-card: 0.065;
  --plate-shadow: rgba(0,0,0,.5);
  --spruce: #6DB592;
  --spruce-soft: #1C3A2E;
  --on-spruce: #0E1613;
  --glacier: #7CC0E0;
  --glacier-soft: #173244;
  --red: #EE3E44;
  --mark-white: #F1F4F2;
  --amber: #E0A458;
  --sign: #D9AE1E;
  --sign-ink: #14120A;
  --sign-rim: #060807;
  --shadow-soft: 0 1px 0 rgba(0,0,0,.25), 0 6px 14px -10px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }
a { color: var(--glacier); }
:focus-visible { outline: 3px solid var(--glacier); outline-offset: 2px; border-radius: 6px; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

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

/* Contours: a band behind the session header that fades out before the card, full on home and summit */
.contours { position: absolute; inset: 0 0 auto 0; height: 380px; width: 100%; pointer-events: none; z-index: 0; }
.contours path { fill: none; stroke: var(--contour); stroke-opacity: var(--contour-op); stroke-width: 1; }
.contours path.idx { stroke-width: 1.8; }
.app[data-screen="session"] .contours, .app[data-screen="free"] .contours, .app[data-screen="start"] .contours, .app[data-screen="freefin"] .contours { height: 170px; -webkit-mask-image: linear-gradient(#000 40%, transparent 94%); mask-image: linear-gradient(#000 40%, transparent 94%); }
.app:not([data-screen="home"]) .contours path { stroke-opacity: var(--contour-op-hdr); }

/* Header */
.hdr { position: relative; z-index: 1; padding: 0 16px 2px; }
.toprow { display: flex; align-items: flex-start; gap: 8px; min-height: 44px; }
.iconbtn { margin-left: auto; flex: none; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; color: var(--muted); margin-right: -10px; }
.iconbtn svg { width: 18px; height: 18px; }

.titleRow { display: flex; align-items: center; gap: 8px; }
/* Wegweiser: Austrian trail sign. Yellow plate, red-white-red band at the flat end, pointed right end, thin dark rim.
   The outer layer (.sign-rim) is the rim; the plate is clipped 1px inside it. Yellow appears only here. */
.sign { display: block; flex: 1 1 auto; min-width: 0; max-width: 290px; margin-right: auto; text-align: left; border-radius: 3px; filter: drop-shadow(0 3px 5px var(--plate-shadow)); }
.sign.notime { flex: 0 1 auto; }
.sign-rim { display: block; background: var(--sign-rim); padding: 1.5px; border-radius: 3px 0 0 3px; clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 50%, calc(100% - 20px) 100%, 0 100%); }
.sign-plate { display: flex; align-items: stretch; min-height: 44px; background: var(--sign); color: var(--sign-ink); border-radius: 2px 0 0 2px; clip-path: polygon(0 0, calc(100% - 19.4px) 0, calc(100% - .6px) 50%, calc(100% - 19.4px) 100%, 0 100%); }
.sign-mark { width: 9px; flex: none; display: grid; grid-template-rows: 1fr 1fr 1fr; border-right: 1.5px solid var(--sign-rim); }
.sign-mark i { display: block; background: #D2202B; }
.sign-mark i:nth-child(2) { background: #FFFFFF; }
.sign-txt { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 5px 30px 5px 10px; }
.sign-dest { display: block; flex: 1; min-width: 0; }
.sign-title, .sign-sub { display: block; }
button.sign:active .sign-plate { filter: brightness(.95); }
/* Sign lettering: one DIN-like face in mixed case, like the destination lines on a Wegweiser */
.sign-title { font-family: var(--font-sign); font-weight: 600; font-size: 24px; line-height: 1.02; letter-spacing: 0; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sign-sub { margin: 1px 0 0; font-family: var(--font-sign); font-weight: 500; font-size: 15px; line-height: 1.05; letter-spacing: 0; }
.sign-time { flex: none; font-family: var(--font-sign); font-weight: 600; font-size: 22px; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums; align-self: flex-start; padding-top: 3px; }
.flag { flex: none; width: 16px; height: 11px; border-radius: 1px; background: linear-gradient(var(--red) 0 33.3%, var(--mark-white) 33.3% 66.6%, var(--red) 66.6%); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 12%, transparent); }

.sync { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 4px; border-radius: 22px; font-size: 13px; color: var(--ink-2); white-space: nowrap; margin-right: -8px; flex: none; }
.sync .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--spruce); flex: none; opacity: .8; }
.sync.off { color: var(--amber); padding: 0 12px; margin-right: 0; border: 1px solid color-mix(in srgb, var(--amber) 45%, var(--line)); background: var(--surface); }
.sync.off .dot { background: transparent; border: 2px solid var(--amber); opacity: 1; }

/* Pace line: x = planned minutes. Solid = walked, dashed = ahead, tick = now */
.paceRow { display: flex; align-items: center; gap: 4px; }
.trk { flex: 1; min-width: 0; min-height: 44px; display: flex; align-items: center; border-radius: 8px; }
.trk svg { display: block; width: 100%; height: 30px; overflow: visible; transition: height .25s ease; }
.trk.flat svg { height: 14px; }
.pr-done { fill: none; stroke: var(--spruce); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.pr-open { fill: none; stroke: var(--muted); stroke-opacity: .7; stroke-width: 2; stroke-dasharray: 4 5; }
.pr-skip { fill: none; stroke: var(--faint); stroke-width: 2; stroke-dasharray: .1 4; stroke-linecap: round; }
.pr-tick { stroke: var(--line); stroke-width: 1; }
.pr-now { stroke: var(--ink-2); stroke-width: 2; stroke-linecap: round; }
.pr-now.paused { stroke: var(--amber); stroke-width: 2.5; }
.pausebtn { min-width: 44px; min-height: 44px; margin-right: -8px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; color: var(--ink-2); flex: none; }
.pausebtn svg { width: 18px; height: 18px; }
.pausebtn[aria-pressed="true"] { color: var(--amber); border: 1px solid var(--amber); margin-right: 0; }
.routeBtn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; color: var(--ink-2); flex: none; }
.routeBtn svg { width: 20px; height: 20px; }
.paceRow { margin-top: 2px; }

main { position: relative; z-index: 1; padding: 6px 16px calc(12px + env(safe-area-inset-bottom)); }
.app[data-screen="summit"] main, .app[data-screen="home"] main { padding-bottom: 32px; }

/* Trail marks (per exercise, one segment per set) */
.trail { display: block; flex: none; overflow: visible; }
.tr-done { fill: none; stroke: var(--spruce); stroke-width: 3; stroke-linecap: round; }
.tr-open { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 3 3; }
.tr-skip { fill: none; stroke: var(--faint); stroke-width: 2; stroke-dasharray: .1 4; stroke-linecap: round; }
.tr-dot { fill: var(--glacier); stroke: var(--surface); stroke-width: 1.5; }
.tr-draw { stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: draw .45s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* Focus card */
.focus { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px 16px; position: relative; display: flex; flex-direction: column; box-shadow: var(--shadow-soft); min-height: calc(100vh - 166px); }
.f-head { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.f-state { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--spruce); }
.f-state.skip { color: var(--muted); }
.moreBtn { min-width: 48px; min-height: 48px; margin: -4px -12px -4px auto; display: grid; place-items: center; border-radius: 12px; color: var(--muted); }
.moreBtn svg { width: 22px; height: 22px; }
/* Superset pair marker: plain text, current one spruce semibold */
.pair { display: flex; align-items: center; gap: 6px; margin: 0; flex: 1; min-width: 0; font-size: 14px; font-weight: 400; color: var(--muted); white-space: nowrap; }
.pair .on { color: var(--spruce); font-weight: 700; }
.pair .dotsep { opacity: .7; }
.f-head .f-state { margin-left: 4px; }
.f-name { font-family: var(--font-display); font-weight: 800; font-size: 32px; line-height: 1.02; text-transform: uppercase; letter-spacing: .01em; margin: 4px 0 2px; }
.f-cue { margin: 2px 0 0; font-size: 15px; color: var(--ink-2); }
.f-tag { align-self: flex-start; display: inline-block; margin-top: 6px; font-size: 12px; color: var(--glacier); border: 1px solid currentColor; border-radius: 4px; padding: 1px 6px; }

/* middle zone: numbers on top, then the trail field takes all free space down to the foot row */
.f-mid { flex: 1; display: flex; flex-direction: column; padding: 14px 0 0; }
.f-nums { display: flex; align-items: center; justify-content: center; gap: 6px; }
.f-field { flex: 1; min-height: 120px; position: relative; margin: 0 -6px; }
.f-field > svg { position: absolute; inset: 0; display: block; overflow: visible; }
/* the card as a small piece of map: faint contours behind everything, fading out towards the Done button */
.focus { isolation: isolate; }
.f-map { position: absolute; inset: 0; z-index: -1; border-radius: inherit; overflow: hidden; pointer-events: none; }
.f-map svg { display: block; width: 100%; height: 100%; -webkit-mask-image: linear-gradient(transparent 4%, #000 26%, #000 74%, transparent 90%); mask-image: linear-gradient(transparent 4%, #000 26%, #000 74%, transparent 90%); }
.f-map path { fill: none; stroke: var(--contour); stroke-opacity: var(--contour-op-card); stroke-width: 1; }
.f-map path.idx { stroke-width: 1.8; }
/* big trail: one segment per set. walked solid, ahead dashed, skipped dotted, rest fills the current one */
.bt-done { fill: none; stroke: var(--spruce); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.bt-open { fill: none; stroke: var(--muted); stroke-opacity: .75; stroke-width: 2; stroke-dasharray: 5 6; stroke-linecap: round; }
.bt-skip { fill: none; stroke: var(--faint); stroke-width: 2; stroke-dasharray: .1 5; stroke-linecap: round; }
.bt-fill { fill: none; stroke: color-mix(in srgb, var(--spruce) 62%, var(--surface)); stroke-width: 3; stroke-linejoin: round; transition: stroke-dasharray .25s linear; }
.bigtrail.over .bt-fill { stroke: color-mix(in srgb, var(--spruce) 80%, var(--surface)); }
.bt-dot { fill: var(--glacier); stroke: var(--surface); stroke-width: 2.5; transform-box: fill-box; transform-origin: center; }
.bigtrail.over .bt-dot { animation: dotPulse 1.6s ease-in-out infinite; }
@keyframes dotPulse { 50% { transform: scale(1.45); } }
.bt-done.tr-draw { animation-duration: .7s; }
.big { min-height: 88px; min-width: 96px; padding: 4px 10px 6px; border-radius: 14px; border: 2px solid transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.big-v { font-family: var(--font-display); font-weight: 800; font-size: 72px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.big-v.sm { font-size: 52px; }
.big-u { margin-top: 2px; font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.big.changed { border-color: var(--glacier); background: var(--glacier-soft); }
/* Scrubber: press and drag vertically, one step per ~22px, up = more */
.scrub { background: var(--bg); padding: 2px 10px 4px; cursor: ns-resize; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.scrub .chev { display: block; width: 18px; height: 8px; color: var(--muted); opacity: .35; transition: opacity .12s ease-out, color .12s ease-out; }
.scrub.drag { background: var(--surface-2); }
.scrub.changed.drag { background: var(--glacier-soft); }
:where(#focusCard) .big.scrub { position: relative; border-color: var(--ink); }
.big.scrub.changed { border-color: var(--glacier); }
.big.scrub.done { background: var(--spruce); border-color: transparent; color: var(--on-spruce); }
.big.scrub.skip { border-color: var(--faint); border-style: dotted; background: transparent; color: var(--faint); }
.big.done[data-changed="true"]::after, .pill.done[data-changed="true"]::after { content: ''; position: absolute; top: 3px; right: 3px; width: 9px; height: 9px; background: var(--glacier); clip-path: polygon(0 0, 100% 0, 100% 100%); }
.scrub.drag .chev, .scrub:focus-visible .chev { opacity: 1; color: var(--glacier); }
.big.done .big-u, .big.done .chev { color: var(--on-spruce); }
.scrub .big-v { display: block; }
.nudge-up .big-v, .nudge-up > b { animation: nudgeUp .11s ease-out; }
.nudge-down .big-v, .nudge-down > b { animation: nudgeDown .11s ease-out; }
@keyframes nudgeUp { 40% { transform: translateY(-3px); } }
@keyframes nudgeDown { 40% { transform: translateY(3px); } }
.times { font-family: var(--font-display); font-weight: 600; font-size: 32px; color: var(--muted); }
.f-delta { height: 44px; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 13px; }
.f-plan { color: var(--muted); font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.f-hint { color: var(--muted); font-size: 13px; }
.linkbtn { min-height: 44px; padding: 0 6px; color: var(--glacier); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }

.chip { min-height: 48px; min-width: 88px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: transparent; font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.chip:active { background: var(--surface-2); }

.f-spacer { flex: 1; min-height: 12px; }
.f-gap { height: 8px; }
.f-foot { display: flex; align-items: center; gap: 4px; min-height: 72px; margin-bottom: 4px; }
.f-next { margin: 0; flex: 1; min-width: 0; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.undoBtn { width: 44px; height: 44px; flex: none; margin-left: auto; margin-right: -10px; display: grid; place-items: center; border-radius: 12px; color: var(--ink-2); }
.undoBtn svg { width: 22px; height: 22px; }
.doneWrap { position: sticky; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 2; display: flex; gap: 8px; background: var(--surface); box-shadow: 0 -14px 12px -6px var(--surface); border-radius: 16px; }
.doneBtn { flex: 1; min-height: 68px; border-radius: 16px; background: var(--spruce); color: var(--on-spruce); display: flex; align-items: center; justify-content: center; gap: 12px; font-family: var(--font-display); font-weight: 800; font-size: 30px; letter-spacing: .1em; text-transform: uppercase; }
.doneBtn svg { width: 32px; height: 32px; }
.doneBtn.big svg { width: 44px; height: 44px; }

/* Rest zone inside the focus card: RIR row (after an exercise's last set) above a calm rest element */
.rz-rir { display: flex; align-items: center; gap: 4px; min-height: 52px; padding: 4px 0; border-top: 1px solid var(--line); }
.rz-rirLbl { flex: 1; min-width: 0; font-size: 12px; line-height: 1.15; color: var(--muted); }
.rz-rirLbl b { display: block; font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rirPick { min-width: 44px; min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font-family: var(--font-display); font-weight: 800; font-size: 20px; }
.rirPick[aria-pressed="true"] { background: var(--spruce); border-color: var(--spruce); color: var(--on-spruce); }
.rz-rirNote { margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.txtBtn { min-width: 44px; min-height: 44px; padding: 0 6px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
/* rest row: same slot as the "then" line, so nothing above it moves when a rest starts or ends */
.rz-summary { flex: 1; min-width: 0; }
.rz-time { min-height: 48px; max-width: calc(100% + 8px); padding: 0 8px; margin-left: -8px; border-radius: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 7px; line-height: 1; flex: none; }
.rz-lbl { font-size: 14px; color: var(--muted); }
.rz-t { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 28px; font-weight: 600; color: var(--ink); min-width: 4.2ch; }
.restZone.over .rz-lbl { color: var(--spruce); }
.restZone.over .rz-t { color: var(--amber); font-size: 14px; font-weight: 400; }
.restZone.frozen .rz-t { opacity: .55; }
.restZone.frozen .rz-lbl { color: var(--muted); }
.restZone .txtBtn { color: var(--muted); font-weight: 600; white-space: nowrap; }
.doneBtn:active { transform: translateY(1px); filter: brightness(.95); }
.doneBtn.quiet { background: var(--surface-2); color: var(--ink); font-size: 22px; }
.secBtn { min-height: 68px; min-width: 96px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--bg); font-weight: 600; font-size: 15px; }
.pausedBand { margin: 14px 0 0; padding: 8px 12px; border-radius: 12px; border: 1px dashed var(--amber); color: var(--amber); font-size: 14px; text-align: center; }
.focus.paused .f-nums { opacity: .4; }

/* Checklist card (warm-up, finisher) */
.ck-sub { margin: 2px 0 6px; font-size: 14px; color: var(--muted); }
.ck-list { list-style: none; margin: 0 0 8px; padding: 0; }
.ck-list li + li { border-top: 1px solid var(--line); }
.ck-row { width: 100%; min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 4px 2px; text-align: left; border-radius: 8px; }
.ck-row .lbl { flex: 1; min-width: 0; font-size: 17px; font-weight: 600; }
.ck-row .amt { font-size: 15px; color: var(--muted); white-space: nowrap; }
.ck-row .amt small { font-family: var(--font-body); font-size: 12px; color: var(--glacier); margin-left: 6px; }
.ck-row[aria-pressed="true"] .lbl { color: var(--ink-2); font-weight: 400; }

/* Route list */
.rt-block { margin-bottom: 18px; }
.rt-title { font-family: var(--font-display); font-weight: 700; font-size: 15px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 4px 2px 6px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-soft); }
.card + .card { margin-top: 8px; }
.rt-checks { list-style: none; margin: 0; padding: 2px 0; }
.rt-checks li + li { border-top: 1px solid var(--line); }
.rt-chk { width: 100%; min-height: 50px; display: flex; align-items: center; gap: 12px; padding: 4px 12px; text-align: left; }
.rt-chk .lbl { flex: 1; }
.rt-chk .amt { font-size: 13px; color: var(--muted); }
.rt-chk.cur .lbl { font-weight: 700; }
.rt-ex { padding: 10px 12px 12px; }
.rt-ex-top { display: flex; align-items: center; gap: 10px; min-height: 28px; }
.rt-code { font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--muted); min-width: 20px; }
.rt-name { flex: 1; min-width: 0; font-weight: 700; font-size: 16px; line-height: 1.2; }
.rirBtn { min-height: 44px; min-width: 44px; margin: -8px -4px -8px 0; padding: 0 8px; border-radius: 10px; font-size: 12px; font-weight: 600; color: var(--glacier); }
.rirBtn.set { color: var(--spruce); }
.pills { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.pill { min-height: 48px; min-width: 0; border-radius: 10px; border: 1px solid var(--line); background: transparent; display: flex; align-items: center; justify-content: center; padding: 0 6px; font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; color: var(--ink-2); }
.pill { position: relative; }
.pill.done { background: var(--spruce); border-color: transparent; color: var(--on-spruce); }
.pill.skip { color: var(--faint); border-style: dotted; }
.pill.cur { border: 2px solid var(--ink); color: var(--ink); }
.finish { width: 100%; min-height: 56px; margin-top: 8px; border-radius: 12px; background: var(--spruce); color: var(--on-spruce); font-family: var(--font-display); font-weight: 800; font-size: 20px; letter-spacing: .08em; text-transform: uppercase; }
.finish-note { font-size: 13px; color: var(--muted); text-align: center; margin: 8px 0 0; }

/* Sheet */
/* Calm sheet: backdrop fades, sheet rises 8px, 150ms ease-out */
.sheetWrap { position: fixed; inset: 0; z-index: 50; background: color-mix(in srgb, var(--ink) 35%, transparent); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .15s ease-out; }
.sheetWrap.on { opacity: 1; }
.sheet { width: 100%; max-width: 430px; background: var(--surface); border-radius: 18px 18px 0 0; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 30px -12px rgba(0,0,0,.4); transform: translateY(8px); transition: transform .15s ease-out; }
.sheetWrap.on .sheet { transform: none; }
.sheet.full { height: calc(100vh - 12px); height: calc(100dvh - 12px); overflow-y: auto; overscroll-behavior: contain; padding-top: 4px; }
.sheetHead { position: sticky; top: -4px; z-index: 1; display: flex; align-items: center; gap: 8px; background: var(--surface); padding: 4px 0 6px; margin-bottom: 4px; }
.sheetHead h2 { margin: 0; flex: 1; }
.closeBtn { width: 44px; height: 44px; margin-right: -10px; display: grid; place-items: center; border-radius: 12px; color: var(--ink-2); flex: none; }
.closeBtn svg { width: 22px; height: 22px; }
.grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 8px; }
.sheet h2 { font-family: var(--font-display); font-weight: 800; font-size: 22px; text-transform: uppercase; letter-spacing: .03em; margin: 0 0 10px; }
.sheet .sub { font-size: 13px; color: var(--muted); margin: -6px 0 10px; }
.actList { display: grid; gap: 6px; }
.act { min-height: 56px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); display: flex; align-items: center; gap: 12px; padding: 0 14px; text-align: left; font-weight: 600; font-size: 16px; }
.act svg { width: 20px; height: 20px; color: var(--ink-2); flex: none; }
.act:disabled { color: var(--muted); border-style: dashed; background: transparent; }
.m2 { margin-left: auto; font-family: var(--font-num); font-size: 11px; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; color: var(--muted); }
.restChips, .rirChips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.restChips .chip, .rirChips .chip { min-width: 0; }
.restChips .chip[aria-pressed="true"], .rirChips .chip[aria-pressed="true"] { background: var(--spruce); border-color: var(--spruce); color: var(--on-spruce); }

/* Summit */
.summit { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-soft); padding: 16px; margin-top: 4px; }
.summit > * { position: relative; }
/* contour band behind the summit head and profile, centred on the peak */
.summit > .sumTopo { position: absolute; left: 0; top: 0; width: 100%; height: 210px; pointer-events: none; -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
.sumTopo path { fill: none; stroke: var(--contour); stroke-opacity: calc(var(--contour-op) * 1.3); stroke-width: 1; }
.sumTopo path.idx { stroke-width: 1.8; }
.summit-flag { display: flex; gap: 8px; align-items: center; font-family: var(--font-display); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--spruce); font-size: 14px; }
.summit h2 { font-family: var(--font-display); font-weight: 800; font-size: 34px; text-transform: uppercase; margin: 6px 0 2px; line-height: 1; }

.summit .where { margin: 0; color: var(--muted); font-size: 14px; }
.sProfile { display: block; width: 100%; height: 88px; margin: 12px 0 6px; }
.sp-plan { fill: none; stroke: var(--muted); stroke-width: 1.4; stroke-dasharray: 3 3; }
.sp-done { fill: none; stroke: var(--spruce); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.sp-area { fill: var(--spruce); fill-opacity: .14; }
.sp-base { stroke: var(--line); stroke-width: 1; }
.sp-hut { fill: var(--surface); stroke: var(--ink-2); stroke-width: 1.2; }
.sp-hut.reached { fill: var(--spruce); stroke: var(--spruce); }
.sp-pole { stroke: var(--ink-2); stroke-width: 1.2; }
.sp-red { fill: var(--red); }
.sp-white { fill: var(--mark-white); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 8px 0 14px; }
.stat { background: var(--bg); border-radius: 12px; padding: 8px 10px; min-height: 68px; text-align: left; display: flex; flex-direction: column; justify-content: center; border: 1px solid transparent; }
.stat b { font-family: var(--font-display); font-weight: 800; font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); display: inline-flex; gap: 5px; align-items: center; }
.stat span svg { width: 11px; height: 11px; }
.stat.scrub { border: 1px dashed var(--line); padding: 2px 10px; align-items: flex-start; }
.stat.scrub .chevs { display: inline-flex; flex-direction: column; gap: 2px; }
.stat.scrub .chev { width: 14px; height: 7px; }
.stat.scrub.changed { border: 2px dashed var(--glacier); background: var(--glacier-soft); }
.note { width: 100%; min-height: 48px; resize: vertical; font: inherit; font-size: 16px; color: var(--ink); background: transparent; border: 0; border-bottom: 1px dashed var(--line); padding: 8px 2px; }
.note:focus-visible { outline: none; border-bottom: 2px solid var(--glacier); }
.summit .syncline { font-size: 13px; color: var(--amber); margin: 10px 0 0; }
.homeBtn { width: 100%; min-height: 56px; margin-top: 14px; border-radius: 12px; background: var(--spruce); color: var(--on-spruce); font-family: var(--font-display); font-weight: 800; font-size: 20px; letter-spacing: .08em; text-transform: uppercase; }

/* Home */
.section-lbl { font-family: var(--font-display); font-weight: 700; font-size: 14px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 14px 2px 6px; }
.recent { list-style: none; margin: 0; padding: 0; }
.recent li { display: flex; align-items: center; gap: 12px; padding: 10px 8px 10px 12px; }
.recent li + li { border-top: 1px solid var(--line); }
.recent .d { font-family: var(--font-display); font-weight: 700; width: 34px; text-transform: uppercase; color: var(--muted); flex: none; }
.recent .w { flex: 1; min-width: 0; font-weight: 600; }
.recent .w small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.repeat { min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--spruce); color: var(--spruce); font-weight: 700; font-size: 15px; }
.ask { margin: 16px 4px 0; font-size: 14px; color: var(--muted); }
.ask code { font-family: var(--font-num); font-size: 13px; color: var(--ink-2); }

.toast { position: fixed; left: 50%; top: 10px; transform: translate(-50%, -150%); z-index: 60; max-width: calc(100% - 32px); width: max-content; background: var(--ink); color: var(--bg); border-radius: 12px; padding: 10px 14px; font-size: 14px; transition: transform .25s ease; }
.toast.on { transform: translate(-50%, 0); }

/* ---------- v7: junction home ---------- */
.junction { margin: 4px 0 0; }
/* quiet destinations: the Wegweiser shape as an outline (rim = spruce, face = surface), no fill colour */
.dest-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.dest-plate { flex: 1 1 140px; min-width: 0; min-height: 48px; padding: 0; background: none; border: 0; text-align: left; }
.dp-rim { display: block; background: var(--spruce); padding: 1.5px; border-radius: 3px 0 0 3px; clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 0 100%); }
.dp-face { display: flex; align-items: center; min-height: 45px; padding: 0 24px 0 12px; background: var(--surface); color: var(--spruce); font-family: var(--font-sign); font-weight: 600; font-size: 19px; border-radius: 2px 0 0 2px; clip-path: polygon(0 0, calc(100% - 15.4px) 0, calc(100% - .6px) 50%, calc(100% - 15.4px) 100%, 0 100%); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dest-plate:active .dp-face { background: var(--surface-2); }
.dest-plate:focus-visible { outline: none; }
.dest-plate:focus-visible .dp-rim { background: var(--glacier); }
.earlierLink { display: inline-flex; align-items: center; min-height: 44px; margin-top: 4px; padding: 0 2px; color: var(--ink-2); font-size: 15px; }
.jsign { width: 100%; max-width: 318px; }
.jsign .sign-plate { min-height: 48px; }
.jsign.lead .sign-plate { min-height: 58px; }
.jsign .sign-title { font-size: 22px; }
.jsign.lead .sign-title { font-size: 25px; }
.jsign .sign-time { font-size: 20px; padding-top: 4px; }
.jsign .sign-sub svg { width: 13px; height: 13px; vertical-align: -2px; margin-right: 4px; }
.jsign.quiet .sign-title { font-weight: 500; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 18px 2px 6px; }
.sec-head .section-lbl { margin: 0; }
.sec-head small { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.week { padding: 10px 6px 8px; }
.wk-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.wk-volume { grid-column: 1 / -1; margin: 8px 6px 0; font-size: 13px; color: var(--muted); }
.wk { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; text-align: center; min-width: 0; }
.wk-lbl { font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.wk-n { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted); }
.wk.met .wk-n { color: var(--spruce); font-weight: 600; }
.week summary { cursor: pointer; list-style: none; min-height: 48px; }
.week summary::-webkit-details-marker { display: none; }
.wk-src h3 { margin: 12px 0 4px; font-size: 13px; color: var(--ink-2); }
.wk-src p { margin: 4px 0; overflow-wrap: anywhere; }
.wk-src { margin: 8px 6px 0; padding-top: 7px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.recent .d { line-height: 1.05; font-size: 15px; }
.recent .d small { display: block; font-family: var(--font-num); font-size: 11px; font-weight: 500; }
.recent .repeat { min-height: 44px; padding: 0 12px; font-size: 14px; }
.balanced { display: flex; align-items: center; gap: 10px; margin: 16px 4px 0; font-size: 13px; color: var(--muted); }

/* ---------- v7: start screen ---------- */
.startCard { padding: 12px 16px 16px; display: flex; flex-direction: column; min-height: calc(100vh - 176px); }
.st-meta { display: flex; justify-content: space-between; gap: 8px; margin: 0; font-size: 14px; color: var(--ink-2); }
.st-meta span + span { color: var(--muted); }
.startCard .sProfile { height: 64px; margin: 6px 0 2px; }
.st-list { list-style: none; margin: 0 0 10px; padding: 0; }
.st-list > li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 0 8px; padding: 7px 0; border-top: 1px solid var(--line); }
.st-code { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--muted); padding-top: 1px; }
.st-rows { display: grid; gap: 2px; }
.st-row { display: flex; align-items: baseline; gap: 8px; font-size: 15px; }
.st-row .n { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-row .a { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); white-space: nowrap; }
.doneBtn.start { font-size: 26px; }
.doneBtn.start svg { width: 34px; height: 34px; }
.notNow { align-self: center; margin-top: 6px; color: var(--muted); }

/* ---------- v7: free timed session ---------- */
.fr-cue { margin: 2px 0 0; font-size: 15px; color: var(--ink-2); }
.fr-hut { fill: var(--surface); stroke: var(--ink-2); stroke-width: 1.3; }
.fr-hut.reached { fill: var(--spruce); stroke: var(--spruce); }
.fr-count { margin: 0; flex: 1; min-width: 0; font-size: 14px; color: var(--muted); }
.fr-count.met { color: var(--spruce); font-weight: 600; }
.big.unset .big-v { color: var(--faint); }
.big-v.grade { font-size: 64px; }

/* ---------- v7: summit with photo ---------- */
.summit.photo { padding: 0; }
.sumPhoto { position: relative; margin: 0; height: 60vh; min-height: 300px; max-height: 560px; border-radius: 15px 15px 0 0; overflow: hidden; background: var(--surface-2); }
.sumPhoto img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; }
.sumPhoto img[data-fx="51"] { object-position: 51% 50%; }
.sumPhoto img[data-fx="55"] { object-position: 55% 50%; }
.sumPhoto img[data-fx="59"] { object-position: 59% 50%; }
.sumPhoto img[data-fx="65"] { object-position: 65% 50%; }
.sumOver { position: absolute; left: 0; right: 0; bottom: 0; padding: 64px 16px 14px; background: linear-gradient(rgba(6,10,8,0), rgba(6,10,8,.66)); color: #FFFFFF; }
.sumOver .summit-flag { color: #FFFFFF; font-size: 13px; }
.peak { margin: 6px 0 0; font-family: var(--font-sign); font-weight: 600; font-size: 32px; line-height: 1.02; text-shadow: 0 1px 10px rgba(0,0,0,.35); }
.peakH { margin: 2px 0 0; font-family: var(--font-sign); font-weight: 500; font-size: 18px; font-variant-numeric: tabular-nums; }
.credit { margin: 0; padding: 6px 16px 0; font-size: 11px; color: var(--muted); }
.credit a { color: var(--muted); text-underline-offset: 2px; }
.sumBody { padding: 10px 16px 16px; }
.sumBody h2 { margin-top: 4px; }
.quietLine { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; font-size: 14px; color: var(--ink-2); }
.quietLine.back { color: var(--spruce); font-weight: 600; }
.quietLine .trail { flex: none; }

/* ---------- v7: sheets ---------- */
.wp-svg { display: block; width: 100%; height: 56px; margin: 2px 0 8px; }
.wp-up { fill: none; stroke: var(--spruce); stroke-width: 3; stroke-linecap: round; }
.wp-down { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 4 4; stroke-linecap: round; }
.wp-list { margin: 0 0 8px; padding: 0 0 0 18px; font-size: 16px; }
.wp-list li { margin: 3px 0; }
.wp-list { font-variant-numeric: tabular-nums; }
.wp-note { margin: 10px 0 4px; font-size: 14px; color: var(--ink-2); }
.finish.quiet { background: var(--surface-2); color: var(--ink); }
.fieldLbl { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 12px 2px 6px; }
.typeGrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.typeGrid .chip { min-width: 0; font-family: var(--font-body); font-size: 15px; }
.typeGrid .chip[aria-pressed="true"] { background: var(--spruce); border-color: var(--spruce); color: var(--on-spruce); }
.pairGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pairGrid .stat { margin: 0; }
.stat b.sm { font-size: 24px; }
.stat.unset b { color: var(--faint); }
.optNote { font-size: 12px; color: var(--muted); margin: 6px 2px 0; }
.gymList { margin-bottom: 10px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .tr-draw { stroke-dasharray: none; stroke-dashoffset: 0; }
}
/* Production shell and accessibility; component styling above comes from v7. */
.hdr { padding-top: max(8px, env(safe-area-inset-top)); }
.toprow { align-items: center; }
.toprow .iconbtn { margin-left: auto; }
button:disabled, [aria-disabled="true"] { opacity: .5; }
.readOnly { padding: 10px 16px; border: 1px dashed var(--amber); color: var(--amber); border-radius: 12px; }
.pair { flex-wrap: wrap; white-space: normal; gap: 3px 6px; }
.big { min-width: 0; }
.big-v { font-size: clamp(44px, 17vw, 72px); }
.sign-txt { gap: 8px; }
.focus, .startCard { min-height: calc(100dvh - 174px); }
.sheet { max-height: calc(100dvh - 12px); overflow-y: auto; }
.summit-photo-slot:empty { display: none; }
.tally { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 14px; }
.tally span { color: var(--ink-2); }
.tally b { color: var(--spruce); font-family: var(--font-num); }
.recent .w { overflow-wrap: anywhere; }
.recent .openRecent { text-align: left; min-height: 48px; }
.pill { font-size: 13px; }
.rz-t { font-size: 24px; }
.rz-rir { flex-wrap: wrap; }
.rz-rirLbl { flex-basis: 70px; }
.iconbtn, .pausebtn, .routeBtn, .closeBtn, .undoBtn, .rirPick, .txtBtn, .linkbtn { min-height: 48px; min-width: 48px; }
.stat.scrub .big-v { font-size: 30px; }
.stat.scrub { align-items: flex-start; }
.f-state { overflow-wrap: anywhere; }
.sr + section { min-width: 0; }

.recent .repeat, .rirBtn { min-height: 48px; min-width: 48px; }
