/* ==========================================================================
   SAMLARC "Where the West Begins Again" — theme + screens (ADR-0004)

   THEME TOKENS: everything brand-tunable is a CSS custom property in :root
   below. To apply Chloe's brand kit, edit ONLY this :root block + swap the
   files in assets/ (logo, map, fonts). No component/Rust changes needed.
   ========================================================================== */

/* SAMLARC brand type — Rosario (SIL OFL), self-hosted for offline-first
   (ADR-0011, no CDN). One variable file per subset covers weights 300–700 and
   is used for BOTH body and display, matching samlarc.org. To change the face,
   swap these files + the @font-face src; that plus the :root tokens is the
   whole brand swap. */
@font-face {
  font-family: "Rosario";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("assets/fonts/rosario-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Rosario";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("assets/fonts/rosario-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* --- palette (SAMLARC brand — samlarc.org / Great Rancho Campout) ---
     Adopted from SAMLARC's live site: navy #114C72 is the primary (headings,
     CTA edge, deep accents); the event's warm terracotta #CD7036 becomes the
     CTA + warm highlights, on a warm neutral surface.
     WCAG AA (ADR-0013): every text/label pair must clear 4.5:1 (3:1 large).
     The CTA keeps a --gr-ink label on the --gr-gold-hi → --gr-gold terracotta
     gradient — kept light enough that ink-on-terracotta stays ≥ 4.5:1 (≈5.9:1)
     — with a navy (--gr-gold-deep) stamped border/lip. Navy headings clear ~8:1
     on parchment. Preserve these invariants if the palette is retuned. */
  --gr-parchment:  #f4efe6;  /* warm neutral surface (SAMLARC light bg, warmed) */
  --gr-parchment-2:#e7dccb;
  --gr-ink:        #232c36;  /* charcoal-navy body text (SAMLARC #333539/#161A26) */
  --gr-ink-soft:   #51616f;  /* muted slate */
  --gr-gold:       #e0975a;  /* warm terracotta — base of the CTA gradient + fills */
  --gr-gold-hi:    #f0b98a;  /* lighter terracotta — top of the CTA gradient */
  --gr-gold-deep:  #114c72;  /* SAMLARC navy — headings, CTA border/lip, deep accents */
  --gr-rust:       #a8451a;  /* deep terracotta — labels/toasts (AA as text) */
  --gr-pine:       #1c6ea3;  /* SAMLARC blue — spare accent (ADR-0004 palette;
                                unused since ADR-0016 retired the completion clock) */
  --gr-shadow:     rgba(17, 32, 48, .28);

  /* --- type --- */
  /* SAMLARC uses Rosario across its site (headings + body). One family,
     variable weight, self-hosted in the @font-face rules above. */
  --gr-font-display: "Rosario", Georgia, "Times New Roman", serif;
  --gr-font-body:    "Rosario", Georgia, "Times New Roman", serif;

  /* --- metrics --- */
  --gr-radius: 14px;
  --gr-gap: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--gr-parchment);
  color: var(--gr-ink);
  font-family: var(--gr-font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  /* No document-level rubber-band. Screens are sized to the viewport, so a
     bounce here is pure "this is a web page in a browser" tell. */
  overscroll-behavior-y: none;
}

/* Parchment texture: layered radial + linear washes plus a faint Old West
   motif tile (cactus / sheriff star / horseshoe / lasso, inline SVG — no
   external image, ADR-0011). The motifs are stroked in SAMLARC navy at ~6%
   opacity, so every text/label pair keeps its ADR-0013 contrast headroom.
   NOTE for brand swaps (ADR-0004): data URIs can't read CSS vars — the
   stroke color below is a baked copy of --gr-gold-deep (%23114c72). */
body {
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(255,255,255,.35), transparent 60%),
    radial-gradient(120% 90% at 50% 120%, rgba(138,90,18,.10), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='280' height='280' viewBox='0 0 280 280'%3E%3Cg fill='none' stroke='%23114c72' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' opacity='.06'%3E%3Cg transform='translate(38,26) rotate(-4)'%3E%3Cpath d='M13 52 V12 a9 9 0 0 1 18 0 V52'/%3E%3Cpath d='M13 34 H6 a6 6 0 0 1 -6 -6 V18'/%3E%3Cpath d='M31 26 h7 a6 6 0 0 0 6 -6 V12'/%3E%3Cpath d='M6 52 H38'/%3E%3C/g%3E%3Cg transform='translate(200,52) rotate(12)'%3E%3Cpath d='M0 -16 L4 -5.5 15.2 -4.9 6.5 2.1 9.4 12.9 0 6.8 -9.4 12.9 -6.5 2.1 -15.2 -4.9 -4 -5.5 Z'/%3E%3C/g%3E%3Cg transform='translate(64,206) rotate(-14)'%3E%3Cpath d='M-12 12 V-2 a12 12 0 0 1 24 0 V12'/%3E%3Cpath d='M-16 12 h8 M8 12 h8'/%3E%3C/g%3E%3Cg transform='translate(206,206) rotate(8)'%3E%3Ccircle cx='0' cy='0' r='11'/%3E%3Cpath d='M8 8 q10 6 5 16'/%3E%3C/g%3E%3Cg transform='translate(136,124)'%3E%3Cpath d='M0 -5 V5 M-5 0 H5'/%3E%3C/g%3E%3Cg transform='translate(252,140)'%3E%3Cpath d='M0 -4 V4 M-4 0 H4'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(180deg, var(--gr-parchment), var(--gr-parchment-2));
  /* Deliberately NOT `background-attachment: fixed`. On iOS a viewport-anchored
     background forces the whole texture to repaint every frame of a scroll —
     and of Safari's toolbar animation — which is the one paint path these
     hand-me-down phones can't afford. Every screen is sized to the viewport
     (min-height: 100svh) so the background box and the viewport coincide
     anyway: same picture, none of the repaint cost. */
}

/* --- splash (index.html; removed on mount) --- */
#splash {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; gap: 12px;
  align-items: center; justify-content: center;
  color: var(--gr-ink-soft);
  font-family: var(--gr-font-body);
}
.splash__spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 4px solid var(--gr-gold-deep); border-top-color: transparent;
  animation: gr-spin .9s linear infinite;
}
@keyframes gr-spin { to { transform: rotate(360deg); } }

/* --- emoji (src/glyph.rs) ---
   Vendored OpenMoji SVGs, not text codepoints, so every phone draws the same
   art instead of its own OS emoji font. Sized in `em` so each call site keeps
   the font-size it already had — the sizes below (4rem badge, 4.5rem burst,
   1.35rem button labels) are unchanged from when these were characters. The
   baseline nudge matches how a text emoji sat next to its label; glyphs that
   stand alone in a centered box override it. */
.glyph {
  /* 1.2em, not 1em: OpenMoji leaves padding inside its 72x72 viewBox, so a
     1em box draws about 0.8em of art and reads a size smaller than the text
     emoji it replaced. This restores the old optical size. */
  width: 1.2em; height: 1.2em;
  display: inline-block;
  vertical-align: -.24em;
  flex: none;
}
.found__badge .glyph,
.done__burst .glyph,
.map__start-badge .glyph,
.photo__shutter .glyph,
.photo__flip .glyph { vertical-align: middle; }

/* --- app shell ---
   VIEWPORT UNIT: `svh`, not `dvh`. Kids reach this app through the iOS Camera
   app's QR banner, which opens in-browser Safari — so the collapsing-toolbar
   case is the normal case, not an edge case. `dvh` re-resolves as that toolbar
   animates, which reflows the whole screen mid-scroll; `svh` is the smallest
   (toolbar-visible) height and never changes. Sized to `svh`, a screen always
   fits without the browser chrome having to move. */
.app { min-height: 100svh; }
.shell {
  min-height: 100svh;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

/* --- base screen ---
   NOTE the `0px` (not `0`) fallbacks below: `calc(0 + 22px)` is invalid — a
   <number> can't be added to a <length> — so the whole declaration would be
   dropped, taking the 22px with it, on any engine that fell back. */
.screen {
  flex: 1;
  min-height: 100svh;
  padding-top: calc(env(safe-area-inset-top, 0px) + 22px);
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 26px);
  /* Landscape: the notch/Dynamic Island intrudes on what is now a long edge.
     In-browser Safari rotates freely (the manifest's `orientation` only binds
     in standalone), so the side padding has to clear it. */
  padding-left: max(22px, env(safe-area-inset-left, 0px));
  padding-right: max(22px, env(safe-area-inset-right, 0px));
  display: flex;
  flex-direction: column;
  gap: var(--gr-gap);
}

/* ready-gate fade-in (ADR-0011). Screens that opt in start hidden. */
.screen-intro,
.screen-map { opacity: 0; transition: opacity .28s ease; }
.screen-intro.is-ready,
.screen-map.is-ready { opacity: 1; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  font-family: var(--gr-font-display);
  font-size: 1.05rem;
  letter-spacing: .02em;
  border: none;
  border-radius: var(--gr-radius);
  padding: 14px 20px;
  cursor: pointer;
  color: var(--gr-ink);
  background: transparent;
  transition: transform .06s ease, filter .15s ease;
  /* No 300ms double-tap-zoom wait, and no text-selection callout on the
     long-presses kids inevitably give a big orange button. `:active` below
     still supplies the press feedback. */
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.btn:active { transform: translateY(1px) scale(.99); }

.btn--gold {
  /* AA (ADR-0013): a --gr-ink label on a light-gold → gold gradient. The darkest
     pixel behind the label is --gr-gold (≈5.6:1 with ink); the 3D "stamped" lip
     comes from the gold-deep border + hard shadow, not a dark gradient bottom. */
  background: linear-gradient(180deg, var(--gr-gold-hi), var(--gr-gold));
  color: var(--gr-ink);
  box-shadow: 0 3px 0 var(--gr-gold-deep), 0 6px 14px var(--gr-shadow);
  border: 2px solid var(--gr-gold-deep);
}
.btn--gold:active { box-shadow: 0 1px 0 var(--gr-gold-deep), 0 3px 8px var(--gr-shadow); }

.btn--ghost {
  background: rgba(255,255,255,.35);
  border: 2px solid var(--gr-gold-deep);
  color: var(--gr-ink);
}
.btn--link {
  background: none; border: none; color: var(--gr-ink-soft);
  text-decoration: underline; font-family: var(--gr-font-body);
  font-size: .9rem; padding: 8px;
}
.btn--big { font-size: 1.35rem; padding: 20px; width: 100%; }

/* ==========================================================================
   Intro
   ========================================================================== */
.screen-intro { align-items: center; justify-content: center; text-align: center; }
.intro__logo { width: 190px; height: 190px; filter: drop-shadow(0 6px 12px var(--gr-shadow)); }
.intro__title {
  font-family: var(--gr-font-display);
  font-size: 2.4rem; margin: 6px 0 0; color: var(--gr-gold-deep);
  text-shadow: 1px 1px 0 rgba(255,255,255,.5);
}
.intro__tagline { font-size: 1.1rem; margin: 0; color: var(--gr-ink); }
.intro__preview { font-family: var(--gr-font-display); color: var(--gr-ink-soft); margin: 4px 0 10px; }
.intro__cta { width: 100%; max-width: 340px; font-size: 1.3rem; padding: 18px; }
.intro__attribution,
.done__attribution { margin-top: 18px; font-size: .78rem; color: var(--gr-ink-soft); opacity: .8; }

/* ==========================================================================
   Trail Hub
   ========================================================================== */
/* App-shell layout: the screen is pinned to the viewport, the clue region in
   the middle is the only thing that scrolls, and the actions sit in a dock that
   is always on screen. `flex: none` is required for the height to be real (see
   .screen-map). `overflow-y: auto` is the text-zoom escape hatch — at 200% the
   dock outgrows the viewport and the whole screen must be able to scroll, or
   the restart link becomes unreachable. */
.screen-hub {
  flex: none;
  height: 100svh;
  overflow-y: auto;
  justify-content: flex-start;
  gap: 14px;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
}
.hub__header { display: flex; justify-content: center; }
/* An <h1> (ADR-0013 M4) styled to read like the former brand <span>: reset the
   UA heading margin + bold. It now owns the whole line — the counter moved to
   the dock — which is what stops the title/counter pair wrapping into a 2x2
   block. It must WRAP, never ellipsize: this is the document's only heading,
   and a wider brand font (ADR-0004) or 200% text zoom has to be able to take a
   second line rather than lose words. */
.hub__brand {
  font-family: var(--gr-font-display);
  font-size: clamp(1rem, 4.6vw, 1.2rem);
  font-weight: 400;
  color: var(--gr-gold-deep);
  margin: 0;
  text-align: center;
  white-space: normal;
  text-wrap: balance;
}
.hub__progress { font-family: var(--gr-font-display); font-size: .9rem; color: var(--gr-ink-soft); }
/* Rosario defaults to oldstyle figures ("0" at x-height reads like an "o",
   "9" descends); counters want lining digits. */
.hub__progress,
.map__progress,
.found__progress { font-variant-numeric: lining-nums; }

.hub__clue-card {
  background: rgba(255,255,255,.45);
  border: 2px dashed var(--gr-gold-deep);
  border-radius: var(--gr-radius);
  padding: 22px 20px;
  margin-top: 8px;
  box-shadow: inset 0 0 24px rgba(138,90,18,.08);
}
.hub__clue-label,
.found__next-label {
  font-family: var(--gr-font-display);
  text-transform: uppercase; letter-spacing: .12em;
  font-size: .8rem; color: var(--gr-rust); margin: 0 0 8px;
}
.hub__clue { font-size: 1.35rem; line-height: 1.4; margin: 0; }
/* First-visit orientation (Chloe's check-in-sheet kickoff, email 2026-07-22). */
.hub__howto { font-size: .95rem; color: var(--gr-ink-soft); margin: 0; }

/* The one scrolling region on the hub. Holds the clue and the first-visit
   orientation line; everything else is pinned. Focusable in its own right
   (tabindex="0" in the markup) because a scroll container with no focusable
   descendant is unreachable by keyboard in Chrome and Safari.

   The mask is a scroll cue that needs no script: its 16px band matches this
   element's own padding-bottom, so it is invisible when the content fits
   (nothing is in the band), fades the cut-off line while there is more below,
   and lands on empty padding once scrolled to the end. */
.hub__content {
  flex: 1 1 0;
  min-height: 8rem; /* rem, so text zoom grows it and the screen scrolls instead */
  overflow-y: auto;
  overscroll-behavior: contain; /* keep the gesture from chaining to the page */
  scroll-padding-block: 8px;
  display: flex; flex-direction: column; gap: 14px;
  margin: 0 -4px;               /* bleed so the card's shadow isn't clipped */
  /* --cue drives BOTH the padding and the mask band; they must stay equal or
     the fade starts eating legible text instead of empty space. */
  --cue: 16px;
  padding: 2px 4px var(--cue);
  -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - var(--cue)), transparent);
  mask-image: linear-gradient(180deg, #000 calc(100% - var(--cue)), transparent);
}
.hub__content:focus-visible {
  /* Inset, or the parent's overflow clips the ring. */
  outline: 3px solid var(--gr-ink);
  outline-offset: -3px;
}

/* Trail-progress strip: now the top of the dock, with the counter as its
   caption — the text sits next to the graphic it describes, and the dots stay
   aria-hidden because that caption carries the same fact.
   Dashed hollow dot = not yet found, filled = found, ringed pulse = current. */
.hub__trail {
  display: flex; align-items: center; justify-content: center;
  gap: 7px;
}
.hub__trailwrap {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.hub__trail-dot {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid var(--gr-gold-deep);
  opacity: .3;
}
.hub__trail-dot.is-found {
  background: linear-gradient(180deg, var(--gr-gold-hi), var(--gr-gold));
  opacity: 1;
}
.hub__trail-dot.is-current {
  opacity: 1;
  animation: gr-beacon 2.2s ease-in-out infinite;
}
@keyframes gr-beacon {
  0%, 100% { box-shadow: 0 0 0 0 rgba(17, 76, 114, .35); }
  50%      { box-shadow: 0 0 0 5px rgba(17, 76, 114, 0); }
}

/* The dock — in normal flow, not fixed/sticky: the screen is already pinned, so
   the actions stay on screen without any of position:fixed's iOS failure modes
   (detaching during the toolbar animation, and silently becoming absolute if an
   ancestor ever gains a transform). The dashed rule doubles as the boundary
   telling you the clue region ended. */
.hub__dock {
  display: flex; flex-direction: column; gap: 12px;
  border-top: 1px dashed var(--gr-gold-deep);
  padding-top: 12px;
}
.hub__scan { margin-top: 0; }
.hub__row { display: flex; gap: 12px; }
.hub__row .btn { flex: 1; }

/* Short viewports are the NORMAL iPhone Safari case, not an edge case: a
   390x844 phone leaves 664px once the browser chrome is counted, and an
   SE-class leaves ~620. Scale type and padding down here so the LONGEST real
   clue (station 1) plus the ADR-0010 orientation line both fit with nothing
   clipped at rest. Verified 0px hidden at 390x664 and 375x620. */
@media (max-height: 700px) {
  .screen-hub { gap: 10px; }
  .hub__clue { font-size: 1.15rem; line-height: 1.35; }
  .hub__clue-card { padding: 16px; }
  .hub__howto { font-size: .875rem; }
  .hub__dock { gap: 8px; }
  .screen-hub .btn--big { padding: 16px; font-size: 1.25rem; }
}
@media (max-height: 640px) {
  .screen-hub { gap: 8px; }
  .hub__clue { font-size: 1.1rem; }
  .hub__clue-card { padding: 14px; }
  .hub__content { gap: 8px; --cue: 10px; }
  .hub__howto { font-size: .85rem; line-height: 1.35; }
  .hub__dock { padding-top: 10px; }
  .hub__trailwrap { gap: 3px; }
}

/* ==========================================================================
   Scan
   ========================================================================== */
/* Pinned like the hub, so the manual-code fallback below the camera is always
   on screen instead of pushed past the fold. */
.screen-scan {
  flex: none;
  height: 100svh;
  overflow-y: auto;
  justify-content: flex-start;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
}
.scan__header { display: flex; align-items: center; gap: 10px; }
.scan__title { font-family: var(--gr-font-display); font-size: 1.4rem; margin: 0; }
.scan__back { min-height: 44px; padding: 10px 14px; } /* ≥44px target (ADR-0013 m2) */
/* The camera FLEXES to whatever height is left rather than holding a fixed 3:4
   box. A fixed ratio is what pushed the hint and the manual-entry fallback off
   the bottom of the screen; now opening that fallback shrinks the preview
   instead of shifting content out of view. */
.scan__viewport {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 160px;
  border-radius: var(--gr-radius);
  overflow: hidden;
  background: #1c130a;
  border: 3px solid var(--gr-gold-deep);
  box-shadow: 0 6px 18px var(--gr-shadow);
}
.scan__video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan__canvas { display: none; }
/* Square, and centred — QR codes are square, and now that the viewport is a
   flexible box a percentage inset would draw a tall rectangle that teaches the
   wrong framing. */
.scan__reticle {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(62%, 320px);
  aspect-ratio: 1;
  border: 3px solid rgba(255,248,230,.85);
  border-radius: 18px;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.25);
}
.scan__hint { text-align: center; color: var(--gr-ink-soft); margin: 4px 0; }
.scan__toast {
  text-align: center; font-family: var(--gr-font-display);
  background: var(--gr-rust); color: #fff8e6;
  padding: 10px 14px; border-radius: var(--gr-radius); margin: 0;
}
.scan__toast-msg { margin: 0; }
/* Clue replay on an out-of-order refusal (ADR-0015). */
.scan__toast-label {
  margin: 10px 0 2px; font-size: .8rem; letter-spacing: .06em;
  text-transform: uppercase; opacity: .85;
}
.scan__toast-clue { margin: 0 0 10px; font-family: var(--gr-font-body); }
.scan__manual { border-top: 1px dashed var(--gr-gold-deep); padding-top: 12px; margin-top: 8px; }
.scan__manual summary { cursor: pointer; color: var(--gr-ink-soft); font-family: var(--gr-font-display); min-height: 44px; padding: 12px 2px; } /* ≥44px target (ADR-0013 m2) */
/* Stacked, not side by side: squeezed next to the input, "Check it" wrapped to
   two lines and read as broken. Two full-width rows are also a bigger target. */
.scan__manual-row { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.scan__manual-row .btn { width: 100%; }
/* Typing the code means the camera is not the path being used — collapse it so
   the field clears the iOS keyboard. dvh/svh track browser chrome, not the
   keyboard, so on a pinned screen the input would otherwise sit underneath it.
   Progressive enhancement: without :has() this is exactly today's behavior. */
.screen-scan:has(.scan__manual-input:focus) .scan__viewport {
  flex: 0 1 0;
  min-height: 0;
  border-width: 0;
  box-shadow: none;
}
.scan__manual-input {
  flex: 1; padding: 12px; font-size: 1.1rem;
  border: 2px solid var(--gr-gold-deep); border-radius: var(--gr-radius);
  background: rgba(255,255,255,.7); color: var(--gr-ink); font-family: var(--gr-font-body);
}
.scan__error { text-align: center; padding: 20px; }
.scan__error-title { font-family: var(--gr-font-display); font-size: 1.2rem; color: var(--gr-rust); margin: 0 0 8px; }
.scan__error-body { color: var(--gr-ink-soft); margin: 0; }

/* ==========================================================================
   Found (success)
   ========================================================================== */
.screen-found { align-items: center; justify-content: center; text-align: center; }
.found__badge { font-size: 4rem; line-height: 1; animation: gr-pop .4s ease; }
@keyframes gr-pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.found__title { font-family: var(--gr-font-display); font-size: 2.1rem; color: var(--gr-gold-deep); margin: 6px 0 0; }
.found__name { font-size: 1.3rem; margin: 0; color: var(--gr-ink); font-style: italic; }
.found__progress { font-family: var(--gr-font-display); color: var(--gr-ink-soft); margin: 2px 0 10px; }
.found__next {
  background: rgba(255,255,255,.45);
  border: 2px dashed var(--gr-gold-deep);
  border-radius: var(--gr-radius);
  padding: 20px; width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: 14px;
}
.found__next-hint { font-size: 1.25rem; line-height: 1.4; margin: 0; }
/* CTA sits below the clue card (not inside it), matching the card's width. */
.found__cta { width: 100%; max-width: 380px; }

/* ==========================================================================
   Map (progress)
   ========================================================================== */
.screen-map {
  justify-content: flex-start;
  /* Definite height: pins the screen to the viewport so nothing can scroll
     and gives .map__canvas a definite height to fill.
     `flex: none` is load-bearing: .screen sets `flex: 1`, i.e. `flex-basis: 0%`
     plus grow — and for a flex item, flex-basis wins over `height` for the main
     size. Without this the height below is inert and the box is whatever the
     flex algorithm makes it; it only looked correct because .map__canvas
     happens to shrink. Opting out of flex sizing makes the height real. */
  flex: none;
  height: 100svh;
  /* Orientation zoom (ADR-0006 pivot): the parchment renders this many times
     the canvas width, centered on the start pin. The placer's phone preview
     (scripts/mapgen/place_pins.py) reads this token — keep it a bare number. */
  --map-zoom: 2.4;
}
.map__header { display: flex; align-items: center; gap: 12px; height: 52px; }
.map__progress { font-family: var(--gr-font-display); color: var(--gr-ink-soft); }
.map__canvas {
  /* Centered-on-start view (ADR-0006 orientation pivot): the canvas is a
     window onto the zoomed parchment; the art overflows on every side. */
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}
.map__inner {
  /* The art at zoom: --map-zoom × the canvas width, 1:2 by aspect-ratio.
     left/top put the box's origin at the canvas center; the inline transform
     (set from the pin's % coords in map.rs) then slides the art so the start
     pin lands exactly on that center — no JS measurement, any viewport. */
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--map-zoom) * 100%);
  aspect-ratio: 1 / 2;
}
.map__parchment { display: block; width: 100%; height: 100%; }
.map__start {
  /* Anchor the BADGE's center (48px tall, border-box) on the pin point — the
     label hangs below. A plain -50% would center the whole column and float
     the star ~11px above the real spot. */
  position: absolute; transform: translate(-50%, -24px);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.map__start-badge {
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  background: radial-gradient(circle, var(--gr-gold), var(--gr-gold-deep));
  border: 3px solid var(--gr-parchment);
  box-shadow: 0 3px 10px var(--gr-shadow);
  animation: map-start-pulse 2.4s ease-in-out infinite;
}
.map__start-label {
  font-family: var(--gr-font-display); font-weight: 700; font-size: .8rem;
  color: var(--gr-gold-deep);
  background: var(--gr-parchment);
  border: 1.5px solid var(--gr-gold-deep); border-radius: 10px;
  padding: 0 8px;
}
@keyframes map-start-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* ==========================================================================
   Completion
   ========================================================================== */
.screen-completion { align-items: center; justify-content: center; text-align: center; }
.done__burst { font-size: 4.5rem; animation: gr-pop .5s ease; }
.done__title { font-family: var(--gr-font-display); font-size: 2.6rem; color: var(--gr-gold-deep); margin: 4px 0 0; }
.done__sub { font-size: 1.1rem; margin: 4px 0 6px; max-width: 360px; }
/* Chloe's photo call-to-action + sign-off (ADR-0015). */
.done__cta { font-size: 1rem; margin: 2px 0 8px; max-width: 360px; }
.done__signoff {
  font-family: var(--gr-font-display); font-size: 1rem;
  color: var(--gr-rust); margin: 12px 0 0; max-width: 340px;
}
.done__photo { max-width: 340px; }

/* ==========================================================================
   Photo finish (ADR-0016) — the closing family photo at the Western Town.
   Capture screen mirrors the scanner's viewport so the app only ever presents
   the camera one way.
   ========================================================================== */
/* Mirrors the scanner exactly — same pinned screen, same flexing viewport — so
   the app still only ever presents the camera one way. */
.screen-photo {
  flex: none;
  height: 100svh;
  overflow-y: auto;
  justify-content: flex-start;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
}
.photo__header { display: flex; align-items: center; gap: 10px; }
.photo__title { font-family: var(--gr-font-display); font-size: 1.4rem; margin: 0; }
.photo__back { min-height: 44px; padding: 10px 14px; } /* ≥44px target (ADR-0013 m2) */
.photo__viewport {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 160px;
  border-radius: var(--gr-radius);
  overflow: hidden;
  background: #1c130a;
  border: 3px solid var(--gr-gold-deep);
  box-shadow: 0 6px 18px var(--gr-shadow);
}
.photo__video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* The selfie preview reads as a mirror, like every phone camera app. The
   captured frame is drawn from the unmirrored stream, so the saved photo has
   the world the right way round. */
.photo__video.is-mirrored { transform: scaleX(-1); }
.photo__canvas { display: none; }
.photo__hint { text-align: center; color: var(--gr-ink-soft); margin: 4px 0; }
.photo__controls {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  margin-top: auto;
}
.photo__shutter {
  width: 78px; height: 78px; border-radius: 50%; padding: 0;
  font-size: 2rem; line-height: 1;
  background: linear-gradient(180deg, var(--gr-gold-hi), var(--gr-gold));
  border: 4px solid var(--gr-gold-deep);
  box-shadow: 0 3px 0 var(--gr-gold-deep), 0 6px 14px var(--gr-shadow);
}
.photo__shutter:active { box-shadow: 0 1px 0 var(--gr-gold-deep), 0 3px 8px var(--gr-shadow); }
/* Camera swap — floats over the preview's top-right corner (48px ≥ the 44px
   target, ADR-0013 m2). */
.photo__flip {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 48px; height: 48px; padding: 0;
  border-radius: 50%;
  font-size: 1.4rem; line-height: 1;
  background: rgba(244, 239, 230, .85);
  border: 2px solid var(--gr-gold-deep);
  box-shadow: 0 3px 10px var(--gr-shadow);
}
.photo__error { text-align: center; padding: 20px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.photo__error-title { font-family: var(--gr-font-display); font-size: 1.2rem; color: var(--gr-rust); margin: 0; }
.photo__error-body { color: var(--gr-ink-soft); margin: 0; max-width: 340px; }

.screen-photo-done { align-items: center; justify-content: center; text-align: center; }
.photo__shot {
  width: 100%; max-width: 360px; display: block;
  border-radius: var(--gr-radius);
  border: 3px solid var(--gr-gold-deep);
  box-shadow: 0 6px 18px var(--gr-shadow);
}
.photo-done__title { font-family: var(--gr-font-display); font-size: 2rem; color: var(--gr-gold-deep); margin: 6px 0 0; }
/* The prize-claim line IS this screen — sized to outrank the buttons below.
   --gr-rust on parchment cleared 4.5:1 as body text, so it's safe at any size. */
.photo-done__claim {
  font-family: var(--gr-font-display); font-size: 1.75rem; font-weight: 700;
  line-height: 1.25;
  color: var(--gr-rust); margin: 2px 0 4px; max-width: 380px;
}
.photo-done__save-hint {
  font-size: .95rem; color: var(--gr-ink-soft); margin: 4px 0 0;
}
.photo-done__actions {
  display: flex; flex-direction: column; gap: 10px;
  width: 100%; max-width: 340px;
}

/* ==========================================================================
   Start-over pop-out (ADR-0001) — two taps to reset. Hosted by the Hub,
   Completion and PhotoDone screens.

   In normal flow at the very bottom of the screen, last in DOM and focus
   order — not the fixed bottom-right pill it used to be. Three reasons that
   floating pill had to go: it sat on top of content at all times, its position
   drifted with content length so nobody could learn it, and a fixed element is
   the one thing iOS Safari detaches during its toolbar animation.

   It stays a *link*, not a button: this is the one destructive control in a
   kids' app, and it should not read as a peer of "Scan a Stop". What is
   demoted is the ink — the 44px target (ADR-0013 m2) and the two-tap confirm
   are untouched.
   ========================================================================== */
.restart {
  display: flex;
  justify-content: center;
  margin-top: 18px; /* ≥28px clear of the control above it */
}
.restart__pill {
  min-height: 44px; /* ≥44px target (ADR-0013 m2) */
  padding: 10px 16px;
  font-size: .9rem;
  color: var(--gr-ink-soft);
  background: none;
  border: none;
  box-shadow: none;
  text-decoration: underline;
}
.restart__bar {
  background: var(--gr-parchment);
  border: 2px solid var(--gr-gold-deep);
  border-radius: var(--gr-radius);
  box-shadow: 0 6px 18px var(--gr-shadow);
  padding: 14px 16px;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: gr-pop .18s ease;
}
.restart__msg { margin: 0; font-size: .95rem; color: var(--gr-ink); }
.restart__actions { display: flex; gap: 8px; }
.restart__actions .btn { flex: 1; font-size: .95rem; padding: 10px 12px; min-height: 44px; }

/* ==========================================================================
   Storage notice (src/webview.rs) — "your trail won't be saved here"

   Fixed, not in flow. Every screen is exactly 100svh, so a bar that occupied
   its own height would push all of them into a document scroll — the one thing
   the body rules above go out of their way to avoid.

   Which is why it collapses to a strip. Overlaying means it lands on whatever
   the screen has at the top, and on the Hub that is the clue card, whose top
   edge sits ~68px down (screen padding + the <h1> + gap). The full message
   cannot fit in 68px; a 44px strip can, so the clue stays whole until the
   player chooses to read the rest.

   Terracotta rather than a new alarm red: --gr-rust is the palette's warning
   ink and is documented AA as text on parchment (ADR-0004/0013), so the brand
   swap keeps working — no color here that isn't already a :root token.
   ========================================================================== */
.notice {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  max-width: 520px; /* tracks .shell */
  margin: 0 auto;
}
.notice__strip,
.notice__panel {
  width: 100%;
  /* Opaque: these overlay live content, so text underneath must not read
     through them. */
  background: var(--gr-parchment);
  border: 2px solid var(--gr-rust);
  border-top: none;
  border-radius: 0 0 var(--gr-radius) var(--gr-radius);
  box-shadow: 0 6px 18px var(--gr-shadow);
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px;
}
/* The collapsed state: one tappable line that clears the Hub's clue card. */
.notice__strip {
  min-height: 44px; /* ≥44px target (ADR-0013 m2) */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--gr-font-display);
  font-size: .9rem;
  text-align: left;
  color: var(--gr-rust);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.notice__more {
  color: var(--gr-gold-deep);
  text-decoration: underline;
  white-space: nowrap;
}
.notice__panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
/* Focused by script on expand so its text is announced; not in the tab order,
   so suppress the container ring the way .screen does. */
.notice__panel:focus { outline: none; }
.notice__head {
  margin: 0;
  font-family: var(--gr-font-display);
  font-size: 1.05rem;
  color: var(--gr-rust);
}
.notice__detail { margin: 0; font-size: .9rem; line-height: 1.4; color: var(--gr-ink); }
/* The address is the actionable part — typed by hand into a real browser, as
   on the printed Start-Here card. Break anywhere rather than overflow: a long
   host on a narrow phone must stay fully readable. */
.notice__address {
  margin: 0;
  font-family: var(--gr-font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--gr-gold-deep);
  overflow-wrap: anywhere;
  /* Selectable, unlike .btn — long-press to copy is the only copy path an
     embedded browser reliably leaves open. */
  user-select: text;
  -webkit-user-select: text;
}
/* Address left, dismiss right, on one row. Wraps rather than crushes the button
   if a longer host than samlarc.crossgen-ai.com ever needs the width. */
.notice__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.notice__dismiss {
  margin-left: auto; /* stays right even when the address is absent */
  min-height: 44px; /* ≥44px target (ADR-0013 m2) */
  padding: 10px 18px;
  font-size: .95rem;
}

/* ==========================================================================
   Accessibility utilities (ADR-0013)
   ========================================================================== */

/* Visually-hidden but exposed to assistive tech — used for the Map screen's
   <h1> (its title has no natural visible slot; the map is cosmetic, ADR-0006). */
.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;
}

/* Visible keyboard focus — a high-contrast ink ring readable over both the gold
   buttons and the parchment. Interactive controls only. */
.btn:focus-visible,
.notice__strip:focus-visible,
.scan__manual-input:focus-visible,
.scan__manual summary:focus-visible {
  outline: 3px solid var(--gr-ink);
  outline-offset: 2px;
}
/* The screen <main> is focused by script on route change (M3) for SR
   announcement; it's not in the tab order (tabindex=-1), so suppress its
   container ring — the controls inside keep their own focus-visible ring. */
.screen:focus { outline: none; }

/* ==========================================================================
   Reduced motion (ADR-0013) — neutralize non-essential motion with static
   equivalents: no spinner spin, no pop/burst, no fade-in, no button/marker
   movement. Essential meaning is always also conveyed as text.
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  /* Splash spinner → a static full gold ring (no spin, no gap). */
  .splash__spinner {
    animation: none;
    border-top-color: var(--gr-gold-deep);
  }
  /* Badge / burst celebrations → appear in their final state, no pop. */
  .found__badge,
  .done__burst,
  .restart__bar { animation: none; }
  /* Ready-gate fade-in → appear instantly. */
  .screen-intro,
  .screen-map,
  .screen-intro.is-ready,
  .screen-map.is-ready { opacity: 1; transition: none; }
  /* Buttons → no press transform / transition. */
  .btn { transition: none; }
  .btn:active { transform: none; }
  /* Start pin → hold still, no pulse. */
  .map__start-badge { animation: none; }
  /* Hub trail strip → current-stop beacon holds still. */
  .hub__trail-dot.is-current { animation: none; }
}
