/* Glide Path styles. */
/* The site's tokens (assets/css/main.css): cool greys, violet for what you act on, amber only for warnings. Data colours
   are the site's chart palette, checked with the dataviz validator (see AGENTS.md). Each colour is defined three times. */
:root {
  color-scheme: light;
  --surface: #ffffff; --surface-2: #f5f5f6; --line: #dcdde1; --line-2: #c3c5cc;
  --ink: #1d1e23; --ink-2: #41434c; --muted: #5a5c67;
  --accent: #6459d3; --accent-ink: #ffffff; --accent-soft: rgba(100, 89, 211, .08); --focus: #6459d3;
  --warn: #8f5300; --warn-bg: #fdf1dc;
  --s-route: #a58d12; --s-straight: #5a4fd6; --s-curve: #12a599; --s-hit: #b8263a;
  --terrain: #e3e3e7; --terrain-edge: #8d909b; --steep: #9a9ca5;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --serif: "STIX Two Text", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface: #1b1c1f; --surface-2: #242529; --line: #34363b; --line-2: #4a4c53;
    --ink: #ececef; --ink-2: #c9cad1; --muted: #a2a4ad;
    --accent: #c8c0ff; --accent-ink: #1b1c1f; --accent-soft: rgba(200, 192, 255, .10); --focus: #c8c0ff;
    --warn: #e2a336; --warn-bg: #3a2c12;
    --s-route: #e4cc66; --s-straight: #a798ff; --s-curve: #88fce9; --s-hit: #eb4763;
    --terrain: #34363b; --terrain-edge: #7c808b; --steep: #7c7f88;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface: #1b1c1f; --surface-2: #242529; --line: #34363b; --line-2: #4a4c53;
  --ink: #ececef; --ink-2: #c9cad1; --muted: #a2a4ad;
  --accent: #c8c0ff; --accent-ink: #1b1c1f; --accent-soft: rgba(200, 192, 255, .10); --focus: #c8c0ff;
  --warn: #e2a336; --warn-bg: #3a2c12;
  --s-route: #e4cc66; --s-straight: #a798ff; --s-curve: #88fce9; --s-hit: #eb4763;
  --terrain: #34363b; --terrain-edge: #7c808b; --steep: #7c7f88;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.45 var(--font); color: var(--ink); background: var(--surface);
       font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* Layout: controls on the left; map with the cross-section under it on the right. On a phone: header, map,
   cross-section, then the controls, all in one scroll. */
#app { display: grid; height: 100vh; height: 100dvh;
       grid-template-columns: minmax(300px, 360px) 1fr; grid-template-rows: auto 1fr auto;
       grid-template-areas: "head map" "panel map" "panel prof"; }
/* the settings can be put away on a wide screen; a button on the map brings them back */
#app.panel-off { grid-template-columns: 0 1fr; }
#app.panel-off #head, #app.panel-off #panel { display: none; }
.leaflet-bar a.show-panel { display: grid; place-items: center; }
#head { grid-area: head; padding: 14px 18px 10px; border-right: 1px solid var(--line); }
#panel { grid-area: panel; overflow-y: auto; padding: 0 18px 28px; border-right: 1px solid var(--line); }
#map { grid-area: map; min-height: 320px; background: #e6e2d7; }
#prof { grid-area: prof; border-top: 1px solid var(--line); background: var(--surface-2); display: grid;
        grid-template-columns: 1fr auto; grid-template-rows: auto 190px; }

.title { display: flex; align-items: center; gap: 10px; }
h1 { font-family: var(--serif); font-size: 23px; font-weight: 600; line-height: 1.2; margin: 0; }
.chip { font-size: 12.5px; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.chip.off { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.icon-btn { flex: none; margin-left: auto; width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: transparent; cursor: pointer; display: grid; place-items: center; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.sm { width: 40px; height: 40px; margin-left: 0; }
.lede { margin: 6px 0 0; color: var(--ink-2); font-size: 14px; }
.lede a { color: var(--muted); }

/* Panel sections fold; a folded one says its settings in its title row, so the panel is short without opening them */
details.group { border-top: 1px solid var(--line); padding: 0 0 6px; }
details.group:first-child { border-top: 0; }
details.group > summary { display: flex; align-items: baseline; gap: 10px; min-height: 48px; padding: 12px 0 4px; cursor: pointer; list-style: none; }
details.group > summary::-webkit-details-marker { display: none; }
details.group > summary h2 { margin: 0; flex: none; }
details.group > summary::after { content: ""; margin-left: auto; align-self: center; flex: none; width: 8px; height: 8px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-3px); transition: transform .15s; }
details.group[open] > summary::after { transform: rotate(-135deg) translate(-2px, 0); }
details.group > summary .sum { min-width: 0; color: var(--muted); font-family: var(--mono); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.group[open] > summary .sum { display: none; }
details.group > summary:hover h2 { color: var(--accent); }
h2 { font-family: var(--serif); font-size: 17px; font-weight: 600; margin: 0 0 8px; }
.row { margin: 10px 0 12px; }
.row label, .lab { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; color: var(--ink-2); }
.row output { color: var(--ink); font-family: var(--mono); font-size: 13px; font-weight: 500; }
.hint { font-size: 13px; color: var(--muted); margin: 2px 0 0; }

input[type=range] { width: 100%; height: 32px; margin: 0; accent-color: var(--accent); cursor: pointer; }
input[type=text] { font-size: 16px; width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
button.btn { min-height: 44px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; font-family: var(--mono); font-size: 13.5px; }
button.btn:hover { border-color: var(--accent); }
button.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.btn:disabled { opacity: .5; cursor: not-allowed; }
button.link { background: none; border: 0; padding: 6px 4px; color: var(--accent); cursor: pointer; text-decoration: underline; min-height: 36px; }
.status { font-size: 14px; color: var(--ink-2); min-height: 1.45em; margin-top: 8px; }
.warn { color: var(--warn); }

.switch { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-size: 14px; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); }

/* Wind: a speed slider and a dial for where it comes from */
.wind { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; }
.dial { width: 84px; height: 84px; touch-action: none; cursor: grab; border-radius: 50%; }
.dial svg { width: 100%; height: 100%; display: block; }
.dial .rim { fill: var(--surface); stroke: var(--line-2); stroke-width: 1.5; }
.dial .tick { stroke: var(--muted); stroke-width: 1.5; }
.dial text { fill: var(--muted); font-size: 11px; font-weight: 600; text-anchor: middle; dominant-baseline: central; }
.dial .needle { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; fill: none; }
.dial .head { fill: var(--ink); }
.dial.calm svg { opacity: .45; }
.dial-cap { text-align: center; font-size: 13px; color: var(--ink-2); margin-top: 2px; }

/* Legend (on the map, always light like the map under it) and results */
.legend-box { background: rgba(255,255,255,.95); color: #1d1e23; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.2); font-size: 13px;
              --s-route: #a58d12; --s-straight: #5a4fd6; --s-curve: #12a599; --s-hit: #b8263a; --steep: #9a9ca5; --ink: #1d1e23; --route: #a58d12; --ring: #1d1e23; }
/* over satellite imagery the map draws mid-tone steps with solid outlines; the key shows the same colours */
.legend-box.on-img { --s-straight: #8a7af7; --s-curve: #0fa593; --s-hit: #f2526c; --route: #b08f10; }
.legend-box summary { cursor: pointer; padding: 0 12px; min-height: 40px; display: flex; align-items: center; font-weight: 600; list-style-position: inside; }
.legend-box[open] summary { min-height: 32px; }
.legend { list-style: none; margin: 0; padding: 0 10px 8px; display: grid; gap: 5px; line-height: 1.3; }
.legend .hint { color: #5d5c57; font-size: 12.5px; margin: 2px 0 0; }
.legend li { display: flex; align-items: center; gap: 8px; }
.key { width: 22px; height: 14px; border-radius: 3px; flex: none; }
.k-straight { background: color-mix(in srgb, var(--s-straight) 55%, transparent); box-shadow: inset 0 0 0 2px var(--s-straight); }
.k-curve { background: repeating-linear-gradient(135deg, var(--s-curve) 0 3px, color-mix(in srgb, var(--s-curve) 45%, transparent) 3px 6px); box-shadow: inset 0 0 0 2px var(--s-curve); }
.k-steep { background: var(--steep); opacity: .55; }
.k-hit { height: 4px; border-radius: 2px; background: var(--s-hit); }
.k-line { height: 0; border-top: 3px solid var(--ink); border-radius: 0; }
.k-contour { height: 0; border-top: 2px solid rgb(122,82,40); border-radius: 0; }
/* the wind on the map: same light card as the key, since both base maps are light */
.wind-box { display: flex; align-items: center; gap: 6px; padding: 5px 10px 5px 6px; min-height: 36px; background: rgba(255,255,255,.95);
            color: #1d1f21; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.2); font-size: 13px; white-space: nowrap; }
.wind-box .wind-arrow { flex: none; color: #6459d3; transition: transform .15s ease; }
.wind-box.calm .wind-arrow { visibility: hidden; width: 0; }
.wind-box b { font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .wind-box .wind-arrow { transition: none; } }
dl.stats { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 6px 0 0; font-size: 14px; }
dl.stats dt { color: var(--ink-2); }
dl.stats dd { margin: 0; text-align: right; font-family: var(--mono); font-size: 13px; }
dl.stats .gain { color: var(--ink); }

/* Offline areas */
#areas { list-style: none; margin: 10px 0 0; padding: 0; }
#areas li { display: flex; align-items: center; gap: 6px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
#areas li:first-child { border-top: 0; }
#areas .nm { flex: 1; min-width: 0; }
#areas .nm span { display: block; color: var(--muted); font-size: 13px; }
.meter { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 12px 0 4px; }
.meter > div { height: 100%; width: 0; background: var(--accent); }
.note { font-size: 13px; color: var(--muted); margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
.note a { color: inherit; }

/* Cross-section strip under the map */
.prof-head { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; padding: 10px 16px 0; }
.prof-head h2 { margin: 0; }
.prof-what { color: var(--ink-2); font-size: 14px; }
.prof-keys { margin-left: auto; display: flex; gap: 14px; font-size: 13px; color: var(--ink-2); }
.prof-keys span { display: inline-flex; align-items: center; gap: 6px; }
.prof-keys i { display: inline-block; width: 18px; height: 0; border-top: 2.5px solid var(--s-straight); }
.prof-keys i.m { border-top: 2px dashed var(--s-straight); opacity: .6; }
.prof-keys i.t { height: 10px; border: 1px solid var(--terrain-edge); background: var(--terrain); }
.prof-body { position: relative; min-width: 0; }
#profile { position: absolute; inset: 4px 0 6px 0; width: 100%; height: calc(100% - 10px); cursor: crosshair; touch-action: pan-y; }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px;
       padding: 6px 9px; font-size: 13px; line-height: 1.35; box-shadow: 0 2px 8px rgba(0,0,0,.12); white-space: nowrap; color: var(--ink); }
.tip b { font-weight: 600; }
.prof-side { padding: 6px 16px 10px 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; }

/* Leaflet bits that should follow the page's look */
.leaflet-container { font: inherit; }
.leaflet-control-layers, .leaflet-bar a { color: #1d1e23; }
.leaflet-bar a.locate { display: grid; place-items: center; }
.leaflet-touch .leaflet-bar a { width: 40px; height: 40px; line-height: 40px; }

@media (max-width: 820px), (max-height: 520px) {
  #app { display: block; height: auto; }
  #head { border-right: 0; padding-bottom: 12px; }
  #map { height: 56vh; height: 56svh; min-height: 300px; }
  #prof { grid-template-rows: auto 160px; border-bottom: 1px solid var(--line); }
  #panel { border-right: 0; overflow: visible; }
  #app.panel-off #head, #app.panel-off #panel { display: block; } /* nothing to hide on a phone: the panel is under the map */
  .show-panel-bar { display: none; }
  .prof-keys { margin-left: 0; width: 100%; }
  .prof-side { padding: 4px 10px 8px 4px; }
  input[type=range] { height: 44px; }
  .legend-box { font-size: 12.5px; }
}
@media (pointer: coarse) { input[type=range] { height: 44px; } .dial { width: 92px; height: 92px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (forced-colors: active) { .key, .prof-keys i { forced-color-adjust: none; } }

/* Units switch (m / ft) */
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.seg button { min-width: 44px; min-height: 40px; padding: 0 10px; border: 0; background: transparent; cursor: pointer; font-family: var(--mono); font-size: 13.5px; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.title .seg { margin-left: auto; flex: none; }
.title { flex-wrap: wrap; row-gap: 8px; }
.title .icon-btn { margin-left: 0; }

/* Map key additions */
.k-out { background: rgba(110,108,100,.2); border: 1px solid #d3d1c9; }
.k-ring { height: 0; border-top: 2px dashed var(--ring); border-radius: 0; }
.k-route { height: 5px; border-radius: 3px; background: var(--route); box-shadow: 0 0 0 1.5px #fff, 0 0 0 2.5px rgba(0,0,0,.25); }

/* 3D: MapLibre in a layer inside the 2D map, over its tiles (panes are z 400–700) and under its controls (1000) */
.leaflet-container .map3d { position: absolute; inset: 0; z-index: 900; background: #dfe8f1; } /* over maplibre-gl.css's relative */
.map3d[hidden] { display: none; }
.is-3d .leaflet-control-zoom, .is-3d .leaflet-control-scale, .is-3d .leaflet-control-attribution,
.is-3d .leaflet-control-layers-separator, .is-3d .leaflet-control-layers-overlays, .is-3d #keyContour { display: none !important; }
.leaflet-bar a.view3d { font-weight: 700; font-size: 14px; line-height: 40px; width: 40px; height: 40px; text-align: center; }
.hint3d { position: absolute; z-index: 2; top: 12px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 140px);
  padding: 6px 12px; border-radius: 8px; background: rgba(29,31,33,.82); color: #fff; font-size: 13px; text-align: center;
  pointer-events: none; transition: opacity .6s; }
.hint3d.gone { opacity: 0; }
.map3d .maplibregl-ctrl-bottom-right { bottom: 4px; }

/* Fly it: follows the glide in 3D; a readout and Stop sit on the map while it flies */
button.btn.sm { min-height: 36px; padding: 4px 12px; font-size: 13px; }
button.btn.fly { display: inline-flex; align-items: center; gap: 6px; border-color: var(--accent); color: var(--accent); }
button.btn.fly:hover { background: var(--accent-soft); }
.fly-hud { position: absolute; z-index: 3; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px;
  max-width: calc(100% - 130px); padding: 6px 6px 6px 14px; border-radius: 10px; background: rgba(27,28,31,.85); color: #fff;
  font: 13px/1.3 var(--mono); }
.fly-hud span { min-width: 0; }
.fly-hud button { flex: none; min-height: 34px; padding: 4px 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,.35);
  background: transparent; color: #fff; font: inherit; cursor: pointer; }
.fly-hud button:hover { background: rgba(255,255,255,.12); }
.fly-glider { position: absolute; z-index: 2; left: 50%; top: 50%; width: 360px; height: 180px; margin: -90px 0 0 -180px; pointer-events: none; }
@media (max-width: 560px) { .fly-glider { width: 240px; height: 120px; margin: -60px 0 0 -120px; } }

/* Quick start: a guide in three steps, opened on a first visit and from the book in the header */
dialog.guide { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--line-2);
  border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: 0 2px 4px rgba(16,24,40,.06), 0 16px 40px rgba(16,24,40,.18);
  --ring: var(--ink); --route: var(--s-straight); }
dialog.guide::backdrop { background: rgba(16, 18, 24, .45); }
dialog.guide[open] { display: flex; flex-direction: column; }
.g-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 6px 20px; }
.g-head h2 { margin: 0; font-size: 21px; }
.g-head .icon-btn { margin-left: auto; }
.dots { display: flex; gap: 6px; }
.dots i { width: 18px; height: 3px; border-radius: 2px; background: var(--line-2); }
.dots i.on { background: var(--accent); }
.g-body { padding: 4px 20px 8px; overflow-y: auto; }
.g-body h3 { font-size: 16px; margin: 6px 0 6px; }
.g-body p { margin: 0 0 12px; color: var(--ink-2); line-height: 1.55; }
.g-lab { font-weight: 600; color: var(--ink) !important; margin: 14px 0 8px !important; }
.presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.presets button { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left; min-height: 64px; padding: 10px 12px;
  border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; }
.presets button b { font-weight: 600; font-size: 14px; }
.presets button span { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.presets button:hover { border-color: var(--accent); }
.presets button[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.g-key { list-style: none; margin: 4px 0 14px; padding: 0; display: grid; gap: 8px; font-size: 14px; }
.g-key li { display: flex; align-items: center; gap: 10px; }
.g-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.g-foot .spacer { flex: 1; }
.switch.sm { min-height: 36px; font-size: 13px; color: var(--ink-2); }
@media (max-width: 560px) { .presets { grid-template-columns: 1fr; } .presets button { min-height: 52px; } }
@media (max-width: 820px), (max-height: 520px) { .wide-only { display: none !important; } }

/* Planning workspace: neutral controls around the existing map palette. */
:root { --serif: var(--font); }
#app { grid-template-columns: 310px minmax(0, 1fr); grid-template-rows: auto minmax(220px, 1fr) auto auto;
  grid-template-areas: "head head" "panel map" "panel dest" "panel prof"; position: relative; }
#head { padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
.title { gap: 10px; flex-wrap: nowrap; }h1 { font-size: 16px; letter-spacing: -.3px; margin-right: 8px; }
#status { font-size: 11px; line-height: 1.35; margin: 3px 0 0; min-height: 15px; color: var(--muted); }
.calc-state { font-size: 11px; font-weight: 500; }
#app[data-calc=loading] .calc-state, #app[data-calc=updating] .calc-state { color: var(--warn); }
#app[data-calc=missing] .calc-state, #app[data-calc=partial] .calc-state { color: var(--warn); }
.plan-changed { font-size: 10px; color: var(--muted); margin-right: auto; }
.title .seg { margin-left: 0; }
.title .icon-btn { width: 34px; height: 34px; border-radius: 3px; }
.seg { border-radius: 3px; }.seg button { min-height: 32px; min-width: 62px; font: 11px var(--font); }
button.btn { border-radius: 3px; min-height: 36px; padding: 6px 10px; font: 12px var(--font); }
button.btn.sm { min-height: 32px; padding: 4px 8px; font: 11px var(--font); }
input[type=search], input[type=text], input[type=number], select { border: 1px solid var(--line-2); border-radius: 3px; background: var(--surface); color: var(--ink); font: 13px var(--font); min-height: 34px; padding: 5px 7px; max-width: 100%; min-width: 0; }
input[type=text] { font-size: 16px; }
input[type=number] { font: 12px var(--mono); }
#panel { padding: 0 12px 18px; min-height: 0; }
h2 { font: 600 13px var(--font); }
details.group > summary { min-height: 41px; padding: 11px 0 8px; }
details.group > summary .sum { font: 10px var(--mono); }
.row { margin: 8px 0 11px; }.row label { font-size: 12px; }.row output { font-size: 10px; color: var(--muted); }
.hint { font-size: 11px; line-height: 1.5; }.note { font-size: 11px; }
.input-pair { display: grid; grid-template-columns: minmax(0, 1fr) 76px; align-items: center; gap: 10px; margin-top: 4px; }
.input-pair input { width: 100%; }
.input-pair input[type=range] { min-width: 0; height: 34px; }
.row.changed > label::after { content: "*"; color: var(--accent); margin-left: 5px; }
.row.changed .input-pair input[type=number] { border-color: var(--accent); }
.row.changed > label output { margin-left: auto; }
.switch { font-size: 12px; }
.preset-label { display: flex; flex-direction: column; gap: 5px; font-size: 11px; margin-bottom: 8px; }.preset-label select { width: 100%; }
.save-row { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }.save-row input { flex: 1; width: 110px; min-width: 80px; font-size: 13px; }
.plans-group .btns select { flex: 1; min-width: 100px; font-size: 12px; }.plans-group .btns { gap: 5px; }
.coordinates { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 8px; margin-top: 10px; }.coordinates label { display: flex; flex-direction: column; gap: 4px; font-size: 10px; }.coordinates input { width: 100%; font-size: 11px; }.coordinates button { grid-column: 1 / -1; }
.direction-input { font-size: 10px; display: flex; align-items: center; gap: 4px; }.direction-input input { width: 62px; font-size: 11px; }
.dial { width: 74px; height: 74px; }.wind { gap: 10px; }
.map-tools { grid-area: map; z-index: 1100; align-self: start; justify-self: center; margin: 10px 75px 0; display: flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 0; background: var(--surface); border: 1px solid var(--line-2); border-radius: 3px; }
.map-tools button { min-height: 36px; padding: 5px 10px; background: transparent; color: var(--ink-2); border: 0; border-right: 1px solid var(--line); cursor: pointer; font: 12px var(--font); }
.map-tools button[aria-pressed=true] { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 -2px var(--accent); }.map-tools button:last-of-type { border-right: 0; }.map-tools button:disabled { opacity: .4; cursor: default; }
#resultNotice:empty { display: none; }#resultNotice { width: 100%; text-align: center; padding: 3px 6px; border-top: 1px solid var(--line); font-size: 10px; color: var(--warn); }
.launch-pin { background: var(--surface); border: 2px solid var(--accent); color: var(--accent); width: 28px; height: 28px; display: grid; place-items: center; font: 600 13px var(--font); border-radius: 2px; box-shadow: 0 0 0 2px var(--surface); }
#app[data-map-mode=launch] #map { cursor: crosshair; }
.destination { grid-area: dest; min-width: 0; border-top: 1px solid var(--line); background: var(--surface); padding: 8px 14px; }
.destination-head { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 12px; }.destination-head h2 { margin: 0; font-size: 11px; color: var(--muted); font-weight: 400; }.destination-head strong { font-size: 12px; font-weight: 600; }#destCoords { font: 10px var(--mono); color: var(--muted); }.destination-head button { margin-left: auto; }
.destination-stats { display: flex; flex-wrap: wrap; gap: 5px 18px; margin: 5px 0 0; }.destination-stats > div { display: flex; align-items: baseline; gap: 5px; }.destination-stats dt { font-size: 10px; color: var(--muted); }.destination-stats dd { font: 11px var(--mono); margin: 0; }
#destReason { font-size: 10px; color: var(--muted); margin: 5px 0 0; }.destination.pending dl { opacity: .45; }
#prof { grid-template-rows: auto 155px; min-width: 0; }.prof-head { padding: 6px 12px 0; gap: 4px 12px; }
#profileToggle { border: 0; background: none; color: var(--ink); padding: 4px 0; cursor: pointer; font: 600 12px var(--font); min-height: 32px; }#profileToggle span { margin-left: 6px; color: var(--muted); }
.prof-what { font-size: 11px; min-width: 0; }.prof-keys { font-size: 10px; gap: 9px; }.prof-keys i { width: 15px; }
.prof-side { padding: 4px 10px; }.prof-side .dial { width: 62px; height: 62px; }.dial-cap { font-size: 10px; }
.bearing-input { display: flex; align-items: center; gap: 4px; font-size: 10px; margin-left: auto; }.bearing-input input { width: 64px; min-height: 30px; font-size: 11px; }
#profBack { font-size: 11px; }#btnFly { font-size: 11px; }
#app.profile-off #prof { grid-template-rows: auto; }#app.profile-off .prof-body, #app.profile-off .prof-side, #app.profile-off .prof-keys { display: none; }
#prof.stale .prof-body { opacity: .45; }
#profile { outline: none; }.tip { border-radius: 3px; box-shadow: none; font-size: 11px; }
.legend-box { border-radius: 3px; box-shadow: none; font-size: 11px; max-width: 270px; }.legend-box summary { font-size: 11px; }.legend { gap: 5px; }.legend-extra { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 6px; }.legend-extra summary { font-weight: 400; }
.wind-box { border-radius: 3px; box-shadow: none; border: 1px solid var(--line-2); font-size: 12px; }
.leaflet-bar { box-shadow: none; border: 1px solid var(--line-2); border-radius: 3px; }.leaflet-control-layers { border-radius: 3px; box-shadow: none; }
dl.stats { font-size: 11px; gap: 6px 10px; }dl.stats dd { font-size: 10px; }
.note { margin-top: 12px; }
.area-state { font-size: 10px; color: var(--muted); display: block; }.area-incomplete { color: var(--warn); }
#areas { font-size: 12px; }#areas li { gap: 5px; padding: 8px 0; }#areas .nm span { font-size: 10px; }
.drawer-head, .settings-toggle { display: none; }
#app.panel-off { grid-template-columns: 0 minmax(0, 1fr); }#app.panel-off #head { display: block; }#app.panel-off #panel { display: none; }
.guide { font-family: var(--font); }dialog.guide { border-radius: 4px; }.presets button { border-radius: 3px; }.guide .icon-btn { border-radius: 3px; }

@media (max-width: 820px), (max-height: 520px) {
  html, body { height: 100%; overflow: hidden; }
  #app, #app.panel-off { height: 100vh; height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(150px, 1fr) auto auto auto; grid-template-areas: "head" "map" "dest" "prof" "drawer"; }
  #head, #app.panel-off #head { display: block; padding: 7px 10px 4px; }.title { flex-wrap: wrap; gap: 5px 8px; }.title h1 { font-size: 15px; margin-right: auto; }
  .title .seg { order: 6; }.title .seg button { min-height: 30px; min-width: 61px; }.title .icon-btn { width: 34px; height: 34px; }
  .calc-state { order: 7; margin-left: auto; font-size: 10px; }.plan-changed { display: none; }#sharePlan { font-size: 10px; min-height: 32px; }
  #status { font-size: 10px; min-height: 13px; }.title .chip { font-size: 10px; padding: 2px 4px; }
  #map { min-height: 150px; height: auto; }
  .map-tools { margin: 9px 55px 0; width: max-content; max-width: calc(100% - 110px); }.map-tools button { min-height: 40px; padding: 5px 8px; font-size: 11px; }.map-tools #undoLaunch { display: none; }.map-tools.has-history #undoLaunch { display: block; flex-basis: 100%; border-top: 1px solid var(--line); }
  .destination { padding: 7px 10px; max-height: 155px; overflow: auto; }.destination-head { gap: 4px 8px; }.destination-head h2 { display: none; }#destCoords { display: none; }.destination-head strong { font-size: 11px; }.destination-stats { gap: 5px 10px; }.destination-stats dt, #destReason { font-size: 9px; }.destination-stats dd { font-size: 10px; }
  #prof { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 135px; border-bottom: 0; }.prof-head { padding: 4px 10px; gap: 4px 10px; }.prof-head h2 { margin: 0; }.prof-what { width: 100%; order: 5; font-size: 10px; }.prof-keys { width: 100%; order: 6; font-size: 9px; }.prof-side { display: none; }
  .bearing-input { margin-left: auto; }.bearing-input input { font-size: 16px; width: 65px; }#btnFly { min-height: 36px; }
  .prof-body { grid-column: 1; }
  #app.profile-off #prof { grid-template-rows: auto; }#app.profile-off .prof-what { max-height: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .settings-toggle { grid-area: drawer; display: flex; align-items: center; gap: 8px; min-height: 54px; padding: 9px 12px calc(9px + env(safe-area-inset-bottom)); background: var(--surface); color: var(--ink); border: 0; border-top: 1px solid var(--line-2); cursor: pointer; text-align: left; font: 12px var(--font); }.settings-toggle b { font-weight: 600; }.settings-toggle > span:last-child { margin-left: auto; }#settingsSummary { font: 10px var(--mono); color: var(--muted); }
  #panel, #app.panel-off #panel { display: none; position: absolute; z-index: 1300; left: 0; right: 0; bottom: calc(54px + env(safe-area-inset-bottom)); max-height: 47dvh; overflow-y: auto; overscroll-behavior: contain; border: 0; border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); background: var(--surface); padding: 0 12px 18px; }
  #app.drawer-open #panel { display: block; }#app.drawer-full #panel { max-height: calc(100dvh - 150px); }
  .drawer-head { display: flex; position: sticky; top: 0; align-items: center; gap: 8px; background: var(--surface); z-index: 2; min-height: 47px; border-bottom: 1px solid var(--line); }.drawer-head h2 { margin: 0 auto 0 0; }.drawer-head button { min-height: 36px; }
  .show-panel-bar { display: none; }.wide-only { display: none !important; }
  input[type=search], input[type=text], input[type=number], select { font-size: 16px; min-height: 40px; }.input-pair { grid-template-columns: minmax(0, 1fr) 86px; }.input-pair input[type=range] { height: 44px; }.input-pair input[type=number] { font-size: 16px; }.direction-input input { width: 72px; font-size: 16px; }
  button.btn { min-height: 40px; }.coordinates input { font-size: 16px; }.preset-label select { font-size: 16px; }.save-row input { font-size: 16px; }.save-row button { min-height: 40px; }
  details.group > summary { min-height: 44px; }.row label { font-size: 13px; }.hint, .switch { font-size: 12px; }.legend-box { font-size: 10px; max-width: 245px; }.legend-box summary { font-size: 12px; }
  .wind-box { font-size: 11px; min-height: 30px; padding: 4px 6px; }.wind-box .wind-arrow { width: 17px; height: 17px; }
  .leaflet-touch .leaflet-bar a { width: 40px; height: 40px; }
}

.terrain-detail { width: 100%; text-align: center; font: 9px var(--font); color: var(--muted); padding: 3px 6px; border-top: 1px solid var(--line); }
.terrain-detail:empty { display: none; }
.legend-content { padding: 4px 10px 9px; }
#profBack { display: none; }
#shareLink { width: 100%; }

.input-pair input[type=number] { appearance: textfield; -moz-appearance: textfield; }
.input-pair input::-webkit-inner-spin-button, .input-pair input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.launch-pin { width: 40px; height: 40px; background: none; border: 0; box-shadow: none; }
.launch-pin > span { display: grid; place-items: center; width: 28px; height: 28px; background: var(--surface); border: 2px solid var(--accent); border-radius: 2px; box-shadow: 0 0 0 2px var(--surface); }
#prof.has-route .prof-side { display: none; }
.bearing-input input:disabled { color: var(--muted); border-color: var(--line); }
.destination-head strong { font-size: 13px; }
.destination-stats dt, #destReason { font-size: 11px; }.destination-stats dd { font-size: 12px; }
@media (max-width: 820px), (max-height: 520px) {
  .title .icon-btn { width: 40px; height: 40px; }.title .seg button, #sharePlan, button.btn.sm, #profileToggle { min-height: 40px; }
  .legend-box summary, .legend-box[open] summary { min-height: 40px; }
  .destination-head strong { font-size: 12px; }.destination-stats dt, #destReason { font-size: 10px; }.destination-stats dd { font-size: 11px; }
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.launch-coords { margin: 7px 0; }.launch-coords > summary { cursor: pointer; color: var(--muted); font-size: 11px; min-height: 32px; display: flex; align-items: center; gap: 6px; }
.launch-coords > summary::before { content: "+"; }.launch-coords[open] > summary::before { content: "−"; }
.launch-coords > summary::-webkit-details-marker { display: none; }
@media (max-width: 820px), (max-height: 520px) {
  .launch-coords > summary { min-height: 40px; font-size: 12px; }
  #app.profile-off #prof.has-route .prof-what { display: none; }
}

@media (max-height: 640px) {
  #app, #app.panel-off { grid-template-rows: auto minmax(80px, 1fr) auto auto auto; }
  #map { min-height: 80px; }
  #prof { grid-template-rows: auto 100px; }
  .destination { max-height: 100px; }
}
@media (max-height: 520px) and (min-width: 650px) {
  /* A phone turned sideways puts the profile beside the map instead of pushing the drawer off-screen. */
  #app:not(.profile-off), #app.panel-off:not(.profile-off), #app:has(#destination:not([hidden])) {
    grid-template-columns: minmax(0, 1fr) 320px;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "head head" "map dest" "map prof" "drawer drawer";
  }
  .destination { max-height: 100%; min-height: 0; }
  #prof { grid-template-rows: auto 70px; }
  .prof-what { display: none; }
  .prof-head { gap: 3px 8px; }.prof-keys { font-size: 8px; gap: 6px; }
  #app.profile-off .prof-keys { display: none; }
}
@media (max-height: 520px) and (max-width: 649px) {
  #prof { grid-template-rows: auto 50px; }.prof-what { display: none; }
  .destination { max-height: 80px; }
  .settings-toggle { min-height: 46px; }
  #panel, #app.panel-off #panel { bottom: 46px; }
}

.status-line { display: flex; align-items: center; gap: 10px; }.status-line #status { flex: 1; }.status-line button.btn.sm { min-height: 28px; padding: 2px 8px; }

/* DynaSoar: one small landmark illustration; the map remains the workspace. */
.brand { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.brand img { width: 54px; height: 44px; object-fit: contain; }
.guide-brand { display: flex; align-items: center; justify-content: center; gap: 15px; margin: -6px 0 12px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.guide-brand img { object-fit: contain; max-width: 45%; }.guide-brand b { font-size: 23px; font-weight: 600; }.guide-brand p { margin: 5px 0 0; font-size: 13px; }
.profile-views { display: flex; gap: 10px; align-items: center; }
.profile-views button { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); font: 11px var(--font); min-height: 34px; padding: 4px 0; cursor: pointer; }
.profile-views button[aria-pressed=true] { border-bottom-color: var(--accent); color: var(--accent); }
#prof[data-view=soaring] .prof-side, #prof[data-view=soaring] .prof-keys, #prof[data-view=soaring] .bearing-input, #prof[data-view=soaring] #btnFly { display: none; }
.wind-fetch { display: flex; gap: 6px; margin: 9px 0 6px; }
#windSource { line-height: 1.65; }#windSource a { color: var(--accent); }
.ds-caveat { border-left: 2px solid var(--line-2); padding-left: 8px; margin: 10px 0; }
.ds-method > summary { min-height: 36px; font-size: 11px; cursor: pointer; color: var(--muted); display: flex; align-items: center; }
.ds-method > summary::after { content: "+"; margin-left: auto; }.ds-method[open] > summary::after { content: "−"; }.ds-method > summary::-webkit-details-marker { display: none; }
.ds-method p { margin: 6px 0; }
.ds-candidates { list-style: none; padding: 0; margin: 8px 0; }
.ds-candidate { display: block; width: 100%; text-align: left; padding: 8px 0 8px 7px; min-height: 44px; background: none; color: var(--ink); border: 0; border-top: 1px solid var(--line); border-left: 2px solid transparent; cursor: pointer; font: 11px var(--font); }
.ds-candidate b { display: block; font-size: 12px; font-weight: 500; margin-bottom: 3px; }.ds-candidate span { color: var(--muted); font-size: 10px; }
.ds-candidate[aria-pressed=true] { border-left-color: var(--accent); background: var(--accent-soft); }
.ds-pin { display: grid; place-items: center; color: var(--ink); }.ds-pin > span { white-space: nowrap; background: var(--surface); border: 1px dashed var(--ink); padding: 3px 5px; font: 600 10px var(--font); border-radius: 2px; box-shadow: 0 0 0 2px var(--surface); }
.ds-pin.selected > span { border-style: solid; }.k-ds { background: #fff; color: #1d1e23; border: 1px dashed currentColor; width: 22px; height: 16px; display: grid; place-items: center; font: 8px var(--font); }
@media (max-width: 820px), (max-height: 520px) {
  .brand { gap: 4px; }.brand img { width: 32px; height: 36px; }
  .profile-views { width: 100%; order: -1; gap: 15px; }.profile-views button { min-height: 40px; font-size: 12px; }
  .ds-method > summary { min-height: 40px; font-size: 12px; }
  .ds-candidate { min-height: 48px; }.ds-candidate span { font-size: 11px; }
}
.ds-3d-pin { width: 54px; height: 40px; border: 0; background: transparent; padding: 0; cursor: pointer; }
.flow-settings { display: grid; grid-template-columns: 90px 1fr; gap: 8px; margin: 7px 0; }
.flow-settings label { display: flex; flex-direction: column; gap: 4px; font-size: 10px; color: var(--muted); }.flow-settings input,.flow-settings select { width: 100%; font-size: 12px; }
#flowStatus { margin: 6px 0; }.wind-vector { pointer-events: none; display: grid; place-items: center; color: var(--ink); text-shadow: 1px 0 var(--surface),-1px 0 var(--surface),0 1px var(--surface),0 -1px var(--surface); font: 24px var(--font); }.wind-vector span { display: block; }
@media (max-width: 820px), (max-height: 520px) { .flow-settings label { font-size: 12px; }.flow-settings input,.flow-settings select { font-size: 16px; } }
.wind-text small { display: block; font-size: 9px; font-weight: 400; color: inherit; opacity: .75; line-height: 1.25; }
.wind-vector { text-shadow: none; }.wind-vector svg { width: 18px; height: 18px; overflow: visible; fill: none; stroke: var(--ink); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }.wind-vector .wind-casing { stroke: var(--surface); stroke-width: 3.5; }

/* Heading controls stay visible in both the flat and tilted map. */
.map-orientation { background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); border-radius: 3px; font: 11px var(--font); }
.map-turn { display: flex; align-items: center; }
.map-orientation button { color: var(--ink); background: none; border: 0; cursor: pointer; min-height: 40px; min-width: 40px; font: inherit; }
.map-turn > button { font-size: 22px; }
.map-turn label { display: flex; align-items: center; gap: 3px; }
.map-turn input { width: 48px; min-height: 40px; padding: 2px; color: var(--ink); background: transparent; border: 0; font: 16px var(--font); appearance: textfield; }
.map-turn input::-webkit-inner-spin-button { appearance: none; }
.map-facing { display: flex; border-top: 1px solid var(--line); }
#mapNorth { flex: 1; }
#mapTilt { border-left: 1px solid var(--line); font-weight: 600; }
#mapNorth span { display: inline-block; margin-right: 5px; }
.ridge-label { display: grid; place-items: center; pointer-events: none; }
.ridge-label span { background: var(--surface); color: var(--ink); padding: 3px 6px; border: 1px solid var(--line-2); font: 600 11px var(--font); white-space: nowrap; }
.ds-3d-pin { width: 76px; }
.ds-pin.selected > span { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.wind-advanced { border-top: 1px solid var(--line); margin-top: 8px; }
.wind-advanced .hint { font-size: 11px; }
@media (max-width: 820px), (max-height: 520px) {
  .map-orientation { margin-top: 6px !important; }
  .map-turn label { font-size: 10px; }
}

.ds-pin > span { min-width: 20px; text-align: center; }

.ridge-label { z-index: 2; }
.ds-pin.selected { z-index: 3; }

.city-search { margin: 12px 0; }
.city-search label { display: block; font-weight: 600; margin-bottom: 5px; }
.city-results { padding: 0; margin: 4px 0; list-style: none; }
.city-results button { width: 100%; min-height: 40px; padding: 8px; text-align: left; background: var(--surface-2); border: 1px solid var(--line); cursor: pointer; }
.city-results button:hover { border-color: var(--accent); }

.city-search input[type=search] { font-size: 16px; }

/* Local aircraft records stay separate from the planning controls and simulated route. */
.flight-file { display: block; margin: 12px 0; font-size: 13px; color: var(--ink-2); }
.flight-file input { display: block; max-width: 100%; margin-top: 6px; font-size: 13px; }
.aircraft-flight .btns { flex-wrap: wrap; }
.aircraft-flight > details { margin: 12px 0; }
.aircraft-flight summary { cursor: pointer; }
#aircraftReplay { display: grid; gap: 6px; font-size: 13px; margin: 12px 0; }
#aircraftSample { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.aircraft-photos, .aircraft-events { padding-left: 18px; font-size: 12px; overflow-wrap: anywhere; max-height: 350px; overflow-y: auto; }
.aircraft-photos li { margin: 8px 0; }
.aircraft-photo { display: block; max-width: 100%; max-height: 240px; object-fit: contain; }
.aircraft-photo-detail { padding: 8px; border: 1px solid var(--line); border-radius: 6px; margin-top: 6px; }

.aircraft-origin { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
