:root {
  --cream: #f6f1e7;
  --paper: #fbf8f1;
  --ink: #2c2a26;
  --muted: #6f6a60;
  --forest: #3f6b4a;
  --forest-deep: #2f5439;
  --leaf: #a9c79d;
  --bark: #8a5a3b;
  --route: #c1440e;
  --water: #5b8fa8;
  --line: #ddd5c7;
  --shadow: 0 18px 45px rgba(62, 51, 36, 0.16);
  --header-h: 76px;
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  background: #e9e2d5;
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button {
  font: inherit;
}

svg {
  display: block;
}

.app-header {
  position: relative;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 18px;
  height: var(--header-h);
  padding: 0 22px;
  flex-shrink: 0;
  background: rgba(251, 248, 241, 0.94);
  border-bottom: 1px solid rgba(221, 213, 199, 0.9);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-icon {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  filter: drop-shadow(0 5px 10px rgba(47, 84, 57, 0.18));
}

.brand-icon svg {
  width: 100%;
  height: 100%;
}

.brand-copy {
  min-width: 0;
}

.brand-copy h1 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 21px;
  line-height: 1.02;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--forest-deep);
  white-space: nowrap;
}

.brand-copy p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  white-space: nowrap;
}

.header-stats {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.header-stats span {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.header-stats strong {
  color: var(--forest-deep);
  font-size: 14px;
  font-weight: 700;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 18px;
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid rgba(221, 213, 199, 0.95);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
  color: var(--forest-deep);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.015em;
  white-space: nowrap;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.ghost-button:hover {
  background: #ffffff;
  border-color: #c9c0b1;
  transform: translateY(-1px);
}

.ghost-button:active {
  transform: translateY(0);
}

.ghost-button-quiet {
  color: var(--muted);
}

.sidebar-toggle {
  display: none;
}

.app-main {
  display: grid;
  grid-template-columns: 356px minmax(0, 1fr);
  height: calc(100dvh - var(--header-h));
  min-height: 0;
}

.sidebar {
  min-height: 0;
  background: var(--paper);
  border-right: 1px solid var(--line);
}

.sidebar-inner {
  height: 100%;
  overflow-y: auto;
  padding: 24px 20px 28px;
  scrollbar-width: thin;
  scrollbar-color: #c9c0b1 transparent;
}

.sidebar-inner::-webkit-scrollbar {
  width: 8px;
}

.sidebar-inner::-webkit-scrollbar-thumb {
  background: #d4ccbd;
  border-radius: 999px;
  border: 2px solid var(--paper);
}

.sidebar-head {
  padding: 2px 4px 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--route);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.review-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 10px 17px 10px 13px;
  border: 1px solid rgba(47, 84, 57, 0.55);
  border-radius: 999px;
  background: linear-gradient(145deg, #5b9a67 0%, #3f6b4a 45%, #2f5439 100%);
  color: #ffffff;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.18);
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(47, 84, 57, 0.32), 0 0 12px rgba(120, 210, 132, 0.35);
  animation: review-glow 2.6s ease-in-out infinite;
  transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
}

.review-button svg {
  width: 17px;
  height: 17px;
}

.review-button:hover {
  border-color: rgba(88, 160, 99, 0.9);
  background: linear-gradient(145deg, #69ad75 0%, #4a7d57 45%, #356141 100%);
  filter: brightness(1.05);
  transform: translateY(-1px);
  animation: none;
  box-shadow: 0 8px 22px rgba(47, 84, 57, 0.4), 0 0 20px rgba(120, 210, 132, 0.7);
}

.review-button:active {
  transform: translateY(0);
}

.review-button:focus-visible,
.review-back:focus-visible {
  outline: 2px solid var(--route);
  outline-offset: 2px;
}

@keyframes review-glow {
  0%,
  100% {
    box-shadow: 0 6px 16px rgba(47, 84, 57, 0.32), 0 0 12px rgba(120, 210, 132, 0.35);
  }
  50% {
    box-shadow: 0 8px 20px rgba(47, 84, 57, 0.42), 0 0 24px rgba(120, 210, 132, 0.75);
  }
}

.sidebar-head h2 {
  margin: 0;
  color: var(--forest-deep);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 25px;
  line-height: 1.08;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.sidebar-intro {
  margin: 10px 0 14px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.sidebar-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sidebar-meta span {
  padding: 4px 8px;
  border: 1px solid #e6dfd2;
  border-radius: 999px;
  background: #f4efe5;
  color: #5b564d;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.hike-switch {
  display: flex;
  gap: 4px;
  margin-top: 12px;
  padding: 4px;
  border: 1px solid #e6dfd2;
  border-radius: 999px;
  background: #f4efe5;
}

.hike-switch-button {
  flex: 1 1 0;
  min-width: 0;
  padding: 7px 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.04em;
  white-space: nowrap;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.hike-switch-button:hover {
  color: var(--forest-deep);
}

.hike-switch-button.is-active {
  background: var(--forest);
  color: var(--cream);
  box-shadow: 0 3px 8px rgba(47, 84, 57, 0.22);
}

.hike-switch-button:focus-visible {
  outline: 2px solid var(--route);
  outline-offset: 2px;
}

.timeline {
  position: relative;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 22px;
  bottom: 22px;
  left: 18px;
  width: 1px;
  background: linear-gradient(to bottom, transparent, #ddd5c7 8%, #ddd5c7 92%, transparent);
}

.timeline-item {
  position: relative;
}

.timeline-button {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  margin: 0 0 2px;
  padding: 9px 8px 9px 4px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 150ms ease;
}

.timeline-button:hover {
  background: #f4efe5;
}

.timeline-button.is-active {
  background: #f0eadf;
}

.timeline-number {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border: 1.5px solid #d5ccbd;
  border-radius: 50%;
  background: var(--paper);
  color: var(--forest-deep);
  font-size: 11px;
  font-weight: 750;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.timeline-button.is-active .timeline-number {
  border-color: var(--forest);
  background: var(--forest);
  color: var(--cream);
}

.timeline-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding-top: 1px;
}

.timeline-top {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.timeline-time {
  color: var(--forest-deep);
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.timeline-type {
  overflow: hidden;
  padding: 1px 5px;
  border-radius: 999px;
  background: #efe9dd;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.timeline-title {
  overflow: hidden;
  color: #35322c;
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.28;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-spark {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--route);
  opacity: 0.38;
  transition: opacity 150ms ease, transform 150ms ease;
}

.timeline-spark svg {
  width: 13px;
  height: 13px;
}

.timeline-button:hover .timeline-spark,
.timeline-button.is-active .timeline-spark {
  opacity: 1;
  transform: scale(1.08);
}

.sidebar-foot {
  margin-top: 20px;
  padding: 16px 4px 0;
  border-top: 1px solid var(--line);
  color: #8a8478;
  font-size: 10px;
  line-height: 1.5;
}

.sidebar-foot p {
  margin: 0 0 4px;
}

.sidebar-backdrop,
.detail-backdrop {
  display: none;
}

.login-view {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 18% 8%, rgba(255, 255, 255, 0.7), transparent 34%),
    linear-gradient(150deg, #efe8da 0%, #e9e2d5 48%, #e3dccd 100%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 200ms ease, visibility 0s linear 200ms;
}

body.locked .login-view {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 200ms ease, visibility 0s;
}

.login-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(47, 84, 57, 0.45);
  backdrop-filter: blur(6px);
}

.login-panel {
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  padding: 48px 32px;
  border-radius: 0;
  background: var(--paper);
  border: none;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.locked .login-panel {
  transform: none;
}

.login-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}

.login-head h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.4px;
}

.login-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.login-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: center;
  gap: 18px;
  margin-top: auto;
  margin-bottom: auto;
}

.login-field {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: -0.2px;
}

.login-field input {
  flex: 1;
  padding: 14px 18px;
  font-size: 17px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--cream);
  color: var(--ink);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.login-field input:focus {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(63, 107, 74, 0.15);
}

.login-error {
  margin: 0 0 14px;
  font-size: 13px;
  color: #a33;
  text-align: center;
}

.login-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 8px;
}

body.locked .app-header,
body.locked .app-main {
  filter: blur(3px) brightness(0.8);
  pointer-events: none;
  user-select: none;
}

.map-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #f3eee3;
}

#map {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-color: #f3eee3;
  background-image:
    repeating-radial-gradient(ellipse at 24% 18%, transparent 0 44px, rgba(175, 164, 143, 0.17) 45px 46px, transparent 47px 92px),
    repeating-radial-gradient(ellipse at 82% 74%, transparent 0 57px, rgba(175, 164, 143, 0.13) 58px 59px, transparent 60px 120px),
    radial-gradient(circle at 48% 38%, rgba(255, 255, 255, 0.32), transparent 68%);
  background-size: 520px 520px, 680px 680px, auto;
  cursor: grab;
}

#map:active {
  cursor: grabbing;
}

.leaflet-container {
  background: transparent;
  font-family: inherit;
}

.leaflet-control-zoom {
  overflow: hidden;
  border: 1px solid rgba(221, 213, 199, 0.95) !important;
  border-radius: 12px !important;
  box-shadow: 0 8px 24px rgba(62, 51, 36, 0.14) !important;
}

.leaflet-control-zoom a {
  width: 35px !important;
  height: 35px !important;
  border: 0 !important;
  border-bottom: 1px solid #e6dfd2 !important;
  background: rgba(251, 248, 241, 0.96) !important;
  color: var(--forest-deep) !important;
  font-size: 19px !important;
  line-height: 35px !important;
}

.leaflet-control-zoom a:last-child {
  border-bottom: 0 !important;
}

.leaflet-control-zoom a:hover {
  background: #ffffff !important;
}

.leaflet-control-scale-line {
  border: 1px solid rgba(111, 106, 96, 0.5);
  border-top: 0;
  background: rgba(251, 248, 241, 0.82);
  color: #5b564d;
  font-size: 9px;
  line-height: 1.1;
  padding: 2px 4px 1px;
  text-shadow: none;
}

.leaflet-control-attribution {
  margin: 0 8px 8px 0 !important;
  padding: 3px 7px !important;
  border-radius: 6px;
  background: rgba(251, 248, 241, 0.82) !important;
  color: #7b7569 !important;
  font-size: 9px !important;
  line-height: 1.35;
}

.leaflet-control-attribution a {
  color: var(--forest) !important;
}

.leaflet-tooltip {
  border: 0;
  box-shadow: none;
}

.stop-tooltip {
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--forest-deep);
  color: var(--cream);
  box-shadow: 0 8px 20px rgba(47, 84, 57, 0.22);
  font-size: 11px;
  line-height: 1.25;
  white-space: nowrap;
}

.stop-tooltip::before {
  border-top-color: var(--forest-deep);
}

.tooltip-index {
  display: block;
  margin-bottom: 2px;
  color: #c9dbc2;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tooltip-title {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
}

.tooltip-meta {
  display: block;
  margin-top: 2px;
  color: #c9dbc2;
  font-size: 9.5px;
}

.trail-tooltip {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
  color: #4d493f;
  box-shadow: 0 4px 12px rgba(62, 51, 36, 0.1);
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
}

.trail-tooltip::before {
  border-top-color: var(--paper);
}

.road-tooltip {
  color: var(--muted);
}

.map-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(221, 213, 199, 0.95);
  border-radius: 999px;
  background: rgba(251, 248, 241, 0.9);
  color: var(--forest-deep);
  box-shadow: 0 7px 18px rgba(62, 51, 36, 0.1);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
  backdrop-filter: blur(8px);
}

.map-chip svg {
  width: 14px;
  height: 14px;
  color: var(--route);
}

.map-topline {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 500;
  pointer-events: none;
}

.legend {
  position: absolute;
  bottom: 22px;
  left: 22px;
  z-index: 500;
  min-width: 154px;
  padding: 13px 15px 12px;
  border: 1px solid rgba(221, 213, 199, 0.95);
  border-radius: 14px;
  background: rgba(251, 248, 241, 0.9);
  box-shadow: 0 10px 28px rgba(62, 51, 36, 0.12);
  color: #5b564d;
  font-size: 10px;
  pointer-events: none;
  backdrop-filter: blur(8px);
}

.legend-title {
  margin-bottom: 7px;
  color: var(--forest-deep);
  font-size: 8.5px;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.swatch {
  display: block;
  width: 15px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 2px;
}

.swatch-forest {
  background: #c6d8ba;
  border: 1px solid #8ba37e;
}

.swatch-trail {
  background: repeating-linear-gradient(90deg, #8a5a3b 0 4px, transparent 4px 7px);
  height: 3px;
}

.swatch-water {
  background: var(--water);
  height: 3px;
}

.swatch-route {
  background: var(--route);
  height: 3px;
}

.swatch-stop {
  width: 10px;
  height: 10px;
  margin-left: 2px;
  border: 2px solid var(--forest);
  border-radius: 50%;
  background: var(--paper);
}

.map-label-anchor {
  width: 0 !important;
  height: 0 !important;
  background: none;
  border: 0;
}

.map-label {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  pointer-events: none;
  text-shadow:
    0 1px 0 rgba(246, 241, 231, 0.95),
    0 0 9px rgba(246, 241, 231, 0.9);
}

.label-forest {
  color: rgba(47, 84, 57, 0.46);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.label-park {
  color: rgba(63, 107, 74, 0.62);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.label-road {
  color: rgba(112, 105, 93, 0.78);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.label-place {
  color: #3b372f;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.label-feature {
  color: #4d7d92;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 11.5px;
  font-style: italic;
}

.label-trail {
  color: rgba(138, 90, 59, 0.8);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.stop-icon {
  background: none;
  border: 0;
}

.stop-marker {
  --marker-color: var(--forest);
  position: relative;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 2px solid var(--marker-color);
  border-radius: 50%;
  background: rgba(251, 248, 241, 0.96);
  color: var(--marker-color);
  box-shadow:
    0 0 0 5px rgba(251, 248, 241, 0.5),
    0 5px 16px rgba(62, 51, 36, 0.2);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.03em;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.stop-marker:hover {
  transform: scale(1.08);
  box-shadow:
    0 0 0 6px rgba(251, 248, 241, 0.62),
    0 8px 22px rgba(62, 51, 36, 0.24);
}

.stop-marker.is-active {
  background: var(--marker-color);
  color: var(--paper);
  transform: scale(1.12);
  box-shadow:
    0 0 0 7px rgba(193, 68, 14, 0.16),
    0 10px 26px rgba(62, 51, 36, 0.28);
}

.stop-number {
  line-height: 1;
}

.stop-spark {
  position: absolute;
  right: -3px;
  bottom: -3px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--route);
  color: var(--cream);
  box-shadow: 0 2px 6px rgba(62, 51, 36, 0.2);
}

.stop-spark svg {
  width: 9px;
  height: 9px;
}

.stop-marker.has-scene .stop-spark {
  animation: spark-pulse 3.4s ease-in-out infinite;
}

.stop-marker.is-active .stop-spark {
  background: #f6c28b;
  color: #7a2a08;
}

.type-checkpoint {
  --marker-color: #4d7d92;
}

.type-stop {
  --marker-color: var(--route);
}

.type-session {
  --marker-color: #7d6a9a;
}

.type-descent {
  --marker-color: var(--bark);
}

.type-arrival {
  --marker-color: var(--forest-deep);
}

.type-departure {
  --marker-color: var(--forest);
}

.stop-icon:focus-visible {
  outline: none;
}

.stop-icon:focus-visible .stop-marker {
  box-shadow:
    0 0 0 5px rgba(193, 68, 14, 0.3),
    0 5px 16px rgba(62, 51, 36, 0.2);
}

.route-flow {
  animation: route-dash 2.4s linear infinite;
}

.detail-panel {
  position: absolute;
  top: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 800;
  display: flex;
  flex-direction: column;
  width: 392px;
  max-width: calc(100% - 36px);
  overflow: hidden;
  border: 1px solid rgba(221, 213, 199, 0.9);
  border-radius: 20px;
  background: var(--paper);
  box-shadow: var(--shadow);
  visibility: hidden;
  pointer-events: none;
  transform: translateX(calc(100% + 32px));
  transition: transform 320ms cubic-bezier(0.22, 0.8, 0.24, 1), visibility 0s linear 320ms;
}

body.detail-open .detail-panel {
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
  transition: transform 360ms cubic-bezier(0.22, 0.8, 0.24, 1), visibility 0s;
}

.detail-close {
  position: absolute;
  top: 13px;
  right: 13px;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(221, 213, 199, 0.9);
  border-radius: 50%;
  background: rgba(251, 248, 241, 0.88);
  color: var(--ink);
  box-shadow: 0 3px 10px rgba(62, 51, 36, 0.12);
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background 150ms ease, transform 150ms ease;
}

.detail-close:hover {
  background: #ffffff;
  transform: rotate(4deg);
}

.detail-close svg {
  width: 15px;
  height: 15px;
}

.detail-scene {
  position: relative;
  flex-shrink: 0;
  height: 236px;
  overflow: hidden;
  background: #dce8d5;
}

.detail-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 -22px 34px rgba(62, 51, 36, 0.08);
  pointer-events: none;
}

.scene-svg {
  width: 100%;
  height: 100%;
}

.detail-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: 19px 20px 18px;
  scrollbar-width: thin;
  scrollbar-color: #d4ccbd transparent;
}

.detail-body::-webkit-scrollbar {
  width: 8px;
}

.detail-body::-webkit-scrollbar-thumb {
  border: 2px solid var(--paper);
  border-radius: 999px;
  background: #d4ccbd;
}

.detail-kicker {
  margin: 0 0 6px;
  color: var(--route);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.detail-body h2 {
  margin: 0 0 8px;
  color: var(--forest-deep);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 29px;
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.detail-summary {
  margin: 0;
  color: #4e4a42;
  font-size: 13px;
  line-height: 1.55;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 13px 0 14px;
}

.meta-chip {
  padding: 3px 8px;
  border: 1px solid #e6dfd2;
  border-radius: 999px;
  background: #f2ede2;
  color: #5b564d;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.meta-time {
  border-color: var(--forest);
  background: var(--forest);
  color: var(--cream);
  font-weight: 750;
}

.detail-note {
  margin: 0 0 16px;
  padding-left: 10px;
  border-left: 2px solid #e6dfd2;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.detail-scene-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 13px;
  border-top: 1px solid #eee7da;
}

.scene-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(169, 199, 157, 0.32);
  color: var(--forest-deep);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.scene-pill svg {
  width: 11px;
  height: 11px;
  color: var(--route);
}

.text-button {
  padding: 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--route);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 150ms ease;
}

.text-button:hover {
  background: rgba(193, 68, 14, 0.08);
}

.detail-nav {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 13px;
  border-top: 1px solid #eee7da;
}

.detail-nav-button {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 35px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--forest-deep);
  font-size: 10.5px;
  font-weight: 650;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}

.detail-nav-button:hover:not(:disabled) {
  border-color: #c9c0b1;
  background: #f2ede2;
}

.detail-nav-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.detail-nav-button svg {
  width: 13px;
  height: 13px;
}

.scene-canopy {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: sway 4.8s ease-in-out infinite alternate;
}

.scene-fern-sway {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: sway 3.8s ease-in-out infinite alternate;
}

.scene-cloud {
  animation: cloud-drift 12s ease-in-out infinite alternate;
}

.scene-sun {
  transform-box: fill-box;
  transform-origin: center;
  animation: sun-pulse 6.5s ease-in-out infinite alternate;
}

.scene-bird {
  animation: bird-flight 20s linear infinite;
}

.scene-bird-small {
  animation-duration: 27s;
  animation-delay: -9s;
}

.scene-fall-line {
  stroke-dasharray: 14 16;
  animation: water-fall 1.15s linear infinite;
}

.scene-flow {
  animation: water-flow 2.2s linear infinite;
}

.scene-mist {
  transform-box: fill-box;
  transform-origin: center;
  animation: mist 3.4s ease-in-out infinite alternate;
}

.scene-ripple {
  transform-box: fill-box;
  transform-origin: center;
  animation: ripple 3.1s ease-out infinite;
}

.scene-petal {
  transform-box: fill-box;
  transform-origin: center;
  animation: petal-fall 5.6s linear infinite;
}

.scene-kite {
  transform-box: fill-box;
  transform-origin: center;
  animation: kite-bob 4.2s ease-in-out infinite alternate;
}

.scene-flag {
  transform-box: fill-box;
  transform-origin: left center;
  animation: flag-wave 2.5s ease-in-out infinite alternate;
}

.scene-confetti {
  transform-box: fill-box;
  transform-origin: center;
  animation: confetti-fall 5.4s linear infinite;
}

.scene-butterfly {
  transform-box: fill-box;
  transform-origin: center;
  animation: butterfly-flutter 3.6s ease-in-out infinite alternate;
}

.scene-hawk {
  transform-box: fill-box;
  transform-origin: center;
  animation: hawk-drift 9s ease-in-out infinite alternate;
}

@keyframes sway {
  from { transform: rotate(-1.1deg); }
  to { transform: rotate(1.1deg); }
}

@keyframes cloud-drift {
  from { transform: translateX(-7px); }
  to { transform: translateX(11px); }
}

@keyframes sun-pulse {
  from { opacity: 0.68; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1.04); }
}

@keyframes bird-flight {
  from { transform: translateX(-90px); }
  to { transform: translateX(760px); }
}

@keyframes water-fall {
  to { stroke-dashoffset: -60; }
}

@keyframes water-flow {
  to { stroke-dashoffset: -34; }
}

@keyframes mist {
  from { opacity: 0.12; transform: translateY(3px) scale(0.88); }
  to { opacity: 0.34; transform: translateY(-7px) scale(1.16); }
}

@keyframes ripple {
  0% { opacity: 0.5; transform: scale(0.62); }
  75% { opacity: 0.05; transform: scale(1.28); }
  100% { opacity: 0; transform: scale(1.4); }
}

@keyframes petal-fall {
  0% { opacity: 0; transform: translateY(-8px) rotate(0deg); }
  12% { opacity: 0.9; }
  100% { opacity: 0; transform: translateY(46px) rotate(190deg); }
}

@keyframes kite-bob {
  from { transform: translateY(-4px) rotate(-2deg); }
  to { transform: translateY(4px) rotate(2deg); }
}

@keyframes flag-wave {
  from { transform: skewY(0deg) scaleX(1); }
  to { transform: skewY(-2.4deg) scaleX(0.96); }
}

@keyframes confetti-fall {
  0% { opacity: 0; transform: translateY(-10px) rotate(0deg); }
  8% { opacity: 1; }
  100% { opacity: 0; transform: translateY(120px) rotate(210deg); }
}

@keyframes butterfly-flutter {
  from { transform: translate(0, 0) rotate(-4deg); }
  to { transform: translate(7px, -7px) rotate(7deg); }
}

@keyframes hawk-drift {
  from { transform: translate(0, 0); }
  to { transform: translate(38px, -16px); }
}

@keyframes route-dash {
  to { stroke-dashoffset: -18; }
}

.review-view {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 18% 8%, rgba(255, 255, 255, 0.7), transparent 34%),
    linear-gradient(150deg, #efe8da 0%, #e9e2d5 48%, #e3dccd 100%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 200ms ease, transform 240ms ease, visibility 0s linear 240ms;
}

body.review-open .review-view {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition: opacity 200ms ease, transform 240ms ease, visibility 0s;
}

.review-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--header-h);
  padding: 0 22px;
  flex-shrink: 0;
  background: rgba(251, 248, 241, 0.94);
  border-bottom: 1px solid rgba(221, 213, 199, 0.9);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(12px);
}

.review-back {
  gap: 4px;
  padding-left: 9px;
}

.review-back svg {
  width: 15px;
  height: 15px;
}

.review-bar-title {
  color: var(--forest-deep);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.review-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 38px 22px 58px;
  overscroll-behavior: contain;
}

.review-paper {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 46px 54px 52px;
  background: var(--paper);
  border: 1px solid rgba(221, 213, 199, 0.9);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(62, 51, 36, 0.15);
}

.review-paper .eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.review-paper .eyebrow::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(193, 68, 14, 0.38), rgba(193, 68, 14, 0));
}

.review-paper h2 {
  margin: 0;
  color: var(--forest-deep);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: clamp(30px, 4vw, 40px);
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.review-source {
  display: inline-flex;
  align-items: center;
  margin: 14px 0 0;
  padding: 4px 10px;
  color: #7b756a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  background: rgba(221, 213, 199, 0.28);
  border: 1px solid rgba(221, 213, 199, 0.75);
  border-radius: 999px;
}

.review-content {
  margin-top: 26px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.review-line {
  display: grid;
  grid-template-columns: minmax(132px, 168px) minmax(0, 1fr);
  align-items: baseline;
  gap: 2px 26px;
  margin: 0;
  padding: 16px 0;
  color: #35322c;
  font-size: 15px;
  line-height: 1.62;
  border-bottom: 1px solid rgba(221, 213, 199, 0.6);
}

.review-line:first-child {
  padding-top: 14px;
}

.review-line:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.review-line strong {
  color: var(--forest-deep);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.review-doc-heading {
  margin: 28px 0 12px;
  color: var(--forest-deep);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 22px;
  line-height: 1.2;
  font-weight: 600;
}

.review-doc-heading:first-child {
  margin-top: 0;
}

.review-tab {
  display: inline-block;
  width: 2em;
}

.review-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

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

@media (max-width: 1180px) {
  .header-stats {
    display: none;
  }

  .header-actions {
    margin-left: auto;
  }
}

@media (max-width: 900px) {
  :root {
    --header-h: 64px;
  }

  .review-bar {
    padding: 0 14px;
  }

  .review-bar-title {
    font-size: 16px;
  }

  .review-scroll {
    padding: 22px 14px calc(44px + env(safe-area-inset-bottom));
  }

  .review-paper {
    padding: 32px 24px 38px;
    border-radius: 12px;
  }

  .review-paper h2 {
    font-size: 28px;
  }

  .app-header {
    gap: 12px;
    padding: 0 14px;
  }

  .brand-icon {
    width: 38px;
    height: 38px;
  }

  .brand-copy h1 {
    font-size: 17px;
  }

  .brand-copy p {
    font-size: 8px;
    letter-spacing: 0.12em;
  }

  .app-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1200;
    width: min(88vw, 360px);
    border-right: 1px solid var(--line);
    box-shadow: 24px 0 50px rgba(44, 42, 38, 0.18);
    transform: translateX(-105%);
    transition: transform 300ms cubic-bezier(0.22, 0.8, 0.24, 1);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-inner {
    padding-top: calc(22px + env(safe-area-inset-top));
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: block;
    background: rgba(44, 42, 38, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 240ms ease;
  }

  body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-toggle {
    display: inline-flex;
  }

  .detail-panel {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1300;
    width: 100%;
    max-width: none;
    max-height: 86dvh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 20px 20px 0 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(102%);
    transition: transform 320ms cubic-bezier(0.22, 0.8, 0.24, 1), visibility 0s linear 320ms;
  }

  body.detail-open .detail-panel {
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition: transform 360ms cubic-bezier(0.22, 0.8, 0.24, 1), visibility 0s;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .detail-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1250;
    display: block;
    background: rgba(44, 42, 38, 0.36);
    opacity: 0;
    pointer-events: none;
    transition: opacity 240ms ease;
  }

  body.detail-open .detail-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .detail-scene {
    height: 200px;
  }

  .detail-body {
    padding: 17px 18px 18px;
  }

  .detail-body h2 {
    font-size: 25px;
  }

  .map-chip {
    padding: 7px 10px;
    font-size: 9.5px;
  }

  .legend {
    display: none;
  }
}

@media (max-width: 720px) {
  .header-stats {
    display: none;
  }

  .review-bar-title {
    display: none;
  }

  .review-paper {
    padding: 28px 20px 34px;
  }

  .review-paper h2 {
    font-size: 25px;
  }

  .review-line {
    grid-template-columns: 1fr;
    gap: 4px;
    font-size: 14px;
    padding: 14px 0;
  }

  .review-line strong {
    line-height: 1.4;
  }

  .header-actions {
    gap: 6px;
  }

  .ghost-button {
    min-height: 31px;
    padding: 7px 9px;
    font-size: 10.5px;
  }

  #fit-forest,
  #reset-view {
    display: none;
  }

  .brand-copy h1 {
    font-size: 16px;
  }

  .brand-copy p {
    display: none;
  }

  .brand-icon {
    width: 35px;
    height: 35px;
  }

  .map-topline {
    top: 12px;
    left: 12px;
  }

  .label-place,
  .label-feature,
  .label-trail {
    display: none;
  }

  .label-forest {
    font-size: 16px;
    letter-spacing: 0.22em;
  }

  .detail-scene {
    height: 180px;
  }

  .detail-summary {
    font-size: 12.5px;
  }

  .detail-note {
    font-size: 11.5px;
  }

  .leaflet-control-attribution {
    max-width: 190px;
    margin-bottom: 4px !important;
  }

  .leaflet-control-scale {
    margin-bottom: 4px !important;
  }
}

@media (max-width: 430px) {
  .brand-copy h1 {
    font-size: 15px;
  }

  .header-actions .ghost-button {
    padding: 7px 8px;
  }

  .map-chip {
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .detail-scene {
    height: 165px;
  }

  .detail-body {
    padding: 15px 15px 16px;
  }

  .detail-body h2 {
    font-size: 23px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

.media-grid {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.media-grid .media-section {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.media-grid .media-section h4 {
  margin: -12px -12px 8px;
  margin-bottom: 8px;
  padding: 0 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--forest-deep);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.media-grid img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 4px;
  margin-top: 8px;
}

.media-grid video {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 4px;
  margin-top: 8px;
}

/* --- Detail media --- */
.detail-media {
  margin: 2px 0 16px;
}

.detail-media[hidden] {
  display: none;
}

.detail-media-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.detail-media-title {
  color: var(--route);
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.detail-media-trek {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 650;
  color: #fff;
  background: var(--forest);
}

.detail-media-trek.trek-cubs {
  background: var(--water);
}

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

.detail-photo {
  margin: 0;
  overflow: hidden;
  border-radius: 8px;
  background: #ece6da;
  cursor: zoom-in;
}

.detail-photo img {
  display: block;
  width: 100%;
  height: 104px;
  object-fit: cover;
  transition: transform 200ms ease;
}

.detail-photo:hover img {
  transform: scale(1.04);
}

.detail-video {
  margin-top: 10px;
}

.detail-video video {
  display: block;
  width: 100%;
  border-radius: 10px;
  background: #000;
  max-height: 220px;
}

.detail-video-caption {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
}

/* --- Map media pins --- */
.media-pin-anchor {
  background: transparent;
  border: 0;
}

.media-pin {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--route);
  background: #fff;
  box-shadow: 0 3px 9px rgba(44, 42, 38, 0.28);
  overflow: visible;
  cursor: pointer;
}

.media-pin.trek-cubs {
  border-color: var(--water);
}

.media-pin img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.media-pin-video {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--route);
  font-size: 12px;
}

.media-pin.trek-cubs .media-pin-video {
  color: var(--water);
}

.media-pin-count {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 15px;
  padding: 1px 4px;
  border-radius: 999px;
  background: var(--forest-deep);
  color: #fff;
  font-size: 9px;
  font-weight: 750;
  line-height: 1.4;
  text-align: center;
}

.media-tooltip .tooltip-index {
  color: var(--water);
}

.ghost-button.is-off {
  opacity: 0.55;
  text-decoration: line-through;
}

/* --- Lightbox --- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: none;
  place-items: center;
  padding: 28px;
  background: rgba(18, 22, 18, 0.9);
}

.lightbox.is-open {
  display: grid;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: rgba(251, 248, 241, 0.14);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.lightbox-close svg {
  width: 16px;
  height: 16px;
}

/* --- Authored review prose & safety briefing --- */
.review-prose {
  margin: 0 0 16px;
  color: #35322c;
  font-size: 15px;
  line-height: 1.7;
}

.review-lead {
  font-size: 16.5px;
  color: #2f2c26;
}

.review-content .review-prose:last-child {
  margin-bottom: 0;
}

.review-safety {
  list-style: none;
  margin: 4px 0 18px;
  padding: 0;
  display: grid;
  gap: 12px;
}

.review-safety li {
  position: relative;
  padding-left: 26px;
  color: #35322c;
  font-size: 15px;
  line-height: 1.6;
}

.review-safety li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--leaf);
  box-shadow: 0 0 0 3px rgba(169, 199, 157, 0.28);
}

.review-safety strong {
  color: var(--forest-deep);
  font-weight: 700;
}
