:root {
  color-scheme: light;
  --ink: #1f1b0d;
  --muted: #6f665a;
  --panel: #ffffff;
  --page: #f3efe5;
  --surface: #fffaf1;
  --surface-low: #f7efe0;
  --surface-high: #e9ddc5;
  --line: #d6c7ad;
  --line-strong: #aa936c;
  --accent: #842234;
  --primary: #2f1729;
  --blue: #214e8a;
  --green: #4f6f3e;
  --gold: #b9822e;
  --focus: #214e8a;
  --shadow: 0 10px 28px rgba(47, 23, 41, 0.08);
  --font-body: "Public Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Noto Serif", Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: var(--font-body);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: linear-gradient(rgba(132, 34, 52, 0.018) 1px, transparent 1px), linear-gradient(90deg, rgba(132, 34, 52, 0.012) 1px, transparent 1px), url("data:image/svg+xml,%3Csvg width='120' height='120' viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.04'/%3E%3C/svg%3E");
  background-size: 36px 36px, 36px 36px, 120px 120px;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input[type="search"],
input[type="number"] {
  border: 1px solid #cfc3ad;
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
}

button {
  min-height: 34px;
  padding: 0 12px;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

button:hover {
  background: #4a1c40;
}

button:focus,
input:focus,
select:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

a {
  color: var(--blue);
}

.app {
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(190px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 58px;
  padding: 8px 18px;
  background: rgba(253, 250, 244, 0.98);
  color: var(--primary);
  border-bottom: 1px solid var(--line-strong);
  box-shadow: 0 2px 14px rgba(31, 27, 13, 0.07);
  position: relative;
  z-index: 20;
}

.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--gold), transparent 78%);
  pointer-events: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  width: fit-content;
  color: var(--primary);
  text-decoration: none;
}

.brand:hover .brand-title {
  color: var(--accent);
}

.brand-title {
  font-family: var(--font-display);
  font-size: clamp(18px, 2.2vw, 23px);
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.brand-title::after {
  content: "Roman Military Dispositions Atlas";
  display: block;
  margin-top: 3px;
  color: #75664d;
  font-family: var(--font-body);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.11em;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.site-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 9px;
  border-radius: 4px;
  color: #665a48;
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.site-nav-link:hover,
.site-nav-link.active {
  background: #f3ead8;
  color: var(--primary);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.material-symbols-outlined {
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  font-size: 17px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 7px;
  min-width: 0;
}

.nav-link,
.detail-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  color: #fff;
  background: var(--accent);
  border: 1px solid #651521;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.nav-link:hover,
.detail-link:hover {
  background: #8c2b38;
}

.detail-link {
  color: #fff;
  background: var(--accent);
  border-color: #8b3025;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.text-button {
  white-space: nowrap;
}

.inline-actions {
  margin: 8px 0 12px;
}

.select-label {
  display: grid;
  gap: 4px;
  color: #5d5249;
  font-size: 12px;
  font-weight: 700;
}

.select-label select {
  min-width: 220px;
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(380px, 1fr) minmax(320px, 390px);
}

.workspace.details-collapsed {
  grid-template-columns: minmax(300px, 360px) minmax(380px, 1fr);
}

.workspace.details-collapsed .details-panel {
  display: none;
}

.workspace.details-collapsed .map-panel {
  grid-column: 2;
  grid-row: 1;
}

.controls,
.details-panel {
  min-height: 0;
  overflow: auto;
  background: rgba(255, 250, 241, 0.98);
}

.controls {
  border-right: 1px solid var(--line);
  box-shadow: 4px 0 18px rgba(31, 27, 13, 0.05);
}

.details-panel {
  border-left: 1px solid var(--line);
  box-shadow: -4px 0 18px rgba(31, 27, 13, 0.05);
}

.control-section {
  padding: 15px;
  border-bottom: 1px solid var(--line);
}

.control-section h2,
.details-panel h2 {
  margin: 0;
  color: var(--primary);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.25;
}

.control-section h3,
.details-panel h3 {
  margin: 18px 0 8px;
  font-size: 13px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

#date-range-label {
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
  text-align: right;
}

.search-label,
.range-grid label,
.select-grid label {
  display: grid;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

input[type="search"],
input[type="number"],
select {
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  background: #fffefb;
  box-shadow: inset 0 1px 3px rgba(31, 27, 13, 0.05);
}

.search-results {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  max-height: min(48vh, 520px);
  overflow: auto;
  padding-right: 4px;
}

.search-results-summary {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.search-results button,
.record-list button,
.related-list button {
  width: 100%;
  display: grid;
  gap: 2px;
  text-align: left;
  color: var(--ink);
  background: #fffefb;
  border-color: #ded3bd;
  padding: 9px 10px;
  border-radius: 4px;
  box-shadow: inset 2px 0 0 transparent;
}

.search-results button:hover,
.record-list button:hover,
.related-list button:hover {
  background: #f8f2e6;
  box-shadow: inset 2px 0 0 var(--gold);
}

.record-list button.is-current {
  background: #fff7e6;
  border-color: #c49a44;
  box-shadow: inset 2px 0 0 var(--gold);
}

.search-results button span,
.record-list span,
.related-list span {
  color: var(--muted);
  font-size: 12px;
}

.range-grid {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.range-grid label {
  color: var(--ink);
}

.range-grid input[type="range"] {
  width: 100%;
}

.range-grid input[type="number"] {
  max-width: 110px;
}

.check-row,
.layer-list label,
fieldset label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
}

.check-row {
  margin-top: 10px;
}

.check-row.is-disabled {
  color: rgba(63, 55, 43, 0.54);
  cursor: not-allowed;
}

.check-row.is-disabled input {
  cursor: not-allowed;
}

.unit-title-control {
  margin-top: 12px;
  padding: 8px 10px 10px;
  border: 1px solid rgba(132, 34, 52, 0.22);
  border-radius: 6px;
  background: rgba(255, 254, 251, 0.72);
}

.unit-title-control legend {
  color: var(--primary);
  font-family: var(--font-display);
  font-size: 13px;
}

.unit-title-control .check-row {
  margin-top: 2px;
}

.unit-title-control.is-auto-waiting {
  border-color: rgba(185, 130, 46, 0.5);
}

.marker-label-mode {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin-top: 2px;
}

.marker-label-mode label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 26px;
  padding: 0 5px;
  border: 1px solid #ded3bd;
  border-radius: 4px;
  background: #fffaf1;
  color: #3f372b;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.marker-label-mode label:has(input:checked) {
  border-color: rgba(132, 34, 52, 0.42);
  background: #fff2e4;
  color: var(--primary);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  background: #f8f2e6;
}

.stats div {
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 1px solid #ded3bd;
  border-radius: 6px;
  background: #fff;
  border-top: 2px solid var(--gold);
}

.stats strong {
  font-size: 18px;
  color: var(--primary);
}

.stats span {
  font-size: 11px;
  color: var(--muted);
}

.filter-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

fieldset {
  border: 1px solid #ded3bd;
  border-radius: 6px;
  padding: 8px 10px;
  margin: 0;
  background: rgba(255, 254, 251, 0.82);
}

legend {
  padding: 0 4px;
  color: var(--primary);
  font-family: var(--font-display);
  font-size: 13px;
}

.check-row,
.layer-list label,
fieldset label {
  color: #3f372b;
  font-size: 13px;
}

input[type="checkbox"] {
  accent-color: var(--accent);
}

input[type="range"] {
  accent-color: var(--accent);
}

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

.legend {
  display: grid;
  gap: 8px;
  font-size: 13px;
}

.legend-row {
  padding: 5px 0;
  color: #3f372b;
}

.legend-colors {
  padding-top: 4px;
}

.unit {
  border-radius: 4px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

#details {
  padding: 20px;
}

#details h2,
.unit-detail h2 {
  color: var(--primary);
  font-family: var(--font-display);
}

#details h3,
.unit-detail h3 {
  color: var(--primary);
  font-family: var(--font-display);
  font-size: 17px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 5px;
}

.details-empty {
  background: linear-gradient(180deg, #fffefb, #fff8ed);
}

.warning-note {
  border-left: 3px solid var(--gold);
}

.history-block {
  box-shadow: inset 0 2px 0 rgba(185, 130, 46, 0.22);
}

.history-section h4 {
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.timeline-item {
  box-shadow: inset 3px 0 0 rgba(185, 130, 46, 0.35);
}

.timeline-head strong {
  color: var(--primary);
  font-family: var(--font-display);
}

.unit-page {
  background: radial-gradient(circle at 70% 10%, rgba(185, 130, 46, 0.08), transparent 32%), var(--page);
}

.unit-index-panel {
  box-shadow: 4px 0 18px rgba(31, 27, 13, 0.05);
}

.unit-list {
  gap: 8px;
  padding: 14px;
}

.unit-list-item {
  border-radius: 4px;
  border-left: 3px solid transparent;
}

.unit-list-item:hover {
  background: #f8f2e6;
  border-left-color: var(--gold);
}

.unit-list-item.selected {
  border-left-color: var(--accent);
}

.unit-detail {
  background: linear-gradient(180deg, #fffefb, #fff9ef);
}

.unit-detail-header {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.unit-detail-header h2 {
  font-size: clamp(27px, 4vw, 38px);
  letter-spacing: 0.01em;
}

.detail-link {
  border-radius: 4px;
  background: var(--primary);
  border-color: var(--primary);
}

.detail-link:hover {
  background: var(--accent);
}

.page-hero {
  background: linear-gradient(135deg, rgba(255, 254, 251, 0.96), rgba(248, 242, 230, 0.96));
}

.archive-card {
  border-top: 2px solid rgba(185, 130, 46, 0.55);
}

/* Museum refinements override earlier utilitarian defaults. */
.control-section h2::before,
.archive-card h2::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 1px;
  margin-right: 7px;
  vertical-align: middle;
  background: var(--gold);
}

@media (min-width: 821px) {
  .unit-app .topbar,
  .page-app .topbar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .unit-app .site-nav,
  .page-app .site-nav {
    justify-content: flex-end;
  }
}

@media (max-width: 1180px) {
  .site-nav-link {
    letter-spacing: 0.04em;
    padding: 0 7px;
  }

  .topbar-actions .material-symbols-outlined {
    display: none;
  }
}

@media (max-width: 640px) {
  .brand-title {
    font-size: 18px;
  }

  .brand-title::after {
    font-size: 8.5px;
    letter-spacing: 0.07em;
  }

  .site-nav-link {
    font-size: 10px;
  }
}

/* Legacy rules below are intentionally narrowed by the museum overrides above. */
legend {
  padding: 0 4px;
  font-size: 12px;
  color: var(--muted);
}

.select-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.filter-helper {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.secondary-button {
  width: 100%;
  margin-top: 12px;
  color: var(--primary);
  background: #fff;
  border-color: #cfc3ad;
}

.secondary-button:hover {
  color: #fff;
  background: var(--primary);
}

.layer-list {
  display: grid;
  gap: 4px;
}

.legend {
  display: grid;
  gap: 8px;
  font-size: 13px;
}

.legend-block {
  display: grid;
  gap: 6px;
}

.legend-block + .legend-block {
  padding-top: 8px;
  border-top: 1px solid #d8cfbe;
}

.legend-block-title {
  color: #5f5039;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-symbol {
  width: 16px;
  height: 16px;
  display: inline-block;
  flex: 0 0 auto;
}

.legend-symbol.exact {
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #8b3025;
}

.legend-symbol.core-legion {
  border-radius: 50%;
  background: #a33a2b;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px #8b3025;
}

.legend-symbol.core-other {
  border-radius: 50%;
  background: #1d5d7e;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px #214e61;
}

.legend-symbol.province {
  background: rgba(47, 111, 115, 0.22);
  border: 2px dashed #24565a;
}

.legend-symbol.uncertain {
  border-radius: 50%;
  background: rgba(29, 93, 126, 0.55);
  border: 2px solid #14191d;
}

.legend-symbol.notitia,
.legend-symbol.notitia-other {
  border-radius: 50%;
  background: #f1d24d;
  border: 2px solid #735a0f;
}

.legend-symbol.notitia-legion {
  border-radius: 50%;
  background: #c7691f;
  border: 2px solid #6f3905;
}

.legend-symbol.notitia-province {
  background: rgba(217, 187, 63, 0.25);
  border: 2px dashed #7a610a;
}

.legend-symbol.selected {
  border-radius: 50%;
  background: rgba(124, 255, 102, 0.16);
  border: 2px solid #7cff66;
  box-shadow: inset 0 0 0 4px rgba(124, 255, 102, 0.12);
}

.legend-line {
  width: 28px;
  height: 0;
  border-top: 2px dashed #8d4f1f;
}

.legend-colors {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dare-legend {
  display: block;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid #d8cfbe;
}

.dare-legend summary {
  cursor: pointer;
  font-weight: 700;
}

.dare-legend-content {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.dare-legend p,
.dare-legend-note {
  margin: 0;
  line-height: 1.4;
}

.dare-legend-note {
  color: var(--muted);
  font-size: 12px;
}

.map-sidebar-credit {
  margin: 10px 0 0;
  padding-top: 8px;
  border-top: 1px solid #d8cfbe;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
}

.map-sidebar-credit a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.map-sidebar-credit a:hover {
  text-decoration: underline;
}

.dare-legend-group {
  padding: 8px;
  border: 1px solid #ded3bd;
  border-radius: 6px;
  background: #fffefb;
}

.dare-legend-group summary {
  color: var(--ink);
  font-size: 12px;
}

.dare-legend-table {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  font-size: 11.5px;
  line-height: 1.25;
}

.dare-legend-table th,
.dare-legend-table td {
  padding: 5px 6px;
  border-top: 1px solid #e2e8e4;
  text-align: left;
  vertical-align: middle;
}

.dare-legend-table th {
  color: var(--muted);
  background: #f2ead7;
  font-weight: 700;
}

.dare-zoom-table td:last-child,
.dare-zoom-table th:last-child,
.dare-symbol-table td:last-child,
.dare-symbol-table th:last-child,
.dare-line-table td:last-child,
.dare-line-table th:last-child,
.dare-elevation-table td:last-child,
.dare-elevation-table th:last-child,
.dare-landcover-table td:last-child,
.dare-landcover-table th:last-child {
  width: 44px;
  text-align: right;
  white-space: nowrap;
}

.dare-symbol-table td:first-child,
.dare-symbol-table th:first-child {
  width: 42px;
  text-align: center;
}

.dare-symbol-table td:nth-child(2),
.dare-symbol-table th:nth-child(2) {
  width: 38px;
  text-align: right;
}

.dare-line-table td:first-child,
.dare-line-table th:first-child,
.dare-elevation-table td:first-child,
.dare-elevation-table th:first-child,
.dare-landcover-table td:first-child,
.dare-landcover-table th:first-child {
  width: 42px;
}

.dare-icon {
  max-width: 18px;
  max-height: 18px;
  vertical-align: middle;
}

.dare-swatch {
  display: inline-block;
  width: 28px;
  height: 14px;
  border: var(--swatch-border, 1px solid rgba(29, 37, 41, 0.45));
  background: var(--swatch-bg, #fff);
  vertical-align: middle;
}

.dare-swatch.province {
  --swatch-border: 2px solid #8a328a;
}

.dare-swatch.road-britain-main,
.dare-swatch.road-aw-main,
.dare-swatch.road-britain-principal,
.dare-swatch.road-aw-minor,
.dare-swatch.road-britain-minor,
.dare-swatch.aqueduct,
.dare-swatch.limes,
.dare-swatch.coastline,
.dare-swatch.contour-100,
.dare-swatch.contour-50 {
  height: 0;
  border: 0;
  background: transparent;
}

.dare-swatch.road-britain-main,
.dare-swatch.road-aw-main {
  border-top: 3px solid #d4312a;
}

.dare-swatch.road-britain-principal,
.dare-swatch.road-aw-minor {
  border-top: 2px solid #d4312a;
}

.dare-swatch.road-britain-minor {
  border-top: 1px solid #d4312a;
}

.dare-swatch.aqueduct {
  border-top: 2px solid #e3b300;
}

.dare-swatch.limes {
  border-top: 2px solid #303030;
}

.dare-swatch.coastline {
  border-top: 2px solid #238b45;
}

.dare-swatch.water-perennial {
  --swatch-bg: rgb(165, 191, 221);
  --swatch-border: 1px solid #0b4f99;
}

.dare-swatch.water-intermittent {
  --swatch-bg: rgb(168, 202, 208);
  --swatch-border: 1px dashed #0b4f99;
}

.dare-swatch.contour-100 {
  border-top: 1px solid #8a6e4c;
}

.dare-swatch.contour-50 {
  border-top: 1px dashed #8a6e4c;
}

.dare-source-row td {
  color: var(--muted);
  background: #f8f2e6;
  font-size: 11px;
}

.dare-name-water {
  color: #0b4f99;
}

.dare-name-road {
  color: #a7261a;
}

.dare-name-natural {
  color: #765229;
}

.dare-province-name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1em;
}

.unit {
  padding: 3px 7px;
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
}

.unit.legion {
  background: var(--accent);
}

.unit.ala {
  background: var(--blue);
}

.unit.cohort {
  background: var(--green);
}

.map-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
}

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

.map-info-stack {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 16;
  max-width: min(520px, calc(100% - 24px));
  display: grid;
  gap: 8px;
  justify-items: start;
  pointer-events: none;
}

.map-overlay-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  pointer-events: auto;
}

.map-overlay-button {
  min-height: 26px;
  padding: 4px 7px;
  border-radius: 5px;
  border: 1px solid rgba(33, 45, 50, 0.22);
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(29, 37, 41, 0.14);
  font-size: 11px;
  pointer-events: auto;
}

.map-overlay-button:hover,
.map-overlay-button:focus {
  background: #f8f2e6;
}

#show-visible-citations .material-symbols-outlined {
  font-size: 14px;
}

.warnings {
  display: grid;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 0;
  pointer-events: none;
}

.map-info-collapsed .warnings {
  display: none;
}

.warnings li,
.app-error {
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #d7c49b;
  color: #5b4519;
  box-shadow: 0 8px 20px rgba(29, 37, 41, 0.14);
  font-size: 12px;
}

.unit-map-popup {
  display: grid;
  gap: 8px;
  min-width: 220px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 12px 36px 12px 13px;
  color: var(--ink);
  font-size: 12px;
}

.popup-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  gap: 6px;
  margin: -12px -36px 0 -13px;
  padding: 12px 44px 9px 13px;
  border-bottom: 1px solid rgba(214, 199, 173, 0.72);
  background: #fffefb;
  box-shadow: 0 6px 14px rgba(29, 37, 41, 0.06);
}

.unit-map-popup strong {
  min-width: 0;
  color: var(--primary);
  font-family: var(--font-display);
  font-size: 15.5px;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.popup-eyebrow {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding-right: 0;
}

.popup-chip {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border: 1px solid rgba(170, 147, 108, 0.42);
  border-radius: 999px;
  background: #f8f2e6;
  color: #665a48;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.055em;
  line-height: 1;
  text-transform: uppercase;
}

.popup-chip-primary {
  border-color: rgba(132, 34, 52, 0.34);
  background: #fff2e4;
  color: var(--primary);
}

.popup-facts {
  display: grid;
  gap: 6px;
  margin: 0;
}

.popup-fact {
  display: grid;
  grid-template-columns: minmax(74px, 0.42fr) minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
}

.popup-fact dt {
  color: #8a7658;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.popup-fact dd {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  line-height: 1.32;
  overflow-wrap: anywhere;
}

.popup-location {
  margin: 0;
  padding-top: 8px;
  border-top: 1px solid rgba(214, 199, 173, 0.78);
  color: var(--muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.popup-stack-tree,
.popup-record-list {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  padding: 8px 4px 2px 0;
  border-top: 1px solid rgba(214, 199, 173, 0.78);
}

.popup-tree-title {
  color: #8a7658;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.popup-tree-node {
  border: 1px solid rgba(170, 147, 108, 0.34);
  border-radius: 6px;
  background: #fffaf0;
}

.popup-tree-node summary {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 32px;
  padding: 0 28px 0 9px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.popup-tree-node summary::-webkit-details-marker {
  display: none;
}

.popup-tree-node summary::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 10px;
  width: 7px;
  height: 7px;
  border-right: 2px solid rgba(132, 34, 52, 0.64);
  border-bottom: 2px solid rgba(132, 34, 52, 0.64);
  transform: translateY(-62%) rotate(45deg);
  transform-origin: center;
  transition: transform 150ms ease, border-color 150ms ease;
}

.popup-tree-node[open] summary::after {
  transform: translateY(-32%) rotate(225deg);
  border-color: var(--primary);
}

.popup-tree-node summary span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.popup-tree-node summary small {
  color: #8a7658;
  font-size: 10px;
  font-weight: 800;
}

.popup-tree-children {
  display: grid;
  gap: 4px;
  padding: 0 7px 7px 20px;
  overflow: hidden;
}

.popup-tree-node[open] .popup-tree-children {
  animation: popup-tree-open 150ms ease-out both;
}

.popup-tree-action,
.popup-tree-record {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(170, 147, 108, 0.38);
  border-radius: 4px;
  background: #fffefb;
  color: var(--ink);
  font: inherit;
  line-height: 1.25;
  text-align: left;
  overflow-wrap: anywhere;
}

.popup-tree-action {
  min-height: 28px;
  padding: 0 8px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
}

.popup-tree-record {
  padding: 7px 8px;
  color: #665a48;
  font-size: 11px;
}

.popup-tree-action:hover,
.popup-tree-action:focus-visible,
.popup-tree-record:hover,
.popup-tree-record:focus-visible {
  border-color: var(--primary);
  background: #fff2e4;
  color: var(--primary);
}

.unit-map-popup b {
  color: var(--ink);
  font-weight: 700;
}

.popup-actions {
  display: flex;
  justify-content: flex-start;
}

.popup-details-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  margin-top: 5px;
  padding: 0 11px;
  border: 1px solid rgba(132, 34, 52, 0.28);
  border-radius: 4px;
  background: var(--primary);
  color: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.popup-details-button .material-symbols-outlined {
  font-size: 16px;
}

.popup-details-button:hover,
.popup-details-button:focus-visible {
  border-color: var(--primary);
  background: #4a1c40;
}

.marker-label-anchor {
  pointer-events: auto;
}

.marker-label {
  display: grid;
  gap: 4px;
  max-width: 210px;
  filter: drop-shadow(0 7px 12px rgba(29, 37, 41, 0.16));
}

.marker-label button {
  display: block;
  min-height: 24px;
  max-width: 210px;
  padding: 0 7px;
  overflow: hidden;
  border: 1px solid rgba(132, 34, 52, 0.2);
  border-radius: 4px;
  background: rgba(255, 254, 251, 0.94);
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.15;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.marker-label button:hover,
.marker-label button:focus-visible {
  border-color: var(--primary);
  background: #fff2e4;
}

.marker-label.is-inactive {
  opacity: 0.52;
}

.marker-label-stack {
  position: relative;
  padding-left: 10px;
}

.marker-label-stack::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 3px;
  width: 1px;
  background: rgba(132, 34, 52, 0.32);
}

.marker-label-row {
  position: relative;
}

.marker-label-row::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -7px;
  width: 7px;
  border-top: 1px solid rgba(132, 34, 52, 0.32);
}

.maplibregl-popup {
  --atlas-popup-width: 320px;
  --atlas-popup-safe-width: calc(100vw - 44px);
  --atlas-popup-safe-height: calc(100vh - 24px);
  z-index: 35;
  will-change: auto;
}

.maplibregl-popup.atlas-popup-closing {
  pointer-events: none;
}

.maplibregl-popup-content,
.maplibregl-popup-tip {
  animation: atlas-popup-in 120ms ease-out;
}

.maplibregl-popup.atlas-popup-closing .maplibregl-popup-content,
.maplibregl-popup.atlas-popup-closing .maplibregl-popup-tip {
  animation: atlas-popup-out 120ms ease-in forwards;
}

.maplibregl-popup-content {
  box-sizing: border-box;
  width: min(var(--atlas-popup-width), var(--atlas-popup-safe-width), calc(100vw - 44px));
  max-width: min(var(--atlas-popup-safe-width), calc(100vw - 44px));
  max-height: min(var(--atlas-popup-safe-height), calc(100vh - 24px));
  padding: 0;
  overflow: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fffefb;
  box-shadow: 0 16px 34px rgba(29, 37, 41, 0.2);
}

.atlas-popup-shell {
  display: grid;
  min-width: 0;
  pointer-events: auto;
}

.atlas-popup-close-button {
  position: sticky;
  top: 7px;
  z-index: 8;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  margin: 7px 7px -35px 0;
  padding: 0;
  border: 1px solid rgba(132, 34, 52, 0.24);
  border-radius: 999px;
  background: #fffefb;
  color: #1c2429;
  appearance: none;
  box-shadow: 0 5px 14px rgba(29, 37, 41, 0.14);
  font-size: 21px;
  line-height: 26px;
  outline: none;
  pointer-events: auto;
  touch-action: manipulation;
  cursor: pointer !important;
}

.atlas-popup-close-button span {
  display: block;
  line-height: 1;
}

.atlas-popup-close-button:hover,
.atlas-popup-close-button:focus {
  border-color: rgba(132, 34, 52, 0.42);
  background: #fff2e4;
  color: var(--primary);
  outline: none;
  box-shadow: 0 6px 16px rgba(29, 37, 41, 0.18);
}

.atlas-popup-close-button:focus-visible {
  outline: none;
  box-shadow: none;
}

@keyframes atlas-popup-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes atlas-popup-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes popup-tree-open {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 260px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .maplibregl-popup-content,
  .maplibregl-popup-tip,
  .maplibregl-popup.atlas-popup-closing .maplibregl-popup-content,
  .maplibregl-popup.atlas-popup-closing .maplibregl-popup-tip,
  .popup-tree-node[open] .popup-tree-children {
    animation: none;
  }

  .popup-tree-node summary::after {
    transition: none;
  }
}

.app-error {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  pointer-events: auto;
}

#details {
  padding: 18px;
}

.details-empty p,
#details p {
  line-height: 1.5;
}

.detail-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.exact-placement-label {
  color: #175c2f;
  font-weight: 800;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(96px, max-content) minmax(0, 1fr);
  gap: 8px 12px;
  box-sizing: border-box;
  max-width: 100%;
  padding: 12px;
  background: #fffefb;
  border: 1px solid #ded3bd;
  border-radius: 6px;
  border-top: 2px solid var(--gold);
}

.detail-grid dt {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.detail-grid dd {
  min-width: 0;
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
}

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

.warning-note {
  padding: 8px 10px;
  background: #fff7e6;
  border: 1px solid #e1c27c;
  border-radius: 6px;
  color: #5b4519;
}

.record-list,
.related-list,
.citation-list {
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.citation-list {
  padding-left: 20px;
  list-style: decimal;
}

.citation-list li {
  margin-bottom: 8px;
  line-height: 1.45;
}

.history-block {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid #ded3bd;
  border-radius: 6px;
  background: #fffefb;
}

.history-block h3 {
  margin-top: 0;
}

.history-section {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.history-section h4 {
  margin: 0;
  font-size: 12px;
  color: var(--accent);
}

.history-section p {
  margin: 0;
}

.history-caveats,
.history-links,
.event-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
}

.history-links li,
.event-list li {
  line-height: 1.35;
}

.history-links span,
.event-list span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.event-list p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.unit-app {
  min-height: 100vh;
}

.unit-page {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
}

.unit-index-panel {
  min-height: 0;
  overflow: auto;
  background: rgba(255, 249, 239, 0.98);
  border-right: 1px solid var(--line);
}

.unit-list {
  display: grid;
  gap: 6px;
  padding: 12px;
}

.unit-list-item {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 54px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fffefb;
  border: 1px solid #ded3bd;
  border-color: #ded3bd;
  text-decoration: none;
  text-align: left;
}

.unit-list-item.selected {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
  background: #fff6ef;
}

.unit-list-item span,
.source-line {
  color: var(--muted);
  font-size: 12px;
}

.unit-list-empty {
  padding: 0 4px;
}

.unit-detail {
  min-width: 0;
  overflow: auto;
  padding: 22px;
  background: #fffefb;
}

.unit-detail-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.unit-detail-header h2 {
  margin: 0 0 4px;
  color: var(--primary);
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.15;
}

.timeline-list {
  display: grid;
  gap: 12px;
  list-style: none;
  padding: 0;
}

.timeline-item {
  padding: 13px;
  border: 1px solid #ded3bd;
  border-radius: 6px;
  background: #fffefb;
}

.timeline-item p {
  margin: 8px 0 0;
  line-height: 1.45;
}

.timeline-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.timeline-head span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.timeline-head .exact-placement-label,
.placement-status.exact-placement-label {
  color: #175c2f;
}

.page-app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.content-page {
  max-width: 1120px;
  width: min(100% - 32px, 1120px);
  margin: 0 auto;
  padding: 28px 0 48px;
}

.breadcrumbs {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.breadcrumbs a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

.page-hero {
  display: grid;
  gap: 8px;
  margin-bottom: 22px;
  padding: 22px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: 8px;
  background: rgba(255, 254, 251, 0.92);
  box-shadow: var(--shadow);
}

.page-hero h1 {
  margin: 0;
  color: var(--primary);
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.1;
}

.page-hero p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.page-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

.archive-card {
  grid-column: span 6;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 254, 251, 0.96);
  box-shadow: 0 2px 10px rgba(31, 27, 13, 0.04);
}

.archive-card.wide {
  grid-column: span 12;
}

.archive-card h2,
.archive-card h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--primary);
  font-family: var(--font-display);
  line-height: 1.2;
}

.archive-card h2 {
  font-size: 22px;
}

.archive-card h3 {
  font-size: 18px;
}

.archive-card p,
.archive-card li {
  line-height: 1.55;
}

.archive-card ul,
.archive-card ol {
  margin: 8px 0 0;
  padding-left: 22px;
}

.archive-card li + li {
  margin-top: 6px;
}

.about-credits-card {
  background: linear-gradient(135deg, rgba(255, 254, 251, 0.98), rgba(248, 242, 230, 0.96));
}

.disclaimer-card,
.attribution-warning-card {
  border-top-color: rgba(132, 34, 52, 0.72);
  background: linear-gradient(135deg, rgba(255, 254, 251, 0.98), rgba(255, 246, 235, 0.96));
}

.disclaimer-card h2,
.attribution-warning-card h2 {
  color: #842234;
}

.contact-coming-soon {
  min-height: 180px;
  display: grid;
  align-content: center;
}

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

.source-list li {
  padding: 12px;
  border: 1px solid #ded3bd;
  border-radius: 6px;
  background: #fff9ef;
}

.source-list strong {
  display: block;
  color: var(--primary);
  margin-bottom: 4px;
}

.policy-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 4px 8px;
  color: #5b4519;
  background: #fff7e6;
  border: 1px solid #e1c27c;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 1280px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .topbar-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 320px 1fr;
    grid-template-rows: minmax(420px, 1fr) minmax(300px, 40vh);
  }

  .map-panel {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .details-panel {
    grid-column: 1;
    border-left: 0;
    border-right: 1px solid var(--line);
  }

  .workspace.details-collapsed {
    grid-template-columns: 320px 1fr;
    grid-template-rows: minmax(420px, 1fr);
  }

  .workspace.details-collapsed .map-panel {
    grid-column: 2;
    grid-row: 1;
  }
}

@media (max-width: 820px) {
  .app {
    height: auto;
    min-height: 100vh;
  }

  .topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 10px;
  }

  .brand {
    min-width: 0;
  }

  .site-nav {
    justify-content: flex-start;
  }

  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto 70vh auto;
  }

  .controls,
  .details-panel {
    max-height: none;
    border: 0;
  }

  .workspace.details-collapsed {
    grid-template-columns: 1fr;
    grid-template-rows: auto 70vh;
  }

  .workspace.details-collapsed .map-panel {
    grid-column: 1;
    grid-row: 2;
  }

  .map-panel {
    grid-column: 1;
    grid-row: 2;
  }

  .unit-page {
    grid-template-columns: 1fr;
  }

  .unit-index-panel {
    max-height: 45vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .unit-detail-header {
    display: grid;
  }

  .content-page {
    width: min(100% - 24px, 1120px);
    padding-top: 18px;
  }

  .archive-card,
  .archive-card.wide {
    grid-column: span 12;
  }
}

/* Final museum skin: this deliberately sits last so it overrides the early utilitarian rules. */
.topbar {
  grid-template-columns: minmax(190px, auto) minmax(0, 1fr) auto;
  min-height: 56px;
  padding: 8px 20px;
  background: rgba(253, 250, 244, 0.99);
  border-bottom: 1px solid #aa936c;
  box-shadow: 0 2px 16px rgba(47, 23, 41, 0.08);
}

.topbar::after {
  height: 2px;
  background: linear-gradient(90deg, #842234 0 180px, #b9822e 180px 300px, transparent 300px);
}

.brand {
  min-width: 0;
  gap: 8px;
}

.brand-aquila {
  width: 58px;
  height: 39px;
  flex: 0 0 auto;
  object-fit: contain;
  border-radius: 3px;
  box-shadow: 0 2px 5px rgba(47, 23, 41, 0.22);
}

.brand-title {
  color: #2f1729;
  font-family: var(--font-display);
  font-size: clamp(18px, 1.8vw, 22px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.brand-title::after {
  content: "Roman Military Dispositions Atlas";
  display: block;
  margin-top: 4px;
  color: #736044;
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.site-nav {
  gap: 2px;
}

.site-nav-link {
  min-height: 31px;
  padding: 0 9px;
  border-radius: 4px;
  color: #665a48;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.site-nav-link .material-symbols-outlined {
  color: #8a7658;
  font-size: 16px;
}

.site-nav-link:hover,
.site-nav-link.active {
  background: #f2e8d3;
  color: #2f1729;
  box-shadow: inset 0 -2px 0 #842234;
}

.site-nav-link.active .material-symbols-outlined {
  color: #842234;
}

.menu-toggle {
  display: none !important;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 38px;
  border: 1px solid #cdbb9c;
  background: #fffefb;
  color: #2f1729;
  box-shadow: 0 1px 0 rgba(185, 130, 46, 0.18);
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.menu-toggle:hover,
.menu-toggle:focus-visible {
  border-color: #842234;
  background: #f2e8d3;
}

.menu-toggle[aria-expanded="true"] {
  border-color: rgba(132, 34, 52, 0.62);
  background: #f2e8d3;
  box-shadow: 0 5px 16px rgba(47, 23, 41, 0.13);
}

.menu-toggle .material-symbols-outlined {
  font-size: 22px;
}

.menu-toggle-lines {
  position: relative;
  display: block;
  width: 21px;
  height: 16px;
}

.menu-toggle-lines span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
  transition: top 210ms cubic-bezier(0.2, 0.8, 0.2, 1), transform 210ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 140ms ease;
}

.menu-toggle-lines span:nth-child(1) {
  top: 1px;
}

.menu-toggle-lines span:nth-child(2) {
  top: 7px;
}

.menu-toggle-lines span:nth-child(3) {
  top: 13px;
}

.menu-toggle[aria-expanded="true"] .menu-toggle-lines span:nth-child(1) {
  top: 7px;
  transform: rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-toggle-lines span:nth-child(2) {
  opacity: 0;
  transform: translateX(7px) scaleX(0.18);
}

.menu-toggle[aria-expanded="true"] .menu-toggle-lines span:nth-child(3) {
  top: 7px;
  transform: rotate(-45deg);
}

.topbar-actions {
  gap: 7px;
}

.text-button,
.nav-link,
.detail-link,
button {
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}

.select-label {
  color: #665a48;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.select-label select {
  min-width: 210px;
}

.controls,
.details-panel,
.unit-index-panel {
  background: rgba(255, 250, 241, 0.98);
}

.control-section {
  background: linear-gradient(180deg, rgba(255, 254, 251, 0.72), rgba(248, 242, 230, 0.42));
}

.control-section h2,
.details-panel h2,
.unit-detail h2 {
  color: #2f1729;
  font-family: var(--font-display);
}

.control-section h2 {
  font-size: 16px;
}

.control-section h2::before,
.archive-card h2::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 1px;
  margin-right: 7px;
  vertical-align: middle;
  background: #b9822e;
}

legend {
  color: #2f1729;
  font-family: var(--font-display);
  font-size: 13px;
}

.search-label,
.range-grid label,
.select-grid label {
  color: #76664e;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

fieldset,
.detail-grid,
.history-block,
.timeline-item,
.dare-legend-group {
  border-color: #ded0b8;
  background: #fffefb;
  border-radius: 6px;
}

.stats div,
.detail-grid,
.archive-card {
  border-top: 2px solid rgba(185, 130, 46, 0.72);
}

.legend-row,
.check-row,
.layer-list label,
fieldset label {
  color: #3f372b;
  font-size: 13px;
}

.unit {
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.details-empty {
  background: linear-gradient(180deg, #fffefb, #fff8ed);
}

#details {
  padding: 20px;
}

#details h3,
.unit-detail h3 {
  color: #2f1729;
  font-family: var(--font-display);
  font-size: 17px;
  padding-bottom: 5px;
  border-bottom: 1px solid #d6c7ad;
}

.unit-page {
  background: radial-gradient(circle at 76% 8%, rgba(185, 130, 46, 0.12), transparent 31%), linear-gradient(180deg, #f3efe5, #ebe2ca);
}

.unit-list {
  gap: 8px;
  padding: 14px;
}

.unit-sort-row {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  color: #5f5345;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.unit-sort-row select {
  width: 100%;
  min-height: 38px;
  border: 1px solid #d6c7ad;
  border-radius: 4px;
  background: #fffefb;
  color: #2f1729;
  font: 600 13px var(--font-ui);
}

.unit-list-item {
  border-color: #ded0b8;
  border-left: 4px solid #b9822e;
  border-radius: 4px;
  background: #fffefb;
  min-height: 60px;
  padding: 11px 12px;
  font-size: 14px;
  line-height: 1.3;
}

.unit-list-item:hover {
  border-left-color: #842234;
  background: #f8f2e6;
}

.unit-list-item.selected {
  border-left-color: #842234;
  background: #fff7ee;
  box-shadow: none;
}

.unit-list-item.familiar-unit {
  border-left-color: #842234;
}

.unit-list-item strong {
  color: #2f1729;
  font-family: var(--font-display);
  font-size: 15.5px;
  line-height: 1.25;
}

.unit-list-item span {
  color: #665a48;
  font-size: 12.5px;
  line-height: 1.35;
}

.unit-detail {
  padding: 26px;
  background: linear-gradient(180deg, #fffefb, #fff8ed);
}

.unit-detail-header {
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid #d6c7ad;
}

.unit-detail-header h2 {
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: 0.01em;
}

.unit-panel-header,
.unit-detail-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
}

.unit-panel-header {
  margin-bottom: 14px;
}

.unit-heading,
.unit-detail-heading,
.unit-list-copy {
  min-width: 0;
}

.unit-heading {
  flex: 1 1 auto;
}

.unit-heading h2 {
  margin: 3px 0 8px;
  overflow-wrap: anywhere;
}

.unit-detail-heading {
  flex: 1 1 auto;
}

.unit-detail-header .detail-link {
  flex: 0 0 auto;
  margin-left: auto;
}

.unit-insignia {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  gap: 5px;
  width: 86px;
  margin: 0;
  color: #665a48;
  text-align: center;
}

.unit-insignia img {
  display: block;
  width: 74px;
  height: 74px;
  object-fit: contain;
}

.unit-insignia figcaption {
  display: grid;
  gap: 1px;
  max-width: 100%;
  font-size: 10.5px;
  line-height: 1.15;
}

.unit-insignia figcaption span,
.unit-insignia figcaption small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unit-insignia figcaption small {
  color: #887968;
  font-size: 9.5px;
}

.unit-insignia--fallback img {
  opacity: 0.72;
  filter: saturate(0.76);
}

.unit-insignia--panel {
  width: 82px;
}

.unit-insignia--page {
  width: 122px;
}

.unit-insignia--page img {
  width: 112px;
  height: 112px;
}

.unit-insignia--list {
  width: 34px;
}

.unit-insignia--list img {
  width: 34px;
  height: 34px;
}

.unit-list-item.has-unit-icon {
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
}

.unit-list-copy {
  display: grid;
  gap: 3px;
}

.unit-detail > section {
  margin-top: 18px;
  padding: 15px;
  border: 1px solid #ded0b8;
  border-radius: 8px;
  background: rgba(255, 254, 251, 0.9);
}

.unit-detail > section h3 {
  margin-top: 0;
}

.history-section h4 {
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.timeline-item {
  box-shadow: inset 3px 0 0 rgba(185, 130, 46, 0.4);
}

.timeline-head strong {
  color: #2f1729;
  font-family: var(--font-display);
}

.page-hero {
  background: linear-gradient(135deg, rgba(255, 254, 251, 0.97), rgba(248, 242, 230, 0.97));
}

@media (min-width: 821px) {
  .unit-app .topbar,
  .page-app .topbar {
    grid-template-columns: minmax(190px, auto) minmax(0, 1fr);
  }

  .unit-app .site-nav,
  .page-app .site-nav {
    justify-content: flex-end;
  }
}

@media (max-width: 1280px) {
  .topbar {
    grid-template-columns: minmax(190px, auto) minmax(0, 1fr);
  }

  .topbar-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 820px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    overflow: visible;
    z-index: 70;
  }

  .brand {
    grid-column: 1;
    min-width: 0;
  }

  .menu-toggle {
    display: inline-flex !important;
    grid-column: 2;
    grid-row: 1;
  }

  .brand-title {
    font-size: 18px;
  }

  .brand-aquila {
    width: 44px;
    height: 29px;
  }

  .brand-title::after {
    font-size: 8.5px;
    letter-spacing: 0.08em;
  }

  .site-nav {
    position: absolute;
    top: calc(100% + 6px);
    left: 10px;
    right: 10px;
    z-index: 75;
    grid-column: auto;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 6px;
    box-sizing: border-box;
    max-height: 360px;
    padding: 8px;
    border: 1px solid #ded0b8;
    border-radius: 6px;
    background: #fffefb;
    box-shadow: 0 8px 24px rgba(47, 23, 41, 0.1);
    overflow: hidden;
    transform-origin: top center;
    will-change: max-height, opacity, transform;
    transition:
      max-height 260ms cubic-bezier(0.2, 0.8, 0.2, 1),
      opacity 180ms ease,
      transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
      padding 220ms ease,
      border-width 220ms ease,
      box-shadow 220ms ease,
      visibility 0s linear 0s;
  }

  .mobile-nav-ready .site-nav:not(.nav-open) {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-top-width: 0;
    border-bottom-width: 0;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transform: translateY(-8px) scaleY(0.96);
    box-shadow: 0 0 0 rgba(47, 23, 41, 0);
    transition:
      max-height 260ms cubic-bezier(0.36, 0, 0.66, -0.56),
      opacity 160ms ease,
      transform 200ms ease,
      padding 220ms ease,
      border-width 220ms ease,
      box-shadow 180ms ease,
      visibility 0s linear 260ms;
  }

  .mobile-nav-ready .site-nav .site-nav-link {
    opacity: 0;
    transform: translateY(-7px);
    transition: opacity 150ms ease, transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .mobile-nav-ready .site-nav.nav-open .site-nav-link {
    opacity: 1;
    transform: translateY(0);
  }

  .mobile-nav-ready .site-nav.nav-open .site-nav-link:nth-child(1) {
    transition-delay: 45ms;
  }

  .mobile-nav-ready .site-nav.nav-open .site-nav-link:nth-child(2) {
    transition-delay: 65ms;
  }

  .mobile-nav-ready .site-nav.nav-open .site-nav-link:nth-child(3) {
    transition-delay: 85ms;
  }

  .mobile-nav-ready .site-nav.nav-open .site-nav-link:nth-child(4) {
    transition-delay: 105ms;
  }

  .mobile-nav-ready .site-nav.nav-open .site-nav-link:nth-child(5) {
    transition-delay: 125ms;
  }

  .mobile-nav-ready .site-nav.nav-open .site-nav-link:nth-child(6) {
    transition-delay: 145ms;
  }

  .mobile-nav-ready .site-nav.nav-open .site-nav-link:nth-child(7) {
    transition-delay: 165ms;
  }

  .mobile-nav-ready .site-nav:not(.nav-open) .site-nav-link:nth-child(1) {
    transition-delay: 120ms;
  }

  .mobile-nav-ready .site-nav:not(.nav-open) .site-nav-link:nth-child(2) {
    transition-delay: 100ms;
  }

  .mobile-nav-ready .site-nav:not(.nav-open) .site-nav-link:nth-child(3) {
    transition-delay: 80ms;
  }

  .mobile-nav-ready .site-nav:not(.nav-open) .site-nav-link:nth-child(4) {
    transition-delay: 60ms;
  }

  .mobile-nav-ready .site-nav:not(.nav-open) .site-nav-link:nth-child(5) {
    transition-delay: 40ms;
  }

  .mobile-nav-ready .site-nav:not(.nav-open) .site-nav-link:nth-child(6) {
    transition-delay: 20ms;
  }

  .mobile-nav-ready .site-nav:not(.nav-open) .site-nav-link:nth-child(7) {
    transition-delay: 0ms;
  }

  .site-nav-link {
    justify-content: flex-start;
    font-size: 10px;
    letter-spacing: 0.04em;
  }

  .topbar-actions {
    grid-column: 1 / -1;
  }

  .unit-detail {
    padding: 18px;
  }

  .unit-panel-header,
  .unit-detail-header {
    align-items: flex-start;
  }

  .unit-detail-header {
    flex-wrap: wrap;
  }

  .unit-detail-header .detail-link {
    margin-left: 0;
  }

  .unit-insignia--page {
    width: 88px;
  }

  .unit-insignia--page img {
    width: 78px;
    height: 78px;
  }
}

/* Stable shared navigation: keep every public menu item visible on all pages. */
.topbar {
  --topbar-actions-space: clamp(360px, 34vw, 590px);
  align-items: center;
  column-gap: 14px;
  row-gap: 8px;
}

.site-nav {
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  row-gap: 4px;
  overflow: visible;
  scrollbar-width: auto;
}

.unit-app .site-nav,
.page-app .site-nav {
  justify-content: flex-end;
}

.site-nav-link {
  flex: 0 0 auto;
  min-height: 29px;
  padding: 0 7px;
  font-size: 10px;
  letter-spacing: 0.055em;
}

.site-nav-link .material-symbols-outlined {
  font-size: 15px;
}

@media (min-width: 1281px) {
  .topbar,
  .unit-app .topbar,
  .page-app .topbar {
    grid-template-columns: minmax(190px, auto) minmax(0, 1fr) minmax(var(--topbar-actions-space), var(--topbar-actions-space));
  }

  .site-nav,
  .unit-app .site-nav,
  .page-app .site-nav {
    justify-content: center;
  }

  .topbar-actions {
    grid-column: 3;
    width: 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 1360px) and (min-width: 821px) {
  .topbar,
  .unit-app .topbar,
  .page-app .topbar {
    grid-template-columns: minmax(190px, auto) minmax(0, 1fr);
  }

  .site-nav,
  .unit-app .site-nav,
  .page-app .site-nav {
    justify-content: flex-end;
  }

  .topbar-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 1040px) and (min-width: 821px) {
  .topbar,
  .unit-app .topbar,
  .page-app .topbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .brand,
  .site-nav,
  .topbar-actions {
    grid-column: 1 / -1;
  }

  .site-nav,
  .unit-app .site-nav,
  .page-app .site-nav {
    justify-content: flex-start;
  }

  .site-nav-link {
    min-height: 28px;
    padding: 0 6px;
    font-size: 9.5px;
    letter-spacing: 0.035em;
  }

  .site-nav-link .material-symbols-outlined {
    font-size: 14px;
  }
}

@media (max-width: 820px) {
  .site-nav {
    flex-wrap: nowrap;
    overflow: hidden;
  }
}

.mobile-map-search,
.mobile-map-actions,
.mobile-sheet-grip,
.mobile-sheet-close,
.mobile-sheet-actions,
.control-section-map-options {
  display: none;
}

@media (max-width: 820px) {
  body.atlas-map-page {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }

  .map-app {
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
  }

  .map-app .topbar {
    min-height: 52px;
    padding: 7px 10px;
    position: relative;
    z-index: 50;
  }

  .map-app .topbar-actions {
    display: none;
  }

  .map-app .workspace,
  .map-app .workspace.details-collapsed {
    position: relative;
    display: block;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .map-app .map-panel,
  .map-app .workspace.details-collapsed .map-panel {
    position: absolute;
    inset: 0;
    grid-column: auto;
    grid-row: auto;
    min-height: 0;
  }

  .map-app #map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }

  .map-app .controls,
  .map-app .details-panel,
  .map-app .workspace.details-collapsed .details-panel {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 76px;
    display: block;
    min-height: 0;
    max-height: min(58dvh, 520px);
    overflow: auto;
    border: 1px solid rgba(132, 34, 52, 0.18);
    border-radius: 12px;
    background: rgba(255, 250, 241, 0.98);
    box-shadow: 0 18px 42px rgba(31, 27, 13, 0.22);
    opacity: 0;
    pointer-events: none;
    --mobile-sheet-drag-y: 0px;
    transform: translateY(calc(100% + 92px));
    transition: transform 180ms ease, opacity 160ms ease;
    -webkit-overflow-scrolling: touch;
  }

  .map-app .controls {
    z-index: 82;
  }

  .map-app .details-panel,
  .map-app .workspace.details-collapsed .details-panel {
    z-index: 84;
    max-height: min(62dvh, 540px);
  }

  .map-app .workspace.mobile-controls-open .controls {
    z-index: 86;
  }

  .map-app .workspace.mobile-details-open:not(.details-collapsed) .details-panel {
    z-index: 88;
  }

  .map-app .workspace.mobile-controls-open .controls,
  .map-app .workspace.mobile-details-open:not(.details-collapsed) .details-panel {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(var(--mobile-sheet-drag-y, 0px));
  }

  .map-app .controls.mobile-sheet-dragging,
  .map-app .details-panel.mobile-sheet-dragging {
    transition: none;
  }

  .map-app .workspace.mobile-controls-open .map-info-stack,
  .map-app .workspace.mobile-details-open .map-info-stack {
    display: none;
  }

  .map-app .mobile-sheet-grip {
    display: block;
    position: sticky;
    top: 0;
    height: 42px;
    z-index: 2;
    border-bottom: 1px solid rgba(132, 34, 52, 0.12);
    background: linear-gradient(180deg, rgba(255, 250, 241, 0.99), rgba(255, 250, 241, 0.92));
    box-shadow: 0 4px 10px rgba(31, 27, 13, 0.04);
    cursor: grab;
    touch-action: none;
    user-select: none;
  }

  .map-app .mobile-sheet-grip:active {
    cursor: grabbing;
  }

  .map-app .mobile-sheet-grip::before {
    content: "";
    position: absolute;
    z-index: 1;
    left: 50%;
    top: 11px;
    width: 34px;
    height: 3px;
    border-radius: 999px;
    background: rgba(47, 23, 41, 0.24);
    box-shadow:
      0 7px 0 rgba(47, 23, 41, 0.2),
      0 14px 0 rgba(47, 23, 41, 0.16);
    transform: translateX(-50%);
  }

  .map-app .mobile-sheet-grip::after {
    content: "";
    position: absolute;
    z-index: 0;
    left: 50%;
    top: 6px;
    width: 60px;
    height: 27px;
    border: 1px solid rgba(132, 34, 52, 0.14);
    border-radius: 999px;
    background: rgba(255, 254, 251, 0.76);
    transform: translateX(-50%);
  }

  .map-app .mobile-sheet-close {
    position: sticky;
    top: 8px;
    float: right;
    z-index: 3;
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    min-width: 0;
    min-height: 0;
    margin: -38px 10px 0 auto;
    padding: 0;
    border: 1px solid rgba(132, 34, 52, 0.22);
    border-radius: 50%;
    background: rgba(255, 254, 251, 0.96);
    color: #5d5249;
    box-shadow: 0 4px 12px rgba(31, 27, 13, 0.12);
  }

  .map-app .mobile-sheet-close .material-symbols-outlined {
    font-size: 21px;
  }

  .map-app .mobile-sheet-close:hover,
  .map-app .mobile-sheet-close:focus-visible {
    border-color: var(--primary);
    background: #f3ead8;
    color: var(--primary);
  }

  .map-app .control-section {
    padding: 13px 14px;
  }

  .map-app .control-section-map-options {
    display: block;
  }

  .map-app .mobile-sheet-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    margin-top: 10px;
  }

  .map-app .mobile-sheet-actions button {
    min-width: 0;
    min-height: 38px;
    padding: 0 9px;
  }

  .mobile-map-search {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    z-index: 20;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) 34px;
    align-items: center;
    gap: 5px;
    min-height: 44px;
    padding: 0 5px 0 12px;
    border: 1px solid rgba(47, 23, 41, 0.16);
    border-radius: 8px;
    background: rgba(255, 254, 251, 0.97);
    box-shadow: 0 10px 26px rgba(31, 27, 13, 0.18);
  }

  .mobile-map-search .material-symbols-outlined {
    color: #665a48;
    font-size: 21px;
  }

  .mobile-map-search input {
    min-height: 40px;
    padding: 0 4px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    font-size: 15px;
  }

  .mobile-map-search input:focus {
    outline: none;
  }

  .mobile-icon-button {
    min-width: 0;
    min-height: 34px;
    width: 34px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #5d5249;
  }

  .mobile-icon-button:hover,
  .mobile-icon-button:focus {
    background: #f3ead8;
    color: var(--primary);
  }

  .mobile-map-actions {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
    padding: 6px;
    border: 1px solid rgba(47, 23, 41, 0.16);
    border-radius: 10px;
    background: rgba(255, 254, 251, 0.98);
    box-shadow: 0 14px 34px rgba(31, 27, 13, 0.22);
  }

  .mobile-map-actions button {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 3px;
    min-width: 0;
    min-height: 50px;
    padding: 4px 2px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #5d5249;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.1;
  }

  .mobile-map-actions button:hover,
  .mobile-map-actions button:focus,
  .mobile-map-actions button[aria-pressed="true"] {
    background: #f3ead8;
    color: var(--primary);
  }

  .mobile-map-actions button[aria-pressed="true"] {
    box-shadow: inset 0 -2px 0 var(--accent);
  }

  .mobile-map-actions .material-symbols-outlined {
    font-size: 20px;
  }

  .map-app .maplibregl-ctrl-top-right {
    top: 62px;
    right: 10px;
    transition: opacity 160ms ease, transform 160ms ease;
  }

  .map-app #map.map-popup-open .maplibregl-ctrl-top-right {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
  }

  .map-app .atlas-popup-mobile {
    max-width: calc(100vw - 44px) !important;
  }

  .map-app .atlas-popup-mobile .maplibregl-popup-content {
    width: min(var(--atlas-popup-width), calc(100vw - 72px));
    max-width: calc(100vw - 72px);
    max-height: min(52dvh, 340px, var(--atlas-popup-safe-height));
    overflow: auto;
    border-radius: 10px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .map-app .atlas-popup-mobile.atlas-popup-has-tree .maplibregl-popup-content {
    height: min(52dvh, 340px, var(--atlas-popup-safe-height));
  }

  .map-app .unit-map-popup {
    min-width: 0;
    padding: 9px 44px 10px 11px;
    font-size: 11.5px;
  }

  .map-app .popup-header {
    gap: 4px;
    margin: -9px -44px 0 -11px;
    padding: 9px 52px 7px 11px;
  }

  .map-app .unit-map-popup strong {
    font-size: 14px;
    line-height: 1.16;
  }

  .map-app .popup-chip {
    min-height: 18px;
    padding: 0 6px;
    font-size: 8.6px;
  }

  .map-app .popup-stack-tree,
  .map-app .popup-record-list {
    max-height: min(32dvh, 190px);
  }

  .map-app .popup-fact {
    grid-template-columns: minmax(62px, 0.35fr) minmax(0, 1fr);
    gap: 6px;
  }

  .map-app .popup-fact dt {
    font-size: 9px;
  }

  .map-app .popup-fact dd,
  .map-app .popup-location,
  .map-app .popup-tree-record {
    line-height: 1.28;
  }

  .map-app .atlas-popup-close-button {
    top: 7px;
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    margin: 7px 7px -45px 0;
    font-size: 28px;
    line-height: 36px;
  }

  .map-app .popup-details-button {
    min-height: 34px;
    padding: 0 12px;
    font-size: 11.5px;
  }

  .map-app .map-info-stack {
    left: 10px;
    bottom: 76px;
    max-width: min(360px, calc(100% - 20px));
    z-index: 16;
  }

  .map-app .marker-label-anchor {
    z-index: 18 !important;
  }

  .map-app .workspace.mobile-controls-open .marker-label-anchor,
  .map-app .workspace.mobile-details-open .marker-label-anchor {
    opacity: 0;
    pointer-events: none;
  }

  .map-app .map-overlay-button {
    min-height: 25px;
    padding: 3px 6px;
    font-size: 10px;
  }

  .map-app .search-results {
    max-height: 42dvh;
  }

  .map-app .filter-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {
  .mobile-map-actions {
    gap: 3px;
    padding: 5px;
  }

  .mobile-map-actions button {
    min-height: 48px;
    font-size: 9px;
  }

  .mobile-map-actions .material-symbols-outlined {
    font-size: 19px;
  }
}
