/* Route planner. Loaded only on the planner page, after style.css (which holds the Atlas tokens and the fonts).
   Wide screens: the header row (where, how, when), the day bar under it, then the map with the elevation
   profile below it on the left and the selected day's stage in a fixed-width column on the right.
   Narrow screens stack the same parts: header, day bar, map, stage, profile. */

.planner { color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.45; background: var(--bg); display: flex; flex-direction: column; }
.planner svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; width: 18px; height: 18px; flex: none; }
.planner h2 { letter-spacing: 0; }
.planner dd, .planner output { font-family: var(--mono); }
.planner button { cursor: pointer; }
.planner button:disabled { cursor: default; }
.plan-page .foot { margin-top: 0; }

/* ---------------------------------------------------------------- header row: A, B, stops, mode | date, reverse, GPX, save */
.plan-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--line); position: relative; z-index: 6; }
.route-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 1 1 480px; min-width: 0; }
.points { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 320px; min-width: 0; }
.points li { position: relative; flex: 1 1 150px; min-width: 0; }
.box { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 4px 0 10px; border: 1px solid var(--ctl-line); border-radius: 6px; background: var(--surface); min-width: 0; }
.box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.box-tag { flex: none; font: 11px var(--mono); color: var(--muted); white-space: nowrap; }
.box input { flex: 1; min-width: 0; height: 100%; border: 0; padding: 0; background: transparent; font-weight: 600; color: var(--ink); outline: none; }
.box input::placeholder { color: var(--muted); font-weight: 400; }
.box input[type="search"]::-webkit-search-cancel-button { display: none; }
.pt-remove { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 4px; background: transparent; color: var(--muted); padding: 0; }
.pt-remove:hover { background: var(--surface-2); color: var(--ink); }
.pt-remove svg { width: 15px; height: 15px; }

.tool { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 44px; padding: 0 14px; border: 1px solid var(--ctl-line); border-radius: 6px;
  background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14px; white-space: nowrap; }
.tool:hover:not(:disabled) { border-color: var(--ink); }
.tool:disabled { color: var(--muted); opacity: .6; }
.tool.icon { width: 44px; padding: 0; }
.tool svg { width: 17px; height: 17px; }
.add-stop { height: 40px; padding: 0 12px 0 10px; }
.add-stop[hidden] { display: none; }
.gpx-note { font: 400 12px var(--mono); color: var(--muted); }
.gpx-note:empty { display: none; }
.head-select select { appearance: none; -webkit-appearance: none; height: 44px; padding: 0 32px 0 12px; border: 1px solid var(--ctl-line); border-radius: 6px; background: var(--surface); color: var(--ink); font-size: 14px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(-45deg, transparent 50%, var(--muted) 50%);
  background-position: right 15px top 20px, right 10px top 20px; background-size: 5px 5px; background-repeat: no-repeat; }
.head-select select:focus-visible { outline: 3px solid var(--sel); outline-offset: 1px; }
.find { position: absolute; left: -9999px; height: 40px; padding: 0 14px; border: 1px solid var(--accent); border-radius: 6px; background: var(--surface); color: var(--accent); font-weight: 600; }
.find:focus-visible { position: static; }
.head-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: auto; }
.date-box { height: 44px; padding-right: 8px; }
.date-box input { font: 600 13px var(--mono); min-width: 120px; color-scheme: inherit; }
.save { height: 44px; padding: 0 16px; border: 0; border-radius: 6px; background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 14px; white-space: nowrap; }
.save:hover:not(:disabled) { background: var(--accent-hover); }
.save:disabled { opacity: .5; }

.suggest { position: absolute; left: 0; top: calc(100% + 4px); width: max(100%, 280px); margin: 0; padding: 4px; list-style: none; background: var(--surface); z-index: 30;
  border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 10px 30px rgba(20, 30, 26, .14); max-height: 320px; overflow: auto; }
.suggest li { padding: 10px 12px; border-radius: 4px; cursor: pointer; line-height: 1.3; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--surface-2); }
.suggest .s-name { display: block; font-weight: 600; }
.suggest .s-detail { display: block; font-size: 12px; color: var(--muted); }
.suggest .s-empty { color: var(--muted); cursor: default; }

/* ---------------------------------------------------------------- the day bar */
.split { padding: 12px 20px 10px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; min-width: 0; margin: 0; }
.split-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; }
.split h2 { margin: 0; font-size: 15px; font-weight: 700; }
.split-modes { display: flex; margin: 0; padding: 0; border: 1px solid var(--ctl-line); border-radius: 6px; overflow: hidden; min-width: 0; }
.split-modes label { display: flex; cursor: pointer; }
.split-modes label + label { border-left: 1px solid var(--ctl-line); }
.split-modes input { position: absolute; opacity: 0; pointer-events: none; }
.split-modes span { display: flex; align-items: center; height: 36px; padding: 0 12px; background: var(--surface); color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.split-modes label:hover span { background: var(--surface-2); }
.split-modes input:checked + span { background: var(--ink); color: var(--surface); font-weight: 600; }
.split-modes input:focus-visible + span { outline: 3px solid var(--sel); outline-offset: -3px; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--ctl-line); border-radius: 6px; background: var(--surface); color: var(--ink); padding: 0; }
.stepper button:hover:not(:disabled) { border-color: var(--ink); }
.stepper button:disabled { opacity: .4; }
.stepper svg { width: 16px; height: 16px; }
.stepper output { min-width: 56px; text-align: center; font-weight: 600; font-size: 15px; white-space: nowrap; }
.split-hint { margin-left: auto; font-size: 12px; color: var(--muted); }

.strip { overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; border-radius: 6px; }
.strip-inner { position: relative; min-width: 100%; }
.strip-tabs { display: flex; gap: 6px; height: 52px; background: var(--handle); border: 1px solid var(--ctl-line); border-radius: 6px; overflow: hidden; }
.strip-tabs:empty { display: none; }
.strip-empty { margin: 0; height: 52px; display: flex; align-items: center; padding: 0 14px; border: 1px dashed var(--ctl-line); border-radius: 6px; background: var(--surface-2); color: var(--muted); font-size: 13px; }
.strip-empty[hidden] { display: none; }
.day-tab { flex: 1 1 0; min-width: 52px; border: 0; padding: 0 12px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 1px;
  text-align: left; background: var(--tint); color: var(--ink); overflow: hidden; }
.day-tab.t0 { --tint: var(--day-0); } .day-tab.t1 { --tint: var(--day-1); } .day-tab.t2 { --tint: var(--day-2); }
.day-tab[aria-selected="true"] { background: var(--sel); color: var(--on-sel); }
.day-tab b, .day-tab span { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-tab b { font-weight: 700; font-size: 13px; }
.day-tab span { font-family: var(--mono); font-size: 11px; color: var(--ink-2); }
.day-tab[aria-selected="true"] span { color: var(--sel-soft); }
.day-tab:focus-visible { outline: 3px solid var(--sel); outline-offset: -3px; }
.day-tab[aria-selected="true"]:focus-visible { outline-color: var(--on-sel); }
.strip-handles { position: absolute; inset: 0; pointer-events: none; }
.day-handle { position: absolute; top: 0; bottom: 0; width: 44px; margin-left: -22px; pointer-events: auto; cursor: col-resize; touch-action: none; display: grid; place-items: center; outline: none; }
.day-handle::after { content: ""; width: 4px; height: 22px; border-radius: 2px; background: #FFFFFF; opacity: .9; box-shadow: 0 0 0 1px var(--handle); }
.day-handle:hover::after, .day-handle.dragging::after { width: 6px; height: 30px; }
.day-handle:focus-visible::after { width: 8px; height: 34px; background: var(--sel); box-shadow: 0 0 0 2px #FFFFFF; }

.route-totals { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; font: 12px var(--mono); color: var(--ink-2); }
.route-totals b { font-weight: 600; color: var(--ink); }
.rt-label { font: 700 11px var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.rt-days:empty { display: none; }

/* ---------------------------------------------------------------- map + profile | stage */
.stage { display: flex; align-items: stretch; min-width: 0; }
.stage-main { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }

.map-section { position: relative; }
.map-wrap { position: relative; overflow: hidden; background: var(--map-bg); height: clamp(470px, calc(100dvh - 530px), 720px); }
.map { position: absolute; inset: 0; }
.map-failed { position: absolute; left: 14px; top: 72px; z-index: 3; margin: 0; max-width: min(360px, calc(100% - 28px)); padding: 10px 14px; background: var(--surface); border-radius: 6px; border: 1px solid var(--line); font-size: 13px; }
.status { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 4; margin: 0; max-width: min(520px, calc(100% - 28px)); padding: 9px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; font-weight: 600; font-size: 13px; text-align: center; }
.status:empty { display: none; }
.status.error { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.status.busy::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; border-radius: 50%; border: 2px solid var(--accent); border-right-color: transparent; animation: spin .8s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(1turn); } }

.area-select { position: absolute; top: 14px; right: 14px; z-index: 3; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 6px 0 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; font-size: 13px; font-weight: 600; }
.area-swatch { flex: none; width: 18px; height: 12px; border: 1.5px solid var(--accent); background: repeating-linear-gradient(45deg, var(--corridor) 0 3px, var(--hatch) 3px 4px); }
.area-select select { height: 32px; border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; background: var(--surface-2); font: 600 13px var(--mono); color: var(--ink); cursor: pointer; }
.area-select:focus-within { outline: 3px solid var(--sel); outline-offset: 2px; }
.area-select select:focus { outline: none; }

.day-legend { position: absolute; left: 14px; bottom: 14px; z-index: 3; margin: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 10px; max-width: calc(100% - 140px);
  padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }
.day-legend[hidden] { display: none; }
.day-legend li { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.day-legend .swatch { width: 18px; height: 4px; background: var(--c); }
.day-legend li.sel { font-weight: 700; }
.legend-card { position: absolute; left: 14px; bottom: 14px; z-index: 3; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; font-size: 12px; }
.legend-card[hidden] { display: none; }
.legend-card ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.legend-card li { display: flex; align-items: center; gap: 6px; }
.legend-card .swatch { width: 18px; height: 4px; background: var(--c); }
.status:not(:empty) ~ .map-failed { top: 72px; }

/* map tools: a row of flat white controls in the top-left corner */
.map-tools { position: absolute; top: 14px; left: 14px; z-index: 4; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; max-width: calc(100% - 300px); }
.seg, .tool-group { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg label { display: flex; cursor: pointer; }
.seg label + label, .tool-group button + button { border-left: 1px solid var(--line); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label > span { display: grid; place-items: center; width: 42px; height: 42px; color: var(--ink-2); }
.seg input:checked + span { background: var(--ink); color: var(--surface); }
.seg input:focus-visible + span { outline: 3px solid var(--sel); outline-offset: -3px; }
.tool-group button, .tool-single { width: 42px; height: 42px; display: grid; place-items: center; border: 0; background: var(--surface); color: var(--ink); padding: 0; }
.tool-single { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 6px; }
.tool-group button:hover:not(:disabled), .tool-single:hover { background: var(--surface-2); }
.tool-group button:disabled { color: var(--muted); opacity: .45; }
.tool-select { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 6px 0 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; font-size: 13px; font-weight: 600; }
.tool-select select { height: 32px; border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; background: var(--surface-2); font-size: 13px; color: var(--ink); cursor: pointer; }
.tool-select:focus-within { outline: 3px solid var(--sel); outline-offset: 2px; }
.tool-select select:focus { outline: none; }

/* markers on the map */
.wp-marker { width: 22px; height: 22px; border-radius: 50%; background: #56625C; color: #FFFFFF; border: 3px solid #FFFFFF; display: grid; place-items: center;
  font: 600 10px/1 "IBM Plex Mono", monospace; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); cursor: grab; }
.wp-marker.start { background: #FFFFFF; color: #1B2421; border-color: #1B2421; }
.wp-marker.end { background: #1B2421; color: #FFFFFF; border-color: #FFFFFF; }
.day-tag { display: flex; flex-direction: column; align-items: center; cursor: grab; }
.day-tag span { display: block; padding: 3px 7px; border-radius: 3px; background: #1B2421; color: #FFFFFF; font: 600 11px/1.3 "IBM Plex Mono", monospace; white-space: nowrap; }
.day-tag::after { content: ""; width: 2px; height: 12px; background: #1B2421; }
.area-tag { display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.area-tag span { display: block; padding: 3px 8px; border-radius: 3px; background: #0B5D57; color: #FFFFFF; font: 600 11px/1.3 "IBM Plex Mono", monospace; white-space: nowrap; }
.area-tag::after { content: ""; width: 1.5px; height: 14px; background: #0B5D57; }
.hover-marker { width: 14px; height: 14px; border-radius: 50%; background: #FFFFFF; border: 3px solid #1B2421; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); pointer-events: none; }
.maplibregl-popup-content { font-family: var(--font); border-radius: 6px; padding: 12px 14px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(20, 30, 26, .16); }
.maplibregl-popup-tip { border-top-color: var(--surface) !important; border-bottom-color: var(--surface) !important; }
.maplibregl-popup-close-button { font-size: 20px; width: 36px; height: 36px; color: var(--muted); }
.pop-actions { display: flex; flex-direction: column; gap: 6px; }
.pop-actions button { min-height: 44px; text-align: left; border: 1px solid var(--ctl-line); background: var(--surface); border-radius: 6px; padding: 0 12px; font-weight: 600; }
.pop-actions button:hover { border-color: var(--ink); }
.pop-kind { font: 600 11px var(--mono); color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.pop-name { margin: 2px 0 4px; font-weight: 700; font-size: 15px; }
.pop-meta { margin: 0 0 4px; font-size: 13px; color: var(--muted); }
.pop-text { margin: 4px 0; font-size: 13px; max-height: 120px; overflow: auto; }
.pop-links { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 13px; font-weight: 600; }
.pop-links a { display: inline-flex; align-items: center; min-height: 32px; }
/* MapLibre's attribution is a <details>: keep the site's disclosure styling off it. */
.maplibregl-ctrl-attrib { border-bottom: 0; }
.maplibregl-ctrl-attrib summary { min-height: 0; font-weight: 400; }
.maplibregl-ctrl-group { border-radius: 6px !important; box-shadow: none !important; border: 1px solid var(--line); }
.maplibregl-ctrl-group button { width: 36px; height: 36px; }
.maplibregl-ctrl-group { background: var(--surface) !important; }
.maplibregl-ctrl-group button + button { border-top-color: var(--line) !important; }
.maplibregl-ctrl-scale { background: var(--surface); color: var(--ink-2); border-color: var(--ink-2); font: 10px var(--mono); }
@media (max-width: 900px) { .maplibregl-ctrl-scale { display: none; } }
.maplibregl-ctrl-attrib.maplibregl-compact { background: var(--surface); color: var(--ink-2); }
.maplibregl-ctrl-attrib a { color: var(--ink-2); }
@media (prefers-color-scheme: dark) { .maplibregl-ctrl-icon, .maplibregl-ctrl-attrib-button { filter: invert(1) hue-rotate(180deg); } }

/* the height profile under the map */
.profile { background: var(--surface); border-top: 1px solid var(--line); padding: 12px 20px 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1 0 auto; }
.chart-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.chart-head h2 { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.chart-note { font-size: 12px; color: var(--muted); }
.chart-stats { margin: 0 0 0 auto; display: flex; gap: 14px; font-size: 12px; }
.chart-stats div { display: flex; gap: 6px; align-items: baseline; }
.chart-stats dt { color: var(--muted); }
.chart-stats dd { margin: 0; font-weight: 600; font-size: 12px; }
.chart-readout { flex-basis: 100%; font: 12px var(--mono); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.4em; order: 5; }
.chart-box { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: 110px auto; column-gap: 8px; }
.chart-box svg { grid-column: 2; grid-row: 1; width: 100%; height: 100%; display: block; stroke: none; cursor: pointer; touch-action: pan-y; }
.chart-box .y-axis { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; justify-content: space-between; font: 11px var(--mono); color: var(--muted); text-align: right; }
.chart-box .x-axis { grid-column: 2; grid-row: 2; position: relative; height: 18px; font: 11px var(--mono); color: var(--muted); }
.chart-box .x-axis span { position: absolute; top: 2px; transform: translateX(-50%); white-space: nowrap; }
.chart-box .x-axis span:first-child { transform: none; }
.chart-box .x-axis span:last-child { transform: translateX(-100%); }
.chart-box .band { fill: var(--band-0); } .chart-box .band.t1 { fill: var(--band-1); } .chart-box .band.t2 { fill: var(--band-2); }
.chart-box .band.sel { fill: var(--band-sel); }
.chart-box .area { fill: var(--area); }
.chart-box .line { fill: none; stroke: var(--ink); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.chart-box .sel-line { fill: none; stroke: var(--sel); stroke-width: 3.5; vector-effect: non-scaling-stroke; }
.chart-box .edge { stroke: var(--ink); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-box .cursor { stroke: var(--ink); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-box .note { grid-column: 1 / 3; align-self: center; }
.chart-empty { grid-column: 1 / 3; grid-row: 1; margin: 0; display: flex; align-items: center; justify-content: center; border: 1px dashed var(--ctl-line); border-radius: 6px;
  background: var(--surface-2); color: var(--muted); font-size: 13px; text-align: center; padding: 0 12px; }

/* the selected day's stage */
.detail { flex: 0 0 400px; width: 400px; min-width: 0; background: var(--surface); border-left: 1px solid var(--line); padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 16px; }
.detail-head { display: flex; align-items: center; gap: 8px; }
.detail-names { flex: 1; min-width: 0; }
.square { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--ctl-line); border-radius: 6px; background: var(--surface); color: var(--ink); padding: 0; }
.square:hover:not(:disabled) { border-color: var(--ink); }
.square:disabled { opacity: .4; }
.kicker-day { margin: 0; font: 600 12px var(--mono); color: var(--sel); text-transform: uppercase; }
.detail h2 { margin: 0; font-size: 20px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.detail-date { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.day-panel, .day-more { display: flex; flex-direction: column; gap: 16px; outline: none; }
.day-more[hidden] { display: none; }
.detail-empty { margin: 0; color: var(--ink-2); font-size: 13px; }
.detail-empty[hidden] { display: none; }
.day-stats { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 6px; }
.day-stats div { padding: 8px 10px; min-width: 0; }
.day-stats div + div { border-left: 1px solid var(--line); }
.day-stats dt { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-stats dd { margin: 0; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-stats dd small { font-size: 11px; font-weight: 400; color: var(--muted); margin-left: 2px; }
.day-wx { margin: 0; display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--surface-2); border-radius: 6px; font-size: 13px; }
.day-wx[hidden] { display: none; }
.day-wx svg { width: 20px; height: 20px; color: var(--ink-2); stroke-width: 1.8; }
.day-wx b { font-weight: 600; }
.day-bars { display: flex; flex-direction: column; gap: 8px; }
.day-bar[hidden] { display: none; }
.day-bar-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; margin-bottom: 4px; }
.day-bar-head b { font-weight: 600; }
.day-bar-head span { color: var(--muted); text-align: right; }
.day-bar .note, .makeup .note { margin: 0; font-size: 12px; color: var(--muted); }
.bar { display: flex; gap: 1px; height: 8px; overflow: hidden; }
.bar span { display: block; min-width: 3px; background: var(--c); }
.night { border: 2px solid var(--sel); border-radius: 6px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.night.arrival { border-color: var(--ink); }
.night-kicker { margin: 0; font: 600 11px var(--mono); color: var(--sel); text-transform: uppercase; }
.night.arrival .night-kicker { color: var(--ink); }
.night-name { display: block; margin: 0; padding: 0; border: 0; background: none; text-align: left; font-size: 16px; font-weight: 700; color: var(--ink); min-height: 32px; }
.night-name:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.night-name.plain { cursor: default; text-decoration: none; color: var(--ink); min-height: 0; }
.night-meta { margin: 0; font-size: 13px; color: var(--muted); }
.night-alts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.night-alts button { min-height: 36px; padding: 6px 10px; border: 1px solid var(--ctl-line); border-radius: 6px; background: var(--surface); font-size: 12px; color: var(--ink); text-align: left; }
.night-alts button:hover { border-color: var(--ink); }
.night .note { margin: 0; font-size: 13px; color: var(--muted); }
.wx-credit { margin: 0; font-size: 12px; color: var(--muted); }
.wx-credit[hidden] { display: none; }
.wx-credit a { color: var(--muted); }

.whole { border: 1px solid var(--line); border-radius: 6px; padding: 0 12px; }
.whole[hidden] { display: none; }
.whole > summary { list-style: none; display: flex; align-items: center; min-height: 44px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.whole > summary::-webkit-details-marker { display: none; }
.whole > summary::after { content: ""; margin-left: auto; width: 7px; height: 7px; border: solid var(--ink-2); border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-3px); }
.whole[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.whole-part { padding: 4px 0 12px; }
.whole-part + .whole-part { border-top: 1px solid var(--line-soft); padding-top: 10px; }
.whole-title { margin: 0 0 6px; font-size: 12px; font-weight: 600; }
.legend { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.legend li { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.legend .dot { width: 10px; height: 10px; border-radius: 2px; background: var(--c); }
.legend .share { margin-left: auto; color: var(--muted); font-family: var(--mono); font-size: 11px; }
.app-note { margin: auto 0 0; font-size: 12px; color: var(--muted); }
.noscript { margin: 0; padding: 16px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }

.planner:fullscreen { overflow-y: auto; background: var(--bg); }

/* ---------------------------------------------------------------- narrower screens */
@media (max-width: 1180px) {
  .detail { flex-basis: 360px; width: 360px; }
  .split-hint { margin-left: 0; width: 100%; }
}
@media (max-width: 900px) {
  .plan-head { padding: 12px 16px; gap: 8px; }
  .route-form { flex-basis: 100%; }
  .points { flex-basis: 100%; flex-direction: column; }
  .points li { flex: none; }
  .box { height: 44px; }
  .pt-remove { width: 40px; height: 40px; }
  .add-stop { height: 44px; flex: 1 1 auto; }
  .head-select { flex: 1 1 auto; }
  .head-select select { width: 100%; }
  .head-tools { margin-left: 0; width: 100%; }
  .date-box { flex: 1 1 calc(100% - 50px); min-width: 0; }
  .date-box input { min-width: 0; }
  .head-tools .save { flex: 1 1 140px; }

  .split { padding: 12px 16px 10px; }
  .split-row { gap: 10px; }
  .split h2 { width: 100%; }
  .split-modes { flex: 1 1 100%; }
  .split-modes label { flex: 1 1 0; min-width: 0; }
  .split-modes span { width: 100%; height: 44px; justify-content: center; text-align: center; white-space: normal; line-height: 1.15; padding: 2px 6px; font-size: 12px; }
  .stepper button { width: 44px; height: 44px; }
  .split-hint { width: auto; flex: 1 1 160px; }
  .strip-tabs { height: 56px; }
  .strip-empty { height: 56px; }
  .day-tab { padding: 0 8px; }

  .stage { flex-direction: column; }
  .stage-main { display: contents; }
  .map-section { order: 1; }
  .detail { order: 2; flex: none; width: auto; border-left: 0; border-top: 1px solid var(--line); padding: 14px 16px 18px; }
  .profile { order: 3; padding: 12px 16px 16px; }
  .map-wrap { height: 62vh; min-height: 340px; max-height: 560px; }
  .map-tools { position: static; max-width: none; flex-wrap: nowrap; overflow-x: auto; padding: 8px 16px; background: var(--surface); border-top: 1px solid var(--line); scrollbar-width: none; }
  .map-tools > * { flex: none; }
  .tool-select-label { display: none; }
  .area-select { top: 12px; right: 12px; }
  .area-select .area-label { display: none; }
  .area-select select { height: 34px; }
  /* the attribution takes the bottom of a phone-sized map, so the legend goes to the top */
  .day-legend { left: 12px; top: 12px; bottom: auto; max-width: calc(100% - 150px); font-size: 11px; padding: 6px 10px; }
  .legend-card { left: 12px; top: 12px; bottom: auto; max-width: calc(100% - 150px); }
  .status { bottom: auto; top: 64px; left: 12px; right: 12px; transform: none; max-width: none; text-align: left; }
  .map-failed { left: 12px; top: 64px; }
  .chart-box { grid-template-rows: 90px auto; }
  .chart-stats { margin-left: 0; width: 100%; flex-wrap: wrap; gap: 4px 12px; }
  .day-stats div { padding: 8px 6px; }
  .night-alts button { min-height: 44px; }
}
@media (max-width: 380px) {
  .day-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .day-stats div + div { border-left: 0; }
  .day-stats div:nth-child(even) { border-left: 1px solid var(--line); }
  .day-stats div:nth-child(n + 3) { border-top: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) { .status.busy::before { animation: none; } }
