:root {
  color-scheme: dark;
  --ink: #eef4ea;
  --muted: #aab9ac;
  --deep: #0d1513;
  --panel: #15201c;
  --panel-2: #1b2923;
  --line: #31463b;
  --moss: #7eaa74;
  --moss-bright: #a9d09d;
  --gold: #d6b86c;
  --clay: #b47758;
  --water: #6e9fa7;
  --danger: #d88772;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(126, 170, 116, 0.12), transparent 32rem),
    linear-gradient(145deg, #0a110f, var(--deep) 45%, #101a16);
  color: var(--ink);
}

button,
select {
  font: inherit;
}

button,
select,
[tabindex] {
  outline-offset: 3px;
}

button:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--gold);
}

.site-header {
  min-height: 88px;
  padding: 18px clamp(18px, 3vw, 42px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 15, 13, 0.92);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  letter-spacing: 0.02em;
}

h2 {
  margin-bottom: 5px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 2vw, 1.8rem);
}

h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.eyebrow,
.section-kicker {
  margin-bottom: 4px;
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.header-actions,
.layout-switch,
.panel-heading,
.directory-heading,
.map-toggles,
.content-toolbar,
.map-notes,
.coordinate-bar {
  display: flex;
  align-items: center;
}

.header-actions {
  gap: 12px;
}

.version-chip,
.range-chip,
.status-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.layout-switch {
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0b1210;
}

.icon-button,
.text-button {
  border: 1px solid transparent;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.text-button:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.map-toggles {
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: wrap;
}

.icon-button {
  min-height: 34px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px;
  font-size: 0.76rem;
}

.icon-button:hover,
.icon-button.is-active,
.text-button:hover,
.text-button.is-active {
  color: var(--ink);
  background: var(--panel-2);
  border-color: var(--line);
}

.viewer-shell {
  width: min(100%, 2300px);
  margin: 0 auto;
  padding: clamp(14px, 2vw, 28px);
  display: grid;
  gap: clamp(16px, 2vw, 28px);
  align-items: start;
}

.viewer-shell.layout-side {
  grid-template-columns: minmax(420px, 1024px) minmax(480px, 1fr);
}

.viewer-shell.layout-stacked {
  grid-template-columns: minmax(0, 1fr);
}

.viewer-shell.layout-stacked .map-column {
  width: min(1024px, 100%);
  justify-self: center;
}

.map-column,
.content-column {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(21, 32, 28, 0.92);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-heading {
  justify-content: space-between;
  gap: 15px;
  padding: 15px 18px 12px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
  margin-bottom: 0;
}

.text-button {
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 0.76rem;
  font-weight: 700;
}

.map-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-width: 1024px;
  overflow: hidden;
  background: #121b17;
  isolation: isolate;
  cursor: crosshair;
}

.base-map,
.map-fallback,
.district-overlay,
.locale-grid,
.map-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.base-map {
  z-index: 1;
  display: block;
  object-fit: contain;
  image-rendering: auto;
}

.base-map.is-missing {
  display: none;
}

.district-overlay {
  z-index: 2;
  display: block;
  object-fit: contain;
  pointer-events: none;
  opacity: 0;
  transition: opacity 150ms ease;
}

.district-overlay.is-visible {
  opacity: 1;
}

.district-overlay.is-missing {
  display: none;
}

.map-fallback {
  z-index: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
  background:
    radial-gradient(circle at 53% 47%, rgba(126, 170, 116, 0.24), transparent 22%),
    radial-gradient(circle at 25% 67%, rgba(110, 159, 167, 0.18), transparent 18%),
    linear-gradient(135deg, #1c2d25, #283b2b 46%, #19261f);
}

.map-fallback strong {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.1rem, 3vw, 2.2rem);
}

.map-fallback span {
  font-size: 0.82rem;
}

.locale-grid {
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  background-image:
    linear-gradient(to right, rgba(238, 244, 234, 0.16) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(238, 244, 234, 0.16) 1px, transparent 1px),
    linear-gradient(to right, rgba(214, 184, 108, 0.42) 2px, transparent 2px),
    linear-gradient(to bottom, rgba(214, 184, 108, 0.42) 2px, transparent 2px);
  background-size:
    3.125% 3.125%,
    3.125% 3.125%,
    25% 25%,
    25% 25%;
  transition: opacity 150ms ease;
}

.locale-grid.is-visible {
  opacity: 1;
}

.map-overlay {
  z-index: 4;
  pointer-events: none;
}

.map-marker {
  z-index: 5;
  position: absolute;
  width: 28px;
  height: 34px;
  margin: -30px 0 0 -14px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: grab;
  touch-action: none;
}

.map-marker[hidden] {
  display: none;
}

.map-marker span {
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 20px;
  height: 20px;
  border: 2px solid white;
  border-radius: 50% 50% 50% 0;
  background: var(--gold);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.55);
  transform: translateX(-50%) rotate(-45deg);
}

.map-marker span::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: #4f3d12;
}

.map-marker:hover span,
.map-marker:focus-visible span,
.map-marker.is-dragging span {
  background: #f0d37f;
  box-shadow: 0 0 0 4px rgba(214, 184, 108, 0.28), 0 3px 0 rgba(0, 0, 0, 0.55);
}

.map-marker.is-dragging {
  cursor: grabbing;
}

.coordinate-bar {
  min-height: 40px;
  padding: 8px 14px;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #0d1613;
  color: var(--muted);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.7rem;
}

.coordinate-bar strong {
  color: var(--ink);
}

.coordinate-action {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.68rem;
}

.coordinate-action:hover:not(:disabled) {
  border-color: var(--gold);
}

.coordinate-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.map-notes {
  min-height: 38px;
  padding: 9px 14px;
  flex-wrap: wrap;
  gap: 15px;
  color: var(--muted);
  font-size: 0.68rem;
}

.map-notes span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 10px;
  height: 10px;
  display: inline-block;
  border-radius: 2px;
}

.swatch-low {
  background: #466c54;
}

.swatch-high {
  background: #b5c39a;
}

.swatch-grid {
  border: 1px solid var(--gold);
  background: transparent;
}

.content-column {
  min-height: 760px;
}

.content-toolbar {
  min-height: 58px;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: #0d1613;
}

.content-toolbar label {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

select {
  min-width: 190px;
  padding: 8px 34px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--ink);
}

.locale-banner {
  min-height: 104px;
  padding: 16px 18px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  background:
    linear-gradient(90deg, rgba(126, 170, 116, 0.14), transparent 58%),
    var(--panel);
}

.locale-banner p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.locale-symbol {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border: 1px solid var(--moss);
  border-radius: 50%;
  background: #0d1713;
  color: var(--moss-bright);
  font-size: 2rem;
}

.locale-symbol.is-feature {
  font-size: 1.55rem;
}

.banner-pid {
  margin-left: 8px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--moss-bright);
  letter-spacing: 0;
  text-transform: none;
}

.status-chip {
  color: var(--gold);
}

.view-tabs {
  display: flex;
  gap: 4px;
  padding: 0 14px;
  overflow-x: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}

.view-tabs button {
  padding: 12px 13px 10px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  font-size: 0.76rem;
  font-weight: 800;
}

.view-tabs button:hover,
.view-tabs button.is-active {
  color: var(--ink);
  border-bottom-color: var(--gold);
}

.content-layout {
  min-height: 590px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
}

.feature-directory {
  padding: 14px 10px;
  border-right: 1px solid var(--line);
  background: #101a16;
}

.directory-heading {
  justify-content: space-between;
  gap: 8px;
  padding: 0 6px 10px;
}

.directory-heading h3 {
  margin-bottom: 0;
}

.range-chip {
  color: var(--moss-bright);
}

.feature-list {
  display: grid;
  gap: 5px;
}

.feature-button {
  width: 100%;
  padding: 9px;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 8px;
  align-items: start;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.feature-button:hover,
.feature-button.is-active {
  border-color: var(--line);
  background: var(--panel-2);
  color: var(--ink);
}

.feature-button .pid {
  color: var(--gold);
  font-weight: 800;
}

.feature-button strong,
.feature-button small {
  display: block;
}

.feature-button strong {
  margin-bottom: 2px;
  color: inherit;
  font-size: 0.78rem;
}

.feature-button small {
  color: #829187;
  font-size: 0.64rem;
  line-height: 1.3;
}

.feature-button .feature-bv {
  margin-top: 4px;
  color: var(--gold);
  font-family: "Cascadia Code", Consolas, monospace;
}

.content-viewport {
  min-width: 0;
  height: 590px;
  padding: clamp(18px, 3vw, 30px);
  overflow: auto;
  scroll-behavior: smooth;
}

.record-heading {
  margin-bottom: 22px;
  padding-bottom: 17px;
  border-bottom: 1px solid var(--line);
}

.record-heading h2 {
  margin-bottom: 5px;
}

.record-heading .lead {
  max-width: 72ch;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

.record-meta {
  margin-bottom: 11px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.record-meta span {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  font-size: 0.67rem;
}

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

.detail-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(11, 18, 16, 0.65);
}

.detail-card.wide {
  grid-column: 1 / -1;
}

.detail-card h3 {
  color: var(--moss-bright);
}

.detail-card h4 {
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 0.86rem;
}

.detail-card p,
.detail-card li,
.detail-card dd,
.detail-card blockquote {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.detail-card p:last-child,
.detail-card ul:last-child {
  margin-bottom: 0;
}

.detail-card ul {
  margin: 0;
  padding-left: 18px;
}

.detail-card code {
  color: var(--gold);
  overflow-wrap: anywhere;
}

.detail-card blockquote {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--gold);
  background: rgba(214, 184, 108, 0.07);
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
}

.detail-card.draft-card {
  border-color: rgba(214, 184, 108, 0.45);
  background: rgba(214, 184, 108, 0.06);
}

.detail-card.warning-card {
  border-color: rgba(216, 135, 114, 0.55);
  background: rgba(216, 135, 114, 0.07);
}

.detail-card.warning-card h3 {
  color: var(--danger);
}

.detail-card.warning-card .item-list li {
  border-left-color: var(--danger);
  background: rgba(216, 135, 114, 0.08);
}

.item-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.item-list li {
  padding: 9px 10px;
  border-left: 3px solid var(--moss);
  background: rgba(126, 170, 116, 0.07);
}

.item-list strong,
.item-list small {
  display: block;
}

.item-list small {
  margin-top: 2px;
  color: #88988e;
}

.definition-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.definition-list div {
  display: grid;
  grid-template-columns: minmax(105px, 0.34fr) 1fr;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(49, 70, 59, 0.65);
}

.definition-list div:last-child {
  border-bottom: 0;
}

.definition-list dt {
  color: var(--moss-bright);
  font-size: 0.7rem;
  font-weight: 800;
}

.definition-list dd {
  margin: 0;
}

.record-list {
  display: grid;
  gap: 10px;
}

.record-list.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.indexed-record {
  padding: 13px;
  border: 1px solid rgba(49, 70, 59, 0.82);
  border-radius: 8px;
  background: rgba(21, 32, 28, 0.8);
}

.indexed-record > header {
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 10px;
}

.indexed-record > header p {
  margin-bottom: 0;
  color: #849389;
  font-size: 0.68rem;
}

.indexed-record > p:last-child {
  margin-bottom: 0;
}

.indexed-record .pid,
.directory-table .pid {
  color: var(--gold);
  font-weight: 800;
}

.bv-chip,
.power-chip,
.resident-chip,
.species-chip {
  align-self: start;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--moss-bright);
  font-size: 0.65rem;
  font-weight: 800;
  white-space: nowrap;
}

.power-chip {
  color: #c6b3e3;
}

.resident-chip {
  color: var(--gold);
}

.species-chip {
  color: #9bc9cf;
}

.record-flags,
.demographic-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 9px 0;
}

.record-flags span,
.demographic-grid span {
  padding: 4px 7px;
  border: 1px solid rgba(49, 70, 59, 0.82);
  border-radius: 5px;
  color: var(--muted);
  font-size: 0.67rem;
}

.demographic-grid span {
  min-width: 112px;
  display: grid;
  gap: 2px;
}

.demographic-grid b {
  color: var(--gold);
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.directory-table {
  display: grid;
  gap: 5px;
}

.directory-table > div {
  display: grid;
  grid-template-columns: 42px minmax(130px, 0.85fr) minmax(180px, 1.4fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-left: 3px solid var(--moss);
  background: rgba(126, 170, 116, 0.07);
  color: var(--muted);
  font-size: 0.72rem;
}

.directory-table strong {
  color: var(--ink);
}

.path-list {
  display: grid;
  gap: 7px;
}

.path-list > div {
  display: grid;
  grid-template-columns: 34px minmax(140px, 0.7fr) 1fr;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid rgba(49, 70, 59, 0.72);
  border-radius: 7px;
}

.path-list span {
  color: var(--gold);
  font-weight: 800;
}

.path-list small {
  color: var(--muted);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  margin-top: 14px;
}

.metric-grid > div {
  min-width: 0;
  padding: 9px;
  border: 1px solid rgba(49, 70, 59, 0.72);
  border-radius: 7px;
  background: rgba(11, 18, 16, 0.5);
}

.metric-grid span,
.metric-grid strong {
  display: block;
}

.metric-grid span {
  min-height: 2.4em;
  color: var(--muted);
  font-size: 0.62rem;
  overflow-wrap: anywhere;
}

.metric-grid strong {
  margin-top: 5px;
  color: var(--gold);
  font-family: "Cascadia Code", Consolas, monospace;
}

.schedule-list {
  margin: 0;
  padding: 0;
  display: grid;
  list-style: none;
}

.schedule-list li {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(49, 70, 59, 0.65);
}

.schedule-list li:last-child {
  border-bottom: 0;
}

.schedule-list span {
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.schedule-list p {
  margin-bottom: 0;
}

.empty-state,
.draft-notice {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: rgba(11, 18, 16, 0.55);
  line-height: 1.6;
}

.draft-notice {
  border-color: rgba(214, 184, 108, 0.45);
}

footer {
  padding: 13px clamp(18px, 3vw, 42px) 20px;
  display: flex;
  justify-content: space-between;
  gap: 15px;
  flex-wrap: wrap;
  color: #728178;
  font-size: 0.66rem;
}

@media (max-width: 1399px) {
  .viewer-shell.layout-side {
    grid-template-columns: minmax(380px, 0.9fr) minmax(480px, 1.1fr);
  }
}

@media (max-width: 1099px) {
  .viewer-shell,
  .viewer-shell.layout-side,
  .viewer-shell.layout-stacked {
    grid-template-columns: minmax(0, 1fr);
  }

  .map-column {
    width: min(1024px, 100%);
    justify-self: center;
  }

  #layoutSide {
    display: none;
  }
}

@media (max-width: 720px) {
  .site-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .content-layout {
    grid-template-columns: 1fr;
  }

  .feature-directory {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .feature-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-viewport {
    height: auto;
    min-height: 520px;
  }

  .locale-banner {
    grid-template-columns: auto 1fr;
  }

  .locale-banner .status-chip {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .detail-card.wide {
    grid-column: auto;
  }

  .record-list.compact,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .directory-table > div {
    grid-template-columns: 36px 1fr auto;
  }

  .directory-table > div > span:nth-child(3) {
    grid-column: 2 / -1;
  }
}

@media (max-width: 480px) {
  .version-chip {
    display: none;
  }

  .feature-list {
    grid-template-columns: 1fr;
  }

  .coordinate-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .definition-list div,
  .path-list > div,
  .schedule-list li {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
