/* Scavenger Hunt: a sticker magnifying glass is the tap target. The little kids' find sits in its lens, the rim drains
   as the clock, and both finds show in a card under it. */
:root {
  --accent: var(--cinnamon);
  --pill-line: var(--cinnamon);
  --pill-on: var(--cinnamon);
  --pill-on-fg: #fff;
  --pill-focus: var(--cinnamon);
  --sh-drain: #f3e0d2; /* the rim's used-up part: about 5:1 against the cinnamon left */
  /* The stage (game.css): the glass's size, and the caption's height until the first Start, when fitScreen (kit.js)
     measures the tallest pair of finds and the tallest line read out on this phone at this text size */
  --char-min: 140px; --char-max: min(52vw, 220px);
  --cap-h: 9rem;
}
@media (prefers-color-scheme: dark) {
  :root { --pill-on-fg: #121a2c; --sh-drain: #3a2a24; }
}

/* "Scavenger" is the longest word in any game title: at 200% text it may break rather than run off the screen. */
h1 { overflow-wrap: anywhere; }

/* ----- The glass ----- */
.glass-btn {
  position: relative; border: 0; background: none; padding: 0; cursor: pointer; border-radius: 24px;
  width: min(40vw, 160px); aspect-ratio: 1; max-width: 100%; container-type: inline-size;
}
.glass-btn:focus-visible { outline: 4px solid var(--cinnamon); outline-offset: 6px; }
.glass-btn svg { width: 100%; height: 100%; display: block; overflow: visible; }
/* The lens's glass (scripts/icons/characters.mjs: middle at 84.7 of 200, 70.4 across inside the rim's ink). The
   picture and the Head back! face sit over it; both are aria-hidden, the finds and the status say it in words. */
.lens {
  position: absolute; left: 24.75%; top: 24.75%; width: 35.2%; aspect-ratio: 1; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; text-align: center; pointer-events: none;
}
.lens-pic { font-family: var(--display); font-size: 17cqw; line-height: 1; color: #1d2333; }
.lens-home { display: none; font-family: var(--display); font-size: 7cqw; line-height: 1.05; color: #1d2333; padding: 0 6%; }
.dealt .eyes { display: none; } /* the picture takes the lens while a find is up */
/* The last 10 seconds: the lens goes solid gold with "Head back!" (a colour swap, never a flash: review Must fix 2). */
.homing .lens { background: var(--sun); }
.homing .lens-pic { display: none; }
.homing .lens-home { display: block; }
.pupils, .glass-btn svg > g { transform-box: view-box; }
.pupils { animation: look 3.2s ease-in-out infinite; }
.dealt .pupils { animation: none; }
@keyframes look { 0%, 25% { transform: none; } 40%, 65% { transform: translateX(-9px); } 80%, 100% { transform: none; } }
.searching .glass-btn svg > g { transform-origin: 140px 140px; animation: sway 1.6s ease-in-out infinite alternate; }
@keyframes sway { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }

/* ----- The finds: two rows, 🐣 then 🦉, or one line to read out (show and tell, the tidy-up) ----- */
.card {
  width: 100%; background: var(--card); border: 3px solid var(--cinnamon); border-radius: 18px; padding: 8px 10px;
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
}
/* Before the first Start the card is out of sight but still in the accessibility tree (not hidden), so screen readers
   already know the live region when the first finds fill it. */
.card.idle { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); border: 0; }
.finds { display: flex; flex-direction: column; gap: 4px; }
.find { margin: 0; display: grid; grid-template-columns: auto 2em minmax(0, 1fr); align-items: center; column-gap: 6px; text-align: left; }
.find.e { min-height: var(--fe-h, 0px); } /* classes, not ids: fitScreen measures a copy with its ids taken off */
.find.t { min-height: var(--ft-h, 0px); }
.find .who { font-size: 1rem; line-height: 1; }
.find .pic { font-family: var(--display); font-size: 1.35rem; line-height: 1; text-align: center; color: var(--fg); }
.find .pic.letter { font-size: 1.15rem; color: var(--cinnamon); white-space: nowrap; }
.find .what { font-family: var(--display); font-size: 1.1rem; line-height: 1.12; text-wrap: balance; overflow-wrap: break-word; }
.find .hint { font-family: var(--body); font-weight: 800; font-size: .85rem; color: var(--muted); margin-left: .4em; white-space: nowrap; }
.tell { display: none; margin: 0; font-family: var(--display); font-size: 1.3rem; line-height: 1.15; text-wrap: balance; overflow-wrap: break-word; }
.telling .finds { display: none; }
.telling .tell { display: block; }
.count { font-family: var(--display); font-size: 1.1rem; color: var(--muted); min-height: 1.4em; margin: 0; font-variant-numeric: tabular-nums; }
html:not([data-docked]) .count { display: none; }

/* ----- House rules (always on the page, above Start before the first Start; plan section 2, safety's card) ----- */
.rules { width: 100%; text-align: left; background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 14px 16px; }
.rules h2 { font-family: var(--display); font-weight: 400; font-size: 1.25rem; line-height: 1.15; margin: 0 0 8px; }
.rules ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rules li { display: flex; gap: 10px; align-items: baseline; line-height: 1.35; }
.rules .pic { flex: none; width: 1.4em; text-align: center; }
.rules b { font-weight: 800; }
.grown { color: var(--muted); font-size: .9rem; line-height: 1.4; margin: 10px 0 0; }

/* ----- The dock (game.css): the main button full width (Pause stays a big target: it's also the "someone's hurt"
   button), and the small row under it: Done on the left, Eyes Up's small Pause in the middle, We're back! on the
   right, so neither coming or going ever moves Pause or the main button. A label that wraps to two lines (We're back!
   at 360 wide on some fonts) still fits the 44px row at the default text size, so the row never grows. ----- */
.running .main-btn { background: var(--muted); }
.done-btn, .home-btn {
  min-height: var(--eu-pause-h); max-width: 100%; padding: 0 10px; border-radius: 999px; cursor: pointer; line-height: 1.05;
  font-family: var(--body); font-weight: 800; font-size: 1rem; color: var(--fg); overflow-wrap: anywhere;
}
.done-btn { min-width: min(6.5rem, 100%); background: none; border: 2px dashed var(--muted); }
.home-btn { min-width: min(7rem, 100%); background: var(--card); border: 3px solid var(--cinnamon); }
.home-btn:focus-visible, .done-btn:focus-visible { outline: 3px solid var(--cinnamon); outline-offset: 3px; }
[data-docked] .dock-small { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); grid-auto-flow: dense; column-gap: 6px; }
.dock-small .done-btn { grid-column: 1; justify-self: start; }
.dock-small .eu-pause { grid-column: 2; }
.dock-small .home-btn { grid-column: 3; justify-self: end; }

/* ----- Eyes Up (game.css): the finds stay as a grey read-out; the dock's buttons go grey, no fill ----- */
[data-eyes-up][data-dimming] :is(.home-btn, .done-btn) { background: none; color: var(--eu-fg); border-color: var(--eu-fg); }
[data-eyes-up][data-dimming] .find .hint { color: var(--eu-fg); }
[data-eyes-up][data-dimming] .find .pic { color: inherit; }
[data-eyes-up][data-dimming] :is(.find .who, .find .pic) { filter: grayscale(1); }
[data-eyes-up][data-dimming] .home-btn:focus-visible, [data-eyes-up][data-dimming] .done-btn:focus-visible { outline-color: var(--eu-keep); }

@media (prefers-reduced-motion: reduce) {
  .pupils, .searching .glass-btn svg > g { animation: none; }
}
