:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #667085;
  --line: #d7dee8;
  --panel: #ffffff;
  --bg: #f4f7fb;
  --active: #2473c6;
  --active-dark: #17324d;
  --active-2: #f08a4b;
  --accent: #f08a4b;
  --event: #2473c6;
  --war: #a33232;
  --city: #ef5b5b;
  --subregion: #159c8b;
}

* {
  box-sizing: border-box;
}

[hidden],
.is-hidden {
  display: none !important;
}

.leaflet-container {
  position: relative;
  overflow: hidden;
  outline-offset: 1px;
  touch-action: pan-x pan-y;
}

.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
  position: absolute;
  left: 0;
  top: 0;
}

.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
  user-select: none;
  -webkit-user-drag: none;
}

.leaflet-tile {
  border: 0;
  visibility: hidden;
}

.leaflet-tile-loaded {
  visibility: inherit;
}

.leaflet-map-pane {
  z-index: 400;
}

.leaflet-tile-pane {
  z-index: 200;
}

.leaflet-overlay-pane {
  z-index: 400;
}

.leaflet-shadow-pane {
  z-index: 500;
}

.leaflet-marker-pane {
  z-index: 600;
}

.leaflet-tooltip-pane {
  z-index: 650;
}

.leaflet-popup-pane {
  z-index: 700;
}

.leaflet-proxy {
  position: absolute;
  visibility: hidden;
}

.leaflet-control {
  position: relative;
  z-index: 800;
  float: left;
  clear: both;
  pointer-events: auto;
}

.leaflet-top,
.leaflet-bottom {
  position: absolute;
  z-index: 1000;
  pointer-events: none;
}

.leaflet-top {
  top: 0;
}

.leaflet-right {
  right: 0;
}

.leaflet-bottom {
  bottom: 0;
}

.leaflet-left {
  left: 0;
}

.leaflet-left .leaflet-control {
  margin-left: 10px;
}

.leaflet-right .leaflet-control {
  margin-right: 10px;
}

.leaflet-top .leaflet-control {
  margin-top: 10px;
}

.leaflet-bottom .leaflet-control {
  margin-bottom: 10px;
}

.leaflet-control-zoom {
  border: 1px solid rgba(23, 32, 51, .16);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 10px 28px rgba(31, 49, 78, .14);
}

.leaflet-control-zoom a {
  display: block;
  width: 32px;
  height: 32px;
  color: var(--ink);
  background: #fff;
  font-size: 20px;
  font-weight: 700;
  line-height: 32px;
  text-align: center;
  text-decoration: none;
}

.leaflet-control-zoom a + a {
  border-top: 1px solid var(--line);
}

.leaflet-control-zoom a:hover {
  color: var(--active);
  background: #f7fbff;
}

.leaflet-control-attribution {
  border-radius: 5px 0 0 0;
  padding: 2px 6px;
  color: #344054;
  background: rgba(255, 255, 255, .84);
  font-size: 11px;
}

.leaflet-popup {
  position: absolute;
  margin-bottom: 20px;
  text-align: center;
}

.leaflet-popup-content-wrapper {
  border: 1px solid rgba(23, 32, 51, .16);
  border-radius: 8px;
  padding: 1px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 14px 36px rgba(31, 49, 78, .18);
  text-align: left;
}

.leaflet-popup-tip-container {
  position: absolute;
  left: 50%;
  width: 40px;
  height: 20px;
  margin-left: -20px;
  overflow: hidden;
  pointer-events: none;
}

.leaflet-popup-tip {
  width: 17px;
  height: 17px;
  margin: -10px auto 0;
  border-right: 1px solid rgba(23, 32, 51, .16);
  border-bottom: 1px solid rgba(23, 32, 51, .16);
  background: #fff;
  transform: rotate(45deg);
}

.leaflet-popup-close-button {
  position: absolute;
  top: 0;
  right: 0;
  width: 24px;
  height: 24px;
  color: var(--muted);
  font: 18px/24px Arial, sans-serif;
  text-align: center;
  text-decoration: none;
}

.leaflet-tooltip {
  position: absolute;
  padding: 4px 7px;
  white-space: nowrap;
  pointer-events: none;
  border: 1px solid #172033;
  border-radius: 5px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 8px 18px rgba(31, 49, 78, .18);
  font-size: 12px;
  font-weight: 760;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
.text-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid rgba(23, 32, 51, .16);
  border-radius: 7px;
  padding: 0 13px;
  color: var(--ink);
  background: #fff;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.text-link:hover {
  border-color: var(--active);
}

.leaflet-shell {
  width: min(1600px, 100%);
  margin: 0 auto;
  padding: clamp(14px, 2vw, 22px);
}

.leaflet-toolbar {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(0, auto);
  gap: 16px;
  align-items: end;
  padding-bottom: 16px;
}

.brand-block h1,
.brand-block p,
.selection-panel h2,
.selection-panel p,
.result-heading h2 {
  margin: 0;
}

.brand-block h1 {
  font-size: 29px;
  line-height: 1.15;
  font-weight: 760;
}

.brand-block p {
  margin-top: 5px;
  color: var(--muted);
}

.leaflet-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  justify-content: end;
  max-width: 1060px;
}

.control-field {
  display: grid;
  gap: 5px;
  min-width: 150px;
}

.control-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.search-field {
  min-width: min(330px, 100%);
}

.control-field input,
.control-field select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 11px;
  color: var(--ink);
  background: #fff;
}

.control-field input:focus,
.control-field select:focus {
  border-color: var(--active);
  outline: 3px solid rgba(36, 115, 198, .18);
}

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

#leafletFitButton {
  color: #fff;
  border-color: var(--active);
  background: var(--active);
}

.app-shell,
.leaflet-shell {
  width: min(1440px, 100%);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 18px;
  align-items: end;
  padding: 0 0 16px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  font-weight: 760;
}

#summary {
  margin-top: 4px;
  color: var(--muted);
}

.controls {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.advanced-controls {
  max-width: 100%;
}

.advanced-controls summary {
  display: none;
}

.advanced-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  justify-content: end;
  max-width: 940px;
}

.advanced-grid select {
  width: 170px;
}

.search {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input[type="search"],
select,
button {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
}

input[type="search"],
select {
  width: 230px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

.primary-search input {
  width: min(280px, 28vw);
}

.advanced-grid > .reset-button {
  width: 74px;
  padding: 0 12px;
}

button {
  padding: 0 16px;
  color: #fff;
  background: var(--active);
}

.map-options {
  display: flex;
  flex-wrap: wrap;
  flex: 1 1 100%;
  gap: 8px;
  align-items: center;
  justify-content: end;
  min-height: 40px;
}

.option-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
}

.option-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--active);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: -4px 0 14px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  border: 1px solid #d8e2ef;
  border-radius: 999px;
  padding: 0 8px 0 10px;
  color: #26364d;
  background: #fff;
  box-shadow: 0 4px 12px rgba(31, 49, 78, .05);
  font-size: 12px;
  font-weight: 680;
}

.filter-chip strong {
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
}

.filter-chip button {
  width: 20px;
  height: 20px;
  min-height: 20px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  color: #506176;
  background: #eef3f8;
  font-size: 15px;
  line-height: 1;
}

.filter-chip button:hover,
.filter-chip button:focus-visible {
  color: #fff;
  background: var(--active);
}

.timeline-panel {
  display: grid;
  grid-template-columns: minmax(220px, .82fr) minmax(360px, 1.35fr);
  gap: 12px 18px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0 0 18px;
  padding: 13px 14px 12px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(31, 49, 78, .06);
}

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

.timeline-copy strong {
  font-size: 16px;
}

.timeline-copy span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.timeline-controls {
  display: grid;
  grid-template-columns: 58px 82px minmax(150px, 1fr);
  gap: 10px;
  align-items: center;
}

.timeline-play,
.timeline-reset {
  width: 58px;
  padding: 0;
  color: #17324d;
  background: #f5b84b;
}

.timeline-reset {
  width: 82px;
  background: #eef4fb;
}

.timeline-play.is-playing {
  color: #fff;
  background: var(--active-2);
}

.timeline-window-label {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-density {
  position: relative;
  grid-column: 1 / -1;
  height: 42px;
  border: 1px solid #dde5ef;
  border-radius: 7px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(36, 115, 198, .08), rgba(240, 138, 75, .12)),
    repeating-linear-gradient(90deg, transparent 0, transparent calc(10% - 1px), rgba(94, 107, 125, .13) calc(10% - 1px), rgba(94, 107, 125, .13) 10%);
  cursor: pointer;
  touch-action: none;
  user-select: none;
}

.timeline-density.is-drag-window,
.timeline-density.is-dragging-window {
  cursor: grab;
}

.timeline-density.is-dragging-window {
  cursor: grabbing;
}

.timeline-density.is-resize-left,
.timeline-density.is-resize-right {
  cursor: ew-resize;
}

.timeline-window {
  position: absolute;
  z-index: 3;
  top: 4px;
  bottom: 4px;
  border: 1px solid rgba(36, 115, 198, .78);
  border-radius: 7px;
  background: rgba(36, 115, 198, .18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .55), 0 6px 18px rgba(36, 115, 198, .12);
  pointer-events: none;
}

.timeline-compression {
  position: absolute;
  z-index: 1;
  inset: 0 auto 0 0;
  border-right: 1px dashed rgba(94, 107, 125, .45);
  background: repeating-linear-gradient(
    -45deg,
    rgba(94, 107, 125, .08) 0,
    rgba(94, 107, 125, .08) 6px,
    rgba(255, 255, 255, .05) 6px,
    rgba(255, 255, 255, .05) 12px
  );
  pointer-events: none;
}

.timeline-compression span {
  position: absolute;
  left: 8px;
  bottom: 4px;
  color: rgba(52, 64, 84, .72);
  font-size: 11px;
  font-weight: 650;
}

.timeline-window-handle {
  position: absolute;
  top: 3px;
  bottom: 3px;
  width: 8px;
  border-radius: 5px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 0 0 1px rgba(36, 115, 198, .45);
}

.timeline-window-handle.is-left {
  left: 3px;
}

.timeline-window-handle.is-right {
  right: 3px;
}

.timeline-window-grip {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 26px;
  height: 4px;
  border-radius: 999px;
  background: rgba(36, 115, 198, .56);
  transform: translate(-50%, -50%);
}

.timeline-bucket {
  position: absolute;
  z-index: 2;
  bottom: 5px;
  display: flex;
  flex-direction: column-reverse;
  min-width: 2px;
  border-radius: 3px 3px 0 0;
  overflow: hidden;
  opacity: .86;
  pointer-events: none;
}

.timeline-bucket-segment {
  display: block;
  min-height: 0;
}

.timeline-bucket-segment.is-war {
  background: linear-gradient(180deg, #f08a4b 0%, #c53e3e 100%);
}

.timeline-bucket-segment.is-history-event {
  background: linear-gradient(180deg, #57a6df 0%, #2473c6 100%);
}

.timeline-selected-pin {
  position: absolute;
  z-index: 4;
  top: 50%;
  width: 12px;
  height: 25px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #f08a4b;
  box-shadow: 0 0 0 4px rgba(240, 138, 75, .24), 0 8px 18px rgba(27, 32, 44, .18);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.timeline-selected-pin.is-history-event {
  height: 20px;
  background: #2473c6;
  box-shadow: 0 0 0 4px rgba(36, 115, 198, .2), 0 8px 18px rgba(27, 32, 44, .18);
}

.timeline-tooltip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1100;
  display: grid;
  gap: 4px;
  max-width: min(260px, calc(100vw - 24px));
  padding: 9px 10px;
  border: 1px solid rgba(27, 32, 44, .12);
  border-radius: 7px;
  color: #1d2939;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 10px 28px rgba(27, 32, 44, .18);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .12s ease;
}

.timeline-tooltip.is-visible {
  opacity: 1;
  visibility: visible;
}

.timeline-tooltip strong {
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.35;
}

.timeline-tooltip small {
  color: #667085;
  font-size: 12px;
  line-height: 1.35;
}

.timeline-tooltip b {
  width: fit-content;
  border-radius: 999px;
  padding: 2px 7px;
  color: #344054;
  background: #eef2f7;
  font-size: 11px;
  line-height: 1.3;
}

.workspace.leaflet-workspace {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.map-host,
.details {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(31, 49, 78, .08);
}

.map-host {
  position: relative;
  min-height: 650px;
  overflow: hidden;
}

.zoom-controls {
  position: absolute;
  z-index: 650;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 6px;
  align-items: center;
}

.zoom-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 36px;
  height: 34px;
  border-color: rgba(23, 32, 51, .18);
  padding: 0 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 8px 22px rgba(31, 49, 78, .16);
  white-space: nowrap;
}

.zoom-button:hover {
  border-color: var(--active);
}

.zoom-fit {
  min-width: 56px;
}

.leaflet-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 18px;
  align-items: stretch;
}

.map-panel,
.leaflet-side {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 16px 40px rgba(31, 49, 78, .08);
}

.map-panel {
  position: relative;
  min-height: 650px;
  overflow: hidden;
}

.leaflet-map {
  width: 100%;
  height: min(760px, calc(100vh - 240px));
  min-height: 650px;
  background: #dbe7ef;
}

.map-message {
  position: absolute;
  z-index: 600;
  left: 50%;
  top: 18px;
  width: min(520px, calc(100% - 30px));
  transform: translateX(-50%);
  border: 1px solid rgba(163, 50, 50, .25);
  border-radius: 8px;
  padding: 12px 14px;
  color: #7a271a;
  background: rgba(255, 251, 250, .96);
  box-shadow: 0 14px 36px rgba(31, 49, 78, .12);
}

.leaflet-side {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 650px;
  overflow: hidden;
  padding: 18px;
}

.mobile-drawer-bar {
  display: none;
}

.details-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  align-items: center;
  margin: 0 0 14px;
  padding: 3px;
  border: 1px solid #dce4ef;
  border-radius: 8px;
  background: #eef3f8;
}

.details-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  width: 100%;
  height: 32px;
  border: 0;
  border-radius: 6px;
  padding: 0 8px;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
  font-size: 13px;
  font-weight: 680;
  line-height: 1;
  white-space: nowrap;
  word-break: keep-all;
  cursor: pointer;
}

.details-tab:hover {
  color: var(--active);
}

.details-tab:focus {
  outline: none;
}

.details-tab:focus-visible {
  box-shadow: 0 0 0 2px rgba(36, 115, 198, .22);
}

.details-tab.is-active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 2px 8px rgba(31, 49, 78, .1);
}

.details-tab.is-active:focus-visible {
  box-shadow: 0 0 0 2px rgba(36, 115, 198, .22), 0 2px 8px rgba(31, 49, 78, .1);
}

.details-tab-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

.details-tab-count {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 5px;
  padding: 0 5px;
  border-radius: 999px;
  color: #506176;
  background: #dde6f1;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  white-space: nowrap;
}

.details-tab.is-active .details-tab-count {
  color: var(--active);
  background: #eaf3ff;
}

.details-tab-panel {
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

.details h2 {
  font-size: 22px;
  line-height: 1.25;
}

.details p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.overlap-detail {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.overlap-detail-header {
  color: var(--ink);
  font-size: 13px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
}

.summary-strip div {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 13px 10px;
  text-align: center;
}

.summary-strip div + div {
  border-left: 1px solid var(--line);
}

.summary-strip strong {
  font-size: 21px;
  line-height: 1;
}

.summary-strip span {
  color: var(--muted);
  font-size: 12px;
}

.selection-panel {
  display: grid;
  gap: 9px;
  border-bottom: 1px solid var(--line);
  padding: 16px;
}

.selection-panel.is-empty {
  display: none;
}

.selection-panel h2,
.result-heading h2 {
  font-size: 17px;
  line-height: 1.3;
}

.selection-panel p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.detail-list {
  display: grid;
  gap: 7px;
  margin: 0;
}

.detail-list div {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.detail-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.detail-list dd {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

#warList,
#historyEventList,
#overlapList {
  display: grid;
  gap: 8px;
  max-height: min(60vh, 620px);
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

#warList li,
#historyEventList li,
#overlapList li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  cursor: pointer;
}

#warList li:hover,
#historyEventList li:hover,
#overlapList li:hover {
  border-color: var(--active);
}

#warList li:focus-visible,
#historyEventList li:focus-visible,
#overlapList li:focus-visible {
  border-color: var(--active);
  outline: 3px solid rgba(36, 115, 198, .18);
}

#warList li.is-empty,
#historyEventList li.is-empty,
#overlapList li.is-empty {
  color: var(--muted);
  cursor: default;
}

#warList li.is-empty:hover,
#historyEventList li.is-empty:hover,
#overlapList li.is-empty:hover {
  border-color: var(--line);
}

#warList li.is-selected,
#historyEventList li.is-selected,
#overlapList li.is-selected {
  border-color: var(--active-2);
  background: #fff4e9;
}

#warList span,
#historyEventList span,
#overlapList span {
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 760;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#warList small,
#historyEventList small,
#overlapList small {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#warList b,
#historyEventList b,
#overlapList b {
  grid-column: 1 / -1;
  width: fit-content;
  border-radius: 999px;
  padding: 2px 7px;
  color: #344054;
  background: #eef2f7;
  font-size: 11px;
  font-weight: 650;
}

.overlap-tools {
  display: grid;
  grid-template-columns: max-content minmax(104px, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin: 4px 0 10px;
}

.overlap-tools[hidden] {
  display: none;
}

.overlap-tool-search,
.overlap-tool-sort {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.overlap-tool-search {
  grid-column: 1 / -1;
}

.overlap-tool-sort {
  min-width: 104px;
}

.overlap-tool-search span,
.overlap-tool-sort span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
}

.overlap-tool-search input,
.overlap-tool-sort select {
  width: 100%;
  min-width: 0;
  height: 32px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 9px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 12px;
}

.overlap-tool-search input:focus,
.overlap-tool-sort select:focus {
  border-color: var(--active);
  outline: 3px solid rgba(36, 115, 198, .16);
}

.overlap-kind-filter {
  display: inline-flex;
  align-items: center;
  align-self: end;
  gap: 4px;
  width: max-content;
  max-width: 100%;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 3px;
  background: #f8fafc;
}

.overlap-kind-filter button {
  flex: 0 0 auto;
  width: auto;
  height: 24px;
  min-height: 24px;
  border: 0;
  border-radius: 5px;
  padding: 0 8px;
  color: #344054;
  background: transparent;
  font-size: 12px;
  font-weight: 720;
  line-height: 1;
  box-shadow: none;
  white-space: nowrap;
}

.overlap-kind-filter button:hover,
.overlap-kind-filter button:focus-visible {
  color: var(--active);
  background: #e8f3ff;
  transform: none;
}

.overlap-kind-filter button.is-active {
  color: #fff;
  background: var(--active);
}

.overlap-tools strong {
  align-self: end;
  justify-self: end;
  padding-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  white-space: nowrap;
}

.search-hit {
  border-radius: 3px;
  padding: 0 2px;
  color: #7a3a00;
  background: #ffe3af;
}

.search-snippet {
  grid-column: 1 / -1;
  min-width: 0;
  color: #5b6678;
  font-size: 12px;
  font-style: normal;
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.search-snippet mark {
  font-weight: 760;
}

#overlapList li.overlap-list-group {
  display: block;
  border: 0;
  border-radius: 0;
  padding: 8px 2px 2px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 750;
  cursor: default;
}

#overlapList li.overlap-list-group:hover {
  border-color: transparent;
}

#overlapList li.overlap-subgroup-row {
  grid-template-columns: minmax(0, 1fr) auto;
  border-color: #d5e2ef;
  background: #f8fbff;
}

#overlapList li.overlap-subgroup-row b {
  color: #17324d;
  background: #e8f3ff;
}

#overlapList li.overlap-list-action {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--active);
  background: #f8fbff;
  font-size: 13px;
  font-weight: 760;
}

#overlapList.is-virtual {
  display: block;
}

#overlapList.is-virtual li {
  margin-bottom: 8px;
}

#overlapList.is-virtual li.overlap-virtual-spacer {
  display: block;
  border: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: default;
  pointer-events: none;
}

#overlapList li.timeline-focus-row.is-timeline-pulse-row {
  border-color: #f5b84b;
  background: #fff7e8;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.stats div {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  background: #f9fbfd;
}

.stats strong,
.stats span {
  display: block;
}

.stats strong {
  font-size: 24px;
}

.stats span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.war-detail {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 14px 0 12px;
  padding: 12px 0;
}

.war-detail.is-hidden {
  display: none;
}

.war-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.war-tags span {
  border: 1px solid #dbe4ef;
  border-radius: 999px;
  padding: 3px 8px;
  color: #344054;
  background: #f8fafc;
  font-size: 12px;
}

.war-detail dl {
  display: grid;
  gap: 7px;
  margin: 0;
}

.war-detail dl div {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 8px;
}

.war-detail dt {
  color: var(--muted);
}

.war-detail dd {
  margin: 0;
}

.war-detail p {
  margin-top: 0;
}

.war-detail a {
  color: var(--active);
  font-size: 13px;
  line-height: 1.5;
  text-decoration: none;
}

.war-detail a:hover {
  text-decoration: underline;
}

.source-links {
  display: grid;
  gap: 6px;
}

.source-links.is-hidden {
  display: none;
}

.source-links-title {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.source-link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.source-link-list a {
  border: 1px solid #d6e3f1;
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--active);
  background: #f7fbff;
  font-size: 13px;
  line-height: 1.5;
  text-decoration: none;
}

.method-note {
  border-left: 3px solid #f0b45a;
  padding-left: 10px;
  font-size: 13px;
}

.province-label-marker {
  color: #17324d;
  font-size: 12px;
  font-weight: 760;
  line-height: 18px;
  text-align: center;
  text-shadow: 0 1px 0 #fff, 0 0 4px #fff;
  pointer-events: none;
}

.result-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

.result-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 11px;
}

.result-heading span {
  min-width: 32px;
  border-radius: 999px;
  padding: 3px 8px;
  color: #fff;
  background: var(--active-dark);
  font-size: 12px;
  font-weight: 760;
  text-align: center;
}

.result-list {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 0;
  margin: 0;
  padding: 0 10px 14px;
  overflow: auto;
  list-style: none;
}

.result-list button {
  display: grid;
  justify-content: stretch;
  width: 100%;
  height: auto;
  min-height: 52px;
  border-color: #e1e7ef;
  padding: 8px 10px;
  text-align: left;
  background: #fff;
}

.result-list button:hover,
.result-list button:focus {
  border-color: var(--active);
  background: #f7fbff;
  outline: none;
}

.result-title {
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 760;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-meta {
  min-width: 0;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-overflow {
  padding: 8px 10px 2px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.leaflet-density-cluster,
.leaflet-overlap-hub,
.leaflet-overlap-subgroup,
.leaflet-spider-leaf {
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
}

.leaflet-density-core {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: #17324d;
  box-shadow: 0 8px 18px rgba(31, 49, 78, .24);
  font-size: 11px;
  font-weight: 820;
  line-height: 1;
}

.leaflet-density-cluster.is-war-only .leaflet-density-core {
  background: #8f3030;
}

.leaflet-density-cluster.is-event-only .leaflet-density-core {
  background: var(--event);
}

.leaflet-density-cluster.is-mixed .leaflet-density-core {
  background: #315f74;
}

.leaflet-density-cluster:hover .leaflet-density-core,
.leaflet-density-cluster:focus .leaflet-density-core {
  border-color: #5b2d00;
  background: var(--accent);
}

.leaflet-overlap-core {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: #7d3f98;
  box-shadow: 0 8px 18px rgba(31, 49, 78, .24), 0 0 0 5px rgba(125, 63, 152, .14);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.leaflet-overlap-hub.is-war-only .leaflet-overlap-core {
  background: #9e2f2f;
  box-shadow: 0 8px 18px rgba(31, 49, 78, .24), 0 0 0 5px rgba(158, 47, 47, .16);
}

.leaflet-overlap-hub.is-event-only .leaflet-overlap-core {
  background: var(--event);
  box-shadow: 0 8px 18px rgba(31, 49, 78, .24), 0 0 0 5px rgba(36, 115, 198, .16);
}

.leaflet-overlap-hub.is-expanded .leaflet-overlap-core {
  border-color: #5b2d00;
  background: var(--accent);
}

.leaflet-overlap-subgroup .leaflet-overlap-core {
  width: 30px;
  height: 30px;
  border-color: #17324d;
  color: #17324d;
  background: #eef7ff;
  box-shadow: 0 8px 18px rgba(31, 49, 78, .18), 0 0 0 5px rgba(36, 115, 198, .1);
  font-size: 10px;
}

.leaflet-overlap-subgroup.is-expanded .leaflet-overlap-core {
  color: #fff;
  border-color: #5b2d00;
  background: var(--accent);
}

.leaflet-overlap-hub:hover .leaflet-overlap-core,
.leaflet-overlap-hub:focus .leaflet-overlap-core,
.leaflet-overlap-subgroup:hover .leaflet-overlap-core,
.leaflet-overlap-subgroup:focus .leaflet-overlap-core,
.leaflet-spider-leaf:hover .leaflet-spider-core,
.leaflet-spider-leaf:focus .leaflet-spider-core {
  border-color: #5b2d00;
  background: var(--accent);
}

.leaflet-spider-line {
  pointer-events: none;
}

.leaflet-spider-hit {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
}

.leaflet-spider-core {
  width: 11px;
  height: 11px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #7d3f98;
  box-shadow: 0 6px 15px rgba(31, 49, 78, .22);
}

.leaflet-spider-leaf.is-war .leaflet-spider-core {
  background: var(--war);
}

.leaflet-spider-leaf.is-event .leaflet-spider-core {
  border-radius: 3px;
  background: var(--event);
  transform: rotate(45deg);
}

.leaflet-spider-leaf.is-selected .leaflet-spider-core {
  border-color: #5b2d00;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(240, 138, 75, .22), 0 8px 18px rgba(31, 49, 78, .22);
}

.leaflet-density-cluster.is-timeline-pulse .leaflet-density-core,
.leaflet-overlap-hub.is-timeline-pulse .leaflet-overlap-core,
.leaflet-overlap-subgroup.is-timeline-pulse .leaflet-overlap-core,
.leaflet-spider-leaf.is-timeline-pulse .leaflet-spider-core {
  animation: timeline-marker-pulse .72s ease-out;
  border-color: #f5b84b;
}

@keyframes timeline-marker-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(245, 184, 75, .42), 0 8px 18px rgba(31, 49, 78, .24);
  }
  58% {
    box-shadow: 0 0 0 9px rgba(245, 184, 75, .08), 0 12px 24px rgba(31, 49, 78, .2);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(245, 184, 75, 0), 0 8px 18px rgba(31, 49, 78, .18);
  }
}

.leaflet-control-layers {
  border: 1px solid rgba(23, 32, 51, .16);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(31, 49, 78, .14);
  font-family: inherit;
}

.leaflet-control-layers-expanded {
  padding: 9px 10px;
}

.leaflet-control-layers label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 25px;
  font-size: 12px;
}

.leaflet-control-layers-selector {
  margin: 0;
}

.leaflet-popup-content {
  margin: 12px 14px;
  font-family: inherit;
}

.popup-content {
  display: grid;
  gap: 6px;
  max-width: 290px;
}

.popup-content strong {
  color: var(--ink);
  font-size: 14px;
}

.popup-content span,
.popup-content p,
.popup-content a {
  font-size: 12px;
  line-height: 1.4;
}

.popup-content span {
  color: var(--muted);
}

.popup-content p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #344054;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

.popup-content a {
  color: var(--active);
  font-weight: 700;
}

.province-tooltip,
.subregion-tooltip,
.record-tooltip {
  border: 1px solid #172033;
  border-radius: 5px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 8px 18px rgba(31, 49, 78, .18);
  font-size: 12px;
  font-weight: 760;
}

.leaflet-tooltip-preview {
  display: grid;
  gap: 4px;
  max-width: min(260px, calc(100vw - 24px));
}

.leaflet-tooltip-preview strong {
  overflow-wrap: anywhere;
  color: #1d2939;
  font-size: 13px;
  line-height: 1.35;
}

.leaflet-tooltip-preview small {
  color: #667085;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

.leaflet-tooltip-preview b {
  width: fit-content;
  border-radius: 999px;
  padding: 2px 7px;
  color: #344054;
  background: #eef2f7;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.3;
}

.war-tooltip {
  border-color: #7a271a;
}

.event-tooltip {
  border-color: #17324d;
}

.city-tooltip {
  border-color: #9e2f2f;
}

.history-popup .leaflet-popup-content-wrapper,
.history-popup .leaflet-popup-tip {
  background: #fff;
}

@media (max-width: 1120px) {
  .toolbar,
  .workspace,
  .leaflet-toolbar,
  .leaflet-workspace,
  .workspace.leaflet-workspace {
    grid-template-columns: 1fr;
  }

  .controls {
    justify-items: stretch;
  }

  .advanced-grid {
    justify-content: start;
    max-width: none;
  }

  .leaflet-controls {
    justify-content: start;
  }

  .leaflet-side {
    min-height: 460px;
  }
}

@media (max-width: 720px) {
  body.mobile-details-drawer-peek {
    --mobile-details-drawer-height: max(84px, calc(72px + env(safe-area-inset-bottom)));
  }

  body.mobile-details-drawer-half {
    --mobile-details-drawer-height: min(48dvh, 430px);
  }

  body.mobile-details-drawer-full {
    --mobile-details-drawer-height: calc(100dvh - 10px);
    overflow: hidden;
  }

  .leaflet-shell {
    padding: 10px;
  }

  h1,
  .brand-block h1 {
    font-size: 23px;
  }

  .toolbar,
  .controls {
    align-items: stretch;
  }

  .advanced-controls summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 0 12px;
    background: #fff;
    cursor: pointer;
    list-style: none;
  }

  .advanced-controls summary::-webkit-details-marker {
    display: none;
  }

  .advanced-controls summary::after {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform .2s ease;
  }

  .advanced-controls[open] summary::after {
    transform: rotate(225deg) translateY(-2px);
  }

  .advanced-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-top: 10px;
  }

  .advanced-grid select,
  input[type="search"],
  select,
  button,
  .primary-search input {
    width: 100%;
  }

  .primary-search {
    grid-column: 1 / -1;
  }

  .map-options {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    justify-content: stretch;
  }

  .timeline-panel {
    display: block;
    margin-bottom: 10px;
    padding: 10px 12px;
  }

  .timeline-copy {
    gap: 2px;
  }

  .timeline-copy strong {
    font-size: 14px;
  }

  .timeline-copy span {
    font-size: 12px;
  }

  .timeline-controls,
  .timeline-density {
    display: none;
  }

  .leaflet-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .search-field,
  .button-row {
    grid-column: 1 / -1;
  }

  .button-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  button,
  .text-link {
    padding: 0 9px;
  }

  .workspace.leaflet-workspace {
    position: relative;
    display: block;
    min-height: calc(100dvh - 20px);
    margin-right: -10px;
    margin-left: -10px;
    padding-bottom: 72px;
  }

  .map-panel {
    height: calc(100dvh - 20px);
    min-height: 560px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .leaflet-map {
    height: 100%;
    min-height: 0;
  }

  .leaflet-side {
    position: fixed;
    z-index: 1000;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    height: var(--mobile-details-drawer-height, min(48dvh, 430px));
    max-height: calc(100dvh - 10px);
    min-height: 0;
    border-radius: 16px 16px 0 0;
    padding: 0 12px max(12px, env(safe-area-inset-bottom));
    overflow: hidden;
    box-shadow: 0 -18px 42px rgba(27, 32, 44, .22);
    transition: height .18s ease;
    overscroll-behavior: contain;
  }

  .mobile-drawer-bar {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    min-height: 56px;
    padding: 8px 0 7px;
    touch-action: none;
  }

  .mobile-drawer-bar.is-dragging {
    cursor: ns-resize;
  }

  .mobile-drawer-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    min-height: 34px;
    border: 0;
    border-radius: 999px;
    padding: 0;
    color: #667085;
    background: transparent;
    box-shadow: none;
  }

  .mobile-drawer-handle::before {
    content: "";
    display: block;
    width: 28px;
    height: 4px;
    border-radius: 999px;
    background: #98a2b3;
  }

  .mobile-drawer-handle:hover,
  .mobile-drawer-handle:focus-visible {
    background: #eef3f8;
    transform: none;
  }

  .mobile-drawer-bar strong {
    min-width: 0;
    color: var(--ink);
    font-size: 14px;
    font-weight: 760;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-drawer-actions {
    display: inline-flex;
    gap: 4px;
    align-items: center;
  }

  .mobile-drawer-actions button {
    width: auto;
    height: 30px;
    min-height: 30px;
    border-color: #dce4ef;
    border-radius: 6px;
    padding: 0 8px;
    color: #344054;
    background: #fff;
    box-shadow: none;
    font-size: 12px;
    font-weight: 720;
  }

  .mobile-drawer-actions button:hover,
  .mobile-drawer-actions button:focus-visible {
    color: var(--active);
    border-color: var(--active);
    transform: none;
  }

  .mobile-drawer-actions button.is-active {
    color: #fff;
    border-color: var(--active);
    background: var(--active);
  }

  body.mobile-details-drawer-peek .details-tabs,
  body.mobile-details-drawer-peek .details-tab-panel {
    display: none;
  }

  .details-tabs {
    margin-bottom: 10px;
  }

  .details-tab-panel {
    overflow: auto;
  }

  body.mobile-details-drawer-full .leaflet-side {
    border-radius: 14px 14px 0 0;
  }

  .summary-strip strong {
    font-size: 18px;
  }

  .details h2 {
    font-size: 18px;
  }

  .method-note {
    display: none;
  }

  .war-detail dl div {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  #warList,
  #historyEventList,
  #overlapList {
    max-height: none;
  }

  .overlap-tools {
    grid-template-columns: max-content minmax(104px, 1fr) auto;
    align-items: end;
    gap: 7px;
  }

  .overlap-kind-filter {
    width: max-content;
    justify-content: start;
  }

  .overlap-kind-filter button {
    flex: 0 0 auto;
    padding: 0 6px;
  }

  .overlap-tools strong {
    justify-self: end;
  }

  #warList li,
  #historyEventList li,
  #overlapList li {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  #warList small,
  #historyEventList small,
  #overlapList small {
    text-align: left;
  }
}

@media (max-width: 420px) {
  .map-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .option-toggle {
    justify-content: start;
  }

  .overlap-tool-sort {
    min-width: 0;
  }
}

@media (max-width: 340px) {
  .overlap-kind-filter {
    grid-column: 1 / -1;
  }
}
