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

:root {
  --bg-deep: #1a1520;
  --bg-card: #252030;
  --sea: #5b9aa8;
  --sea-deep: #3d7a88;
  --sand: #e8dcc8;
  --sand-dark: #c9b89a;
  --coral: #ff6b6b;
  --coral-soft: #ff9a8b;
  --mint: #7ec4a8;
  --text: #f5f0ea;
  --text-muted: #b8aea4;
  --serif: "Cormorant Garamond", "Georgia", "Times New Roman", serif;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --panel-radius: 1.25rem;
  --tap-min: 44px;
  --progress-h: 3.25rem;
  /** Warm tint on map tiles only — set to `none` to disable */
  --map-tile-filter: sepia(0.2) saturate(1.1) hue-rotate(-10deg);
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-deep);
  overflow: hidden;
  overscroll-behavior: none;
}

button,
input {
  font: inherit;
}

img,
video {
  max-width: 100%;
  display: block;
}

.screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(1.5rem + var(--safe-top)) 1.5rem calc(1.5rem + var(--safe-bottom));
  background: var(--bg-deep);
  opacity: 0;
  transition: opacity 0.7s cubic-bezier(0.33, 1, 0.38, 1);
  pointer-events: none;
}

.screen.is-active {
  opacity: 1;
  pointer-events: auto;
}

.screen[hidden] {
  display: none !important;
}

.btn {
  min-height: var(--tap-min);
  min-width: var(--tap-min);
  padding: 0.75rem 1.75rem;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 500;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: linear-gradient(135deg, var(--coral), var(--coral-soft));
  color: #1a1018;
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.btn--tap-begin {
  font-size: 1.125rem;
  letter-spacing: 0.04em;
}

.skip-intro {
  position: absolute;
  bottom: calc(1rem + var(--safe-bottom));
  right: 1rem;
  margin: 0;
  padding: 0.5rem 0.65rem;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.6;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.skip-intro:hover {
  opacity: 0.85;
}

/* Gate */
.screen--gate {
  background: radial-gradient(ellipse at 50% 30%, #2a2438 0%, var(--bg-deep) 70%);
}

.gate-card {
  width: min(22rem, 100%);
  text-align: center;
}

.gate-prompt {
  font-family: var(--serif);
  font-size: clamp(1.25rem, 4vw, 1.75rem);
  margin: 0 0 1.5rem;
  line-height: 1.35;
}

.gate-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.gate-input {
  min-height: var(--tap-min);
  padding: 0.65rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  text-align: center;
}

.gate-error {
  margin: 1rem 0 0;
  color: var(--coral-soft);
  font-size: 0.9rem;
}

.gate-card.shake {
  animation: shake 0.45s ease;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-8px);
  }
  40% {
    transform: translateX(8px);
  }
  60% {
    transform: translateX(-6px);
  }
  80% {
    transform: translateX(6px);
  }
}

/* Intro message — button slot reserved so text never jumps */
.screen--message {
  justify-content: center;
}

.intro-message-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(36rem, 100%);
  min-height: min(62dvh, 28rem);
  justify-content: center;
}

.intro-message {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 4.5vw, 2rem);
  line-height: 1.45;
  text-align: center;
  margin: 0;
  padding: 0 0.25rem;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(0.35rem);
}

.intro-message.is-visible {
  animation: intro-message-in 1.75s cubic-bezier(0.33, 1, 0.38, 1) forwards;
}

@keyframes intro-message-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.intro-message-actions {
  flex-shrink: 0;
  width: 100%;
  min-height: calc(var(--tap-min) + 0.5rem);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 0.5rem;
}

.btn--continue {
  opacity: 0;
  transform: translateY(0.5rem);
  pointer-events: none;
  transition:
    opacity 0.85s cubic-bezier(0.33, 1, 0.38, 1),
    transform 0.85s cubic-bezier(0.33, 1, 0.38, 1);
}

.btn--continue.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Flash */
.screen--flash {
  padding: 0;
  background: #000;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
}

.flash-frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #000;
}

.flash-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.flash-loading[hidden] {
  display: none !important;
}

.flash-loading__spinner {
  width: 2rem;
  height: 2rem;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--coral);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.flash-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: scale(1.06);
  transform-origin: center center;
  will-change: transform;
  backface-visibility: hidden;
}

.flash-image.is-zooming {
  animation: flash-fill-zoom var(--flash-ms, 200ms) cubic-bezier(0.22, 0.05, 0.25, 1)
    forwards;
}

@keyframes flash-fill-zoom {
  from {
    transform: scale(1.06);
  }
  to {
    transform: scale(1.28);
  }
}

/* Disperse */
.screen--disperse {
  padding: 0;
  pointer-events: none;
  background: transparent;
  z-index: 90;
}

.screen--disperse.is-active {
  pointer-events: none;
}

.app.is-intro-reveal {
  z-index: 1;
}

.disperse-cards {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.intro-grid-backdrop {
  position: absolute;
  inset: 0;
  background: #0a0a0c;
  z-index: 1;
  transition: opacity 1.1s ease;
}

.intro-grid-backdrop.is-clear {
  opacity: 0;
}

.intro-photo-grid {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: clamp(3px, 0.8vw, 7px);
  padding: calc(0.35rem + var(--safe-top)) 0.35rem calc(0.35rem + var(--safe-bottom));
  box-sizing: border-box;
}

.polaroid {
  background: #fff;
  padding: 0.25rem 0.25rem 0.65rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  transform-origin: center center;
  opacity: 1;
  box-sizing: border-box;
}

.polaroid--in-grid {
  position: relative;
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
}

.polaroid--in-grid img {
  flex: 1;
  min-height: 0;
  width: 100%;
  object-fit: cover;
  object-position: center;
  content-visibility: auto;
}

.polaroid--free {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
}

.polaroid--free img {
  flex: 1;
  min-height: 0;
  width: 100%;
  object-fit: cover;
}

.polaroid.is-flying {
  transition: transform 2s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 2s ease;
}

@media (max-width: 380px) {
  .intro-photo-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(5, 1fr);
  }
}

/* App / map */
.app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

.app[hidden] {
  display: none !important;
}

.progress-header {
  flex-shrink: 0;
  padding: 0.5rem 1rem 0.65rem;
  background: rgba(26, 21, 32, 0.92);
  backdrop-filter: blur(8px);
  z-index: 20;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.progress-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--mint), var(--coral-soft));
  border-radius: inherit;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.map-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  /* Soft fallback while tiles load (needs internet) */
  background: linear-gradient(180deg, #87c4d4 0%, var(--sea) 35%, var(--sea-deep) 100%);
}

.leaflet-map {
  width: 100%;
  height: 100%;
  z-index: 1;
  font-family: var(--sans);
}

.leaflet-map .leaflet-tile-pane {
  filter: var(--map-tile-filter);
}

.train-route-line {
  pointer-events: none;
}

.train-marker-icon {
  background: transparent;
  border: none;
}

.train-glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-size: 1.35rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
  transform: rotate(-90deg);
}

.pin-hit--station {
  width: 48px;
  height: 52px;
}

.station-pin {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 44px;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.45));
  animation: station-pulse 2.4s ease-in-out infinite;
}

.station-pin.is-discovered {
  animation: none;
}

.station-roof {
  width: 40px;
  height: 8px;
  border-radius: 4px 4px 0 0;
  background: repeating-linear-gradient(
    -45deg,
    #c45c3e,
    #c45c3e 4px,
    #e8dcc8 4px,
    #e8dcc8 8px
  );
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 12px rgba(255, 107, 107, 0.45);
}

.station-body {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 22px;
  background: linear-gradient(180deg, #4a5568 0%, #2d3748 100%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-top: none;
  border-radius: 0 0 4px 4px;
}

.station-train {
  font-size: 0.95rem;
  line-height: 1;
  transform: scaleX(-1);
}

.station-platform {
  width: 42px;
  height: 5px;
  margin-top: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #8b7355, #a89070, #8b7355);
  border: 1px solid rgba(0, 0, 0, 0.25);
}

.station-pin.is-discovered .station-roof {
  background: repeating-linear-gradient(
    -45deg,
    #5a9a82,
    #5a9a82 4px,
    #c8e8dc 4px,
    #c8e8dc 8px
  );
  box-shadow: 0 0 10px rgba(126, 196, 168, 0.5);
}

.station-pin.is-discovered .station-body {
  background: linear-gradient(180deg, #3d5248 0%, #2a3d34 100%);
}

.station-pin.is-discovered .station-body::after {
  content: "✓";
  position: absolute;
  top: 14px;
  font-size: 10px;
  font-weight: 700;
  color: var(--mint);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

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

.leaflet-pin-icon {
  background: transparent;
  border: none;
}

.pin-hit {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 44px;
  height: 44px;
}

.map-pushpin {
  display: block;
  font-size: 2rem;
  line-height: 1;
  transform: translateY(-2px);
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.45));
  animation: pin-pulse 2.2s ease-in-out infinite;
}

.map-pushpin.is-explored {
  filter: hue-rotate(95deg) saturate(1.35) brightness(1.05)
    drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4));
  animation: none;
}

.pin-hit--heart {
  width: 30px;
  height: 30px;
  align-items: center;
}

.map-heart {
  display: block;
  font-size: 1.15rem;
  line-height: 1;
  color: #e63946;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  animation: heart-pulse 2.4s ease-in-out infinite;
}

@keyframes heart-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.12);
  }
}

@keyframes pin-pulse {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-3px) scale(1.08);
  }
}

.pin-tooltip {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  border-radius: 0.35rem;
  background: rgba(26, 21, 32, 0.92);
  color: var(--text);
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.leaflet-cluster-icon {
  background: transparent;
  border: none;
}

.leaflet-map .marker-cluster {
  background: transparent !important;
}

.leaflet-map .marker-cluster div {
  display: none;
}

.cluster-bubble {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: var(--coral);
  color: #1a1018;
  font-weight: 600;
  font-size: 0.85rem;
  box-shadow: 0 4px 16px rgba(255, 107, 107, 0.45);
  animation: pin-pulse 2s ease-in-out infinite;
}

.leaflet-cluster-icon.is-partial .cluster-bubble {
  background: linear-gradient(135deg, var(--coral-soft), var(--mint));
}

.leaflet-cluster-icon.is-all-discovered .cluster-bubble {
  background: var(--mint);
  animation: none;
}

.leaflet-control-layers {
  border-radius: 0.5rem !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2) !important;
  font-family: var(--sans) !important;
  font-size: 0.8rem !important;
}

.leaflet-control-zoom a {
  width: var(--tap-min) !important;
  height: var(--tap-min) !important;
  line-height: var(--tap-min) !important;
  font-size: 1.25rem !important;
}

@media (pointer: coarse) {
  .leaflet-control-zoom {
    display: none;
  }

  .map-control-btn--desktop {
    display: none;
  }
}

.map-controls {
  position: absolute;
  right: calc(0.75rem + env(safe-area-inset-right, 0px));
  bottom: calc(0.75rem + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  z-index: 1001;
  pointer-events: none;
}

.map-controls .map-control-btn {
  pointer-events: auto;
}

.map-control-btn {
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  border: none;
  border-radius: 0.65rem;
  background: rgba(26, 21, 32, 0.88);
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.map-control-btn--wide {
  font-size: 0.7rem;
  padding: 0 0.5rem;
}

/* Location panel */
.location-panel {
  position: fixed;
  inset: 0;
  z-index: 1100;
  pointer-events: none;
}

.location-panel.is-open {
  pointer-events: auto;
}

.location-panel[hidden] {
  display: none !important;
}

.location-panel__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.location-panel.is-open .location-panel__backdrop {
  opacity: 1;
}

.location-panel__sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(85dvh, 640px);
  background: var(--bg-card);
  border-radius: var(--panel-radius) var(--panel-radius) 0 0;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
  isolation: isolate;
}

.location-panel.is-open .location-panel__sheet {
  transform: translateY(0);
}

.panel-drag-handle {
  width: 2.5rem;
  height: 4px;
  margin: 0.65rem auto 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}

.panel-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  z-index: 40;
  width: var(--tap-min);
  height: var(--tap-min);
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.panel-header {
  padding: 0.25rem 1.25rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.panel-title {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1rem 1.25rem 1.5rem;
}

/* Reel presentation (e.g. Ulwe) — half screen, bottom on phone + laptop */
.location-panel.is-reel .location-panel__sheet.is-reel-sheet {
  left: 0;
  right: 0;
  top: auto;
  bottom: 0;
  width: 100%;
  height: 50dvh;
  max-height: 50dvh;
  border-radius: var(--panel-radius) var(--panel-radius) 0 0;
  transform: translateY(100%);
}

.location-panel.is-reel.is-open .location-panel__sheet.is-reel-sheet {
  transform: translateY(0);
}

.location-panel.is-reel .panel-body {
  overflow: hidden;
  padding: 0.5rem 0 0.75rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.location-panel.is-reel .panel-header {
  flex-shrink: 0;
  padding-bottom: 0.35rem;
}

/* Friend heart notes — slide in from the right, 3/4 width; photo + note stack vertically */
.location-panel.is-friend-note .panel-drag-handle {
  display: none;
}

.location-panel.is-friend-note .location-panel__sheet.is-friend-sheet {
  left: auto;
  right: 0;
  top: 0;
  bottom: 0;
  width: 75vw;
  max-width: 100%;
  height: 100%;
  max-height: none;
  border-radius: var(--panel-radius) 0 0 var(--panel-radius);
  transform: translateX(100%);
  display: flex;
  flex-direction: column;
}

.location-panel.is-friend-note.is-open .location-panel__sheet.is-friend-sheet {
  transform: translateX(0);
}

.location-panel.is-friend-note .panel-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1.25rem 1.5rem;
  overflow-y: auto;
}

.friend-note {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
  min-height: 0;
}

.friend-note__photo {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  border-radius: 0.65rem;
  background: rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.friend-note__text {
  flex-shrink: 0;
}

.friend-note__message {
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.55;
  margin: 0;
  white-space: pre-wrap;
}

.friend-note__meta {
  font-family: var(--sans);
  font-size: 0.88rem;
  line-height: 1.45;
  margin: 0.75rem 0 0;
  opacity: 0.82;
  white-space: pre-line;
}

.reel-viewport {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y pinch-zoom;
  cursor: grab;
}

.reel-viewport.is-manual {
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  touch-action: pan-x pan-y;
  cursor: auto;
}

.reel-track {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.85rem;
  height: 100%;
  padding: 0.35rem 1rem 0.75rem;
  will-change: transform;
}

.reel-viewport.is-manual .reel-track {
  will-change: auto;
}

.reel-item {
  flex: 0 0 auto;
  scroll-snap-align: center;
  border-radius: 0.65rem;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.reel-item--note {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(72vw, 16rem);
  padding: 1.25rem 1.1rem;
  background: rgba(255, 154, 139, 0.18);
  border: 1px dashed rgba(255, 154, 139, 0.45);
  font-family: var(--serif);
  font-size: clamp(1.05rem, 3.5vw, 1.35rem);
  font-style: italic;
  line-height: 1.45;
  text-align: center;
  color: var(--text);
  white-space: pre-line;
}

.reel-item--photo,
.reel-item--video {
  height: 100%;
  max-height: calc(50dvh - 5.5rem);
  aspect-ratio: 3 / 4;
  background: #0a0a0c;
}

.reel-item--photo img,
.reel-item--video video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.reel-video-wrap {
  position: relative;
  width: 100%;
  height: 100%;
}

.reel-video-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
  pointer-events: none;
  transition: opacity 0.35s ease;
  background: #0a0a0c;
}

.reel-video-poster.is-hidden {
  opacity: 0;
}

.reel-video-poster.is-missing {
  opacity: 0;
}

.reel-item--video video {
  cursor: pointer;
  position: relative;
  z-index: 1;
  background: #0a0a0c;
}

.reel-item__missing {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.content-block {
  margin-bottom: 1.5rem;
}

.content-block--story {
  font-family: var(--serif);
}

.story-date {
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--coral-soft);
  margin: 0 0 0.35rem;
}

.story-title {
  font-size: 1.35rem;
  margin: 0 0 0.5rem;
}

.story-text {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.55;
  color: var(--text);
}

.content-block--snippet {
  padding: 1rem 1.1rem;
  border-radius: 1rem 1rem 1rem 0.25rem;
  background: rgba(255, 154, 139, 0.15);
  border: 1px dashed rgba(255, 154, 139, 0.35);
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
}

.photo-strip {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.25rem;
}

.photo-thumb--strip {
  flex: 0 0 min(75%, 260px);
  scroll-snap-align: center;
}

.photo-thumb {
  border: none;
  padding: 0;
  border-radius: 0.5rem;
  overflow: hidden;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.2);
  min-height: 100px;
}

.photo-thumb img {
  width: 100%;
  height: 120px;
  object-fit: cover;
}

.photo-thumb.is-broken {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.photo-caption {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0.35rem 0 0;
}

.content-block video {
  width: 100%;
  border-radius: 0.5rem;
  background: #000;
}

.media-missing {
  padding: 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0.5rem;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1150;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.lightbox[hidden] {
  display: none !important;
}

.lightbox-close {
  position: absolute;
  top: calc(0.5rem + var(--safe-top));
  right: 0.75rem;
  z-index: 2;
  width: var(--tap-min);
  height: var(--tap-min);
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.lightbox-img {
  max-height: 75dvh;
  object-fit: contain;
}

.lightbox-caption {
  margin: 0.75rem 0 0;
  color: var(--text-muted);
  text-align: center;
}

/* Final message — above location panel (1100) */
.screen--final {
  z-index: 1200;
  transition: opacity 0.45s cubic-bezier(0.33, 1, 0.38, 1);
}

.screen--final .intro-message.is-visible {
  animation-duration: 0.95s;
}

.final-message-text {
  white-space: pre-line;
  color: var(--text);
}

#btn-final-close {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* Desktop: side panel (never for reel — reel stays bottom half everywhere) */
@media (min-width: 900px) {
  .location-panel.is-reel .location-panel__sheet.is-reel-sheet {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    height: 50dvh;
    max-height: 50dvh;
    border-radius: var(--panel-radius) var(--panel-radius) 0 0;
    transform: translateY(100%);
  }

  .location-panel.is-reel.is-open .location-panel__sheet.is-reel-sheet {
    transform: translateY(0);
  }

  .location-panel.is-reel .panel-drag-handle {
    display: block;
  }

  .location-panel:not(.is-reel):not(.is-friend-note) .location-panel__sheet {
    left: auto;
    right: 0;
    top: 0;
    bottom: 0;
    max-height: none;
    width: min(420px, 40vw);
    border-radius: var(--panel-radius) 0 0 var(--panel-radius);
    transform: translateX(100%);
  }

  .location-panel:not(.is-reel):not(.is-friend-note).is-open .location-panel__sheet {
    transform: translateX(0);
  }

  .panel-drag-handle {
    display: none;
  }

  .map-controls {
    bottom: calc(1.5rem + var(--safe-bottom));
  }
}

/* Reduced motion: soften most motion; intro flash timing stays in JS */
@media (prefers-reduced-motion: reduce) {
  .pin-dot,
  .cluster-bubble {
    animation: none;
  }

  .progress-fill {
    transition-duration: 0.01ms;
  }

  .polaroid.is-flying {
    transition-duration: 0.4s;
  }

  .intro-message.is-visible {
    animation-duration: 0.5s;
  }

  .btn--continue {
    transition-duration: 0.35s;
  }

  .screen {
    transition-duration: 0.35s;
  }

  .flash-image.is-zooming {
    animation: none;
    transform: scale(1.12);
  }

  .reel-viewport.is-manual .reel-track {
    transform: none !important;
  }
}
