/* ============================================================
   VINTAGE CARTOGRAPHY — antique nautical-chart palette
   Source: Photos_website/raw/2026-04-25-map-style-prompt.md
   Pixel-sampled from a specific reference image. Do not invent
   or improvise colors. If a colour you need isn't here, ask.
   ============================================================ */

:root {
  /* Parchment — outer frame ramp (light → burnt) */
  --parchment-1:    #c9b074;
  --parchment-2:    #a48b53;
  --parchment-3:    #7a6542;
  --parchment-edge: #5b4727;

  /* Sea / ocean */
  --sea:        #3c686a;
  --sea-deep:   #2e4648;
  --sea-light:  #527373;

  /* Land */
  --land:       #95a15a;
  --land-edge:  #6b7644;

  /* Ink (lines, type) */
  --ink:        #2a1f15;
  --ink-soft:   #4a3a28;

  /* Paper highlight (text on dark) */
  --paper-text:     #f4ead0;
  --paper-text-dim: #d8c89a;

  /* Accents */
  --seal-red:   #8b2e2a;
  --gold:       #a8852b;

  /* Derived: gold-tint for soft borders, paper-stain blobs */
  --gold-soft:   rgba(168, 133, 43, 0.5);
  --stain-amber: rgba(168, 133, 43, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: 'Cormorant Garamond', 'Crimson Text', serif;
  background: var(--parchment-1);
  color: var(--ink);
}

.hidden { display: none !important; }

/* ============ LOCK SCREEN ============ */
#lock-screen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #2a1f15 0%, #0f0a06 100%);
}

.lock-card {
  background: var(--parchment-1);
  padding: 52px 48px;
  max-width: 420px;
  width: 92%;
  text-align: center;
  position: relative;
  box-shadow:
    0 20px 50px rgba(42, 31, 21, 0.6),
    0 0 0 1px var(--gold),
    0 0 0 4px rgba(42, 31, 21, 0.95),
    0 0 0 5px var(--gold);
  border-radius: 4px;
}

.lock-eyebrow {
  font-family: 'Cinzel', 'IM Fell English SC', serif;
  font-size: 0.7rem;
  letter-spacing: 0.35em;
  color: var(--seal-red);
  text-transform: uppercase;
  margin-bottom: 14px;
}

.lock-title {
  font-family: 'Cinzel', 'IM Fell English SC', serif;
  font-weight: 900;
  font-size: 2rem;
  color: var(--ink);
  letter-spacing: 0.1em;
  margin-bottom: 14px;
}
.lock-title span {
  color: var(--paper-text);
  font-style: italic;
}

.lock-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 14px 0 18px;
  color: var(--gold);
}
.lock-ornament .line {
  width: 70px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.lock-sub {
  font-style: italic;
  color: var(--ink-soft);
  opacity: 0.8;
  margin-bottom: 22px;
  font-size: 1rem;
}

#password-input {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--parchment-2);
  background: rgba(255, 255, 255, 0.35);
  font-family: 'Cormorant Garamond', 'Crimson Text', serif;
  font-size: 1.1rem;
  color: var(--ink);
  outline: none;
  margin-bottom: 14px;
  border-radius: 2px;
  letter-spacing: 0.05em;
}
#password-input:focus { border-color: var(--gold); }

#password-btn {
  width: 100%;
  padding: 13px;
  border: 1px solid var(--gold);
  background: var(--ink);
  color: var(--paper-text);
  font-family: 'Cinzel', 'IM Fell English SC', serif;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.25s;
}
#password-btn:hover {
  background: var(--ink-soft);
  color: var(--parchment-1);
}

.error {
  font-family: 'Cormorant Garamond', 'Crimson Text', serif;
  font-style: italic;
  color: var(--seal-red);
  font-size: 1rem;
  margin-top: 12px;
  min-height: 20px;
}

/* ============ FULL-SCREEN MAP (no frame, no borders) ============ */
#app { position: fixed; inset: 0; }

#map {
  position: fixed;
  inset: 0;
  background: var(--parchment-1);
  z-index: 1;
}

/* Tile filter — pushes Stamen Watercolor toward antique-chart palette.
   Per spec (raw/2026-04-25-map-style-prompt.md): less saturated, slight
   hue shift, subtle darkening, multiply blend. The .sea-tint overlay
   below adds a --sea wash to unify ocean tones. */
.leaflet-tile-pane {
  filter:
    sepia(0.35)
    saturate(0.55)
    brightness(0.92)
    contrast(1.05)
    hue-rotate(-8deg);
  mix-blend-mode: multiply;
}

/* Place-name labels — vector tiles via MapLibre GL JS (see
   maplibre-style.json + addVectorLabels in app.js). Symbol layers
   render directly to a WebGL canvas inside this pane; the canvas
   inherits the pane's z-index (393) so the cloud canvas (zPane 395)
   hides labels in unexplored areas. No CSS rules apply to the labels
   themselves — typography is controlled by the MapLibre style JSON. */
.leaflet-pane.leaflet-mapLabels-pane {
  pointer-events: none;
}
.leaflet-pane.leaflet-mapLabels-pane .maplibregl-canvas {
  pointer-events: none;
}

/* Sea tint — unifies ocean tones across the watercolor tiles.
   Sits above the tile pane (z-index 399) and below the parchment overlay
   (z-index 400) so the parchment grain still reads on top. */
.sea-tint {
  position: fixed;
  inset: 0;
  background-color: var(--sea);
  opacity: 0.20;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 399;
}

/* Parchment color wash — full viewport */
.parchment-overlay {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 15% 25%, rgba(164, 139, 83, 0.25) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 75%, rgba(139, 46, 42, 0.12) 0%, transparent 50%);
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 400;
}

/* Grain texture — full viewport (15% opacity per spec) */
.grain {
  position: fixed; inset: 0;
  opacity: 0.15; mix-blend-mode: multiply;
  pointer-events: none; z-index: 401;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/></filter><rect width='200' height='200' filter='url(%23n)' opacity='0.6'/></svg>");
}

/* Vignette — burnt parchment-edge tint at 40% on the corners (derived from --parchment-3 122,101,66) */
.vignette {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(122, 101, 66, 0.4) 100%);
  pointer-events: none;
  z-index: 402;
  mix-blend-mode: multiply;
}

/* Aged-paper amber stain blobs in corners (3-4 scattered, 8% opacity) */
.stains { position: fixed; inset: 0; pointer-events: none; z-index: 403; }
.stain {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(168, 133, 43, 0.12) 0%, rgba(168, 133, 43, 0.04) 45%, transparent 70%);
  filter: blur(6px);
  mix-blend-mode: multiply;
}
.stain-1 { top: -60px; left: -80px; width: 320px; height: 260px; transform: rotate(-18deg); }
.stain-2 { top: 18%; right: -110px; width: 280px; height: 220px; transform: rotate(22deg); opacity: 0.85; }
.stain-3 { bottom: -70px; left: 22%; width: 340px; height: 250px; transform: rotate(8deg); opacity: 0.7; }
.stain-4 { bottom: 18%; right: 6%; width: 200px; height: 160px; transform: rotate(-6deg); opacity: 0.8; }

/* Ornate border frame — thin double-line in accent gold, fixed inset from viewport */
.border-frame {
  position: fixed;
  inset: 16px;
  border: 1px solid var(--gold-soft);
  pointer-events: none;
  z-index: 404;
}
.border-frame-inner {
  position: absolute;
  inset: 4px;
  border: 1px solid var(--gold-soft);
}

/* Corner cartouches — SVG flourishes in the four corners */
.corner {
  position: fixed;
  width: 90px; height: 90px;
  pointer-events: none;
  z-index: 405;
  opacity: 0.75;
  filter: drop-shadow(1px 2px 2px rgba(42, 31, 21,0.2));
}
.corner-tl { top: 10px; left: 10px; }
.corner-tr { top: 10px; right: 10px; transform: scaleX(-1); }
.corner-bl { bottom: 10px; left: 10px; transform: scaleY(-1); }
.corner-br { bottom: 10px; right: 10px; transform: scale(-1, -1); }

/* Edge-midpoint fleurons */
.fleuron {
  position: fixed;
  color: var(--gold);
  font-size: 14px;
  line-height: 1;
  pointer-events: none;
  z-index: 405;
  opacity: 0.6;
  text-shadow: 0 1px 2px rgba(42, 31, 21,0.3);
}
.fleuron-top    { top: 8px; left: 50%; transform: translateX(-50%); }
.fleuron-bottom { bottom: 8px; left: 50%; transform: translateX(-50%); }
.fleuron-left   { top: 50%; left: 8px; transform: translateY(-50%); }
.fleuron-right  { top: 50%; right: 8px; transform: translateY(-50%); }

/* ========== LEAFLET CONTROL OVERRIDES ========== */
.leaflet-control-zoom {
  border: 1px solid var(--gold) !important;
  box-shadow: 0 4px 12px rgba(42, 31, 21,0.4) !important;
  margin: 0 22px 90px 0 !important;  /* bottom-right, lifted above music player */
}
.leaflet-control-zoom a {
  background: var(--ink) !important;
  color: var(--paper-text) !important;
  border-bottom: 1px solid var(--gold) !important;
  font-family: 'Cinzel', 'IM Fell English SC', serif !important;
  font-weight: 900 !important;
  transition: background 0.2s;
}
.leaflet-control-zoom a:hover {
  background: var(--ink-soft) !important;
  color: var(--parchment-1) !important;
}
.leaflet-control-zoom a:last-child {
  border-bottom: none !important;
}
.leaflet-control-attribution {
  background: rgba(42, 31, 21, 0.8) !important;
  color: var(--parchment-1) !important;
  font-family: 'Cinzel', 'IM Fell English SC', serif !important;
  font-size: 0.55rem !important;
  letter-spacing: 0.1em !important;
  padding: 4px 8px !important;
  border-top-left-radius: 4px;
}
.leaflet-control-attribution a {
  color: var(--paper-text) !important;
}

/* ========== HXH PIN ========== */
.hxh-pin-wrap {
  position: relative;
  width: 40px;
  height: 48px;
}
.hxh-pin-aura {
  position: absolute;
  top: 12px; left: 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168, 133, 43, 0.5) 0%, transparent 70%);
  animation: pulse 2.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes pulse {
  0%, 100% { transform: scale(0.8); opacity: 0.7; }
  50% { transform: scale(1.4); opacity: 0.3; }
}
.hxh-pin-svg {
  position: absolute;
  top: 0; left: 0;
  width: 40px; height: 48px;
  filter: drop-shadow(0 4px 6px rgba(42, 31, 21, 0.55));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}
.hxh-pin-wrap:hover .hxh-pin-svg {
  transform: translateY(-6px) scale(1.15);
}

/* ========== HXH POPUP ========== */
.leaflet-popup-content-wrapper {
  background: var(--parchment-1) !important;
  border-radius: 4px !important;
  box-shadow:
    0 20px 50px rgba(42, 31, 21,0.6),
    0 0 0 1px var(--gold),
    0 0 0 4px rgba(42, 31, 21, 0.95),
    0 0 0 5px var(--gold) !important;
  padding: 0 !important;
}
.leaflet-popup-content {
  margin: 0 !important;
  width: 300px !important;
}
.leaflet-popup-tip {
  background: var(--gold) !important;
  box-shadow: 0 4px 8px rgba(42, 31, 21,0.4) !important;
}
.leaflet-popup-close-button {
  color: var(--paper-text) !important;
  font-size: 24px !important;
  padding: 8px 10px !important;
  font-family: serif !important;
  z-index: 10;
}

.popup-card { font-family: 'Cormorant Garamond', 'Crimson Text', serif; }
.popup-image {
  width: 100%;
  aspect-ratio: 4/3;
  background-size: cover;
  background-position: center;
  background-color: var(--parchment-2);
  border-bottom: 3px double var(--gold);
  position: relative;
  cursor: pointer;
}
.popup-image::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 60%, rgba(42, 31, 21, 0.4));
}
.popup-body { padding: 20px 22px 22px; position: relative; }
.popup-body::before {
  content: '❋';
  position: absolute;
  top: 8px; left: 50%;
  transform: translateX(-50%);
  color: var(--gold);
  font-size: 1rem;
}
.popup-eyebrow {
  font-family: 'Cinzel', 'IM Fell English SC', serif;
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  color: var(--seal-red);
  text-transform: uppercase;
  margin-top: 10px;
  text-align: center;
}
.popup-title {
  font-family: 'Cinzel', 'IM Fell English SC', serif;
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--ink);
  text-align: center;
  margin: 4px 0 2px;
  letter-spacing: 0.05em;
}
.popup-subtitle {
  font-style: italic;
  color: var(--ink-soft);
  text-align: center;
  opacity: 0.75;
  font-size: 0.85rem;
}
.popup-divider {
  display: flex; align-items: center;
  gap: 10px; margin: 14px 0 10px;
  color: var(--gold);
}
.popup-divider .line {
  flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.popup-caption {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink-soft);
  text-align: center;
  font-style: italic;
}

.popup-gallery-link {
  display: block;
  margin: 14px auto 0;
  background: none;
  border: none;
  font-family: 'Cinzel', 'IM Fell English SC', serif;
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--seal-red);
  cursor: pointer;
  padding: 8px 12px;
  border-top: 1px dashed var(--gold);
  width: 100%;
  transition: color 0.2s;
}
.popup-gallery-link:hover { color: var(--ink); }

/* ========== COMPASS — moved to top-right so it doesn't fight the countdown ========== */
.compass {
  position: fixed;
  top: 24px; right: 24px;
  width: 68px; height: 68px;
  z-index: 500;
  opacity: 0.85;
  pointer-events: none;
  animation: compass-drift 20s ease-in-out infinite;
}
@keyframes compass-drift {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}

/* ========== TRAVEL PATH (red chronological line) ========== */
/* The Leaflet polyline renders inside SVG — style via class on the path */
.travel-path-core {
  animation: flow 2.4s linear infinite;
  filter: drop-shadow(0 0 4px rgba(139, 46, 42, 0.55));
}
@keyframes flow {
  to { stroke-dashoffset: -18; }
}

/* ============ COUNTDOWN (top-left, anime red Bangers) ============ */
#countdown-overlay {
  position: fixed;
  top: 22px;
  left: 22px;
  z-index: 1500;
  background: var(--parchment-1);
  padding: 14px 22px;
  border-radius: 4px;
  box-shadow:
    0 8px 24px rgba(42, 31, 21,0.5),
    0 0 0 1px var(--gold),
    0 0 0 3px rgba(42, 31, 21, 0.95),
    0 0 0 4px var(--gold);
}

.cd-label {
  font-family: 'Cinzel', 'IM Fell English SC', serif;
  font-size: 0.65rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--seal-red);
  margin-bottom: 4px;
  text-align: center;
}

.cd-nums {
  font-family: 'Bangers', cursive;
  font-size: 2.4rem;
  color: var(--seal-red);
  letter-spacing: 0.04em;
  line-height: 1;
  text-shadow:
    2px 2px 0 rgba(139, 46, 42, 0.35),
    0 0 10px rgba(168, 133, 43, 0.15);
  display: flex;
  align-items: baseline;
  gap: 2px;
  justify-content: center;
  padding: 2px 0;
}
.cd-nums small {
  font-family: 'Cinzel', 'IM Fell English SC', serif;
  font-weight: 900;
  font-size: 0.7rem;
  color: var(--seal-red);
  opacity: 0.7;
  margin-right: 6px;
  text-shadow: none;
  letter-spacing: 0;
}

.cd-target {
  font-family: 'Cinzel', 'IM Fell English SC', serif;
  font-size: 0.65rem;
  color: var(--ink-soft);
  margin-top: 4px;
  text-align: center;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  opacity: 0.7;
}

/* ============ MUSIC PLAYER (bottom center) ============ */
#music-player {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1500;
  background: var(--parchment-1);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 360px;
  max-width: 90vw;
  border-radius: 4px;
  box-shadow:
    0 8px 24px rgba(42, 31, 21,0.5),
    0 0 0 1px var(--gold),
    0 0 0 3px rgba(42, 31, 21, 0.95),
    0 0 0 4px var(--gold);
}

#music-player button {
  background: var(--ink);
  border: 1px solid var(--gold);
  width: 34px;
  height: 34px;
  cursor: pointer;
  color: var(--paper-text);
  font-size: 0.85rem;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
#music-player button:hover { background: var(--ink-soft); color: var(--parchment-1); }

#music-player .track-info {
  flex: 1;
  min-width: 0;
}

#track-name {
  font-family: 'Cinzel', 'IM Fell English SC', serif;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.bar {
  height: 2px;
  background: var(--parchment-2);
  overflow: hidden;
}
#bar-fill {
  height: 100%;
  width: 0%;
  background: var(--seal-red);
  transition: width 0.3s linear;
}

/* ============ LOCATION PANEL (slides in from right) ============ */
#location-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 460px;
  max-width: 100vw;
  height: 100vh;
  background: var(--parchment-1);
  border-left: 4px solid var(--gold);
  box-shadow: -12px 0 40px rgba(42, 31, 21, 0.5);
  transform: translateX(100%);
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 1600;
  overflow-y: auto;
  padding: 34px 28px 60px;
}
#location-panel.open { transform: translateX(0); }

.close-panel {
  position: absolute;
  top: 20px;
  right: 22px;
  background: var(--ink);
  border: 1px solid var(--gold);
  width: 32px;
  height: 32px;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--paper-text);
  border-radius: 2px;
  z-index: 2;
  font-family: 'Cinzel', 'IM Fell English SC', serif;
}
.close-panel:hover { background: var(--ink-soft); color: var(--parchment-1); }

.panel-eyebrow {
  font-family: 'Cinzel', 'IM Fell English SC', serif;
  font-size: 0.7rem;
  color: var(--seal-red);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 8px;
  text-align: center;
}

#loc-name {
  font-family: 'Cinzel', 'IM Fell English SC', serif;
  font-weight: 900;
  font-size: 1.4rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 4px;
  text-align: center;
  padding: 0 30px;
}

.panel-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 14px 0 12px;
  color: var(--gold);
}
.panel-divider .line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

#loc-stats {
  font-style: italic;
  text-align: center;
  color: var(--ink-soft);
  margin-bottom: 14px;
  font-size: 0.95rem;
  opacity: 0.8;
}

/* Panel action buttons (download all, enter select mode) */
.panel-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.panel-action-btn {
  background: var(--ink);
  color: var(--paper-text);
  border: 1px solid var(--gold);
  font-family: 'Cinzel', 'IM Fell English SC', serif;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 9px 18px;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.2s, color 0.2s, opacity 0.2s;
}
.panel-action-btn:hover:not(:disabled) {
  background: var(--seal-red);
}
.panel-action-btn:disabled {
  opacity: 0.65;
  cursor: progress;
}
.panel-action-btn.panel-action-secondary {
  background: var(--parchment-1);
  color: var(--ink);
  border-color: var(--ink-soft);
}
.panel-action-btn.panel-action-secondary:hover:not(:disabled) {
  background: var(--paper-text);
  color: var(--ink);
}
.panel-action-btn.panel-action-secondary.active {
  background: var(--gold);
  color: var(--ink);
  border-color: var(--ink);
}

/* Chronicle Select button sits below the ornament */
#chronicle-select-btn {
  margin-top: 18px;
}

/* ========== SELECT MODE — visual state on selectable thumbnails ==========
   Applied to .loc-grid img and .chronicle-photo when in select mode. The
   .selected class adds a checkmark badge + tinted overlay. */
.selectable {
  position: relative;
  cursor: pointer;
}
.selectable::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(42, 31, 21, 0.0);
  transition: background 0.15s;
  pointer-events: none;
}
.selectable.selected::after {
  background: rgba(168, 133, 43, 0.35);
  outline: 3px solid var(--gold);
  outline-offset: -3px;
}
.selectable.selected::before {
  content: '✓';
  position: absolute;
  top: 6px; left: 6px;
  width: 22px; height: 22px;
  background: var(--gold);
  color: var(--ink);
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 22px;
  text-align: center;
  border-radius: 50%;
  border: 1px solid var(--ink);
  z-index: 2;
  pointer-events: none;
  box-shadow: 0 2px 4px rgba(42, 31, 21, 0.4);
}
/* Suppress the lightbox-zoom hover state when selecting — it's distracting. */
.loc-grid img.selectable:hover,
.chronicle-photo.selectable:hover {
  transform: none;
}

/* ========== SELECT-MODE FLOATING ACTION BAR ==========
   Bottom-centred parchment pill. Shows count + Download / Delete (chronicle-only) / Cancel. */
#select-action-bar {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1900;
  background: var(--parchment-1);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  border-radius: 4px;
  box-shadow:
    0 8px 24px rgba(42, 31, 21, 0.5),
    0 0 0 1px var(--gold),
    0 0 0 3px rgba(42, 31, 21, 0.95),
    0 0 0 4px var(--gold);
  max-width: 92vw;
}
.select-count {
  font-family: 'Cinzel', 'IM Fell English SC', serif;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
}
.select-action-btn {
  background: var(--ink);
  color: var(--paper-text);
  border: 1px solid var(--gold);
  font-family: 'Cinzel', 'IM Fell English SC', serif;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.2s, opacity 0.2s;
}
.select-action-btn:hover:not(:disabled) { background: var(--ink-soft); }
.select-action-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.select-action-btn.select-action-danger {
  background: var(--seal-red);
  border-color: var(--seal-red);
}
.select-action-btn.select-action-danger:hover:not(:disabled) { background: #6b2421; }
.select-action-btn.select-action-cancel {
  background: var(--parchment-1);
  color: var(--ink);
}
.select-action-btn.select-action-cancel:hover { background: var(--paper-text); }

/* ========== CONFIRM MODAL ==========
   Destructive-action confirmation. Centred parchment card with cancel/danger
   buttons and a status line for inline error/progress messages. */
#confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 2100;
  background: rgba(15, 10, 6, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
}
.confirm-card {
  background: var(--parchment-1);
  border: 1px solid var(--gold);
  padding: 30px 36px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow:
    0 20px 50px rgba(42, 31, 21, 0.6),
    0 0 0 4px rgba(42, 31, 21, 0.95),
    0 0 0 5px var(--gold);
  border-radius: 4px;
}
.confirm-eyebrow {
  font-family: 'Cinzel', 'IM Fell English SC', serif;
  font-size: 0.7rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--seal-red);
  margin-bottom: 14px;
}
.confirm-message {
  font-family: 'IM Fell English', 'Cormorant Garamond', serif;
  font-style: italic;
  color: var(--ink);
  font-size: 1.1rem;
  line-height: 1.45;
  margin: 0 0 22px;
}
.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.confirm-btn {
  background: var(--parchment-1);
  color: var(--ink);
  border: 1px solid var(--ink-soft);
  font-family: 'Cinzel', 'IM Fell English SC', serif;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 10px 22px;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.2s, color 0.2s;
}
.confirm-btn:hover { background: var(--paper-text); }
.confirm-btn-danger {
  background: var(--seal-red);
  color: var(--paper-text);
  border-color: var(--seal-red);
}
.confirm-btn-danger:hover { background: #6b2421; color: var(--paper-text); }
.confirm-status {
  margin: 14px 0 0;
  min-height: 1.2em;
  font-family: 'IM Fell English', 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.loc-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.loc-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  cursor: pointer;
  border: 1px solid var(--gold);
  transition: transform 0.2s, box-shadow 0.2s;
  border-radius: 2px;
}
.loc-grid img:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(42, 31, 21, 0.4);
}

/* ============ LIGHTBOX ============ */
#lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 10, 6, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 2000;
  cursor: pointer;
  padding: 30px;
}

#lightbox img {
  max-width: 90vw;
  max-height: 80vh;
  border: 4px solid var(--parchment-1);
  box-shadow:
    0 0 0 1px var(--gold),
    0 0 0 5px rgba(42, 31, 21, 0.95),
    0 0 0 6px var(--gold),
    0 20px 60px rgba(42, 31, 21, 0.6);
}


/* ========== COMPASS 8-POINT (override) ========== */
.compass {
  width: 86px; height: 86px;
  animation: compass-rotate 120s linear infinite;  /* 120s/rev per spec */
  animation-play-state: running;
}
.compass:hover { animation-play-state: paused; cursor: pointer; }
@keyframes compass-rotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ========== PLACE NAME TOOLTIPS (engraved cartographer lettering) ==========
   Hover-only — Leaflet's bindTooltip with our hxh-place-tooltip className.
   Strip Leaflet's default tooltip chrome (white box + arrow) and apply the
   parchment label look. */
.leaflet-tooltip.hxh-place-tooltip {
  /* Cinzel-first to match the rest of the site chrome (loc-name, track-name,
     luggage tags, countdown). Was IM Fell English SC per the original style
     guide — overridden 2026-04-27 for visual consistency. */
  font-family: 'Cinzel', 'IM Fell English SC', serif;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  padding: 3px 10px;
  background: rgba(244, 234, 208, 0.92);
  border: none;
  border-top: 1px solid rgba(168, 133, 43, 0.55);
  border-bottom: 1px solid rgba(168, 133, 43, 0.55);
  border-radius: 0;
  box-shadow: none;
}
/* Hide Leaflet's default tooltip pointer (the little arrow) */
.leaflet-tooltip.hxh-place-tooltip::before { display: none; }

/* ========== CLOUD FOG LAYER (canvas inside Leaflet cloudPane) ========== */
.cloud-canvas {
  display: block;
  pointer-events: none;
}
.leaflet-pane.leaflet-cloudPane-pane { pointer-events: none; }

/* ========== TOOLBAR TAGS (luggage-tag buttons) ========== */
.toolbar {
  position: fixed;
  top: 22px;
  right: 130px;
  display: flex;
  gap: 10px;
  z-index: 1500;
}
.tag-btn {
  position: relative;
  background: var(--parchment-1);
  border: 1px solid var(--gold-soft);
  color: var(--ink);
  font-family: 'Cinzel', 'IM Fell English SC', serif;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  padding: 10px 14px 10px 18px;
  cursor: pointer;
  border-radius: 2px;
  box-shadow:
    1px 2px 4px rgba(42, 31, 21,0.25),
    inset 0 0 0 1px rgba(255,255,255,0.15);
  transition: transform 0.15s, background 0.2s;
  transform: rotate(-2deg);
}
.tag-btn:hover { transform: rotate(-2deg) translateY(-2px); background: var(--paper-text); }
.tag-btn.active { background: var(--sea); color: var(--parchment-1); border-color: var(--ink); }
/* The eyelet hole + string attachment */
.tag-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 6px;
  transform: translateY(-50%);
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 1px var(--gold);
}
.tag-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 11px;
  width: 10px;
  height: 1.5px;
  background: linear-gradient(90deg, var(--ink), transparent);
  transform: translateY(-50%) rotate(-15deg);
  transform-origin: left center;
}

/* ========== WAX SEAL (lock card top) ========== */
.wax-seal {
  position: absolute;
  top: -34px;
  left: 50%;
  transform: translateX(-50%);
  width: 68px; height: 68px;
  z-index: 2;
  filter: drop-shadow(0 4px 6px rgba(42, 31, 21,0.4));
}

/* ========== LIGHTBOX: mounted-photo look w/ corner tape ==========
   Layout: dark backdrop with edge nav buttons (prev/next, close); centred
   .lb-stage holds metadata header → framed photo → caption block → counter. */
#lightbox-frame {
  position: relative;
  display: inline-block;
  padding: 14px;
  background: var(--parchment-1);
  border: 1px solid var(--parchment-2);
  box-shadow: 0 20px 60px rgba(42, 31, 21,0.7);
}
.tape {
  position: absolute;
  width: 70px; height: 22px;
  background: rgba(216, 200, 154, 0.75);
  border: 1px solid rgba(168, 133, 43, 0.35);
  box-shadow: 0 2px 4px rgba(42, 31, 21,0.25);
}
.tape-tl { top: -8px; left: -14px; transform: rotate(-18deg); }
.tape-tr { top: -8px; right: -14px; transform: rotate(18deg); }
.tape-bl { bottom: -8px; left: -14px; transform: rotate(16deg); }
.tape-br { bottom: -8px; right: -14px; transform: rotate(-16deg); }

/* Stage — vertical column for meta / frame / caption / counter */
.lb-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 92vw;
}

/* Metadata header — small, ornamental */
.lb-meta {
  font-family: 'IM Fell English SC', 'Cinzel', serif;
  color: var(--paper-text);
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-align: center;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 90vw;
}
.lb-meta-sep { color: var(--gold); opacity: 0.7; }
.lb-meta-by  { font-style: italic; color: var(--paper-text-dim); text-transform: none; letter-spacing: 0.1em; }
.lb-meta span:empty { display: none; }
.lb-meta-sep.hidden { display: none; }

/* Lightbox image sizing — leave room for header + caption block + counter */
#lightbox img {
  max-width: 88vw;
  max-height: 65vh;
  display: block;
}

/* Caption block — display + edit form */
.lb-caption-block {
  background: var(--parchment-1);
  border: 1px solid var(--parchment-2);
  padding: 14px 22px 12px;
  max-width: 600px;
  width: 88vw;
  text-align: center;
  box-shadow: 0 4px 12px rgba(42, 31, 21, 0.4);
}
.lb-caption-display {
  font-family: 'IM Fell English', 'Cormorant Garamond', 'Crimson Text', serif;
  font-style: italic;
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.45;
  min-height: 1.45em;
  margin-bottom: 8px;
}
.lb-caption-display.empty {
  color: var(--ink-soft);
  opacity: 0.55;
  font-style: italic;
}
.lb-caption-edit-btn {
  background: none;
  border: none;
  border-top: 1px dashed var(--gold);
  font-family: 'Cinzel', 'IM Fell English SC', serif;
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--seal-red);
  cursor: pointer;
  padding: 8px 10px 0;
  margin-top: 4px;
  width: 100%;
  transition: color 0.2s;
}
.lb-caption-edit-btn:hover { color: var(--ink); }
.lb-caption-edit {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.lb-caption-edit input {
  flex: 1;
  min-width: 200px;
  font-family: 'Cormorant Garamond', 'Crimson Text', serif;
  font-size: 1rem;
  color: var(--ink);
  background: rgba(244, 234, 208, 0.5);
  border: 1px solid var(--parchment-2);
  border-radius: 2px;
  padding: 8px 12px;
  outline: none;
}
.lb-caption-edit input:focus { border-color: var(--gold); }
/* Coordinate inputs — narrower than the caption input so lat + lon + the
   Save/Cancel/Clear buttons fit on one row at typical lightbox widths. */
.lb-caption-edit input.lb-coord-input {
  flex: 0 1 110px;
  min-width: 80px;
  font-variant-numeric: tabular-nums;
}
.lb-caption-edit button {
  background: var(--ink);
  color: var(--paper-text);
  border: 1px solid var(--gold);
  font-family: 'Cinzel', 'IM Fell English SC', serif;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 8px 14px;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.2s;
}
.lb-caption-edit button:hover { background: var(--ink-soft); }
.lb-caption-status {
  font-family: 'IM Fell English', 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 0.85rem;
  color: var(--ink-soft);
  width: 100%;
  text-align: center;
  margin-top: 4px;
}

/* Counter ("3 of 12") under caption */
.lb-counter {
  font-family: 'IM Fell English SC', 'Cinzel', serif;
  font-size: 0.7rem;
  color: var(--paper-text-dim);
  letter-spacing: 0.25em;
  opacity: 0.75;
}

/* Edge nav arrows + close button */
.lb-nav, .lb-close {
  position: fixed;
  background: rgba(42, 31, 21, 0.6);
  border: 1px solid var(--gold);
  color: var(--paper-text);
  font-family: 'Cinzel', 'IM Fell English SC', serif;
  cursor: pointer;
  z-index: 2010;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  transition: background 0.2s, transform 0.15s;
}
.lb-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 64px;
  font-size: 2.2rem;
  line-height: 1;
}
.lb-prev { left: 24px; }
.lb-next { right: 24px; }
.lb-nav:hover { background: var(--seal-red); transform: translateY(-50%) scale(1.06); }
.lb-close {
  top: 24px;
  right: 24px;
  width: 36px;
  height: 36px;
  font-size: 1.4rem;
}
.lb-close:hover { background: var(--seal-red); }
.lb-rotate {
  top: 24px;
  right: 70px;
  width: 36px;
  height: 36px;
  font-size: 1.2rem;
}
.lb-rotate:hover { background: var(--seal-red); }
.lb-nav.hidden, .lb-close.hidden, .lb-rotate.hidden { display: none; }

/* Rotation handling — img bounds swap when sideways so the rotated photo
   fits the viewport instead of overflowing. */
#lightbox-img {
  transition: transform 0.3s ease;
  transform-origin: center center;
}
#lightbox-img.rot-90,
#lightbox-img.rot-270 {
  max-width: 65vh;
  max-height: 88vw;
}

/* ========== PIN HOVER GLOW (gentle gold) ========== */
.hxh-pin-wrap:hover .hxh-pin-svg {
  filter: drop-shadow(0 0 10px rgba(244, 234, 208, 0.9)) drop-shadow(0 4px 6px rgba(42, 31, 21, 0.55));
  transform: translateY(-6px) scale(1.15);
}

/* Pin drop ink-splash (plays on first render) */
.ink-splash {
  position: absolute;
  left: 50%; top: 75%;
  width: 50px; height: 20px;
  transform: translate(-50%, 0) scale(0);
  background: radial-gradient(ellipse, rgba(42, 31, 21, 0.6) 0%, rgba(42, 31, 21, 0.1) 50%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  animation: ink-splash 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
@keyframes ink-splash {
  0%   { transform: translate(-50%, 0) scale(0); opacity: 0; }
  40%  { transform: translate(-50%, 0) scale(1.4); opacity: 1; }
  100% { transform: translate(-50%, 0) scale(1.8); opacity: 0; }
}

/* ========== ROUTE DRAW-IN (initial animation) ========== */
.travel-path-core.drawing {
  animation: draw-in 2s ease-out forwards;
}
@keyframes draw-in {
  from { stroke-dashoffset: var(--path-len, 2000); }
  to   { stroke-dashoffset: 0; }
}

/* ========== ZOOM HINT ("Exploring...") ========== */
#zoom-hint {
  position: fixed;
  bottom: 90px;
  left: 22px;
  z-index: 1400;
  font-family: 'IM Fell English', 'Cormorant Garamond', 'Cormorant Garamond', 'Crimson Text', serif;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--parchment-1);
  padding: 6px 14px;
  border: 1px solid var(--gold-soft);
  border-radius: 2px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.35s, transform 0.35s;
  pointer-events: none;
  box-shadow: 1px 2px 4px rgba(42, 31, 21,0.25);
  letter-spacing: 0.08em;
}
#zoom-hint.visible {
  opacity: 0.92;
  transform: translateY(0);
}

/* ========== BIRD ANIMATION ========== */
#flying-bird {
  position: fixed;
  top: 25%;
  left: -60px;
  width: 32px; height: 18px;
  z-index: 410;
  opacity: 0;
  pointer-events: none;
  color: rgba(42, 31, 21, 0.55);
}
#flying-bird.flying {
  animation: bird-fly 14s linear forwards;
}
@keyframes bird-fly {
  0%   { left: -60px; opacity: 0; transform: translateY(0) scale(0.9); }
  10%  { opacity: 0.7; }
  50%  { transform: translateY(-12px) scale(1.05); }
  90%  { opacity: 0.7; }
  100% { left: calc(100vw + 60px); opacity: 0; transform: translateY(6px) scale(0.9); }
}
#flying-bird svg { width: 100%; height: 100%; }
.bird-wing { animation: bird-wings 0.45s ease-in-out infinite alternate; transform-origin: center; }
@keyframes bird-wings {
  from { transform: scaleY(1); }
  to   { transform: scaleY(0.4); }
}

/* ========== CHRONICLE VIEW (slide-up parchment journal) ========== */
#chronicle-view {
  position: fixed;
  inset: 0;
  z-index: 1800;
  background: var(--parchment-1);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 70px 36px 90px;
  transform: translateY(100%);
  transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: none;
  visibility: hidden;

  /* Same aged paper background as the main view */
  background-image:
    radial-gradient(ellipse at 15% 15%, rgba(164, 139, 83, 0.2) 0%, transparent 45%),
    radial-gradient(ellipse at 85% 85%, rgba(139, 46, 42, 0.1) 0%, transparent 50%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/></filter><rect width='200' height='200' filter='url(%23n)' opacity='0.08'/></svg>");
  background-color: var(--parchment-1);
}
#chronicle-view.open {
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
}

.chronicle-back {
  position: fixed;
  top: 22px;
  left: 22px;
  z-index: 1850;
  background: var(--parchment-1);
  border: 1px solid var(--gold-soft);
  color: var(--ink);
  font-family: 'Cinzel', 'IM Fell English SC', serif;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  padding: 10px 18px;
  cursor: pointer;
  border-radius: 2px;
  box-shadow: 1px 2px 4px rgba(42, 31, 21,0.25);
  transition: background 0.2s, color 0.2s;
}
.chronicle-back:hover {
  background: var(--sea);
  color: var(--parchment-1);
}

.chronicle-header {
  text-align: center;
  max-width: 700px;
  margin: 20px auto 48px;
}
.chronicle-eyebrow {
  font-family: 'Cinzel', 'IM Fell English SC', serif;
  font-size: 0.72rem;
  letter-spacing: 0.38em;
  color: var(--seal-red);
  text-transform: uppercase;
  margin-bottom: 14px;
}
.chronicle-title {
  font-family: 'Cinzel', 'IM Fell English SC', serif;
  font-weight: 700;
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  letter-spacing: 0.12em;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 10px;
}
.chronicle-sub {
  font-family: 'IM Fell English', 'Cormorant Garamond', 'Cormorant Garamond', 'Crimson Text', serif;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ink-soft);
  opacity: 0.8;
}
.chronicle-ornament {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; margin-top: 18px;
  color: var(--gold); opacity: 0.75;
}
.chronicle-ornament .line {
  width: 80px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

#chronicle-timeline {
  max-width: 1300px;
  margin: 0 auto;
}

.chronicle-month {
  margin-bottom: 56px;
}
.chronicle-month-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}
.chronicle-month-header .line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-soft), transparent);
}
.chronicle-month-header .month-name {
  font-family: 'Cinzel', 'IM Fell English SC', serif;
  font-size: 1rem;
  letter-spacing: 0.28em;
  color: var(--ink);
  white-space: nowrap;
  padding: 0 6px;
}
.chronicle-month-header .count {
  font-family: 'IM Fell English', 'Cormorant Garamond', 'Cormorant Garamond', 'Crimson Text', serif;
  font-style: italic;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.chronicle-month-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.chronicle-photo {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  cursor: pointer;
  border: 1px solid var(--parchment-2);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  display: block;
  background: var(--parchment-2);
}
.chronicle-photo:hover {
  transform: scale(1.04);
  border-color: var(--gold);
  box-shadow: 0 6px 16px rgba(42, 31, 21, 0.35);
  z-index: 1;
  position: relative;
}

/* ========== MOBILE ========== */
@media (max-width: 700px) {
  .compass { width: 56px; height: 56px; top: 14px; right: 14px; }
  #countdown-overlay { top: 14px; left: 14px; padding: 10px 14px; }
  .cd-nums { font-size: 1.7rem; }
  #music-player { min-width: 280px; padding: 8px 12px; bottom: 14px; }
  #location-panel { width: 100vw; }
  .toolbar { top: auto; bottom: 90px; right: 14px; }
  .tag-btn { font-size: 0.6rem; padding: 8px 10px 8px 16px; }
  .corner { width: 60px; height: 60px; }
  .stain-1, .stain-2, .stain-3, .stain-4 { width: 180px; height: 140px; }
  #chronicle-view { padding: 72px 18px 60px; }
  .chronicle-back { top: 14px; left: 14px; font-size: 0.65rem; padding: 8px 12px; }
  .chronicle-month-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
}
