/* Dark "Dusk" theme, phone first. Buttons and controls follow the Tonal
   system chosen on 2026-11-14 (see UI.md): everything tappable has a fill,
   lime is the main step, selected things go lime (no ticks: 2026-11-15). */
/* Tokens and button roles are in css/tonal.css, loaded first. */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: clip; background: var(--bg); }
/* The map handles every pan and pinch itself, so the browser doesn't need to
   work out whether a touch is meant to scroll or zoom the page. */
html, body, #map { touch-action: none; overscroll-behavior: none; }
.list #route-list { touch-action: pan-y; }
body { font-family: "Space Grotesk", system-ui, sans-serif; color: var(--text); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }
#map { position: absolute; inset: 0; }

/* Busy (Generate, Find): stays lime, with a spinner. */
.go .t2 { display: none; align-items: center; gap: 10px; }
.loading .go .t1 { display: none; }
.loading .go .t2 { display: inline-flex; }
.loading .go:disabled { background: var(--neon); color: #0b1004; cursor: progress; }
/* Fields: email, icon search and the distance. */
.field, .drawer input, .sheet-head input {
  height: 50px; padding: 0 16px; border-radius: 16px; border: 2px solid transparent;
  background: var(--card); color: var(--text); font: inherit; font-size: 16px; outline: none;
}
:is(.field, .drawer input, .sheet-head input)::placeholder { color: var(--dim-2); }
:is(.field, .drawer input, .sheet-head input):focus { border-color: var(--neon); }

/* Vignette over the map */
.vignette { position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,.55) 100%); }

.glass { background: var(--glass); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%); border: 1px solid var(--edge); }

/* Top HUD */
.hud-top {
  position: absolute; z-index: 3; top: max(12px, env(safe-area-inset-top)); left: 12px; right: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  height: var(--hud-h); padding: 0 12px 0 14px; border-radius: 18px;
}
.tag { font-size: 13px; color: var(--dim); }
/* The name with its motion-blur stripes (assets/logo-runthe.svg, made by the
   backend's devtools/texticons/logo_export.py; chosen 2026-11-15: lime, 30px). */
.logo { display: flex; align-items: center; flex: none; }
.logo img { display: block; height: 30px; width: auto; }
.hud-top .info { text-align: right; display: none; }
.show-results .hud-top .info { display: block; }
.show-results .hud-top .hint { display: none; }
.hint { font-size: 14px; font-weight: 600; color: var(--neon); }
.has-start .hint .h1 { display: none; }
.hint .h2 { display: none; }
.has-start .hint .h2 { display: inline; }
.hud-top .now { font-size: 22px; font-weight: 700; color: var(--neon); text-shadow: var(--neon-glow); line-height: 1.05; }
.hud-top .now small { font-size: 13px; color: var(--dim); text-shadow: none; }

/* Bottom deck */
.deck {
  position: absolute; z-index: 3; left: 12px; right: 12px; bottom: var(--above-modebar);
  border-radius: 24px; padding: 16px;
}
.setup { display: grid; gap: 14px; }

/* Back to the previous routes, shown only once there are some. Laptops
   show "Back to routes" and the Esc key; phones just "Back". */
.back, .art-back { display: none; justify-content: space-between; }
.has-results .back, .art-can-back .art-back { display: flex; }
.back-short { display: none; }
:is(.back, .art-back) kbd {
  font: 500 11px "JetBrains Mono", monospace; color: var(--lime-ink);
  border: 1px solid rgba(var(--neon-rgb), .35); border-radius: 6px; padding: 2px 6px;
}
@media (hover: none) { :is(.back, .art-back) kbd { display: none; } :is(.back, .art-back) { justify-content: center; } }
.results { display: none; }
.show-results .setup { display: none; }
/* The route info tab sits on the panel's top edge: the panel leaves room
   under it, so it never touches Export GPX. */
body:not([data-mode="art"]):not([data-mode="p2p"]).show-results.has-info .deck { padding-top: 26px; }
/* minmax(0, …): the column is the panel's width, whatever is inside (the
   profile chart is drawn to it, so mustn't widen it, 2026-11-18) */
.show-results .results { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }

.dial { display: flex; align-items: center; justify-content: space-between; }
.readout { text-align: center; }
/* The distance sits in a field, so it looks like something you can type in. */
.readout input {
  width: 4.2ch; box-sizing: content-box; padding: 2px 12px; border-radius: 18px; border: 2px solid transparent;
  background: var(--card); outline: none; text-align: center; color: var(--text);
  font: 700 60px/1.1 "JetBrains Mono", monospace; letter-spacing: -0.04em; -moz-appearance: textfield;
}
.readout input:focus { border-color: var(--neon); }
.readout input::-webkit-inner-spin-button { -webkit-appearance: none; }
.readout .tag { margin-top: 4px; }

/* Distance presets: pick one. The selected one goes lime. */
.chips { display: flex; gap: 6px; }
.chip {
  flex: 1; min-width: 0; height: 40px; padding: 0; border-radius: 999px; background: var(--tone); color: #dfe5ec;
  font-size: 15px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 3px;
  transition: transform .12s, background-color .15s; -webkit-tap-highlight-color: transparent;
}
.chip.active { background: var(--neon); color: #0b1004; }
@media (hover: hover) { .chip:not(.active):hover { background: var(--tone-2); } }
.chip:active { transform: scale(.96); }
.chip:not(.active):active { background: var(--tone-press); }

.nav { display: grid; grid-template-columns: 64px 1fr 64px; gap: 10px; }
.nav-btn { width: 100%; height: 52px; border-radius: 999px; }
.row2 { display: grid; grid-template-columns: 52px 1fr 1fr; gap: 10px; }
:is(.row2, .art-row, .draw-row) .btn { padding-inline: 8px; }

/* Viewing favourites, a mode left from the shelf: the top bar gets a pink
   edge, the list arrives like a new page, and there's no New run button. */
.in-favourites.show-results .hud-top { border-color: rgba(255, 61, 139, .45); }
.in-favourites .list { animation: page-in .3s cubic-bezier(.2, .8, .2, 1); }
.in-favourites #edit { display: none; }
.in-favourites .row2 { grid-template-columns: 52px 1fr; }
@keyframes page-in { from { opacity: 0; transform: translateX(32px); } }
@media (prefers-reduced-motion: reduce) {
  .in-favourites .list { animation: none; }
}

/* Favourite heart: a toggle. On, it's pink and filled. */
.fav { width: 100%; border-radius: 999px; }
.fav svg { fill: none; }
.fav.on { background: #3d1a2b; color: var(--pink); }
.fav.on svg { fill: currentColor; }

/* Account */
.account-btn {
  flex: none; width: 38px; height: 38px; padding: 0; border-radius: 50%;
  display: grid; place-items: center; background: var(--tone); color: var(--text);
  transition: transform .12s, background-color .15s;
}
.account-btn:active { transform: scale(.94); }
.signed-in .account-btn { background: var(--ltone); color: var(--neon); }
.hud-top .hint, .hud-top .info { margin-left: auto; }
/* Account menu: a native dialog that slides in from the right. Browsers
   without these transitions just show and hide it. */
dialog.account {
  inset: 0 0 0 auto; margin: 0; padding: 0; width: min(340px, 86vw); height: 100dvh;
  max-width: none; max-height: none; border: 0; border-left: 1px solid var(--edge);
  background: var(--panel); color: var(--text); transform: translateX(100%);
  transition: transform .28s cubic-bezier(.2, .8, .2, 1), display .28s allow-discrete, overlay .28s allow-discrete;
}
dialog.account[open] { transform: none; }
@starting-style { dialog.account[open] { transform: translateX(100%); } }
dialog.account::backdrop {
  background: rgba(7, 9, 13, 0); transition: background .28s, display .28s allow-discrete, overlay .28s allow-discrete;
}
dialog.account[open]::backdrop { background: rgba(7, 9, 13, .6); }
@starting-style { dialog.account[open]::backdrop { background: rgba(7, 9, 13, 0); } }
@media (prefers-reduced-motion: reduce) {
  dialog.account, dialog.account::backdrop { transition: none; }
}
.drawer {
  height: 100%; overflow-y: auto; touch-action: pan-y; display: flex; flex-direction: column;
  padding: calc(22px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom));
}
.drawer > [data-view] { display: none; gap: 12px; }
dialog.account[data-view="signin"] .drawer > [data-view="signin"],
dialog.account[data-view="sent"] .drawer > [data-view="sent"],
dialog.account[data-view="confirm"] .drawer > [data-view="confirm"],
dialog.account[data-view="account"] .drawer > [data-view="account"],
dialog.account[data-view="delete"] .drawer > [data-view="delete"] { display: grid; }
/* The heading row is as tall as the close button and lines up with it, so
   what follows (e.g. the email and Sign out) starts below the button rather
   than beside it, with extra room below (2026-11-17: they nearly touched). */
.drawer h2 { margin: -8px 0 12px; min-height: 44px; display: flex; align-items: center; font-size: 22px; padding-right: 48px; }
.drawer p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--dim); overflow-wrap: anywhere; }
.drawer strong { color: var(--text); font-weight: 600; }
.drawer form { display: grid; gap: 10px; }
.drawer .btn:not(.btn-tertiary) { padding-inline: 12px; }
.drawer .or { text-align: center; font-size: 14px; color: var(--dim); }
.drawer-user { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.drawer-user p { min-width: 0; }
.drawer-user .btn { flex: none; height: 44px; padding: 0 16px; font-size: 15px; }
.drawer-foot { margin-top: auto; padding-top: 18px; display: flex; justify-content: space-between; align-items: center; }
/* Privacy and Delete account: tertiary, lime words. */
.drawer-link { min-height: 44px; display: inline-flex; align-items: center; padding: 10px 0; font-size: 15px; font-weight: 600; color: var(--neon); text-decoration: none; text-underline-offset: .2em; }
.drawer-link:hover { text-decoration: underline; }
.drawer-links { display: flex; gap: 24px; }
dialog.account:not([data-view="account"]) #delete-account { display: none; }
.account-close { position: absolute; z-index: 1; top: calc(14px + env(safe-area-inset-top)); right: 12px; }
/* Connection card (UI.md): a linked service in the account menu, Garmin
   Connect first. Its official tile at 32px, the name in full, a status line,
   and the action underneath so every state keeps one shape. */
.drawer .drawer-label { margin: 6px 0 -4px; font-size: 14px; font-weight: 600; color: var(--dim); }
.garmin { display: grid; gap: 12px; }
.garmin[hidden] { display: none; }
.conn { display: grid; grid-template-columns: 32px 1fr; align-items: center; gap: 12px; padding: 14px; background: var(--card); border-radius: 18px; }
.conn[hidden] { display: none; }
.conn-logo { width: 32px; height: 32px; display: block; align-self: start; margin-top: 2px; }
.conn-text { min-width: 0; }
.conn-name { font-size: 16px; font-weight: 600; color: var(--text); }
.conn-note { margin: 0; font-size: 14px; line-height: 1.35; color: var(--dim); }
.drawer .conn-note { font-size: 14px; line-height: 1.35; }
.conn-note.on, .drawer .conn-note.on { color: var(--lime-ink); }
.conn-note.on::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--neon); vertical-align: 1px; }
.conn > .btn { grid-column: 1 / -1; width: 100%; }
.conn > .btn[hidden] { display: none; }
.conn > .btn-tertiary { justify-self: start; width: auto; margin-left: -10px; padding: 0 10px; }
.conn > .btn[aria-busy="true"] { pointer-events: none; cursor: progress; }
.conn-msg { margin: 0; font-size: 15px; line-height: 1.45; color: #ffd3e4; }
.drawer .conn-msg { color: #ffd3e4; }
.conn-msg:empty { display: none; }
/* Export's Download GPX and Copy link: one under the other while Download
   GPX is the primary, side by side when Send is (UI.md, Export dialog). */
.export-pair { display: grid; gap: 10px; }
.export-pair.two { grid-template-columns: 1fr 1fr; }
.export-pair.two .btn { padding-inline: 12px; }
.export-pair .btn[hidden] { display: none; }
/* Link box (UI.md): the link just made, and what it means. */
.link-box { display: grid; gap: 4px; padding: 12px 14px; border-radius: 16px; background: var(--card); }
.link-box[hidden] { display: none; }
.link-url { font-size: 15px; color: var(--text); overflow-wrap: anywhere; user-select: all; -webkit-user-select: all; }
.link-box p { margin: 0; font-size: 14px; line-height: 1.4; color: var(--dim); }
.link-box a { color: var(--neon); font-weight: 600; text-decoration: none; }
.link-box a:hover { text-decoration: underline; }
/* Settings rows (UI.md): in the account menu, each opens a page of its own. */
.rows { display: grid; gap: 1px; border-radius: 18px; overflow: hidden; }
.row-link {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 14px 0 16px;
  background: var(--card); color: var(--text); text-decoration: none; font-size: 16px; font-weight: 600;
  transition: background-color .15s; -webkit-tap-highlight-color: transparent;
}
.row-link > svg { flex: none; color: var(--dim); }
.row-link .row-chev { color: var(--dim-2); }
.row-label { flex: 1; min-width: 0; }
.row-link:active { background: var(--tone-2); }
.row-link:focus-visible { outline: 3px solid var(--neon); outline-offset: -3px; }
@media (hover: hover) { .row-link:hover { background: var(--tone); } }
.badge {
  min-width: 24px; height: 24px; padding: 0 8px; border-radius: 999px; display: inline-grid; place-items: center;
  background: var(--ltone); color: var(--lime-ink); font-size: 13px; font-weight: 700;
}
.badge[hidden] { display: none; }
/* Export dialog (export.js): the buttons hide and show as the state changes. */
#export-dialog .btn[hidden] { display: none; }
#export-dialog .btn[aria-busy="true"] { pointer-events: none; cursor: progress; }
#account-error { color: #ffd3e4; }
#account-error:not(:empty) { margin-top: 12px; }

/* Full-screen list on the phone */
.list {
  position: absolute; z-index: 4; inset: 0; padding: calc(70px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom));
  background: rgba(7, 9, 13, .9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; flex-direction: column; gap: 12px;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.list-open .list { opacity: 1; pointer-events: auto; }
.list-head { display: flex; justify-content: space-between; align-items: center; min-height: 44px; }
.list-head h2 { margin: 0; font-size: 18px; font-weight: 700; color: var(--text); }
/* Sort by climb (UI.md): the title, then the button and, when sorted, what
   order it is, on the left, well away from the close button on phones. */
.list-head-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sort-btn { width: 44px; height: 44px; flex: none; }
.sort-btn[hidden] { display: none; }
.sort-btn[aria-pressed="true"] { background: var(--ltone); color: var(--lime-ink); }
@media (hover: hover) { .sort-btn[aria-pressed="true"]:hover { background: var(--ltone-2); } }
.sort-btn[aria-pressed="true"]:active { background: var(--ltone-press); }
.sort-note { font-size: 14px; color: var(--dim); white-space: nowrap; }
.sort-note:empty { display: none; }

#route-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
/* Route rows (2026-11-16, were half-width cards): full width and short, so
   many fit. Shape, distance over number (and area, in favourites), how far
   off the distance asked for on the right, then the heart. Pick one.
   Selected: lime edge and a tinted fill. */
.route-item {
  position: relative; width: 100%; min-height: 74px; border: 2px solid transparent; border-radius: 18px;
  padding: 10px 64px 10px 12px; text-align: left;
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 0 14px; background: var(--card);
  transition: transform .12s, background-color .15s; -webkit-tap-highlight-color: transparent;
}
.route-item .thumb { grid-row: 1 / 3; width: 48px; height: 48px; color: #7d8899; }
.route-item.selected { background: #222c16; border-color: var(--neon); }
.route-item.selected .thumb { color: var(--neon); filter: drop-shadow(0 0 4px rgba(var(--neon-rgb), .5)); }
@media (hover: hover) { .route-item:not(.selected):hover { background: var(--float); } }
.route-item:active { transform: scale(.98); }
.thumb-start { fill: var(--pink); stroke: none; }
.route-cell { position: relative; transition: opacity .24s ease, transform .24s ease; }
.route-cell.leaving { opacity: 0; transform: scale(.85); pointer-events: none; }
/* The heart on each card, also in favourites: a filled heart takes the
   route out, with Undo (2026-11-14; it used to be a bin there). */
.ri-action {
  position: absolute; top: 50%; right: 10px; margin-top: -22px; width: 44px; height: 44px; padding: 0; border-radius: 50%;
  display: grid; place-items: center; color: var(--text); background: rgba(28, 35, 46, .92);
  transition: transform .12s, background-color .15s; -webkit-tap-highlight-color: transparent;
}
.ri-action svg { fill: none; width: 20px; height: 20px; }
.ri-action:active { transform: scale(.92); background: var(--tone-press); }
.ri-heart.on { color: var(--pink); background: #3d1a2b; }
.ri-heart.on svg { fill: currentColor; }
/* One line always, so every row is the same height (2026-11-17): the
   number stays whole, the area name shortens with "…" (its full name is
   the tooltip). */
.ri-meta { grid-column: 2; grid-row: 2; display: flex; align-items: baseline; min-width: 0; white-space: nowrap; font-size: 15px; color: var(--dim); line-height: 1.35; }
.ri-meta > * { flex: none; }
.ri-meta > .ri-place { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ri-num { font: 500 14px "JetBrains Mono"; }
.ri-num::before { content: "#"; }
.ri-place:not(:empty)::before { content: " · "; white-space: pre; }
/* Same as the route info tab's dot: this route has warnings. */
.ri-dot { display: inline-block; width: 7px; height: 7px; margin-left: 6px; vertical-align: 1px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 6px rgba(255, 181, 71, .7); }
/* The route's climb (2026-11-18; it was how far off the distance asked
   for), with a hill: in favourites saved without heights, nothing. */
.ri-climb { font: 500 15px "JetBrains Mono"; color: var(--dim); grid-column: 3; grid-row: 1 / 3; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.ri-climb svg { flex: none; color: var(--dim-2); }
.ri-climb small { font-size: 13px; color: var(--dim-2); }
.ri-dist { grid-column: 2; grid-row: 1; font: 700 22px "JetBrains Mono"; line-height: 1.25; }
.ri-dist small { font-size: 14px; color: var(--dim); }
/* Route info: a tab on the panel's top edge opens a drawer above the route
   controls. The amber dot says there's something to know. Open, it's lime. */
.info-tab {
  display: none; position: absolute; top: -15px; left: 0; right: 0; margin-inline: auto; width: max-content;
  height: 30px; padding: 0 14px; border-radius: 999px; align-items: center; gap: 7px;
  background: var(--float); color: var(--text); box-shadow: 0 4px 12px rgba(0, 0, 0, .4);
  font-size: 13px; font-weight: 600; white-space: nowrap;
  transition: transform .12s, background-color .15s; -webkit-tap-highlight-color: transparent;
}
.info-tab:active { transform: scale(.96); }
.show-results.has-info .info-tab { display: flex; }
.info-open .info-tab { background: var(--ltone); color: var(--lime-ink); }
.info-dot { display: none; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 6px rgba(255, 181, 71, .7); }
.has-warnings .info-dot { display: block; }
.route-info { display: none; }
.info-open.has-info .route-info { display: block; animation: info-in .2s ease-out; }
@keyframes info-in { from { opacity: 0; transform: translateY(6px); } }
/* Elevation profile (js/profile.js, UI.md): a header line, label and
   climb (or, while reading along it, distance and height), over a small
   chart: lime line and fill like the route, round gridlines labelled in
   metres, km along the bottom, the start pink as on the map. Drag, hover
   or arrow keys read it out and put a dot on the route. */
/* min-width 0 and overflow hidden: the chart is drawn to its box's
   width, so it must never hold the box open itself (a narrower screen
   would otherwise keep the old, wider chart and scroll sideways) */
.profile { padding-top: 6px; margin-bottom: 10px; min-width: 0; }
.profile[hidden] { display: none; }
.profile-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.profile-label { font-size: 14px; font-weight: 600; color: var(--dim); }
.profile-value { font-size: 15px; color: var(--dim); white-space: nowrap; }
.profile-value b { font: 600 15px "JetBrains Mono"; color: var(--text); }
.profile-chart { position: relative; height: 112px; min-width: 0; overflow: hidden; border-radius: 10px; touch-action: none; cursor: crosshair; -webkit-tap-highlight-color: transparent; }
.profile-chart:focus-visible { outline: 3px solid var(--neon); outline-offset: 3px; }
/* short screens: a shorter chart, so the map keeps some room above the
   panel with route info open */
@media (max-height: 720px) { .profile-chart { height: 84px; } }
.profile-chart svg { display: block; overflow: visible; max-width: none; }
.pf-grid { stroke: rgba(255, 255, 255, .09); stroke-width: 1; }
.pf-base { stroke: rgba(255, 255, 255, .22); stroke-width: 1; }
.pf-y, .pf-x { font: 500 13px "JetBrains Mono", monospace; fill: var(--dim); }
.pf-y { text-anchor: end; dominant-baseline: middle; }
.pf-area { fill: url(#pf-fill); }
.pf-line { fill: none; stroke: var(--neon); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.pf-start { fill: var(--pink); stroke: var(--panel); stroke-width: 2; }
/* the distance asked for: routes found together share the scale, so a
   short one's line stops before this and a long one's runs past */
.pf-target { stroke: var(--dim-2); stroke-width: 1.5; stroke-dasharray: 4 3; }
/* waypoints on the chart (A to B): like the via and finish markers on the map */
.pf-via { stroke: rgba(233, 238, 245, .25); stroke-width: 1; stroke-dasharray: 3 3; }
.pf-vdot { fill: #0b1004; stroke: #fff; stroke-width: 2; }
.pf-fin { fill: #fff; stroke: #0b1004; stroke-width: 2.5; }
.pf-cursor-line { stroke: var(--text); stroke-width: 1; stroke-dasharray: 3 3; opacity: .7; }
.pf-cursor-dot { fill: var(--neon); stroke: var(--panel); stroke-width: 2; }
/* where you are on the profile, on the route */
.profile-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--neon); border: 3px solid #0b1004; box-shadow: 0 0 10px rgba(var(--neon-rgb), .8); pointer-events: none; }
.profile:not([hidden]) + .info-list { padding-top: 10px; border-top: 1px solid var(--edge); }
.info-list { list-style: none; margin: 0; padding: 6px 0 0; display: grid; gap: 10px; }
.info-list li { display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start; }
.info-list b { display: block; font-size: 15px; font-weight: 600; color: var(--text); }
.info-list li span:not(.info-mark) { display: block; font-size: 14px; line-height: 1.4; color: var(--dim); margin-top: 1px; }
.info-mark {
  width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font: 700 12px "JetBrains Mono", monospace; margin-top: 1px;
}
.warn .info-mark { color: var(--bg); background: var(--amber); }
.ok .info-mark { color: var(--neon); border: 1.5px solid var(--neon); }
.none .info-mark { color: var(--dim); border: 1.5px solid var(--dim); }
/* Map key: how the map marks what's listed above (see main.js). */
.info-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--edge); font-size: 13px; color: var(--dim); }
.info-legend:empty { display: none; }
.key { display: inline-flex; align-items: center; gap: 7px; }
.key i { width: 20px; height: 3px; border-radius: 2px; }
.key-country i { border-radius: 0; background: repeating-linear-gradient(90deg, var(--neon) 0 5px, transparent 5px 9px); }
@media (prefers-reduced-motion: reduce) { .route-info { animation: none !important; } }

/* Start marker: pink with a radar pulse while searching */
.start-marker {
  width: 22px; height: 22px; border-radius: 50%; background: var(--pink);
  border: 3px solid #fff; box-shadow: 0 0 0 4px rgba(255,61,139,.35), 0 0 22px var(--pink);
}
body:not(.show-results) .start-marker { cursor: grab; }
/* While planning, a slow pulse makes the start easy to spot. */
body:not(.show-results):not(.loading) .start-marker::before { animation: pulse 2.2s ease-out infinite; }
@keyframes pulse { from { transform: scale(.6); opacity: .8; } to { transform: scale(2.6); opacity: 0; } }
.start-marker::before, .start-marker::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 1px solid var(--pink); opacity: 0;
}
.loading .start-marker::before { animation: radar 1.6s ease-out infinite; }
.loading .start-marker::after { animation: radar 1.6s ease-out .8s infinite; }
@keyframes radar { from { transform: scale(.5); opacity: .9; } to { transform: scale(6); opacity: 0; } }

#toast {
  position: absolute; z-index: 6; left: 12px; right: 12px; top: calc(76px + env(safe-area-inset-top));
  padding: 12px 14px; border-radius: 14px; font-size: 15px;
  background: #24141d; border: 1px solid rgba(255, 61, 139, .55); color: #ffd3e4;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  opacity: 0; transform: translateY(-8px); transition: .2s; pointer-events: none;
}
#toast.show { opacity: 1; transform: none; }

/* Undo offer after removing a favourite */
#undo {
  position: absolute; z-index: 7; left: 12px; right: 12px; bottom: var(--above-modebar);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 6px 6px 20px; border-radius: 999px; font-size: 15px;
  background: var(--float); box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity .2s, transform .2s, visibility .2s;
}
#undo.show { opacity: 1; visibility: visible; transform: none; animation: undo-in .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes undo-in { from { opacity: 0; transform: translateY(10px); } }
/* Swiped away on touch screens (js/ui.js swipeAway): the toast takes
   touches while it shows (elsewhere taps go through it to the map), and
   the browser leaves the swipe to them. */
@media (hover: none) {
  #toast.show { pointer-events: auto; }
  #toast, #undo { touch-action: none; -webkit-user-select: none; user-select: none; }
}

/* Map credits: the ⓘ sits just under the top bar on the left, clear of the
   bottom panel and its route info tab. The text slides out to its right. */
.credits {
  position: absolute; left: 0; top: calc(100% + 8px);
  min-height: 26px; display: flex; flex-direction: row-reverse; justify-content: flex-end; align-items: flex-start; gap: 8px;
  /* fast taps count as double/triple clicks: don't select the text */
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.credits-btn { width: 24px; height: 24px; padding: 0; display: grid; place-items: center; color: var(--text); opacity: .85; }
.credits-btn:hover { opacity: 1; }
.credits-i { fill: var(--bg); }
.credits-text {
  font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden;
  background: rgba(16, 20, 28, .9); border: 1px solid var(--edge); border-radius: 8px;
  padding: 5px 10px; max-width: min(420px, calc(100vw - 80px)); opacity: 1;
  transition: max-width .5s cubic-bezier(.2, .8, .2, 1), padding .5s cubic-bezier(.2, .8, .2, 1),
              opacity .35s ease, border-color .35s ease;
}
/* Open, long credits (satellite adds Esri's) wrap onto more lines rather
   than being cut off. Closing goes back to one line, so the slide works. */
.credits.open .credits-text { white-space: normal; line-height: 1.4; }
.credits-btn { margin-top: 1px; }
.credits-text a { color: inherit; text-decoration: none; }
.credits-text a:hover { color: var(--text); }
.credits:not(.open) .credits-text {
  max-width: 0; padding-left: 0; padding-right: 0; opacity: 0; border-color: transparent; pointer-events: none;
}

/* The round buttons over the map, stacked above the bottom panel on the
   left and moving with it: Focus nearest the panel, My location above it
   (the dot marks where you are), Satellite on top, 54px apart. */
.locate-btn {
  position: absolute; left: 0; bottom: calc(100% + 64px);
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: var(--float); color: var(--text); box-shadow: 0 6px 16px rgba(0, 0, 0, .5);
  transition: transform .12s, background-color .15s; -webkit-tap-highlight-color: transparent;
}
.locate-btn[hidden] { display: none; }
/* No room above the panel (a short phone with a tall panel: js/map.js
   fit): they fade out rather than sit on the top bar. */
.locate-btn { transition: transform .12s, background-color .15s, color .15s, box-shadow .15s, opacity .18s, visibility .18s; }
.no-sat-btn .sat-btn, .no-locate-btn #locate, .no-focus-btn #focus { opacity: 0; visibility: hidden; pointer-events: none; }
/* Satellite toggle: the same round button, on top. */
.sat-btn { bottom: calc(100% + 118px); }
/* Focus (2026-11-23, the user): frames what the mode has on the map (the
   route, or only its start before there's a leg; each mode's focus() in
   js/modes.js). With nothing there yet (no start in Loop or A to B, GPS
   art before a search) it's disabled, like Undo with nothing to undo,
   rather than leaving a gap (the user). */
.focus-btn { bottom: calc(100% + 10px); }
.locate-btn:disabled { background: #1a2029; color: #566070; box-shadow: none; cursor: not-allowed; }
.sat-btn[aria-pressed="true"] { color: var(--neon); background: var(--ltone); }
.locate-btn:active:not(:disabled) { transform: scale(.94); }
.locate-btn:not([aria-pressed="true"]):active:not(:disabled) { background: var(--tone-press); }
.locate-btn.busy svg { animation: locate-busy 1s ease-in-out infinite; }
@keyframes locate-busy { 50% { opacity: .35; } }
.me-dot {
  width: 16px; height: 16px; border-radius: 50%; background: #e9eef5;
  border: 3px solid #07090d; box-shadow: 0 0 0 6px rgba(233, 238, 245, .18);
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) { .locate-btn.busy svg { animation: none; opacity: .5; } }

/* The shelf of modes: full width along the bottom on phones, like the tab
   bars in Strava or Garmin Connect. The current mode's icon sits on a lime
   pill; modes not built yet are dimmer. */
.modebar {
  position: absolute; z-index: 4; left: 0; right: 0; bottom: 0;
  height: calc(var(--modebar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: #0b0e14; border-top: 1px solid var(--edge);
}
/* The favourites heart only shows while signed in. Every mode looks the
   same, now and in future (the user, 2026-11-13): grey, then white on the
   lime pill with a lime label when current. No per-mode colours here. */
body:not(.signed-in) .modebar .signed-in-only { display: none; }
.modebar button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--dim); -webkit-tap-highlight-color: transparent;
}
.mode-icon { width: 52px; height: 30px; border-radius: 15px; display: grid; place-items: center; transition: background .2s; }
.mode-icon svg { display: block; }
.mode-icon .logo-dot { fill: var(--pink); } /* the logo's dot, the one exception */
.mode-label { font-size: 12px; font-weight: 600; }
.modebar .active { color: #fff; }
.modebar .active .mode-icon { background: rgba(var(--neon-rgb), .16); }
.modebar .active .mode-label { color: var(--neon); }
.modebar .soon { opacity: .6; }
.modebar button:active .mode-icon { background: rgba(255, 255, 255, .1); }

/* Phones: lighter to draw (no live blur behind panels, no edge overlay),
   and a more compact setup panel so more of the map shows. */
@media (max-width: 899px) {
  .glass { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(16, 20, 28, .94); }
  /* The list fills the screen above the shelf of modes, covering the top bar
     and the map credits; the shelf stays, so you can always switch mode. */
  .list {
    backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(7, 9, 13, .97);
    z-index: 5; padding-top: calc(12px + env(safe-area-inset-top));
    bottom: calc(var(--modebar-h) + env(safe-area-inset-bottom)); padding-bottom: 12px;
  }
  .list-open .credits, .list-open .hud-top, .list-open .locate-btn { visibility: hidden; }
  .in-favourites .list.list { animation-name: page-in-phone; }
  .vignette { display: none; }

  .deck { padding: 12px; border-radius: 24px; }
  /* Planning a run, kept compact so the map shows (2026-11-11): the
     distance on one line with "km" beside it, and Back beside Generate
     rather than a row of its own. */
  .setup { gap: 10px; grid-template-columns: auto 1fr; }
  .setup > * { grid-column: 1 / -1; }
  .setup .dial { grid-row: 1; }
  .setup .chips { grid-row: 2; }
  .setup .back { grid-row: 3; grid-column: 1; height: 52px; padding: 0 20px; }
  .has-results .setup .go { grid-row: 3; grid-column: 2; }
  #back-label, .back-long, :is(.back, .art-back) kbd { display: none; }
  .art-back { height: 52px; padding: 0 20px; }
  .back-short { display: inline; }
  /* The number stays centred; "km" hangs off its right side. */
  .readout { position: relative; }
  .readout .tag { position: absolute; left: calc(100% + 8px); bottom: 10px; white-space: nowrap; }
  /* Sized to the number where browsers can, so "km" sits right beside it;
     elsewhere the box keeps room for "21.1". */
  .readout input { font-size: 34px; }
  @supports (field-sizing: content) { .readout input { width: auto; field-sizing: content; min-width: 1.5ch; } }
  .readout .tag { margin-top: 0; font-size: 0; }
  .readout .tag::after { content: "km"; font-size: 15px; }
  .show-results .results { gap: 10px; }
}

@keyframes page-in-phone { from { transform: translateX(100%); } }

/* Narrow phones: keep the name and the hint on one line in the top bar. */
@media (max-width: 380px) {
  .hint { font-size: 13px; }
}

/* Phones: the account button shares the top bar, so shorten the hint. */
@media (max-width: 440px) {
  .h2-more { display: none; }
}

@media (min-width: 900px) {
  .hud-top { right: auto; width: 400px; }
  #toast { right: auto; width: 400px; }
  #undo { left: 50%; right: auto; width: 340px; margin-left: -170px; bottom: 24px; }
  .deck { right: auto; width: 400px; --above-modebar: calc(12px + var(--modebar-h) + 10px); }
  /* On wide screens the shelf sits under the panel, the same width. */
  .modebar {
    left: 12px; right: auto; bottom: 12px; width: 400px; height: var(--modebar-h); padding-bottom: 0;
    border: 1px solid var(--edge); border-radius: 18px; background: var(--glass);
    backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
  }
  /* The route list on laptops: 420px wide from a ~1100px window, down to
     340px (its old width) in narrow ones, so the map keeps room. Widened on
     2026-11-17: favourites' names ("#03 · Heart · Bethnal Green") wrapped
     and made rows uneven. js/main.js frames routes clear of it. */
  :root { --list-w: clamp(340px, 38vw, 420px); }
  .list {
    inset: auto; right: 12px; top: 12px; bottom: 12px; width: var(--list-w); border-radius: 24px; padding: 16px;
    opacity: 1; pointer-events: auto; background: var(--glass); border: 1px solid var(--edge);
    transform: translateX(110%); transition: transform .35s cubic-bezier(.2,.8,.2,1);
  }
  .show-results .list { transform: none; }
  #list-toggle, #list-close { display: none; }
  /* The map's own buttons together at the top right (js/map.js,
     placeMapTools): the credits' ⓘ above Satellite and My location, its
     text sliding out to the left. They move aside for the route list. */
  .map-tools {
    position: absolute; z-index: 3; top: 12px; right: 12px; display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
    transition: right .35s cubic-bezier(.2, .8, .2, 1);
  }
  body.show-results:not([data-mode="art"]):not([data-mode="p2p"]) .map-tools { right: calc(12px + var(--list-w) + 12px); }
  .map-tools .locate-btn { position: static; }
  .map-tools .credits { position: relative; flex-direction: row; align-items: center; }
  .map-tools .credits-btn { width: 46px; height: 32px; margin: 0; }
  /* the text opens to the left of the ⓘ without taking room in the column,
     so the buttons below stay still as it slides and wraps */
  .map-tools .credits-text { position: absolute; top: 0; right: 54px; width: max-content; }
  /* The heart sits at the end of the Export row: ‹ Export GPX › ♥, with
     New run on its own row below (none in favourites), so no gap beside
     the heart (2026-11-14). GPS art the same: Export GPX ♥, New search. */
  .show-results .results { grid-template-columns: 52px minmax(0, 1fr) 52px 52px; }
  .results > * { grid-column: 1 / -1; }
  .results .nav, .results .row2 { display: contents; }
  .nav > *, .row2 > * { grid-column: auto; }
  .nav-btn { height: 52px; }
  .fav { height: 52px; }
  #edit { grid-column: 1 / -1; }
}

/* GPS art mode (js/art.js). It shares the deck with loop mode: in art mode
   loop's panels, start marker, list and top-bar text are hidden, and the
   art panel shows instead. Art has no marker and no top-bar text: it looks
   round the middle of the map (the user, 2026-11-13). */
.art { display: none; }
[data-mode="art"] .setup, [data-mode="art"] .results, [data-mode="art"] .list, [data-mode="art"] .info-tab,
[data-mode="art"] .route-info, [data-mode="art"] .hud-top .hint, [data-mode="art"] .hud-top .info,
[data-mode="art"] .start-marker:not(.art-start) { display: none !important; }
[data-mode="art"] .art { display: block; }
/* A found route's start: loop's pink dot, fixed, so no grab or pulse. */
.art-start { cursor: default !important; }
.art-start::before, .art-start::after { animation: none !important; }
/* A flex column rather than a grid, so a part shrinking away can pull its
   gap in with a negative margin (js/art.js, smooth). */
.art-setup { display: flex; flex-direction: column; gap: 10px; }
.art-setup > .tag { font-size: 14px; font-weight: 600; }
.art-note { margin: 0 0 4px; font-size: 15px; line-height: 1.5; color: var(--dim); }
/* Back (after New search) and Find: side by side on phones, Back above on
   laptops (as in loop mode). */
.art-go { display: grid; gap: 10px; }
@media (max-width: 899px) { .art-can-back .art-go { grid-template-columns: auto 1fr; } }
.art-found { display: none; gap: 12px; }
.art-results .art-setup { display: none; }
.art-results .art-found { display: grid; }
.art-shapes { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: none; }
/* Shape tiles: Icons and Draw open a picker; the chosen shape shows as
   selected (lime edge, tinted fill). */
.art-shape {
  position: relative; flex: 0 0 76px; display: grid; gap: 4px; justify-items: center; padding: 8px 4px 7px; border-radius: 18px;
  border: 2px solid transparent; background: var(--card); color: var(--text); font-size: 13px; font-weight: 600;
}
/* Names wrap onto a second line rather than being cut off. */
.art-shape span, .icon-tile span {
  max-width: 100%; text-align: center; line-height: 1.2; overflow-wrap: break-word;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.art-shapes { align-items: stretch; }
.art-shape { align-content: start; }
.art-shape svg { width: 44px; height: 44px; }
.art-shape.active { background: var(--ltone); border-color: var(--neon); color: var(--lime-ink); flex: 0 1 auto; min-width: 76px; max-width: 140px; padding-inline: 10px; }
.art-shape.active svg { max-width: 100%; }
.art-tool { background: var(--tone); transition: transform .12s, background-color .15s; -webkit-tap-highlight-color: transparent; }
.art-tool svg { width: 30px; height: 44px; }
@media (hover: hover) { .art-tool:hover { background: var(--tone-2); } }
.art-tool:active { transform: scale(.96); background: var(--tone-press); }
/* Short / Medium / Long: pick one. Selected: lime edge and a tinted fill. */
.art-options { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.art-option {
  position: relative; display: grid; gap: 2px; justify-items: center; padding: 10px 4px; border-radius: 18px;
  border: 2px solid transparent; background: var(--card);
  transition: transform .12s, background-color .15s; -webkit-tap-highlight-color: transparent;
}
.art-option.active { border-color: var(--neon); background: #222c16; }
@media (hover: hover) { .art-option:not(.active):hover { background: var(--float); } }
.art-option:active { transform: scale(.97); }
.art-option .tag { font-size: 13px; font-weight: 600; color: var(--text); }
.art-km { font-size: 22px; font-weight: 700; color: var(--text); }
.art-option.active .art-km { color: var(--neon); }
.art-km small { font-size: 12px; color: var(--dim); }
.art-fit { font-size: 13px; font-weight: 500; color: var(--amber); }
.art-fit.good { color: var(--dim); }
.art-row { display: grid; grid-template-columns: 52px 1fr; gap: 10px; }
/* Where to look (2026-11-16): Default, Custom and Free placement, choice
   cards like the chosen shape, shown once a shape is chosen. Custom opens a
   sheet; its tile shows what's set. */
.art-where { display: none; gap: 10px; }
.art-has-shape .art-where { display: grid; }
.art-where > .tag { font-size: 14px; font-weight: 600; }
.art-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.art-mode { transition: transform .12s, background-color .15s; -webkit-tap-highlight-color: transparent; }
.art-mode svg { width: 28px; height: 28px; margin: 4px 0 2px; }
/* All three alike: one line of label under a 28px icon, the same size
   chosen or not. */
.art-mode, .art-mode.active { flex: none; min-width: 0; max-width: none; padding: 10px 4px; gap: 6px; align-content: center; }
.art-mode span { white-space: nowrap; overflow: visible; display: block; }
/* Custom's values, in its note: the line that matters, in full text. */
.art-sum { display: block; margin-bottom: 2px; font-size: 16px; font-weight: 600; color: var(--text); }
@media (hover: hover) { .art-mode:not(.active):hover { background: var(--float); } }
.art-mode:active { transform: scale(.96); }
/* Free placement: the shape in a selection box over the map, like a
   picture in a slide deck. Drag the box to move it, a corner to resize it,
   the round handle on top to turn it. Corners and the handle have 44px
   targets round their small dots. */
.place { position: absolute; left: 0; top: 0; z-index: 2; touch-action: none; cursor: move; outline: none; }
.place[hidden] { display: none; }
.place-shape { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; fill: none; stroke: var(--neon); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 3px rgba(0, 0, 0, .6)); }
.place-shape polyline { vector-effect: non-scaling-stroke; }
.place-frame { position: absolute; inset: -10px; border: 2px dashed rgba(233, 238, 245, .85); border-radius: 4px; pointer-events: none; }
.place:focus-visible .place-frame { border-color: var(--neon); }
.place-corner, .place-turn { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; display: grid; place-items: center; }
.place-corner::after { content: ""; width: 16px; height: 16px; border-radius: 3px; background: var(--text); border: 2px solid #0b1004; box-shadow: 0 1px 6px rgba(0, 0, 0, .5); }
.place-corner[data-corner="nw"] { left: -10px; top: -10px; cursor: nwse-resize; }
.place-corner[data-corner="ne"] { left: calc(100% + 10px); top: -10px; cursor: nesw-resize; }
.place-corner[data-corner="se"] { left: calc(100% + 10px); top: calc(100% + 10px); cursor: nwse-resize; }
.place-corner[data-corner="sw"] { left: -10px; top: calc(100% + 10px); cursor: nesw-resize; }
.place-stem { position: absolute; left: 50%; top: -38px; width: 2px; height: 28px; margin-left: -1px; background: rgba(233, 238, 245, .85); pointer-events: none; }
.place-turn { left: 50%; top: -50px; cursor: grab; }
.place-turn svg { width: 30px; height: 30px; padding: 6px; border-radius: 50%; background: var(--neon); color: #0b1004; box-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
.place.busy .place-turn { cursor: grabbing; }
/* The panel's grip (phones, GPS art): a pill on the top edge in a 44px
   tall, full-width target. Tap or drag down folds the panel to its shape
   row; again, or drag up, opens it. */
.deck-grip { display: none; }

/* Slider (UI.md): a 6px track, lime up to the thumb (--p, set by the
   page), a 28px white thumb in a 44px tall target. Value above the right
   end, label above the left. */
.slider-field { display: grid; gap: 2px; }
.slider-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.slider-top label { font-size: 14px; font-weight: 600; color: var(--dim); }
.slider-top output { font-size: 15px; font-weight: 600; color: var(--text); }
.slider-top output span { color: var(--dim); }
.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; margin: 0; background: none; cursor: pointer; --p: 50%; }
.slider:focus-visible { outline: none; }
.slider::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--neon) var(--p), var(--tone) var(--p)); }
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 28px; height: 28px; margin-top: -11px; border-radius: 50%;
  background: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, .45); transition: transform .12s;
}
.slider:active::-webkit-slider-thumb { transform: scale(1.143); }
.slider:focus-visible::-webkit-slider-thumb { outline: 3px solid var(--neon); outline-offset: 3px; }
.slider::-moz-range-track { height: 6px; border-radius: 3px; background: var(--tone); }
.slider::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--neon); }
.slider::-moz-range-thumb { width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, .45); transition: transform .12s; }
.slider:active::-moz-range-thumb { transform: scale(1.143); }
.slider:focus-visible::-moz-range-thumb { outline: 3px solid var(--neon); outline-offset: 3px; }
.slider:disabled { cursor: not-allowed; }
.slider:disabled::-webkit-slider-runnable-track { background: #1a2029; }
.slider:disabled::-webkit-slider-thumb { background: #566070; }
.sheet-plain { grid-template-rows: none; gap: 14px; }

/* GPS art's own shapes (js/shapes.js): the dialogs the Icons and Draw tiles
   open. */
dialog.sheet {
  margin: auto; padding: 0; border: 0; background: none; color: var(--text);
  width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
}
dialog.sheet::backdrop { background: rgba(7, 9, 13, .66); }
.sheet-card {
  display: grid; gap: 12px; padding: 16px; border-radius: 26px; border: 1px solid var(--edge);
  background: var(--panel); max-height: calc(100dvh - 24px); grid-template-rows: auto minmax(0, 1fr);
}
.sheet-head { display: flex; align-items: center; gap: 10px; }
.sheet-head h2 { flex: 1; margin: 0; font-size: 18px; font-weight: 700; }
.sheet-head input { flex: 1; min-width: 0; height: 48px; }
.sheet-note { margin: 0; font-size: 14px; color: var(--dim); line-height: 1.45; }
.sheet-note:empty { display: none; }
.sheet-note a { color: inherit; text-decoration: underline; }
.icon-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px;
  overflow-y: auto; min-height: 120px; align-content: start;
  /* rows keep their full height when the list is taller than the dialog,
     and scroll: without this the tiles are squashed and their icons cut */
  grid-auto-rows: max-content;
}
.icon-tile {
  display: grid; gap: 4px; justify-items: center; padding: 10px 2px 8px; border-radius: 18px; border: 2px solid transparent;
  background: var(--card); color: var(--text); font-size: 12px; font-weight: 500; overflow: hidden;
  transition: transform .12s, background-color .15s; -webkit-tap-highlight-color: transparent;
}
.icon-tile svg { width: 34px; height: 34px; max-width: 100%; }
/* Wide icons (words, numbers) get a picture as wide as they are (js/shapes.js);
   the widest take two columns. Lines in .px pictures are a steady width on screen. */
.icon-tile.wide { grid-column: span 2; }
.px polyline { vector-effect: non-scaling-stroke; }
.icon-tile span { color: var(--dim); }
@media (hover: hover) { .icon-tile:hover { background: var(--tone-2); } }
.icon-tile:active { transform: scale(.96); background: var(--tone-press); }
#draw-pad {
  width: 100%; aspect-ratio: 1; border-radius: 18px; border: 2px dashed #5b6678;
  background: rgba(255, 255, 255, .02); touch-action: none; cursor: crosshair;
  fill: none; stroke: var(--neon); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round;
}
.draw-row { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 10px; align-items: center; }

/* Laptops: GPS art's heart sits at the end of the Export row, like loop's
   (after the art rules above, so it wins over them). */
@media (min-width: 900px) {
  .art-results .art-found { grid-template-columns: 1fr 52px; }
  .art-found > * { grid-column: 1 / -1; }
  .art-found .art-row { display: contents; }
  #art-download { grid-column: 1; }
  #art-fav { grid-column: 2; height: 52px; }
  #art-new { grid-column: 1 / -1; }
}

/* Phones: the grip folds the panel (GPS art to its shape row, A to B to its
   routing and Export; js/panel.js). */
@media (max-width: 899px) {
  body[data-mode="art"]:not(.art-results) .deck { padding-top: 28px; }
  body[data-mode="art"]:not(.art-results) #art-grip, body[data-mode="p2p"].p2p-has-leg #p2p-grip {
    display: block; position: absolute; top: -14px; left: 0; right: 0; height: 44px; padding: 0;
    background: none; border: 0; cursor: grab; touch-action: none; -webkit-tap-highlight-color: transparent;
  }
  .deck-grip i { display: block; width: 40px; height: 5px; margin: 8px auto 0; border-radius: 3px; background: var(--dim-2); transition: background-color .15s; }
  .deck-grip:active i { background: var(--text); }
  .deck-grip:focus-visible { outline: none; }
  .deck-grip:focus-visible i { outline: 3px solid var(--neon); outline-offset: 3px; }
  .art-folded .art-fold { display: none !important; }
}

/* ----- Switch (UI.md; first used 2026-11-20 for Minimise climb) -----
   On or off for a setting: a 52x32 pill with a white knob; on, the pill
   goes lime and the knob dark, slid right. The label sits to its left and
   the whole row is the target (role="switch", aria-checked). */
.switch-row {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0;
  font-size: 15px; font-weight: 500; color: var(--text); text-align: left; -webkit-tap-highlight-color: transparent;
}
.switch { position: relative; flex: none; width: 52px; height: 32px; border-radius: 999px; background: var(--tone); transition: background-color .15s, transform .12s; }
.switch::after {
  content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--text); transition: transform .15s, background-color .15s;
}
.switch-row[aria-checked="true"] .switch { background: var(--neon); }
.switch-row[aria-checked="true"] .switch::after { transform: translateX(20px); background: #0b1004; }
@media (hover: hover) {
  .switch-row:hover:not(:disabled) .switch { background: var(--tone-2); }
  .switch-row[aria-checked="true"]:hover:not(:disabled) .switch { background: #d4ff58; }
}
.switch-row:active:not(:disabled) .switch { transform: scale(.96); }
.switch-row:disabled { color: #566070; cursor: not-allowed; }
.switch-row:disabled .switch { background: #1a2029; }
.switch-row:disabled .switch::after { background: #566070; }
@media (prefers-reduced-motion: reduce) { .switch, .switch::after { transition: none; } }

/* ----- Map pill (UI.md; 2026-11-20, A to B's Undo and Clear) -----
   A map button with words: the same --float fill and shadow, a 46px pill.
   Laptops show the key that does the same (kbd). */
.map-pill {
  height: 46px; padding: 0 18px; border-radius: 999px; display: inline-flex; align-items: center; gap: 8px;
  background: var(--float); color: var(--text); box-shadow: 0 6px 16px rgba(0, 0, 0, .5);
  font-size: 15px; font-weight: 600; white-space: nowrap;
  transition: transform .12s, background-color .15s; -webkit-tap-highlight-color: transparent;
}
.map-pill[hidden] { display: none; }
.map-pill:has(svg) { padding-left: 14px; }
.map-pill svg { width: 20px; height: 20px; flex: none; }
@media (hover: hover) { .map-pill:hover:not(:disabled) { background: var(--tone-2); } }
.map-pill:active:not(:disabled) { transform: scale(.94); background: var(--tone-press); }
.map-pill:disabled { background: #1a2029; color: #566070; box-shadow: none; cursor: not-allowed; }
.map-pill kbd { font: 500 11px "JetBrains Mono", monospace; color: var(--dim); border: 1px solid var(--edge); border-radius: 6px; padding: 2px 6px; }
.map-pill kbd:empty { display: none; }
/* Lap's count, inside its arrow once the route runs a lap more than once
   (2026-11-23): bold, in the icon's colour, smaller for two digits */
.lap-icon { position: relative; display: inline-flex; flex: none; }
.lap-count { position: absolute; inset: 0; display: grid; place-items: center; font-size: 10px; font-weight: 700; line-height: 1; letter-spacing: -.02em; pointer-events: none; }
.lap-count.two-digits { font-size: 8px; letter-spacing: -.04em; }
.lap-count:empty { display: none; }
/* a detail after the words, as Lap's length: quieter, numbers in mono */
.map-pill-note { margin-left: -2px; color: var(--dim); font: 500 14px "JetBrains Mono", monospace; }
@media (hover: none) { .map-pill kbd { display: none; } }

/* ----- Warning line (UI.md; 2026-11-20, A to B's route info) -----
   Route info's warning card made small: an amber mark, what it is in one
   line, and a chevron; tap it for the why, which opens below. Its target
   reaches 44px tall though it looks 36. */
.warn-line {
  position: relative; justify-self: start; display: inline-flex; align-items: center; gap: 8px; min-height: 36px;
  padding: 0 12px 0 9px; border-radius: 999px; background: rgba(255, 181, 71, .1); color: #ffdca8;
  font-size: 14px; font-weight: 500; text-align: left; transition: transform .12s, background-color .15s;
}
.warn-line { max-width: 100%; }
/* a long label: cut short, the why says it whole */
.warn-line > span:not(.warn-mark) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.warn-line::before { content: ""; position: absolute; inset: -4px 0; }
.warn-line[hidden] { display: none; }
.warn-line svg { width: 16px; height: 16px; flex: none; opacity: .8; transition: transform .2s; }
.warn-line[aria-expanded="true"] svg { transform: rotate(180deg); }
@media (hover: hover) { .warn-line:hover { background: rgba(255, 181, 71, .16); } }
.warn-line:active { transform: scale(.96); }
.warn-mark {
  width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--amber); color: var(--bg); font: 700 11px "JetBrains Mono", monospace;
}
.warn-text { margin: -2px 0 0; font-size: 15px; line-height: 1.45; color: var(--dim); }
.warn-text[hidden] { display: none; }

/* ----- A to B mode (js/p2p.js) -----
   It shares the deck with the other modes: here loop's and GPS art's panels,
   loop's start marker, list and top-bar text are hidden, and A to B's own
   show. Its body classes (p2p-*) only count in this mode. */
body:not([data-mode="p2p"]) :is(.p2p-hint, .p2p-info) { display: none !important; }
.p2p { display: none; }
[data-mode="p2p"] .setup, [data-mode="p2p"] .results, [data-mode="p2p"] .list, [data-mode="p2p"] .info-tab,
[data-mode="p2p"] .route-info, [data-mode="p2p"] .hud-top .hint:not(.p2p-hint), [data-mode="p2p"] .hud-top .info:not(.p2p-info),
[data-mode="p2p"] .start-marker { display: none !important; }
/* A column, like GPS art's: the parts that grow in and shrink away take
   the gap above them with them (a negative margin, js/panel.js), which a
   grid's gaps won't do. */
[data-mode="p2p"] .p2p { display: flex; flex-direction: column; gap: 10px; }
[data-mode="p2p"] .p2p > * { min-width: 0; }
/* The top bar: loop's hint (what a tap does next) until there's a leg,
   then the distance, as in loop mode. */
body[data-mode="p2p"] .hud-top .p2p-hint { display: block; }
body[data-mode="p2p"] .hud-top .p2p-info { display: none; }
body[data-mode="p2p"].p2p-has-leg .hud-top .p2p-hint { display: none; }
body[data-mode="p2p"].p2p-has-leg .hud-top .p2p-info { display: block; }
/* The heading heads all four controls (the chips and the switch) and says
   what they change: Next leg, or Last leg (a Scope heading). */
.p2p-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.p2p-title { margin: 0; font-size: 16px; font-weight: 700; color: var(--text); }

/* ----- Scope heading (UI.md; 2026-11-22, A to B's Next leg / Last leg) -----
   A heading that's also a button: each tap moves on to the next of a few
   scopes for the controls under it. Joined dots under the words show
   them, the current one lime; like the grip, a small mark on a big
   target. The dots sit under the words without taking room, so the words
   stay level with the row's other label and don't move when the dots
   come. Disabled (nothing else to choose), it's a plain heading. */
.scope {
  position: relative; display: flex; align-items: center; min-height: 44px; padding: 0 2px 0 0;
  text-align: left; -webkit-tap-highlight-color: transparent; transition: transform .12s;
}
.scope:disabled { cursor: default; }
.scope-dots { position: absolute; left: 0; top: calc(50% + 13px); display: flex; gap: 8px; }
.scope-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--dim-2); transition: background-color .15s; }
.scope-dots::before {
  content: ""; position: absolute; left: 4px; right: 4px; top: 3px; height: 2px;
  background: var(--dim-2); transition: background-color .15s;
}
.scope-dots::after {
  content: ""; position: absolute; left: 0; top: 0; width: 8px; height: 8px; border-radius: 50%;
  background: var(--neon); transform: translateX(calc(var(--at, 0) * 16px)); transition: transform .18s ease;
}
.scope:disabled .scope-dots { display: none; }
@media (hover: hover) {
  .scope:hover:not(:disabled) .scope-dots i, .scope:hover:not(:disabled) .scope-dots::before { background: var(--dim); }
}
.scope:active:not(:disabled) { transform: scale(.96); }
.scope:active:not(:disabled) .scope-dots i, .scope:active:not(:disabled) .scope-dots::before { background: var(--text); }
@media (prefers-reduced-motion: reduce) { .scope, .scope-dots i, .scope-dots::before, .scope-dots::after { transition: none; } }
/* From the first leg: the elevation and any warning, then Export and the
   heart. p2p-has-route follows them as they grow in and shrink away (it
   comes off once they're gone); p2p-has-leg, for everything else that
   comes with a route, changes at once, so it all moves together. */
.p2p-details, .p2p-actions { display: none; }
[data-mode="p2p"].p2p-has-route .p2p-details {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding-top: 10px; border-top: 1px solid var(--edge);
}
[data-mode="p2p"].p2p-has-route .p2p-actions { display: grid; grid-template-columns: minmax(0, 1fr) 52px; gap: 10px; }
[data-mode="p2p"].p2p-no-details .p2p-details, .p2p-folded .p2p-fold { display: none !important; }
.p2p-details .profile { padding-top: 0; margin-bottom: 0; }
.p2p-actions .fav { height: 52px; }
/* Undo and Clear float above the panel's right end, from the first point
   (Undo also after a Clear, to bring the route back), and Lap left of
   them while there is one. Laid out from the right (Undo, Clear, Lap) so
   that where the row has no room, Lap goes up a row, still on the right,
   and Undo and Clear stay put. */
.p2p-history {
  position: absolute; right: 0; bottom: calc(100% + 10px); display: none; gap: 8px;
  flex-direction: row-reverse; flex-wrap: wrap-reverse; max-width: 100%;
}
#p2p-undo { order: 1; }
#p2p-clear { order: 2; }
#p2p-lap { order: 3; }
[data-mode="p2p"]:is(.p2p-has-point, .p2p-can-undo) .p2p-history { display: flex; }
/* Folded with a warning hidden: the grip's pill turns amber, so it says
   there's something to see where you'd tap to see it (was a dot beside
   it, which floated on the panel's edge, 2026-11-21). */
body[data-mode="p2p"].p2p-folded.p2p-warnings #p2p-grip i { background: var(--amber); }
body[data-mode="p2p"].p2p-folded.p2p-warnings #p2p-grip:active i { background: var(--text); }
/* Waypoints (UI.md): the start keeps loop's pink, vias are dark beads,
   the finish is chequered. Small, and they take no taps: a tap near one
   lands on it (moving them is the Edit mode's job). */
.wp { border-radius: 50%; pointer-events: none; }
.wp-start {
  width: 18px; height: 18px; background: var(--pink); border: 3px solid #fff;
  box-shadow: 0 0 0 3px rgba(255, 61, 139, .35), 0 0 14px rgba(255, 61, 139, .8);
}
.wp-via { width: 13px; height: 13px; background: #0b1004; border: 2.5px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .7); }
.wp-fin {
  width: 19px; height: 19px; border: 2.5px solid #fff;
  background: repeating-conic-gradient(#0b1004 0 25%, #fff 0 50%) 0 0 / 7px 7px; box-shadow: 0 1px 6px rgba(0, 0, 0, .8);
}
/* The same finish on routes that end away from their start in the route
   viewer (favourites) and GPS art (2026-11-21). The viewer's goes with
   its routes, and out of sight in other modes, as loop's start does. */
body:not(.show-results) .loop-finish, :is([data-mode="art"], [data-mode="p2p"]) .loop-finish { display: none !important; }
/* It comes when the line has drawn in to it, fading in (opacity only: the
   map positions markers with transform). */
.loop-finish, .art-finish { animation: finish-in .25s ease-out; }
@keyframes finish-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .loop-finish, .art-finish { animation: none; } }
@media (max-width: 899px) {
  /* the panel is always open, so a shorter chart leaves more map */
  .p2p .profile-chart { height: 84px; }
  /* room for the grip: the panel, and everything floating above it, moves up */
  body[data-mode="p2p"].p2p-has-leg .deck { padding-top: 28px; }
  body[data-mode="p2p"].p2p-has-leg .locate-btn { bottom: calc(100% + 72px); }
  body[data-mode="p2p"].p2p-has-leg :is(.p2p-history, .focus-btn) { bottom: calc(100% + 18px); }
  body[data-mode="p2p"].p2p-has-leg .sat-btn { bottom: calc(100% + 126px); }
  /* clear of Focus, at the panel's left end */
  .p2p-history { max-width: calc(100% - 54px); }
}
/* The route's part of the panel grows in and shrinks away (js/p2p.js,
   createSmoother); the grip's room and the buttons over the map glide
   with it rather than jump. */
@media (max-width: 899px) and (prefers-reduced-motion: no-preference) {
  body[data-mode="p2p"] .deck { transition: padding-top .28s cubic-bezier(.2, .8, .2, 1); }
  body[data-mode="p2p"] .p2p-history { transition: bottom .28s cubic-bezier(.2, .8, .2, 1); }
  body[data-mode="p2p"] .locate-btn {
    transition: bottom .28s cubic-bezier(.2, .8, .2, 1), transform .12s, background-color .15s, color .15s, box-shadow .15s, opacity .18s, visibility .18s;
  }
}
