/* =============================================================================
   Will It Rain — sky UI
   The background is a stack of flat colour bands radiating from a core that
   moves on every load. Everything readable sits on a frosted panel above it.
   ========================================================================== */

:root {
  color-scheme: light;

  --ink: #241e33;
  --ink-soft: rgb(36 30 51 / 68%);
  --ink-faint: rgb(36 30 51 / 50%);
  --sheet: rgb(255 255 255 / 90%);
  --sheet-line: rgb(36 30 51 / 8%);
  --pill: rgb(36 30 51 / 6%);
  --surface: #fbf8fc;
  --surface-2: #ffffff;
  --surface-line: #e7e1ef;
  --brand: #6b4ea8;
  --brand-ink: #ffffff;
  --sky-ink: #ffffff;
  --glass: rgb(20 14 30 / 30%);
  --glass-line: rgb(255 255 255 / 30%);
  --wet-light: #57bdf0;
  --wet-moderate: #ffcc55;
  --wet-heavy: #ff7a7a;
  --dry-bar: rgb(36 30 51 / 18%);
  --ok: #38a169;
  --warn: #d69e2e;
  --bad: #e05252;
  --radius: 1.75rem;
  --tap: 2.9rem;
  --shadow: 0 -10px 46px rgb(20 10 30 / 20%);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --ink: #f4f0fa;
  --ink-soft: rgb(244 240 250 / 72%);
  --ink-faint: rgb(244 240 250 / 55%);
  --sheet: rgb(16 11 24 / 78%);
  --sheet-line: rgb(255 255 255 / 10%);
  --pill: rgb(255 255 255 / 10%);
  --surface: #100c18;
  --surface-2: #171122;
  --surface-line: #2a2138;
  --brand: #b9a3ec;
  --brand-ink: #150f20;
  --dry-bar: rgb(255 255 255 / 30%);
  --shadow: 0 -10px 46px rgb(0 0 0 / 45%);
}

* {
  box-sizing: border-box;
}

/* Several components set a display value; keep [hidden] authoritative. */
[hidden] {
  display: none !important;
}

html {
  overflow-x: hidden;
  overflow-x: clip;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  overflow-x: clip;
  min-height: 100vh;
  color: var(--ink);
  background: var(--surface);
  font-family: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Noto Sans Thai UI is designed for compact interface text and avoids relying
   on an unpredictable operating-system fallback for Thai combining marks. */
html[lang="th"] :is(
  body,
  button,
  input,
  .place-chip,
  .state-chip,
  .answer,
  .hero,
  .pill,
  .section-title,
  .details summary,
  .detail-section h3
) {
  font-family: "Noto Sans Thai UI", "Tahoma", system-ui, sans-serif;
}

html[lang="th"] body { line-height: 1.62; }

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

:where(a) {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
  border-radius: 0.55rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ── the sky ───────────────────────────────────────────────────────────── */

.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.sky svg {
  width: 100%;
  height: 100%;
  display: block;
}

.sky .ring {
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0);
  animation: bloom 900ms cubic-bezier(0.22, 1.15, 0.36, 1) forwards;
  animation-delay: calc(var(--i, 0) * 46ms);
}

.sky.settled .ring,
.sky svg.settled .ring {
  animation: none;
  transform: none;
}

@keyframes bloom {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

.sky .rings {
  transform-box: fill-box;
  transform-origin: center;
  animation: breathe 24s ease-in-out infinite alternate;
}

@keyframes breathe {
  from { transform: scale(1); }
  to { transform: scale(1.022); }
}

.sky .spark {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  animation: spark 1100ms ease-out forwards;
  animation-delay: var(--d, 0ms);
}

@keyframes spark {
  0% { opacity: 0; transform: translate(0, 0) scale(0.3); }
  25% { opacity: 0.9; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.9); }
}

.sky .chr {
  filter: drop-shadow(0 7px 12px rgb(28 10 40 / 22%));
}

.sky .sway { animation: sway 8s ease-in-out infinite alternate; }
.sky .bob { animation: bob 5.4s ease-in-out infinite alternate; }
.sky .spin { animation: spin 48s linear infinite; transform-box: fill-box; transform-origin: center; }
.sky .pulse { animation: ring 3s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.sky .tw { animation: twinkle 3.6s ease-in-out infinite; }
.sky .zone-ring { animation: turn 26s linear infinite; }

@keyframes sway { from { transform: translate(-9px, -4px); } to { transform: translate(11px, 5px); } }
@keyframes bob { from { transform: translateY(-7px); } to { transform: translateY(7px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ring { 0% { transform: scale(0.7); opacity: 0.55; } 100% { transform: scale(2); opacity: 0; } }
@keyframes twinkle { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
@keyframes turn { to { stroke-dashoffset: -120; } }

.sky .rain {
  animation: fall 1.5s linear infinite;
}

@keyframes fall {
  0% { opacity: 0; transform: translateY(-6px); }
  18% { opacity: 0.95; }
  84% { opacity: 0.95; }
  100% { opacity: 0; transform: translateY(var(--fall, 90px)); }
}

/* the curved cloud → you link */
.sky .link-line {
  stroke-dasharray: 8 12;
  /* Unhurried: the line should read as a gentle current, not a barber pole. */
  animation: flow 2.6s linear infinite;
  opacity: 0.82;
}

@keyframes flow { to { stroke-dashoffset: -40; } }

.sky .link-head {
  animation: nudge 1.5s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes nudge {
  0%, 100% { opacity: 0.75; }
  55% { opacity: 1; }
}

.sky .link-dot { opacity: 0.95; }
.sky .link-dot-trail { opacity: 0.5; }
.sky .link-dot-halo { opacity: 0.22; }

.sky .you-label,
.sky .zone-label {
  font-family: "Baloo 2", system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  fill: #fff;
  paint-order: stroke;
  stroke: rgb(20 10 30 / 30%);
  stroke-width: 3px;
}

.sky .zone-label { font-size: 1rem; }

/* ── shell ─────────────────────────────────────────────────────────────── */

.app-shell {
  position: relative;
  z-index: 1;
}

.stage {
  /* Order matters. `vh` on iOS Safari is the height with the toolbars hidden,
     so it must be the OLD-browser fallback and `svh`/`dvh` must come after it —
     the other way round leaves the answer sheet under the bottom toolbar. */
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  padding:
    max(1.1rem, env(safe-area-inset-top))
    1.15rem
    max(0.9rem, env(safe-area-inset-bottom));
}

.stage-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
  /* The answer keeps the same place on the screen whatever the phone: pinned to
     the bottom of the first view, with the sky taking whatever is left over. */
  min-height: 0;
}

/* ── top bar ───────────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 1.4rem;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex: none;
}

.language-toggle {
  display: inline-flex;
  align-items: center;
  height: 2rem;
  padding: 0.16rem;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(10px);
}

.language-toggle button {
  display: grid;
  place-items: center;
  min-width: 2rem;
  height: 1.58rem;
  padding: 0 0.38rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--sky-ink);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.035em;
  opacity: 0.68;
  transition: background 180ms ease, color 180ms ease, opacity 180ms ease;
}

.language-toggle button.is-active {
  background: #fff;
  color: #2a2438;
  box-shadow: 0 1px 4px rgb(0 0 0 / 18%);
  opacity: 1;
}

.place-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  margin: 0;
  padding: 0.42rem 0.85rem 0.42rem 0.65rem;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(10px);
  color: var(--sky-ink);
  font-family: "Baloo 2", system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  max-width: 12rem;
}

.place-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.place-chip svg {
  width: 0.95rem;
  height: 0.95rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.location-badge {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  flex: none;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  color: #ffd7a1;
  padding: 0;
  animation: badge-in 420ms cubic-bezier(0.2, 1.3, 0.4, 1) both;
}

.location-badge svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.location-badge .slash { stroke-width: 2.2; }

@keyframes badge-in {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

.freshness {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  margin: 0;
  color: var(--sky-ink);
  font-size: 0.76rem;
  opacity: 0.86;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgb(20 10 30 / 35%);
}

.freshness .dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 999px;
  background: var(--ok);
}

.freshness[data-state="aging"] .dot { background: var(--warn); }
.freshness[data-state="stale"] .dot,
.freshness[data-state="unavailable"] .dot { background: var(--bad); }

.theme-toggle {
  position: relative;
  width: 3.9rem;
  height: 2rem;
  flex: none;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  padding: 0;
}

.theme-toggle .knob {
  position: absolute;
  top: 0.17rem;
  left: 0.17rem;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 6px rgb(0 0 0 / 24%);
  transition: transform 260ms cubic-bezier(0.2, 1.2, 0.4, 1);
}

.theme-toggle[aria-checked="true"] .knob {
  transform: translateX(1.87rem);
}

.theme-toggle .ico {
  position: absolute;
  top: 0.46rem;
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .ico-sun { left: 0.45rem; stroke: #2a2438; }
.theme-toggle .ico-moon { right: 0.45rem; stroke: #fff; }
.theme-toggle[aria-checked="true"] .ico-sun { stroke: #fff; }
.theme-toggle[aria-checked="true"] .ico-moon { stroke: #2a2438; }

/* ── the mascot's speech bubble ────────────────────────────────────────── */

.cloud-bubble {
  position: fixed;
  z-index: 4;
  left: var(--bubble-x, 50%);
  top: var(--bubble-y, 9rem);
  transform: translateX(-50%);
  width: min(19rem, calc(100vw - 2rem));
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  padding: 0.7rem 0.5rem 0.7rem 0.9rem;
  border-radius: 1.1rem;
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: 0 12px 30px rgb(20 10 30 / 26%);
  animation: bubble-in 420ms cubic-bezier(0.2, 1.25, 0.4, 1) both;
}

.cloud-bubble[hidden] { display: none; }

.cloud-bubble.is-leaving {
  animation: bubble-out 320ms ease forwards;
}

.cloud-bubble::before {
  content: "";
  position: absolute;
  top: -0.42rem;
  left: var(--tail-x, 1.6rem);
  width: 0.9rem;
  height: 0.9rem;
  background: inherit;
  transform: rotate(45deg);
  border-radius: 0.18rem;
}

.cloud-bubble.is-above::before {
  top: auto;
  bottom: -0.42rem;
}

.cloud-bubble p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.4;
}

.bubble-close {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-faint);
  padding: 0;
}

.bubble-close svg {
  width: 0.85rem;
  height: 0.85rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}

@keyframes bubble-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px) scale(0.9); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

@keyframes bubble-out {
  to { opacity: 0; transform: translateX(-50%) translateY(-6px) scale(0.96); }
}

/* ── "there's more" hint ───────────────────────────────────────────────────
   Deliberately quiet: it sits under the answer, never over it, and it retires
   the moment you start scrolling. */

.scroll-hint {
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.02rem;
  margin-top: 0.3rem;
  padding: 0 0.7rem;
  border: 0;
  background: transparent;
  color: var(--sky-ink);
  opacity: 0.62;
  transition: opacity 320ms ease, transform 320ms ease;
}

/* The word is a nicety; on a short screen the sky needs the pixels more. */
.scroll-hint span { display: none; }

@media (min-height: 46rem) {
  .scroll-hint span { display: block; }
}

.scroll-hint span {
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  text-shadow: 0 1px 5px rgb(20 10 30 / 45%);
}

.scroll-hint svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 5px rgb(20 10 30 / 45%));
  animation: hint-dip 2.6s cubic-bezier(0.4, 0, 0.35, 1) infinite;
}

.scroll-hint.is-away {
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
}

@keyframes hint-dip {
  0%, 62%, 100% { transform: translateY(0); }
  76% { transform: translateY(4px); }
  88% { transform: translateY(1px); }
}

/* ── the answer sheet ──────────────────────────────────────────────────── */

.sheet {
  margin-top: auto;
  padding: 1.15rem 1.15rem 1rem;
  border-radius: var(--radius) var(--radius) 1.35rem 1.35rem;
  background: var(--sheet);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  animation: sheet-in 620ms cubic-bezier(0.2, 0.85, 0.3, 1) both;
  animation-delay: 180ms;
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.state-chip {
  display: inline-block;
  margin: 0;
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  background: var(--pill);
  color: var(--ink-soft);
  font-family: "Baloo 2", system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.82rem;
}

.sheet.is-rain .state-chip { background: rgb(255 155 165 / 20%); color: #c4515c; }
.sheet.is-clear .state-chip { background: rgb(76 175 122 / 18%); color: #2c7a55; }
.sheet.is-unsupported .state-chip { background: rgb(214 158 46 / 20%); color: #8a6a22; }
.sheet.is-error .state-chip { background: rgb(224 82 82 / 18%); color: #b03b3b; }

:root[data-theme="dark"] .sheet.is-rain .state-chip { color: #ffaab2; }
:root[data-theme="dark"] .sheet.is-clear .state-chip { color: #8de3b4; }
:root[data-theme="dark"] .sheet.is-unsupported .state-chip { color: #f0cd82; }
:root[data-theme="dark"] .sheet.is-error .state-chip { color: #ff9b9b; }

.answer {
  margin: 0.55rem 0 0;
  font-family: "Baloo 2", system-ui, sans-serif;
  font-size: clamp(1.65rem, 6.6vw, 2rem);
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: -0.01em;
}

.hero {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0.1rem 0 0;
  font-family: "Baloo 2", system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(3rem, 14vw, 3.9rem);
  line-height: 1;
  letter-spacing: -0.02em;
}

.hero[hidden] { display: none; }

.hero-unit {
  font-size: 0.42em;
  font-weight: 600;
  opacity: 0.85;
}

.blurb {
  margin: 0.55rem 0 0;
  color: var(--ink-soft);
  font-size: 0.96rem;
  line-height: 1.45;
  text-wrap: pretty;
}

/* the next hour */

.ribbon-wrap { margin-top: 1.05rem; }
.ribbon-wrap[hidden] { display: none; }

.ribbon {
  display: flex;
  align-items: flex-end;
  gap: 0.25rem;
  height: 1.9rem;
}

.ribbon i {
  display: block;
  flex: 1;
  height: 0.56rem;
  border-radius: 0.32rem;
  background: var(--dry-bar);
  transition: height 320ms cubic-bezier(0.2, 1.1, 0.4, 1), opacity 320ms ease;
}

.ribbon i.wet { height: 1.62rem; background: var(--wet-light); }
.ribbon i.wet.moderate { background: var(--wet-moderate); }
.ribbon i.wet.heavy { background: var(--wet-heavy); }
.ribbon i.maybe { height: 1rem; background: var(--dry-bar); opacity: 0.85; }
.ribbon i.beyond { opacity: 0.45; }

.ribbon-legend {
  display: flex;
  justify-content: space-between;
  margin: 0.45rem 0 0;
  color: var(--ink-faint);
  font-size: 0.7rem;
}

.sheet-actions {
  display: flex;
  gap: 0.55rem;
  margin-top: 1rem;
}

.pill {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: var(--tap);
  padding: 0.45rem 0.8rem;
  border-radius: 1rem;
  background: var(--pill);
  color: inherit;
  text-decoration: none;
}

.pill-grow {
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
  justify-content: center;
  min-width: 0;
}

.pill-label { font-size: 0.7rem; color: var(--ink-faint); }

.pill-value {
  font-family: "Baloo 2", system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
}

.pill-link svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pill-link span {
  font-family: "Baloo 2", system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
}

.sheet-foot {
  margin: 0.75rem 0 0;
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.68rem;
  line-height: 1.45;
}

/* ── everything else ───────────────────────────────────────────────────── */

.drawer {
  position: relative;
  background: var(--surface);
  border-radius: 1.75rem 1.75rem 0 0;
  margin-top: -1.1rem;
  padding: 1.4rem 0 2rem;
  box-shadow: 0 -2px 0 var(--surface-line);
}

.drawer-inner {
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
  padding: 0 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.section-title {
  margin: 0;
  font-family: "Baloo 2", system-ui, sans-serif;
  font-size: 1.08rem;
  font-weight: 700;
}

.tools { display: flex; flex-direction: column; gap: 0.7rem; }

.tool-row { display: flex; flex-direction: column; gap: 0.55rem; }

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--tap);
  padding: 0.6rem 1rem;
  border: 0;
  border-radius: 0.9rem;
  background: var(--brand);
  color: var(--brand-ink);
  font-family: "Baloo 2", system-ui, sans-serif;
  font-weight: 600;
  transition: filter 160ms ease, transform 160ms ease;
}

.primary-button:hover { filter: brightness(1.08); }
.primary-button:active { transform: translateY(1px); }
.primary-button:disabled { opacity: 0.65; cursor: wait; }

.primary-button svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.ghost-button {
  min-height: 2.4rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--surface-line);
  border-radius: 0.75rem;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 600;
}

.ghost-button:hover { border-color: var(--brand); color: var(--brand); }

.search-control {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.35rem 0.3rem 0.75rem;
  border: 1px solid var(--surface-line);
  border-radius: 0.9rem;
  background: var(--surface-2);
}

.search-control:focus-within { border-color: var(--brand); }

.search-icon {
  width: 1.05rem;
  height: 1.05rem;
  flex: none;
  fill: none;
  stroke: var(--ink-faint);
  stroke-width: 2;
  stroke-linecap: round;
}

.search-control input {
  flex: 1;
  min-width: 0;
  min-height: 2.4rem;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 0.95rem;
}

.search-control input:focus { outline: none; }

.search-control button {
  min-height: 2.4rem;
  padding: 0.35rem 0.85rem;
  border: 0;
  border-radius: 0.7rem;
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 600;
  font-size: 0.88rem;
}

.inline-status {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  min-height: 1.1rem;
}

.location-reminder {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.6rem 0.7rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--surface-line);
  border-left: 3px solid var(--warn);
  border-radius: 0.9rem;
  background: var(--surface-2);
}

.location-reminder[hidden] { display: none; }

.location-reminder > svg {
  width: 1.2rem;
  height: 1.2rem;
  margin-top: 0.1rem;
  fill: none;
  stroke: var(--warn);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.location-reminder p { margin: 0; font-size: 0.86rem; line-height: 1.45; }
.location-reminder strong { display: block; }
.location-reminder span { color: var(--ink-soft); }

.location-reminder-actions {
  grid-column: 2;
  display: flex;
  gap: 0.5rem;
}

.search-results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.search-results:empty { display: none; }

.search-results button {
  width: 100%;
  min-height: var(--tap);
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--surface-line);
  border-radius: 0.8rem;
  background: var(--surface-2);
  color: inherit;
  text-align: left;
  font-size: 0.88rem;
  line-height: 1.4;
}

.search-results button:hover { border-color: var(--brand); }

.map-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.9rem;
  border: 1px solid var(--surface-line);
  border-radius: 1.15rem;
  background: var(--surface-2);
  scroll-margin-top: 1rem;
}

.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.area-key {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--ink-faint);
  font-size: 0.74rem;
}

.area-key > span:first-child {
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid var(--brand);
  border-radius: 0.2rem;
  background: rgb(107 78 168 / 14%);
}

@media (max-width: 25rem) {
  .topbar { gap: 0.45rem; }
  .topbar-actions { gap: 0.3rem; }
  .place-chip { max-width: 8.5rem; }
  .freshness { font-size: 0.69rem; }
  .theme-toggle { width: 3.55rem; }
  .theme-toggle[aria-checked="true"] .knob { transform: translateX(1.52rem); }
}

#map {
  height: 15rem;
  border-radius: 0.85rem;
  overflow: hidden;
  background: var(--surface);
  z-index: 0;
}

.hint { margin: 0; color: var(--ink-faint); font-size: 0.78rem; line-height: 1.45; }

.details {
  border: 1px solid var(--surface-line);
  border-radius: 1.15rem;
  background: var(--surface-2);
  overflow: hidden;
}

.details summary {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.85rem 0.95rem;
  cursor: pointer;
  font-family: "Baloo 2", system-ui, sans-serif;
  font-weight: 700;
  list-style: none;
}

.details summary::-webkit-details-marker { display: none; }
.details-hint { font-family: "Nunito Sans", sans-serif; font-weight: 400; font-size: 0.78rem; color: var(--ink-faint); }

.details-content {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 0 0.95rem 1rem;
}

.detail-section h3 {
  margin: 0 0 0.2rem;
  font-size: 0.86rem;
  font-weight: 700;
}

.detail-section p { margin: 0; font-size: 0.86rem; line-height: 1.5; color: var(--ink-soft); }
.detail-note { margin-top: 0.4rem !important; font-size: 0.8rem !important; color: var(--ink-faint) !important; }
.detail-note[hidden] { display: none; }

.technical-details {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin: 0;
  padding-top: 0.7rem;
  border-top: 1px solid var(--surface-line);
}

.technical-details div { display: flex; flex-direction: column; gap: 0.1rem; }
.technical-details dt { font-size: 0.72rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.05em; }
.technical-details dd { margin: 0; font-size: 0.82rem; line-height: 1.45; overflow-wrap: anywhere; }

.radar-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.9rem;
  border: 1px solid var(--surface-line);
  border-radius: 1.15rem;
  background: var(--surface-2);
}

footer { display: flex; flex-direction: column; gap: 0.5rem; }
.safety-note, .attribution { margin: 0; font-size: 0.78rem; line-height: 1.5; color: var(--ink-soft); }
.attribution { color: var(--ink-faint); }
footer a { color: var(--brand); }

/* ── leaflet ───────────────────────────────────────────────────────────── */

.leaflet-container { font: inherit; background: var(--surface); }
.leaflet-control-attribution { font-size: 0.62rem; }

:root[data-theme="dark"] .leaflet-tile { filter: brightness(0.72) saturate(0.75); }

.selected-location-marker .map-pin {
  display: block;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0.35rem;
  border-radius: 999px;
  background: var(--brand);
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px rgb(107 78 168 / 35%);
}

.location-tooltip { font-size: 0.78rem; }

/* ── wide screens: the sky gets the room, the answer stays a column ────── */

@media (min-width: 56.25rem) {
  .stage { padding: 1.6rem 2.2rem 2.2rem; }

  .stage-inner {
    max-width: 76rem;
    display: grid;
    grid-template-columns: minmax(20rem, 30rem) 1fr;
    grid-template-rows: auto 1fr;
    column-gap: 2rem;
    align-items: start;
  }

  .topbar { grid-column: 1 / -1; }
  .sheet { grid-column: 1; grid-row: 2; align-self: end; max-width: 30rem; }
  .cloud-bubble { --bubble-y: 8rem; }

  .drawer-inner {
    max-width: 68rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
    align-items: start;
  }

  .tools { grid-column: 1; }
  .map-card { grid-column: 2; grid-row: 1 / span 2; }
  #map { height: 22rem; }
  .details { grid-column: 1; }
  .radar-tools { grid-column: 1 / -1; }
  footer { grid-column: 1 / -1; }
  .tool-row { flex-direction: row; align-items: center; }
  .search-form { flex: 1; }
}

/* ── short screens: the sky must not be squeezed out ──────────────────── */

@media (max-height: 46rem) {
  .sheet { padding: 0.9rem 1rem 0.85rem; border-radius: 1.5rem 1.5rem 1.1rem 1.1rem; }
  .answer { font-size: clamp(1.4rem, 5.6vw, 1.7rem); }
  .hero { font-size: clamp(2.4rem, 11vw, 3rem); }
  .blurb { font-size: 0.88rem; margin-top: 0.4rem; }
  .ribbon-wrap { margin-top: 0.75rem; }
  .ribbon { height: 1.5rem; }
  .ribbon i.wet { height: 1.28rem; }
  /* A short screen leaves little sky, so the mascot speaks more compactly. */
  .cloud-bubble { padding: 0.52rem 0.45rem 0.52rem 0.75rem; border-radius: 0.95rem; }
  .cloud-bubble p { font-size: 0.79rem; line-height: 1.32; }
  .sheet-actions { margin-top: 0.7rem; }
  .pill { min-height: 2.5rem; }
  .sheet-foot { margin-top: 0.55rem; }
  .topbar { padding-top: 0.9rem; }
}

/* ── reduced motion ────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .sky .ring,
  .sky .rings,
  .sky .sway,
  .sky .bob,
  .sky .spin,
  .sky .pulse,
  .sky .tw,
  .sky .rain,
  .sky .link-line,
  .sky .link-head,
  .scroll-hint svg,
  .sky .zone-ring,
  .sky .spark,
  .sheet,
  .cloud-bubble,
  .location-badge {
    animation: none !important;
    transform: none !important;
    opacity: 1;
  }

  .sky .spark { display: none; }
  .theme-toggle .knob { transition: none; }
  .language-toggle button { transition: none; }
  .ribbon i { transition: none; }
}
