html, body, #map { width:100%; height:100%; margin:0; }
#map { position:absolute; inset:0; }
:root { --ink:#243042; --muted:#4e6070; --line:#cfd9e1; }
.leaflet-container { background:#e7eff3; }
.leaflet-control-layers { border-radius:8px; box-shadow:0 2px 9px #24304226; }
.battle-overlay { position:absolute; z-index:600; color:var(--ink); background:#fff;
  border:1px solid var(--line); border-radius:9px; padding:10px 13px;
  box-shadow:0 2px 9px #24304224; font:13px/1.35 system-ui,sans-serif; }
.battle-title { top:12px; left:54px; max-width:min(440px, calc(100vw - 360px)); }
.battle-title h1 { margin:0; font:700 clamp(15px, 2.8vw, 22px)/1.12 system-ui,sans-serif; }
.battle-legend { bottom:25px; left:12px; }
#map-legend { list-style:none; margin:0; padding:0; }
#map-legend li { display:flex; align-items:center; gap:7px; margin:4px 0; }
#map-legend .battle-dot { flex:none; }
.battle-legend p { margin:5px 0 0; color:var(--muted); font-size:11px; }
.battle-dot { width:15px; height:15px; border:2px solid var(--outline); border-radius:50%;
  background:var(--pin); box-sizing:border-box; display:block; box-shadow:0 1px 5px #1b243f99; }
.battle-icon { display:grid; place-items:center; }
.battle-cluster { display:grid; place-items:center; color:white; background:var(--pin);
  border:2px solid var(--outline); border-radius:50%; box-sizing:border-box;
  font:700 13px system-ui,sans-serif; box-shadow:0 0 0 4px #ffffff94, 0 1px 7px #1b243f88; }
.battle-card { color:var(--ink); white-space:normal; max-width:min(350px,65vw);
  font:12px/1.35 system-ui,sans-serif; overflow-wrap:anywhere; }
.battle-heading { font-size:15px; font-weight:700; margin-bottom:4px; }
.battle-heading a { color:#174e7c; }
.battle-badge { display:inline-block; border-radius:5px; padding:2px 6px; background:var(--pin);
  color:#fff; font-weight:650; }
.battle-card dl { display:grid; grid-template-columns: 88px minmax(80px,1fr); gap:4px 8px; margin:8px 0 0; }
.battle-card dt { color:var(--muted); font-weight:650; }
.battle-card dd { margin:0; }
.battle-full-verses { max-height:160px; overflow:auto; margin-top:4px; }
.battle-card summary { cursor:pointer; text-decoration:underline; }
@media (max-width:650px) {
  .battle-title { top:auto; left:12px; bottom:112px; max-width:62vw; }
  .battle-legend { font-size:11px; padding:5px 8px; }
  .leaflet-control-layers { font-size:11px; }
}

.historical-dot { --pin:#999999; --outline:#f0f0f0; width:10px; height:10px; }
.battle-cluster.historical-cluster { --pin:#6b6b6b; --outline:#e9e9e9; }
.historical-control { background:white; color:#243042; border:1px solid #cfd9e1;
  border-radius:8px; padding:7px; font:12px/1.35 system-ui,sans-serif; }
.historical-control label, .historical-control select { display:block; margin-bottom:3px; }
.historical-control {
  box-sizing:border-box; width:min(250px, calc(100vw - 24px)); max-height:calc(100dvh - 100px);
  overflow:auto; accent-color:#505a64;
}
.historical-control select { width:100%; }
.historical-period { margin-top:6px; }
.historical-dates { border:0; margin:7px 0 0; padding:0; min-width:0; }
.historical-dates legend { font-weight:650; padding:0; }
.historical-year-fields { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto; gap:5px; align-items:end; }
.historical-year-fields label { margin:0; }
.historical-year-fields input { display:block; width:100%; box-sizing:border-box; }
.historical-control select, .historical-year-fields input, .historical-year-fields button {
  font:inherit; min-height:24px; color:inherit;
}
.historical-slider { height:32px; position:relative; margin:2px 3px; }
.historical-slider-track {
  position:absolute; inset:14px 8px auto; height:4px; border-radius:2px;
  background:linear-gradient(to right,#d5dbe1 var(--range-start),#505a64 var(--range-start),
    #505a64 var(--range-end),#d5dbe1 var(--range-end));
}
.historical-slider input {
  appearance:none; position:absolute; left:0; width:100%; height:22px; margin:0;
  background:transparent; pointer-events:none;
}
#historical-start-slider { top:0; }
#historical-end-slider { top:10px; }
.historical-slider input::-webkit-slider-thumb {
  appearance:none; width:17px; height:17px; border:2px solid #fff; border-radius:50%;
  background:#505a64; box-shadow:0 0 0 1px #505a64; cursor:ew-resize; pointer-events:auto;
}
.historical-slider input::-moz-range-thumb {
  width:13px; height:13px; border:2px solid #fff; border-radius:50%;
  background:#505a64; box-shadow:0 0 0 1px #505a64; cursor:ew-resize; pointer-events:auto;
}
.historical-slider input:focus-visible { outline:none; }
.historical-slider input:focus-visible::-webkit-slider-thumb { outline:2px solid #336699; outline-offset:2px; }
.historical-slider input:focus-visible::-moz-range-thumb { outline:2px solid #336699; outline-offset:2px; }
#historical-date-error { color:#a12922; margin:2px 0 4px; }
.historical-year-fields input[aria-invalid="true"] { outline:1px solid #a12922; }
@media (forced-colors:active) {
  .historical-slider-track { background:CanvasText; }
  .historical-slider input::-webkit-slider-thumb { background:ButtonText; border-color:Canvas; }
  .historical-slider input::-moz-range-thumb { background:ButtonText; border-color:Canvas; }
}
@media (max-width:650px) {
  .historical-control {
    margin-bottom:calc(var(--legend-height, 175px) + 25px) !important;
    max-height:max(90px, calc(100dvh - var(--legend-height, 175px) - var(--layers-height, 155px) - var(--title-height, 75px) - 55px));
  }
}

.battle-cluster { --pin:#234e72; --outline:#d4e6f6; }
.battle-badge.approve_approximate { color:#102b43; }
.map-subtitle, #map-status { margin:5px 0 0; color:var(--muted); }
.title-actions > *, #map-about button {
  font:inherit; color:var(--ink); background:#fff; border:1px solid var(--line);
  border-radius:5px; min-height:30px; padding:3px 8px; cursor:pointer;
}
.title-actions { display:flex; flex-wrap:wrap; gap:6px; margin-top:6px; }
.title-actions a {
  display:inline-flex; align-items:center; box-sizing:border-box; text-decoration:none;
}
#map-about {
  box-sizing:border-box; width:min(540px, calc(100vw - 24px)); max-height: min(76dvh, 560px);
  padding:0; border:1px solid var(--line); border-radius:9px; color:var(--ink);
  background:#fff; font:14px/1.5 system-ui,sans-serif;
}
#map-about[open] { display:grid; grid-template-rows:auto minmax(0, 1fr); }
#map-about::backdrop { background:#24304280; }
#map-about header {
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:10px 14px; border-bottom:1px solid var(--line);
}
#map-about h2 { font-size:18px; margin:0; }
#map-about h3 { font-size:15px; margin:12px 0 4px; }
#map-about p, #map-about ul { margin:0 0 8px; }
#map-about ul { padding-left:20px; }
.about-content { overflow:auto; overscroll-behavior:contain; padding:12px 14px; }
#map-about a { color:#174e7c; }
.popup-details { margin-top:7px; }
.historical-category { --pin:#999999; color:#142230; }
.battle-legend { max-width:310px; }
.battle-card { max-height:42vh; overflow:auto; padding-right:5px; }
.battle-card ul { margin:4px 0 8px; padding-left:17px; }
.battle-card small { color:var(--muted); }
.chronology { border-top:1px solid var(--line); padding-top:6px; }
.locality-qualification { background:#e7f0fa; border-radius:5px; padding:6px 8px; }
@media (max-width:650px) {
  .battle-title { top:calc(var(--layers-height, 155px) + 18px); bottom:auto; left:12px; max-width:70vw; padding:6px 8px; }
  .battle-legend { max-width:70vw; }
}
.approve{--pin:#336699;--outline:#e2effb;}
.approve_approximate{--pin:#6699CC;--outline:#e2effb;}

.intertestamental { --pin:#996633; --outline:#f5e8d7; }
.battle-cluster.intertestamental-cluster { --pin:#79502b; --outline:#f5e8d7; }
.colocated-events { margin-top:8px; border-top:1px solid var(--line); padding-top:6px; }
.colocated-events button {
  display:block; font:inherit; text-align:left; margin-top:3px; padding:2px 4px; color:#174e7c;
}
