#map-page {
  --site-header-height: 66px;
}

#map-page #atlas-shell {
  height: calc(100vh - var(--site-header-height));
  height: calc(100dvh - var(--site-header-height));
  overflow: clip;
}

#map-page .wuxia-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#map-page #wuxia-book-filter {
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: #fbf8f1;
  color: var(--text-main);
  font: inherit;
  font-size: 12px;
}

#map-page .wuxia-event-count,
#map-page .wuxia-coverage-notice {
  margin: 5px 0;
  font-size: 12px;
  color: var(--text-secondary);
}

#map-page .wuxia-event-detail {
  margin: 9px 0 12px;
  padding: 10px 11px;
  border: 1px solid var(--hairline);
  border-inline-start: 2px solid var(--vermilion);
  background: #fbf8f1;
  border-radius: 6px;
}

#map-page .wuxia-event-detail h4 {
  margin: 2px 0;
  font: 700 17px/1.4 var(--serif-stack);
}

#map-page .wuxia-event-detail p {
  margin: 5px 0;
  line-height: 1.58;
  font-size: 13px;
}

#map-page .wuxia-event-detail .wuxia-event-meta,
#map-page .wuxia-event-detail .wuxia-event-source {
  color: var(--text-secondary);
  font-size: 12px;
}

#map-page .wuxia-event-detail a,
#map-page .disclaimer-box a {
  color: var(--vermilion);
}

#map-page #milestone-list li[role="button"]:focus-visible {
  outline: 2px solid var(--vermilion);
  outline-offset: -2px;
}

@media (min-width: 901px) {
  #map-page #milestone-list {
    max-height: min(30vh, 320px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }
}

@media (max-width: 900px) {
  #map-page #dynasty-summary:not(.polity-focus-summary) { display: none; }
}

#map-page .milestone-pin[data-precision="approx"] .ev-core {
  fill: #a17533;
}

#map-page .milestone-pin[data-precision="fictional"] .ev-core {
  fill: #745577;
}

@media (max-width: 735px) {
  #map-page { --site-header-height: 58px; }
  #map-page .brand-group .subtitle-mark { display: none; }
}

#map-page #wuxia-sect-status {
  margin: 7px 0 0;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.5;
}

#map-page .layer-chip:has(#chk-wuxia-sects:focus-visible) {
  outline: 2px solid #285a4e;
  outline-offset: 1px;
}

#map-page #wuxia-sect-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

#map-page .wuxia-sect-pin {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  transform: translate(-50%, calc(-50% - 18px));
  border: 0;
  border-radius: 50%;
  background: none;
  color: #244f43;
  pointer-events: auto;
}

#map-page .wuxia-sect-pin::after {
  position: absolute;
  top: 23px;
  left: 15px;
  width: 1px;
  height: 11px;
  background: currentColor;
  content: "";
  pointer-events: none;
}

#map-page .wuxia-sect-symbol {
  width: 12px;
  height: 12px;
  transform: rotate(45deg);
  border: 1px solid #f5f2e6;
  border-radius: 2px;
  background: #285a4e;
  box-shadow: 0 0 0 1px #285a4e;
}

#map-page .wuxia-sect-pin[data-kind="schematic"] .wuxia-sect-symbol {
  border: 1.5px solid #285a4e;
  background: #e8f0e7;
  box-shadow: 0 0 0 1px #f5f2e6;
}

#map-page .wuxia-sect-pin[data-kind="activity"] .wuxia-sect-symbol {
  transform: none;
  border: 1.5px dashed #285a4e;
  background: #e8f0e7;
  box-shadow: 0 0 0 1px #f5f2e6;
}

#map-page .wuxia-sect-pin[data-kind="group"] .wuxia-sect-symbol {
  box-shadow: 0 0 0 1px #285a4e, 3px 0 0 #739384;
}

#map-page .wuxia-sect-pin:focus-visible {
  outline: 2px solid #285a4e;
  outline-offset: -4px;
}

#map-page .wuxia-sect-pin-label {
  position: absolute;
  inset: auto auto auto 27px;
  padding: 1px 5px 2px;
  border: 1px solid #79958876;
  border-radius: 3px;
  background: #f8f6ebf5;
  color: #173f33;
  box-shadow: 0 1px 2px #23362628;
  font: 700 11px/1.35 var(--serif-stack);
  white-space: nowrap;
  pointer-events: none;
}

#map-page .wuxia-sect-pin.label-left .wuxia-sect-pin-label {
  right: 27px;
  left: auto;
}

#map-page .wuxia-sect-pin.label-collides:not(:hover):not(:focus-visible):not([aria-expanded="true"]) .wuxia-sect-pin-label {
  visibility: hidden;
}

#map-page .wuxia-sect-pin[aria-expanded="true"] .wuxia-sect-pin-label,
#map-page .wuxia-sect-pin:hover .wuxia-sect-pin-label {
  background: #dcebe0;
}

#map-page #wuxia-sect-card,
#map-page #wuxia-sect-empty {
  position: absolute;
  z-index: 8;
  top: 49px;
  right: 12px;
  margin: 0;
  border: 1px solid #799588;
  border-radius: 8px;
  background: #faf7eefb;
  color: #23483b;
  box-shadow: 0 3px 12px #24372b22;
}

#map-page #wuxia-sect-empty {
  padding: 5px 8px;
  font-size: 11px;
  pointer-events: none;
}

#map-page #wuxia-sect-card {
  width: min(260px, calc(100% - 24px));
  max-height: calc(100% - 61px);
  padding: 9px 11px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

#map-page #wuxia-sect-close {
  position: absolute;
  top: 4px;
  right: 5px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #23483b;
  font-size: 19px;
  line-height: 1;
}

#map-page #wuxia-sect-close:hover {
  background: #e6eee6;
}

#map-page .wuxia-sect-entry h3 {
  margin: 0 24px 3px 0;
  font: 700 16px/1.4 var(--serif-stack);
}

#map-page .wuxia-sect-entry p {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}

#map-page .wuxia-sect-entry .wuxia-sect-place,
#map-page .wuxia-sect-entry .wuxia-sect-source {
  font-size: 11px;
}

#map-page .wuxia-sect-entry + .wuxia-sect-entry {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #79958860;
}

#map-page #viewport-frame.has-active-challenge :is(#wuxia-sect-layer, #wuxia-sect-empty),
#map-page #viewport-frame:is(.has-active-challenge, .has-active-genealogy, .has-active-journey) #wuxia-sect-card {
  display: none;
}
