:root {
  color-scheme: dark;
  --ink: #080706;
  --pale: #f4e7c3;
  --muted: rgba(244, 231, 195, 0.62);
  --faint: rgba(244, 231, 195, 0.16);
  --line: rgba(244, 231, 195, 0.42);
  --glow: rgba(244, 231, 195, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #050505;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 16% 18%, rgba(128, 148, 143, 0.16), transparent 31%),
    radial-gradient(circle at 82% 24%, rgba(154, 124, 92, 0.12), transparent 29%),
    linear-gradient(180deg, #050505, #11100d 58%, #060606);
  color: var(--pale);
  font-family: Georgia, "Times New Roman", serif;
}

a {
  color: inherit;
}

.observer-map-page {
  width: min(1540px, calc(100vw - 36px));
  margin: 0 auto;
  padding: clamp(26px, 5vw, 58px) 0 32px;
}

.observer-map-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px clamp(18px, 4vw, 54px);
  border-bottom: 1px solid rgba(212, 188, 126, 0.17);
  background: rgba(5, 5, 5, 0.78);
  backdrop-filter: blur(18px);
}

.observer-map-intro {
  margin-bottom: 24px;
}

.observer-kicker,
.panel-kicker {
  color: #9b8a64;
  font-family: "Times New Roman", "Cinzel", serif;
  text-transform: uppercase;
}

.observer-kicker {
  margin: 0 0 8px;
  font-size: 12px;
}

.panel-kicker {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.24em;
}

h1,
h2,
h3 {
  font-family: "Times New Roman", Cinzel, serif;
  font-weight: normal;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 2vw, 54px);
  letter-spacing: 0;
}

.observer-lead {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

.observer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  font-size: 12px;
  letter-spacing: .12em;
}

.observer-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 15px;
  border: 1px solid rgba(212, 188, 126, 0.34);
  background:
    linear-gradient(180deg, rgba(212, 188, 126, 0.13), rgba(212, 188, 126, 0.035));
  color: #ead9ae;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
  font-family: "Times New Roman", "Cinzel", serif;
  text-decoration: none;
  transition: border-color 0.35s ease, color 0.35s ease, background 0.35s ease;
}

.observer-nav a:hover,
.observer-nav a:focus-visible {
  border-color: rgba(212, 188, 126, 0.56);
  background:
    linear-gradient(180deg, rgba(212, 188, 126, 0.22), rgba(212, 188, 126, 0.07));
  color: #fff0c8;
}

.observer-map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 380px);
  gap: 22px;
  align-items: stretch;
}

.observer-map-frame,
.observer-region-panel {
  border: 1px solid rgba(244, 231, 195, 0.16);
  background:
    linear-gradient(180deg, rgba(244, 231, 195, 0.035), transparent 42%),
    rgba(5, 4, 3, 0.62);
  box-shadow:
    inset 0 0 54px rgba(244, 231, 195, 0.025),
    0 0 34px rgba(0, 0, 0, 0.34);
}

.observer-map-frame {
  position: relative;
  min-height: min(72vh, 760px);
  padding: clamp(10px, 1.4vw, 20px);
  overflow: hidden;
}

.map-reset-button {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(212, 188, 126, 0.36);
  background:
    linear-gradient(180deg, rgba(10, 9, 7, 0.78), rgba(10, 9, 7, 0.46));
  color: rgba(244, 231, 195, 0.82);
  font: 22px/1 "Times New Roman", serif;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    opacity 0.32s ease,
    transform 0.32s ease,
    border-color 0.32s ease,
    color 0.32s ease;
}

.map-reset-button.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.map-reset-button:hover,
.map-reset-button:focus-visible {
  border-color: rgba(212, 188, 126, 0.62);
  color: #fff0c8;
  outline: none;
}

.observer-map-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 76vh;
}

.observer-map-svg text {
  fill: var(--pale) !important;
  pointer-events: none;
}

.observer-map-svg [inkscape\:label="background"],
.observer-map-svg #rect6400 {
  pointer-events: none;
}

.observer-map-region {
  cursor: pointer;
  pointer-events: bounding-box;
  transition: filter 0.32s ease, opacity 0.32s ease;
}

.observer-map-region path,
.observer-map-region polygon {
  transition: fill 0.32s ease, stroke 0.32s ease, opacity 0.32s ease;
}

.observer-map-region:hover,
.observer-map-region:focus,
.observer-map-region.is-selected {
  filter:
    brightness(1.18)
    drop-shadow(0 0 7px rgba(244, 231, 195, 0.25));
  outline: none;
}

.observer-density-silent {
  opacity: 0.78;
}

.observer-density-quiet {
  opacity: 0.88;
}

.observer-density-active {
  opacity: 0.98;
}

.observer-density-dense {
  opacity: 1;
  filter: drop-shadow(0 0 4px rgba(244, 231, 195, 0.1));
}

.observer-map-region-unregistered {
  opacity: 0.48;
}

.observer-region-panel {
  min-height: min(72vh, 760px);
  padding: 24px;
  overflow: auto;
}

.observer-region-panel h2 {
  margin: 0 0 14px;
  color: rgba(255, 246, 222, 0.96);
  font-size: 27px;
}

.panel-note {
  margin: 0 0 18px;
  color: rgba(244, 231, 195, 0.68);
  font-size: 14px;
  line-height: 1.75;
}

.region-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 10px;
}

.region-stats span {
  border: 1px solid rgba(244, 231, 195, 0.18);
  padding: 6px 8px;
  background: rgba(244, 231, 195, 0.045);
  color: rgba(244, 231, 195, 0.78);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.last-observed {
  margin: 0 0 18px;
  color: rgba(244, 231, 195, 0.44);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.record-group {
  border-top: 1px solid rgba(244, 231, 195, 0.13);
  margin-top: 10px;
}

.record-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  min-height: 44px;
  border: 0;
  padding: 12px 2px;
  background: transparent;
  color: rgba(244, 231, 195, 0.78);
  font-family: "Times New Roman", Cinzel, serif;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
}

.record-toggle::before {
  content: "+";
  width: 16px;
  color: rgba(244, 231, 195, 0.38);
  font-size: 18px;
  line-height: 1;
}

.record-group.is-open .record-toggle::before {
  content: "-";
}

.record-toggle span {
  flex: 1;
}

.record-toggle small {
  min-width: 26px;
  border: 1px solid rgba(244, 231, 195, 0.14);
  padding: 3px 6px;
  color: rgba(244, 231, 195, 0.46);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-align: center;
}

.record-toggle:hover,
.record-toggle:focus-visible {
  color: rgba(255, 244, 220, 0.96);
  outline: none;
}

.record-panel {
  max-height: 230px;
  overflow: auto;
  padding: 0 4px 14px 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(244, 231, 195, 0.28) rgba(244, 231, 195, 0.05);
}

.record-panel::-webkit-scrollbar {
  width: 7px;
}

.record-panel::-webkit-scrollbar-track {
  background: rgba(244, 231, 195, 0.05);
}

.record-panel::-webkit-scrollbar-thumb {
  background: rgba(244, 231, 195, 0.26);
}

.record-group ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.record-group li {
  display: grid;
  gap: 4px;
  padding-left: 12px;
  border-left: 1px solid rgba(244, 231, 195, 0.22);
}

.record-label {
  color: rgba(244, 231, 195, 0.46);
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.record-title {
  color: rgba(255, 244, 220, 0.9);
  font-size: 13px;
  line-height: 1.45;
  text-decoration: none;
}

a.record-title:hover,
a.record-title:focus-visible {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.record-group small,
.record-empty {
  color: rgba(244, 231, 195, 0.44);
  font-size: 12px;
  line-height: 1.55;
}

.record-empty {
  margin: 0;
}

.observer-empty,
.observer-footer-note {
  margin: 18px 0 0;
  color: rgba(244, 231, 195, 0.44);
  font-size: 12px;
  letter-spacing: 0.08em;
}

@media (max-width: 980px) {
  .observer-map-page {
    width: min(100vw - 24px, 760px);
    padding-top: 24px;
  }

  .observer-map-header,
  .observer-map-layout {
    display: block;
  }

  .observer-nav {
    justify-content: flex-start;
    margin-top: 18px;
  }

  .observer-map-header {
    padding: 22px 18px;
  }

  .observer-map-frame {
    min-height: auto;
  }

  .observer-region-panel {
    min-height: 0;
    margin-top: 16px;
  }
}
