:root {
  color-scheme: dark;
  font-family: "Avenir Next", Avenir, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0c1210;
  color: #f4f1e8;
  --header-height: 96px;
  --ink: #0c1210;
  --panel: rgba(17, 25, 22, 0.97);
  --panel-soft: rgba(29, 40, 35, 0.86);
  --panel-lifted: rgba(22, 32, 28, 0.94);
  --border: rgba(224, 231, 217, 0.14);
  --border-strong: rgba(224, 231, 217, 0.24);
  --text: #f4f1e8;
  --muted: #aab6ad;
  --muted-warm: #c9bdab;
  --moss: #a8ce91;
  --moss-deep: #20382b;
  --foxfire: #e7b96b;
  --rain: #88afa8;
  --danger: #f0a18f;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% -15%, rgba(231, 185, 107, 0.08), transparent 30rem),
    var(--ink);
}

button,
input {
  font: inherit;
}

button,
label {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

::selection {
  color: #101b14;
  background: var(--moss);
}

:focus-visible {
  outline: 3px solid var(--foxfire);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: relative;
  z-index: 10;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  overflow: hidden;
  padding: 13px 22px 14px;
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(90deg, rgba(16, 24, 21, 0.98), rgba(20, 29, 25, 0.96)),
    #111916;
  box-shadow: 0 10px 30px rgba(3, 8, 6, 0.24);
}

.topbar::after {
  position: absolute;
  z-index: -1;
  top: -95px;
  left: 18%;
  width: 390px;
  height: 180px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 58% 62%, rgba(231, 185, 107, 0.12), transparent 32%),
    radial-gradient(circle at 42% 68%, rgba(126, 175, 151, 0.09), transparent 50%);
  content: "";
  filter: blur(5px);
  pointer-events: none;
}

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

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--moss);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.18em;
  line-height: 1;
  text-transform: uppercase;
}

.waypoint-mark {
  position: relative;
  width: 17px;
  height: 8px;
  flex: 0 0 auto;
}

.waypoint-mark::before {
  position: absolute;
  top: 2px;
  left: 0;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--foxfire);
  box-shadow:
    6px -2px 0 -0.5px rgba(231, 185, 107, 0.72),
    12px 1px 0 -1px rgba(168, 206, 145, 0.74),
    0 0 12px rgba(231, 185, 107, 0.5);
  content: "";
}

h1,
.detail-panel h2 {
  font-family: Iowan Old Style, Palatino Linotype, Book Antiqua, Palatino, Georgia, serif;
  font-weight: 600;
}

h1 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: clamp(23px, 2.6vw, 31px);
  letter-spacing: -0.025em;
  line-height: 0.98;
}

.dedication {
  margin: 5px 0 0;
  color: var(--muted-warm);
  font-family: Iowan Old Style, Palatino Linotype, Book Antiqua, Palatino, Georgia, serif;
  font-size: 13px;
  font-style: italic;
  letter-spacing: 0.01em;
  line-height: 1.1;
}

.progress {
  min-width: 104px;
  display: grid;
  grid-template-columns: auto auto;
  align-items: end;
  column-gap: 7px;
  flex: 0 0 auto;
  padding: 9px 12px 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(7, 13, 10, 0.32);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
}

.progress-label {
  grid-column: 1 / -1;
  margin-bottom: 1px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.13em;
  line-height: 1;
  text-transform: uppercase;
}

.progress-count {
  display: flex;
  align-items: baseline;
  gap: 4px;
  color: var(--muted-warm);
  font-size: 13px;
  line-height: 1;
}

.progress-count strong {
  color: var(--moss);
  font-family: Iowan Old Style, Palatino Linotype, Book Antiqua, Palatino, Georgia, serif;
  font-size: 25px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.progress-suffix {
  padding-bottom: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}

.shell {
  height: calc(100vh - var(--header-height));
  height: calc(100dvh - var(--header-height));
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 390px);
}

.map-wrap {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: #1d2724;
}

.map-wrap::after {
  position: absolute;
  z-index: 1;
  inset: 0;
  box-shadow:
    inset 0 22px 32px -30px rgba(4, 9, 7, 0.72),
    inset -20px 0 34px -36px rgba(3, 8, 6, 0.64);
  content: "";
  pointer-events: none;
}

#map {
  position: absolute;
  inset: 0;
}

.map-tools {
  position: absolute;
  z-index: 3;
  top: 14px;
  left: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toggle,
.ghost-button {
  min-height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: rgba(14, 21, 18, 0.9);
  color: var(--text);
  box-shadow: 0 7px 22px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(14px) saturate(125%);
}

.toggle {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 13px 8px 9px;
  font-size: 13px;
  font-weight: 650;
  user-select: none;
}

.toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.toggle-control {
  position: relative;
  width: 34px;
  height: 22px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: #303a35;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.toggle-control::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #d5dad5;
  content: "";
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.36);
  transition: transform 160ms ease, background-color 160ms ease;
}

.toggle input:checked + .toggle-control {
  border-color: rgba(168, 206, 145, 0.52);
  background: var(--moss-deep);
}

.toggle input:checked + .toggle-control::after {
  background: var(--moss);
  transform: translateX(12px);
}

.toggle input:focus-visible + .toggle-control {
  outline: 3px solid var(--foxfire);
  outline-offset: 3px;
}

.ghost-button {
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 650;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.ghost-button:hover {
  border-color: rgba(231, 185, 107, 0.44);
  background: rgba(27, 37, 32, 0.94);
}

.loading-card {
  position: absolute;
  z-index: 4;
  right: 16px;
  bottom: 16px;
  left: 16px;
  max-width: 390px;
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 15px;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: rgba(15, 23, 20, 0.95);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px) saturate(120%);
}

.loading-card[hidden] {
  display: none;
}

.state-orb {
  position: relative;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid rgba(168, 206, 145, 0.34);
  border-radius: 50%;
  background:
    radial-gradient(circle at 62% 34%, #f0cc87 0 7%, transparent 8%),
    radial-gradient(circle at 48% 56%, rgba(168, 206, 145, 0.82), rgba(69, 103, 79, 0.42) 38%, transparent 66%);
  box-shadow: 0 0 18px rgba(168, 206, 145, 0.24);
}

.loading .state-orb {
  animation: breathe 1.8s ease-in-out infinite;
}

.loading-card.error .state-orb {
  border-color: rgba(240, 161, 143, 0.45);
  background: radial-gradient(circle, rgba(240, 161, 143, 0.85), rgba(104, 50, 43, 0.4) 38%, transparent 66%);
  box-shadow: 0 0 18px rgba(240, 161, 143, 0.2);
}

.loading-card.empty .state-orb {
  border-color: rgba(136, 175, 168, 0.4);
  background: radial-gradient(circle, rgba(136, 175, 168, 0.75), rgba(53, 79, 75, 0.4) 38%, transparent 66%);
}

.state-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.state-copy strong {
  color: var(--text);
  font-family: Iowan Old Style, Palatino Linotype, Book Antiqua, Palatino, Georgia, serif;
  font-size: 16px;
  font-weight: 600;
}

.state-copy span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.68;
    transform: scale(0.92);
  }
  50% {
    opacity: 1;
    transform: scale(1.04);
  }
}

.detail-panel {
  position: relative;
  z-index: 2;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 27px 28px 32px;
  border-left: 1px solid var(--border);
  background:
    radial-gradient(circle at 100% 0, rgba(231, 185, 107, 0.055), transparent 17rem),
    linear-gradient(180deg, rgba(22, 31, 27, 0.98), rgba(15, 23, 20, 0.99));
  box-shadow: -18px 0 46px rgba(3, 8, 6, 0.15);
  scrollbar-color: rgba(168, 206, 145, 0.35) transparent;
  scrollbar-width: thin;
}

.sheet-handle {
  display: none;
}

.detail-empty {
  max-width: 300px;
  margin: 18vh auto 0;
  color: var(--muted);
}

.empty-mark {
  position: relative;
  width: 54px;
  height: 54px;
  margin-bottom: 22px;
  border: 1px solid rgba(168, 206, 145, 0.26);
  border-radius: 50%;
  background: radial-gradient(circle at 64% 35%, rgba(231, 185, 107, 0.2), transparent 15%);
  box-shadow:
    inset 0 0 22px rgba(168, 206, 145, 0.05),
    0 0 28px rgba(168, 206, 145, 0.08);
}

.empty-mark::before,
.empty-mark::after,
.empty-mark span::before {
  position: absolute;
  width: 25px;
  height: 12px;
  border-top: 1px solid var(--moss);
  border-radius: 50%;
  content: "";
  opacity: 0.78;
  transform-origin: left center;
}

.empty-mark::before {
  top: 28px;
  left: 14px;
  transform: rotate(-31deg);
}

.empty-mark::after {
  top: 28px;
  left: 17px;
  transform: rotate(3deg);
}

.empty-mark span::before {
  top: 27px;
  left: 14px;
  border-color: var(--foxfire);
  transform: rotate(34deg);
}

.category {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border: 1px solid rgba(168, 206, 145, 0.27);
  border-radius: 999px;
  background: rgba(49, 73, 56, 0.22);
  color: var(--moss);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.11em;
  line-height: 1;
  text-transform: uppercase;
}

.category::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
  box-shadow: 0 0 8px rgba(168, 206, 145, 0.45);
}

.detail-empty h2 {
  margin: 16px 0 11px;
  color: var(--text);
  font-size: 29px;
  letter-spacing: -0.02em;
  line-height: 1.04;
}

.detail-empty p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}

.detail-empty .empty-hint {
  margin-top: 18px;
  color: var(--muted-warm);
  font-family: Iowan Old Style, Palatino Linotype, Book Antiqua, Palatino, Georgia, serif;
  font-size: 13px;
  font-style: italic;
}

.detail-topline {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-flags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.visited-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--foxfire);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.visited-badge svg {
  width: 14px;
  height: 14px;
}

.close-details {
  width: 44px;
  height: 44px;
  display: none;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(12, 18, 16, 0.52);
  color: var(--muted-warm);
}

.close-details svg {
  width: 17px;
  height: 17px;
}

.detail-panel h2 {
  margin: 16px 0 5px;
  color: var(--text);
  font-size: clamp(28px, 3vw, 36px);
  letter-spacing: -0.03em;
  line-height: 1.02;
}

.detail-subtitle {
  margin: 0 0 21px;
  color: var(--rain);
  font-family: Iowan Old Style, Palatino Linotype, Book Antiqua, Palatino, Georgia, serif;
  font-size: 14px;
  font-style: italic;
  line-height: 1.35;
}

.meta {
  display: grid;
  gap: 0;
  margin: 20px 0 22px;
  border-top: 1px solid var(--border);
}

.meta-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.meta-row dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}

.meta-row dd {
  min-width: 0;
  margin: 0;
  color: #e9e7df;
  font-size: 13px;
  line-height: 1.4;
}

.fact {
  position: relative;
  margin: 0;
  padding: 16px 16px 17px;
  overflow: hidden;
  border: 1px solid rgba(231, 185, 107, 0.19);
  border-radius: 15px;
  background:
    radial-gradient(circle at 100% 0, rgba(231, 185, 107, 0.11), transparent 12rem),
    var(--panel-soft);
  color: #dddcd4;
  font-size: 13px;
  line-height: 1.58;
}

.fact::after {
  position: absolute;
  top: -8px;
  right: -5px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(231, 185, 107, 0.12);
  border-radius: 50%;
  content: "";
  box-shadow: 0 0 24px rgba(231, 185, 107, 0.08);
}

.fact-label {
  display: block;
  margin-bottom: 6px;
  color: var(--foxfire);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.fact p {
  margin: 0;
}

.source-note {
  margin: 14px 2px 0;
  color: #85928a;
  font-size: 11px;
  line-height: 1.4;
}

.actions {
  display: grid;
  gap: 9px;
  margin-top: 22px;
}

.primary-button,
.secondary-button {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 15px;
  border: 1px solid transparent;
  border-radius: 13px;
  font-weight: 750;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.primary-button svg {
  width: 18px;
  height: 18px;
}

.primary-button {
  background: linear-gradient(135deg, #b7da9f, #96c48b);
  color: #102016;
  box-shadow:
    0 9px 26px rgba(66, 105, 76, 0.22),
    inset 0 1px rgba(255, 255, 255, 0.3);
}

.primary-button:hover:not(:disabled) {
  box-shadow:
    0 11px 30px rgba(76, 119, 86, 0.3),
    inset 0 1px rgba(255, 255, 255, 0.34);
  transform: translateY(-1px);
}

.primary-button:active:not(:disabled) {
  transform: translateY(0);
}

.primary-button.visited,
.primary-button[disabled] {
  border-color: rgba(168, 206, 145, 0.28);
  background: rgba(52, 78, 60, 0.34);
  color: var(--moss);
  box-shadow: none;
  cursor: default;
  opacity: 1;
}

.primary-button.is-busy {
  border-color: transparent;
  background: linear-gradient(135deg, #b7da9f, #96c48b);
  color: #102016;
  box-shadow:
    0 9px 26px rgba(66, 105, 76, 0.18),
    inset 0 1px rgba(255, 255, 255, 0.28);
  cursor: wait;
}

.button-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(16, 32, 22, 0.28);
  border-top-color: #102016;
  border-radius: 50%;
  animation: spin 750ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

.secondary-button {
  border-color: var(--border-strong);
  background: transparent;
  color: var(--text);
}

.secondary-button:hover {
  border-color: rgba(231, 185, 107, 0.42);
  background: rgba(231, 185, 107, 0.05);
}

.status {
  margin: 14px 2px 0;
  padding-left: 12px;
  border-left: 2px solid rgba(136, 175, 168, 0.34);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.status.success {
  border-color: rgba(168, 206, 145, 0.66);
  color: var(--moss);
}

.status.error {
  border-color: rgba(240, 161, 143, 0.66);
  color: var(--danger);
}

.dev-note {
  margin: 12px 2px 0;
  color: var(--foxfire);
  font-size: 11px;
  line-height: 1.45;
}

.maplibregl-ctrl-bottom-right {
  right: 3px;
  bottom: 3px;
}

.maplibregl-ctrl-group {
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 13px;
  background: rgba(15, 23, 20, 0.92);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
}

.maplibregl-ctrl-group:not(:empty) {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.28);
}

.maplibregl-ctrl-group button {
  width: 42px;
  height: 42px;
}

.maplibregl-ctrl-group button + button {
  border-top-color: var(--border);
}

.maplibregl-ctrl button .maplibregl-ctrl-icon {
  filter: invert(0.92) sepia(0.08);
}

.maplibregl-ctrl-group button:hover {
  background-color: rgba(46, 64, 54, 0.84);
}

.maplibregl-ctrl-attrib {
  border-radius: 6px 0 0;
  background: rgba(242, 242, 237, 0.82);
  font-size: 10px;
}

.maplibregl-popup-content {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #141d19;
  color: var(--text);
  box-shadow: var(--shadow);
}

.maplibregl-popup-tip {
  border-top-color: #141d19 !important;
}

@media (max-width: 820px) {
  :root {
    --header-height: 94px;
  }

  body {
    overflow: hidden;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 11px max(12px, env(safe-area-inset-right)) 12px max(12px, env(safe-area-inset-left));
  }

  .eyebrow {
    gap: 6px;
    font-size: 9px;
    letter-spacing: 0.13em;
  }

  .waypoint-mark {
    width: 15px;
  }

  h1 {
    max-width: 240px;
    font-size: clamp(21px, 6vw, 25px);
  }

  .dedication {
    max-width: 100%;
    font-size: clamp(10.5px, 3vw, 12px);
    white-space: nowrap;
  }

  .progress {
    min-width: 74px;
    column-gap: 5px;
    padding: 8px 9px 7px;
    border-radius: 12px;
  }

  .progress-count strong {
    font-size: 22px;
  }

  .progress-suffix {
    font-size: 9px;
  }

  .shell {
    display: block;
  }

  .map-wrap {
    height: 100%;
  }

  .map-wrap::after {
    box-shadow: inset 0 20px 28px -28px rgba(4, 9, 7, 0.68);
  }

  .map-tools {
    top: 10px;
    right: 10px;
    left: 10px;
  }

  .toggle,
  .ghost-button {
    background: rgba(14, 21, 18, 0.94);
  }

  .ghost-button {
    display: none;
  }

  .loading-card {
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 10px;
    max-width: none;
  }

  .detail-panel {
    position: fixed;
    z-index: 20;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 8px;
    max-height: min(68dvh, 620px);
    padding: 33px 18px calc(18px + env(safe-area-inset-bottom));
    border: 1px solid var(--border-strong);
    border-radius: 23px;
    background:
      radial-gradient(circle at 100% 0, rgba(231, 185, 107, 0.07), transparent 14rem),
      linear-gradient(180deg, rgba(23, 33, 28, 0.99), rgba(14, 22, 19, 0.995));
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
    overscroll-behavior: contain;
    transform: translateY(calc(100% + 28px));
    transition: transform 220ms cubic-bezier(0.22, 0.75, 0.2, 1);
  }

  .detail-panel.open {
    transform: translateY(0);
  }

  .sheet-handle {
    position: absolute;
    top: 10px;
    left: 50%;
    width: 38px;
    height: 4px;
    display: block;
    border-radius: 999px;
    background: rgba(229, 232, 224, 0.25);
    transform: translateX(-50%);
  }

  .detail-empty {
    display: none;
  }

  .close-details {
    display: grid;
  }

  .detail-panel h2 {
    margin-top: 13px;
    font-size: clamp(27px, 8vw, 33px);
  }

  .scientific {
    margin-bottom: 17px;
  }

  .meta {
    margin: 17px 0 19px;
  }

  .meta-row {
    grid-template-columns: 88px minmax(0, 1fr);
    padding: 9px 0;
  }

  .actions {
    margin-top: 19px;
  }

  .maplibregl-ctrl-bottom-right {
    right: 0;
    bottom: 0;
  }
}

@media (max-width: 410px) {
  .progress-suffix {
    display: none;
  }

  .progress {
    min-width: 64px;
    display: grid;
    padding: 8px 9px 7px;
  }

  .dedication {
    max-width: calc(100vw - 92px);
  }
}

@media (max-height: 650px) and (max-width: 820px) {
  :root {
    --header-height: 88px;
  }

  .topbar {
    padding-top: 8px;
    padding-bottom: 9px;
  }

  .detail-panel {
    max-height: 76dvh;
  }
}

@media (pointer: coarse) {
  .maplibregl-ctrl-group button {
    width: 46px;
    height: 46px;
  }
}

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