/* Razorback Maps: the map page, laid out and coloured as the Android app
   (NativeUi, MapControls, NativeSheet, PlannerUi, LayersUi). Sizes are the
   app's dp as CSS pixels. */
:root {
  --paper: rgb(250 250 245); --ink: rgb(35 61 52); --muted: rgb(101 115 105); --orange: rgb(232 121 68);
  --line: rgb(214 221 210); --surface: #fff; --chip: rgb(236 240 232); --glass: rgb(255 255 255 / 92%);
  --on-ink: #fff; --link: rgb(196 104 46); --hint: rgb(132 142 136); --detail: rgb(120 132 124); --grip: #8a9691;
  --ripple: rgb(35 61 52 / 16%);
  --font: Roboto, system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --top: max(10px, env(safe-area-inset-top));
  --shadow-2: 0 1px 2px rgb(0 0 0 / 22%), 0 1px 3px rgb(0 0 0 / 12%);
  --shadow-8: 0 -2px 10px rgb(0 0 0 / 14%), 0 -1px 3px rgb(0 0 0 / 10%);
  --shadow-12: 0 6px 24px rgb(0 0 0 / 20%), 0 2px 6px rgb(0 0 0 / 12%);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: rgb(27 31 29); --ink: rgb(226 233 228); --muted: rgb(152 165 157); --line: rgb(64 73 68); --surface: rgb(41 47 44);
    --chip: rgb(48 56 52); --glass: rgb(30 35 33 / 92%); --on-ink: rgb(22 26 24); --link: rgb(238 146 98); --hint: rgb(128 140 133);
    --detail: rgb(150 162 155); --ripple: rgb(255 255 255 / 20%); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { font-family: var(--font); color: var(--ink); background: #1b2420; font-size: 13px; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
#map { position: fixed; inset: 0; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg .fill { fill: currentColor; stroke: none; }
button { font: inherit; color: inherit; }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { display: inline-flex; }
.map-status { position: fixed; inset: 0; margin: 0; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 24px; text-align: center; color: #e2e9e4; font-size: 15px; z-index: 1; pointer-events: none; }

/* Loading: a thin bar while tiles arrive. */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 30; pointer-events: none; overflow: hidden; opacity: 0; transition: opacity .3s; }
.progress::before { content: ""; position: absolute; inset: 0; width: 40%; background: linear-gradient(90deg, transparent, var(--orange), transparent); animation: slide 1.1s ease-in-out infinite; }
body.loading .progress { opacity: 1; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* ---- Map chrome (MapControls / MainActivity) ---- */
.tile, .launcher, .perspective { position: fixed; z-index: 8; border: 0; padding: 0; background: var(--surface); box-shadow: var(--shadow-2); color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.tile { border-radius: 8px; }
.tile:active, .launcher:active { background-image: linear-gradient(var(--ripple), var(--ripple)); }
.launcher { left: 10px; top: var(--top); width: 44px; height: 44px; border-radius: 10px; overflow: hidden; }
.launcher img { width: 100%; height: 100%; object-fit: cover; display: block; }
.locate { left: 10px; top: calc(var(--top) + 52px); width: 44px; height: 44px; }
.locate.on { color: var(--orange); }
.perspective { right: 54px; top: var(--top); height: 34px; border-radius: 10px; padding: 3px; display: flex; gap: 0; cursor: default; }
.perspective button { width: 38px; height: 100%; border: 0; border-radius: 8px; background: transparent; font-size: 12px; cursor: pointer; color: var(--ink); }
.perspective button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.compass { right: 10px; top: var(--top); width: 34px; height: 34px; }
.compass svg { transition: transform .08s linear; }
.compass .n { fill: var(--ink); stroke: none; }
.compass .s { fill: #9aa49f; stroke: none; }
.layers { right: 10px; top: calc(var(--top) + 42px); width: 34px; height: 34px; }
.layers svg { stroke-width: 1.8; }

/* Notes over the map (status, drawing hints). */
.notes { position: fixed; top: calc(var(--top) + 52px); left: 50%; transform: translateX(-50%); z-index: 20; display: grid; gap: 4px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 140px); }
.toast { padding: 6px 12px; border-radius: 10px; background: var(--glass); color: var(--ink); font-size: 12px; box-shadow: var(--shadow-2); text-align: center; }

/* ---- Buttons (NativeUi.button: 7 dp corners, 1 dp border) ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); font-size: 13px; cursor: pointer; text-decoration: none; text-align: center; line-height: 1.15; }
.btn:active { background-image: linear-gradient(var(--ripple), var(--ripple)); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.danger { color: rgb(186 99 53); }
.link { border: 0; background: none; color: var(--link); font-size: 13px; padding: 0 14px 0 0; min-height: 36px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.icon-button { width: 40px; height: 40px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--muted); font-size: 18px; flex: none; }

/* ---- The routes drawer (PlannerUi.showRoutes) ---- */
.drawer-cover { position: fixed; inset: 0; z-index: 25; pointer-events: none; }
.drawer-cover .drawer { pointer-events: auto; }
.drawer { position: absolute; left: 10px; top: var(--top); bottom: 10px; width: min(300px, calc(100vw - 64px)); display: flex; flex-direction: column; padding: 4px 14px 10px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-12); overflow: hidden; }
.search { display: flex; align-items: center; gap: 4px; padding: 8px 0 2px; position: relative; }
.search .field { position: relative; flex: 1; height: 40px; }
.search input { width: 100%; height: 100%; padding: 0 34px 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--chip); color: var(--ink); font: inherit; font-size: 14px; outline: none; -webkit-appearance: none; appearance: none; }
.search input::placeholder { color: var(--hint); }
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus { border-color: var(--ink); }
.search-clear { position: absolute; right: 4px; top: 4px; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 13px; cursor: pointer; }
.search .close { width: 40px; height: 40px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; }
.drawer-body { flex: 1; overflow: auto; margin: 0 -14px; padding: 0 14px; overscroll-behavior: contain; }
.drawer h2 { font-size: 17px; font-weight: 700; margin: 10px 0 6px; }
.drawer-body .btn.block { width: 100%; min-height: 38px; margin-bottom: 6px; }
.drawer-offline { margin-top: 8px; min-height: 40px; flex: none; }
.drawer-home { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--muted); text-decoration: none; font-size: 12px; }
.drawer-home img { border-radius: 5px; }
.route-card { padding: 10px 0 2px; border-bottom: 1px solid var(--line); margin-bottom: 0; }
.route-card .head > div { min-width: 0; }
.route-card .head { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.route-card canvas { width: 50px; height: 42px; border-radius: 8px; background: var(--chip); border: 1px solid var(--line); flex: none; }
.route-card b { font-size: 13.5px; display: block; overflow-wrap: anywhere; }
.route-card small { font-size: 11.5px; color: var(--detail); }
.route-card .actions { display: flex; padding-top: 2px; }
.empty { color: var(--muted); padding: 12px 0; line-height: 1.45; }
.results { list-style: none; margin: 4px 0 0; padding: 0; }
.results li.none { padding: 12px 2px; color: var(--muted); }
.results button { display: grid; width: 100%; padding: 8px 2px; border: 0; background: transparent; text-align: left; cursor: pointer; border-radius: 6px; }
.results [aria-selected="true"] button, .results button:hover { background: var(--chip); }
.results b { font-size: 14px; font-weight: 600; }
.results small { font-size: 12px; color: var(--detail); }

/* ---- Layers (LayersUi): a card under the layers button ---- */
.layers-panel { position: fixed; z-index: 24; right: 10px; top: calc(var(--top) + 42px); width: min(296px, calc(100vw - 82px)); overflow: auto; padding: 0 14px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-12); overscroll-behavior: contain; max-height: calc(100vh - var(--top) - 58px); }
.layers-panel .heading { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--paper); padding-top: 4px; z-index: 1; }
.layers-panel h2 { font-size: 19px; font-weight: 700; margin: 8px 0; }
.layers-panel h3 { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; }
.bases { display: grid; gap: 6px; }
.base { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; font-size: 14px; text-align: left; color: var(--ink); }
.base[aria-pressed="true"] { border: 2px solid var(--ink); padding: 0 9px; font-weight: 700; }
.swatch { width: 26px; height: 26px; border-radius: 6px; flex: none; }
.swatch-aerial { background: linear-gradient(140deg, #3d5b3a, #6b7c55 40%, #a8a596 60%, #e8eef0 75%, #5d7488); }
.swatch-topo { background: repeating-radial-gradient(circle at 30% 60%, #f3efe2 0 4px, #d9b98a 4px 5px), #f3efe2; }
.check { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 42px; cursor: pointer; font-size: 14px; border-radius: 6px; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); margin: 0 2px 0 0; flex: none; cursor: pointer; }
.check.disabled { opacity: .45; cursor: default; }
.check .key { display: inline-block; width: 18px; height: 0; border-top: 2.5px dashed #c79a3b; vertical-align: middle; margin-right: 8px; }
.check .key.huts { width: 10px; height: 10px; border: 1.5px solid #233d34; border-radius: 50%; background: #f6db94; }
.check .key.te-araroa { border-top: 3px solid #ef3b5d; border-radius: 2px; box-shadow: 0 0 0 1px rgb(40 10 16 / .5); }
.check .key.hunting { width: 14px; height: 10px; border: 1.5px dashed rgb(255 106 19); background: repeating-linear-gradient(-45deg, rgb(255 106 19 / 35%) 0 1.5px, transparent 1.5px 4px); }
.relief { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px; padding: 8px 0; font-size: 14px; }
.relief input { grid-column: 1 / -1; width: 100%; accent-color: var(--ink); }
.relief output { color: var(--muted); font-variant-numeric: tabular-nums; }
.layers-panel .note { color: var(--muted); font-size: 12px; line-height: 1.4; margin: 4px 0; }
.layers-panel .doc-link { display: inline-block; margin-top: 10px; font-size: 13px; }

/* ---- The bottom sheet (NativeSheet: 20 dp top corners, 28 dp grip, two stops) ---- */
.sheet { position: fixed; z-index: 15; left: 0; right: 0; bottom: 0; height: 55vh; height: 55dvh; display: flex; flex-direction: column; background: var(--paper); border-radius: 20px 20px 0 0; box-shadow: var(--shadow-8); overflow: hidden; transition: height .2s ease; padding-bottom: env(safe-area-inset-bottom); }
.sheet.dragging { transition: none; }
.sheet[data-size="compact"] { height: calc(var(--compact, 116px) + env(safe-area-inset-bottom)); }
.sheet[data-size="full"] { height: calc(100vh - var(--top) - 56px); height: calc(100dvh - var(--top) - 56px); }
/* On computers: a floating card at the lower left, as tall as its content (up to most
   of the window), so the map stays in view around it. Phones keep the app's sheet. */
@media (min-width: 800px) {
  .sheet, .sheet[data-size="compact"] { left: 12px; right: auto; bottom: 12px; top: auto; width: 440px; height: auto; max-height: calc(100vh - 120px); border-radius: 16px; box-shadow: 0 8px 30px rgb(0 0 0 / 22%), 0 2px 6px rgb(0 0 0 / 12%); padding-bottom: 0; transition: none; }
  .sheet .grip { height: 34px; cursor: move; flex: none; }
  .sheet .sheet-head { cursor: move; }
  .sheet .resize { position: absolute; z-index: 2; }
  .resize-e, .resize-w { top: 12px; bottom: 12px; width: 8px; cursor: ew-resize; }
  .resize-e { right: 0; } .resize-w { left: 0; }
  .resize-n, .resize-s { left: 12px; right: 12px; height: 8px; cursor: ns-resize; }
  .resize-n { top: 0; } .resize-s { bottom: 0; }
  .resize-se, .resize-nw, .resize-ne, .resize-sw { width: 14px; height: 14px; }
  .resize-se { right: 0; bottom: 0; cursor: nwse-resize; } .resize-nw { left: 0; top: 0; cursor: nwse-resize; }
  .resize-ne { right: 0; top: 0; cursor: nesw-resize; } .resize-sw { left: 0; bottom: 0; cursor: nesw-resize; }
  /* A small corner mark, as on a resizable window. */
  .resize-se::after { content: ""; position: absolute; right: 4px; bottom: 4px; width: 7px; height: 7px; border-right: 2px solid var(--line); border-bottom: 2px solid var(--line); border-radius: 0 0 3px 0; }
  body.card-moving, body.card-moving * { cursor: move !important; user-select: none; }
  body.card-resizing * { user-select: none; }
  .sheet .grip::before { display: none; }
  .sheet .grip .close { width: 46px; height: 34px; font-size: 22px; }
  .sheet .grip .back { height: 34px; font-size: 13px; }
  .sheet-head { padding: 0 20px; }
  .sheet-body { padding: 0 20px 16px; }
  .sheet-title { font-size: 19px; }
  .sheet .chart-wrap, .side-panel .chart-wrap { height: 220px; }
  .sheet[style*='height:'] .chart-wrap.grow, .sheet[style*='height: '] .chart-wrap.grow { flex: 1 1 200px; height: auto; min-height: 150px; }
  body.sheet-open .maplibregl-ctrl-bottom-left { left: 460px; }
}
.grip { position: relative; height: 28px; flex: none; cursor: grab; touch-action: none; }
/* Phones: a taller grip, and the title area drags the sheet too (the app's drag zone). */
@media (max-width: 799.98px) {
  .sheet .grip { height: 36px; }
  .sheet .grip::before { top: 14px; width: 40px; margin-left: -20px; }
  .sheet .grip .close, .sheet .grip .back { height: 36px; }
  .sheet .sheet-head { touch-action: none; cursor: grab; padding-bottom: 6px; }
  .sheet [data-drag] { touch-action: none; cursor: grab; }
}
.grip::before { content: ""; position: absolute; left: 50%; top: 12px; width: 32px; height: 4px; margin-left: -16px; border-radius: 3px; background: var(--grip); }
.grip .close { position: absolute; right: 0; top: 0; width: 46px; height: 28px; border: 0; background: transparent; font-size: 19px; color: var(--ink); cursor: pointer; line-height: 1; }
.grip .back { position: absolute; left: 4px; top: 0; height: 28px; padding: 0 10px; border: 0; background: transparent; color: var(--link); font-size: 13px; cursor: pointer; max-width: calc(50% - 30px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Photo | title | aside (Te Araroa's direction) on the first row; the subtitle under
   the title runs the full width, under the aside too. */
.sheet-head { padding: 0 16px; flex: none; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; }
.sheet-heading { display: contents; }
.sheet-head .thumb { grid-column: 1; grid-row: 1 / span 2; margin-right: 12px; }
.sheet-head .sheet-title { grid-column: 2; grid-row: 1; }
.sheet-head .sheet-subtitle { grid-column: 2 / 4; grid-row: 2; }
/* The app's 56 dp photo, top left beside the name. */
.thumb { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; background: var(--line); flex: none; margin-bottom: 8px; }
@media (min-width: 800px) { .thumb { width: 72px; height: 72px; } }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 0 16px 8px; overscroll-behavior: contain; display: flex; flex-direction: column; }
.sheet-body > * { flex: none; }
.sheet-title { font-size: 17px; font-weight: 700; line-height: 1.25; margin: 0; overflow-wrap: anywhere; }
.sheet-subtitle { font-size: 12.5px; color: var(--muted); margin: 2px 0 8px; }
/* A Te Araroa section's number and km: always one line. */
.sheet[data-kind="te-araroa"] .sheet-subtitle { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet:focus { outline: none; }

/* Sheet content (TrackSheet, PlannerUi) */
.photo { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; margin: 2px 0 10px; background: var(--chip); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 10px; }
.chip { padding: 5px 10px; border-radius: 14px; background: var(--chip); font-size: 12px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 2px 0 4px; }
.stats.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { display: grid; justify-items: center; align-content: start; min-height: 40px; text-align: center; min-width: 0; }
.stat span { font-size: 10.4px; color: var(--muted); }
.stat b { font-size: 16.25px; font-weight: 400; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart-wrap { height: 200px; margin: 4px -4px 0; }
.sheet-body > .chart-wrap.grow { flex: 1 1 170px; min-height: 150px; }
.chart { width: 100%; height: 100%; display: block; touch-action: pan-y; cursor: crosshair; }
.section-stats { display: grid; grid-template-columns: auto repeat(3, minmax(0, 1fr)) auto; align-items: center; gap: 6px; margin: 6px 0; }
.section-stats .ab { font-weight: 700; color: var(--link); font-size: 12px; }
.link-button { border: 0; background: none; color: var(--link); cursor: pointer; font-size: 12px; }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0; }
.intro { font-size: 13.5px; line-height: 1.5; margin: 8px 0; }
.fine { color: var(--muted); font-size: 11.5px; line-height: 1.4; margin: 8px 0; }
.notice { padding: 10px 12px; border-radius: 10px; background: var(--chip); }
.alert { padding: 8px 12px; border-radius: 10px; background: rgb(253 236 217); color: rgb(122 60 18); font-size: 12.5px; }
@media (prefers-color-scheme: dark) { .alert { background: rgb(71 48 30); color: rgb(246 201 162); } }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgb(255 255 255 / 30%); border-top-color: var(--orange); animation: spin .8s linear infinite; flex: none; }
.loading .spinner { border-color: var(--line); border-top-color: var(--orange); }
@keyframes spin { to { transform: rotate(360deg); } }
.sheet-body h3 { font-size: 14.5px; font-weight: 700; margin: 12px 0 4px; }
.plain { margin: 0; padding-left: 18px; font-size: 13px; }
.plain li { margin: 3px 0; }
.hut-list { list-style: none; margin: 0; padding: 0; }
.hut-list button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 2px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; color: var(--ink); }
.hut-dot { width: 10px; height: 10px; border-radius: 50%; background: #f6db94; border: 1.5px solid #233d34; flex: none; }
.hut-name { flex: 1; display: grid; min-width: 0; font-size: 13.5px; }
.hut-name small { color: var(--detail); font-size: 11.5px; }
.hut-km { color: var(--muted); font-variant-numeric: tabular-nums; }
.card-row { border-bottom: 1px solid var(--line); padding: 4px 0 10px; }
.doc-page { color: var(--orange); font-weight: 700; font-size: 14px; text-decoration: none; display: inline-flex; align-items: center; min-height: 40px; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; align-items: center; }
/* Route sheet (PlannerUi): name field, stats, chart, then the tools at the bottom. */
.route-name { width: 100%; height: 40px; font: inherit; font-size: 16px; padding: 0 8px; border-radius: 4px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); margin-bottom: 6px; }
.route-name:focus { outline: none; border-color: var(--ink); }
.route-tools { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; margin-top: 6px; }
.route-tools .btn { min-height: 30px; font-size: 11px; padding: 2px 4px; }
.app-cta { display: flex; align-items: center; gap: 10px; margin: 10px 0 2px; padding: 10px 12px; border-radius: 10px; background: var(--chip); font-size: 12.5px; }
.app-cta p { margin: 0; flex: 1; color: var(--ink); }
.sheet[data-size="compact"] .chart-wrap, .sheet[data-size="compact"] .route-name, .sheet[data-size="compact"] .route-extra, .sheet[data-size="compact"] .section-stats { display: none; }
body.drawing #map .maplibregl-canvas { cursor: crosshair; }

/* MapLibre's scale and credits, as the app's */
.maplibregl-ctrl-bottom-left .maplibregl-ctrl { margin: 0 0 14px 12px; }
.maplibregl-ctrl-scale { background: transparent; border: 1.5px solid var(--ink); border-top: 0; color: var(--ink); font-size: 10px; text-shadow: 0 0 2px #fff, 0 0 2px #fff; }
@media (prefers-color-scheme: dark) { .maplibregl-ctrl-scale { text-shadow: 0 0 2px #000, 0 0 2px #000; } }
.maplibregl-ctrl-attrib.maplibregl-compact { background: var(--glass); color: var(--ink); font-size: 11px; }
.maplibregl-ctrl-attrib a { color: inherit; }
@media (prefers-color-scheme: dark) { .maplibregl-ctrl-attrib-button { filter: invert(1); } }
body.sheet-open .maplibregl-ctrl-bottom-left, body.sheet-open .maplibregl-ctrl-bottom-right { visibility: hidden; }
@media (min-width: 800px) { body.sheet-open .maplibregl-ctrl-bottom-left, body.sheet-open .maplibregl-ctrl-bottom-right { visibility: visible; } }
@media (prefers-reduced-motion: reduce) { .sheet, .progress::before, .spinner { transition: none; animation: none; } }

/* Computers: the side panel always shows everything (no compact stop). */
@media (min-width: 800px) {
  .sheet[data-size="compact"] .chart-wrap, .sheet[data-size="compact"] .route-name { display: block; }
  .sheet[data-size="compact"] .route-extra.app-cta { display: flex; }
  .sheet .chart-wrap.grow { flex: none; height: 200px; }
}

/* The app's track summary: leg chips, leg text, DOC's page sections. */
.parts { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; flex: none; }
.parts::-webkit-scrollbar { display: none; }
.part { flex: none; padding: 6px 12px; border-radius: 14px; border: 0; background: var(--chip); color: var(--ink); font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.part[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.part-text h3 { margin: 8px 0 2px; }
.part-text .muted { color: var(--muted); font-size: 12.5px; margin: 0 0 6px; }
.doc-sections { margin-top: 10px; border-top: 1px solid var(--line); }
.doc-section { border-bottom: 1px solid var(--line); }
.doc-section summary { list-style: none; display: flex; align-items: center; justify-content: space-between; padding: 10px 0; font-size: 14.5px; font-weight: 700; cursor: pointer; }
.doc-section summary::-webkit-details-marker { display: none; }
.doc-section summary::after { content: "›"; font-size: 20px; color: var(--muted); transform: rotate(90deg); transition: transform .15s; font-weight: 400; }
.doc-section[open] summary::after { transform: rotate(270deg); }
.doc-section-body { padding-bottom: 10px; }
.doc-heading { font-size: 13.5px; font-weight: 700; margin: 12px 0 0; }
.doc-text { font-size: 13.5px; line-height: 1.5; margin: 6px 0 0; white-space: pre-line; }
.doc-list { margin: 4px 0 0; padding-left: 18px; font-size: 13.5px; line-height: 1.45; }
.doc-list li { margin-top: 4px; }
.doc-photo { margin: 10px 0 0; }
.doc-photo img { width: 100%; height: auto; border-radius: 10px; background: var(--line); display: block; }
.doc-photo figcaption { font-size: 11.5px; color: var(--muted); margin-top: 4px; white-space: pre-line; line-height: 1.35; }

@media (max-width: 799.98px) { .resize { display: none; } }

/* DOC's current alerts: amber, as DOC marks them, above the walk's or hut's details. */
.doc-alerts { margin: 10px 0 12px; border-radius: 10px; background: rgb(253 236 217); color: rgb(92 45 12); font-size: 13px; overflow: hidden; }
.doc-alerts-head { margin: 0; padding: 9px 12px 7px; font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.doc-alerts-head::before { content: ''; width: 16px; height: 16px; flex: none; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2 1 21h22L12 2zm1 15h-2v2h2v-2zm0-7h-2v5h2v-5z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2 1 21h22L12 2zm1 15h-2v2h2v-2zm0-7h-2v5h2v-5z'/%3E%3C/svg%3E") center / contain no-repeat; }
.doc-alerts-head a { font-weight: 600; color: inherit; }
.doc-alerts-fold > summary { cursor: pointer; list-style: none; }
.doc-alerts-fold > summary::-webkit-details-marker { display: none; }
.doc-alerts-fold > summary::after { content: '▸'; margin-left: auto; font-size: 14px; }
.doc-alerts-fold[open] > summary::after { content: '▾'; }
.doc-alert { border-top: 1px solid rgb(122 60 18 / .18); }
.doc-alert > summary { cursor: pointer; padding: 8px 12px; font-weight: 600; line-height: 1.35; list-style-position: inside; }
.doc-alert-body { padding: 0 12px 10px; line-height: 1.45; }
.doc-alert-body p, .doc-alert-body ul, .doc-alert-body ol { margin: 0 0 6px; }
.doc-alert-body ul, .doc-alert-body ol { padding-left: 18px; }
.doc-alert-body a { color: inherit; text-decoration: underline; overflow-wrap: anywhere; }
.doc-alert-body .muted { opacity: .75; font-size: 12px; margin: 4px 0 0; }
@media (prefers-color-scheme: dark) {
  .doc-alerts { background: rgb(71 48 30); color: rgb(250 214 180); }
  .doc-alert { border-top-color: rgb(250 214 180 / .18); }
}

/* Te Araroa: step along the trail. */
.ta-steps { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; margin: 10px 0 4px; }

/* Te Araroa sections list, options and places. */
.ta-sections h3 { margin: 14px 0 4px; font-size: 13px; color: var(--muted); }
.ta-row { display: grid; grid-template-columns: 26px 1fr auto auto; gap: 8px; align-items: center; width: 100%; padding: 7px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); text-align: left; cursor: pointer; font: inherit; }
.ta-row:hover { background: var(--ripple); }
.ta-row.option { padding-left: 16px; opacity: .85; }
.ta-n { font-size: 12px; color: var(--muted); text-align: right; }
.ta-name { font-size: 13.5px; font-weight: 600; line-height: 1.25; }
.ta-name small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.ta-km { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ta-badge { font-size: 11px; padding: 2px 7px; border-radius: 999px; background: rgb(253 236 217); color: rgb(122 60 18); white-space: nowrap; }
.ta-badge.closed { background: rgb(254 226 226); color: rgb(153 27 27); }
.ta-status-line { margin: 2px 0 6px; font-size: 12.5px; }
.ta-options { margin: 10px 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ta-options h3 { width: 100%; margin: 0 0 2px; font-size: 13px; }
.hut-dot.ta-camp { background: #fff4f6; border-color: #ef3b5d; border-radius: 50%; }
.doc-alert .alert-meta { display: block; font-weight: 500; opacity: .8; font-size: 11.5px; margin-top: 2px; }
@media (prefers-color-scheme: dark) {
  .ta-badge { background: rgb(71 48 30); color: rgb(250 214 180); }
  .ta-badge.closed { background: rgb(80 24 24); color: rgb(254 202 202); }
}

/* Te Araroa: tabs, inline sections, options, food. */
.ta-tabs { display: flex; gap: 4px; margin: 6px 0 8px; border-bottom: 1px solid var(--line); }
.ta-tabs button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; padding: 8px 10px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.ta-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: #ef3b5d; }
.ta-row.open { background: var(--chip); }
.ta-inline { padding: 8px 6px 12px; border-left: 3px solid #ef3b5d; margin: 0 0 8px 6px; background: color-mix(in srgb, var(--chip) 45%, transparent); }
.ta-inline .stats { margin-top: 6px; }
.ta-why { margin: 6px 0; font-size: 13px; }
.ta-option { display: grid; gap: 2px; width: 100%; text-align: left; padding: 9px 10px; margin: 6px 0; border: 1px dashed #ef3b5d; border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; }
.ta-option:hover { background: var(--chip); }
.ta-option b { font-size: 13.5px; }
.ta-option small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.ta-option-kind { display: flex; gap: 6px; align-items: center; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #c42a4a; }
.ta-options .ta-option { margin: 0; }
.ta-options { flex-direction: column; align-items: stretch; }
.food-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; border: 1.8px solid #1f6b42; background: #e9f6ee; vertical-align: middle; }
.food-dot.full { background: #2f8f5b; }
.food-dot.box { background: #fff; border-color: #ef3b5d; }
.food-key { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.food-key .food-dot { margin-left: 6px; }
.food-carries { list-style: none; margin: 6px 0; padding: 0; }
.food-carries li { padding: 8px 2px; border-bottom: 1px solid var(--line); display: grid; gap: 2px; }
.food-carries li.long { border-left: 3px solid #ef3b5d; padding-left: 8px; }
.food-carries small { color: var(--muted); font-size: 12px; }
.food-leg { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.food-stop { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--ink); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; padding: 0; }
.food-stop small { font-weight: 400; color: var(--muted); }
.food-arrow { color: var(--muted); }
.food-hitch .link { font-size: 12px; }
.ta-food .hut-list button .food-dot { margin: 0 2px; }
.plain-list { margin: 4px 0 8px; padding-left: 18px; font-size: 13px; line-height: 1.45; }
/* "Part of Te Araroa" on walks, tracks and huts. */
.ta-link { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; margin: 8px 0; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, #ef3b5d 10%, var(--surface)); }
.ta-link-mark { width: 18px; height: 0; border-top: 3px solid #ef3b5d; border-radius: 2px; }
.ta-link b { display: block; font-size: 13px; }
.ta-link small { color: var(--muted); font-size: 12px; }
.ta-link-buttons { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.ta-link-buttons .btn { min-height: 30px; font-size: 12px; }
.stat b { overflow: hidden; text-overflow: ellipsis; max-width: 100%; display: block; }

/* The panel beside the side panel (computers): a picked section or food stop. */
.side-panel { position: fixed; z-index: 6; display: flex; flex-direction: column; background: var(--paper); color: var(--ink); border-radius: 16px; box-shadow: 0 8px 30px rgb(0 0 0 / 22%), 0 2px 6px rgb(0 0 0 / 12%); overflow: hidden; }
.side-panel .side-top { display: flex; justify-content: flex-end; padding: 6px 8px 0; }
.side-panel .close { border: 0; background: none; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px 8px; }
.side-panel .sheet-head { padding: 0 16px 6px; }
.side-panel .sheet-body { overflow: auto; padding: 0 16px 16px; }
@media (max-width: 799px) { .side-panel { display: none; } }
/* Te Araroa, simpler. */
.sheet-aside { grid-column: 3; grid-row: 1; margin-left: 10px; }
.sheet-aside:empty { display: none; }
.ta-dir { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 1px; background: var(--surface); }
.ta-dir button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 999px; cursor: pointer; line-height: 1.3; }
.ta-dir button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.ta-facts { margin: 2px 0 8px; font-size: 13.5px; font-weight: 600; }
.ta-steps { display: flex; gap: 8px; margin: 2px 0 8px; }
.ta-step { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 4px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: inherit; font: inherit; text-align: left; cursor: pointer; }
/* The arrow at the outer edge; the name centred in the rest, nudged towards its side. */
.ta-step-name { flex: 1 1 auto; text-align: center; }
.ta-step.prev .ta-step-name { padding-right: 14px; }
.ta-step.next .ta-step-name { padding-left: 14px; }
.ta-step.empty { border: 0; padding: 0; cursor: default; }
.ta-step:hover { background: color-mix(in srgb, var(--paper) 88%, currentColor); }
.ta-step .arrow { font-size: 20px; line-height: 1; flex: none; margin-top: -2px; }
.ta-step-name { min-width: 0; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ta-food-line { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0; font-size: 13.5px; }
.ta-food-line .food-dot { margin-top: 4px; }
.ta-food-line small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.ta-food-line .link, .ta-options .link { padding: 0; font-size: inherit; }
.ta-options { display: block; margin: 8px 0; font-size: 13px; }
.ta-options .link { margin-right: 10px; }
.ta-row.food .ta-name { grid-column: 1 / -1; }
.ta-row.food.long { box-shadow: inset 3px 0 0 #ef3b5d; }
.ta-n.option { color: #c42a4a; }
.ta-food-line .link, .ta-options .link, .ta-row .link { min-height: 0; display: inline; padding: 0; }

/* Te Araroa: the list narrows and the picked section joins it, wider. */
@media (min-width: 800px) {
  .sheet.joined { width: 300px !important; height: calc(100vh - 120px) !important; border-top-right-radius: 0; border-bottom-right-radius: 0; }
  .sheet.joined .ta-row .ta-name small, .sheet.joined .ta-status-line { display: none; }
  .sheet.joined .resize-e { display: none; }
  /* The side panel on its left (the list moved to the right of the screen). */
  .sheet.joined.joined-left { border-radius: 0 16px 16px 0; }
  .sheet.joined.joined-left .resize-e { display: block; }
  .sheet.joined.joined-left .resize-w { display: none; }
  .side-panel { border-radius: 0 16px 16px 0; border-left: 1px solid var(--line); }
  .side-panel.left { border-radius: 16px 0 0 16px; border-left: 0; border-right: 1px solid var(--line); }
}
.side-panel .side-top { justify-content: space-between; align-items: center; padding: 8px 10px 0; }
.side-panel .back { border: 0; background: none; color: var(--link); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; padding: 4px 6px; }
.food-dot.supermarket { background: #2f8f5b; border-color: #1f6b42; }
.food-dot.store { background: #a8dcbc; border-color: #1f6b42; }
.food-dot.cafe { background: #c98a4b; border-color: #6b4421; }
.food-dot.box { background: #fff; border-color: #ef3b5d; }
.food-dot { width: 8px; height: 8px; border-width: 1.5px; }
.ta-sub { margin: 12px 0 4px; font-size: 13px; }
.on-map { font-size: 12px; white-space: nowrap; }
.on-map { min-height: 0; display: inline; padding: 0; }
/* NZ Topo: where Topo50 replaces Topo250. */
.topo-switch .note { margin-top: 2px; }
.topo-switch .link { border: 0; background: none; padding: 0; font: inherit; color: var(--link); cursor: pointer; text-decoration: underline; }
/* ?promo (tools/promo-shots.mjs): the map alone, for the website's pictures. */
body.promo #launcher, body.promo #locate, body.promo #perspective, body.promo #compass, body.promo #layers-button,
body.promo .maplibregl-ctrl-bottom-left, body.promo .maplibregl-ctrl-bottom-right, body.promo #map-status, body.promo .progress, body.promo #notes { display: none !important; }

/* A walk, hut or Te Araroa page's own text (lib/seo-pages.mjs): last in its place's
   panel (js/map/sheet.js), not shown before the panel takes it. */
.place-text { display: none; }
.sheet-body > .place-text { display: block; border-top: 1px solid var(--line); margin-top: 14px; padding-top: 4px; font-size: 13.5px; line-height: 1.5; }
.place-text p { margin: 4px 0 8px; }
.place-text a { color: var(--link); }
.place-text .muted { color: var(--muted); }
.place-text .link-list { list-style: none; padding: 0; margin: 2px 0 8px; }
.place-text .link-list li { padding: 3px 0; }
.place-text .facts { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 6px 0 10px; }
.place-text .facts > div { display: contents; }
.place-text .facts dt { color: var(--muted); }
.place-text .facts dd { margin: 0; }
.place-text .prev-next { display: flex; justify-content: space-between; gap: 12px; margin: 8px 0; font-weight: 600; }

/* ?promo pictures: the map as the app shows it, without the website's "get the app" notes. */
body.promo .app-cta { display: none !important; }
