@font-face {
  font-family: "Makinas 4 Flat Title";
  src: url("./fonts/Makinas4Flat-title.woff2?v=afb7f57d5ae7ef2721c7") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "DSEG7 Classic";
  src: url("./fonts/DSEG7Classic-Regular.woff2?v=afb7f57d5ae7ef2721c7") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
:root { color-scheme: dark; --black: #191a17; --gold: #c6a867; --quiet: #aaa58f; --paper: #eee3c9; --border: #59513b; --current: #a44937; background: var(--black); color: var(--paper); font-family: "Yu Gothic", "Hiragino Sans", sans-serif; }
* { box-sizing: border-box; }
body { margin: 0; }
main { max-width: 1920px; margin: auto; padding: 28px max(24px, env(safe-area-inset-right)) 24px max(24px, env(safe-area-inset-left)); }
button, input, select { font: inherit; accent-color: var(--gold); }
button { min-height: 44px; min-width: 44px; padding: 10px 16px; color: inherit; background: transparent; border: 0; cursor: pointer; }
button:disabled { opacity: .4; cursor: default; }
button:hover:not(:disabled), a { color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.masthead { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 24px; padding: 0 12px 20px; }
.wordmark { min-width: 0; }
#event-countdown { display: flex; flex: 0 0 auto; align-items: baseline; gap: 4px; color: var(--quiet); font-size: 24px; line-height: 1.2; white-space: nowrap; }
#countdown-label, #countdown-unit { font-family: "Makinas 4 Flat Title", "Yu Mincho", "游明朝", serif; }
#event-countdown.event-ended { font-size: 14px; }
.countdown-value { display: inline-flex; align-items: baseline; gap: 6px; }
#countdown-days { color: var(--gold); font: 400 22px/1.4 "DSEG7 Classic", monospace; font-variant-numeric: tabular-nums; }
.header-tools { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; align-self: center; margin-left: auto; }
#help-dialog { position: fixed; inset: 0; width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: 16px; overflow: auto; color: var(--paper); background: var(--black); border: 1px solid var(--gold); }
#help-dialog::backdrop { background: rgb(0 0 0 / .6); }
.share-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.share-heading form { margin: 0; }
.share-heading button { display: grid; place-items: center; padding: 8px; }
.share-destinations { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.share-destinations a, .share-tools button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px; color: var(--paper); border: 1px solid var(--border); font-size: 12px; text-decoration: none; }
.share-destinations a:hover, .share-tools button:hover { color: var(--gold); }
.share-destinations a { border-color: var(--gold); font-size: 16px; min-height: 48px; }
.share-controls:not(.share-compact) svg { display: block; width: 18px; height: 18px; flex: none; }
.share-url { width: 100%; min-width: 0; min-height: 44px; margin-top: 12px; padding: 8px; border: 1px solid var(--border); background: #10110f; color: var(--paper); font-size: 12px; }
.share-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.share-tools button { flex: 1 1 auto; }
.share-status { margin: 12px 0 0; color: var(--quiet); font-size: 12px; line-height: 1.6; }
.share-status:empty { display: none; }
.share-controls [hidden] { display: none !important; }
h1 { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 2px; min-width: 0; margin: 0; font: 400 48px/1.2 "Makinas 4 Flat Title", "Yu Mincho", "游明朝", serif; text-wrap: balance; }
h1 span { white-space: nowrap; }
h1 .title-distance { color: var(--gold); font-weight: 700; letter-spacing: .02em; margin-right: .04em; }
h1 small { margin: 0 .16em 0 .08em; font-size: .8em; }
.mounting { position: relative; isolation: isolate; overflow: hidden; border: 1px solid #70603e; padding: 12px; background: #10110f; }
#street { touch-action: none; position: relative; overflow-x: auto; overflow-y: hidden; height: clamp(240px, calc(100dvh - 470px), 650px); scrollbar-width: thin; scrollbar-color: var(--gold) #78725d; background-color: #78725d; cursor: grab; overscroll-behavior-x: contain; overflow-anchor: none; }
/* Small sasazuru motifs over soft silk variation; both follow native scrolling. */
#street {
  background-image:
    linear-gradient(#95865c 0 1px, #534f3e 1px 4px, #b3a16e 4px 5px),
    linear-gradient(#b3a16e 0 1px, #534f3e 1px 4px, #95865c 4px 5px),
    url("./textures/sasazuru.svg?v=afb7f57d5ae7ef2721c7"), url("./textures/cloth.svg?v=afb7f57d5ae7ef2721c7");
  background-size: 100% 5px, 100% 5px, var(--mounting-size, 24px) var(--mounting-size, 24px), var(--cloth-size, 192px) var(--cloth-size, 192px);
  background-position: left calc(var(--art-top, -5px) - 5px), left var(--art-bottom, 100%), left var(--art-top, 0px), left var(--art-top, 0px);
  background-repeat: no-repeat, no-repeat, repeat, repeat;
  background-attachment: scroll, scroll, local, local;
}
#street.dragging { cursor: grabbing; }
#strip { height: 100%; position: relative; overflow: hidden; }
#strip img { position: absolute; display: block; max-width: none; pointer-events: none; user-select: none; }
.place-name-icon-layer { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.place-name-icon { position: absolute; display: block; overflow: hidden; }
.street-name-layer { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.street-nameplate { position: absolute; display: block; font-family: "Yu Mincho", "游明朝", "Hiragino Mincho ProN", serif; font-weight: 600; }
.landmark-layer { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.landmark-figure { position: absolute; margin: 0; color: #463c2d; text-align: center; font-family: "Yu Mincho", "游明朝", serif; }
.landmark-photo-window { position: absolute; inset: 0; overflow: hidden; }
#strip .landmark-photo img { inset: 0; width: 100%; height: 100%; object-fit: cover; filter: sepia(.45) saturate(.65) contrast(.88); }
.landmark-frame { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke: #958052; stroke-width: 1; stroke-linejoin: round; }
.landmark-figure figcaption { position: absolute; padding: 0; margin: 0; }
.landmark-nameplate { display: block; width: 100%; height: 100%; font-weight: 600; }
.landmark-photo:not(.loaded) img, .landmark-photo:not(.loaded) .landmark-frame { visibility: hidden; }
.landmark-relief { color: #716547; }
.landmark-glyph { display: block; height: 100%; font-size: 1em; line-height: 1; text-shadow: 1px 1px #eee3c9; }
.landmark-relief .landmark-glyph { font-size: clamp(22px, 2em, 54px); }
.landmark-relief > svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; fill: none; stroke: #716547; stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(1px 1px #eee3c9); }
#strip .landmark-mountain-photo img { filter: none; }
.landmark-mountain-photo .landmark-frame { stroke: #fff; stroke-width: 1.2; }
.landmark-relief figcaption { color: #463c2d; font-size: .8em; }
.landmark-pin { display: grid; place-items: center; min-width: 28px; min-height: 28px; width: 28px; height: 28px; padding: 0; border: 1px solid #66583d; border-radius: 50%; background: #eee3c9; color: #66583d; font-size: 15px; }
.landmark-pin.is-visible { color: #fff6df; background: #a44937; border-color: #fff6df; }
.landmark-pin:hover, .landmark-pin:focus-visible { background: #fff6df; color: #a44937; }
.landmark-popup { color: #332e25; font-size: 13px; }
.landmark-popup strong { display: block; font-size: 16px; margin-bottom: 8px; }
.landmark-popup img { display: block; width: 200px; max-height: 130px; object-fit: cover; }
.landmark-popup p { margin: 8px 0; }
.landmark-popup a { color: #6e4922; }
.landmark-popup button { color: #633625; border-bottom: 1px solid #a78c53; }
.landmark-popup .landmark-source { max-height: 100px; overflow: auto; font-size: 11px; overflow-wrap: anywhere; }
.landmark-credits { margin-top: 16px; }
.landmark-credits dd { overflow-wrap: anywhere; }
.mini-landmark { fill: #a78c53; stroke: #fff6df; stroke-width: .7; }
.mini-landmark.is-visible { fill: #a44937; }
#runner { position: absolute; top: 0; left: 0; z-index: 3; pointer-events: none; }
.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { display: block; width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.workspace-controls { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: stretch; gap: 20px; margin: 16px 0 24px; }
.control-section { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 12px 16px; border: 1px solid var(--border); }
.control-section > .under-scroll, .control-section > .marathon-layout { flex: 1; }
h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; font-weight: 500; text-wrap: balance; }
h2 .icon { color: var(--gold); }
#marathon-controls { container: marathon / inline-size; }
.marathon-layout { display: grid; grid-template-rows: minmax(min-content, 1fr) auto; gap: 12px; min-width: 0; }
.race-body { display: grid; grid-template-rows: minmax(min-content, 1fr) auto; gap: 12px; min-width: 0; }
.race-display { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; min-width: 0; padding: 14px 12px; background: #10110f; border: 1px solid var(--border); }
.race-metric { display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.race-label { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--quiet); }
.race-label .icon { width: 14px; height: 14px; }
.race-digits { display: inline-block; color: #efd28b; font: 400 28px/1.4 "DSEG7 Classic", Consolas, "Courier New", monospace; font-variant-numeric: tabular-nums; white-space: nowrap; }
#run-distance { min-width: 5ch; text-align: right; }
.race-unit { font-size: 11px; color: var(--quiet); margin-left: 4px; }
/* Play/pause takes the spare width. When three buttons do not fit, runner setup wraps to its own row
   instead of the 116px buttons overlapping (seen at 770-840px). */
.run-controls { display: flex; flex-wrap: wrap; gap: 8px; }
#run-toggle { flex: 3 1 116px; }
#run-restart { flex: none; }
#runner-edit { flex: 1 0 auto; }
.run-controls button, .step-buttons button, .map-controls button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.run-settings { display: grid; grid-template-columns: minmax(0, 1fr) 104px; align-content: start; gap: 12px; min-width: 0; }
.pace-setting, .rate-setting { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.run-settings label { font-size: 11px; color: var(--quiet); }
#run-custom { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
#run-time { width: 120px; }
#run-time-error { color: #edb3a8; font-size: 12px; }
.setting-note { color: var(--quiet); font-size: 11px; line-height: 1.6; font-variant-numeric: tabular-nums; text-wrap: pretty; }
#run-progress { white-space: nowrap; }
#run-toggle, #run-restart { min-width: 116px; font-size: 12px; }
#run-toggle { color: var(--black); background: var(--gold); border: 1px solid var(--gold); }
#run-toggle:hover:not(:disabled) { color: var(--black); background: var(--paper); }
#run-toggle[aria-pressed="true"] { color: var(--gold); background: transparent; }
#run-restart { color: var(--quiet); border: 1px solid var(--border); }
/* Opens the same runner setup as "?", showing the current look. */
#runner-edit { gap: 6px; padding: 6px 12px 6px 6px; color: var(--quiet); border: 1px solid var(--border); font-size: 12px; white-space: nowrap; }
#runner-thumb { display: block; width: 30px; height: 30px; border-radius: 50%; background: var(--paper); }
#run-speed, #run-pace, #run-time { min-height: 44px; min-width: 0; padding: 6px 8px; color: var(--paper); border: 1px solid var(--border); background: var(--black); font-size: 12px; }
#run-status { margin: 0; color: var(--quiet); font-size: 11px; }
.street-zoom { position: absolute; right: 20px; bottom: 20px; display: flex; align-items: center; background: var(--black); border: 1px solid var(--border); }
.street-zoom button { display: grid; place-items: center; padding: 8px; font-size: 12px; font-variant-numeric: tabular-nums; }
#street-reset { min-width: 44px; }
.street-zoom .icon { width: 16px; height: 16px; }
@media (pointer: fine) {
  .street-zoom button { min-width: 32px; min-height: 32px; padding: 4px; font-size: 11px; }
  .street-zoom #street-reset { min-width: 48px; }
}
@media (max-width: 640px) {
  .street-zoom { right: 16px; bottom: 16px; }
  .street-zoom button { min-width: 36px; min-height: 36px; padding: 4px; font-size: 11px; }
  .street-zoom #street-reset { min-width: 44px; }
  .street-zoom .icon { width: 14px; height: 14px; }
}
#run-retry { align-self: flex-start; border: 1px solid var(--border); font-size: 12px; }
#loading { position: absolute; top: 22px; left: 28px; padding: 8px 12px; margin: 0; font-size: 12px; color: #273a33; background: #eee3c9; pointer-events: none; }
#error { display: flex; align-items: center; justify-content: center; gap: 16px; font-size: 14px; color: var(--paper); }
.navigation { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; font-size: 11px; color: var(--quiet); font-variant-numeric: tabular-nums; }
.visible-range { display: flex; flex-direction: column; gap: 4px; }
.visible-range > span { font-size: 11px; white-space: nowrap; }
.visible-range output { margin-left: 4px; color: var(--paper); }
.step-buttons { display: flex; align-items: center; gap: 0; }
.step-buttons button { gap: 4px; padding: 8px; font-size: 11px; white-space: nowrap; }
.under-scroll { display: grid; grid-template-columns: minmax(0, 1fr) 248px; align-items: stretch; gap: 20px; min-width: 0; }
.journey { display: flex; flex-direction: column; min-width: 0; }
input[type="range"] { display: block; width: 100%; height: 44px; margin: 0; cursor: ew-resize; }
.ends { display: flex; justify-content: space-between; color: var(--quiet); font-size: 12px; }
/* The chart fills the panel height and is inset by half the slider thumb, so both share one scale. */
.profile-seek { position: relative; display: flex; flex: 1 1 auto; min-height: 56px; margin: 8px 8px 0; cursor: pointer; touch-action: pan-y; }
#profile-svg { display: block; flex: 1; width: 100%; height: auto; min-height: 56px; }
.profile-seek:hover { background: #292920; }
.profile-fill { fill: var(--gold); opacity: .12; }
.profile-line, .profile-guides line, .profile-cursor { fill: none; vector-effect: non-scaling-stroke; }
.profile-line { stroke: var(--gold); stroke-width: 1.5; }
.profile-guides line { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 4; }
.profile-band { fill: var(--current); opacity: .2; }
.profile-cursor { stroke: var(--current); stroke-width: 2; }
#profile-error { align-self: center; margin: 0; color: var(--quiet); font-size: 12px; cursor: default; }
#position { appearance: none; background: transparent; }
#position::-webkit-slider-runnable-track { height: 3px; background: var(--border); border-radius: 2px; }
#position::-moz-range-track { height: 3px; background: var(--border); border-radius: 2px; }
#position::-webkit-slider-thumb { appearance: none; width: 16px; height: 16px; margin-top: -6.5px; border: 0; border-radius: 50%; background: var(--gold); }
#position::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: var(--gold); }
.mini-map:hover:not(:disabled) .map-caption { background: var(--paper); }
.mini-map { display: flex; flex-direction: column; width: 100%; min-width: 0; border: 1px solid var(--gold); padding: 8px; text-align: left; }
.map-caption { width: 100%; display: flex; align-items: center; justify-content: space-between; font-size: 12px; gap: 4px; margin-top: 8px; padding: 10px 8px; min-height: 44px; color: var(--black); background: var(--gold); }
#mini-svg { display: block; flex: 1; width: 100%; min-height: 200px; height: 200px; background: #e8e1d0; }
.map-caption > span { display: flex; align-items: center; gap: 4px; }
.map-caption .icon { width: 14px; height: 14px; }
.map-base { opacity: .6; }
#mini-svg .map-base { opacity: .6; }
.route-halo, .route-line, .view-halo, .view-line { fill: none; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.route-halo { stroke: #fff9e8; stroke-width: 4; }
.route-line { stroke: #645944; stroke-width: 1.6; }
.view-halo { stroke: #fff9e8; stroke-width: 8; }
.view-line { stroke: var(--current); stroke-width: 4; }
.map-arrow { fill: var(--current); stroke: #fff9e8; stroke-width: 1; }
.map-end { fill: #282c25; stroke: #fff9e8; stroke-width: 1; }
/* Links and the credits disclosure share one top-aligned row; open credits take their own row. */
footer { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: flex-end; gap: 0 32px; border-top: 1px solid var(--border); padding: 16px 12px 0; font-size: 12px; color: var(--quiet); }
footer .footer-links { margin: 0; min-height: 44px; }
footer .credits[open] { flex-basis: 100%; }
details { max-width: 640px; text-align: right; }
summary { min-height: 44px; padding: 8px 0; cursor: pointer; }
.credits dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 16px; margin: 8px 0 0; text-align: left; line-height: 1.8; text-wrap: pretty; }
.credits dt { white-space: nowrap; }
.credits dd { margin: 0; }
#map-dialog { --panel-safe-top: env(safe-area-inset-top, 0px); --panel-safe-right: env(safe-area-inset-right, 0px); --panel-safe-bottom: env(safe-area-inset-bottom, 0px); --panel-safe-left: env(safe-area-inset-left, 0px); position: fixed; z-index: 10; inset: auto 24px 24px auto; margin: 0; width: min(640px, calc(100vw - 48px)); max-height: 64dvh; padding: 12px 16px; border: 1px solid var(--gold); color: var(--paper); background: var(--black); overflow: auto; }
#map-dialog[open].is-resized { display: flex; flex-direction: column; max-width: calc(100vw - var(--panel-safe-left) - var(--panel-safe-right)); max-height: calc(100dvh - var(--panel-safe-top) - var(--panel-safe-bottom)); }
#map-dialog.is-resized .map-area { flex: 1; min-height: 100px; }
#map-dialog.is-resized #osm-map { position: absolute; inset: 0; height: 100%; }
#map-dialog.is-resized > :not(.map-area) { flex-shrink: 0; }
#map-resize { position: absolute; right: 8px; bottom: 8px; background: var(--black); border: 1px solid var(--border); display: grid; place-items: center; width: 44px; height: 44px; padding: 10px; color: var(--gold); cursor: nwse-resize; touch-action: none; user-select: none; }
.map-attribution { position: absolute; top: 8px; left: 8px; z-index: 4; width: 44px; text-align: left; color: var(--border); }
.map-attribution summary { display: grid; place-items: center; width: 44px; height: 44px; padding: 8px; list-style: none; border: 1px solid var(--gold); border-radius: 50%; background: var(--paper); font: 20px/1 Georgia, serif; }
.map-attribution summary::-webkit-details-marker { display: none; }
.map-attribution .map-credit { position: absolute; top: 52px; left: 0; width: max-content; max-width: min(260px, calc(100vw - 64px)); padding: 12px; gap: 4px; color: var(--border); background: var(--paper); border: 1px solid var(--gold); }
#map-move { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; justify-content: center; gap: 4px; width: 152px; height: 44px; padding: 0 8px; font-size: 11px; white-space: nowrap; color: var(--paper); background: var(--black); border: 1px solid var(--border); cursor: grab; touch-action: none; user-select: none; }
#map-move svg { width: 24px; height: 24px; fill: currentColor; pointer-events: none; }
#map-move.dragging { cursor: grabbing; }
.map-collapse { position: absolute; top: 8px; right: 8px; margin: 0; background: var(--black); border: 1px solid var(--border); }
#close-map { display: grid; place-items: center; width: 44px; height: 44px; padding: 10px; }
#close-map svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.map-area { position: relative; background: #e8e1d0; }
#osm-map { width: 100%; height: min(calc(40dvh + 52px), 462px); }
.osm-position { width: 24px; height: 24px; pointer-events: none; }
.osm-position svg { width: 100%; height: 100%; fill: var(--current); stroke: #fff9e8; stroke-width: 1.5; }
#map-loading { position: absolute; top: 64px; left: 8px; margin: 0; padding: 6px 8px; color: var(--black); background: var(--paper); font-size: 12px; pointer-events: none; }
#map-error { font-size: 12px; margin: 0; }
.north { display: flex; align-items: center; gap: 4px; position: absolute; top: 64px; right: 16px; color: #33392e; font-size: 12px; pointer-events: none; }
.map-controls { position: absolute; display: flex; left: 8px; bottom: 8px; background: var(--black); border: 1px solid var(--border); }
.map-controls button { padding: 8px 12px; font-size: 18px; }
.map-controls #map-fit { font-size: 12px; border-left: 1px solid var(--border); }

.map-credit { display: flex; flex-direction: column; align-items: flex-start; color: var(--quiet); font-size: 11px; }
.map-credit a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
@media (max-width: 1200px) {
  .masthead { gap: 16px; }
  h1 { font-size: clamp(24px, 4.5vw, 36px); }
  #event-countdown { font-size: 18px; }
}

@media (max-width: 1100px) {
  .workspace-controls { grid-template-columns: 1fr 1fr; gap: 12px; }
  .control-section { padding: 12px; }
  .under-scroll { grid-template-columns: minmax(0, 1fr) 180px; gap: 12px; }
  .navigation { flex-wrap: wrap; }
  #mini-svg { min-height: 160px; height: 160px; }
}
@media (max-width: 760px) {
  .workspace-controls { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  main { padding: 20px max(12px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  .masthead { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 0 4px 16px; }
  .wordmark { grid-column: 1 / -1; }
  h1 { font-size: clamp(24px, 6.6vw, 34px); }
  #event-countdown { min-width: 0; font-size: 14px; white-space: normal; }
  #countdown-days { font-size: 20px; }
  .header-tools { gap: 8px; }
  .mounting { padding: 8px; } #street { height: clamp(240px, calc(100dvh - 560px), 460px); }
  .workspace-controls { margin: 12px 0 20px; gap: 12px; }
  h2 { font-size: 12px; }
  .race-metric { gap: 6px; }
  .under-scroll { gap: 12px; }
  .ends { font-size: 11px; }
  .profile-seek, #profile-svg { min-height: 48px; }
  .under-scroll { grid-template-columns: minmax(0, 1fr) 160px; }
  .mini-map { padding: 6px; }
  .map-caption { font-size: 11px; }
  footer { padding: 12px 0 0; }
  #map-dialog { inset: auto 0 0; width: 100%; max-width: none; max-height: 62dvh; padding: 8px max(12px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  #osm-map { height: min(calc(36dvh + 52px), 392px); }
}
@media (max-width: 360px) {
  h1 { font-size: 24px; }
  .under-scroll { grid-template-columns: minmax(0, 1fr) 140px; }
  .step-buttons button { padding-inline: 4px; }
}

@container marathon (min-width: 680px) {
  .race-body, .run-settings { grid-template-columns: minmax(0, 1fr) 132px; }
  .race-body { grid-template-rows: 1fr; }
  .race-digits { font-size: 36px; }
  .run-controls { display: grid; grid-template-columns: 1fr; grid-template-rows: repeat(3, 1fr); }
}
@container marathon (max-width: 360px) {
  .race-digits { font-size: 24px; }
}
@container marathon (max-width: 280px) {
  .race-digits { font-size: 22px; }
}

#help-open { flex: 0 0 auto; display: grid; place-items: center; width: 44px; height: 44px; padding: 8px; border: 1px solid var(--gold); border-radius: 50%; background: var(--black); color: var(--paper); font-size: 20px; line-height: 1; }
.help-items { margin: 0; font-size: 13px; line-height: 1.8; text-wrap: pretty; }
.help-items dt { margin-top: 16px; color: var(--gold); }
.help-items dd { margin: 4px 0 0; }

/* Mobile playback stays within thumb reach; the settings disclosure shares the
   existing controls and gives the floating map a reserved bottom boundary. */
#mobile-player { display: none; }
@media (max-width: 760px), (max-width: 1000px) and (max-height: 500px) and (pointer: coarse) {
  main { padding-bottom: calc(var(--mobile-dock-height, 76px) + 24px); }
  #street { height: clamp(240px, calc(100dvh - 340px), 540px); }
  #mobile-player { display: flex; flex-direction: column; position: fixed; z-index: 20; inset: auto 0 0; background: var(--black); border-top: 1px solid var(--gold); }
  #mobile-player-bar { display: grid; grid-template-columns: minmax(104px, 1fr) minmax(116px, 1fr) 48px; align-items: center; gap: 8px; padding: 10px max(12px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  #mobile-play-slot { min-width: 0; }
  #mobile-play-slot #run-toggle { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-width: 0; min-height: 48px; padding: 8px; font-size: 14px; color: var(--black); background: var(--gold); }
  #mobile-race-toggle { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 48px; padding: 8px 4px; font-size: 13px; border: 1px solid var(--border); }
  #mobile-race-toggle[aria-expanded="true"] { border-color: var(--gold); color: var(--gold); }
  #mobile-race-toggle[aria-expanded="true"] .icon { transform: rotate(180deg); }
  #mobile-map { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px; min-height: 48px; padding: 4px; font-size: 11px; }
  #mobile-map[aria-expanded="true"] { color: var(--gold); background: #292920; }
  #mobile-race-drawer { max-height: min(64dvh, calc(100dvh - var(--mobile-dock-height, 76px) - 12px)); overflow-y: auto; overscroll-behavior-y: contain; padding: 0 max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left)); border-bottom: 1px solid var(--border); }
  .mobile-race-heading { display: flex; justify-content: space-between; align-items: center; min-height: 52px; }
  .mobile-race-heading button { display: grid; place-items: center; padding: 8px; }
  #mobile-race-content #marathon-controls { border: 0; padding: 0; }
  #mobile-race-content .race-body { gap: 12px; }
  #mobile-race-content .run-controls { display: flex; justify-content: flex-end; }
  #mobile-race-content #runner-edit { flex-grow: 0; }
  #mobile-race-content #run-restart { min-height: 44px; }
  #mobile-race-content .race-display { gap: 8px; padding: 12px; }
  #mobile-race-content .race-digits { font-size: clamp(20px, 6vw, 28px); }
  #mobile-race-content #run-pace, #mobile-race-content #run-speed, #mobile-race-content #run-time { font-size: 16px; }
  #map-dialog { inset: auto 8px calc(var(--mobile-dock-height, 76px) + 8px) auto; width: calc(100% - 16px); max-width: none; max-height: min(62dvh, calc(100dvh - var(--mobile-dock-height, 76px) - 16px)); padding: 8px; }
  #osm-map { height: min(40dvh, 360px); }
}
