/* Homepage world: fullscreen canvas plus a light HUD. Layout tokens
   (--site-gutter, --site-logo-h) come from css/site-tokens.css. */

:root {
  --ink: #1c1a2e;
  --paper: #fff8e7;
  --sky: #7fd0ff;
  --cobalt: #5a63ff;
  --cyan: #24d8ff;
  --amber: #ffb45b;
  --magenta: #ff4eb8;
  --line: rgba(28, 26, 46, 0.14);
  --shadow: 0 10px 30px rgba(28, 26, 46, 0.18);
  --radius: 1.1rem;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  position: fixed;
  inset: 0;
  background: var(--sky);
  color: var(--ink);
  font-family: "Avenir Next", Avenir, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; }

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.world {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.75rem 1rem;
  transform: translateY(-150%);
  border-radius: 0.6rem;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
}
.skip-link:focus { transform: translateY(0); }

/* ---------- Loading + intro ---------- */

.loading, .intro, .fallback {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: max(1.5rem, var(--site-gutter));
  text-align: center;
}

.loading {
  background: linear-gradient(180deg, #4aa8ff 0%, #a4e2ff 65%, #fff8e7 100%);
  transition: opacity 450ms ease;
}
.loading.is-done { opacity: 0; pointer-events: none; }
.loading__logo { filter: brightness(0) invert(1); }
.loading__spinner { display: flex; gap: 0.5rem; margin: 1.6rem 0 1rem; }
.loading__spinner span {
  width: 0.9rem;
  height: 0.9rem;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--amber);
  animation: bounce 900ms ease-in-out infinite;
}
.loading__spinner span:nth-child(2) { background: var(--magenta); animation-delay: 150ms; }
.loading__spinner span:nth-child(3) { background: var(--cyan); animation-delay: 300ms; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-0.7rem); } }
.loading__line { margin: 0; color: var(--ink); font-weight: 600; }

.intro {
  z-index: 25;
  overflow-y: auto;
  background: radial-gradient(circle at 50% 40%, rgba(255, 248, 231, 0.55), rgba(74, 168, 255, 0.35) 70%);
  transition: opacity 450ms ease;
}
.intro.is-done { opacity: 0; pointer-events: none; }
.intro__panel {
  max-width: 30rem;
  padding: clamp(1.4rem, 4vw, 2.4rem);
  border: 4px solid var(--ink);
  border-radius: 1.6rem;
  background: var(--paper);
  box-shadow: 0.6rem 0.6rem 0 var(--ink);
  animation: pop 500ms cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
@keyframes pop { from { transform: scale(0.85); opacity: 0; } to { transform: none; opacity: 1; } }
.intro__eyebrow, .card__area, .hint__label, .sheet__lead {
  margin: 0 0 0.6rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.7;
}
.intro h1 {
  margin: 0;
  font-size: clamp(2.6rem, 8vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.95;
}
.intro__lead { margin: 1rem 0 1.4rem; font-size: 1rem; line-height: 1.55; }
.intro__hint { margin: 1rem 0 0; font-size: 0.78rem; opacity: 0.7; }
.intro__hint-touch { display: none; }
@media (pointer: coarse) {
  .intro__hint-desktop { display: none; }
  .intro__hint-touch { display: inline; }
}
@media (max-height: 560px) {
  .intro { place-items: start center; }
  .intro__panel { margin: 0.5rem 0; padding: 1rem 1.4rem; }
  .intro__eyebrow { margin-bottom: 0.3rem; }
  .intro h1 { font-size: 2.1rem; }
  .intro__lead { margin: 0.6rem 0 0.9rem; font-size: 0.85rem; }
  .intro__hint { display: none; }
  .loading__logo { transform: scale(0.8); }
}

/* Chrome stays hidden until the traveller is actually exploring. */
body:not(.is-playing) .hud-top, body:not(.is-playing) .hint, body:not(.is-playing) .card { display: none; }

.button {
  display: inline-flex;
  min-height: 3.2rem;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.5rem;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0.25rem 0.25rem 0 var(--ink);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.button--primary { background: var(--amber); }
.button:hover { transform: translate(-0.1rem, -0.1rem); box-shadow: 0.35rem 0.35rem 0 var(--ink); }
.button:active { transform: translate(0.15rem, 0.15rem); box-shadow: 0.1rem 0.1rem 0 var(--ink); }
.button:focus-visible, .chip:focus-visible, .hint:focus-visible, .sheet button:focus-visible {
  outline: 3px solid var(--cobalt);
  outline-offset: 3px;
}

.fallback { z-index: 40; background: linear-gradient(180deg, #4aa8ff, #c8f0ff); overflow: auto; }
.fallback__panel { max-width: 34rem; padding: 2rem; border: 4px solid var(--ink); border-radius: 1.6rem; background: var(--paper); box-shadow: 0.6rem 0.6rem 0 var(--ink); }
.fallback h1 { margin: 1rem 0; font-size: 1.8rem; letter-spacing: -0.03em; line-height: 1.1; }
.fallback .button { margin: 0.4rem 0.2rem; }
body.is-fallback .hud-top, body.is-fallback .hint { display: none; }
body.is-cinematic .hud-top, body.is-cinematic .hint, body.is-cinematic .intro, body.is-cinematic .bubble, body.is-cinematic .debug { display: none !important; }

/* ---------- HUD ---------- */

.hud-top {
  position: fixed;
  z-index: 20;
  top: calc(0.9rem + var(--safe-top));
  right: calc(0.9rem + var(--safe-right));
  left: calc(0.9rem + var(--safe-left));
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  pointer-events: none;
}
.chip {
  display: inline-flex;
  min-height: 2.8rem;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.9rem;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-weight: 700;
  box-shadow: 0.2rem 0.2rem 0 var(--ink);
  pointer-events: auto;
}
.chip img { display: block; width: auto; height: calc(var(--site-logo-h) * 0.7); filter: brightness(0); }
.fallback__panel img { filter: brightness(0); }
.chip--brand span { font-size: 0.8rem; }
.chip--passport { font-variant-numeric: tabular-nums; }
body.is-complete .chip--passport { background: var(--amber); }

/* Centre of the top bar: the weather chip and the Singapore clock. */
.hud-top__centre { display: flex; align-items: flex-start; gap: 0.5rem; pointer-events: none; }
.chip--clock { gap: 0.35rem; padding: 0.35rem 0.75rem 0.35rem 0.65rem; font-variant-numeric: tabular-nums; font-size: 0.9rem; }
.chip--clock .chip__icon { font-size: 1.1rem; line-height: 1; }

/* Weather chip: sky and temperature normally; the PSI reading, tinted by
   NEA band and gently pulsing, once any region is unhealthy. */
.chip--weather { gap: 0.4rem; padding-left: 0.7rem; font-variant-numeric: tabular-nums; }
.chip--weather[hidden] { display: none; }
.chip--weather .chip__icon { font-size: 1.2rem; line-height: 1; }
.chip--weather.is-alert { animation: haze-pulse 2.4s ease-in-out infinite; }
.chip--weather.is-alert[data-band="unhealthy"] { background: var(--amber); }
.chip--weather.is-alert[data-band="very-unhealthy"] { background: #ff6b5b; }
.chip--weather.is-alert[data-band="hazardous"] { background: #a64dff; color: var(--paper); }
@keyframes haze-pulse { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-0.15rem); } }
.chip--clock, .chip--weather { flex: none; white-space: nowrap; }
.chip--clock.is-pinned { background: var(--cyan); }

/* Time-of-day panel under the clock chip. */
.clock-panel {
  position: fixed;
  z-index: 22;
  top: calc(4.4rem + var(--safe-top));
  left: 50%;
  display: grid;
  width: min(20rem, calc(100vw - 2rem));
  gap: 0.6rem;
  padding: 0.8rem 0.9rem 0.9rem;
  border: 3px solid var(--ink);
  border-radius: 1.2rem;
  background: var(--paper);
  box-shadow: 0.3rem 0.3rem 0 var(--ink);
  transform: translateX(-50%);
  animation: rise 250ms ease both;
}
.clock-panel[hidden] { display: none; }
.clock-panel__label { margin: 0; font-size: 0.78rem; font-weight: 800; text-align: center; }
.clock-panel__range { width: 100%; accent-color: var(--cobalt); }
.clock-panel__presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.35rem; }
.clock-panel__preset { padding: 0.4rem 0.2rem; border: 2px solid var(--ink); border-radius: 999px; background: #fff; font-size: 0.72rem; font-weight: 700; white-space: nowrap; }
.clock-panel__preset:hover { background: var(--amber); }
.clock-panel__hint { margin: 0; font-size: 0.68rem; line-height: 1.4; text-align: center; opacity: 0.65; }
.clock-panel__now { padding: 0.4rem 0.8rem; border: 2px solid var(--ink); border-radius: 999px; background: var(--cyan); font-size: 0.75rem; font-weight: 800; }
.clock-panel__now[hidden] { display: none; }
body.is-cinematic .clock-panel, body:not(.is-playing) .clock-panel { display: none !important; }
@media (max-height: 560px) { .clock-panel { top: calc(3.6rem + var(--safe-top)); } }
@media (max-width: 480px) {
  .chip--brand span, .chip--clock .chip__icon { display: none; }
  .chip { padding: 0.35rem 0.5rem; }
  .hud-top { gap: 0.4rem; }
  .hud-top__centre { gap: 0.3rem; }
  .chip--clock, .chip--weather { font-size: 0.78rem; }
}
@media (max-width: 380px) { .chip--weather .chip__icon { display: none; } }

/* Weather & haze sheet */
.weather { display: grid; gap: 1.1rem; }
.weather h3 { margin: 0 0 0.45rem; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.6; }
.weather__now { display: flex; align-items: center; gap: 0.9rem; }
.weather__big { font-size: 3rem; line-height: 1; }
.weather__headline { margin: 0; font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; }
.weather__meta { margin: 0.25rem 0 0; font-size: 0.8rem; line-height: 1.45; opacity: 0.8; }
.weather__band { display: inline-block; margin-left: 0.4rem; padding: 0.15rem 0.6rem; border: 2px solid var(--ink); border-radius: 999px; background: #fff; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.06em; text-transform: none; vertical-align: middle; opacity: 1; }
.weather__compass { display: grid; max-width: 21rem; grid-template-columns: repeat(3, 1fr); grid-template-areas: ". n ." "w c e" ". s ."; gap: 0.35rem; }
.weather__region { display: grid; padding: 0.4rem 0.3rem; border: 2px solid var(--ink); border-radius: 0.8rem; background: #fff; text-align: center; box-shadow: 0.12rem 0.12rem 0 var(--ink); }
.weather__region b { font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.weather__region small { font-size: 0.6rem; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.7; }
.weather__band[data-band="good"], .weather__region[data-band="good"] { background: #b6ff5b; }
.weather__band[data-band="moderate"], .weather__region[data-band="moderate"] { background: #9fe6ff; }
.weather__band[data-band="unhealthy"], .weather__region[data-band="unhealthy"] { background: var(--amber); }
.weather__band[data-band="very-unhealthy"], .weather__region[data-band="very-unhealthy"] { background: #ff6b5b; }
.weather__band[data-band="hazardous"], .weather__region[data-band="hazardous"] { background: #a64dff; color: var(--paper); }
.weather__advice { margin: 0.6rem 0 0; font-size: 0.82rem; line-height: 1.45; font-weight: 600; }
.weather__list { margin: 0; padding: 0; list-style: none; }
.weather__list li { display: flex; align-items: baseline; gap: 0.6rem; padding: 0.35rem 0; border-top: 1px solid var(--line); font-size: 0.82rem; line-height: 1.4; }
.weather__list .weather__icon { flex: none; width: 1.6rem; text-align: center; }
.weather__list b { flex: none; min-width: 8rem; font-weight: 800; }
.weather__list span:last-child { opacity: 0.8; }
.weather__foot { margin: 0; font-size: 0.68rem; line-height: 1.5; opacity: 0.6; }
.weather__empty { margin: 0; font-size: 0.82rem; opacity: 0.7; }

.hint {
  position: fixed;
  z-index: 20;
  top: calc(4.4rem + var(--safe-top));
  right: calc(0.9rem + var(--safe-right));
  display: flex;
  max-width: min(20rem, calc(100vw - 2rem));
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.9rem 0.5rem 0.7rem;
  border: 3px solid var(--ink);
  border-radius: 1rem;
  background: var(--paper);
  text-align: left;
  box-shadow: 0.2rem 0.2rem 0 var(--ink);
  transition: opacity 200ms ease;
}
.hint[hidden] { display: none; }
.hint__arrow {
  display: grid;
  width: 2rem;
  height: 2rem;
  flex: none;
  place-items: center;
  border-radius: 50%;
  background: var(--cyan);
  color: var(--ink);
  font-size: 1rem;
  transition: transform 250ms ease;
}
.hint__body { display: flex; min-width: 0; flex-direction: column; }
.hint__label { margin: 0; font-size: 0.58rem; }
.hint__text { overflow: hidden; font-size: 0.85rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.hint__cta {
  flex: none;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: var(--amber);
  font-size: 0.68rem;
  font-weight: 700;
}
@media (max-width: 520px) { .hint__cta { display: none; } }

.guide {
  position: fixed;
  z-index: 20;
  top: calc(4.4rem + var(--safe-top));
  left: calc(0.9rem + var(--safe-left));
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.5rem 0.45rem 0.8rem;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--cobalt);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: 0.2rem 0.2rem 0 var(--ink);
}
.guide[hidden] { display: none; }
.guide__dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--cyan); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }
.guide button { display: grid; width: 1.6rem; height: 1.6rem; place-items: center; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.2); color: #fff; }

.card {
  position: fixed;
  z-index: 20;
  bottom: calc(1rem + var(--safe-bottom));
  left: 50%;
  display: flex;
  width: min(30rem, calc(100vw - 1.6rem));
  align-items: flex-start;
  gap: 0.9rem;
  padding: 0.9rem 1rem;
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0.3rem 0.3rem 0 var(--ink);
  transform: translateX(-50%);
  animation: rise 350ms cubic-bezier(0.2, 1.3, 0.4, 1) both;
  pointer-events: none;
}
.card[hidden] { display: none; }
@keyframes rise { from { transform: translate(-50%, 1.5rem); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }
.card__emoji { flex: none; font-size: 2rem; line-height: 1; }
.card__body { min-width: 0; }
.card__area { margin-bottom: 0.15rem; font-size: 0.58rem; }
.card__name { margin: 0; font-size: 1.15rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.card__tagline { margin: 0.2rem 0 0; font-size: 0.85rem; font-weight: 600; }
.card__fact { margin: 0.35rem 0 0; font-size: 0.78rem; line-height: 1.4; opacity: 0.8; }
.card__stamp {
  position: absolute;
  top: -1.2rem;
  right: -0.6rem;
  padding: 0.3rem 0.7rem;
  border: 3px solid var(--ink);
  border-radius: 0.5rem;
  background: var(--magenta);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: rotate(-8deg);
}
.card__stamp[hidden] { display: none; }
.card__stamp.is-stamped { animation: stamp 500ms cubic-bezier(0.2, 1.6, 0.4, 1) both; }
@keyframes stamp { from { transform: rotate(-8deg) scale(2.4); opacity: 0; } to { transform: rotate(-8deg) scale(1); opacity: 1; } }
body.is-touch .card { bottom: calc(6.4rem + var(--safe-bottom)); }
@media (max-width: 520px) { .card__fact { display: none; } }

/* Floating name labels (district and map zoom) */
.labels { position: fixed; inset: 0; z-index: 18; pointer-events: none; overflow: hidden; }
.label {
  position: absolute; left: 0; top: 0;
  padding: 0.22rem 0.6rem; border: 2px solid var(--ink, #1c1a2e); border-radius: 999px;
  background: rgba(255, 248, 231, 0.94); color: var(--ink, #1c1a2e);
  font: 700 0.78rem/1.2 var(--font-sans, system-ui, sans-serif); white-space: nowrap;
  opacity: 0; transition: opacity 0.25s; pointer-events: none; cursor: pointer;
}
.label.is-on { opacity: 1; pointer-events: auto; }
.label--place.is-stamped::before { content: "✓ "; color: #d6336c; }
.label--area {
  padding: 0.1rem 0.45rem; border: 0; background: rgba(28, 26, 46, 0.55); color: #fff8e7;
  font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; pointer-events: none;
}
.label--area.is-on { pointer-events: none; }
body.is-cinematic .labels { display: none; }
@media (max-width: 720px) {
  .label { font-size: 0.68rem; padding: 0.16rem 0.5rem; }
  .label--area { font-size: 0.56rem; }
}

.bubble {
  position: fixed;
  z-index: 19;
  top: 0;
  left: 0;
  max-width: 14rem;
  padding: 0.45rem 0.8rem;
  border: 3px solid var(--ink);
  border-radius: 1rem;
  background: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
  will-change: transform;
}
.bubble::after {
  position: absolute;
  bottom: -0.75rem;
  left: 50%;
  width: 0;
  height: 0;
  border: 0.6rem solid transparent;
  border-top-color: var(--ink);
  border-bottom: 0;
  transform: translateX(-50%);
  content: "";
}
.bubble[hidden] { display: none; }

.toast {
  position: fixed;
  z-index: 21;
  top: calc(4.4rem + var(--safe-top));
  left: 50%;
  max-width: min(26rem, calc(100vw - 2rem));
  padding: 0.6rem 1rem;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--amber);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  transform: translateX(-50%);
  animation: rise 350ms ease both;
}
.toast[hidden] { display: none; }
/* On narrow screens the nearest-place hint fills the same row, so toasts
   drop below it; a softer corner reads better when a line wraps. */
@media (max-width: 720px) {
  .toast { top: calc(8.9rem + var(--safe-top)); border-radius: 1.2rem; }
}

/* District fanfare: a handful of falling squares, purely decorative and
   removed from the DOM once their fall animation ends (see hud.js). */
.confetti { position: fixed; z-index: 25; inset: 0; overflow: hidden; pointer-events: none; }
.confetti__piece {
  position: absolute;
  top: 28%;
  left: 50%;
  width: 0.5rem;
  height: 0.9rem;
  border-radius: 0.15rem;
  animation: confetti-fall 1.1s ease-in forwards;
}
@keyframes confetti-fall {
  from { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  to { transform: translate(var(--dx), 62vh) rotate(var(--rot)); opacity: 0; }
}

.debug {
  position: fixed;
  z-index: 21;
  bottom: calc(0.3rem + var(--safe-bottom));
  left: 50%;
  margin: 0;
  color: var(--ink);
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.7rem;
  transform: translateX(-50%);
  pointer-events: none;
}

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

.joystick {
  position: fixed;
  z-index: 22;
  top: 0;
  left: 0;
  width: 8rem;
  height: 8rem;
  margin: -4rem 0 0 -4rem;
  border: 3px solid rgba(28, 26, 46, 0.5);
  border-radius: 50%;
  background: rgba(255, 248, 231, 0.35);
  pointer-events: none;
}
.joystick[hidden] { display: none; }
.joystick__knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3.4rem;
  height: 3.4rem;
  margin: -1.7rem 0 0 -1.7rem;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0.15rem 0.15rem 0 var(--ink);
}
.joystick__knob { will-change: transform; }

.jump {
  position: fixed;
  z-index: 20;
  right: calc(1.2rem + var(--safe-right));
  bottom: calc(1.6rem + var(--safe-bottom));
  width: 4.4rem;
  height: 4.4rem;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--cyan);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  box-shadow: 0.25rem 0.25rem 0 var(--ink);
  touch-action: none;
}
.jump[hidden] { display: none; }
.jump:active { transform: translate(0.15rem, 0.15rem); box-shadow: 0.1rem 0.1rem 0 var(--ink); }

/* ---------- Sheets ---------- */

.sheet {
  width: min(34rem, calc(100vw - 1.5rem));
  max-height: min(calc(100vh - 2rem), calc(100dvh - 2rem));
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: visible;
}
.sheet::backdrop { background: rgba(28, 26, 46, 0.45); backdrop-filter: blur(4px); }
.sheet__panel {
  max-height: min(calc(100vh - 2rem), calc(100dvh - 2rem));
  padding: 1.3rem 1.4rem 1.5rem;
  border: 4px solid var(--ink);
  border-radius: 1.4rem;
  background: var(--paper);
  box-shadow: 0.5rem 0.5rem 0 var(--ink);
  overflow: auto;
  -webkit-user-select: text;
  user-select: text;
}
/* The panel takes focus only so the keyboard can scroll it; its ink border
   already marks it, so no extra ring. */
.sheet__panel:focus { outline: none; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.6rem; }
.sheet__head h2 { margin: 0; font-size: 1.6rem; font-weight: 800; letter-spacing: -0.03em; }
.sheet__close { display: grid; width: 2.2rem; height: 2.2rem; place-items: center; border: 3px solid var(--ink); border-radius: 50%; background: #fff; font-weight: 800; }
.sheet__lead { font-size: 0.62rem; line-height: 1.5; opacity: 0.75; letter-spacing: 0.08em; text-transform: none; }
.sheet__reset { margin-top: 1rem; padding: 0.4rem 0.8rem; border: 2px solid var(--line); border-radius: 999px; background: transparent; font-size: 0.75rem; font-weight: 700; opacity: 0.7; }

/* "This visit" recap strip, above the landmark list. */
.passport__visit { margin: 0 0 0.8rem; padding: 0.5rem 0.7rem; border: 2px dashed var(--line); border-radius: 0.8rem; font-size: 0.78rem; font-weight: 700; text-align: center; opacity: 0.85; }
.passport__visit:empty { display: none; }

.passport { margin: 0; padding: 0; list-style: none; }
.passport__area h3, .passport__subhead { margin: 0.9rem 0 0.3rem; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.6; }
.passport__area ul { margin: 0; padding: 0; list-style: none; }
.passport__item { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0; border-top: 1px solid var(--line); }
.passport__emoji { display: grid; width: 2rem; height: 2rem; flex: none; place-items: center; border: 2px dashed var(--ink); border-radius: 50%; font-size: 1rem; opacity: 0.5; }
.passport__item.is-found .passport__emoji { border-style: solid; background: var(--amber); opacity: 1; }
.passport__name { flex: 1; min-width: 0; font-weight: 700; }
.passport__item.is-found .passport__name::after { content: " ✓"; color: var(--cobalt); }
.passport__go { padding: 0.35rem 0.7rem; border: 2px solid var(--ink); border-radius: 999px; background: #fff; font-size: 0.7rem; font-weight: 700; }
.passport__go:hover { background: var(--cyan); }
.passport__where { flex: none; max-width: 40%; overflow: hidden; font-size: 0.68rem; text-overflow: ellipsis; white-space: nowrap; opacity: 0.6; }

.about h3 { margin: 1.4rem 0 0.4rem; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.65; }
.about p { margin: 0.4rem 0; font-size: 0.92rem; line-height: 1.55; }
.about__lead { font-size: 1.05rem !important; font-weight: 600; }
.about__list { margin: 0; padding: 0; list-style: none; }
.about__list li { margin: 0.5rem 0; font-size: 0.9rem; line-height: 1.5; }
.about__list b, .chip b { font-weight: 800; }
.about__links { display: flex; gap: 1rem; margin-top: 1rem !important; font-weight: 700; }
.about__credits { font-size: 0.78rem; line-height: 1.5; opacity: 0.75; }
.about__foot { font-size: 0.75rem !important; opacity: 0.6; }

@media (prefers-reduced-motion: reduce) {
  .intro__panel, .card, .toast, .card__stamp.is-stamped, .loading__spinner span { animation: none; }
  .confetti__piece { animation: none; }
}

/* Short landscape phones: keep the chrome out of the middle of the view. */
@media (max-height: 560px) {
  .card { left: calc(0.9rem + var(--safe-left)); bottom: calc(0.8rem + var(--safe-bottom)); width: min(22rem, 52vw); padding: 0.6rem 0.8rem; transform: none; animation: none; }
  body.is-touch .card { bottom: calc(0.8rem + var(--safe-bottom)); }
  .card__fact { display: none; }
  .card__emoji { font-size: 1.4rem; }
  .card__stamp { top: -0.9rem; right: -0.4rem; font-size: 0.6rem; }
  .hint { top: calc(0.9rem + var(--safe-top)); right: auto; left: 50%; max-width: 18rem; padding: 0.3rem 0.7rem 0.3rem 0.5rem; transform: translateX(-50%); }
  .hint__label { display: none; }
  .hint__arrow { width: 1.6rem; height: 1.6rem; font-size: 0.8rem; }
  .guide { top: calc(3.6rem + var(--safe-top)); }
  .toast { top: calc(3.6rem + var(--safe-top)); }
  .bubble { max-width: 11rem; font-size: 0.75rem; }
}

.passport__region { margin-left: 0.4rem; padding: 0.1rem 0.5rem; border-radius: 999px; background: #d6336c; color: #fff8e7; font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; vertical-align: middle; }

.intro__version { margin-top: 0.6rem; font-size: 0.68rem; letter-spacing: 0.04em; opacity: 0.55; }

.about__name { font-size: 0.92rem; line-height: 1.55; opacity: 0.85; }
.about__name i { font-style: italic; }

/* First-run controls guide */
.coach {
  position: fixed; left: 50%; bottom: calc(5.5rem + var(--safe-bottom, 0px)); z-index: 24;
  transform: translateX(-50%); width: min(24rem, calc(100vw - 2rem));
  padding: 0.9rem 1rem 0.8rem; border: 3px solid var(--ink, #1c1a2e); border-radius: 1.2rem;
  background: rgba(255, 248, 231, 0.97); box-shadow: 0.35rem 0.35rem 0 var(--ink, #1c1a2e);
  animation: coach-in 0.35s ease-out both;
}
.coach[hidden] { display: none; }
.coach__list { margin: 0 0 0.8rem; padding: 0; list-style: none; display: grid; gap: 0.45rem; font-size: 0.86rem; line-height: 1.35; }
.coach__list li { display: flex; align-items: center; gap: 0.55rem; }
.coach__icon { width: 1.6rem; text-align: center; font-size: 1.15rem; flex: none; }
.coach__key { flex: none; padding: 0.1rem 0.45rem; border: 2px solid var(--ink, #1c1a2e); border-radius: 0.4rem; background: #fff; font: 700 0.72rem/1.2 var(--font-mono, ui-monospace, monospace); letter-spacing: 0.04em; }
.coach .button { width: 100%; }
.coach__touch { display: none; }
body.is-touch .coach__desktop { display: none; }
body.is-touch .coach__touch { display: grid; }
body.is-touch .coach { bottom: calc(8.6rem + var(--safe-bottom, 0px)); }
@keyframes coach-in { from { opacity: 0; transform: translate(-50%, 0.6rem); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (max-height: 560px) { .coach { bottom: 1rem; width: min(22rem, calc(100vw - 2rem)); padding: 0.6rem 0.8rem; } .coach__list { gap: 0.25rem; font-size: 0.78rem; margin-bottom: 0.5rem; } }
