/* The auto-hiker's page (M0; from the prototype's index.html by tools/sync-proto.mjs). */
:root {
  --c0:#343945; --c1:#394862; --c2:#4d698a; --c3:#93b7cd; --c4:#f2efe6; --c5:#e9dab6; --c6:#e49d8d;
  --c8:#ce6937; --c9:#9b4a39; --c10:#6d4f3d; --c11:#345148; --c12:#3f6c55; --c13:#749353; --c14:#aabb8d; --c15:#4a8a85;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  --tap: 44px;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--c0); overflow: hidden; overscroll-behavior: none; }
/* iOS 26 lays a home-screen app out one status bar short of the screen (WebKit bug 301108), so the fixed layers
   stopped above the bottom edge over a strip of the page's ink (the creator's screenshots, 2026-10-17). A document
   taller by the top inset gets the whole screen; the 100lvh cap leaves it alone where the viewport was right. */
@media (display-mode: standalone) { html { min-height: min(100lvh, calc(100% + env(safe-area-inset-top, 0px))); } }
body { font: 14px/1.3 ui-monospace, "SF Mono", Menlo, monospace; color: var(--c0); -webkit-user-select: none; user-select: none; touch-action: none; }
#view { position: fixed; left: 0; top: 0; width: 100%; height: 100%; display: block; touch-action: none; image-rendering: pixelated; } /* the dither stays crisp when the 2x buffer is upscaled; main.js sets its height, the screen down to the panel */
#glLost { position: fixed; left: 50%; top: 45%; transform: translate(-50%, -50%); z-index: 8; display: none; padding: 12px 14px; pointer-events: auto; } /* a lost WebGL context: tap to resume */
canvas.px { display: block; image-rendering: pixelated; pointer-events: none; }
.hud { position: fixed; left: 0; right: 0; pointer-events: none; z-index: 2; }
.hud * { pointer-events: auto; }
/* the corner box at the top right (decision 156; panelbar.js Corner draws it): the full-screen key, the turn mark and
   the menu, each a 44 px cell; Undo drops under it for a few seconds (#offer, hud.js; decision 139) */
#top { top: 0; height: 0; }
#corner { position: fixed; z-index: 2; top: calc(var(--safe-t) + 4px); right: calc(var(--safe-r) + 4px); pointer-events: none; }
#corner canvas, #card canvas { position: absolute; display: block; image-rendering: pixelated; pointer-events: none; }
#corner button { position: absolute; border: 0; padding: 0; margin: 0; background: transparent; pointer-events: auto; touch-action: manipulation; }
#corner button[hidden] { display: none; }
#offer { position: fixed; z-index: 2; right: calc(var(--safe-r) + 4px); top: calc(var(--safe-t) + 67px); } /* (as drawn: 1 px under the corner box, its right side the box's) */
#offer canvas { position: absolute; left: 0; top: 0; image-rendering: pixelated; pointer-events: none; }
#offer button { position: absolute; border: 0; padding: 0; margin: 0; background: transparent; touch-action: manipulation; }
/* the trail card (a tap on the readouts: the elevation, the speed and pace), right-aligned with the panel; hud.js sets
   its top, 6 px over the panel or the shelf */
#card { position: fixed; z-index: 3; right: calc(var(--safe-r) + 4px); top: 0; pointer-events: none; }
#card[hidden] { display: none; }
/* the Sierra box: snow fill, brick border */
.box { background: var(--c4); border: 3px solid var(--c9); box-shadow: 0 0 0 2px var(--c4), 0 0 0 4px var(--c0); padding: 8px 8px 8px; }
/* One Panel (decision 156; web/js/ui/panel.js lays it out, dialart.js draws it, panelbar.js runs it), docked under the
   scene: the Sierra rings along its top, its snow out to the screen's sides and foot, under the safe area too (its
   paper, slate after dark); the scene's canvas stops at it (main.js). Its art is drawn one picture pixel a CSS px and
   scaled up pixel for pixel; its words are pixel labels on whole CSS px. The keys' buttons are see-through: the art is
   the key; the panel's one touch area takes every touch on it (the nearest key). The panel's height is its own
   (panelbar.js), the safe area's inset added under it (content-box), so in a Home Screen app its keys end over the
   home indicator's zone, not in it (the controls review's finding 1). In the document the panel comes before the shelf,
   as VoiceOver reads them (finding 6); drawn, the shelf sits over it. */
#bottom { bottom: 0; padding: 0; display: flex; flex-direction: column; }
#bar { position: relative; pointer-events: none; box-sizing: content-box; padding-bottom: var(--safe-b); background: var(--c4); }
body.night #bar { background: var(--c2); }
#bar canvas, #shelf canvas { position: absolute; display: block; image-rendering: pixelated; pointer-events: none; }
#bar .key { position: absolute; pointer-events: none; }
#bar .hit, #bar .dk, #shelf .hit, #shelf .dk { position: absolute; pointer-events: auto; touch-action: none; }
#bar .dk, #shelf .dk { border: 0; padding: 0; margin: 0; background: transparent; color: transparent; border-radius: 0; }
/* the shelf of stop verbs (the stop's own first), over the panel while stopped, only with verbs the game can do: its
   ring 6 px over the panel's */
#shelf { position: relative; order: -1; margin: 0 0 6px; pointer-events: none; }
#shelf[hidden] { display: none; }
/* A low meter (hud.js LOW_ENERGY, LOW_WATER) blinks once a second for 5 seconds, then stays lit while it is low (decision
   156, revising 105's blink for as long as it is low: WCAG 2.2.2, and an alarm always on stops being noticed): half a
   second at rest, then half a second warning, when its gauge's track rim turns brick and its number turns to its plate,
   snow letters on brick (decision 105). The plate is dial.js's (plateLayout): 2 px of brick round the number
   (PLATE_PAD), its words on the label's own, pixel for pixel; laid over the label, so nothing moves. One keyframe for
   both, step-end so each half holds, and the last held. Reduce Motion: the warning lit at once while the meter is low. */
#bar .rim, #bar .plate { opacity: 0; }
#bar .low .rim, #bar .low .plate { animation: blink 1s step-end 5 forwards; }
@keyframes blink { 0% { opacity: 0; } 50%, 100% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #bar .low .rim, #bar .low .plate { animation: none; opacity: 1; } }
/* full screen (the corner box's key): the panel away, the scene to the foot */
body.full #bottom { display: none; }
#bottom > .box { display: none; }
#bottom.ended > .box { display: block; border-width: 3px 0 0; padding: 10px calc(var(--safe-r) + 17px) calc(var(--safe-b) + 17px) calc(var(--safe-l) + 17px); } /* docked, in the panel's place */
#bottom.ended #bar, #bottom.ended #shelf { display: none; }
body.night #bottom.ended > .box { background: var(--c2); } /* after dark, the slate look, as the panel it replaces (finding 10) */
.row { display: flex; gap: 6px; }
.row + .row { margin-top: 6px; }
/* the menu's Restart and Auto Snacks keys stack under 375 px, where half the row can't hold Auto Snacks Off with its
   padding: the 320 px SE, and every width up to 371 px at 2x (decision 125; its audit's sweep of every width) */
@media (max-width: 374px) { #hikeKeys { flex-direction: column; } }
@media (max-width: 374px) { #shareSwitches { flex-direction: column; } } /* the share sheet's Place and Hour (web/js/ui/share.js) stack as New Hike and Auto Snacks do, at the same width */
button.k { flex: 1 1 0; min-height: var(--tap); min-width: var(--tap); border: 2px solid var(--c0); background: var(--c4); display: grid; place-items: center; grid-auto-flow: column; justify-content: center; column-gap: 7px; padding: 2px 4px; border-radius: 0; box-shadow: inset 0 -3px 0 var(--c5); touch-action: manipulation; }
button.k:active { box-shadow: inset 0 3px 0 var(--c5); }
button.k.on { background: var(--c0); box-shadow: none; padding-top: 4px; padding-bottom: 0; } /* lit, the key has no moulding, so its face is the whole inside: its word 2 px lower keeps its capitals in the face's middle, within a font pixel in either lettering (boxes.json key centre) */
button.k:disabled { opacity: 0.35; }
button.k.on:disabled { opacity: 1; } /* the stop to eat or drink that is on stays lit while Eat and Drink wait for it (QA-06) */
/* the toast: hud.js toast() sets it centred, over the bottom panel, on whole px (centreOn: a half px blurs a fading layer's lettering) */
#toast { position: fixed; left: 0; top: 0; z-index: 3; background: var(--c0); padding: 6px 10px; border: 2px solid var(--c4); pointer-events: none; opacity: 0; transition: opacity 0.3s; }
#toast.show { opacity: 1; }
/* words beside the pixel lettering for VoiceOver alone (the toast's, the pack sheet's, the arrival panel's) */
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* the arrival panel, in place of the keys once the hike has ended: the place, how far and how long, what was eaten and drunk, Hike Again */
.arrive { display: none; flex-direction: column; align-items: flex-start; gap: 5px; }
#bottom.ended .arrive { display: flex; }
#endKeys { position: relative; align-self: stretch; height: 48px; margin-top: 3px; } /* the panel's pixel-art keys (panel.js endLayout; the controls study's F10): Hike Again, and at the lake Turn Around at the right (the hike out, decision 114); back at the trailhead, Hike Again alone */
#endKeys canvas { position: absolute; left: 0; top: 0; image-rendering: pixelated; pointer-events: none; }
#endKeys button { position: absolute; border: 0; padding: 0; margin: 0; background: transparent; touch-action: manipulation; }
/* the arrival's name card (decision 98): the place's name over the view, like a museum placard; it fades in, holds and
   fades out (hud.js nameCard, which sets it centred, 42% down, on whole px), while the bottom panel steps aside, then
   slides back in as the arrival panel */
#arriveCard { position: fixed; left: 0; top: 0; z-index: 3; padding: 14px 20px; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity 0.8s, visibility 0s linear 0.8s; }
#arriveCard.show { opacity: 1; visibility: visible; transition: opacity 0.8s; }
#bottom { transition: transform 0.45s ease-out; }
body.arriving #bottom { transform: translateY(calc(100% + 12px)); }
@media (prefers-reduced-motion: reduce) { #arriveCard, #arriveCard.show, #bottom { transition: none; } } /* no fade, no slide: shown, then hidden */
/* sign labels in the scene (main.js places them: inside the band between the screen's top and the panel, clear of the HUD's controls and of each other); a sign's fades out as the camera pulls back (--sign-op, main.js), a peak's stays */
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.lbl { position: absolute; left: 0; top: 0; background: var(--c4); border: 2px solid var(--c9); padding: 2px 4px; will-change: transform; display: none; opacity: var(--sign-op, 1); }
.lbl.peak { background: none; border: 0; padding: 0; opacity: 1; }
/* the HUD's sheets: pack screen and menu, over the live view (no scrim: a dimmed view read as a dark block over the top of the screen); the frame's error sheet and the debug menu are sheets of their own */
#pack, #menu { position: fixed; z-index: 5; display: none; align-items: flex-end; justify-content: center; background: none; }
#menu { inset: 0; align-items: flex-start; justify-content: flex-end; padding: calc(var(--safe-t) + 76px) calc(var(--safe-r) + 8px) calc(var(--safe-b) + 10px) calc(var(--safe-l) + 8px); } /* it drops from the corner box (decision 156): its outer ring 6 px under it, its right edge the box's (the .box's rings reach 4 px past its border) */
/* the pack sheet is a bottom sheet: the corner box (its ≡ works) and the hiker at the trailhead show above it (QA-15) */
#pack { left: 0; right: 0; bottom: 0; padding: 0 calc(var(--safe-r) + 10px) calc(var(--safe-b) + 10px) calc(var(--safe-l) + 10px); }
#pack.open, #menu.open { display: flex; }
#pack .box, #menu .box { width: 100%; max-width: 480px; max-height: 100%; overflow: auto; }
#pack .box { max-height: calc(100dvh - var(--safe-t) - 96px); }
#tPackRoute { margin-top: 6px; }
#packNote { display: flex; flex-direction: column; gap: 3px; margin: 6px 0 10px; }
@media (max-width: 389px) { #pack .choice { padding: 6px 10px; gap: 3px; margin-bottom: 6px; min-height: 0; } } /* a narrow phone: compact choices, so the diorama keeps room above the sheet */
/* while packing, the sheet stands in for the panel, and the scene runs to the foot behind it; while the menu is open,
   the pack sheet hides (QA-21) */
body.packing #bottom { display: none; }
body.menu-open #pack { visibility: hidden; }
#bCopy, #bSound, #bSilent, #bWatch, #featureKeys > button.k { margin-top: 6px; }
#featureKeys > button.k { width: 100%; } /* a key a feature adds (hud.js; ui/menukeys.js): the sheet's width, as the shell's own wide keys */
#tripKeys > button.k { width: 100%; } /* a way of travel's key (hud.js; main.js), at the menu's top: the sheet's width, as Sound's */
#tripKeys > button.k + button.k, #tripKeys:not(:empty) + #hikeKeys { margin-top: 6px; }
#menuReport:not([hidden]) { display: block; width: 100%; min-height: 8em; margin-top: 6px; font: 12px/1.3 ui-monospace, monospace; color: var(--c0); background: var(--c4); border: 1px solid var(--c2); border-radius: 0; resize: none; -webkit-user-select: text; user-select: text; }
.choice { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; text-align: left; border: 2px solid var(--c0); background: var(--c4); padding: 8px 10px; margin: 0 0 8px; min-height: 56px; box-shadow: inset 0 -3px 0 var(--c5); }
.choice.on { background: var(--c5); border-color: var(--c9); box-shadow: inset 0 0 0 2px var(--c9); }
.sp { height: 8px; }
.dev { border-top: 2px dashed var(--c9); margin-top: 10px; padding-top: 8px; }
#boot { position: fixed; inset: 0; display: grid; place-items: center; z-index: 9; background: var(--c0); color: var(--c5); text-align: center; padding: 20px; }
#bootError button.done { padding-right: 34px !important; } /* the error state's Copy Bug Report: room for the copy's ✓ (QA-23) */
#bootError .report:not([hidden]) { display: block; width: 100%; max-width: 340px; min-height: 6em; margin: 12px auto 0; font: 12px/1.3 ui-monospace, monospace; -webkit-user-select: text; user-select: text; } /* the copy's fallback: the report, selected */

/* The frame (tools/sync-proto.mjs FRAME_CSS): the error sheet over everything; the update note, the stamps and the upright note wait for M0's menu. */
#frame, .upright { display: none; }
/* Held sideways (QA-10): the game is drawn for a phone held upright; on its side the bottom panel covers the hiker. A landscape screen no taller than 540 px (a phone, as the old game's rule had it), or a touch screen no taller than 640 (the open iPhone Duo turned, about 626: decision 150), shows the upright note over the game, under the error sheet; the frame scheduler drops to its covered rate meanwhile (main.js, the same query: rate.js SIDEWAYS). */
@media (orientation: landscape) and (max-height: 540px), (orientation: landscape) and (pointer: coarse) and (max-height: 640px) {
  .upright { display: flex; position: fixed; inset: 0; z-index: 15; flex-direction: column; gap: 14px; align-items: center; justify-content: center; padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l); background: var(--c0); color: var(--c4); text-align: center; }
  .upright .turn-glyph { flex: none; width: 64px; height: 64px; color: var(--c4); }
  .upright p { margin: 0; padding: 14px 20px; font: 20px/1.2 var(--font-pixel); color: var(--c0); background: var(--c4); border: 3px solid var(--c9); box-shadow: 0 0 0 2px var(--c4), 0 0 0 4px var(--c0); }
}
#error-sheet:not([hidden]) { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(52, 57, 69, 0.72); }
#error-sheet .sheet { position: static; background: var(--c4); color: var(--c0); border: 3px solid var(--c9); padding: 12px; max-width: 340px; display: grid; gap: 8px; }
#error-sheet button { min-height: 44px; }

/* The hidden debug menu (ui/debug.js builds it when it opens: ?debug=1, or five quick taps on the second status line), over the HUD and under the error sheet. */
.scrim.debug:not([hidden]) { position: fixed; inset: 0; z-index: 10; display: flex; align-items: flex-end; justify-content: center; padding: var(--safe-t) var(--safe-r) 0 var(--safe-l); background: var(--scrim); }
.debug-sheet { width: 100%; max-width: 440px; max-height: 80dvh; overflow: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 10px; padding: 14px 12px calc(14px + var(--safe-b)); color: var(--ink); touch-action: pan-y; -webkit-user-select: text; user-select: text; }
.debug button { font: inherit; color: var(--ink); }
.debug-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.debug-id { margin: 0; font-family: var(--font-code); font-size: 15px; color: var(--c2); }
.debug-close { flex: none; width: var(--tap); height: var(--tap); margin: -8px -6px -8px 0; padding: 0; font-size: 28px; line-height: 1; background: none; border: 0; }
.debug-check { margin: 0; font-size: 15px; color: var(--c2); }
.debug-check[data-check="match"]::before { content: "✓ "; }
.debug-check[data-check="differs"], .debug-check[data-check="error"] { color: var(--c9); }
.debug-check[data-check="differs"]::before, .debug-check[data-check="error"]::before { content: "✗ "; }
.debug .report { flex: none; margin: 0; max-height: 40dvh; overflow: auto; font: 12px/1.3 var(--font-code); white-space: pre-wrap; word-break: break-all; }
.debug textarea.report { width: 100%; min-height: 8em; font-size: 16px; background: var(--c4); border: 1px solid var(--c2); border-radius: 0; resize: none; }
.debug textarea.report:not([hidden]) + pre.report { display: none; }
.debug-note-label { font-size: 15px; color: var(--c2); }
.debug-note { flex: none; width: 100%; font: 16px/1.3 var(--font-code); color: var(--ink); background: var(--c4); border: 1px solid var(--c2); border-radius: 0; resize: vertical; }
.marks { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 15px; }
.marks-label { color: var(--c2); margin-right: 4px; }
.marks-mode { min-height: var(--tap); padding: 4px 10px; background: var(--c4); border: 1px solid var(--c2); border-radius: 0; }
.debug .marks-mode[aria-pressed="true"] { color: var(--c4); background: var(--c2); }
.done { position: relative; }
.done::after { content: "✓"; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); }
