/* Character Trail — mobile-first styles.

   The colour variables are the trail's theme: a trail config may
   override any of them through its "theme" block (app.js writes them
   onto :root), so nothing below hard-codes a brand colour. */

:root {
  --ink: #24211c;
  --paper: #f7f1e3;
  --card: #fffdf7;
  --primary: #002147;
  --accent: #c8a44d;
  --success: #2e7d32;
  --danger: #a4382c;
  --muted: #6b6455;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(36, 33, 28, 0.18);
}

* {
  box-sizing: border-box;
}

/* The app shows and hides screens, sheets and buttons with the hidden
   attribute; this keeps it winning over any display rule below. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  touch-action: manipulation;
}

main {
  height: 100%;
}

h1 {
  font-size: 1.6rem;
  line-height: 1.2;
  color: var(--primary);
}

h2 {
  font-size: 1.1rem;
}

code {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* --- Screens ------------------------------------------------------ */

.screen--card {
  max-width: 620px;
  margin: 0 auto;
  padding: 1.25rem;
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.lede {
  font-size: 1.05rem;
}

.how-to {
  margin: 0;
  padding-left: 1.4rem;
  display: grid;
  gap: 0.4rem;
}

.note {
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--primary) 15%, transparent);
  border-radius: var(--radius);
  padding: 0.25rem 1rem;
}

.note-muted,
.privacy {
  color: var(--muted);
  font-size: 0.9rem;
}

/* --- Buttons ------------------------------------------------------ */

.btn {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 0.7rem 1rem;
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--primary);
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.btn--primary {
  background: var(--primary);
  color: #fff;
}

.btn--danger {
  border-color: var(--danger);
  color: var(--danger);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.3rem;
  color: inherit;
  text-decoration: none;
}

/* --- Map mode ----------------------------------------------------- */

.screen--map {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.map-topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0.5rem 0.4rem 1rem;
  padding-top: max(0.4rem, env(safe-area-inset-top));
  background: var(--primary);
  color: #fff;
}

.map-topbar-title {
  font-weight: 700;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-progress {
  font: inherit;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  min-height: 40px;
  font-size: 0.9rem;
  color: inherit;
  cursor: pointer;
}

.map-topbar :focus-visible {
  outline-color: #fff;
}

.map-viewport {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.map-canvas {
  position: relative;
  /* Keep the artwork legible on narrow phones; pan via native scroll. */
  width: max(100%, 640px);
}

.map-image {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-select: none;
}

/* --- Stop markers ------------------------------------------------- */

.stop-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid var(--primary);
  background: var(--card);
  color: var(--primary);
  font: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  padding: 0;
}

.stop-marker.is-collected {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.stop-marker img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  pointer-events: none;
}

.stop-marker.is-collected[data-face="stamp"] {
  background: var(--card);
  padding: 2px;
  animation: stamp-in 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
}

@keyframes stamp-in {
  from {
    transform: translate(-50%, -50%) scale(1.6);
  }
}

.stop-marker--finale {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--primary);
  font-size: 1.4rem;
}

.stop-marker--finale.is-locked {
  background: var(--card);
  border-style: dashed;
  color: var(--muted);
  border-color: var(--muted);
  box-shadow: none;
}

.stop-marker--finale:not(.is-locked):not(.is-collected) {
  animation: finale-pulse 1.6s ease-in-out infinite;
}

@keyframes finale-pulse {
  50% {
    box-shadow: 0 0 0 10px color-mix(in srgb, var(--accent) 35%, transparent);
  }
}

/* Highlight for the nearest uncollected stops after a scan.
   Gold glow that stays subtle over the illustrated map. */
.stop-marker.is-nearest {
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--accent) 35%, transparent),
    0 2px 12px rgba(36, 33, 28, 0.18);
  animation: nearest-pulse 2s ease-in-out infinite;
}

@keyframes nearest-pulse {
  50% {
    box-shadow:
      0 0 0 8px color-mix(in srgb, var(--accent) 25%, transparent),
      0 2px 12px rgba(36, 33, 28, 0.18);
  }
}

/* --- Stop bottom sheet -------------------------------------------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(36, 33, 28, 0.35);
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 620px;
  margin: 0 auto;
  background: var(--card);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -4px 20px rgba(36, 33, 28, 0.25);
  padding: 1rem 1.25rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transform: translateY(100%);
  transition: transform 0.25s ease;
}

.sheet.is-open {
  transform: translateY(0);
}

.sheet-kicker {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.sheet h2 {
  margin: 0;
  font-size: 1.3rem;
  color: var(--primary);
}

.sheet p {
  margin: 0;
}

.sheet-hint-photo {
  display: block;
  width: 100%;
  max-height: 40vh;
  object-fit: cover;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--primary) 6%, transparent);
}

.sheet-directions {
  color: var(--ink);
  font-size: 0.95rem;
}

.sheet-directions-label {
  font-weight: 700;
  color: var(--primary);
  margin-right: 0.3em;
}

.sheet-scan {
  /* Primary-styled Scan button — offered on every sheet, whether the
     stop is collected or not, so free-roam re-scanning works. */
  background: var(--primary);
  color: #fff;
}

/* --- Settings ----------------------------------------------------- */

.setting {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-height: 48px;
  padding: 0.6rem 0.9rem;
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--primary) 15%, transparent);
  border-radius: var(--radius);
  cursor: pointer;
}

.setting input {
  width: 24px;
  height: 24px;
  margin-top: 0.15rem;
  accent-color: var(--primary);
  flex: none;
}

.setting small {
  display: block;
  color: var(--muted);
}

/* --- AR scan mode ------------------------------------------------- */

.screen--ar {
  position: fixed;
  inset: 0;
  background: #000;
}

/* MindAR injects its camera feed and canvas as absolutely positioned
   children, so the stage is a plain full-bleed container.
   It sizes and offsets the camera video itself so that the feed and the
   3D projection share one framing, and A-Frame sizes its own canvas to
   the stage, so neither is given a size here: forcing them to 100% used
   to override MindAR's framing and left the character drawn away from
   the marker whenever the viewport was not the same shape as the camera
   frame (a phone held sideways, a tablet). The stage only has to clip
   whatever MindAR positions outside it. */
/* A-Frame's own enter-VR and enter-AR buttons have no place over a
   marker scan; the scene asks for them to be off, and this makes sure. */
.a-enter-vr,
.a-enter-ar,
.a-enter-vr-button,
.a-enter-ar-button {
  display: none !important;
}

.ar-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/* One wrapper per scan, so teardown can remove everything MindAR
   appended in a single step. */
.ar-session {
  position: absolute;
  inset: 0;
}

/* Field diagnostics (?diag=1): deliberately plain and dense. It sits
   above the camera picture during a scan, so it has to stay readable
   against anything behind it without hiding the marker view. */
.ar-diag {
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  top: 3.25rem;
  z-index: 4;
  background: rgba(0, 0, 0, 0.72);
  color: #e8ffe8;
  border-radius: 0.5rem;
  padding: 0.5rem 0.6rem;
  font-size: 0.7rem;
  line-height: 1.45;
}

.ar-diag pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

.ar-diag-copy {
  margin-top: 0.4rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.ar-gate,
.ar-error {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow-y: auto;
  background: var(--paper);
  padding: 1.25rem;
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.9rem;
  max-width: 620px;
  margin: 0 auto;
}

.ar-gate-kicker {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.ar-gate h2,
.ar-error h2 {
  margin: 0;
  font-size: 1.4rem;
  color: var(--primary);
}

.ar-gate-photo {
  display: block;
  width: 100%;
  max-height: 34vh;
  object-fit: cover;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--primary) 6%, transparent);
}

.ar-gate-hint,
.ar-error p {
  margin: 0;
}

.ar-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  /* The overlay is a HUD: only its own controls take pointer events,
     so taps pass through to the AR scene everywhere else. */
  pointer-events: none;
  display: flex;
  flex-direction: column;
}

.ar-topbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  padding-top: max(0.5rem, env(safe-area-inset-top));
  background: linear-gradient(rgba(0, 0, 0, 0.55), transparent);
  color: #fff;
}

.ar-exit {
  pointer-events: auto;
  min-height: 44px;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.ar-title {
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.ar-hud {
  margin: auto auto 0;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.95rem;
  text-align: center;
}

.ar-captions {
  margin: 0.6rem 0.75rem;
  margin-bottom: max(0.6rem, env(safe-area-inset-bottom));
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius);
  /* Near-opaque black behind white text: captions have to stay legible
     over an unpredictable camera image. */
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 1.05rem;
  line-height: 1.4;
  text-align: center;
  white-space: pre-line;
}

/* --- Reward + collection overlays ------------------------------- */

.reward {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  margin: 0 auto;
  background: var(--card);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -4px 20px rgba(36, 33, 28, 0.25);
  padding: 1.25rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.6rem;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.reward.is-open {
  transform: translateY(0);
}

.reward h2 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--primary);
}

.reward p {
  margin: 0;
}

.reward .btn {
  margin-top: 0.3rem;
}

.reward-stamp {
  width: 132px;
  height: 132px;
  animation: reward-pop 0.7s cubic-bezier(0.2, 1.4, 0.4, 1);
}

@keyframes reward-pop {
  0% {
    transform: scale(0.2) rotate(-25deg);
    opacity: 0;
  }
  60% {
    opacity: 1;
  }
}

.stamp-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 0.6rem;
  margin: 0.3rem 0;
}

.stamp {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.stamp img,
.stamp-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
}

/* Uncollected: an empty dashed ring with the stop number inside. */
.stamp-ring {
  display: grid;
  place-items: center;
  border: 3px dashed var(--muted);
  font-size: 1.1rem;
  font-weight: 700;
}

.stamp-name {
  line-height: 1.2;
}

.stamp.is-collected .stamp-name {
  color: var(--ink);
  font-weight: 600;
}

/* --- Offline panel + update toast --------------------------------- */

.offline-panel,
.keep-panel {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--primary) 15%, transparent);
  border-radius: var(--radius);
  padding: 0.75rem 1rem 1rem;
}

.offline-panel h2,
.keep-panel h2 {
  margin: 0;
}

/* Long and unmemorable by nature, so it is shown in a field the visitor
   can select from rather than as text they would have to transcribe. */
.keep-link {
  width: 100%;
  box-sizing: border-box;
  font-size: 0.85rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
  border-radius: calc(var(--radius) / 2);
  background: var(--paper);
  color: var(--ink);
}

.reward-install {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0 0 0.25rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 18%, var(--card));
  text-align: left;
}

.reward-install p {
  margin: 0;
  font-size: 0.95rem;
}

/* --- A giving trail's completion screen -------------------------- */

/* The charity block comes first and reads as the point of the screen:
   the charity's words, the running total, where the money goes. */
.reward-giving {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--primary) 9%, var(--card));
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  text-align: left;
}

.reward-giving-total {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.reward-giving-honesty {
  font-size: 0.85rem;
  color: var(--muted);
}

/* The divider and the card below it are deliberately quieter than the
   charity block above: a different thing, asked for separately. */
.reward-divider {
  width: 100%;
  border: 0;
  border-top: 1px solid color-mix(in srgb, var(--ink) 20%, transparent);
  margin: 0.5rem 0 0;
}

.reward-review {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--ink) 15%, transparent);
  text-align: left;
  font-size: 0.92rem;
  color: var(--muted);
}

.reward-review h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--ink);
}

/* --- The small act ----------------------------------------------- */

.act-sheet {
  text-align: center;
}

.act-prompt {
  font-size: 1.15rem;
  line-height: 1.4;
  color: var(--ink);
}

.act-options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
}

.act-option {
  width: 100%;
  font-size: 1.05rem;
  padding: 0.85rem 1rem;
}

/* Answers as pictures: two side by side, or a handful in rows. */
.act-options--pictures {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.7rem;
}

.act-picture {
  flex: 0 1 calc(50% - 0.35rem);
  max-width: 180px;
  padding: 0.3rem 0.3rem 0.45rem;
  border: 3px solid var(--accent);
  border-radius: 20px;
  background: var(--card);
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.2;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.act-picture img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 14px;
  display: block;
}

.act-picture:active {
  transform: scale(0.96);
}

.act-options--many .act-picture {
  flex-basis: calc(33.3% - 0.5rem);
  max-width: 124px;
  font-size: 0.72rem;
}

.act-list {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0.75rem 1rem 0.75rem 1.75rem;
  text-align: left;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 18%, var(--card));
  line-height: 1.6;
}

.act-list .is-pledge {
  font-weight: 700;
  color: var(--primary);
}

.act-list .is-pledge::after {
  content: ' (you chose this)';
  font-weight: 400;
  color: var(--muted);
}

.act-reply {
  font-size: 1.1rem;
  font-style: italic;
  color: var(--primary);
}

.offline-panel > div {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.offline-status {
  margin: 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: calc(100% - 2rem);
  padding: 0.6rem 0.6rem 0.6rem 1rem;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 0.95rem;
}

.toast-btn {
  min-height: 40px;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  border: 0;
  background: var(--accent);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* --- Seasonal decor ----------------------------------------------- */

/* Snow: two drifting layers of radial-gradient flakes, drawn above the
   paper and below every control. Pure CSS, no images, and it stays off
   the camera view. */
.decor {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

body.is-ar .decor {
  display: none;
}

.decor[data-decor="snow"]::before,
.decor[data-decor="snow"]::after {
  content: "";
  position: absolute;
  inset: -340px 0 0;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.95) 0 3px, transparent 4px),
    radial-gradient(circle, rgba(255, 255, 255, 0.8) 0 2px, transparent 3px);
  background-size: 180px 220px, 260px 300px;
  background-position: 20px 0, 140px 90px;
  animation: snow-fall 14s linear infinite;
  opacity: 0.7;
}

.decor[data-decor="snow"]::after {
  background-size: 300px 340px, 220px 260px;
  background-position: 90px 40px, 10px 160px;
  animation-duration: 22s;
  opacity: 0.45;
}

@keyframes snow-fall {
  to {
    transform: translateY(340px);
  }
}

/* Everything interactive sits above the decor layer. */
.screen--card,
.map-topbar {
  position: relative;
  z-index: 2;
}

.sheet-backdrop,
.sheet,
.reward {
  z-index: 3;
}

/* --- Dev overlay -------------------------------------------------- */

.dev-overlay {
  position: fixed;
  top: max(0.5rem, env(safe-area-inset-top));
  right: 0.5rem;
  z-index: 10;
  width: 230px;
  background: rgba(20, 24, 31, 0.88);
  color: #e8e6df;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.75rem;
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.dev-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.dev-body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* Collapsed, the panel is only its heading, so the map underneath can
   be tapped. It shrinks to fit rather than holding the full width. */
.dev-overlay.is-collapsed {
  width: auto;
}

.dev-toggle {
  font: inherit;
  line-height: 1;
  /* A real touch target: this is the control that gets the panel out
     of the way, so it has to be reachable with a thumb. */
  min-width: 2rem;
  min-height: 2rem;
  padding: 0;
  border-radius: 6px;
  border: 1px solid #a7a396;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
}

.dev-overlay h2 {
  margin: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.dev-overlay p {
  margin: 0;
}

.dev-hint {
  color: #a7a396;
}

.dev-overlay code {
  background: rgba(255, 255, 255, 0.08);
  color: #f7efd6;
  padding: 0.15em 0.35em;
  border-radius: 4px;
  font-size: 0.75rem;
  line-height: 1.6;
}

.dev-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.dev-field select {
  font: inherit;
  padding: 0.3rem;
  border-radius: 6px;
  border: 1px solid #a7a396;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
}

.dev-scan-btn {
  font: inherit;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: #f7efd6;
  cursor: pointer;
  text-align: left;
}

.dev-actions {
  display: flex;
  gap: 0.4rem;
}

.dev-actions button {
  flex: 1;
  font: inherit;
  padding: 0.35rem 0.2rem;
  border-radius: 6px;
  border: 1px solid #a7a396;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

/* --- Reduced motion ----------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .sheet,
  .reward {
    transition: none;
  }

  .stop-marker--finale:not(.is-locked),
  .stop-marker.is-nearest,
  .stop-marker.is-collected[data-face="stamp"],
  .reward-stamp,
  .decor[data-decor="snow"]::before,
  .decor[data-decor="snow"]::after {
    animation: none;
  }
}

/* --- Partner venues ----------------------------------------------- */

/* An offer on the map: a small tag, quieter than a stop until the
   trail has unlocked it. */
.venue-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 0 0.55rem;
  height: 28px;
  border-radius: 999px;
  border: 2px solid var(--accent);
  background: var(--card);
  color: var(--primary);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0.85;
}

.venue-marker.is-unlocked {
  background: var(--accent);
  opacity: 1;
}

.venue-logo {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: var(--radius);
  background: #fff;
  margin: 0 0 0.5rem;
}

.venue-offer {
  font-size: 1.1rem;
  font-weight: 600;
}

/* The code the visitor shows at the till: big and unmistakable across
   a counter. */
.venue-code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 1.6rem;
  letter-spacing: 0.12em;
  text-align: center;
  padding: 0.6rem 0.8rem;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: var(--paper);
}

.offers-list {
  display: grid;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.offer-item {
  display: grid;
  gap: 0.15rem;
  text-align: left;
  font: inherit;
  color: inherit;
  padding: 0.6rem 0.8rem;
  border: 1px solid rgba(36, 33, 28, 0.18);
  border-left: 5px solid var(--muted);
  border-radius: var(--radius);
  background: var(--card);
  cursor: pointer;
}

.offer-item.is-unlocked {
  border-left-color: var(--success);
}

.offer-item small {
  color: var(--muted);
}

.reward-note {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  background: var(--paper);
  font-style: italic;
}

.reward-offer {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  background: var(--paper);
  border-left: 5px solid var(--accent);
}

/* --- A trail nobody has to read ------------------------------------ */

/* The first screen: a picture, a name and one button. Its words wait
   on the grown-ups' screen. */
.landing-hero {
  display: block;
  width: min(100%, 46vh);
  margin: 0 auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.no-reading #screen-landing {
  min-height: 100%;
  justify-content: center;
  text-align: center;
}

.btn--start {
  min-height: 72px;
  font-size: 1.6rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

/* A triangle says "go" to someone who cannot read the word beside it. */
.btn--start::before {
  content: '';
  border-style: solid;
  border-width: 0.5em 0 0.5em 0.8em;
  border-color: transparent transparent transparent currentColor;
}

.landing-sound,
.landing-grownups {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.landing-grownups {
  text-decoration: underline;
  padding: 0.5rem;
}

.grownups {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.grownups p {
  margin: 0;
}

/* The map as a wall of frames: it fits the screen's width, and the
   whole of each frame is the thing to tap. */
.no-reading .map-canvas {
  width: 100%;
}

.stop-marker--frame,
.stop-marker--frame.is-collected,
.stop-marker--frame.is-collected[data-face="stamp"],
.stop-marker--frame.stop-marker--finale,
.stop-marker--frame.stop-marker--finale.is-locked,
.stop-marker--frame.is-nearest {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  box-shadow: none;
  animation: none;
}

/* The one to do next glows, and that is all the telling there is. */
.stop-marker--frame.is-next,
.stop-marker--frame.stop-marker--finale.is-next {
  box-shadow:
    0 0 0 3px var(--accent),
    0 0 18px 6px color-mix(in srgb, var(--accent) 75%, transparent);
  animation: frame-glow 1.6s ease-in-out infinite;
}

@keyframes frame-glow {
  50% {
    box-shadow:
      0 0 0 5px var(--accent),
      0 0 30px 12px color-mix(in srgb, var(--accent) 85%, transparent);
  }
}

/* One that cannot be opened yet is in the dark, behind a padlock. */
.stop-marker--frame.is-locked::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 3px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath d='M20 28v-8a12 12 0 0 1 24 0v8' fill='none' stroke='%23f3ead6' stroke-width='6' stroke-linecap='round'/%3E%3Crect x='12' y='28' width='40' height='30' rx='6' fill='%23f3ead6'/%3E%3Ccircle cx='32' cy='41' r='5' fill='%2316223f'/%3E%3Crect x='30' y='42' width='4' height='10' rx='2' fill='%2316223f'/%3E%3C/svg%3E")
      center / 34% no-repeat,
    rgba(10, 14, 30, 0.66);
}

/* What a collected frame has won, on a badge at its corner. */
.stop-badge {
  position: absolute;
  right: -7%;
  bottom: -5%;
  width: 46%;
  aspect-ratio: 1;
  padding: 2px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: var(--shadow);
  display: block;
  pointer-events: none;
}

.stop-badge img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

/* While the thing won is in the air, its place on the map waits. */
.stop-marker.is-awaiting .stop-badge,
.stop-marker.is-awaiting > img {
  visibility: hidden;
}

.stop-marker.is-landing .stop-badge,
.stop-marker.is-landing > img {
  animation: badge-land 0.6s cubic-bezier(0.2, 1.6, 0.4, 1);
}

@keyframes badge-land {
  from {
    transform: scale(1.5);
  }
}

/* No, said without a word. The marker is placed by its own transform,
   so the shake has to carry that with it. */
.stop-marker.is-refusing {
  animation: refuse 0.5s ease-in-out;
}

@keyframes refuse {
  0%,
  100% {
    transform: translate(-50%, -50%);
  }
  20%,
  60% {
    transform: translate(calc(-50% - 7px), -50%);
  }
  40%,
  80% {
    transform: translate(calc(-50% + 7px), -50%);
  }
}

/* The thing won: large in the middle of the screen, then away to its frame. */
.prize {
  position: fixed;
  left: 50%;
  top: 42%;
  width: min(62vw, 280px);
  aspect-ratio: 1;
  margin: calc(min(62vw, 280px) / -2) 0 0 calc(min(62vw, 280px) / -2);
  border-radius: 50%;
  z-index: 4;
  pointer-events: none;
  filter: drop-shadow(0 8px 22px rgba(0, 0, 0, 0.35));
  animation: reward-pop 0.7s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.prize.is-flying {
  animation: none;
  transition: transform 0.75s cubic-bezier(0.5, 0, 0.3, 1);
}

/* What the stop leaves behind, for the grown-up to read aloud. */
.wall-note {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 2.6rem 0.6rem 0.9rem;
  padding-bottom: max(0.6rem, env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 1px solid color-mix(in srgb, var(--ink) 15%, transparent);
  font-size: 0.88rem;
  font-style: italic;
  color: var(--muted);
}

.wall-note p {
  margin: 0;
  flex: 1 1 100%;
}

.wall-note .btn {
  width: auto;
  min-height: 40px;
  font-style: normal;
}

.wall-note-close {
  position: absolute;
  top: 0.2rem;
  right: 0.3rem;
  width: 40px;
  height: 40px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 1.4rem;
  font-style: normal;
  color: var(--muted);
  cursor: pointer;
}

/* Where to put the picture: the corners of a frame, there while the
   camera is looking. */
.ar-finder {
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(72vw, 52vh);
  aspect-ratio: 4 / 5;
  transform: translate(-50%, -50%);
  background:
    linear-gradient(#fff, #fff) left top / 34px 4px no-repeat,
    linear-gradient(#fff, #fff) left top / 4px 34px no-repeat,
    linear-gradient(#fff, #fff) right top / 34px 4px no-repeat,
    linear-gradient(#fff, #fff) right top / 4px 34px no-repeat,
    linear-gradient(#fff, #fff) left bottom / 34px 4px no-repeat,
    linear-gradient(#fff, #fff) left bottom / 4px 34px no-repeat,
    linear-gradient(#fff, #fff) right bottom / 34px 4px no-repeat,
    linear-gradient(#fff, #fff) right bottom / 4px 34px no-repeat;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.7));
  animation: finder-breathe 1.8s ease-in-out infinite;
}

@keyframes finder-breathe {
  50% {
    transform: translate(-50%, -50%) scale(1.05);
    opacity: 0.65;
  }
}

/* The camera view slides up to keep the character in sight above a
   sheet: see makeRoom in app.js. */
.no-reading .ar-stage {
  transition: transform 0.3s ease;
}

/* Over the camera the sheet does not dim what is behind it: the
   character is answering there. */
.no-reading #act-sheet-backdrop {
  background: transparent;
}

.no-reading .act-sheet {
  padding-top: 0.8rem;
  gap: 0.5rem;
}

.no-reading .act-prompt {
  font-size: 1rem;
}

/* Once answered the sheet is a strip: the reply, small, and a way on. */
.no-reading .act-sheet.is-replied .act-prompt {
  display: none;
}

.no-reading .act-sheet.is-replied .act-reply {
  font-size: 1rem;
}

.no-reading .act-sheet.is-replied #act-continue {
  width: auto;
  min-height: 40px;
  align-self: center;
  padding: 0.4rem 1.4rem;
}

/* Lines are said and acted first. Written, they are the grown-up's. */
.no-reading .ar-captions {
  font-size: 0.95rem;
  padding: 0.45rem 0.8rem;
}

.no-reading .ar-hud {
  font-size: 0.85rem;
}

@media (prefers-reduced-motion: reduce) {
  .stop-marker--frame.is-next,
  .stop-marker.is-refusing,
  .stop-marker.is-landing .stop-badge,
  .stop-marker.is-landing > img,
  .prize,
  .ar-finder {
    animation: none;
  }

  .no-reading .ar-stage {
    transition: none;
  }
}
