/* ============================================================
   BrainBite Field Guide
   Layer 1: BrainBite design tokens (verbatim from the system)
   Layer 2: BrainBite component primitives (.bb-*), used as-is
   Layer 3: Field Guide domain components, composed from 1 and 2
   No new colour architecture, type scale, radius set or shadow set.
   ============================================================ */

/* ---------- LAYER 1 · TOKENS ---------- */
@font-face {
  font-family: "OpenDyslexic";
  src: url("https://cdn.jsdelivr.net/npm/open-dyslexic@1.0.3/woff/OpenDyslexic-Regular.woff") format("woff");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "OpenDyslexic";
  src: url("https://cdn.jsdelivr.net/npm/open-dyslexic@1.0.3/woff/OpenDyslexic-Bold.woff") format("woff");
  font-weight: 700;
  font-display: swap;
}
:root {
  /* core brand shades */
  --pr10: #8b57a2;
  --sc-teal10: #47bac0;
  --sc-pink10: #f17eb2;
  --sc-yellow10: #f1e150;
  --purple: #704682;
  --purple-strong: #52315a;
  --purple-hover: #7e488f;
  --teal: #1b767f;
  --teal-hover: #185e63;
  --teal-strong: #004043;
  --pink: #c61857;
  --pink-strong: #820f39;
  --yellow: #f1e150;
  --yellow-ink: #7a5a00;

  --nr01: #ffffff; --nr02: #fafafa; --nr03: #f1f1f1; --nr04: #e8e8e8;
  --nr06: #d5d5d5; --nr08: #a8a8a8; --nr10: #787878; --nr12: #575757;
  --nr13: #454545; --nr15: #161616;

  --error: #dd3412; --error-strong: #bc280f; --success: #188834;
  --warning: #c64e0c; --warning-alt: #d35e0d; --info: #1744c1;

  --text-strong: #161616;
  --text-weak: #454545;
  --text-weaker: #5c5c5c;
  --text-disabled: #787878;
  --text-on-color: #ffffff;
  --text-primary: #8c57a2;
  --text-primary-selected: #704682;
  --text-secondary: #c61857;
  --text-teal: #1b767f;
  --text-error: #bc280f;
  --text-warning: #d35e0d;
  --text-success: #188834;
  --text-info: #1744c1;

  --bg-base: #ffffff;
  --bg-weaker: #fafafa;
  --bg-weak: #e8e8e8;
  --bg-placeholder: #fafafa;
  --bg-disabled: #f1f1f1;
  --surface-card: #ffffff;
  --surface-muted: #fafafa;

  --bg-primary: #8b57a2;
  --bg-primary-strong: #704682;
  --bg-primary-weak: #e8dded;
  --bg-primary-weaker: #f9f6fa;
  --bg-secondary: #c61857;
  --bg-secondary-weak: #fce5f0;
  --bg-teal: #1b767f;
  --bg-teal-weak: #cdf2f4;
  --bg-yellow: #f1e150;
  --bg-yellow-weak: #fbf6c9;
  --bg-error: #dd3412; --bg-error-weak: #fef6f5;
  --bg-success: #188834; --bg-success-weak: #f1fdf6;
  --bg-warning: #c64e0c; --bg-warning-weak: #fff9f3;
  --bg-info: #1744c1; --bg-info-weak: #f2f5fd;

  --border: #e6e1ea;
  --border-strong: #d5d5d5;
  --stroke-primary: #8b57a2;
  --stroke-primary-weak: #d9c7e2;
  --stroke-teal: #1b767f;
  --stroke-error: #dd3412;
  --stroke-success: #188834;
  --stroke-disabled: #e8e8e8;

  --icon-strong: #161616;
  --icon-weak: #5c5c5c;
  --icon-primary: #8b57a2;
  --icon-teal: #1b767f;
  --icon-disabled: #a8a8a8;
  --ring: #8b57a2;

  /* type */
  --font-display: "Baloo 2", ui-rounded, "Trebuchet MS", system-ui, sans-serif;
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --tracking-display: -0.30px;
  --tracking-heading: -0.20px;

  --text-display-large: 36px;  --lh-display-large: 42px;
  --text-display-small: 26px;  --lh-display-small: 32px;
  --text-display-tiny: 24px;   --lh-display-tiny: 30px;
  --text-h1: 24px; --lh-h1: 30px;
  --text-h2: 20px; --lh-h2: 28px;
  --text-h3: 18px; --lh-h3: 26px;
  --text-h4: 16px; --lh-h4: 24px;
  --text-h5: 14px; --lh-h5: 20px;
  --text-body-default: 16px; --lh-body-default: 22px;
  --text-body-small: 14px;   --lh-body-small: 20px;
  --text-body-tiny: 12px;    --lh-body-tiny: 18px;
  --text-paragraph-small: 14px; --lh-paragraph-small: 24px;
  --text-caption-small: 12px;   --lh-caption-small: 16px;

  /* radius, space, shadow, motion */
  --radius-sm: 6px; --radius-md: 8px; --radius-lg: 10px;
  --radius-xl: 14px; --radius-2xl: 18px; --radius-3xl: 24px;
  --radius-pill: 999px;
  --radius-button: 12px; --radius-card: 12px; --radius-modal: 24px;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;
  --space-12: 48px; --space-16: 64px;
  --tap-min: 44px; --tap-kid: 56px;

  --shadow-xs: 0 1px 2px rgba(22, 22, 22, 0.06);
  --shadow-sm: 0 1px 3px rgba(22, 22, 22, 0.08), 0 1px 2px rgba(22, 22, 22, 0.04);
  --shadow-md: 0 4px 12px rgba(22, 22, 22, 0.08);
  --shadow-lg: 0 12px 28px rgba(22, 22, 22, 0.12);
  --shadow-xl: 0 24px 48px rgba(22, 22, 22, 0.16);
  --shadow-primary: 0 10px 24px rgba(112, 70, 130, 0.22);

  --ease-standard: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 150ms; --dur: 200ms; --dur-slow: 350ms;
  /* Decorative enhancement aliases follow the existing themed palette. */
  --polish-glare: color-mix(in srgb, var(--nr01) 38%, transparent);
  --polish-ripple: color-mix(in srgb, var(--stroke-primary) 45%, transparent);
  --polish-seed: var(--icon-teal);
  --polish-leaf: var(--bg-success);
  --polish-petal: var(--sc-pink10);
  --polish-gold: var(--bg-yellow);

  /* Field Guide aliases mapped to the shared Math / English course palette. */
  --stage-max: 1120px;
  --guide-paper: var(--bg-base);
  --journal-ground: var(--bg-primary-weaker);
  --journal-line: var(--border);
  --field-action: var(--bg-primary);
  --field-action-hover: var(--purple-hover);
  --field-action-edge: var(--purple-strong);
  --field-context: var(--bg-teal);
  --field-context-hover: var(--teal-hover);
  --field-context-edge: var(--teal-strong);
  --paper-shadow: var(--shadow-md);

  /* artwork plates (illustrations are dark-ink, so plates stay light in both themes) */
  --art-plate-teal: var(--bg-teal-weak);
  --art-plate-yellow: var(--bg-yellow-weak);
  --art-plate-purple: var(--bg-primary-weak);
  --art-plate-pink: var(--bg-secondary-weak);
  --art-plate-success: var(--bg-success-weak);

  /* Cards tinted by what they hold (home's books, places, the guide). Light,
     they are the art plates; dark, deep tints that keep white text readable.
     Anything drawn on a light art plate uses the fixed plate inks. */
  --card-teal: var(--art-plate-teal);
  --card-purple: var(--art-plate-purple);
  --card-yellow: var(--art-plate-yellow);
  --plate-ink: #1b767f;
  --plate-ink-purple: #704682;
  --plate-muted: #e9e4ed;
  --text-yellow: #7a5a00;
  --logo: #8b57a2;
  --text-danger: #bc280f;
  --stroke-danger: #dd3412;
  color-scheme: light;
}

/* BrainBite dark theme values, wired to the three viewer states */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --text-strong: #ffffff;
    --text-weak: #cbc3d1;
    --text-weaker: #a99fb1;
    --text-disabled: #7c7285;
    --text-primary: #c9a6db;
    --text-primary-selected: #d9bde8;
    --text-secondary: #f18db4;
    --text-teal: #7fcdd4;
    --text-success: #6fd68d;
    --text-warning: #f0a86a;
    --text-error: #ff9a86;
    --bg-base: #1c1120;
    --bg-weaker: #241528;
    --bg-weak: #3b2b42;
    --bg-disabled: #3b2b42;
    --surface-card: #271830;
    --surface-muted: #2c1c31;
    --bg-primary-weak: #45264d;
    --bg-primary-weaker: #241528;
    --bg-teal-weak: #14383c;
    --bg-yellow-weak: #3d3410;
    --bg-secondary-weak: #45182c;
    --bg-success-weak: #16321f;
    --bg-warning-weak: #3a2313;
    --bg-error-weak: #3d1c16;
    --bg-info-weak: #1a2344;
    --border: #3a2b42;
    --border-strong: #4a3a52;
    --ring: #b98fce;
    --icon-strong: #ffffff;
    --icon-weak: #a99fb1;
    --guide-paper: var(--bg-base);
    --journal-ground: var(--bg-primary-weaker);
    --journal-line: var(--border);
    --art-plate-teal: #dcefef;
    --art-plate-yellow: #ece0c0;
    --art-plate-purple: #ebdff4;
    --art-plate-pink: #f8e1e9;
    --art-plate-success: #dcefe1;
    --bg-placeholder: #241528;
    --stroke-primary-weak: #5a3d66;
    --stroke-disabled: #3a2b42;
    --text-info: #93a9f0;
    --icon-primary: #c9a6db;
    --icon-teal: #7fcdd4;
    --icon-disabled: #7c7285;
    --text-yellow: #ecd27a;
    --text-danger: #ff9a86;
    --stroke-danger: #ff9a86;
    --stroke-primary: #a877bf;
    --stroke-teal: #4fa9b0;
    --card-teal: #14383c;
    --card-purple: #3a2143;
    --card-yellow: #3d3410;
    --logo: #c9a6db;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --text-strong: #ffffff;
  --text-weak: #cbc3d1;
  --text-weaker: #a99fb1;
  --text-disabled: #7c7285;
  --text-primary: #c9a6db;
  --text-primary-selected: #d9bde8;
  --text-secondary: #f18db4;
  --text-teal: #7fcdd4;
  --text-success: #6fd68d;
  --text-warning: #f0a86a;
  --text-error: #ff9a86;
  --bg-base: #1c1120;
  --bg-weaker: #241528;
  --bg-weak: #3b2b42;
  --bg-disabled: #3b2b42;
  --surface-card: #271830;
  --surface-muted: #2c1c31;
  --bg-primary-weak: #45264d;
  --bg-primary-weaker: #241528;
  --bg-teal-weak: #14383c;
  --bg-yellow-weak: #3d3410;
  --bg-secondary-weak: #45182c;
  --bg-success-weak: #16321f;
  --bg-warning-weak: #3a2313;
  --bg-error-weak: #3d1c16;
  --bg-info-weak: #1a2344;
  --border: #3a2b42;
  --border-strong: #4a3a52;
  --ring: #b98fce;
  --icon-strong: #ffffff;
  --icon-weak: #a99fb1;
  --guide-paper: var(--bg-base);
  --journal-ground: var(--bg-primary-weaker);
  --journal-line: var(--border);
  --art-plate-teal: #dcefef;
  --art-plate-yellow: #ece0c0;
  --art-plate-purple: #ebdff4;
  --art-plate-pink: #f8e1e9;
  --art-plate-success: #dcefe1;
  --bg-placeholder: #241528;
  --stroke-primary-weak: #5a3d66;
  --stroke-disabled: #3a2b42;
  --text-info: #93a9f0;
  --icon-primary: #c9a6db;
  --icon-teal: #7fcdd4;
  --icon-disabled: #7c7285;
  --text-yellow: #ecd27a;
  --text-danger: #ff9a86;
  --stroke-danger: #ff9a86;
  --stroke-primary: #a877bf;
  --stroke-teal: #4fa9b0;
  --card-teal: #14383c;
  --card-purple: #3a2143;
  --card-yellow: #3d3410;
  --logo: #c9a6db;
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text-strong);
  background: var(--bg-primary-weaker);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: var(--tracking-heading);
  color: var(--text-strong);
  margin: 0;
  text-wrap: balance;
}
p { margin: 0; }
button { font: inherit; }
/* inline interface icons carry no class; artwork does (.sp, .marie, .thumb) */
svg:not([class]) { width: 1.15em; height: 1.15em; flex-shrink: 0; vertical-align: -0.18em; }
.species-image { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; }
[hidden] { display: none !important; }

.bb-display-small { font-family: var(--font-display); font-weight: 800; font-size: var(--text-display-small); line-height: var(--lh-display-small); letter-spacing: var(--tracking-display); }
.bb-display-tiny  { font-family: var(--font-display); font-weight: 800; font-size: var(--text-display-tiny); line-height: var(--lh-display-tiny); letter-spacing: var(--tracking-display); }
.bb-h1 { font-family: var(--font-display); font-weight: 700; font-size: var(--text-h1); line-height: var(--lh-h1); letter-spacing: var(--tracking-heading); }
.bb-h2 { font-family: var(--font-display); font-weight: 700; font-size: var(--text-h2); line-height: var(--lh-h2); letter-spacing: var(--tracking-heading); }
.bb-h3 { font-family: var(--font-display); font-weight: 700; font-size: var(--text-h3); line-height: var(--lh-h3); letter-spacing: var(--tracking-heading); }
.bb-h4 { font-family: var(--font-display); font-weight: 700; font-size: var(--text-h4); line-height: var(--lh-h4); letter-spacing: var(--tracking-heading); }
.bb-body       { font-family: var(--font-sans); font-weight: 400; font-size: var(--text-body-default); line-height: var(--lh-body-default); }
.bb-body-small { font-family: var(--font-sans); font-weight: 400; font-size: var(--text-body-small); line-height: var(--lh-body-small); }
.bb-body-small-strong { font-family: var(--font-sans); font-weight: 600; font-size: var(--text-body-small); line-height: var(--lh-body-small); }
.bb-body-tiny  { font-family: var(--font-sans); font-weight: 400; font-size: var(--text-body-tiny); line-height: var(--lh-body-tiny); }
.bb-paragraph-small { font-family: var(--font-sans); font-weight: 400; font-size: var(--text-paragraph-small); line-height: var(--lh-paragraph-small); }
.bb-caption-small { font-family: var(--font-sans); font-weight: 600; font-size: var(--text-caption-small); line-height: var(--lh-caption-small); }
.bb-eyebrow { font-family: var(--font-sans); font-weight: 700; font-size: 12px; line-height: 1; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-weaker); }

/* ---------- LAYER 2 · BrainBite primitives ---------- */
.bb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  font-family: var(--font-display); font-weight: 700; white-space: nowrap;
  border: 2px solid transparent; border-radius: var(--radius-button);
  cursor: pointer; text-decoration: none; user-select: none;
  transition: background-color var(--dur) var(--ease-standard), border-color var(--dur) var(--ease-standard),
              color var(--dur) var(--ease-standard), transform var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur) var(--ease-standard);
}
.bb-btn:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.bb-btn:active { transform: translateY(1px); }
.bb-btn:disabled, .bb-btn[aria-disabled="true"] { pointer-events: none; opacity: .5; }
.bb-btn svg { width: 1.15em; height: 1.15em; flex-shrink: 0; }
.bb-btn--sm { min-height: 36px; padding: 6px 14px; font-size: 14px; border-radius: 10px; }
.bb-btn--md { min-height: 44px; padding: 10px 16px; font-size: 16px; }
.bb-btn--lg { min-height: 52px; padding: 14px 24px; font-size: 18px; }
.bb-btn--pill { border-radius: var(--radius-pill); }
.bb-btn--icon { padding: 0; width: 44px; min-height: 44px; }
.bb-btn--block { width: 100%; }
.bb-btn--primary { background: var(--bg-primary); color: var(--text-on-color); }
.bb-btn--primary:hover { background: var(--purple-hover); }
.bb-btn--primary:active { background: var(--purple-strong); }
.bb-btn--secondary { background: var(--bg-base); color: var(--text-primary-selected); border-color: var(--stroke-primary); }
.bb-btn--secondary:hover { background: var(--bg-primary-weak); }
.bb-btn--tertiary { background: var(--teal); color: var(--text-on-color); }
.bb-btn--tertiary:hover { background: var(--teal-hover); }
.bb-btn--neutral { background: var(--bg-disabled); color: var(--text-strong); }
.bb-btn--neutral:hover { background: var(--bg-weak); }
.bb-btn--ghost { background: transparent; color: var(--text-primary-selected); }
.bb-btn--ghost:hover { background: var(--bg-primary-weak); }

.bb-card {
  background: var(--bg-base); border: 1px solid var(--border); border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm); overflow: hidden; color: var(--text-strong);
  display: flex; flex-direction: column;
}
.bb-card--interactive { cursor: pointer; transition: transform var(--dur) var(--ease-standard), box-shadow var(--dur) var(--ease-standard); }
.bb-card--interactive:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.bb-card--interactive:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.bb-card__body { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }

.bb-badge {
  display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-sans);
  font-weight: 700; font-size: 12px; line-height: 1; padding: 5px 10px;
  border-radius: 999px; border: 1px solid transparent;
}
.bb-badge svg { width: 13px; height: 13px; }
.bb-badge--primary { background: var(--bg-primary-weak); color: var(--text-primary-selected); }
.bb-badge--teal { background: var(--bg-teal-weak); color: var(--text-teal); }
.bb-badge--yellow { background: var(--bg-yellow-weak); color: var(--text-yellow); }
.bb-badge--neutral { background: var(--bg-weak); color: var(--text-weak); }
.bb-badge--success { background: var(--bg-success-weak); color: var(--text-success); }
.bb-badge--warning { background: var(--bg-warning-weak); color: var(--text-warning); }

.bb-tag {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-sans);
  font-weight: 600; font-size: 14px; padding: 6px 12px; border-radius: 999px;
  border: 1.5px solid var(--border); background: var(--bg-base); color: var(--text-strong);
  cursor: pointer; transition: background-color var(--dur), border-color var(--dur), color var(--dur);
}
.bb-tag:hover { border-color: var(--stroke-primary); background: var(--bg-primary-weaker); }
.bb-tag[data-selected="true"] { background: var(--bg-primary); border-color: var(--bg-primary); color: var(--text-on-color); }
.bb-tag:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

.bb-avatar { display: inline-grid; place-items: center; border-radius: 999px; overflow: hidden; background: var(--bg-primary-weak); flex-shrink: 0; }
.bb-avatar--md { width: 44px; height: 44px; }
.bb-avatar--lg { width: 64px; height: 64px; }

.bb-progress__track { height: 12px; border-radius: 999px; background: var(--bg-weak); overflow: hidden; }
.bb-progress__fill { display: block; height: 100%; border-radius: 999px; background: var(--bg-success); transition: width var(--dur-slow) var(--ease-standard); }

.bb-modal__overlay {
  position: fixed; inset: 0; background: color-mix(in oklab, var(--nr15) 58%, transparent);
  display: grid; place-items: center; padding: 16px; z-index: 100;
  animation: bb-fade var(--dur) var(--ease-standard);
}
.bb-modal {
  position: relative; background: var(--bg-base); border-radius: var(--radius-modal);
  box-shadow: var(--shadow-xl); width: 100%; max-width: 460px; max-height: 88vh;
  overflow: auto; padding: 24px; animation: bb-pop var(--dur-slow) var(--ease-spring);
}
.bb-modal__title { font-family: var(--font-display); font-weight: 800; font-size: var(--text-h1); line-height: 1.15; letter-spacing: var(--tracking-heading); margin-bottom: 6px; }
.bb-modal__body { font-family: var(--font-sans); font-size: 15px; line-height: 1.6; color: var(--text-weak); }
.bb-modal__actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.bb-modal__actions .bb-btn { flex: 1 1 auto; }
@keyframes bb-fade { from { opacity: 0; } }
@keyframes bb-pop { from { opacity: 0; transform: translateY(8px) scale(.97); } }

.bb-alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-xl); border: 1px solid transparent; }
.bb-alert__icon { flex-shrink: 0; width: 22px; height: 22px; display: grid; place-items: center; }
.bb-alert__icon svg { width: 20px; height: 20px; }
.bb-alert__title { display: block; font-family: var(--font-display); font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.bb-alert__msg { display: block; font-family: var(--font-sans); font-size: 14px; line-height: 1.5; color: var(--text-weak); }
.bb-alert--success { background: var(--bg-success-weak); border-color: color-mix(in oklab, var(--success) 26%, transparent); color: var(--text-success); }
.bb-alert--warning { background: var(--bg-warning-weak); border-color: color-mix(in oklab, var(--warning) 26%, transparent); color: var(--text-warning); }
.bb-alert--info { background: var(--bg-info-weak); border-color: color-mix(in oklab, var(--info) 22%, transparent); color: var(--text-info); }

.bb-bubble-row { display: flex; gap: 10px; align-items: flex-end; }
.bb-bubble { padding: 11px 14px; border-radius: 18px; font-family: var(--font-sans); font-size: 15px; line-height: 1.5; }
.bb-bubble__speaker { display: block; font-family: var(--font-display); font-weight: 700; font-size: 12px; margin-bottom: 2px; opacity: .85; }
.bb-bubble--mentor { background: var(--bg-primary-weak); color: var(--text-strong); border-bottom-left-radius: 6px; }
.bb-bubble--user { background: var(--bg-primary); color: var(--text-on-color); border-bottom-right-radius: 6px; }

.bb-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.bb-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.bb-switch__track { width: 46px; height: 28px; border-radius: 999px; background: var(--bg-weak); position: relative; transition: background-color var(--dur) var(--ease-standard); flex-shrink: 0; }
.bb-switch__thumb { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 999px; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--dur) var(--ease-spring); }
.bb-switch input:checked + .bb-switch__track { background: var(--bg-primary); }
.bb-switch input:checked + .bb-switch__track .bb-switch__thumb { transform: translateX(18px); }
.bb-switch input:focus-visible + .bb-switch__track { outline: 3px solid var(--ring); outline-offset: 2px; }

.bb-field { display: flex; flex-direction: column; gap: 6px; }
.bb-field__label { font-family: var(--font-sans); font-weight: 600; font-size: 14px; color: var(--text-strong); }
.bb-field__hint { font-family: var(--font-sans); font-size: 12px; line-height: 16px; color: var(--text-weaker); }
.bb-input {
  font-family: var(--font-sans); font-size: 15px; color: var(--text-strong);
  min-height: 44px; width: 100%; padding: 10px 14px;
  background: var(--bg-placeholder); border: 2px solid var(--border); border-radius: var(--radius-xl);
  outline: none; transition: border-color var(--dur), box-shadow var(--dur);
}
.bb-input::placeholder { color: var(--text-weaker); }
.bb-input:focus-visible { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 28%, transparent); }

.bb-tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--bg-disabled); border-radius: 999px; }
.bb-tab { font-family: var(--font-display); font-weight: 700; font-size: 14px; padding: 7px 14px; min-height: 40px; border-radius: 999px; border: none; background: transparent; color: var(--text-weak); cursor: pointer; }
.bb-tab[data-selected="true"] { background: var(--bg-base); color: var(--text-primary-selected); box-shadow: var(--shadow-sm); }
.bb-tab:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

/* ---------- LAYER 3 · Field Guide ---------- */

.stage {
  width: 100%;
  max-width: none;
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--guide-paper);
  position: relative;
  overflow: hidden;
}
@media (min-width: 1180px) {
  body { padding: 0; }
  .stage { min-height: 100dvh; border-radius: 0; box-shadow: none; border: 0; }
}

/* header */
.topbar {
  display: block;
  padding: 0; min-height: 60px;
  background: var(--bg-base); border-bottom: 1px solid var(--border);
  position: relative; z-index: 20; flex-shrink: 0;
}
.topbar__inner { width: min(100%, 1280px); min-height: inherit; margin-inline: auto; padding: 10px clamp(16px, 3vw, 32px); display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.topbar__identity, .topbar__actions { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-home { min-height: 44px; display: inline-flex; align-items: center; gap: 10px; border: 0; padding: 0; background: transparent; color: var(--text-strong); cursor: pointer; }
.brand-home__mark { width: 36px; height: 36px; display: block; flex: 0 0 36px; color: var(--logo); transition: transform var(--dur) var(--ease-standard); }
.brand-home__mark .bb-logo { display: block; width: 100%; height: 100%; }
.brand-home:hover .brand-home__mark { transform: rotate(-6deg); }
.brand-home > span:last-child, .nav-brand b { font: 800 20px/1 var(--font-display); }
.brand-home:focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; border-radius: var(--radius-button); }
.nav-cta { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 8px 20px; border: 0; border-radius: var(--radius-pill); background: var(--bg-primary); color: var(--text-on-color); font: 700 15px/1 var(--font-display); box-shadow: var(--shadow-md); cursor: pointer; }
.nav-cta:hover { background: var(--purple-hover); }
.nav-cta:focus-visible, .nav-menu:focus-visible, .nav-close:focus-visible, .nav-quiet:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.nav-menu-wrap { position: relative; width: 48px; height: 48px; flex: 0 0 48px; }
.nav-menu-shadow { position: absolute; inset: 0; transform: translate(4px, 4px); border-radius: var(--radius-button); background: var(--bg-teal); transition: transform var(--dur); }
.nav-menu-wrap:hover .nav-menu-shadow { transform: translate(6px, 6px); }
.nav-menu { position: relative; width: 44px; height: 44px; border: 2px solid var(--purple-strong); border-radius: var(--radius-button); background: var(--bg-primary); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; }
.nav-menu i { display: block; width: 24px; height: 5px; border-radius: var(--radius-pill); background: var(--text-on-color); }
.overlay-open { overflow: hidden; }
.nav-drawer, .a11y-overlay { position: fixed; inset: 0; z-index: 200; }
.nav-drawer__scrim, .a11y-overlay__scrim { position: absolute; inset: 0; width: 100%; border: 0; background: color-mix(in oklab, var(--text-strong) 32%, transparent); backdrop-filter: blur(4px); cursor: default; }
.nav-drawer__layers { position: absolute; inset-block: 0; right: 0; width: min(100%, 466px); pointer-events: none; }
.nav-drawer__layers i { position: absolute; inset: 0; transform: scaleX(0); transform-origin: right; animation: nav-layer 420ms var(--ease-standard) forwards; }
.nav-drawer__layers i:nth-child(1) { background: var(--bg-primary); }
.nav-drawer__layers i:nth-child(2) { background: var(--bg-secondary); animation-delay: 40ms; }
.nav-drawer__layers i:nth-child(3) { background: var(--bg-teal); animation-delay: 80ms; }
@keyframes nav-layer { to { transform: scaleX(1); } }
.nav-panel { position: absolute; inset-block: 0; right: 0; width: min(100%, 448px); background: var(--bg-base); color: var(--text-strong); display: flex; flex-direction: column; box-shadow: var(--shadow-xl); opacity: 0; animation: nav-panel-in 200ms var(--ease-standard) 140ms forwards; }
@keyframes nav-panel-in { to { opacity: 1; } }
.nav-panel__head { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; border-bottom: 1px solid var(--border); }
.nav-brand { display: flex; align-items: center; gap: 10px; }
.nav-close { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: var(--radius-button); background: var(--surface-card); color: var(--icon-strong); cursor: pointer; }
.nav-close svg { width: 20px; height: 20px; }
.nav-panel__body { flex: 1; min-height: 0; overflow-y: auto; padding: 26px 24px; }
.nav-panel__body ul { list-style: none; padding: 4px 0 0; margin: 0; }
.nav-panel__body li { border-bottom: 1px solid var(--border); overflow: hidden; }
.nav-panel__body li button { position: relative; width: 100%; min-height: 58px; padding: 10px 12px 10px 16px; border: 0; background: transparent; color: var(--text-strong); text-align: left; font: 800 28px/1.15 var(--font-display); cursor: pointer; transform: translateY(100%); opacity: 0; animation: nav-item-in 240ms var(--ease-standard) calc(60ms + var(--nav-i) * 20ms) forwards; }
@keyframes nav-item-in { to { transform: translateY(0); opacity: 1; } }
.nav-panel__body li button::before { content: ""; position: absolute; left: 0; top: 50%; width: 4px; height: 28px; border-radius: var(--radius-pill); background: var(--bg-primary); transform: translateY(-50%); opacity: 0; transition: opacity var(--dur); }
.nav-panel__body li button:hover, .nav-panel__body li button[aria-current="page"] { color: var(--text-primary-selected); }
.nav-panel__body li button[aria-current="page"]::before { opacity: 1; }
.nav-panel__body li button:focus-visible { outline: 3px solid var(--ring); outline-offset: -3px; }
.nav-panel__cta { margin-top: 24px; }
.nav-panel__foot { display: flex; flex-direction: column; gap: 10px; padding: 16px 24px max(16px, env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--surface-muted); }
.nav-language { min-height: 44px; display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--text-weaker); font-size: 13px; font-weight: 600; }
.nav-language__choices { display: inline-flex; padding: 4px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--bg-base); }
.nav-language__choices button { min-width: 48px; min-height: 36px; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--text-weaker); font-weight: 700; cursor: pointer; }
.nav-language__choices button[aria-checked="true"] { background: var(--bg-primary); color: var(--text-on-color); }
.nav-language__choices button:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.nav-quiet { min-height: 44px; align-self: flex-start; display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; color: var(--text-weaker); font-size: 13px; font-weight: 600; cursor: pointer; }
.nav-quiet:hover { color: var(--text-secondary); }

/* shared accessibility dialog */
.a11y-overlay { display: flex; align-items: center; justify-content: center; padding: 16px; }
.a11y-panel { position: relative; width: min(100%, 420px); max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-modal); background: var(--bg-base); color: var(--text-strong); box-shadow: var(--shadow-xl); animation: bb-pop var(--dur-slow) var(--ease-spring); }
.a11y-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.a11y-head h2 { font-size: var(--text-h2); }
.a11y-head p { margin-top: 2px; color: var(--text-weaker); font-size: 14px; line-height: 20px; }
.a11y-preview { margin-top: 16px; padding: 12px 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius-card); background: var(--bg-placeholder); }
.a11y-preview b { display: block; margin-bottom: 3px; color: var(--text-weaker); font-size: 12px; text-transform: uppercase; }
.a11y-preview p { font-size: 15px; line-height: 1.5; }
.a11y-field { margin: 20px 0 0; padding: 0; border: 0; }
.a11y-field legend, .a11y-size > b { font-size: 14px; font-weight: 600; }
.a11y-theme { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.a11y-theme button, .a11y-size button, .a11y-reset { min-height: 44px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--bg-disabled); color: var(--text-weak); font-weight: 600; cursor: pointer; }
.a11y-theme button { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px; font-size: 12px; }
.a11y-theme button[aria-pressed="true"] { border-color: var(--stroke-primary); background: var(--bg-primary); color: var(--text-on-color); }
.a11y-theme button:focus-visible, .a11y-size button:focus-visible, .a11y-switch:focus-visible, .a11y-reset:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.a11y-size { margin-top: 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.a11y-size > div { display: flex; align-items: center; gap: 10px; }
.a11y-size button { width: 44px; display: grid; place-items: center; }
.a11y-size output { width: 54px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.a11y-toggles { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 16px; }
.a11y-row { display: flex; align-items: center; gap: 12px; }
.a11y-row__icon { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; border-radius: var(--radius-card); background: var(--bg-primary-weaker); color: var(--icon-primary); }
.a11y-row__icon svg { width: 18px; height: 18px; }
.a11y-row__copy { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px; }
.a11y-row__copy b { font-size: 14px; }
.a11y-row__copy small { flex-basis: 100%; color: var(--text-weaker); font-size: 12px; line-height: 17px; }
.a11y-tag { padding: 2px 7px; border: 1px solid var(--bg-secondary); border-radius: var(--radius-pill); color: var(--text-secondary); font-size: 11px; font-weight: 600; }
.a11y-switch { position: relative; width: 48px; height: 44px; flex: 0 0 48px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.a11y-switch::before { content: ""; position: absolute; left: 2px; top: 9px; width: 44px; height: 26px; border-radius: var(--radius-pill); background: var(--bg-disabled); transition: background-color var(--dur); }
.a11y-switch i { position: absolute; top: 11px; left: 4px; width: 22px; height: 22px; border-radius: 50%; background: var(--bg-base); box-shadow: var(--shadow-sm); transition: transform var(--dur) var(--ease-spring); }
.a11y-switch[aria-checked="true"]::before { background: var(--bg-primary); }
.a11y-switch[aria-checked="true"] i { transform: translateX(18px); }
.a11y-reset { width: 100%; margin-top: 20px; display: flex; align-items: center; justify-content: center; gap: 8px; }

html.a11y-high-contrast { --text-strong: #000; --text-weak: #000; --text-weaker: #000; --bg-base: #fff; --bg-weaker: #fff; --surface-card: #fff; --surface-muted: #fff; --border: #000; --border-strong: #000; --ring: #000; --bg-primary: #000; --text-on-color: #fff; --journal-line: #000; }
html.a11y-high-contrast[data-theme="dark"] { --text-strong: #fff; --text-weak: #fff; --text-weaker: #fff; --bg-base: #000; --bg-weaker: #000; --surface-card: #000; --surface-muted: #000; --border: #fff; --border-strong: #fff; --ring: #fff; --bg-primary: #fff; --text-on-color: #000; --journal-line: #fff; }
html.a11y-high-contrast *, html.a11y-high-contrast *::before, html.a11y-high-contrast *::after { text-shadow: none !important; box-shadow: none !important; }
html.a11y-reduce-motion *, html.a11y-reduce-motion *::before, html.a11y-reduce-motion *::after { animation-duration: .001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
html.a11y-wide-spacing { letter-spacing: .08em; word-spacing: .16em; line-height: 1.7; }
html.a11y-dyslexia-font, html.a11y-dyslexia-font * { font-family: "OpenDyslexic", "Comic Sans MS", sans-serif !important; }
html.a11y-reading-ruler p:hover, html.a11y-reading-ruler li:hover, html.a11y-reading-ruler h1:hover, html.a11y-reading-ruler h2:hover, html.a11y-reading-ruler h3:hover, html.a11y-reading-ruler h4:hover, html.a11y-reading-ruler p:focus-visible, html.a11y-reading-ruler li:focus-visible { background-color: var(--bg-yellow-weak); border-radius: 4px; box-shadow: 0 0 0 4px var(--bg-yellow-weak); }
html.a11y-read-aloud p, html.a11y-read-aloud h1, html.a11y-read-aloud h2, html.a11y-read-aloud h3, html.a11y-read-aloud h4, html.a11y-read-aloud li { cursor: help; }
.topbar__title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.topbar__title h1 { font-size: var(--text-h3); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar__title .sub { color: var(--text-weaker); font-size: 12px; line-height: 14px; }
.iconbtn {
  width: var(--tap-min); height: var(--tap-min); min-width: var(--tap-min);
  display: grid; place-items: center; border-radius: var(--radius-button);
  border: 2px solid transparent; background: var(--bg-disabled); color: var(--icon-strong);
  cursor: pointer; transition: background-color var(--dur);
}
.iconbtn:hover { background: var(--bg-weak); }
.iconbtn:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.iconbtn svg { width: 20px; height: 20px; }

.tally {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--bg-primary-weak); color: var(--text-primary-selected);
  border-radius: var(--radius-pill); padding: 6px 12px 6px 9px;
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.tally svg { width: 17px; height: 17px; }
.tally .of { font-weight: 600; opacity: .75; font-size: 13px; }

.langswap { display: inline-flex; background: var(--bg-disabled); border-radius: var(--radius-pill); padding: 3px; }
.langswap button {
  border: none; background: transparent; cursor: pointer; border-radius: var(--radius-pill);
  font-family: var(--font-display); font-weight: 700; font-size: 12px; letter-spacing: .04em;
  padding: 6px 9px; color: var(--text-weak); min-height: 32px;
}
.langswap button[aria-pressed="true"] { background: var(--bg-base); color: var(--text-primary-selected); box-shadow: var(--shadow-xs); }
.langswap button:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }

/* screens */
.screen { flex: 1; min-height: 0; display: none; flex-direction: column; }
.screen[data-active="true"] { display: flex; }
.scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.pad { padding: var(--space-5) var(--space-4) var(--space-8); display: flex; flex-direction: column; gap: var(--space-5); }
@media (min-width: 720px) { .pad { padding: var(--space-6) var(--space-6) var(--space-10); } }

/* ---- shelf ---- */
.shelf-hero {
  display: grid; gap: var(--space-4);
  grid-template-columns: 1fr;
  align-items: center;
}
@media (min-width: 640px) { .shelf-hero { grid-template-columns: minmax(0, 1fr) 230px; } }

.book {
  position: relative; width: 100%; max-width: 260px; margin: 0 auto;
  aspect-ratio: 4 / 5; border-radius: 6px 16px 16px 6px;
  background: linear-gradient(105deg, var(--purple-strong) 0 16px, var(--bg-primary) 16px 100%);
  box-shadow: var(--shadow-lg); color: var(--text-on-color);
  padding: var(--space-5) var(--space-4) var(--space-4) var(--space-6);
  display: flex; flex-direction: column; justify-content: space-between;
  overflow: hidden;
}
.book::after {
  content: ""; position: absolute; inset: 10px 10px 10px 22px;
  border: 2px solid rgba(255, 255, 255, .28); border-radius: 4px 10px 10px 4px; pointer-events: none;
}
.book__title { font-family: var(--font-display); font-weight: 800; font-size: 22px; line-height: 1.1; letter-spacing: var(--tracking-display); }
.book__owner { font-size: 12px; opacity: .85; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; }
.book__stack { display: flex; gap: 4px; flex-wrap: wrap; align-items: flex-end; }
.book__leaf { width: 13px; height: 17px; border-radius: 2px; background: rgba(255, 255, 255, .25); }
.book__leaf[data-on="true"] { background: var(--sc-yellow10); }
.book__spines { position: absolute; left: 0; top: 0; bottom: 0; width: 16px; display: flex; flex-direction: column; }
.book__spines i { flex: 1; border-bottom: 1px solid rgba(255, 255, 255, .12); }

.countline { display: flex; flex-direction: column; gap: var(--space-2); }
.countline__n { font-family: var(--font-display); font-weight: 800; font-size: var(--text-display-large); line-height: 1; letter-spacing: var(--tracking-display); color: var(--text-primary-selected); font-variant-numeric: tabular-nums; }

.marie-row { display: flex; gap: var(--space-3); align-items: flex-end; }
.marie-row .bb-avatar { background: var(--bg-primary-weak); }
svg.marie { width: 100%; height: 100%; display: block; }
.marie-eye { transform-origin: center; }
.blinking .marie-eye { animation: blink 6s var(--ease-standard) infinite; }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.12); } }

.doors { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.door {
  display: flex; align-items: center; gap: var(--space-3); text-align: left;
  padding: var(--space-3) var(--space-4); min-height: 66px;
  color: var(--text-strong);
  background: var(--bg-base); border: 1px solid var(--border); border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm); cursor: pointer;
  transition: transform var(--dur) var(--ease-standard), box-shadow var(--dur), border-color var(--dur);
}
.door:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--stroke-primary-weak); }
.door:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.door__ico { width: 40px; height: 40px; border-radius: var(--radius-lg); display: grid; place-items: center; flex-shrink: 0; background: var(--bg-primary-weak); color: var(--text-primary-selected); }
.door__ico svg { width: 21px; height: 21px; }
.door__ico[data-tone="teal"] { background: var(--bg-teal-weak); color: var(--text-teal); }
.door__ico[data-tone="yellow"] { background: var(--bg-yellow-weak); color: var(--yellow-ink); }
.door__t { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.door__t b { font-family: var(--font-display); font-size: 16px; font-weight: 700; }
.door__t span { font-size: 12px; color: var(--text-weaker); line-height: 15px; }

/* ---- map ---- */
.places { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); }
.place {
  position: relative; border: 1px solid var(--border); border-radius: var(--radius-card);
  overflow: hidden; background: var(--bg-base); box-shadow: var(--shadow-sm);
  cursor: pointer; text-align: left; padding: 0; color: var(--text-strong);
  transition: transform var(--dur) var(--ease-standard), box-shadow var(--dur);
}
.place:hover { transform: translateY(-2px); box-shadow: var(--shadow-primary); }
.place:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.place__art { display: block; height: 118px; position: relative; overflow: hidden; }
.place__art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.place__body { padding: var(--space-3) var(--space-4) var(--space-4); display: flex; flex-direction: column; gap: 7px; }
.place__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.place__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pips { display: flex; gap: 3px; }
.pip { width: 10px; height: 10px; border-radius: 3px; background: var(--bg-weak); }
.pip[data-on="true"] { background: var(--bg-success); }
.tool--primary { background: var(--bg-primary); color: var(--text-on-color); margin-left: auto; }
.tool--primary:hover { background: var(--purple-hover); }

/* ---- guide grid ---- */
.grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); } }

.gcard {
  position: relative; display: flex; flex-direction: column; text-align: left; padding: 0;
  background: var(--bg-base); border: 1px solid var(--border); border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm); cursor: pointer; overflow: hidden; color: var(--text-strong);
  transition: transform var(--dur) var(--ease-standard), box-shadow var(--dur), border-color var(--dur);
}
.gcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.gcard:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.gcard__art {
  aspect-ratio: 1 / 1; display: grid; place-items: center; padding: 12px;
  background: var(--bg-primary-weaker); position: relative;
}
.gcard[data-found="true"] .gcard__art { background: var(--art-plate-success); }
.gcard__art .sp { width: 100%; height: 100%; }
.gcard[data-found="false"] .gcard__art svg.sp { color: color-mix(in oklab, var(--text-primary-selected) 46%, transparent); }
.gcard__body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; }
.gcard__name { font-family: var(--font-display); font-weight: 700; font-size: 15px; line-height: 1.2; }
.gcard__flag {
  position: absolute; top: 8px; right: 8px; display: inline-flex; align-items: center; gap: 4px;
  border-radius: 999px; padding: 4px 8px; font-size: 11px; font-weight: 700;
  background: var(--bg-weak); color: var(--text-weak);
}
.gcard__flag svg { width: 12px; height: 12px; }
.gcard__flag[data-kind="found"] { background: var(--bg-success); color: var(--text-on-color); }
/* the card the day's quest is after: a quiet mark, never a push. The
   quest only ever marks what to go and look for (quests.js: questWants) */
.gcard[data-quest="true"] { border-color: var(--bg-primary); }
.gcard__quest {
  position: absolute; top: 8px; left: 8px; display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 999px;
  background: var(--bg-primary); color: var(--text-on-color); box-shadow: var(--shadow-sm);
}
.gcard__quest svg { width: 16px; height: 16px; }

.gcard__count { position: absolute; bottom: 8px; left: 8px; background: var(--bg-base); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 700; color: var(--text-weak); }

.sectionhead { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }

/* ---- detail ---- */
.detail-art {
  aspect-ratio: 16 / 11; border-radius: var(--radius-2xl); display: grid; place-items: center;
  padding: var(--space-5); background: var(--bg-primary-weaker); border: 1px solid var(--border); position: relative;
}
.detail-art[data-found="true"] { background: var(--art-plate-success); }
.detail-art .sp { width: 100%; height: 100%; max-height: 240px; }
.detail-art[data-found="false"] svg.sp { color: color-mix(in oklab, var(--text-primary-selected) 46%, transparent); }
.factlist { display: flex; flex-direction: column; gap: var(--space-3); }
.factrow { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) 0; border-top: 1px solid var(--border); }
.factrow:first-child { border-top: none; padding-top: 0; }
.factrow__ico { width: 34px; height: 34px; border-radius: var(--radius-lg); display: grid; place-items: center; flex-shrink: 0; background: var(--bg-primary-weak); color: var(--text-primary-selected); }
.factrow__ico svg { width: 18px; height: 18px; }
.factrow__t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.factrow__t b { font-family: var(--font-sans); font-weight: 600; font-size: 13px; color: var(--text-weaker); }

.myfinds { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.myfind {
  border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden;
  background: var(--bg-success-weak); display: flex; flex-direction: column;
}
.myfind__art { aspect-ratio: 1 / 1; display: grid; place-items: center; padding: 10px; }
.myfind__art .sp { width: 100%; height: 100%; }
.myfind__cap { padding: 8px 10px; background: var(--bg-base); border-top: 1px solid var(--border); }

/* ---- observation flow ---- */
.observe-art {
  position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius-2xl); overflow: hidden;
  border: 3px solid var(--bg-primary); background: var(--bg-primary-weaker);
  display: grid; place-items: center; padding: var(--space-4);
}
.observe-art .sp { width: 78%; height: 78%; }
.observe-art::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 46%, transparent 46%, rgba(28, 17, 32, .3) 100%);
}
.observe-art .corner { position: absolute; width: 26px; height: 26px; border: 3px solid rgba(255, 255, 255, .85); }
.observe-art .corner.tl { top: 12px; left: 12px; border-right: 0; border-bottom: 0; border-radius: 6px 0 0 0; }
.observe-art .corner.tr { top: 12px; right: 12px; border-left: 0; border-bottom: 0; border-radius: 0 6px 0 0; }
.observe-art .corner.bl { bottom: 12px; left: 12px; border-right: 0; border-top: 0; border-radius: 0 0 0 6px; }
.observe-art .corner.br { bottom: 12px; right: 12px; border-left: 0; border-top: 0; border-radius: 0 0 6px 0; }

.answers { display: grid; gap: var(--space-2); }
.answer {
  display: flex; align-items: center; gap: var(--space-3); text-align: left;
  min-height: 54px; padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-xl); border: 2px solid var(--border); background: var(--bg-base);
  color: var(--text-strong); cursor: pointer; font-family: var(--font-display); font-weight: 700; font-size: 16px;
  transition: border-color var(--dur), background-color var(--dur), transform var(--dur-fast);
}
.answer:hover { border-color: var(--stroke-primary); background: var(--bg-primary-weaker); }
.answer:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.answer[data-picked="true"] { border-color: var(--bg-primary); background: var(--bg-primary-weak); }
.answer__k { width: 30px; height: 30px; border-radius: 999px; background: var(--bg-primary-weak); color: var(--text-primary-selected); display: grid; place-items: center; font-size: 14px; flex-shrink: 0; }
.answer[data-picked="true"] .answer__k { background: var(--bg-primary); color: var(--text-on-color); }
.answer--quiet { font-family: var(--font-sans); font-weight: 600; font-size: 15px; color: var(--text-weak); }

.looks { display: flex; gap: 4px; align-items: center; }
.look-dot { width: 9px; height: 9px; border-radius: 999px; background: var(--bg-primary); }
.look-dot[data-spent="true"] { background: var(--bg-weak); }

/* ---- reward ---- */

/* ---- journal ---- */
.entries { display: flex; flex-direction: column; gap: var(--space-3); }
.entry {
  display: flex; gap: var(--space-3); padding: var(--space-3);
  background: var(--bg-base); border: 1px solid var(--border); border-radius: var(--radius-card);
  align-items: flex-start;
}
.entry__art { width: 60px; height: 60px; border-radius: var(--radius-lg); background: var(--art-plate-success); display: grid; place-items: center; padding: 6px; flex-shrink: 0; }
.entry__art svg.sp { width: 100%; height: 100%; }
.entry__b { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.entry__meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ---- empty state ---- */
.empty { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); text-align: center; padding: var(--space-10) var(--space-4); }
.empty .bb-avatar { background: var(--bg-primary-weak); }

/* ---- settings ---- */
.setrow {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  padding: var(--space-4) 0; border-top: 1px solid var(--border);
}
.setrow:first-child { border-top: none; }
.setrow__t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.setrow__t b { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.setrow__t span { font-size: 13px; color: var(--text-weaker); line-height: 18px; }

/* ---- utility ---- */
.row { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: var(--space-3); }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-weak); }
.center { text-align: center; }
.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.sheet {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: flex-end; justify-content: center;
  background: color-mix(in oklab, var(--nr15) 55%, transparent); padding: 0;
  animation: bb-fade var(--dur) var(--ease-standard);
}
@media (min-width: 640px) { .sheet { align-items: center; padding: var(--space-5); } }
.sheet__panel > * { flex: 0 0 auto; }
.reward-card > * { flex: 0 0 auto; }
.sheet__panel {
  background: var(--bg-base); width: 100%; max-width: 580px; max-height: 92dvh; overflow-y: auto;
  border-radius: var(--radius-modal) var(--radius-modal) 0 0;
  padding: var(--space-5) var(--space-4) var(--space-6);
  display: flex; flex-direction: column; gap: var(--space-4);
  animation: sheet-up var(--dur-slow) var(--ease-standard);
}
@media (min-width: 640px) { .sheet__panel > * { flex: 0 0 auto; }
.reward-card > * { flex: 0 0 auto; }
.sheet__panel { border-radius: var(--radius-modal); padding: var(--space-6); } }
@keyframes sheet-up { from { transform: translateY(24px); opacity: .6; } }
/* closing: the backdrop fades while the panel slides back down */
.sheet[data-leaving] { pointer-events: none; opacity: 0; transition: opacity var(--dur-slow) var(--ease-standard); }
.sheet[data-leaving] .sheet__panel { animation: none; transform: translateY(100%); transition: transform var(--dur-slow) var(--ease-standard); }
@media (min-width: 640px) { .sheet[data-leaving] .sheet__panel { transform: translateY(24px); } }
.sheet__header {
  position: sticky; top: calc(-1 * var(--space-5)); z-index: 5;
  display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center;
  min-height: 44px; padding-block: var(--space-2); margin-top: calc(-1 * var(--space-5));
  background: var(--guide-paper, var(--bg-base));
}
@media (min-width: 640px) {
  .sheet__header { top: calc(-1 * var(--space-6)); margin-top: calc(-1 * var(--space-6)); }
}
.sheet__grab { grid-column: 2; display: flex; justify-content: center; align-items: center; height: 44px; margin: 0; touch-action: none; cursor: grab; }
.sheet__grab i { width: 44px; height: 5px; border-radius: 999px; background: var(--border-strong); }
.sheet__close {
  grid-column: 3; position: relative;
  display: grid; place-items: center; width: 44px; height: 44px; margin: 0;
  border-radius: 999px; border: 1px solid var(--journal-line); background: var(--bg-base); color: var(--text-weak);
  box-shadow: var(--shadow-sm); cursor: pointer;
}
/* absolute centring: Safari ignores grid on <button>, which pushed the glyph off-centre */
.sheet__close svg { position: absolute; top: 50%; left: 50%; display: block; width: 18px; height: 18px; margin: -9px 0 0 -9px; }
.sheet__close:focus-visible { outline: 3px solid var(--ring, var(--stroke-primary)); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; transition-delay: 0s !important; }
}

/* ============================================================
   The real-world guide: camera, photographs, consent
   ============================================================ */

.bb-btn__spinner {
  width: 1.1em; height: 1.1em; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: bb-spin .6s linear infinite; display: inline-block;
}
@keyframes bb-spin { to { transform: rotate(360deg); } }

.screen[data-screen="camera"] .scroll { display: flex; flex-direction: column; overflow: hidden; }

/* ---- camera ---- */
.cam { flex: 1; min-height: 0; position: relative; background: #14101a; display: flex; flex-direction: column; }
.cam__stage { position: absolute; inset: 0; overflow: hidden; background: #14101a; }
.cam__video, .cam__shot { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.cam__grid {
  position: absolute; inset: 0; pointer-events: none; opacity: .28;
  background:
    linear-gradient(to right, transparent 33.2%, #fff 33.2%, #fff 33.4%, transparent 33.4%,
                    transparent 66.5%, #fff 66.5%, #fff 66.7%, transparent 66.7%),
    linear-gradient(to bottom, transparent 33.2%, #fff 33.2%, #fff 33.4%, transparent 33.4%,
                    transparent 66.5%, #fff 66.5%, #fff 66.7%, transparent 66.7%);
}
.cam__flash { position: absolute; inset: 0; background: #fff; animation: camflash .3s ease-out forwards; pointer-events: none; }
@keyframes camflash { from { opacity: .85; } to { opacity: 0; } }

.cam__state { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(20, 16, 26, .78); z-index: 4; padding: var(--space-4); }
.cam__msg {
  background: var(--bg-base); border-radius: var(--radius-modal); padding: var(--space-5);
  max-width: 320px; text-align: center; display: flex; flex-direction: column; gap: var(--space-3);
  align-items: center; color: var(--text-strong); box-shadow: var(--shadow-xl);
}

.cam__top { position: absolute; top: 0; left: 0; right: 0; padding: var(--space-3); z-index: 3; }
.cam__target {
  display: flex; align-items: center; gap: 10px; max-width: 100%;
  background: color-mix(in oklab, var(--bg-base) 92%, transparent);
  border-radius: var(--radius-pill); padding: 7px 16px 7px 7px; box-shadow: var(--shadow-md);
  color: var(--text-strong);
}
.cam__target-art { width: 34px; height: 34px; flex-shrink: 0; display: grid; place-items: center; border-radius: 999px; background: var(--art-plate-purple); color: var(--purple); padding: 4px; }
.cam__target-art svg { width: 100%; height: 100%; }
.cam__target b { display: block; font-family: var(--font-display); font-size: 15px; line-height: 1.2; }
.cam__target span span { display: block; font-size: 12px; line-height: 15px; color: var(--text-weak); }

.cam__safety {
  position: absolute; left: var(--space-3); right: var(--space-3); bottom: 112px; z-index: 3;
  display: flex; align-items: flex-start; gap: 9px;
  background: color-mix(in oklab, var(--nr15) 62%, transparent); color: #fff;
  border-radius: var(--radius-xl); padding: 10px 14px;
  font: 600 16px/22px var(--font-sans);
}
.cam__safety svg { width: 24px; height: 24px; flex-shrink: 0; margin-top: -1px; }

.cam__bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-4) var(--space-6) calc(var(--space-5) + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(20, 16, 26, .82), transparent);
}
.cam__side {
  width: 52px; height: 52px; border-radius: 999px; border: none; cursor: pointer;
  display: grid; place-items: center; color: #fff;
  background: color-mix(in oklab, var(--nr15) 55%, transparent);
}
.cam__side svg { width: 24px; height: 24px; }
.cam__side:focus-visible, .cam__shutter:focus-visible { outline: 3px solid var(--bg-yellow); outline-offset: 3px; }
.cam__shutter {
  width: 78px; height: 78px; border-radius: 999px; cursor: pointer;
  border: 5px solid #fff; background: transparent; display: grid; place-items: center;
  transition: transform var(--dur-fast) var(--ease-standard);
}
.cam__shutter span { width: 58px; height: 58px; border-radius: 999px; background: #fff; display: block; transition: background-color var(--dur); }
.cam__shutter:active { transform: scale(.94); }
.cam__shutter:active span { background: var(--bg-yellow); }

/* ---- the captured photograph ---- */
.shotframe {
  position: relative; width: 100%; flex: 0 0 auto; aspect-ratio: 4 / 3; border-radius: var(--radius-2xl); overflow: hidden;
  border: 3px solid var(--bg-primary); background: var(--bg-primary-weaker);
}
.shotframe__img { position: absolute; inset: 0; display: block; }
.shotframe__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shotframe .corner { position: absolute; width: 24px; height: 24px; border: 3px solid rgba(255, 255, 255, .9); }
.shotframe .corner.tl { top: 10px; left: 10px; border-right: 0; border-bottom: 0; border-radius: 6px 0 0 0; }
.shotframe .corner.tr { top: 10px; right: 10px; border-left: 0; border-bottom: 0; border-radius: 0 6px 0 0; }
.shotframe .corner.bl { bottom: 10px; left: 10px; border-right: 0; border-top: 0; border-radius: 0 0 0 6px; }
.shotframe .corner.br { bottom: 10px; right: 10px; border-left: 0; border-top: 0; border-radius: 0 0 6px 0; }

img.ownphoto { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
.gcard__art[data-has-photo="true"] { padding: 0; }
.detail-art[data-has-photo="true"] { padding: 0; overflow: hidden; }
.entry__art { border: none; cursor: pointer; padding: 6px; }
.entry__art[data-has-photo="true"] { padding: 0; overflow: hidden; }
.myfind { position: relative; border: 1px solid var(--border); cursor: pointer; padding: 0; text-align: left; }
.myfind__art[data-has-photo="true"] { padding: 0; }
.myfind__zoom {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 999px;
  background: color-mix(in oklab, var(--nr15) 55%, transparent); color: #fff; display: grid; place-items: center;
}
.myfind__zoom svg { width: 14px; height: 14px; }

/* ---- something else, as a first-class path (PRD §12) ---- */
.elsecard {
  display: flex; align-items: center; gap: var(--space-3); width: 100%; text-align: left;
  padding: var(--space-4); border-radius: var(--radius-card); cursor: pointer;
  border: 2px dashed var(--stroke-primary-weak); background: var(--bg-primary-weaker);
  color: var(--text-strong);
  transition: border-color var(--dur), background-color var(--dur);
}
.elsecard:hover { border-color: var(--stroke-primary); background: var(--bg-primary-weak); }
.elsecard:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.elsecard__ico { width: 44px; height: 44px; border-radius: 999px; display: grid; place-items: center; flex-shrink: 0; background: var(--bg-primary); color: var(--text-on-color); }
.elsecard__ico svg { width: 22px; height: 22px; }
.elsecard__t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.elsecard__t b { font-family: var(--font-display); font-size: 17px; }
.elsecard__t span { font-size: 13px; line-height: 17px; color: var(--text-weak); }
.elsecard > svg { width: 20px; height: 20px; color: var(--icon-weak); flex-shrink: 0; }

/* ---- looking closely at your own photograph ---- */
.zoomwrap {
  position: relative; aspect-ratio: 1 / 1; max-height: 52vh; border-radius: var(--radius-2xl);
  overflow: hidden; background: var(--bg-weak); cursor: zoom-in; touch-action: none;
}
.zoomwrap.is-zoom { cursor: zoom-out; }
.zoomimg { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform var(--dur-slow) var(--ease-standard); }
.zoomimg.is-zoom { transform: scale(3); }
.zoomnone { display: grid; place-items: center; height: 100%; gap: 8px; padding: var(--space-6); color: var(--text-primary-selected); }
.zoomnone svg { width: 40%; height: auto; }

/* ---- panels and toast ---- */
.panel {
  display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-4); background: var(--bg-base);
  border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-sm);
}

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 120;
  background: var(--text-strong); color: var(--bg-base); border-radius: var(--radius-pill);
  padding: 12px 18px; font: 600 14px var(--font-sans); box-shadow: var(--shadow-lg);
  max-width: calc(100% - 32px); text-align: center; opacity: 0; pointer-events: none;
  transition: opacity var(--dur), transform var(--dur) var(--ease-standard);
}
.toast[data-on="true"] { opacity: 1; transform: translate(-50%, 0); }

.looks { display: flex; gap: 4px; align-items: center; }
.look-dot { width: 9px; height: 9px; border-radius: 999px; background: var(--bg-primary); }
.look-dot[data-spent="true"] { background: var(--bg-weak); }

.center { text-align: center; }
@media (max-width: 460px) {
  .cam__safety { bottom: 104px; font-size: 16px; line-height: 22px; padding: 10px 14px; }
  .cam__bar { padding-inline: var(--space-4); }
  .cam__shutter { width: 70px; height: 70px; }
  .cam__shutter span { width: 52px; height: 52px; }
}

/* ============================================================
   Field journal classic · aligned with BrainBite course products
   ============================================================ */

body {
  background-color: var(--journal-ground);
  background-image:
    linear-gradient(color-mix(in oklab, var(--stroke-primary) 5%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in oklab, var(--stroke-primary) 5%, transparent) 1px, transparent 1px);
  background-size: 32px 32px;
}

.stage {
  background: var(--guide-paper);
  isolation: isolate;
}

.stage::before {
  content: "";
  position: absolute;
  inset: 60px auto 0 34px;
  width: 1px;
  z-index: 0;
  background: color-mix(in oklab, var(--sc-pink10) 22%, transparent);
  pointer-events: none;
}

.topbar {
  min-height: 72px;
  padding: 12px clamp(16px, 3vw, 32px);
  border-bottom-color: var(--journal-line);
  box-shadow: 0 1px 0 color-mix(in oklab, var(--nr15) 3%, transparent);
}

.topbar__title h1 {
  color: var(--text-primary-selected);
  font-size: var(--text-h2);
}

.iconbtn {
  border-color: var(--journal-line);
  background: var(--bg-base);
  box-shadow: var(--shadow-xs);
  border-radius: var(--radius-button);
}

.iconbtn:hover { color: var(--text-primary-selected); border-color: var(--stroke-primary); background: var(--bg-primary-weak); }
.tally { background: var(--bg-primary-weak); color: var(--text-primary-selected); }
.langswap { background: var(--bg-disabled); border: 1px solid var(--border); }
.langswap button[aria-pressed="true"] { color: var(--text-primary-selected); }

.screen, .scroll, .pad { position: relative; z-index: 1; }
.pad { width: min(100%, 1040px); margin-inline: auto; gap: clamp(18px, 2.2vw, 28px); padding: 24px clamp(18px, 4vw, 42px) 56px; }

.shelf-pad { animation: journal-enter 540ms var(--ease-standard) both; }
@keyframes journal-enter { from { opacity: 0; transform: translateY(12px); } }

.journal-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(190px, .55fr);
  align-items: center;
  gap: clamp(24px, 6vw, 72px);
  min-height: 260px;
  padding: clamp(24px, 4vw, 48px);
  border-radius: var(--radius-modal);
  background: var(--bg-base);
  border: 1px solid var(--journal-line);
  box-shadow: var(--paper-shadow);
  overflow: hidden;
  position: relative;
}

.journal-intro::after {
  content: "";
  position: absolute;
  width: 110px;
  height: 24px;
  right: 27%;
  top: 18px;
  transform: rotate(-3deg);
  background: color-mix(in oklab, var(--bg-yellow) 28%, transparent);
  border-block: 1px solid color-mix(in oklab, var(--yellow-ink) 12%, transparent);
}

.journal-intro__copy { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; }
.journal-intro__copy .bb-display-small { color: var(--text-primary-selected); font-size: clamp(30px, 4vw, 42px); line-height: 1.08; }
.journal-intro__copy .bb-paragraph-small { max-width: 48ch; }
.bb-eyebrow { color: var(--text-primary); }

.journal-progress { width: min(100%, 360px); display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.journal-progress__count { font-size: 13px; font-weight: 700; color: var(--text-success); font-variant-numeric: tabular-nums; }
.journal-progress__count b { font: 800 25px/1 var(--font-display); }
.bb-progress__track { height: 10px; background: var(--bg-weak); }
.bb-progress__fill { background: var(--bg-success); }

.book {
  width: min(100%, 190px);
  border-radius: 5px 18px 18px 5px;
  background: linear-gradient(96deg, var(--field-action-edge) 0 15px, var(--field-action) 15px 100%);
  box-shadow: 0 10px 0 color-mix(in oklab, var(--field-action-edge) 82%, var(--bg-base)), var(--shadow-lg);
  transform: rotate(2deg);
  transition: transform var(--dur-slow) var(--ease-spring);
}
.journal-intro:hover .book { transform: rotate(0deg) translateY(-4px); }
.book::after { border-color: color-mix(in oklab, var(--bg-base) 34%, transparent); }
.book__mark { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--bg-yellow); color: var(--yellow-ink); align-self: center; box-shadow: 0 4px 0 color-mix(in oklab, var(--yellow-ink) 28%, transparent); }
.book__mark svg { width: 27px; height: 27px; }
.book__stack { display: none; }

.expedition-card {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(230px, .7fr);
  gap: clamp(18px, 4vw, 42px);
  align-items: center;
  padding: clamp(18px, 3vw, 28px);
  border-radius: var(--radius-modal);
  background: var(--bg-primary-weaker);
  border: 1px solid var(--stroke-primary-weak);
}
.marie-row { align-items: center; }
.marie-row .bb-avatar { background: var(--bg-primary-weak); border: 3px solid var(--bg-base); box-shadow: var(--shadow-md); }
.bb-bubble--mentor { border-radius: var(--radius-xl); border-bottom-left-radius: var(--radius-sm); background: transparent; padding: 0; }
.bb-bubble__speaker { color: var(--text-primary-selected); font-size: 13px; }
/* the child's own bubble is solid purple: its label has to be light to be read */
.bb-bubble--user .bb-bubble__speaker { color: var(--text-on-color); opacity: .9; }
.go-looking {
  min-height: 64px;
  justify-content: space-between;
  padding-inline: 18px;
  background: var(--field-action);
  box-shadow: 0 7px 0 var(--field-action-edge), var(--shadow-md);
  color: var(--text-on-color);
}
.go-looking:hover { background: var(--field-action-hover); transform: translateY(-2px); box-shadow: 0 9px 0 var(--field-action-edge), var(--shadow-lg); }
.go-looking:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--field-action-edge); }
.go-looking__icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: var(--yellow-ink); background: var(--bg-yellow); }

.doors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.door { min-height: 78px; border-radius: var(--radius-xl); border-width: 1.5px; box-shadow: var(--shadow-card, var(--shadow-sm)); }
.door > svg { width: 19px; height: 19px; color: var(--icon-weak); margin-left: auto; transition: transform var(--dur); }
.door:hover > svg { transform: translateX(3px); }

.places { gap: 18px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.place, .gcard { border-radius: var(--radius-modal); box-shadow: var(--shadow-sm); border-color: var(--journal-line); }
.place__art { height: 150px; }
.place:hover, .gcard:hover { box-shadow: 0 8px 0 color-mix(in oklab, var(--field-context) 22%, transparent), var(--shadow-md); }
.place__body { padding: 16px 18px 18px; }
.gcard__art { background: var(--art-plate-teal); }
.gcard[data-found="false"] .gcard__art svg.sp { color: color-mix(in oklab, var(--field-context) 56%, transparent); }
.gcard__body { padding: 12px 14px 15px; }
.gcard__name { color: var(--text-strong); font-size: 17px; }
.elsecard { border-color: var(--stroke-teal); background: var(--bg-teal-weak); border-radius: var(--radius-xl); }
.elsecard:hover { border-color: var(--teal-strong); background: var(--bg-teal-weak); }
.elsecard__ico { background: var(--bg-teal); }

.detail-art, .shotframe, .observe-art, .zoomwrap { border-radius: var(--radius-modal); }
.detail-art { background: var(--art-plate-teal); border-color: var(--journal-line); }
.detail-art[data-found="false"] svg.sp { color: color-mix(in oklab, var(--field-context) 56%, transparent); }
.factrow__ico { background: var(--bg-teal-weak); color: var(--text-teal); }
.entry, .myfind, .panel { border-color: var(--journal-line); border-radius: var(--radius-xl); box-shadow: var(--shadow-sm); }
.answer:hover { border-color: var(--stroke-primary); background: var(--bg-primary-weaker); }
.answer[data-picked="true"] { border-color: var(--bg-primary); background: var(--bg-primary-weak); }
.answer__k, .answer[data-picked="true"] .answer__k { background: var(--bg-primary); color: var(--text-on-color); }

.sheet__panel, .bb-modal, .cam__msg { border: 1px solid var(--journal-line); box-shadow: var(--shadow-xl); }
.sheet__panel { background: var(--guide-paper); }

@media (min-width: 1180px) {
  body { padding: 0; }
  .stage { min-height: 100dvh; border-radius: 0; border: 0; box-shadow: none; }
}

@media (max-width: 760px) {
  .stage::before { left: 18px; }
  .topbar { min-height: 64px; padding: 0; }
  .topbar__inner { padding-inline: 14px; }
  .topbar .tally { display: none; }
  .topbar__title h1 { font-size: 18px; }
  .pad { padding: 18px 18px 42px; }
  .journal-intro { grid-template-columns: minmax(0, 1fr) 112px; min-height: 210px; padding: 22px; gap: 14px; }
  .journal-intro::after { width: 72px; right: 22%; top: 10px; }
  .journal-intro__copy .bb-display-small { font-size: 30px; }
  .book { width: 104px; min-height: 138px; padding: 16px 10px 12px 20px; }
  .book__title { font-size: 16px; }
  .book__mark { width: 40px; height: 40px; }
  .book__owner { font-size: 9px; }
  .expedition-card { grid-template-columns: 1fr; padding: 18px; gap: 16px; }
  .go-looking { min-height: 58px; }

}

@media (max-width: 540px) {
  .brand-home > span:last-child, .nav-cta span { display: none; }
  .nav-cta { width: 44px; padding: 0; justify-content: center; }
  .topbar__title .sub { display: none; }
  .nav-panel__head, .nav-panel__body, .nav-panel__foot { padding-inline: 20px; }
  .a11y-overlay { align-items: flex-end; padding: 0; }
  .a11y-panel { max-height: 94dvh; border-radius: var(--radius-modal) var(--radius-modal) 0 0; padding: 20px 18px max(24px, env(safe-area-inset-bottom)); }
}

@media (max-width: 430px) {
  .langswap button { min-width: 34px; padding-inline: 7px; }
  .journal-intro { grid-template-columns: 1fr; }
  .book { display: none; }
  .journal-intro::after { right: 18px; }
  .doors { gap: 10px; }
  .door { padding: 11px; }
  .door__ico { width: 36px; height: 36px; }
  .door__t b { font-size: 15px; }
  .door > svg { display: none; }

}

@media (prefers-reduced-motion: reduce) {
  .shelf-pad { animation: none; }
  .journal-intro:hover .book, .go-looking:hover { transform: none; }
}

/* ============================================================
   Real-world home: Steve, one big camera button, today's quests
   ============================================================ */
.coinpill {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 14px;
  border: 1px solid var(--stroke-yellow, var(--journal-line));
  border-radius: 999px;
  background: var(--art-plate-yellow);
  color: var(--yellow-ink, var(--text-strong));
  font-family: var(--font-display); font-size: 16px;
  transition: transform var(--dur) var(--ease-standard);
}
.coinpill .coin { width: 24px; height: 24px; }
.coinpill:hover { transform: translateY(-2px); }
.coinpill b { font-size: 17px; }

.home { gap: var(--space-6); }
.hero {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 12px; padding: 26px 20px 28px;
  background: var(--guide-paper, var(--bg-base));
  border: 1px solid var(--journal-line);
  border-radius: var(--radius-modal);
  box-shadow: var(--shadow-sm);
}
.shoot-cta {
  display: inline-flex; align-items: center; gap: 14px;
  min-height: 72px; padding: 0 30px 0 16px; margin-top: 6px;
  border: none; border-radius: 999px;
  background: var(--bg-primary); color: var(--text-on-color);
  font-family: var(--font-display); font-size: 22px; font-weight: 700;
  box-shadow: 0 8px 0 var(--purple-strong), var(--shadow-lg);
  transition: transform var(--dur) var(--ease-standard), box-shadow var(--dur);
}
.shoot-cta__ring {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  background: rgba(255, 255, 255, .22);
}
.shoot-cta__ring svg { width: 28px; height: 28px; }
.shoot-cta:hover { transform: translateY(-3px); box-shadow: 0 11px 0 var(--purple-strong), var(--shadow-xl); }
.shoot-cta:active { transform: translateY(4px); box-shadow: 0 3px 0 var(--purple-strong); }
.hero__quiet {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  background: none; border: none; color: var(--text-teal); font-weight: 600;
}
.hero__quiet svg { width: 20px; height: 20px; }
.hero__quiet:hover { text-decoration: underline; }

/* home: the streak keepsake and today's trail, side by side */
.home-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-5); align-items: stretch; }
.streak-col, .quest-strip { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.streak-col > h2, .quest-strip > h2 { margin: 0; padding-inline: 4px; color: var(--text-weak); }
@media (max-width: 900px) { .home-top { grid-template-columns: minmax(0, 1fr); } }




/* proper silhouettes for anything not yet found */
.gcard[data-found="false"] .gcard__art img.sp,
.detail-art[data-found="false"] img.sp { filter: brightness(0) saturate(0); opacity: .62; }
.gcard[data-found="false"] .gcard__art svg.sp,
.detail-art[data-found="false"] svg.sp { color: rgba(22, 22, 22, .72); }
.gcard[data-found="false"] .gcard__name { color: var(--text-muted, inherit); }

@media (max-width: 600px) {
  .shoot-cta { width: 100%; justify-content: center; font-size: 20px; }
}
body.calm .shoot-cta:hover, body.calm .book-card:hover, body.calm .coinpill:hover { transform: none; }

/* the same button, floating: within reach wherever the child has got to */
.float-cta { position: fixed; z-index: 30; right: clamp(16px, 3vw, 40px); bottom: calc(env(safe-area-inset-bottom, 0px) + clamp(28px, 5.5vh, 56px)); margin: 0; width: auto; }
.float-cta { opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(var(--space-4)); transition: opacity var(--dur-slow) var(--ease-standard), transform var(--dur-slow) var(--ease-standard), visibility var(--dur-slow); }
.float-cta[data-visible="true"] { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0); }
body.has-page-photo .screen[data-active="true"] .pad { padding-bottom: calc(var(--space-16) * 3 + env(safe-area-inset-bottom, 0px)); }
body.calm .float-cta { transition: none; }
.home { padding-bottom: 196px; }
@media (max-width: 900px) {
  .float-cta { left: 12px; right: 12px; width: auto; max-width: none; margin: 0; bottom: calc(env(safe-area-inset-bottom, 0px) + 40px); justify-content: center; }
}

/* ---- Steve, animated (steve.js) ------------------------------------------
   The drawing stays underneath until the Rive animation has a frame, so a
   slow or failed load never leaves an empty circle. */
.steve-figure { position: relative; display: block; width: 100%; height: 100%; }
.steve-figure > .mentor-fallback { display: block; width: 100%; height: 100%; object-fit: contain; transition: opacity .25s var(--ease-standard); }
.steve-figure__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity .25s var(--ease-standard); }
.steve-figure[data-rive="ready"] > .steve-figure__canvas { opacity: 1; }
.steve-figure[data-rive="ready"] > .mentor-fallback { opacity: 0; }
/* with the runtime present, a re-rendered Steve waits for his animation
   instead of flashing the drawing; the drawing comes back only on failure */
/* Keep the approved portrait visible until a real animation frame loads. */
/* a round avatar is too small for the whole figure, so it frames head and shoulders */
.bb-avatar .steve-figure__canvas { inset: 0; width: 100%; height: 100%; }

.steve-say {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 4px 14px 4px 10px; border-radius: var(--radius-pill);
  border: 1px solid var(--stroke-primary-weak); background: var(--bg-base);
  color: var(--text-primary-selected); font: 600 13px/1 var(--font-sans); cursor: pointer;
}
.steve-say svg { width: 17px; height: 17px; }
.steve-say:focus-visible { outline: 3px solid var(--stroke-primary, currentColor); outline-offset: 2px; }

/* Steve explains a find (app.js: steveInfoOffer / showSteveInfo) */
.steve-info { display: flex; flex-direction: column; gap: var(--space-3); }
.steve-info__ask { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
/* a question that stays above its Yes / No (app.js: steveStage o.ask) */
.steve-ask { margin: var(--space-1) 0 0; align-self: stretch; text-align: center; font-family: var(--font-display); font-weight: 700; font-size: 18px; line-height: 1.3; color: var(--text-strong); text-wrap: balance; }
/* on the reward sheet Steve is a little smaller, so his question and its
   Yes / No sit above the bottom buttons without scrolling */
#steveInfo .steve-stage__figure--sheet { width: min(100%, 190px, 22dvh); }
/* the coin row stays quiet until its turn (app.js: addedSheet) */
.coin-earn { transition: opacity var(--dur-slow) var(--ease-standard); }
.coin-earn[data-waiting="true"] { opacity: .3; }

/* ---- coins (app.js: coinBurst / countUp / flyCoins) ----------------------
   The still coin is BrainBite's approved gold coin; the burst is the shared
   coin-earned.riv, whose artboard is twice the coin so its sparkles spill
   past it without moving anything around it. */
.coin { display: block; flex: none; width: 1.25em; height: 1.25em; object-fit: contain; }
.factrow__ico .coin { width: 22px; height: 22px; }
.bb-badge .coin { width: 16px; height: 16px; }

.coin-earn {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 8px 18px 8px 10px; border-radius: var(--radius-pill);
  /* fixed light gold in both themes: it always sits on the purple reward card */
  background: #fff4b8; color: #5c4300;
  box-shadow: 0 4px 0 rgba(92, 67, 0, .35);
}
.coin-earn__coin { position: relative; display: block; width: 44px; height: 44px; flex: none; }
.coin-earn__coin .coin { width: 100%; height: 100%; transition: opacity .12s; }
.coin-earn__coin[data-burst="playing"] .coin { opacity: 0; }
.coin-burst { position: absolute; inset: -22px; width: 88px; height: 88px; pointer-events: none; }
.coin-earn__t { display: flex; align-items: baseline; gap: 6px; font-family: var(--font-display); }
.coin-earn__t b { font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; }
.coin-earn__t > span:last-child { font-size: 17px; font-weight: 700; }

.coin-fly { position: fixed; left: 0; top: 0; width: 30px; height: 30px; z-index: 130; pointer-events: none; will-change: transform, opacity; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .25)); }
.coinpill--ghost { position: fixed; z-index: 125; margin: 0; pointer-events: none; box-shadow: var(--shadow-lg); justify-content: center; }

/* ---- Steve's sheets ---- */

/* Steve centre stage (app.js: steveStage). The artboard is 578x480 and leaves
   room round him for his gestures, so the figure keeps that shape. What he
   says reads like a caption under him, not a heading. */
.steve-stage { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; text-align: center; }
/* the artboard's top is headroom for his gestures (a question mark, stars), so
   it is left clear rather than tucked under whatever sits above */
.steve-stage__figure { position: relative; display: block; width: min(100%, 340px); aspect-ratio: 578 / 480; margin-bottom: -6px; }
.steve-stage--big .steve-stage__figure { width: min(100%, 400px); }
.steve-mentor-badge {
  visibility: hidden; pointer-events: none;
  display: inline-flex; align-items: center; justify-content: center;
  max-width: 100%; padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-pill); background: var(--bg-primary-weaker);
  color: var(--text-weak); font: 600 var(--text-caption-small)/var(--lh-caption-small) var(--font-sans);
  letter-spacing: 0;
}
.steve-stage__figure:hover + .steve-mentor-badge,
.steve-stage:focus-within .steve-mentor-badge { visibility: visible; }
.steve-stage__figure .steve-figure > svg.marie { position: absolute; inset: 0; margin: auto; width: 62%; height: auto; }
.steve-caption {
  margin: 0; max-width: 36ch;
  font-family: var(--font-sans); font-weight: 500; font-size: 15px; line-height: 21px;
  color: var(--text-weak);
}
.steve-caption { min-height: 42px; }
.steve-caption__line { display: inline-block; }
/* how far through what he is saying */
.steve-dots { display: flex; gap: 5px; justify-content: center; }
.steve-dots i { width: 6px; height: 6px; border-radius: 999px; background: var(--border-strong); transition: background-color var(--dur), transform var(--dur); }
.steve-dots i[data-on="true"] { background: var(--bg-primary); }
/* while he talks the button is the volume reminder, with a speaker that pulses */
.steve-say[data-speaking="true"] { cursor: default; border-color: transparent; background: var(--bg-primary-weaker); }
.steve-say[data-speaking="true"] svg { animation: steve-pulse 1.1s ease-in-out infinite; }
@keyframes steve-pulse { 50% { transform: scale(1.18); } }
body.calm .steve-say[data-speaking="true"] svg { animation: none; }
.steve-caption--busy { display: inline-flex; align-items: center; gap: 8px; }
.steve-caption--busy .bb-btn__spinner { width: 16px; height: 16px; color: var(--text-primary); }
.steve-caption:focus { outline: none; }

/* when Steve opens a sheet, his artboard's empty headroom tucks under the top edge */
.sheet__panel > .steve-stage:first-of-type .steve-stage__figure { margin-top: -12%; }

/* the child's answer as one chip; tapping it goes back to change it */
.your-answer {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 14px 8px 8px; cursor: pointer; text-align: left;
  background: var(--bg-primary-weaker); color: var(--text-strong);
  border: 1px solid var(--stroke-primary-weak); border-radius: var(--radius-xl);
}
.your-answer__art { display: grid; place-items: center; width: 48px; height: 48px; flex: none; overflow: hidden; border-radius: var(--radius-lg); background: var(--art-plate-teal); color: var(--plate-ink-purple); padding: 4px; }
.your-answer__art[data-has-photo="true"] { padding: 0; }
.your-answer__art .sp, .your-answer__art img { width: 100%; height: 100%; object-fit: contain; }
.your-answer__art svg:not(.sp) { width: 22px; height: 22px; }
.your-answer__t { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.your-answer__t small { font-size: 12px; font-weight: 600; color: var(--text-weaker); }
.your-answer__t b { font-family: var(--font-display); font-size: 18px; line-height: 1.2; }
.your-answer__change { font-weight: 700; font-size: 14px; color: var(--text-primary-selected); }
.your-answer:focus-visible { outline: 3px solid var(--ring, var(--stroke-primary)); outline-offset: 2px; }

/* ---- first run: pick a language (app.js: renderLang) ---- */
body.picking-lang .topbar { display: none; }
.langpick { min-height: 100dvh; justify-content: center; align-items: center; text-align: center; gap: var(--space-6); }
.langpick__logo { display: block; width: 72px; height: 72px; flex: none; color: var(--logo); }
.langpick__logo .bb-logo { width: 100%; height: 100%; }
.langpick h1 { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.langpick__alt { font-family: var(--font-sans); font-weight: 600; font-size: 16px; line-height: 1; letter-spacing: 0; color: var(--text-weaker); }
.langpick__choices { display: grid; grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 14px; width: min(100%, 440px); align-items: start; }
.langpick__choice {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 18px 14px 16px; cursor: pointer;
  background: var(--bg-base); color: var(--text-strong);
  border: 2px solid var(--journal-line); border-radius: var(--radius-modal);
  box-shadow: 0 6px 0 var(--journal-line), var(--shadow-sm);
  transition: transform var(--dur) var(--ease-standard), box-shadow var(--dur), border-color var(--dur);
}
.langpick__consent { display: flex; gap: 12px; align-items: center; width: min(100%, 440px); padding: 8px 14px; font-size: 15px; border: 2px solid var(--stroke-primary); border-radius: 16px; background: var(--surface-secondary, transparent); text-align: left; cursor: pointer; }
.langpick__consent > span:not(.sr) { display: block; }
.langpick__consent .langpick__alt { display: block; margin-top: 2px; font-size: 13px; font-weight: 500; }
.langpick__consent input { flex: none; width: 24px; height: 24px; margin: 0; accent-color: var(--stroke-primary); }
.langpick__choice[aria-pressed="true"] { border-color: var(--stroke-primary); }
.langpick__consent { margin-top: 4px; }
.langpick__choice:hover { border-color: var(--stroke-primary); transform: translateY(-2px); }
.langpick__choice:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--journal-line); }
.langpick__choice:focus-visible { outline: 3px solid var(--ring, var(--stroke-primary)); outline-offset: 3px; }
.langpick__choice b { font-family: var(--font-display); font-size: 20px; }
.langpick__flag { position: relative; display: block; width: 100%; max-width: 132px; height: clamp(64px, 22vw, 88px); border-radius: 10px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08), var(--shadow-sm); }
/* The svg is pinned inside the flag box: an in-flow svg with height:100%
   inside an aspect-ratio box makes iOS Safari inflate the whole card. */
.langpick__flag svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
body.calm .langpick__choice:hover { transform: none; }

/* ---- picture answers (app.js: answerSheet) ---- */
.steve-stage--compact .steve-stage__figure { width: min(100%, 240px); }
.picks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pick {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 8px 12px; cursor: pointer; text-align: center;
  background: var(--bg-base); color: var(--text-strong);
  border: 2px solid var(--journal-line); border-radius: var(--radius-xl);
  box-shadow: 0 4px 0 var(--journal-line);
  transition: border-color var(--dur), transform var(--dur-fast), box-shadow var(--dur-fast);
}
.pick:hover { border-color: var(--stroke-primary); }
.pick:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--journal-line); }
.pick:focus-visible { outline: 3px solid var(--ring, var(--stroke-primary)); outline-offset: 2px; }
.pick__art { display: grid; place-items: center; width: 100%; aspect-ratio: 1; max-width: 120px; border-radius: var(--radius-lg); background: var(--art-plate-teal); padding: 8px; }
.pick__art .sp { width: 100%; height: 100%; object-fit: contain; }
.pick__name { font-family: var(--font-display); font-weight: 700; font-size: 16px; line-height: 1.15; }
.pick__flag { position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 999px; background: var(--bg-primary); color: var(--text-on-color); }
.pick__flag svg { width: 14px; height: 14px; }
.answer__art { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: var(--radius-md, 10px); background: var(--art-plate-teal); padding: 3px; }
.answer__art .sp { width: 100%; height: 100%; object-fit: contain; }
body.calm .pick:active { transform: none; }
.pick[data-picked="true"] { border-color: var(--bg-primary); background: var(--bg-primary-weaker); }
.pick__who { font-size: 12px; font-weight: 600; color: var(--text-weaker); margin-top: -2px; }
.pick__art svg:not(.sp) { width: 36px; height: 36px; color: var(--plate-ink-purple); }

/* ---- flags next to a language name ---- */
.flag-chip { display: inline-block; width: 22px; height: 15px; margin-right: 6px; vertical-align: -2px; border-radius: 3px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
.flag-chip svg { display: block; width: 100%; height: 100%; }
.nav-language__choices button { display: inline-flex; align-items: center; padding-inline: 10px; }
.bb-tab { display: inline-flex; align-items: center; }


/* ---- quests: today's trail (app.js: trailStep / questNow / renderQuests) ---- */
.quests { gap: var(--space-6); }
.quest-coins {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  padding: 5px 10px 5px 6px; border-radius: 999px;
  background: #fff4b8; color: #5c4300;
  font: 700 14px/1 var(--font-display); font-variant-numeric: tabular-nums;
}
.quest-coins .coin { width: 20px; height: 20px; }
.quest-coins[data-done="true"] { background: var(--bg-success-weak); color: var(--text-success); }

.trail { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; position: relative; }
.trail__step { position: relative; display: flex; align-items: center; gap: 12px; }
/* the path joining the steps */
.trail__step:not(:last-child)::after {
  content: ""; position: absolute; left: 17px; top: calc(50% + 18px); height: calc(100% - 24px);
  border-left: 3px dashed var(--journal-line);
}
.trail__step[data-state="done"]:not(:last-child)::after { border-left-style: solid; border-color: var(--success); }
.trail__node {
  position: relative; z-index: 1; display: grid; place-items: center; flex: none;
  width: 37px; height: 37px; border-radius: 999px;
  background: var(--bg-base); border: 3px solid var(--journal-line); color: var(--text-weaker);
  font: 800 16px/1 var(--font-display);
}
.trail__node svg { width: 18px; height: 18px; }
.trail__step[data-state="done"] .trail__node { background: var(--success); border-color: var(--success); color: #fff; }
.trail__step[data-state="current"] .trail__node { background: var(--bg-primary); border-color: var(--bg-primary); color: var(--text-on-color); box-shadow: 0 0 0 5px var(--bg-primary-weak); }
.trail__card {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-xl);
  background: var(--bg-base); border: 1px solid var(--journal-line); box-shadow: var(--shadow-sm);
}
.trail__step[data-state="current"] .trail__card { border: 2px solid var(--bg-primary); box-shadow: 0 5px 0 var(--bg-primary-weak), var(--shadow-sm); padding: 14px 12px; }
.trail__step[data-state="locked"] .trail__card { background: transparent; box-shadow: none; border-style: dashed; }
.trail__step[data-state="locked"] .trail__art, .trail__step[data-state="locked"] .trail__t b { opacity: .55; }
.trail__step[data-state="done"] .trail__t b { color: var(--text-weak); }
.trail__art { display: grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: var(--radius-lg); background: var(--art-plate-teal); color: var(--field-context, var(--text-teal)); padding: 5px; }
.trail__step[data-state="current"] .trail__art { width: 60px; height: 60px; }
.trail__art .sp { width: 100%; height: 100%; object-fit: contain; }
.trail__art > svg:not(.sp) { width: 24px; height: 24px; }
.trail__t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.trail__t b { font-family: var(--font-display); font-size: 16px; line-height: 1.2; color: var(--text-strong); }
.trail__step[data-state="current"] .trail__t b { font-size: 18px; }
.trail__meta { font-size: 13px; font-weight: 600; color: var(--text-weaker); }

/* home: just the quest you are on */
:root {
  --quest-ink: #1f1a10;
  --quest-surface: #fedc4b;
  --quest-shadow: color-mix(in oklab, var(--quest-surface) 70%, var(--quest-ink));
}
/* home: just the quest you are on. Two rows and nothing else: the picture
   with what to do, then how far along the trail the child is. */
.quest-now {
  --qn-accent: var(--bg-primary);
  --qn-tint: color-mix(in oklab, var(--bg-primary) 26%, transparent);
  --qn-tint-2: color-mix(in oklab, var(--art-plate-teal) 22%, transparent);
  --qn-edge: color-mix(in oklab, var(--bg-primary) 70%, var(--text-strong) 30%);
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column; gap: 12px; width: 100%; padding: 14px 16px 16px; text-align: left; cursor: pointer;
  background:
    radial-gradient(110% 90% at 100% 0%, var(--qn-tint) 0%, transparent 58%),
    radial-gradient(90% 90% at 0% 100%, var(--qn-tint-2) 0%, transparent 62%),
    var(--surface-card, var(--bg-base));
  color: var(--text-strong);
  border: 0; border-radius: var(--radius-modal);
  box-shadow: 0 8px 0 var(--qn-edge), inset 0 0 0 1.5px color-mix(in oklab, var(--qn-accent) 45%, transparent), var(--shadow-sm);
  transition: transform var(--dur) var(--ease-standard), box-shadow var(--dur) var(--ease-standard);
}
/* a faint dotted trail drawn across the back of the ticket */
.quest-now::before {
  content: ""; position: absolute; z-index: -1; inset: auto -40px -60px auto; width: 160px; height: 120px; pointer-events: none;
  border: 3px dotted color-mix(in oklab, var(--qn-accent) 22%, transparent); border-radius: 50%;
  transform: rotate(-14deg);
}
.quest-now:hover { transform: translateY(-2px); box-shadow: 0 10px 0 var(--qn-edge), inset 0 0 0 1.5px color-mix(in oklab, var(--qn-accent) 60%, transparent), var(--shadow-md, var(--shadow-sm)); }
.quest-now:active { transform: translateY(6px); box-shadow: 0 2px 0 var(--qn-edge), inset 0 0 0 1.5px var(--qn-accent); }
.quest-now[data-state="done"] {
  --qn-accent: var(--success);
  --qn-tint: color-mix(in oklab, var(--success) 26%, transparent);
  --qn-edge: color-mix(in oklab, var(--success) 70%, var(--text-strong) 30%);
}

.quest-now__top { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.quest-now__coins {
  display: inline-flex; align-items: center; gap: 4px; flex: none; padding: 2px 9px 2px 3px; border-radius: 999px;
  background: color-mix(in oklab, var(--quest-surface) 22%, transparent); color: var(--text-strong);
  font: 800 14px/1 var(--font-display); font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--quest-surface) 55%, transparent);
}
.quest-now__coins .coin { width: 20px; height: 20px; }
.quest-now__coins[data-done="true"] { padding: 4px; background: var(--bg-success); color: var(--text-on-color); box-shadow: none; }
.quest-now__coins[data-done="true"] svg { width: 14px; height: 14px; }

.quest-now__head { display: flex; align-items: center; gap: 14px; min-width: 0; }
.quest-now__head b { font-family: var(--font-display); font-size: 19px; line-height: 1.2; text-wrap: balance; }
.quest-now__art {
  position: relative; display: grid; place-items: center; flex: none; width: 58px; height: 58px; padding: 7px;
  border-radius: 18px; transform: rotate(-4deg);
  background: linear-gradient(150deg, color-mix(in oklab, var(--art-plate-teal) 100%, white 25%), var(--art-plate-teal));
  color: var(--field-context, var(--text-teal));
  box-shadow: 0 4px 0 color-mix(in oklab, var(--art-plate-teal) 55%, var(--text-strong)), 0 8px 18px -6px color-mix(in oklab, var(--qn-accent) 60%, transparent);
  transition: transform var(--dur) var(--ease-standard);
}
.quest-now:hover .quest-now__art { transform: rotate(3deg) scale(1.05); }
.quest-now[data-state="done"] .quest-now__art { background: var(--bg-success-weak); color: var(--text-success); box-shadow: 0 4px 0 color-mix(in oklab, var(--success) 55%, var(--text-strong)); }
.quest-now__art .sp { width: 100%; height: 100%; object-fit: contain; }
.quest-now__art > svg:not(.sp) { width: 28px; height: 28px; }

/* the trail: three stops joined by a path; the stop the child is on glows */
.quest-now__trail { display: flex; align-items: center; min-width: 0; }
.quest-now__stop {
  display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%;
  background: var(--surface-muted, var(--bg-weaker)); color: var(--text-weaker);
  box-shadow: inset 0 0 0 2px var(--journal-line);
  font: 800 12px/1 var(--font-display); font-variant-numeric: tabular-nums;
}
.quest-now__stop svg { width: 13px; height: 13px; }
.quest-now__stop[data-state="done"] { background: var(--bg-success); color: var(--text-on-color); box-shadow: none; }
.quest-now__stop[data-state="current"] {
  width: 28px; height: 28px; background: var(--bg-primary); color: var(--text-on-color); box-shadow: 0 0 0 4px color-mix(in oklab, var(--bg-primary) 28%, transparent);
  animation: quest-stop-pulse 2.4s ease-in-out infinite;
}
@keyframes quest-stop-pulse {
  0%, 100% { box-shadow: 0 0 0 4px color-mix(in oklab, var(--bg-primary) 28%, transparent); }
  50% { box-shadow: 0 0 0 7px color-mix(in oklab, var(--bg-primary) 10%, transparent); }
}
.quest-now__path { flex: 1; min-width: 10px; max-width: 48px; height: 0; margin: 0 4px; border-top: 3px dotted var(--journal-line); }
.quest-now__path[data-state="done"] { border-top-style: solid; border-top-color: var(--success); border-radius: 2px; }
.quest-now__got { margin-left: auto; padding-left: 10px; font-size: 13px; font-weight: 700; color: var(--text-weak); font-variant-numeric: tabular-nums; white-space: nowrap; }

html.a11y-high-contrast .quest-now { background: var(--bg-base); color: var(--text-strong); border: 2px solid var(--border); box-shadow: none; }
html.a11y-high-contrast .quest-now::before { display: none; }
body.calm .quest-now:hover, body.calm .quest-now:hover .quest-now__art { transform: none; }
body.calm .quest-now__stop, .a11y-reduce-motion .quest-now__stop { animation: none; }
@media (prefers-reduced-motion: reduce) { .quest-now__stop { animation: none; } .quest-now:hover .quest-now__art { transform: rotate(-4deg); } }
/* a phone leaves the ticket narrow: smaller picture and words, same layout */
@media (max-width: 480px) {
  .quest-now { padding: 12px 12px 14px; gap: 10px; }
  .quest-now__head { gap: 10px; }
  .quest-now__head b { font-size: 16px; }
  .quest-now__art { width: 46px; height: 46px; padding: 5px; border-radius: 14px; }
  .quest-now__art > svg:not(.sp) { width: 22px; height: 22px; }
}

/* collections: one short row each */
.coll-rows { display: flex; flex-direction: column; gap: 10px; }
.coll-row {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  background: var(--bg-base); border: 1px solid var(--journal-line); border-radius: var(--radius-xl); box-shadow: var(--shadow-sm);
}
.coll-row[data-done="true"] { border-color: color-mix(in oklab, var(--success) 40%, transparent); }
.coll-row__pics { display: flex; flex: none; }
.coll-row__pic { display: grid; place-items: center; width: 38px; height: 38px; margin-left: -10px; padding: 3px; border-radius: 999px; background: var(--art-plate-teal); border: 2px solid var(--bg-base); }
.coll-row__pic:first-child { margin-left: 0; }
.coll-row__pic[data-found="false"] { background: var(--bg-weak); }
.coll-row__pic .sp { width: 100%; height: 100%; object-fit: contain; }
.coll-row__pic[data-found="false"] img.sp { filter: brightness(0) saturate(0); opacity: .45; }
.coll-row__t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.coll-row__t b { font-family: var(--font-display); font-size: 16px; line-height: 1.15; }
.coll-row__t small { font-size: 12px; font-weight: 600; color: var(--text-weaker); }
.coll-row .bb-progress__track { height: 7px; }
@media (max-width: 380px) { .coll-row__pic:nth-child(n+4) { display: none; } }
.trail__row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 3px; }
.trail__row .quest-coins { padding: 3px 9px 3px 4px; font-size: 13px; }
.trail__row .quest-coins .coin { width: 18px; height: 18px; }

/* ---- home: the child's own books (app.js: guideCard / findCard) ---- */
.home-books { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(8px, 2.2vw, 14px); }
.book-card {
  position: relative; display: flex; text-align: left; cursor: pointer; color: var(--text-strong);
  background: var(--bg-base); border: 2px solid var(--journal-line); border-radius: var(--radius-modal);
  box-shadow: 0 6px 0 var(--journal-line), var(--shadow-sm);
  transition: transform var(--dur) var(--ease-standard), box-shadow var(--dur);
}
.book-card:hover { transform: translateY(-2px); box-shadow: 0 8px 0 var(--journal-line), var(--shadow-md); }
.book-card:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--journal-line); }
.book-card:focus-visible { outline: 3px solid var(--ring, var(--stroke-primary)); outline-offset: 3px; }
.book-card__t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.book-card__t b { font-family: var(--font-display); font-size: 18px; line-height: 1.15; }
.book-card__t small { font-size: 13px; font-weight: 600; color: var(--text-weaker); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* the guide: one progress circle, centred in the same picture band the photo
   cards use, and the words left-aligned under it. --gring is the circle */
.book-card--guide {
  --gring: 68px; --gnum: 22px;
  display: flex; flex-direction: column; align-items: stretch; justify-content: space-between;
  gap: 10px; padding: 14px 12px 12px; overflow: hidden;
  background: var(--art-plate-teal); border-color: color-mix(in oklab, var(--teal) 30%, transparent);
  box-shadow: 0 6px 0 color-mix(in oklab, var(--teal) 30%, transparent), var(--shadow-sm);
}
.book-card--guide:hover { box-shadow: 0 8px 0 color-mix(in oklab, var(--teal) 30%, transparent), var(--shadow-md); }
.book-card__top { display: flex; align-items: center; justify-content: center; width: 100%; min-width: 0; }
.book-card__ring { position: relative; display: grid; place-items: center; flex: none; width: var(--gring); height: var(--gring); }
.book-card__ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.book-card__ring .ring-track { fill: var(--bg-base); stroke: color-mix(in oklab, var(--teal) 18%, transparent); stroke-width: 8; }
.book-card__ring .ring-fill { fill: none; stroke: var(--teal); stroke-width: 8; stroke-linecap: round; }
.book-card__ring b { position: relative; font: 800 var(--gnum)/1 var(--font-display); color: var(--teal-strong, var(--text-strong)); }
.book-card--guide .book-card__t { align-items: flex-start; text-align: left; width: 100%; }
.book-card__go svg { width: 22px; height: 22px; color: var(--teal); }

body.calm .book-card:active { transform: none; }

/* Steve's stage, tighter: progress dots and the replay button share one quiet row */
.steve-stage { gap: 8px; }
.steve-stage__controls { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 36px; }
.steve-info__ask .bb-btn { min-width: 128px; }

/* a sheet's own buttons stay in reach at the bottom while it scrolls */
.sheet__panel > .bb-modal__actions {
  position: sticky; bottom: calc(-1 * var(--space-6)); z-index: 3;
  margin: 0 calc(-1 * var(--space-4)) calc(-1 * var(--space-6));
  padding: 14px var(--space-4) calc(var(--space-5) + env(safe-area-inset-bottom, 0px));
  background: var(--guide-paper, var(--bg-base));
  box-shadow: 0 -12px 16px -8px color-mix(in oklab, var(--guide-paper, var(--bg-base)) 90%, transparent);
  border-top: 1px solid var(--journal-line);
}
@media (min-width: 640px) {
  .sheet__panel > .bb-modal__actions { margin-inline: calc(-1 * var(--space-6)); padding-inline: var(--space-6); }
}
.book-card__t small { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* ---- polaroids: the child's own photographs, in a white frame ---- */
.polaroid {
  display: block; padding: 5px 5px 14px; background: #fff; border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 6px 14px rgba(0, 0, 0, .12);
}
.polaroid__img { position: relative; display: grid; place-items: center; overflow: hidden; aspect-ratio: 1; border-radius: 3px; background: var(--art-plate-teal); color: var(--plate-ink); padding: 12%; }
.polaroid__img[data-has-photo="true"] { padding: 0; }
.polaroid__img .sp { width: 100%; height: 100%; object-fit: contain; }
.polaroid__img img.ownphoto { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.polaroid__img > svg:not(.sp) { width: 40%; height: 40%; }
.polaroid--empty { background: color-mix(in oklab, #fff 70%, transparent); box-shadow: none; }
.polaroid--empty .polaroid__img { background: transparent; border: 2px dashed color-mix(in oklab, currentColor 35%, transparent); color: inherit; }

/* ---- reward: a card for the guide (app.js: addedSheet) ---- */
.reward-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  padding: 18px 18px 20px; border-radius: var(--radius-modal);
  background: radial-gradient(120% 70% at 50% 0%, var(--bg-primary-weak) 0%, var(--bg-primary-weaker) 60%, var(--bg-base) 100%);
  border: 2px solid var(--stroke-primary-weak);
  box-shadow: 0 6px 0 var(--bg-primary-weak), var(--shadow-md);
}
.reward-card > * { flex: 0 0 auto; }
.reward-card__shot { position: relative; display: block; width: min(64%, 230px); margin: 6px 0 4px; }
.polaroid--big { padding: 8px 8px 26px; transform: rotate(-3deg); }
.reward-card__sticker {
  position: absolute; right: -14px; bottom: 6px; display: grid; place-items: center; width: 64px; height: 64px; padding: 7px;
  border-radius: 999px; background: #fff; border: 3px solid var(--bg-primary); box-shadow: var(--shadow-md); transform: rotate(8deg);
}
.reward-card__sticker .sp { width: 100%; height: 100%; object-fit: contain; }
.reward-card__sticker > svg:not(.sp) { width: 30px; height: 30px; color: var(--plate-ink); }
.reward-card__name { margin: 0; font: 800 30px/1.1 var(--font-display); color: var(--text-primary-selected); }
.coin-earn__split { margin: -2px 0 0; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--text-weaker); }
body.calm .polaroid--big, body.calm .reward-card__sticker { transform: none; }

/* ---- home: journal and found by me, as a little stack of the child's photos ---- */
.home-books { align-items: stretch; }
.book-card--finds {
  flex-direction: column; justify-content: space-between; gap: 10px; padding: 14px 12px 12px; overflow: hidden;
  background: var(--art-plate-purple); border-color: color-mix(in oklab, var(--purple) 22%, transparent);
  box-shadow: 0 6px 0 color-mix(in oklab, var(--purple) 22%, transparent), var(--shadow-sm);
  color: var(--purple);
}
.book-card--finds[data-tone="yellow"] {
  background: var(--art-plate-yellow); border-color: color-mix(in oklab, var(--yellow-ink) 22%, transparent);
  box-shadow: 0 6px 0 color-mix(in oklab, var(--yellow-ink) 22%, transparent), var(--shadow-sm);
  color: var(--yellow-ink);
}
.book-card__stack { position: relative; display: block; width: 100%; aspect-ratio: 5 / 4; }
.book-card__stack .polaroid { position: absolute; top: 50%; left: 50%; width: 62%; transform: translate(-50%, -50%); }
.book-card__stack[data-n="2"] .polaroid:nth-child(1) { transform: translate(-62%, -52%) rotate(-8deg); }
.book-card__stack[data-n="2"] .polaroid:nth-child(2) { transform: translate(-40%, -48%) rotate(5deg); }
.book-card__stack[data-n="3"] .polaroid:nth-child(1) { transform: translate(-68%, -50%) rotate(-11deg); }
.book-card__stack[data-n="3"] .polaroid:nth-child(2) { transform: translate(-34%, -53%) rotate(9deg); }
.book-card__stack[data-n="3"] .polaroid:nth-child(3) { transform: translate(-50%, -47%) rotate(-2deg); }
.book-card__stack[data-n="1"] .polaroid { transform: translate(-50%, -50%) rotate(-4deg); }
.book-card__title { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.book-card--finds .book-card__t b { color: var(--text-strong); font-size: 17px; }
.book-card--finds .book-card__t small { color: var(--text-weak); -webkit-line-clamp: 1; }
.book-card__count {
  display: grid; place-items: center; min-width: 26px; height: 24px; padding: 0 8px; flex: none;
  border-radius: 999px; background: var(--bg-base); color: var(--text-strong); font: 800 13px/1 var(--font-display);
}
body.calm .book-card__stack .polaroid { transition: none; }

/* ---- stamps on the photo (app.js: stampLabels) ---- */
.polaroid--big { position: relative; }
.stamp { position: absolute; z-index: 2; pointer-events: none; --ink: #704682; }
.stamp--place { left: 4%; bottom: 16%; transform: rotate(-8deg); --ink: #1b767f; }
.stamp--rarity { right: 2%; top: 6%; transform: rotate(9deg); }
.stamp--rarity[data-rarity="3"] { --ink: #185e63; }
.stamp--rarity[data-rarity="4"], .stamp--rarity[data-rarity="5"] { --ink: #c61857; }
.stamp__ink {
  position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  padding: 6px 10px 5px; border: 3px solid var(--ink); border-radius: 8px;
  outline: 1.5px solid var(--ink); outline-offset: 2px;
  background: rgba(255, 255, 255, .78); color: var(--ink);
  font: 800 13px/1 var(--font-display); letter-spacing: .08em; text-transform: uppercase;
}
.stamp__stars { letter-spacing: 0; font-size: 11px; }
.stamp[data-state="waiting"] .stamp__ink { opacity: 0; }
.stamp[data-state="inked"] .stamp__ink { animation: stamp-ink .38s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes stamp-ink {
  0% { opacity: 0; transform: scale(1.35); }
  35% { opacity: 1; transform: scale(.92); }
  100% { opacity: 1; transform: scale(1); }
}
.stamp__rive { position: absolute; z-index: 2; left: 50%; top: 50%; transform: translate(-50%, -75%); pointer-events: none; }
body.calm .stamp[data-state="inked"] .stamp__ink { animation: none; }

/* ---- reward card: NEW ribbon, tick on the sticker, what the find is ---- */
.reward-card__ribbon {
  position: absolute; top: -2px; left: -2px; z-index: 3; width: 118px; height: 118px; overflow: hidden;
  border-top-left-radius: var(--radius-modal); pointer-events: none;
}
.reward-card__ribbon > span {
  position: absolute; top: 30px; left: -44px; width: 180px; transform: rotate(-45deg);
  padding: 6px 0 5px; text-align: center;
  background: #c61857; color: #fff; font: 800 14px/1 var(--font-display); letter-spacing: .14em; text-transform: uppercase;
  box-shadow: 0 3px 0 #820f39, 0 6px 12px rgba(0, 0, 0, .18);
}
/* found before: a teal ribbon with how many times */
.reward-card__ribbon[data-kind="again"] > span { background: #1b767f; box-shadow: 0 3px 0 #004043, 0 6px 12px rgba(0, 0, 0, .18); font-size: 16px; letter-spacing: .04em; }
.reward-card__sticker[data-art="false"] { width: 40px; height: 40px; right: -8px; bottom: 16px; padding: 0; border-width: 0; background: transparent; box-shadow: none; }
.reward-card__tick {
  position: absolute; right: -4px; bottom: -4px; display: grid; place-items: center; width: 26px; height: 26px;
  border-radius: 999px; background: var(--success, #188834); color: #fff; border: 3px solid #fff; box-shadow: var(--shadow-sm);
}
.reward-card__tick svg { width: 13px; height: 13px; }
.reward-card__sticker[data-art="false"] .reward-card__tick { position: static; width: 40px; height: 40px; }
.reward-card__sticker[data-art="false"] .reward-card__tick svg { width: 20px; height: 20px; }

/* ---- dark theme: home cards and inks that were drawn for a light page ----
   applyA11y() always sets data-theme on <html>, so these follow system, light and dark.
   Artwork plates stay light (the drawings are dark-ink); the cards around them go dark. */
:root[data-theme="dark"] { --gold-ink: #ecd27a; }
:root[data-theme="dark"] .book-card--guide {
  background: var(--bg-teal-weak); border-color: color-mix(in oklab, var(--text-teal) 30%, transparent);
  box-shadow: 0 6px 0 color-mix(in oklab, var(--text-teal) 22%, transparent), var(--shadow-sm);
}
:root[data-theme="dark"] .book-card--guide:hover { box-shadow: 0 8px 0 color-mix(in oklab, var(--text-teal) 22%, transparent), var(--shadow-md); }
:root[data-theme="dark"] .book-card__ring .ring-track { stroke: color-mix(in oklab, var(--text-teal) 18%, transparent); }
:root[data-theme="dark"] .book-card__ring .ring-fill { stroke: var(--text-teal); }
:root[data-theme="dark"] .book-card__ring b { color: var(--text-strong); }
:root[data-theme="dark"] .book-card__go svg { color: var(--text-teal); }
:root[data-theme="dark"] .book-card--finds {
  background: var(--bg-primary-weak); border-color: color-mix(in oklab, var(--text-primary) 26%, transparent);
  box-shadow: 0 6px 0 color-mix(in oklab, var(--text-primary) 18%, transparent), var(--shadow-sm);
  color: var(--text-primary);
}
:root[data-theme="dark"] .book-card--finds[data-tone="yellow"] {
  background: var(--bg-yellow-weak); border-color: color-mix(in oklab, var(--gold-ink) 26%, transparent);
  box-shadow: 0 6px 0 color-mix(in oklab, var(--gold-ink) 18%, transparent), var(--shadow-sm);
  color: var(--gold-ink);
}
:root[data-theme="dark"] .polaroid--empty { background: color-mix(in oklab, currentColor 12%, transparent); }
/* not-yet-found silhouettes: light shapes, since black ones vanish on a dark circle */
:root[data-theme="dark"] .coll-row__pic[data-found="false"] img.sp { filter: brightness(0) invert(1); opacity: .28; }
:root[data-theme="dark"] .coll-row__pic[data-found="false"] svg.sp { color: color-mix(in oklab, var(--text-strong) 28%, transparent); }
:root[data-theme="dark"] .bb-badge--yellow,
:root[data-theme="dark"] .door__ico[data-tone="yellow"] { color: var(--gold-ink); }
:root[data-theme="dark"] .elsecard:hover { border-color: var(--text-teal); }

/* ============================================================
   Inner screens, built to the home page's standard
   (app.js: renderPlaces / renderGuide / renderDetail / snap / renderSettings)
   Chunky cards with a solid bottom edge, pictures before words, one big
   camera button, and colours that hold up in the dark theme.
   ============================================================ */

/* one header on every screen: the way back, the coins, the menu */
.topbar__actions { flex: none; }
@media (max-width: 760px) { .stage::before { display: none; } }

/* a silhouette is the real picture blacked out, wherever it is shown */
img.sp[data-mono="true"] { filter: brightness(0) saturate(0); opacity: .62; }
.gcard[data-found="false"] .gcard__art svg.sp { color: rgba(22, 22, 22, .72); }

/* ---- buttons that remove something ---- */
.bb-btn--danger { background: var(--error-strong); color: #fff; }
.bb-btn--danger:hover { background: var(--error); }
.bb-btn--danger-quiet { background: transparent; color: var(--text-danger); border-color: color-mix(in oklab, var(--stroke-danger) 55%, transparent); }
.bb-btn--danger-quiet:hover { background: var(--bg-error-weak); border-color: var(--stroke-danger); }
.sheet__panel > .bb-btn--danger-quiet { align-self: flex-start; }

/* ---- the chunky card edge home uses ---- */
.place, .gcard, .coll-row, .panel, .grownups {
  border: 2px solid var(--journal-line);
  box-shadow: 0 5px 0 var(--journal-line), var(--shadow-sm);
}
.place:active, .gcard:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--journal-line); }
.place:hover, .gcard:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--journal-line), var(--shadow-md); }
body.calm .place:hover, body.calm .gcard:hover, body.calm .place:active, body.calm .gcard:active { transform: none; }

/* ---- places ---- */
.places { gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.place { display: flex; flex-direction: column; border-radius: var(--radius-modal); }
.place__art { height: 132px; }
.place__strip { position: absolute; left: 14px; bottom: 12px; display: flex; }
.place__strip > span {
  display: grid; place-items: center; width: 46px; height: 46px; margin-left: -10px; padding: 5px; overflow: hidden;
  border-radius: 999px; background: #fff; border: 3px solid #fff; box-shadow: var(--shadow-md);
}
.place__strip > span:first-child { margin-left: 0; }
.place__strip > span[data-found="false"] { background: var(--plate-muted); }
.place__strip .sp, .place__strip > span > svg { display: block; width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: contain; }
.place__strip img.sp[data-mono="true"] { opacity: .45; }
.place__strip > span[data-found="false"] > svg.sp { color: var(--text-weaker); opacity: .7; }
.place__strip svg { position: static; inset: auto; }
.place__body { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 16px; }
.place__name { font: 700 20px/1.15 var(--font-display); color: var(--text-strong); }
.place__progress { display: flex; flex-direction: column; gap: 5px; }
.place__progress .bb-progress__track { height: 8px; }
.place__progress small, .guide-head__meta small { font-size: 13px; font-weight: 600; color: var(--text-weaker); }

/* ---- one place's guide ---- */
.guide-head {
  display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; align-items: center;
}
.guide-head__art { display: block; position: relative; width: 96px; height: 96px; border-radius: var(--radius-2xl); overflow: hidden; border: 2px solid var(--journal-line); }
.guide-head__art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.guide-head__t { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.guide-head__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 4px; }
.gcard { border-radius: var(--radius-2xl); }
.gcard__flag { box-shadow: var(--shadow-sm); }
.gcard__flag[data-kind="found"] { width: 28px; height: 28px; padding: 0; justify-content: center; }
.gcard__flag[data-kind="found"] svg { width: 15px; height: 15px; }
.elsecard { border-width: 2px; box-shadow: 0 5px 0 color-mix(in oklab, var(--stroke-teal) 35%, transparent); }

/* the day's quest, above a place's cards */
.guide-quest {
  display: flex; align-items: center; gap: 12px; margin: 0; padding: 12px 14px;
  background: var(--bg-primary-weaker); border: 1px solid var(--bg-primary-weak);
  border-radius: var(--radius-modal); color: var(--text-strong);
}
.guide-quest__art { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: var(--radius-lg); background: var(--bg-base); color: var(--text-primary-selected); padding: 5px; }
.guide-quest__art .sp { width: 100%; height: 100%; object-fit: contain; }
.guide-quest__art > svg:not(.sp) { width: 22px; height: 22px; }
.guide-quest__t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.guide-quest__t b { font-family: var(--font-display); font-size: 16px; line-height: 1.2; }
.guide-quest__t small { font-size: 12px; font-weight: 600; color: var(--text-weak); }
/* the same spark as on the cards it means, so the ring explains itself */
.guide-quest__spark { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 4px; vertical-align: -4px; border-radius: 999px; background: var(--bg-primary); color: var(--text-on-color); }
.guide-quest__spark svg { width: 12px; height: 12px; }
.guide-quest[data-here="false"] { background: var(--bg-weak); border-color: var(--border); }
.guide-quest[data-here="false"] .guide-quest__art { color: var(--text-weak); }
.elsecard__t span { color: var(--text-weak); }

/* ---- a card: built like home ---- */
.detail-hero { gap: 14px; padding: 16px 16px 24px; }
.detail-hero .detail-art { width: 100%; aspect-ratio: 4 / 3; padding: 16px; border-width: 0; overflow: hidden; }
.detail-hero .detail-art { grid-template: minmax(0, 1fr) / minmax(0, 1fr); }
.detail-hero .detail-art .sp { width: 100%; height: 100%; max-height: none; min-height: 0; object-fit: contain; }
.detail-hero .detail-art[data-has-photo="true"] { padding: 0; }
.detail-head { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.detail-name { font: 800 32px/1.1 var(--font-display); letter-spacing: var(--tracking-display); color: var(--text-strong); }
.detail-look { max-width: 34ch; font-size: 16px; line-height: 23px; color: var(--text-weak); }
.detail-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.detail-chips .bb-badge { font-size: 13px; padding: 6px 11px; }
.detail-hero .shoot-cta { margin-top: 4px; }

/* ---- a page's own heading, with a count ---- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.page-head .book-card__count { min-width: 32px; height: 30px; font-size: 15px; background: var(--bg-primary-weak); color: var(--text-primary-selected); }

/* ---- the child's finds as polaroids (journal, found by me, a card) ---- */
.snaps { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px 14px; }
.snap {
  display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 0; min-width: 0;
  background: none; border: 0; text-align: left; cursor: pointer; color: var(--text-strong);
}
.snap .polaroid { padding: 7px 7px 20px; transform: rotate(-2deg); transition: transform var(--dur) var(--ease-standard); }
.snap:nth-child(even) .polaroid { transform: rotate(2deg); }
.snap:hover .polaroid { transform: rotate(0) translateY(-3px); }
.snap:focus-visible { outline: 3px solid var(--ring); outline-offset: 4px; border-radius: 8px; }
.snap__t { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding-inline: 2px; min-width: 0; }
.snap__t b { font: 700 17px/1.2 var(--font-display); overflow-wrap: anywhere; }
.snap__t small { font-size: 12px; font-weight: 600; color: var(--text-weaker); }
body.calm .snap .polaroid, body.calm .snap:nth-child(even) .polaroid, body.calm .snap:hover .polaroid { transform: none; }

/* ---- settings ---- */
.panel { border-radius: var(--radius-2xl); padding: 18px; }
.panel .bb-field { gap: 0; }
.grownups { border-radius: var(--radius-2xl); background: var(--bg-base); }
.grownups__summary {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 64px;
  list-style: none; cursor: pointer; border-radius: inherit;
}
.grownups__summary::-webkit-details-marker { display: none; }
.grownups__summary:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.grownups__ico { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: var(--radius-lg); background: var(--bg-info-weak); color: var(--text-info); }
.grownups__ico svg { width: 20px; height: 20px; }
.grownups__t { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.grownups__t b { font: 700 17px/1.2 var(--font-display); }
.grownups__t small { font-size: 13px; color: var(--text-weaker); }
.grownups__chev svg { width: 20px; height: 20px; color: var(--icon-weak); transition: transform var(--dur); }
.grownups[open] .grownups__chev svg { transform: rotate(90deg); }
.grownups__body { display: flex; flex-direction: column; gap: 14px; padding: 4px 12px 14px; }
.grownups__body .panel { box-shadow: none; border-width: 1px; }

/* ---- the answer sheet: pictures to choose from stay on screen ---- */
.shotframe--small { width: min(100%, 240px); align-self: center; }
.sheet__panel > .shotframe--small + .steve-stage .steve-stage__figure { width: min(100%, 220px); }

/* "What do you think it is?": small photo and question side by side, so
   the four pictures and the actions are on screen without scrolling */
.ask-head { display: flex; align-items: center; gap: var(--space-3); }
.shotframe--thumb { width: 96px; height: 96px; aspect-ratio: 1; flex: none; border-width: 2px; border-radius: var(--radius-lg); }
.shotframe--thumb .corner { display: none; }
.steve-stage--voice { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 0; }
.steve-voice__row { display: flex; align-items: center; gap: var(--space-2); width: 100%; }
.steve-voice__title { margin: 0; flex: 1 1 auto; min-width: 0; font-family: var(--font-display); font-weight: 700; font-size: 20px; line-height: 1.15; color: var(--text-strong); }
.steve-stage--voice .steve-say { flex: none; min-width: var(--tap-kid, 56px); min-height: var(--tap-kid, 56px); padding: 0; justify-content: center; }
.steve-voice__kicker { align-self: center; margin: 0 0 4px; padding: 3px 12px; border-radius: var(--radius-pill); background: var(--bg-primary-weak, rgba(255,255,255,.08)); font: 700 12px/18px var(--font-sans); letter-spacing: .4px; text-transform: uppercase; color: var(--text-weak); }
.steve-voice__kicker:empty { display: none; }
.steve-voice__sub { margin: 0; font-family: var(--font-sans); font-size: 13px; line-height: 18px; color: var(--text-weak); }
.sheet__panel:has(.ask-head) { gap: var(--space-3); }
.sheet__panel:has(.ask-head) .picks { gap: 8px; }
.sheet__panel:has(.ask-head) .pick { padding: 8px 6px 10px; gap: 4px; }
.sheet__panel:has(.ask-head) .pick__art { width: min(100%, 112px, 13dvh); }
.sheet__panel:has(.ask-head) .pick__name { font-size: 15px; }
.answers--pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.answers--pair .answer { min-height: 48px; padding: var(--space-2) var(--space-3); justify-content: center; text-align: center; gap: var(--space-2); }
.sheet__panel:has(.ask-head) .ask-maybe { margin: 0; }
.sheet__panel:has(.ask-head) .bb-modal__actions { margin-top: 0; padding-top: 0; }

/* every sheet: Steve is his voice and a line of text, never a big figure,
   so the actions are on screen straight away */
.ask-head__t { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.steve-stage--voice { align-self: stretch; width: 100%; }
.ask-head .steve-stage--voice { width: auto; }
.steve-voice__line { margin: 0; flex: 1 1 auto; min-width: 0; font-family: var(--font-display); font-weight: 600; font-size: 22px; line-height: 1.3; color: var(--text-strong); }
.steve-stage--voice .steve-caption--busy { min-height: 0; margin: 0; font-size: 19px; }
.steve-stage--voice .steve-stage__controls { align-self: center; min-height: 44px; }
.steve-stage--voice .steve-step { min-width: 44px; min-height: 44px; }
.steve-stage--voice .steve-info__ask { align-self: stretch; justify-content: stretch; margin-top: var(--space-2); }
.steve-stage--voice .steve-info__ask .bb-btn { flex: 1 1 0; min-width: 0; }
.sheet__panel:has(.steve-stage--voice) { gap: var(--space-3); }
.sheet__panel:has(.steve-stage--voice) .picks--one .pick__art { width: min(100%, 104px, 13dvh); }
/* "Continue with Google" and its "or" rule (app.js: googleButton) */
.google-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; padding: 10px 16px; border-radius: var(--radius-pill); background: var(--bg-base); border: 1.5px solid var(--border-strong, var(--border)); color: var(--text-strong); font: 700 14px/1 var(--font-sans); cursor: pointer; }
.google-btn:disabled { opacity: .6; cursor: default; }
.google-btn:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.google-or { display: flex; align-items: center; gap: 12px; margin: 2px 0; font: 600 12px/1 var(--font-sans); text-transform: uppercase; letter-spacing: .5px; color: var(--text-weaker); }
.google-or span { flex: 1; height: 1px; background: var(--border); }
.google-or i { font-style: normal; }
/* the two optional boxes on the new-account form (app.js: familyRegisterPanel) */
.consent-row { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; font: 400 13px/1.45 var(--font-sans); color: var(--text-strong); cursor: pointer; }
.consent-row input { flex: none; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--bg-primary); cursor: pointer; }
.consent-row a { font-weight: 600; color: var(--text-primary-selected, inherit); text-decoration: underline; text-underline-offset: 3px; }
/* Steve's sound switch, everywhere (app.js: syncSteveText).
   Sound on and his voice heard on this Steve (data-heard): you see him
   talking and no words. Otherwise his words show as well. Screen readers
   still get the words, and fixed headings and the "checking" status are not
   captions, so they stay. */
body[data-steve-text="hide"] .steve-stage[data-heard="true"] .steve-caption:not(.steve-caption--busy),
body[data-steve-text="hide"] .steve-stage[data-heard="true"] .steve-voice__line {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; min-height: 0;
}
body[data-steve-text="hide"] .steve-stage[data-heard="true"] .steve-voice__row { justify-content: center; }
.steve-say[aria-pressed="false"] { color: var(--text-weak); }
/* in a sheet he is a smaller figure above his words, so the buttons stay on screen */
.steve-stage__figure--sheet { align-self: center; width: min(100%, 250px); margin: -8px 0 0; }
.sheet__panel > .steve-stage--voice:first-of-type .steve-stage__figure--sheet { margin-top: -4%; }
/* the reward card keeps its moment but leaves room for what comes next */
.reward-card {
  display: grid; grid-template-columns: minmax(0, 44%) minmax(0, 1fr); column-gap: var(--space-4); row-gap: 6px;
  grid-template-areas: "shot name" "shot coins" "shot split";
  align-content: center; align-items: center; justify-items: start; text-align: left;
  padding: 16px 16px 18px;
}
.reward-card__shot { grid-area: shot; justify-self: center; width: min(100%, 180px); margin: 4px 0 8px; }
.reward-card__name { grid-area: name; align-self: end; font-size: 26px; overflow-wrap: anywhere; }
.reward-card .coin-earn { grid-area: coins; max-width: 100%; gap: 8px; padding: 6px 14px 6px 6px; }
.reward-card .coin-earn__coin { width: 36px; height: 36px; }
.reward-card .coin-earn__t b { font-size: 26px; }
.reward-card .coin-earn__t > span:last-child { font-size: 15px; }
.reward-card .stamp__ink { font-size: 10px; padding: 3px 6px 2px; border-width: 2px; outline-width: 1px; border-radius: 6px; gap: 3px; }
.reward-card .stamp__stars { font-size: 8px; }
.reward-card .stamp--place { bottom: 18%; left: 2%; }
.reward-card .reward-card__sticker[data-art="true"] { width: 46px; height: 46px; }
.reward-card .coin-earn__split { grid-area: split; align-self: start; margin: 0; text-align: left; }
.zoomwrap { max-height: min(52vh, 34dvh); }
.zoom-meta { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.zoom-meta .col { min-width: 0; }
.zoom-meta .bb-btn { flex: none; min-height: 44px; }
.sheet__panel:has(.zoomwrap) { gap: var(--space-3); }

/* ---- camera unavailable: Steve says so ---- */
.cam__msg-steve { position: relative; display: block; width: 140px; aspect-ratio: 1; margin: -8px 0 -4px; }
.cam__msg-steve .steve-figure > svg.marie { position: absolute; inset: 0; margin: auto; width: 62%; height: auto; }

/* ---- quests: collection names line up, whatever the pictures ---- */
.coll-row { border-radius: var(--radius-2xl); }
.coll-row__pics { width: 122px; }
@media (max-width: 380px) { .coll-row__pics { width: 94px; } }
.coll-row__pic[data-found="false"] { background: var(--plate-muted); }

/* ---- menu: the camera button, as on home ---- */
.nav-panel__cta { width: 100%; justify-content: center; margin-top: 24px; min-height: 64px; font-size: 20px; }

/* ---- a find with no photo, up close: its picture on a light plate ---- */
.zoomnone { background: var(--art-plate-teal); align-content: center; }
.zoomnone .sp { width: 62%; height: auto; max-height: 72%; margin-inline: auto; object-fit: contain; }
.zoomnone p.muted { color: #575757; }

/* badge inks: the brand success and warning text is a touch light on its pale
   fills, and these badges carry the safety words, so they get a deeper ink */
:root { --badge-success-ink: #13702b; --badge-warning-ink: #a4420a; }
:root[data-theme="dark"] { --badge-success-ink: var(--text-success); --badge-warning-ink: var(--text-warning); }
.bb-badge--success, .quest-coins[data-done="true"] { color: var(--badge-success-ink); }
.bb-badge--warning { color: var(--badge-warning-ink); }

/* Daily streak: one warm keepsake card — flame spotlight on top, this week below. */
:root {
  --streak-glow: color-mix(in oklab, oklch(0.75 0.18 55) 22%, transparent);
  --streak-glow-2: color-mix(in oklab, var(--bg-primary-weak) 70%, transparent);
  --streak-ember: oklch(0.6 0.2 40);
  /* the pressed-edge colour: the ember deepened with the ink, same 3D build as the trail card */
  --streak-edge: color-mix(in oklab, var(--streak-ember) 76%, var(--text-strong));
}
.streak-widget {
  flex: 1;
  position: relative; isolation: isolate; overflow: hidden;
  width: 100%; min-width: 0;

  display: flex; flex-direction: column; justify-content: space-between; gap: var(--space-4);

  padding: var(--space-5);
  border: 0; border-radius: var(--radius-modal);
  background:
    radial-gradient(120% 90% at 0% 0%, var(--streak-glow) 0%, transparent 55%),
    radial-gradient(90% 80% at 100% 100%, var(--streak-glow-2) 0%, transparent 60%),
    var(--surface-card);
  color: var(--text-strong);
  box-shadow: 0 8px 0 var(--streak-edge), var(--shadow-sm);
}
.streak-summary { display: flex; align-items: center; gap: var(--space-4); min-width: 0; }
.streak-flame { flex: none; width: 92px; pointer-events: none; filter: drop-shadow(0 10px 18px color-mix(in oklab, var(--streak-ember) 40%, transparent)); transform-origin: 50% 90%; }
.streak-flame img, .streak-flame svg { width: 100%; height: auto; display: block; }
.streak-widget[data-done="true"] .streak-flame { animation: streak-flicker 2.8s ease-in-out infinite; }
@keyframes streak-flicker { 0%,100% { transform: scale(1) rotate(-2deg); } 50% { transform: scale(1.05) rotate(2deg); } }
.calm .streak-flame, .a11y-reduce-motion .streak-flame { animation: none !important; }
@media (prefers-reduced-motion: reduce) { .streak-flame { animation: none !important; } }
.streak-summary__text { display: flex; flex-direction: column; min-width: 0; }
.streak-summary__number { font: 800 var(--text-display-large)/1 var(--font-display); letter-spacing: 0; color: var(--streak-ember); }
:root[data-theme="dark"] .streak-summary__number { color: oklch(0.78 0.16 55); }
.streak-summary b { font: 700 var(--text-h4)/var(--lh-h4) var(--font-display); }
.streak-summary small { margin-top: var(--space-1); font: 500 var(--text-body-tiny)/var(--lh-body-tiny) var(--font-sans); color: var(--text-weak); }
.streak-goal { min-width: 0; padding-top: var(--space-4); border-top: 1px dashed var(--border); }
.streak-goal__heading { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.streak-goal__heading h2, .streak-goal__heading h3 { display: flex; gap: var(--space-2); align-items: center; margin: 0; }
.streak-goal__heading h2 svg, .streak-goal__heading h3 svg { width: var(--space-5); height: var(--space-5); color: var(--text-teal); flex: none; }

.streak-goal__count { display: flex; align-items: center; gap: var(--space-1); padding: var(--space-1) var(--space-3); border-radius: var(--radius-pill); background: var(--bg-primary-weak); color: var(--text-primary-selected); font-size: var(--text-body-small); }
.streak-goal__count[data-done="true"] { background: var(--bg-success-weak); color: var(--badge-success-ink); }
.streak-goal__count svg { width: var(--space-4); height: var(--space-4); }
.streak-goal__caption { margin: var(--space-1) 0 var(--space-3); font-size: var(--text-body-small); line-height: var(--lh-body-small); color: var(--text-weak); }
.streak-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--space-1); list-style: none; padding: 0; margin: 0; }
.streak-week__day { position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--space-1); min-width: 0; padding: var(--space-2) 0; border: 1px solid transparent; border-radius: var(--radius-button); color: var(--text-weaker); font: 600 var(--text-body-tiny)/var(--lh-body-tiny) var(--font-sans); }
.streak-week__mark { display: grid; place-items: center; width: var(--space-7, 28px); height: var(--space-7, 28px); border-radius: var(--radius-pill); border: 2px solid var(--border-strong); background: var(--surface-card); }
.streak-week__mark svg { width: var(--space-4); height: var(--space-4); }
.streak-week__mark i { width: var(--space-2); height: var(--space-2); border-radius: var(--radius-pill); background: var(--icon-disabled); }
.streak-week__day[data-state="done"] { color: var(--badge-success-ink); }
.streak-week__day[data-state="done"] .streak-week__mark { background: var(--bg-success); color: var(--text-on-color); border-color: var(--bg-success); }
.streak-week__day[aria-current="date"] { background: var(--bg-primary-weak); border-color: var(--stroke-primary); color: var(--text-primary-selected); }
.streak-week__day[data-state="current"] .streak-week__mark { border-color: var(--stroke-primary); color: var(--text-primary-selected); }
:root[data-theme="dark"] .streak-week__day[aria-current="date"] { color: var(--text-primary); }
.a11y-high-contrast .streak-flame { display: none; }
.a11y-high-contrast .streak-widget { background: var(--surface-card); border: 2px solid var(--border); box-shadow: none; }
/* home top cards: compact on phones — shorter streak strip, tighter trail card */
@media (max-width: 900px) {
  .home-top { gap: var(--space-3); }
  .streak-col, .quest-strip { gap: 6px; }
  .streak-col > h2, .quest-strip > h2 { padding-inline: 2px; }

  .streak-widget { gap: var(--space-3); padding: var(--space-4); }
  .streak-summary { gap: var(--space-3); }
  .streak-flame { width: 48px; filter: drop-shadow(0 6px 10px color-mix(in oklab, var(--streak-ember) 36%, transparent)); }
  .streak-summary__number { font-size: clamp(28px, 8.5vw, 34px); }
  /* the top of the card is one compact strip: the number and the days wording share a line */
  .streak-summary__text { flex-flow: row wrap; align-items: baseline; gap: 2px 8px; }
  .streak-summary b { font-size: 15px; line-height: 20px; }
  .streak-summary small { margin-top: 0; }
  .streak-goal { padding-top: var(--space-3); }
  .streak-goal__caption { display: none; }
  .streak-week { gap: 4px; }
  .streak-week__day { padding: 3px 0; gap: 0; }
  .streak-week__day > span:last-child { display: none; }
  .streak-week__mark { width: 22px; height: 22px; border-width: 1.5px; }
  .streak-week__mark svg { width: 12px; height: 12px; }
  .streak-week__mark i { width: 6px; height: 6px; }

}
@media (max-width: 380px) {
  .streak-widget { padding: var(--space-3); }
  .streak-flame { width: 42px; }
  .streak-week__mark { width: 20px; height: 20px; }
}

/* Phones: places become compact rows (picture left, details right). The 3D
   tilt is switched off on touch screens — iOS Safari blanks the picture
   inside a preserve-3d card, and there is no hover to tilt with anyway. */
@media (hover: none), (max-width: 900px) {
  .bb-tilt-card, .bb-tilt-card:is(.gcard, .place):hover, .bb-tilt-card:is(.gcard, .place):active {
    transform: none; transform-style: flat;
  }
  .bb-tilt-card .gcard__art, .bb-tilt-card > .polaroid { translate: none; }
}
@media (max-width: 600px) {
  .places { grid-template-columns: 1fr; gap: 12px; }
  .place { flex-direction: row; align-items: stretch; text-align: left; }
  .place__art { flex: 0 0 112px; height: auto; min-height: 112px; }
  .place__strip { left: 50%; bottom: 10px; translate: -50% 0; }
  .place__strip > span:nth-child(n+3) { display: none; }
  .place__body { flex: 1 1 auto; min-width: 0; justify-content: center; gap: 6px; padding: 12px 14px; }
  .place__name { font-size: 18px; }
  .place__meta .bb-badge { font-size: 12px; }
}

/* Guide cards: keep the picture square without pushing the name out
   (iOS Safari grows aspect-ratio boxes inside a flex button). */
.gcard__art { flex: none; width: 100%; height: auto; min-height: 0; overflow: hidden; }
.gcard__art .sp { max-width: 100%; max-height: 100%; }
.gcard__body { flex: none; }
.gcard__name { display: block; }
.gcard__hint { font-size: 13px; font-weight: 600; color: var(--text-weaker); }

/* iOS Safari: no aspect-ratio box with a 100%-tall picture inside a button
   (it grows the picture and hides the name). The picture sets its own
   square size instead, and the card stacks as a plain block. */
.gcard { display: block; }
.gcard__art { display: block; aspect-ratio: auto; height: auto; }
.gcard__art .sp { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; max-height: none; object-fit: contain; }
.gcard__body { display: flex; }

/* Top bar on one grid: back, coins and menu all 44px tall, centred on one
   line; the menu's offset shadow stays inside the page edge. */
.topbar__inner { align-items: center; }
.topbar__identity, .topbar__actions { height: 48px; align-items: center; }
.iconbtn { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; padding: 0; }
.nav-menu-wrap { width: 44px; height: 44px; flex: 0 0 44px; margin-right: 4px; margin-bottom: 4px; align-self: center; }
.nav-menu { width: 44px; height: 44px; }
.nav-menu i { width: 22px; height: 4px; }
.coinpill { height: 44px; min-height: 44px; }
@media (max-width: 600px) {
  .topbar__inner { padding-inline: 16px; gap: 10px; }
  .topbar__actions { gap: 10px; }
  .home, .pad { padding-inline: 16px; }
}
/* Camera: line the top tag, safety note and buttons up with the page's 16px edge. */
@media (max-width: 600px) {
  .cam__top { padding: 12px 16px; }
  .cam__target { width: 100%; }
  .cam__safety { left: 16px; right: 16px; }
  .cam__bar { padding-inline: 16px; }
}

/* ---- home books: one row of three at every size (app.js: renderShelf) ----
   The three cards stand side by side on a phone and on a big screen. The
   guide is one progress circle centred in the picture band the photo cards
   keep for their pictures. The photo cards show a fan of the child's own
   photographs. A big screen keeps the same cards roomier. */
@media (max-width: 899px) {
  .home-books { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

  /* guide: the number's circle centred, then the words left-aligned underneath */
  .book-card--guide { --gring: 56px; --gnum: 22px; gap: 6px; padding: 10px 8px; }
  .book-card__ring b { font-size: 22px; }
  .book-card__go { display: none; }
  /* the circle sits in the same band the photo cards keep for their pictures */
  .book-card--guide .book-card__top { min-height: clamp(82px, 20vw, 92px); }
  .book-card--guide .book-card__t b { font-size: 14px; white-space: nowrap; }
  .book-card--guide .book-card__t small { font-size: 11px; line-height: 1.25; }

  .book-card--finds { gap: 6px; padding: 10px 8px; }
  .book-card__stack { height: clamp(82px, 20vw, 92px); }
  .book-card__stack .polaroid { width: min(72%, 70px); }
  .book-card__stack[data-n="2"] .polaroid:nth-child(1) { transform: translate(-60%, -52%) rotate(-7deg); }
  .book-card__stack[data-n="2"] .polaroid:nth-child(2) { transform: translate(-40%, -48%) rotate(5deg); }
  .book-card__stack[data-n="3"] .polaroid:nth-child(1) { transform: translate(-62%, -50%) rotate(-9deg); }
  .book-card__stack[data-n="3"] .polaroid:nth-child(2) { transform: translate(-38%, -52%) rotate(8deg); }
  .book-card__stack[data-n="3"] .polaroid:nth-child(3) { transform: translate(-50%, -47%) rotate(-2deg); }
  .book-card--finds .book-card__t b { font-size: 14px; white-space: nowrap; }
  .book-card__title { flex: none; }
  .book-card--finds .book-card__t { align-items: center; text-align: center; }
  .book-card--finds .book-card__t small { font-size: 11px; line-height: 1.25; white-space: normal; -webkit-line-clamp: 2; }
  .book-card__count { position: absolute; top: 8px; right: 8px; min-width: 22px; height: 20px; padding: 0 6px; font-size: 11px; }
}
@media (max-width: 380px) {
  .book-card__t b, .book-card--finds .book-card__t b { font-size: 13px; }
  .book-card__stack .polaroid { width: min(74%, 62px); }
}

/* A big screen has room for the roomy cards: the guide keeps its circle
   centred and larger, the photo cards keep a taller fan of their photographs. */
@media (min-width: 900px) {
  /* guide: the number's circle centred, then the words left-aligned underneath */
  .book-card--guide { --gring: 80px; --gnum: 28px; gap: 12px; }
  .book-card__ring b { font-size: clamp(22px, 2vw, 28px); }
  .book-card--guide .book-card__t b { font-size: 17px; }
  .book-card__go { display: none; }
  /* the circle sits in the same band the photo cards keep for their pictures */
  .book-card--guide .book-card__top { min-height: clamp(96px, 12vw, 140px); }
  .book-card__stack { height: clamp(96px, 12vw, 140px); }
  .book-card__stack .polaroid { width: min(56%, 92px); }
}

/* Secondary photo action: compact and content-width, separate from the home action. */
.page-photo-cta {
  left: auto; right: var(--space-4); width: max-content;
  max-width: calc(100% - var(--space-8)); min-height: var(--space-12);
  padding: var(--space-2) var(--space-4) var(--space-2) var(--space-2);
  gap: var(--space-2); border-radius: var(--radius-pill);
  background: var(--field-action-edge); box-shadow: var(--shadow-md);
  font-family: var(--font-sans); font-size: var(--text-body-small);
  line-height: var(--lh-body-small); letter-spacing: 0;
}
.page-photo-cta .shoot-cta__ring {
  flex: 0 0 var(--space-8); width: var(--space-8); height: var(--space-8);
  background: var(--polish-glare);
}
.page-photo-cta .shoot-cta__ring svg { width: var(--space-5); height: var(--space-5); }
.page-photo-cta:hover { background: var(--field-action-hover); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.page-photo-cta:active { transform: translateY(0); box-shadow: var(--shadow-xs); }
.page-photo-cta:focus-visible { outline: var(--space-1) solid var(--ring); outline-offset: var(--space-1); }

/* Focused home: progress stays quiet; the trail leads straight to the photo. */
.home { gap: var(--space-5); }
.home-discovery { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }
.home-discovery .quest-strip { width: min(100%, 560px); gap: var(--space-1); }
.home-discovery .quest-strip > h2 { text-align: center; font-size: var(--text-h5); line-height: var(--lh-h5); }
.home-discovery .hero { width: min(100%, 560px); padding: 0; gap: var(--space-3); background: transparent; border: 0; border-radius: 0; box-shadow: none; }
.home-discovery .steve-stage { gap: var(--space-2); }
.home-discovery .steve-stage__figure { width: min(100%, 300px); margin: 0; }
.home-discovery .steve-caption { min-height: var(--lh-body-default); font-size: var(--text-body-small); line-height: var(--lh-body-small); }
.home-discovery .shoot-cta { width: min(100%, 400px); min-height: var(--space-16); margin: 0 0 var(--space-2); justify-content: center; font-size: var(--text-h2); }
.home-discovery .shoot-cta__ring { width: var(--tap-min); height: var(--tap-min); }
/* home: the streak and today's quest side by side. The streak is a small
   tile (flame, days, this week); the quest takes the wider column. */
.home-today { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.7fr); gap: var(--space-3); align-items: stretch; width: min(100%, 560px); }
.home-today .quest-strip { width: 100%; }
.home-today .quest-now { height: 100%; justify-content: space-between; }
.home .streak-widget {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "flame count" "dots dots";
  align-items: center; column-gap: var(--space-2); row-gap: var(--space-3);
  padding: 16px 14px; box-shadow: 0 6px 0 var(--streak-edge), var(--shadow-sm);
}
.home .streak-flame { grid-area: flame; width: 44px; filter: drop-shadow(0 6px 10px color-mix(in oklab, var(--streak-ember) 36%, transparent)); }
.streak-widget[data-zero="true"] .streak-flame { filter: grayscale(1); opacity: .45; }
.streak-count { grid-area: count; display: flex; flex-direction: column; min-width: 0; }
.streak-count__n { font: 800 32px/1 var(--font-display); color: var(--streak-ember); }
:root[data-theme="dark"] .streak-count__n { color: oklch(0.78 0.16 55); }
.streak-count__label { font: 700 13px/1.2 var(--font-display); color: var(--text-strong); }
.streak-dots { grid-area: dots; display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.streak-dots li { flex: 1; height: 6px; border-radius: 999px; background: var(--journal-line); }
.streak-dots li[data-state="done"] { background: var(--success); }
.streak-dots li[data-state="current"] { background: var(--bg-primary); }
/* a phone leaves the tile narrow, so the flame sits above the words */
@media (max-width: 480px) {
  .home .streak-widget { grid-template-columns: minmax(0, 1fr); grid-template-areas: "flame" "count" "dots"; row-gap: var(--space-2); padding: 14px 12px; }
  .home .streak-flame { width: 36px; }
}

.home .coinpill { background: var(--surface-muted); color: var(--text-weak); }
body[data-polish-screen="shelf"] .coinpill { background: var(--surface-muted); color: var(--text-weak); border-color: var(--border); }
body.overlay-open .float-cta { opacity: 0; visibility: hidden; pointer-events: none; }
@media (max-width: 600px) {
  .home { gap: var(--space-3); padding-top: var(--space-3); }
  .home-discovery { gap: var(--space-2); }
  .home-discovery .steve-stage__figure { width: min(100%, 230px); }
}
@media (prefers-reduced-motion: reduce) { .float-cta { transition: none; } }

/* ---- phone sheets: no sideways drift, no stretched answer cards (iOS Safari) ---- */
.sheet__panel { overflow-x: hidden; overflow-x: clip; isolation: isolate; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sheet__panel > * { max-width: 100%; min-width: 0; }
.picks { align-items: stretch; align-content: start; grid-auto-rows: max-content; height: auto; min-height: 0; }
.pick { min-width: 0; height: auto; min-height: 0; justify-content: flex-start; align-self: stretch; }
/* Keep percentage-height artwork out of grid's intrinsic row sizing (Safari). */
.pick__art { position: relative; display: block; width: min(100%, 120px); height: auto; aspect-ratio: 1; flex: none; overflow: hidden; }
.pick__art .sp { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); max-height: none; object-fit: contain; }
.pick__name { overflow-wrap: anywhere; }
.reward-card { width: 100%; box-sizing: border-box; overflow: hidden; }
.sheet__panel > .bb-modal__actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 10px; }
.sheet__panel > .bb-modal__actions > * { min-width: 0; width: 100%; margin: 0; }
.sheet__panel > .bb-modal__actions { max-width: none; }

/* ============================================================
   In-app notes (notify.js): toast, Steve card, bell and inbox
   ============================================================ */
.notebell {
  position: relative; display: inline-grid; place-items: center; flex: 0 0 44px;
  width: 44px; height: 44px; min-height: 44px; padding: 0; margin: 0; box-sizing: border-box;
  border-radius: 999px; line-height: 0;
  border: 2px solid var(--stroke-primary); background: var(--bg-primary-weak); color: var(--text-primary-selected);
  transition: transform var(--dur) var(--ease-standard);
}
.notebell svg { display: block; width: 22px; height: 22px; grid-area: 1 / 1; }
.notebell:hover { transform: translateY(-2px); }
.notebell:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
body.calm .notebell:hover { transform: none; }
.notebell__dot {
  position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: var(--bg-primary); color: var(--bg-base);
  font: 700 11px/20px var(--font-sans); text-align: center; border: 2px solid var(--bg-base);
}
.notice {
  position: fixed; z-index: 140; left: 50%; top: calc(12px + env(safe-area-inset-top, 0px));
  width: min(440px, calc(100% - 24px)); transform: translate(-50%, -24px); opacity: 0;
  display: grid; grid-template-columns: 48px 1fr 44px; align-items: center; gap: 12px;
  padding: 10px 10px 10px 12px; border-radius: 22px;
  background: var(--bg-base); color: var(--text-strong);
  border: 2px solid var(--bg-primary-weak); box-shadow: var(--shadow-lg);
  transition: opacity var(--dur) var(--ease-standard), transform var(--dur) var(--ease-standard);
}
.notice[data-on="true"] { opacity: 1; transform: translate(-50%, 0); }
body.calm .notice { transform: translate(-50%, 0); transition: opacity var(--dur); }
.notice__art { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; background: var(--card-yellow, var(--bg-primary-weaker)); overflow: hidden; }
.notice__art img, .notice__art svg { width: 100%; height: 100%; object-fit: contain; }
.notice__emoji { font-size: 26px; line-height: 1; }
.notice__text { margin: 0; font: 600 15px/1.3 var(--font-display); }
.notice__close { position: relative; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 999px; background: transparent; color: var(--text-strong); border: 0; }
.notice__close svg { position: absolute; top: 50%; left: 50%; display: block; width: 18px; height: 18px; margin: -9px 0 0 -9px; }
.notice--steve { grid-template-columns: 84px 1fr 44px; border-color: var(--bg-primary); padding: 12px; }
.notice--steve .notice__art { width: 84px; height: 96px; background: var(--card-teal); grid-row: span 2; }
.notice--steve .notice__text { font-size: 16px; }
.notice__go {
  grid-column: 2; justify-self: start; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 0;
  background: var(--bg-primary); color: var(--text-on-color); font: 700 15px var(--font-display);
}
.notice--steve .notice__close { grid-column: 3; grid-row: 1; align-self: start; }
.inbox { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.inbox__group { margin: 12px 0 6px; font: 700 13px var(--font-sans); text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted, var(--text-strong)); }
.inbox__row {
  width: 100%; min-height: 56px; display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px;
  padding: 8px 12px; border-radius: 16px; border: 1px solid var(--border); background: var(--bg-base); color: var(--text-strong); text-align: left;
}
.inbox__row:disabled { opacity: 1; cursor: default; }
.inbox__icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--card-yellow, var(--bg-primary-weaker)); overflow: hidden; }
.inbox__icon img, .inbox__icon svg { width: 100%; height: 100%; object-fit: contain; }
.inbox__text { font: 600 15px/1.3 var(--font-sans); }
.inbox__new { width: 10px; height: 10px; border-radius: 999px; background: var(--bg-primary); }
@media (max-width: 420px) { .topbar__actions { gap: 6px; } }

/* a single picture (confirm / result sheets) */
.picks.picks--one { grid-template-columns: minmax(0, 160px); justify-content: center; }
.picks.picks--one .pick { cursor: default; }

/* Camera: pinch zooms the camera only; flashlight sits beside the target card */
.cam, .cam__stage { touch-action: none; -webkit-user-select: none; user-select: none; }
.cam__video { transform-origin: center; transition: transform 80ms linear; }
.cam__video.is-boost { filter: brightness(1.55) contrast(1.08); }
.cam__top { display: flex; align-items: center; gap: 8px; }
.cam__top .cam__target { flex: 1 1 auto; min-width: 0; width: auto; }
.cam__torch {
  flex-shrink: 0; width: 48px; height: 48px; padding: 0; border: none; border-radius: 999px; cursor: pointer;
  display: grid; place-items: center; color: var(--text-strong);
  background: color-mix(in oklab, var(--bg-base) 92%, transparent); box-shadow: var(--shadow-md);
}
.cam__torch svg { width: 22px; height: 22px; display: block; }
.cam__torch.is-on { background: var(--bg-yellow); color: var(--nr15); }
.cam__torch:focus-visible { outline: 3px solid var(--bg-yellow); outline-offset: 3px; }
.cam__zoom {
  position: absolute; left: 50%; top: 84px; transform: translateX(-50%); z-index: 3;
  padding: 4px 12px; border-radius: 999px; font: 600 14px/20px var(--font-body);
  color: #fff; background: color-mix(in oklab, var(--nr15) 70%, transparent); pointer-events: none;
}
.cam__shutter { position: relative; padding: 0; -webkit-appearance: none; appearance: none; }
.cam__shutter span { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }

/* replay: a small speaker icon beside Charles's words, full tap area */
.steve-caption-row { display: flex; align-items: center; justify-content: center; gap: 4px; max-width: 40ch; }
.steve-caption-row .steve-caption { min-height: 0; }
.steve-caption-row .steve-say {
  flex: none; position: relative; width: var(--tap-kid, 56px); height: var(--tap-kid, 56px); min-height: 0;
  padding: 0; gap: 0; justify-content: center; border: 0; background: transparent; border-radius: 50%;
}
.steve-caption-row .steve-say::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--bg-primary-weaker); }
.steve-caption-row .steve-say svg { position: relative; width: 22px; height: 22px; }
.steve-caption-row .steve-say[data-speaking="true"]::before { background: var(--bg-primary-weak, var(--bg-primary-weaker)); }

/* ============================================================
   UX audit fixes
   ============================================================ */

/* Dutch "Door mij gevonden" and other long card titles wrap instead of being cut off */
.book-card__title { max-width: 100%; min-width: 0; }
.book-card--finds .book-card__t b { white-space: normal; overflow-wrap: anywhere; text-wrap: balance; }
@media (max-width: 899px) {
  .book-card--finds .book-card__t b,
  .book-card--guide .book-card__t b { white-space: normal; overflow-wrap: anywhere; text-wrap: balance; }
  .book-card__title { justify-content: center; }
}

/* artwork the content system has not finished yet: a quiet question mark */
.sp.sp--pending { color: var(--text-weaker); }

/* one quiet notebook: no stray margin line beside the page */
.stage::before { display: none; }

/* every tap target is at least 44px */
.bb-btn--sm { min-height: var(--tap-min, 44px); }
.bb-tab { min-height: var(--tap-min, 44px); }
.nav-language__choices button { min-height: var(--tap-min, 44px); }
.brand-home { min-width: var(--tap-min, 44px); }
.panel details > summary { display: flex; align-items: center; min-height: var(--tap-min, 44px); cursor: pointer; }

/* Steve's mentor badge: hover, a tap on touch screens, or keyboard focus */
.steve-stage:focus-within .steve-mentor-badge,
.steve-stage__figure:hover + .steve-mentor-badge { visibility: hidden; }
@media (hover: hover) { .steve-stage__figure:hover + .steve-mentor-badge { visibility: visible; } }
.steve-stage.is-badge .steve-mentor-badge,
.steve-stage:has(:focus-visible) .steve-mentor-badge { visibility: visible; }

/* the replay speaker looks the same whether or not he has spoken yet */
.steve-caption-row .steve-say::before { background: var(--bg-primary-weak, var(--bg-primary-weaker)); }

/* back / next under a longer talk */
.steve-stage__controls { gap: var(--space-2); }
.steve-step {
  flex: none; display: grid; place-items: center;
  width: var(--tap-min, 44px); height: var(--tap-min, 44px); padding: 0;
  border: 0; border-radius: var(--radius-pill); background: transparent;
  color: var(--text-primary-selected); cursor: pointer;
}
.steve-step svg { width: var(--space-5); height: var(--space-5); }
.steve-step:hover { background: var(--bg-primary-weaker); }
.steve-step[aria-disabled="true"] { opacity: .35; cursor: default; background: transparent; }
.steve-step:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

/* empty journal / found by me: Steve, then their own photo button */
.empty-finds .shoot-cta { justify-content: center; }

/* card page on a big screen: the picture leaves room for the name and Find this */
@media (min-width: 720px) {
  .detail-hero .detail-art { width: min(100%, calc(min(40vh, 400px) * 4 / 3)); align-self: center; margin-inline: auto; }
}

/* big screens: the header lines up with the page column */
@media (min-width: 761px) {
  .topbar { padding-inline: 0; }
  .topbar__inner { width: min(100%, 1040px); padding-inline: clamp(18px, 4vw, 42px); }
  /* camera: the target card sits centred instead of stretching edge to edge */
  .cam__top { justify-content: center; }
  .cam__top .cam__target { flex: 0 1 auto; max-width: 560px; }
  .cam__safety { left: 50%; right: auto; width: min(760px, calc(100% - var(--space-6))); transform: translateX(-50%); }
}

/* Laptop home: the streak and today's trail row, Steve beside his words and the
   big photo button, then the three cards, so all of it fits a laptop screen.
   Steve keeps his size; the reading order stays streak, trail, Steve, photo, cards. */
@media (min-width: 1024px) {
  .home {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr);
    grid-template-areas: "today today" "hero hero" "books books";
    align-items: center; column-gap: var(--space-6); row-gap: var(--space-5);
  }
  .home > * { grid-column: 1 / -1; }
  .home > .home-discovery { display: contents; }
  .home-discovery .home-today { grid-area: today; width: 100%; grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); column-gap: var(--space-6); }
  .home-discovery .hero {
    grid-area: hero; justify-self: center; width: min(100%, 820px);
    display: grid; grid-template-columns: 300px minmax(0, 1fr);
    grid-template-areas: "fig cap" "fig photo";
    column-gap: var(--space-8); row-gap: var(--space-4); align-items: center;
  }
  .home-discovery .hero > .steve-stage { display: contents; }
  .home-discovery .steve-stage__figure { grid-area: fig; width: 300px; margin: 0; }
  .home-discovery .steve-mentor-badge { grid-area: fig; align-self: end; justify-self: center; position: relative; z-index: 1; }
  .home-discovery .steve-caption-row { grid-area: cap; align-self: end; justify-self: center; }
  .home-discovery .home-photo { grid-area: photo; align-self: start; justify-self: center; margin: 0; }
  .home > .home-books { grid-area: books; }
}
@media (min-width: 1024px) and (max-height: 900px) {
  .book-card__stack { height: 88px; }
  .book-card--guide .book-card__top { min-height: 88px; }
  .book-card__stack .polaroid { width: 64px; }
}

/* Keep-your-finds-safe nudge (guests, journal and Found by me) */
.save-nudge {
  display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: var(--space-4); align-items: start;
  padding: var(--space-4); border-radius: var(--radius-lg, 20px);
  background: var(--bg-primary-weaker); border: 1px solid var(--bg-primary-weak);
}
.save-nudge__art { width: 64px; height: 64px; border-radius: 16px; overflow: hidden; background: var(--bg-primary-weak); display: grid; place-items: center; }
.save-nudge__art img, .save-nudge__art svg { width: 100%; height: 100%; object-fit: contain; }
.save-nudge__body { min-width: 0; display: grid; gap: var(--space-2); }
.save-nudge__title { margin: 0; font: 700 18px/1.2 var(--font-display); color: var(--text-strong); }
.save-nudge__text { margin: 0; font-size: 15px; line-height: 1.4; color: var(--text-weak); }
.save-nudge__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.save-nudge__actions .bb-btn { min-height: 44px; }
@media (prefers-reduced-motion: no-preference) {
  body:not(.calm) .save-nudge { animation: save-nudge-in 360ms ease-out both; }
}
@keyframes save-nudge-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Steve's sound switch lives inside his figure: a round button at his side,
   56px to tap (small fingers), with a 44px disc you can see */
.steve-stage__art { display: contents; }
.steve-stage__figure > .steve-say {
  position: absolute; right: 0; bottom: 6%; z-index: 2;
  width: var(--tap-kid, 56px); height: var(--tap-kid, 56px); min-height: 0;
  padding: 0; gap: 0; justify-content: center; border: 0; background: transparent; border-radius: 50%;
}
.steve-stage__figure > .steve-say::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--bg-primary-weaker); border: 1px solid var(--stroke-primary-weak); }
.steve-stage__figure > .steve-say svg { position: relative; width: 22px; height: 22px; }
.steve-stage__figure > .steve-say[data-speaking="true"]::before { background: var(--bg-primary-weak, var(--bg-primary-weaker)); }
/* pressing the sound button glides his drawing sideways (app.js: steveWander);
   the button itself stays put */
.steve-stage__figure .steve-stage__art > .steve-figure { transition: transform 600ms var(--ease-standard); }
body.calm .steve-stage__figure .steve-stage__art > .steve-figure { transition: none; }
@media (prefers-reduced-motion: reduce) { .steve-stage__figure .steve-stage__art > .steve-figure { transition: none; } }

/* The verdict after a guess (app.js: resultSheet): seen, not only heard */
.verdict { display: flex; align-items: center; justify-content: center; gap: 10px; }
.verdict .pick { flex: 0 1 150px; cursor: default; }
.verdict__card { overflow: visible; }
.verdict[data-right="true"] .verdict__card { border-color: var(--bg-success); box-shadow: 0 4px 0 var(--bg-success); }
.verdict[data-right="false"] .verdict__card { border-color: var(--yellow-ink, #c98a00); box-shadow: 0 4px 0 var(--yellow-ink, #c98a00); }
.verdict__mark {
  position: absolute; top: -14px; right: -14px; z-index: 1; display: grid; place-items: center;
  width: 52px; height: 52px; border-radius: 999px; color: #fff; box-shadow: var(--shadow-md);
}
.verdict__mark svg { width: 30px; height: 30px; }
.verdict[data-right="true"] .verdict__mark { background: var(--bg-success); }
.verdict[data-right="false"] .verdict__mark { background: var(--yellow-ink, #c98a00); }
.verdict__guess { opacity: .85; }
@media (prefers-reduced-motion: no-preference) {
  body:not(.calm) .verdict[data-right="true"] .verdict__mark { animation: verdict-pop 420ms var(--ease-spring) 120ms both; }
  body:not(.calm) .verdict[data-right="true"] .verdict__card { animation: verdict-bounce 520ms var(--ease-spring) 80ms; }
  body:not(.calm) .verdict[data-right="false"] .verdict__mark { animation: verdict-pop 320ms var(--ease-standard) 260ms both; }
}
@keyframes verdict-pop { from { opacity: 0; transform: scale(.3); } to { opacity: 1; transform: scale(1); } }
@keyframes verdict-bounce { 0% { transform: scale(.92); } 55% { transform: scale(1.06); } 100% { transform: scale(1); } }
/* Phone home: the page fills the phone's height. Steve grows or shrinks with the
   height, the trail, Steve and the cards spread over the room, and nothing is
   left empty at the bottom. The room kept for the floating photo button is only
   added once that button has appeared (the child has scrolled). */
@media (max-width: 1023px) {
  #shelf { display: flex; flex-direction: column; }
  #shelf > .home { flex: 1 0 auto; padding-bottom: var(--space-6); }
  #shelf > .home:has(.float-cta[data-visible="true"]) { padding-bottom: 196px; }
  .home-discovery { flex: 1 0 auto; justify-content: space-evenly; }
  .home-discovery .hero { flex: 1 0 auto; justify-content: center; }
  .home-discovery .steve-stage__figure { width: min(100%, clamp(140px, calc(100dvh - 550px), 360px)); }
}

/* ============================================================
   UX polish: every control answers the pointer, the finger and
   the keyboard, and everything that animates in animates out.
   ============================================================ */

/* no grey iOS flash on top of the game's own tap ripple */
html { -webkit-tap-highlight-color: transparent; }

/* every button shows a hand and the house focus ring unless it says otherwise
   (zero specificity: any rule of a component wins) */
:where(button:not(:disabled), [role="button"], summary, label:has(> input[type="checkbox"])) { cursor: pointer; }
:where(button, a[href], [role="button"], input, select, textarea, [tabindex]:not([tabindex="-1"])):focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

/* the menu and the accessibility panel leave the way they came in */
.nav-drawer[data-leaving], .a11y-overlay[data-leaving] { pointer-events: none; }
.nav-drawer[data-leaving] .nav-panel { animation: nav-panel-out 180ms var(--ease-standard) forwards; }
.nav-drawer[data-leaving] .nav-drawer__layers i { transform: scaleX(1); animation: nav-layer-out 300ms var(--ease-standard) forwards; }
.nav-drawer[data-leaving] .nav-drawer__layers i:nth-child(3) { animation-delay: 60ms; }
.nav-drawer[data-leaving] .nav-drawer__layers i:nth-child(2) { animation-delay: 100ms; }
.nav-drawer[data-leaving] .nav-drawer__layers i:nth-child(1) { animation-delay: 140ms; }
.nav-drawer[data-leaving] .nav-drawer__scrim,
.a11y-overlay[data-leaving] .a11y-overlay__scrim { animation: bb-fade-out 380ms var(--ease-standard) forwards; }
.a11y-overlay[data-leaving] .a11y-panel { animation: bb-pop-out 220ms var(--ease-standard) forwards; }
@keyframes nav-panel-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateX(32px); } }
@keyframes nav-layer-out { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes bb-fade-out { to { opacity: 0; } }
@keyframes bb-pop-out { to { opacity: 0; transform: translateY(8px) scale(.97); } }
@media (max-width: 640px) {
  @keyframes bb-sheet-down { to { transform: translateY(100%); } }
  .a11y-overlay[data-leaving] .a11y-panel { animation: bb-sheet-down 260ms var(--ease-standard) forwards; }
}
/* calm mode: the menu is simply there, no staggered entrance */
body.calm :is(.nav-panel, .nav-panel__body li button) { animation: none; opacity: 1; transform: none; }
body.calm .nav-drawer__layers i { animation: none; }

/* hover lifts only where there is a real pointer. On a phone a tap leaves
   :hover stuck, so cards stayed lifted until the next tap elsewhere. */
@media (hover: none) {
  :is(.bb-card--interactive, .door, .place, .gcard, .go-looking, .coinpill, .notebell, .shoot-cta, .langpick__choice, .quest-now, .book-card, .page-photo-cta):hover:not(:active) { transform: none; }
  .brand-home:hover .brand-home__mark, .door:hover > svg { transform: none; }
  .nav-menu-wrap:hover .nav-menu-shadow { transform: translate(4px, 4px); }
}
/* calm mode keeps every card still, not just some */
body.calm :is(.bb-card--interactive, .door, .place, .gcard, .go-looking, .coinpill, .notebell, .shoot-cta, .langpick__choice, .quest-now, .book-card, .page-photo-cta, .snap .polaroid):is(:hover, :active) { transform: none; }

/* top bar: bell, coins, menu, logo and back all press in, and hover */
#topbar :is(.notebell, .coinpill, .nav-menu, .brand-home, .iconbtn) {
  cursor: pointer;
  transition: transform var(--dur) var(--ease-standard), scale 120ms var(--ease-standard),
    background-color var(--dur) var(--ease-standard), border-color var(--dur) var(--ease-standard), color var(--dur);
}
#topbar :is(.notebell, .coinpill, .nav-menu, .brand-home, .iconbtn):active { scale: .94; }
@media (hover: hover) {
  #topbar .notebell:hover { background: var(--bg-primary-weaker); }
  #topbar .coinpill:hover { border-color: var(--yellow-ink, var(--stroke-primary)); }
  #topbar .nav-menu:hover { background: var(--purple-hover); }
  #topbar .brand-home:hover { color: var(--text-primary-selected); }
}

/* buttons that had no hover at all */
.sheet__close, .nav-close, .notice__close, .notice__go, .inbox__row, .steve-say, .hero__quiet, .quest-now, .a11y-row, .google-btn { cursor: pointer; }
.sheet__close, .nav-close, .notice__close, .notice__go, .inbox__row, .google-btn, .a11y-theme button, .a11y-size button, .a11y-reset, .nav-language__choices button {
  transition: background-color var(--dur) var(--ease-standard), border-color var(--dur) var(--ease-standard), color var(--dur), box-shadow var(--dur), scale 120ms var(--ease-standard);
}
:is(.sheet__close, .nav-close, .notice__close, .notice__go, .inbox__row:not(:disabled), .google-btn:not(:disabled), .a11y-theme button, .a11y-size button, .a11y-reset, .nav-language__choices button):active { scale: .96; }
@media (hover: hover) {
  :is(.sheet__close, .nav-close):hover { background: var(--surface-muted); border-color: var(--border-strong); color: var(--text-strong); }
  .notice__close:hover { background: var(--surface-muted); }
  .notice__go:hover { filter: brightness(1.08); }
  .inbox__row:not(:disabled):hover { background: var(--surface-muted); }
  .google-btn:not(:disabled):hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
  :is(.a11y-theme button:not([aria-pressed="true"]), .a11y-size button, .a11y-reset):hover { border-color: var(--stroke-primary); color: var(--text-strong); }
  .nav-language__choices button:not([aria-checked="true"]):hover { background: var(--surface-muted); color: var(--text-strong); }
  .steve-say:not([data-speaking="true"]):hover { border-color: var(--stroke-primary); background: var(--bg-primary-weaker); }
  .snap:hover .polaroid { box-shadow: var(--shadow-md); }
}

/* accessibility switches: the whole row is the tap target, not the 46px track */
.a11y-row { margin: -6px -8px; padding: 6px 8px; border-radius: var(--radius-card); transition: background-color var(--dur); }
@media (hover: hover) { .a11y-row:hover { background: var(--surface-muted); } }

/* the "read more" link in the consent row gets a finger-sized target */
.consent-row a { display: inline-block; padding: 10px 2px; margin: -10px 0; }

/* a place's quest line is information, not a button: no box around it */
.guide-quest { padding: 2px 0; background: transparent; border: 0; border-radius: 0; }
.guide-quest[data-here="false"] { background: transparent; }
.guide-quest__art { background: var(--bg-primary-weaker); }

/* phones: the page's photo button is a round camera in the corner, so it
   covers a corner instead of half a row of cards */
@media (max-width: 640px) {
  .page-photo-cta { left: auto; right: var(--space-4); width: 64px; height: 64px; min-height: 64px; padding: 0; justify-content: center; border-radius: 50%; }
  .page-photo-cta .shoot-cta__ring { flex-basis: 44px; width: 44px; height: 44px; }
  .page-photo-cta .shoot-cta__ring svg { width: 26px; height: 26px; }
  .page-photo-cta__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

/* three language cards on the first screen: even height, names that fit a phone */
.langpick__choices { align-items: stretch; gap: 10px; }
.langpick__choice b { font-size: clamp(14px, 4.2vw, 19px); line-height: 1.25; }
@media (max-width: 420px) { .langpick__choice { padding-inline: 6px; } }

/* first screen: "terms and conditions" inside the agreement box opens what
   they mean for Go */
.langpick__terms {
  display: inline; padding: 10px 0; margin: -10px 0; border: 0; background: transparent;
  color: var(--text-primary-selected); font: inherit; font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
@media (hover: hover) { .langpick__terms:hover { text-decoration-thickness: 2px; } }

/* the terms sheet */
.go-terms { display: flex; flex-direction: column; gap: var(--space-4); text-align: left; }
.go-terms__intro { color: var(--text-weak); font-size: 15px; line-height: 1.5; margin: 0; }
.go-terms__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.go-terms__list li { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface-card, var(--bg-base)); }
.go-terms__list b { font-family: var(--font-display); font-size: 16px; line-height: 1.25; }
.go-terms__list span { font-size: 14px; line-height: 1.5; color: var(--text-weak); }
.go-terms__links { display: flex; flex-direction: column; gap: var(--space-2); }
.go-terms__links .bb-btn { display: flex; align-items: center; justify-content: center; min-height: 52px; padding: 12px 20px; text-decoration: none; text-align: center; }
.go-terms { padding-bottom: var(--space-4); }

/* ---- language dropdown (menu + settings) ---- */
.langsel { position: relative; display: inline-block; }
.langsel__btn { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap-min, 44px); padding: 6px 12px 6px 14px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--bg-base); color: var(--text-strong); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.langsel__btn .flag-chip { margin-right: 0; }
.langsel__btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.langsel__chev { display: inline-flex; width: 18px; height: 18px; color: var(--text-weaker); transition: transform .15s ease; }
.langsel__chev svg { width: 100%; height: 100%; }
.langsel.is-open .langsel__chev { transform: rotate(180deg); }
.langsel__pop { position: absolute; right: 0; z-index: 60; width: max(100%, 240px); max-width: calc(100vw - 32px); padding: 6px; border: 1px solid var(--border); border-radius: var(--radius-card, 16px); background: var(--bg-base); box-shadow: 0 12px 32px rgba(0, 0, 0, .18); }
.langsel--down .langsel__pop { top: calc(100% + 6px); }
.langsel--up .langsel__pop { bottom: calc(100% + 6px); }
.langsel__pop[hidden] { display: none; }
.langsel__search { width: 100%; min-height: 40px; margin-bottom: 6px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--bg-base); color: var(--text-strong); font: inherit; font-size: 14px; }
.langsel__search:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.langsel__list { list-style: none; margin: 0; padding: 0; max-height: min(320px, 50vh); overflow-y: auto; }
.langsel__list [role="option"] { display: flex; align-items: center; gap: 10px; min-height: var(--tap-min, 44px); padding: 8px 10px; border-radius: 10px; color: var(--text-strong); font-size: 15px; font-weight: 600; cursor: pointer; }
.langsel__list [role="option"] .flag-chip { margin-right: 0; }
.langsel__list [role="option"][hidden] { display: none; }
.langsel__list [role="option"]:hover, .langsel__list [role="option"]:focus { background: var(--surface-muted, rgba(0, 0, 0, .05)); outline: none; }
.langsel__list [role="option"]:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.langsel__list [role="option"][aria-selected="true"] { color: var(--bg-primary); }
.langsel__name { flex: 1; }
.langsel__tick { display: inline-flex; width: 18px; height: 18px; }
.langsel__tick svg { width: 100%; height: 100%; }
.langsel__none { margin: 6px 10px 8px; color: var(--text-weaker); font-size: 14px; }
.settings-lang { flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: 12px; }

/* Child-sized taps (UX audit N4): the controls a child presses on every
   screen (back, home, notes, coins, menu, a sheet's close) are 56px, the
   same as Steve's sound button, not the 44px adult minimum. */
.topbar .iconbtn { width: var(--tap-kid); height: var(--tap-kid); min-width: var(--tap-kid); }
.topbar .iconbtn svg { width: 26px; height: 26px; }
.brand-home { min-height: var(--tap-kid); min-width: var(--tap-kid); }
.notebell { flex-basis: var(--tap-kid); width: var(--tap-kid); height: var(--tap-kid); min-height: var(--tap-kid); }
.notebell svg { width: 26px; height: 26px; }
.coinpill { height: var(--tap-kid); min-height: var(--tap-kid); }
.nav-menu-wrap { width: 60px; height: 60px; flex-basis: 60px; }
.nav-menu { width: var(--tap-kid); height: var(--tap-kid); }
.sheet__close { width: var(--tap-kid); height: var(--tap-kid); }
.sheet__close svg { width: 22px; height: 22px; margin: -11px 0 0 -11px; }

/* The terms box on the first screen says who it is for (UX audit N5). */
.langpick__consent .langpick__who { display: block; margin-bottom: 2px; font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-primary-selected, var(--text-strong)); }

/* Five language tiles do not fit one row on a phone: three, then two
   (UX audit N14), so "Nederlands" fits its tile. */
@media (max-width: 420px) {
  .langpick__choices { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); justify-content: center; }
}

/* "Add to my guide" while the find is being saved */
[data-act="write"][aria-busy="true"] { opacity: .6; cursor: progress; }
