:root {
  --bg: #07080c;
  --panel: #0e1016;
  --ink: #f6f1e7;
  --muted: #b7ad9e;
  --faint: #8d867a;
  --brass: #c4a36a;
  --brass-2: #e8d7b0;
  --line: rgba(232, 215, 176, 0.14);
  --line-strong: rgba(196, 163, 106, 0.72);
  --danger: #e7a097;
  --sans: Nunito, "Segoe UI", sans-serif;
  --serif: Literata, Georgia, serif;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.48);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-text-size-adjust: 100%;
}

.leaflet-container,
.leaflet-bar a,
.leaflet-popup-content,
.leaflet-control {
  font-family: var(--sans);
}
button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: 0.42; cursor: default; }
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 1px solid var(--brass);
  outline-offset: 1px;
}

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
}
.skip:focus {
  left: 8px;
  z-index: 4000;
  background: #000;
  color: #fff;
  padding: 8px 10px;
}

#gate {
  position: fixed;
  inset: 0;
  z-index: 6000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #07080c;
}
.gate-card {
  width: min(380px, 100%);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  padding: 28px 24px 22px;
  box-shadow: var(--shadow);
}
.gate-card h2 {
  margin: 4px 0 14px;
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.gate-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 12px;
}
.gate-card input {
  background: #07080c;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
}
.gate-card .btn { width: 100%; margin-top: 6px; }
.gate-error {
  margin: 4px 0 0;
  color: var(--danger);
  font-size: 13px;
}
.cabinet {
  margin: 2px 0 18px;
  padding: 16px 14px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(196, 163, 106, 0.18), transparent 52%),
    #0c0e14;
}
.cabinet-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cabinet-mark {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--brass);
  background: #07080c;
  color: var(--brass-2);
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1;
}
.cabinet-id { min-width: 0; }
#panel .cabinet-id h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--brass-2);
}
.cabinet-role {
  margin: 5px 0 0;
  color: var(--brass);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.cabinet-head .btn { margin-left: auto; flex: 0 0 auto; }
.cabinet-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0 4px;
}
.cabinet-stat {
  margin: 0;
  padding: 10px 12px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}
.cabinet-stat b {
  display: block;
  font-family: var(--sans);
  font-size: 26px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--brass-2);
}
.cabinet-stat span {
  color: var(--muted);
  font-size: 12px;
}
.cabinet-list { max-height: 260px; overflow: auto; }
.cabinet-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.cabinet-open {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 2px;
  align-items: center;
  padding: 2px;
  background: transparent;
  border: 0;
  color: inherit;
  text-align: left;
}
.cabinet-open:hover { color: var(--brass-2); }
.cabinet-act {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 4px 8px;
  font-size: 11px;
}
.cabinet-act.danger { color: var(--danger); }
.cabinet-kind {
  grid-row: 1 / span 2;
  align-self: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, #e8d7b0, #c4a36a);
  color: #1a140c;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.cabinet-title {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
}
.cabinet-meta {
  color: var(--faint);
  font-size: 12px;
}
.cabinet .hint { margin-bottom: 0; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

#app {
  height: 100dvh;
  display: flex;
  min-height: 0;
}

#panel {
  width: 360px;
  flex: none;
  background:
    linear-gradient(180deg, rgba(196, 163, 106, 0.09), transparent 160px),
    var(--panel);
  border-right: 1px solid var(--line);
  box-shadow: inset -1px 0 0 rgba(196, 163, 106, 0.08);
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#panel-scroll {
  overflow: auto;
  overscroll-behavior: contain;
  padding: 18px 16px 32px;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(196, 163, 106, 0.45) transparent;
}

.brand {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.kicker {
  margin: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brass);
}
.brand h1 {
  margin: 6px 0 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 34px;
  letter-spacing: 0.01em;
  line-height: 0.95;
  color: var(--brass-2);
}
.sub {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.guest-lead {
  margin: 12px 0 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0;
  text-transform: none;
}

#panel h2 {
  margin: 22px 0 8px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
}

.tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.tools button {
  appearance: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 68px;
  padding: 7px 4px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.tools button span {
  font-size: 11.5px;
  line-height: 1.15;
  text-align: center;
}
.tools button:hover { border-color: rgba(196, 163, 106, 0.45); }
.tools button[aria-pressed="true"] {
  border-color: var(--brass);
  background: linear-gradient(180deg, rgba(196, 163, 106, 0.22), rgba(196, 163, 106, 0.08));
  color: var(--brass-2);
  box-shadow: inset 0 0 0 1px rgba(196, 163, 106, 0.28);
}
.tools svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.tools svg [fill="currentColor"] { stroke: none; }

.seg { display: flex; flex-wrap: wrap; gap: 4px; }
.seg button {
  flex: 1 1 calc(50% - 4px);
  min-height: 34px;
  padding: 7px 8px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.02em;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.seg button[aria-pressed="true"] {
  border-color: var(--brass);
  background: linear-gradient(180deg, #e8d7b0, #c4a36a);
  color: #1a140c;
  font-weight: 700;
}
#unit-sides button { flex-basis: calc(33% - 4px); }
#period-seg button { flex-basis: calc(20% - 4px); padding: 7px 2px; font-size: 11px; }
.period-pick {
  margin-top: 2px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--brass);
  background:
    linear-gradient(180deg, rgba(232, 215, 176, 0.2), rgba(196, 163, 106, 0.07));
  box-shadow: 0 0 0 1px rgba(232, 215, 176, 0.12), 0 10px 28px rgba(0, 0, 0, 0.28);
}
.period-prompt,
.date-prompt {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass-2);
}
.date-prompt { margin: 12px 0 0; }
.date-entry {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass-2);
}
.date-entry input {
  text-transform: none;
  letter-spacing: 0.06em;
  font-weight: 650;
  font-size: 15px;
}
#period-seg button {
  background: rgba(7, 8, 12, 0.55);
  color: var(--ink);
  border-color: rgba(196, 163, 106, 0.4);
}
#period-seg button:hover { border-color: var(--brass-2); color: var(--brass-2); }
#period-seg button[aria-pressed="true"] {
  box-shadow: 0 0 0 1px #1a140c, 0 0 18px rgba(232, 215, 176, 0.45);
}
.lang-seg { margin-top: 12px; }
.lang-seg button { flex-basis: calc(33.33% - 4px); padding: 7px 4px; font-size: 12px; }
.period-list {
  margin-top: 8px;
  max-height: 420px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.day-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(196, 163, 106, 0.42);
  background: rgba(196, 163, 106, 0.07);
  color: var(--brass-2);
  font-weight: 650;
  letter-spacing: 0.04em;
}
.day-row:hover {
  border-color: var(--brass-2);
  background: rgba(196, 163, 106, 0.16);
}
.day-row[aria-expanded="true"] {
  border-color: var(--brass);
  color: #1a140c;
  background: linear-gradient(180deg, #e8d7b0, #c4a36a);
  box-shadow: 0 0 16px rgba(232, 215, 176, 0.28);
}
.day-row[aria-expanded="true"] .day-count { color: #1a140c; }
.day-count {
  color: var(--brass);
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}
.day-items { display: flex; flex-direction: column; gap: 6px; margin: 0 0 4px 8px; }
.mention {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--ink);
}
.mention.mil {
  border-color: rgba(228, 194, 122, 0.55);
  background: linear-gradient(90deg, rgba(228, 194, 122, 0.14), rgba(255, 255, 255, 0.02) 48%);
}
.mention.ru {
  border-color: rgba(226, 75, 75, 0.72);
  background: linear-gradient(90deg, rgba(226, 75, 75, 0.18), rgba(255, 255, 255, 0.02) 52%);
}
.mention.ua {
  border-color: rgba(61, 143, 212, 0.75);
  background: linear-gradient(90deg, rgba(61, 143, 212, 0.2), rgba(255, 255, 255, 0.02) 52%);
}
.mention.news {
  border-color: rgba(169, 183, 201, 0.22);
  background: rgba(255, 255, 255, 0.02);
}
.mention:hover { border-color: var(--line-strong); }
.mention.mil:hover { border-color: #e4c27a; }
.mention.ru:hover { border-color: #ff8d86; }
.mention.ua:hover { border-color: #8ec2f5; }
.mention-photo {
  position: relative;
  width: 76px;
  height: 76px;
  flex: none;
  border-radius: 10px;
  overflow: hidden;
  background: #0c0f14;
}
.mention-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mention-photo svg {
  display: block;
  width: 40px;
  height: 40px;
  margin: 18px auto;
}
.mention-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.mention-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.mention-date {
  color: var(--brass);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.mention-kind {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.mention.mil .mention-kind { color: #e4c27a; }
.mention.ru .mention-kind { color: #ffb4ae; }
.mention.ua .mention-kind { color: #9ec8f5; }
.mention.news .mention-kind { color: #a9b7c9; }
.mention-place { font-weight: 700; font-size: 13px; }
.mention-text {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tool-opt label,
#editor label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 8px 0;
  font-size: 12px;
  color: var(--muted);
}
.field-label {
  margin: 10px 0 4px;
  font-size: 12px;
  color: var(--muted);
}
.color-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}
input[type="text"],
input[type="number"],
input[type="date"],
input[type="search"],
textarea,
select {
  width: 100%;
  background: #090b10;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 13.5px;
  line-height: 1.4;
  color-scheme: dark;
}
textarea { resize: vertical; min-height: 52px; }
input[type="color"] {
  width: 48px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
}
.hint {
  color: var(--faint);
  font-size: 12px;
  line-height: 1.45;
  margin: 8px 0 0;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 14px;
  cursor: pointer;
}
.check input { accent-color: #c4a36a; width: 16px; height: 16px; }
.check .count {
  margin-left: auto;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.leg-block { margin-bottom: 10px; }
.leg-title {
  margin: 0 0 4px;
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.leg-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 26px;
  font-size: 13px;
}
.leg-row svg { flex: none; }
#legend .sym { width: 28px; height: 22px; }
#legend .strike-svg { width: 22px; height: 22px; }
.swatch {
  width: 18px;
  height: 12px;
  border: 1.5px solid #f4efe6;
  display: inline-block;
  flex: none;
}
.swatch.line {
  width: 22px;
  height: 0;
  border: none;
  border-top: 3px solid currentColor;
  background: none !important;
}

#search-results { max-height: 168px; overflow: auto; margin-top: 4px; }
.search-hit {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-top: 1px solid var(--line);
  padding: 8px 2px;
  font-size: 12px;
  line-height: 1.35;
}
.search-hit:hover { color: var(--brass); }

.btn-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.btn {
  flex: 1;
  min-height: 36px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12.5px;
  letter-spacing: 0.03em;
}
.btn:hover { border-color: var(--line-strong); }
.btn.primary {
  background: linear-gradient(180deg, #e8d7b0, #c4a36a);
  border-color: #e8d7b0;
  color: #1a140c;
  font-weight: 700;
}
.btn.danger {
  color: var(--danger);
  border-color: rgba(224, 122, 112, 0.55);
  background: #2a1719;
}
.btn.wide { width: 100%; margin-top: 8px; flex: none; }
.editor-actions { display: flex; gap: 6px; margin-top: 8px; }
.editor-actions .btn { flex: 1; }

.legal {
  margin: 18px 0 0;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.5;
}
.legal a { color: var(--brass); }

#panel-close, #menu { display: none; }

#stage { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; background: var(--bg); }

#loupe {
  position: absolute;
  z-index: 850;
  width: min(300px, calc(100% - 24px));
  height: 236px;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--brass);
  background: #0e1016;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(232, 215, 176, 0.12);
}
#loupe[hidden] { display: none !important; }
.loupe-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
  padding: 4px 6px 4px 12px;
  background: linear-gradient(180deg, rgba(196, 163, 106, 0.18), rgba(14, 16, 22, 0.96));
  color: var(--brass-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.loupe-bar:active { cursor: grabbing; }
.loupe-bar button {
  width: 28px;
  height: 24px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--brass-2);
  font-size: 18px;
  line-height: 1;
}
.loupe-bar button:hover { background: rgba(232, 215, 176, 0.12); }
#loupe-map { flex: 1; min-height: 0; background: #07080c; }
#loupe .leaflet-bar a {
  width: 28px !important;
  height: 28px !important;
  line-height: 28px !important;
  font-size: 16px !important;
}
#loupe .leaflet-top.leaflet-right { margin-top: 6px; margin-right: 6px; }
#loupe-resize {
  position: absolute;
  right: 2px;
  bottom: 2px;
  z-index: 800;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  touch-action: none;
  background:
    linear-gradient(135deg, transparent 0 46%, rgba(232, 215, 176, 0.95) 46% 58%, transparent 58% 68%, rgba(232, 215, 176, 0.95) 68% 80%, transparent 80%);
}
#loupe-map::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translate(-50%, -50%);
  background:
    linear-gradient(#f7f3ea, #f7f3ea) center / 1.5px 100% no-repeat,
    linear-gradient(#f7f3ea, #f7f3ea) center / 100% 1.5px no-repeat;
  filter: drop-shadow(0 0 1px #140e08);
  pointer-events: none;
  z-index: 650;
}

#stage::after { content: none; }

#ruler {
  position: absolute;
  z-index: 500;
  top: 92px;
  right: 10px;
  width: 34px;
  height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 11, 16, 0.92);
  color: #e8d7b0;
  border: 1px solid rgba(196, 163, 106, 0.55);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}
#ruler svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}
#ruler[aria-pressed="true"] {
  background: linear-gradient(180deg, #e8d7b0, #c4a36a);
  color: #1a140c;
}
#compass {
  position: absolute;
  z-index: 500;
  top: 140px;
  right: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  pointer-events: none;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-shadow: 0 1px 2px #000;
}

#dock {
  position: absolute;
  z-index: 800;
  left: 16px;
  bottom: 16px;
  width: min(440px, calc(100% - 160px));
  background: rgba(10, 11, 16, 0.82);
  border: 1px solid var(--line);
  padding: 10px 12px 9px;
  color: var(--ink);
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
#drawbar { display: flex; gap: 6px; margin-bottom: 8px; }
#drawbar .btn { min-height: 34px; }
#status { margin: 0; font-size: 12.5px; line-height: 1.45; }
#coords {
  margin: 4px 0 0;
  color: var(--brass-2);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  min-height: 1.15em;
}

#toast {
  position: absolute;
  z-index: 900;
  top: 62px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  background: rgba(14, 16, 22, 0.92);
  color: var(--brass-2);
  border: 1px solid var(--line-strong);
  padding: 8px 14px;
  font-size: 13px;
  max-width: min(440px, calc(100% - 24px));
  text-align: center;
  border-radius: 999px;
  box-shadow: var(--shadow);
}

#menu {
  position: absolute;
  z-index: 2100;
  top: 10px;
  left: 10px;
  min-height: 40px;
  padding: 8px 12px;
  background: rgba(10, 11, 16, 0.9);
  color: var(--brass-2);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11px;
}

#scrim {
  position: absolute;
  inset: 0;
  z-index: 1600;
  background: rgba(0, 0, 0, 0.45);
}

.noscript {
  padding: 16px;
}

.leaflet-container {
  background: var(--bg);
  font-family: var(--sans);
}
.leaflet-container.sat > .leaflet-map-pane > .leaflet-tile-pane {
  filter: brightness(0.78) contrast(1.05) saturate(0.86);
}
.leaflet-container[data-mode="zone"].leaflet-grab,
.leaflet-container[data-mode="arrow"].leaflet-grab,
.leaflet-container[data-mode="measure"].leaflet-grab,
.leaflet-container[data-mode="strike"].leaflet-grab,
.leaflet-container[data-mode="unit"].leaflet-grab,
.leaflet-container[data-mode="news"].leaflet-grab,
.leaflet-container[data-mode="note"].leaflet-grab,
.leaflet-container[data-mode="zone"],
.leaflet-container[data-mode="arrow"],
.leaflet-container[data-mode="measure"],
.leaflet-container[data-mode="strike"],
.leaflet-container[data-mode="unit"],
.leaflet-container[data-mode="news"],
.leaflet-container[data-mode="note"] {
  cursor: crosshair;
}
.event-pin.selected { box-shadow: 0 0 0 3px rgba(232, 215, 176, 0.9); }

.leaflet-bar {
  border: 1px solid rgba(196, 163, 106, 0.55) !important;
  border-radius: 14px !important;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35) !important;
  overflow: hidden;
}
.leaflet-bar a {
  background: rgba(10, 11, 16, 0.92) !important;
  color: #e8d7b0 !important;
  border-bottom: 1px solid rgba(196, 163, 106, 0.22) !important;
  width: 34px !important;
  height: 34px !important;
  line-height: 34px !important;
}
.leaflet-bar a:hover { background: #1c1812 !important; }
.leaflet-control-attribution,
.maplibregl-ctrl-attrib { display: none !important; }
.leaflet-labels-pane,
.leaflet-labels-pane * {
  pointer-events: none !important;
}
.leaflet-labels-pane .maplibregl-map,
.leaflet-labels-pane canvas {
  background: transparent !important;
}
.leaflet-control-scale-line {
  background: rgba(10, 11, 16, 0.82) !important;
  border: 1px solid rgba(196, 163, 106, 0.55) !important;
  border-top: none !important;
  color: #e8d7b0 !important;
  font: 12px/1.45 var(--sans) !important;
  text-shadow: none;
  padding: 1px 6px 0;
}

.leaflet-div-icon.strike-icon.mil { filter: drop-shadow(0 0 6px rgba(228, 194, 122, 0.55)); }
.leaflet-div-icon.strike-icon.news { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55)); }
.leaflet-div-icon.strike-icon,
.leaflet-div-icon.unit-icon,
.leaflet-div-icon.arrow-icon,
.leaflet-div-icon.label-icon,
.leaflet-div-icon.vx {
  background: transparent;
  border: none;
}
.unit-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.unit-tag {
  margin-top: 1px;
  max-width: 116px;
  font: 700 12px/1.25 var(--sans);
  color: #ffffff;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 0 2px #000, 0 0 4px #000, 0 1px 2px #000;
}
.map-label {
  width: max-content;
  max-width: 176px;
  margin: 0 auto;
  text-align: center;
  color: #ffffff;
  font: 700 13px/1.3 var(--sans);
  text-shadow: 0 0 2px #000, 0 0 5px #000, 0 1px 2px #000;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.map-label.chip {
  background: rgba(8, 10, 9, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 1px 6px;
  font-weight: 500;
  font-size: 11.5px;
}
.map-label.chip.measure {
  color: #1a140c;
  background: linear-gradient(180deg, #e8d7b0, #c4a36a);
  border-color: transparent;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  text-shadow: none;
}
.vx .vtx,
.vx .mid {
  display: block;
  box-sizing: border-box;
}
.vx .vtx {
  width: 12px;
  height: 12px;
  border: 2px solid #e8d7b0;
  background: #1a140c;
}
.vx .mid {
  width: 9px;
  height: 9px;
  border: 1.5px solid #c4a36a;
  background: #0e1016;
  border-radius: 50%;
}
.leaflet-tooltip.sheet-tip {
  background: rgba(10, 11, 16, 0.94);
  color: #f6f1e7;
  border: 1px solid rgba(196, 163, 106, 0.55);
  border-radius: 10px;
  box-shadow: none;
  padding: 4px 8px;
  font: 13px/1.4 var(--sans);
  white-space: normal;
  max-width: 230px;
}
.news-popup .leaflet-popup-content-wrapper {
  background: #12151c;
  color: #f6f1e7;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  padding: 0;
}
.news-popup.mil .leaflet-popup-content-wrapper { border-color: rgba(228, 194, 122, 0.7); }
.news-popup.ru .leaflet-popup-content-wrapper { border-color: rgba(226, 75, 75, 0.8); }
.news-popup.ua .leaflet-popup-content-wrapper { border-color: rgba(61, 143, 212, 0.85); }
.news-popup.news .leaflet-popup-content-wrapper { border-color: rgba(169, 183, 201, 0.45); }
.news-popup .leaflet-popup-content {
  margin: 0;
  width: 280px !important;
}
.news-popup .leaflet-popup-tip { background: #12151c; }
.news-popup .leaflet-popup-close-button {
  color: #f5f7fb !important;
  width: 26px !important;
  height: 26px !important;
  font-size: 18px !important;
  line-height: 24px !important;
  border-radius: 50%;
  background: rgba(8, 10, 14, 0.72);
  top: 8px !important;
  right: 8px !important;
}
.news-hero { position: relative; background: #0c0f14; }
.news-hero.no-photo { min-height: 44px; background: transparent; }
.news-photo {
  display: block;
  width: 100%;
  height: 168px;
  object-fit: cover;
  margin: 0;
  border-radius: 0;
  background: #0c0f14;
}
.news-kind {
  position: absolute;
  left: 12px;
  bottom: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(8, 10, 14, 0.78);
  color: #e4c27a;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.news-popup.news .news-kind { color: #d5deea; }
.news-hero.no-photo .news-kind { position: static; display: inline-flex; margin: 12px 14px 0; }
.news-card h3 {
  margin: 12px 14px 4px;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  line-height: 1.05;
  color: var(--brass-2);
}
.news-card .news-date {
  margin: 0 14px 8px;
  color: #c4a36a;
  font-size: 12px;
  letter-spacing: 0.04em;
}
.news-card .news-text {
  margin: 0 14px 10px;
  color: #e7e0d4;
  font-size: 13.5px;
  line-height: 1.45;
}
.news-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  margin: 0 14px 14px;
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #e8d7b0, #c4a36a);
  color: #1a140c !important;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}
.leaflet-tooltip-top.sheet-tip::before { border-top-color: rgba(12, 14, 13, 0.94); }
.leaflet-tooltip-bottom.sheet-tip::before { border-bottom-color: rgba(12, 14, 13, 0.94); }

@media (max-width: 900px) {
  .map-float { top: 64px; }
  #panel {
    position: fixed;
    z-index: 2000;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(calc(100vw - 56px), 380px);
    transform: translateX(-105%);
    transition: transform 0.18s ease;
    box-shadow: var(--shadow);
  }
  body.panel-open #panel { transform: none; }
  body.panel-open #scrim { display: block; }
  body.panel-open #menu { visibility: hidden; }
  #menu, #panel-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  #panel-close {
    margin-top: 10px;
    min-height: 44px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--brass-2);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
  }
  #dock {
    left: 8px;
    right: 8px;
    width: auto;
    bottom: 8px;
  }
  .leaflet-bottom.leaflet-right { bottom: 118px !important; }
  #ruler { top: 112px; width: 44px; height: 44px; border-radius: 16px; }
  #ruler svg { width: 22px; height: 22px; }
  #compass { top: 168px; }
  #toast { top: 108px; }
  #period-seg button { min-height: 40px; font-size: 12px; }
  .leaflet-control-zoom a {
    width: 44px !important;
    height: 44px !important;
    line-height: 44px !important;
    font-size: 22px !important;
  }
  .leaflet-top.leaflet-right { top: calc(8px + env(safe-area-inset-top)); }
  .leaflet-bottom.leaflet-right { margin-bottom: env(safe-area-inset-bottom); }
}
.cluster-icon { background: none; border: 0; }
.cluster {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #14110c;
  color: #f6f1e7;
  border: 2px solid #e8d7b0;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}
.cluster.strike.ru, .cluster.event.ru { border-color: #e24b4b; color: #ffd5d0; }
.cluster.strike.ua, .cluster.event.ua { border-color: #3d8fd4; color: #d6e8ff; }
body.phone #compass { display: none; }
body.phone:not(.admin) #status { display: none; }
body.phone.measuring #status { display: block; }
.map-float {
  position: absolute;
  z-index: 480;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: calc(100% - 28px);
  pointer-events: none;
}
.map-chip, .map-key { pointer-events: auto; }
.map-chip {
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(7, 8, 12, 0.88);
  color: var(--brass-2);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow);
}
.map-key {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: min(640px, calc(100vw - 24px));
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(7, 8, 12, 0.78);
  color: var(--ink);
  font-size: 11px;
  letter-spacing: 0.04em;
}
.map-key span { display: inline-flex; align-items: center; gap: 5px; }
.cal {
  pointer-events: auto;
  width: min(320px, calc(100vw - 28px));
  padding: 12px 12px 10px;
  border-radius: 18px;
  border: 1px solid var(--line-strong);
  background: #07080c;
  box-shadow: var(--shadow);
  color: var(--ink);
}
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.cal-head p {
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  color: var(--brass-2);
  letter-spacing: 0.01em;
}
.cal-nav {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--brass-2);
  font-size: 22px;
  line-height: 1;
}
.cal-nav:hover { background: rgba(232, 215, 176, 0.12); }
.cal-nav:disabled { opacity: 0.35; cursor: default; }
.cal-nav:disabled:hover { background: transparent; }
.cal-week, .cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-week span {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass);
  padding: 4px 0 6px;
}
.cal-day {
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}
.cal-day.is-out { color: var(--faint); }
.cal-day.is-future,
.cal-day:disabled {
  color: rgba(183, 173, 158, 0.32);
  cursor: default;
}
.cal-day.is-future:hover,
.cal-day:disabled:hover { box-shadow: none; }
.cal-day.is-in { background: rgba(196, 163, 106, 0.22); border-radius: 0; }
.cal-day.is-start, .cal-day.is-end, .cal-day.is-anchor {
  background: linear-gradient(180deg, #e8d7b0, #c4a36a);
  color: #1a140c;
  border-radius: 10px;
}
.cal-day.is-today:not(.is-start):not(.is-end):not(.is-anchor) {
  box-shadow: inset 0 0 0 1px var(--brass);
}
.cal-day:hover { box-shadow: inset 0 0 0 1px var(--brass-2); }
.cal-presets { margin-top: 10px; }
.cal-presets button { flex-basis: calc(20% - 4px); min-height: 32px; padding: 6px 2px; font-size: 11px; }
.cal-hint {
  margin: 8px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.key-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.key-dot.ru { background: #e24b4b; }
.key-dot.ua { background: #3d8fd4; }
.key-dot.ev { background: #c4a46a; }
.key-dot.note { background: #8b5cf6; }

.afu-icon { background: none; border: none; }
.event-icon { background: none; border: 0; }
.event-pin {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #f3ead7;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55);
  background: #c4a46a;
}
.event-pin.ru { background: #e24b4b; }
.event-pin.ua { background: #3d8fd4; }
.note-pin {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  transform: rotate(45deg);
  background: #8b5cf6;
  border: 2px solid #f3e8ff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55);
}
.note-pin.selected { box-shadow: 0 0 0 3px rgba(232, 215, 176, 0.95); }
.news-popup.note .news-kind { color: #d8c4ff; }
.afu-badge {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(228, 194, 122, 0.85);
  background: #0c0e14;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), 0 8px 16px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.afu-badge.ua { border-color: #3d8fd4; }
.afu-badge.ru { border-color: #e24b4b; }
.afu-badge.bare.ua span { color: #d6e8ff; }
.afu-badge.bare.ru span { color: #ffd5d0; }
.afu-badge.lg { width: 64px; height: 64px; border-radius: 12px; }
.afu-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #111318;
}
.afu-badge.bare span {
  color: #e8d7b0;
  font: 700 11px/1 var(--sans);
  letter-spacing: -0.03em;
}
.afu-badge.lg.bare span { font-size: 16px; }
.unit-popup .leaflet-popup-content-wrapper {
  background: #12151c;
  color: #f6f1e7;
  border-radius: 14px;
  border: 1px solid rgba(228, 194, 122, 0.7);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  padding: 0;
}
.unit-popup .leaflet-popup-content { margin: 0; width: 280px !important; }
.unit-popup .leaflet-popup-tip { background: #12151c; }
.unit-popup .leaflet-popup-close-button {
  color: #f5f7fb !important;
  width: 26px !important;
  height: 26px !important;
  font-size: 18px !important;
  line-height: 24px !important;
  border-radius: 50%;
  background: rgba(8, 10, 14, 0.72);
  top: 8px !important;
  right: 8px !important;
}
.unit-card { padding: 14px 14px 14px; }
.unit-head { display: flex; gap: 12px; align-items: center; padding-right: 22px; }
.unit-card h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.1;
  color: var(--brass-2);
}
.unit-type {
  margin: 4px 0 0;
  color: #c4a36a;
  font-size: 12px;
  letter-spacing: 0.03em;
}
.unit-line { margin: 8px 0 0; font-size: 13px; color: #f6f1e7; }
.unit-line span { color: #b7ad9e; }
.unit-note { margin: 8px 0 0; font-size: 12px; line-height: 1.4; color: #b7ad9e; }
.unit-card a {
  display: inline-flex;
  margin-top: 12px;
  color: #1a140c;
  background: #e8d7b0;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

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