/* Munch — warm, dark-first, single stylesheet. No build step, no framework. */

:root {
  color-scheme: dark light;

  --bg: #12100f;
  --bg-raised: #1c1917;
  --bg-sunken: #0c0b0a;
  --border: #2f2926;
  --border-strong: #453c37;
  --text: #f6f1ec;
  --text-muted: #a99f97;
  --accent: #ff7a3d;
  --accent-soft: rgba(255, 122, 61, 0.14);
  --accent-text: #1a0f08;
  --ok: #6ee7a8;
  --warn: #ffd166;
  --error: #ff8a80;

  --radius: 18px;
  --radius-lg: 26px;
  --radius-pill: 999px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.22);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.3), 0 14px 34px rgba(0, 0, 0, 0.3);
  --maxw: 1120px;

  /* Background wash. Four soft blooms, no images and no blur filter — the
     whole effect is one painted layer that never repaints on scroll. */
  --glow-1: rgba(255, 122, 61, 0.26);
  --glow-2: rgba(255, 186, 84, 0.18);
  --glow-3: rgba(122, 92, 224, 0.20);
  --glow-4: rgba(255, 94, 120, 0.14);
  --veil: rgba(0, 0, 0, 0.26);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fdf8f3;
    --bg-raised: #ffffff;
    --bg-sunken: #f2eae1;
    --border: #e6dbd0;
    --border-strong: #d2c2b4;
    --text: #241c17;
    --text-muted: #6f6259;
    --accent: #e2591b;
    --accent-soft: rgba(226, 89, 27, 0.1);
    --accent-text: #ffffff;
    --ok: #167a4e;
    --warn: #8a6100;
    --error: #b3261e;
    --shadow: 0 10px 28px rgba(90, 60, 40, 0.12);
    --shadow-card: 0 1px 2px rgba(120, 80, 50, 0.06), 0 8px 24px rgba(120, 80, 50, 0.09);
    --shadow-lift: 0 2px 6px rgba(120, 80, 50, 0.10), 0 16px 36px rgba(120, 80, 50, 0.14);

    --glow-1: rgba(255, 128, 60, 0.30);
    --glow-2: rgba(255, 196, 96, 0.34);
    --glow-3: rgba(146, 124, 240, 0.20);
    --glow-4: rgba(255, 116, 138, 0.18);
    --veil: rgba(255, 255, 255, 0.30);
  }
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/*
 * The background wash.
 *
 * A fixed pseudo-element rather than `background-attachment: fixed`, which
 * janks badly on iOS. Static gradients on their own layer: painted once,
 * composited thereafter, and nothing to download.
 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(46% 34% at 6% -6%, var(--glow-1), transparent 64%),
    radial-gradient(42% 32% at 100% 4%, var(--glow-2), transparent 62%),
    radial-gradient(56% 40% at 88% 96%, var(--glow-3), transparent 66%),
    radial-gradient(50% 34% at 14% 104%, var(--glow-4), transparent 64%);
}

/*
 * A veil over the blooms, so the wash stays behind the content instead of
 * competing with it. Raising the glow alphas alone reads as busy; raising
 * them and then knocking the whole layer back keeps the colour visible at
 * the edges while the middle — where the cards sit — settles down.
 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(78% 60% at 50% 46%, var(--veil), transparent 78%);
}

a { color: var(--accent); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ------------------------------------------------------------------ shell */

.app {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(12px, 3.5vw, 34px) clamp(12px, 3.5vw, 28px)
           max(28px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 2.4vw, 22px);
  min-height: 100vh;
  /* dvh tracks the collapsing mobile toolbars; vh above is the fallback. */
  min-height: 100dvh;
}

.app__header { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}

.brand__mark { font-size: 26px; }

.brand__name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand__tagline {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

/*
 * The sign-in strip.
 *
 * Above the footer and below everything that matters — an account is how a
 * subscription travels between devices, not something anyone came here for.
 */
.account {
  margin-top: auto;
  padding-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-muted);
}

.account[hidden] { display: none; }

/* The footer's own auto margin would fight this one; once the account strip
   is present it owns the gap and the footer sits directly beneath. */
.account:not([hidden]) + .app__footer { margin-top: 0; }

.account__form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.account__form .input { flex: 1 1 220px; min-width: 0; font-size: 14px; }
.account__form .input[hidden] { display: none; }
.account__form[hidden] { display: none; }

.account__state strong { color: var(--text); font-weight: 650; }
.account__status { margin: 0; min-height: 1.2em; }
.account__status[data-tone="ok"] { color: var(--ok); }
.account__status[data-tone="warn"] { color: var(--warn); }
.account__status[data-tone="error"] { color: var(--error); }

@media (max-width: 520px) {
  .account__form { flex-wrap: nowrap; }
  .account__form .input { flex: 1 1 auto; }
}

.app__footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12.5px;
}

.app__footer p { margin: 0; }
.app__footer code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  font-size: 0.92em;
}

/* --------------------------------------------------------------- progress */

.progress__list {
  display: flex;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.progress__item {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-raised);
}

.progress__item.is-done { border-color: var(--border-strong); color: var(--text); }

.progress__item.is-current {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.progress__btn {
  all: unset;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

/* ---------------------------------------------------------------- screens */

/*
 * The screens take the slack between the header and the footer. Without
 * this the footer sits at the bottom (margin-top: auto) and every screen
 * bunches against the header, leaving a dead band down the middle — most
 * of the viewport on a desktop, where there is the most slack to strand.
 */
.screens { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }

.screen { display: flex; flex-direction: column; gap: 14px; flex: 1 1 auto; }
.screen[hidden] { display: none; }

/* The two question screens hold four cards and nothing else, so they are
   centred in what is left; the results screen stays top-aligned, since it
   grows past the fold on its own. */
.screen--quiz { justify-content: center; gap: clamp(10px, 1.8vh, 18px); }
.screen__title { margin: 0; font-size: clamp(26px, 5vw, 38px); line-height: 1.15; letter-spacing: -0.03em; }
.screen__title:focus { outline: none; }
.screen__sub { margin: 0; color: var(--text-muted); max-width: 56ch; }

.screen__eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ---------------------------------------------------------------- options */

.options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 6px;
}

/* Two across on a phone so all four choices land above the fold. Stated
   outright rather than left to auto-fit, which drops to one column on the
   narrowest handsets — exactly where the scrolling hurt most. */
@media (max-width: 560px) {
  .options { grid-template-columns: 1fr 1fr; gap: 10px; }
  .option { padding: 14px 12px; }
  .option__blurb { font-size: 12.5px; }
}

/* The flavour screen has five options against the other screen's four, so a
   two-column grid leaves a widow on a third row. It runs full width instead —
   a deliberate row rather than a gap — and every card loses a little height so
   three rows still clear the fold. */
#flavor-options .option { min-height: clamp(84px, 13.5vh, 150px); }
#flavor-options .option:nth-child(5):last-child { grid-column: 1 / -1; }

/* Three rows of cards plus a Back button the first question does not have.
   The cards are content-sized at these widths, so the padding is what has to
   give — without it the screen scrolls by single-figure pixels, which is the
   most annoying amount to scroll by. */
@media (max-width: 560px) {
  #flavor-options { gap: 8px; }
  #flavor-options .option { padding: 11px 12px; }
}

@media (min-width: 561px) {
  /* Wide enough for five across, so the odd one out stops being odd. */
  #flavor-options { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  #flavor-options .option:nth-child(5):last-child { grid-column: auto; }
}

/* Short screens — small or older handsets — need more than two columns to
   clear the fold, so the descriptions go. The four labels carry the meaning
   on their own; the descriptions are flavour, and flavour is what you drop. */
@media (max-height: 700px) {
  .app { gap: 14px; }
  .brand__tagline { display: none; }
  .screen__sub { display: none; }
  .option__blurb { display: none; }
  .option { padding: 13px 12px; }
}

.option {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 14px;
  /* Sized against the viewport so the four cards feel like the page rather
     than a strip pinned under the header. The vh term keeps short screens
     honest — it shrinks before anything is pushed below the fold. */
  min-height: clamp(112px, 18vh, 190px);
  /* Centred rather than pinned top-and-bottom: the blurbs wrap to different
     line counts, and anchoring the text to the floor puts the four labels at
     four different heights. */
  justify-content: center;
  text-align: left;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.option { box-shadow: var(--shadow-card); }

@media (hover: hover) {
  .option:hover {
    transform: translateY(-3px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lift);
  }
}

.option[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.option__emoji { font-size: clamp(28px, 4.2vh, 44px); line-height: 1; margin-bottom: 6px; }

/* ------------------------------------------------------------ Munch+ */

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/*
 * The rainbow rim.
 *
 * Two backgrounds on one element rather than a pseudo-element: the card
 * surface clipped to the padding box, the gradient clipped to the border box.
 * A pseudo behind the card would be trapped the moment the card lifts on
 * hover, since a transform makes it a stacking context and a z-index:-1 child
 * can no longer sit behind its parent's own background.
 *
 * The angle animates through a registered custom property. Where @property is
 * unsupported the angle simply stays put and the rim is a static rainbow,
 * which is a fine place to land.
 */
@property --munch-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

.option--premium {
  position: relative;
  overflow: hidden;
  border-color: transparent;
  border-width: 2px;
  background:
    linear-gradient(var(--bg-raised), var(--bg-raised)) padding-box,
    conic-gradient(
      from var(--munch-angle),
      #ff5f6d, #ffc371, #f9f871, #47e0a0, #4facfe, #b06ab3, #ff5f6d
    ) border-box;
  animation: munch-spin 7s linear infinite;
}

.option--premium[aria-checked="true"] {
  background:
    linear-gradient(var(--accent-soft), var(--accent-soft)) padding-box,
    conic-gradient(
      from var(--munch-angle),
      #ff5f6d, #ffc371, #f9f871, #47e0a0, #4facfe, #b06ab3, #ff5f6d
    ) border-box;
}

@keyframes munch-spin {
  to { --munch-angle: 360deg; }
}

/* The shimmer sweep. Transform-only, so it composites rather than repaints. */
.option--premium::after {
  content: "";
  position: absolute;
  top: -60%;
  bottom: -60%;
  left: -40%;
  width: 28%;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: rotate(18deg) translateX(0);
  animation: munch-shimmer 3.6s ease-in-out infinite;
  opacity: 0.5;
}

@keyframes munch-shimmer {
  0%, 65% { transform: rotate(18deg) translateX(-120%); }
  100% { transform: rotate(18deg) translateX(520%); }
}

/* The badge sits in the corner rather than in the text flow, so it does not
   push the label around or cost the card a line of height. */
.premium {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  font-weight: 750;
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
}

.option--premium .premium {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 12px;
  padding: 4px 7px 4px 8px;
  border-radius: var(--radius-pill);
  background: var(--bg-sunken);
  border: 1px solid var(--border-strong);
  color: var(--text);
}

.premium__plus { width: 0.9em; height: 0.9em; display: block; margin-left: 1px; }

/* Alongside the "Diagnosis" eyebrow on the results screen. */
.premium--inline {
  margin-left: 8px;
  font-size: 11px;
  vertical-align: baseline;
  color: var(--text);
  text-transform: none;
  letter-spacing: -0.01em;
}

.premium--inline[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  /* Keep the rainbow, drop the movement. */
  .option--premium { animation: none; }
  .option--premium::after { display: none; }
}
.option__label { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
.option__blurb { font-size: 13px; color: var(--text-muted); }

/* --------------------------------------------------------------- controls */

.btn {
  align-self: flex-start;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-raised);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.12s ease, border-color 0.12s ease;
}

.btn:hover { filter: brightness(1.08); }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
  padding-left: 0;
}

.btn--ghost:hover { color: var(--text); }

.input, .select {
  padding: 11px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-sunken);
  color: var(--text);
  font: inherit;
  min-width: 0;
}

.select { border-radius: 12px; padding: 7px 12px; }

.link-btn {
  all: unset;
  cursor: pointer;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
}

/* -------------------------------------------------------------- diagnosis */

.screen--results { gap: 20px; }

.diagnosis {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.diagnosis__verdict {
  margin: 0;
  font-size: 18px;
  color: var(--text-muted);
  max-width: 60ch;
}

/* Escape hatch from the derived cuisine — deliberately quiet, and below the
   diagnosis, so the app still reads as having made up its mind. */
.swap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.swap[hidden] { display: none; }
.swap__label { font-size: 13.5px; color: var(--text-muted); }
.swap__options { display: flex; gap: 8px; flex-wrap: wrap; }

.swap__btn {
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.swap__btn:hover { color: var(--text); border-color: var(--border-strong); }

/* ----------------------------------------------------------------- reveal */

.reveal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  opacity: 0;
  /* Kept in step with the dismissal delay in reveal.js. */
  transition: opacity 0.32s ease;
}

.reveal[hidden] { display: none; }
.reveal.is-open { opacity: 1; }

.reveal__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.reveal__stage {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(140px, 42vw, 200px);
  height: clamp(140px, 42vw, 200px);
}

.reveal__emoji {
  font-size: clamp(64px, 18vw, 104px);
  line-height: 1.1;
  animation: bob 1.15s ease-in-out infinite;
}

/* Rings and confetti fire once, on landing. */
.reveal__ring {
  position: absolute;
  width: 120px;
  height: 120px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  opacity: 0;
}

.reveal[data-phase="landed"] .reveal__ring { animation: ring 900ms ease-out both; }
.reveal[data-phase="landed"] .reveal__ring--late { animation-delay: 180ms; }

@keyframes ring {
  0% { opacity: 0.75; transform: scale(0.35); }
  100% { opacity: 0; transform: scale(2.4); }
}

.reveal__burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.confetti {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--size, 8px);
  height: var(--size, 8px);
  border-radius: 2px;
  background: var(--accent);
  animation: burst 950ms cubic-bezier(0.15, 0.7, 0.3, 1) var(--delay, 0ms) both;
}

.confetti--alt { background: var(--text); opacity: 0.55; border-radius: 50%; }

@keyframes burst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3) rotate(0); }
  18% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y)))
      scale(1) rotate(var(--spin, 180deg));
  }
}

.reveal[data-phase="landed"] .reveal__emoji {
  animation: land 0.7s cubic-bezier(0.2, 1.5, 0.35, 1) both;
}

/* A warm wash behind the answer, so landing changes the whole screen. */
.reveal[data-phase="landed"]::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 45% at 50% 42%, var(--accent-soft), transparent 70%);
  animation: wash 700ms ease both;
  pointer-events: none;
}

@keyframes wash { from { opacity: 0; } to { opacity: 1; } }

@keyframes bob {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-10px) scale(1.04); }
}

@keyframes land {
  0% { transform: scale(0.45) rotate(-10deg); opacity: 0.35; }
  60% { transform: scale(1.12) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.reveal__caption {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.reveal__cuisine {
  margin: 0;
  font-size: clamp(34px, 10vw, 56px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.reveal[data-phase="landed"] .reveal__cuisine { animation: rise 0.55s ease both 0.14s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.reveal__hint {
  margin: 22px 0 0;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.65;
}

/* ---------------------------------------------------------------- locator */

.locator {
  padding: clamp(14px, 2.5vw, 20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-sunken);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.locator__actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.locator__form { display: flex; align-items: center; gap: 8px; flex: 1 1 320px; }
.locator__form .input { flex: 1 1 auto; }
.locator__status { margin: 0; font-size: 14px; color: var(--text-muted); min-height: 1.2em; }
.locator__status[data-tone="ok"] { color: var(--ok); }
.locator__status[data-tone="warn"] { color: var(--warn); }
.locator__status[data-tone="error"] { color: var(--error); }
.locator__status[data-tone="busy"]::after {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------------------------------------------------------------- results */

.results { display: flex; flex-direction: column; gap: 12px; }
.results[hidden] { display: none; }

.results__bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.results__count { margin: 0; color: var(--text-muted); font-size: 14px; }

/* Map and list share the screen. On a phone they stack, map first; from
   860px they sit side by side and the map sticks while the list scrolls. */
.results__panes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

@media (min-width: 860px) {
  .results__panes { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 20px; }
  .screen__title { font-size: clamp(34px, 3.6vw, 46px); }
  .diagnosis__verdict { font-size: 20px; }

  /* A desktop window is mostly slack. Rather than leave four small cards
     floating in it, the question reads as a lede and the cards take real
     room — the same layout, sized for the screen it is actually on. */
  .screen--quiz .screen__sub { font-size: 20px; max-width: 62ch; }
  .screen--quiz .options { gap: 18px; }
  .screen--quiz .option { min-height: clamp(150px, 21vh, 220px); padding: 24px 22px; }
  /* Five narrower cards carry less text per line, so they need less height. */
  #flavor-options .option { min-height: clamp(140px, 19vh, 200px); }
  .screen--quiz .option__label { font-size: 20px; }
  .screen--quiz .option__blurb { font-size: 14.5px; }
  .places { grid-template-columns: 1fr; }
  #map { height: clamp(420px, 62vh, 640px); }

  .results__map {
    position: sticky;
    top: 16px;
  }

  /* The list scrolls with the page rather than in its own box — a nested
     scroll area next to a sticky map traps the wheel. */

  .places { grid-template-columns: 1fr; margin-top: 0; }
}

.results__map[hidden] { display: none; }

#map {
  height: clamp(300px, 46vh, 520px);
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-sunken);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.pin {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.pin--match { background: var(--accent); }
.pin--near { background: #8d8078; }
.pin--here { background: #2f6bff; }

/* Google renders info windows on a white surface in both themes. */
.gm-style .popup__meta { color: #555; }

/* A configuration problem the user has to fix — key missing or rejected. */
.notice {
  margin: 0;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--warn);
  background: var(--accent-soft);
  color: var(--text);
  font-size: 14px;
}

.notice[hidden] { display: none; }

/*
 * The venue-grounded suggestion.
 *
 * Styled as a quiet aside rather than a headline: it is a reading of the
 * results, not a claim about them, and the note under the lead says as much.
 */
.suggestion {
  margin: 0;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-sunken);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.suggestion[hidden] { display: none; }

.suggestion__lead { font-size: 15.5px; font-weight: 650; letter-spacing: -0.01em; }
.suggestion__note { font-size: 13px; color: var(--text-muted); }

/* A hunch looks like a hunch. */
.suggestion[data-confidence="strong"] { border-color: var(--border-strong); }
.suggestion[data-confidence="strong"] .suggestion__lead { color: var(--accent); }
.suggestion[data-confidence="possible"] .suggestion__lead { color: var(--text-muted); font-weight: 600; }

.sort {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.places {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.place {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

@media (hover: hover) {
  .place:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lift);
  }
}

.place__head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }

.place__photo-slot { margin: 2px 0 4px; }

/* Photos cost money per fetch, so the card offers rather than loads. */
.place__photo-btn {
  width: 100%;
  padding: 10px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.place__photo-btn:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.place__photo { margin: 0; }

.place__photo img {
  display: block;
  width: 100%;
  /* Reserved up front so arriving images do not shift the list. Wide rather
     than square: with 20 results, card height is what makes the list
     unscannable. */
  aspect-ratio: 2 / 1;
  object-fit: cover;
  border-radius: 14px;
  background: var(--bg-sunken);
}

.place__credit {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.8;
}

.place__credit a { color: inherit; }
.place__name { margin: 0; font-size: 17px; letter-spacing: -0.01em; }
.place__distance { color: var(--accent); font-weight: 650; font-size: 14px; white-space: nowrap; }
.place__meta { margin: 0; font-size: 13.5px; color: var(--text-muted); }
.place__type { text-transform: capitalize; }
.place__hours { margin: 0; font-size: 13px; color: var(--text-muted); }
.place__rating { margin: 0; font-size: 14px; font-weight: 600; color: var(--text); }
.place__rating span { color: var(--accent); }
.place__badges { display: flex; gap: 6px; flex-wrap: wrap; }

.badge {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
}

.badge--match { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.badge--open { border-color: var(--ok); color: var(--ok); }
.badge--shut { border-color: var(--error); color: var(--error); }

.place__links { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; margin-top: 2px; }

@media (max-width: 520px) {
  /* `wrap` here would size the flex line to the widest item rather than to
     the container, and the search row is wider than a small handset — which
     is a sideways scrollbar, not a wrapped row. Stacked, there is nothing
     left to wrap. */
  .locator__actions { flex-direction: column; align-items: stretch; flex-wrap: nowrap; }
  /* The row basis is a main-axis size, which becomes height once the parent
     stacks — leave the form to size itself instead. */
  .locator__form { flex: 0 0 auto; min-width: 0; }
  .btn--primary { text-align: center; }
}
