/* Monochrome brutalist styling: near-black canvas, greyscale landmass, one acid
   accent, monospaced labels. Fixed palette — the Telegram theme is ignored. */
:root {
  --canvas: #0f0f0f;
  --land: #1d1d1d;
  --land-edge: #333333;
  --land-focus: #2a2a2a;
  --accent: #c5f24a;

  --ink: #d8d8d8;
  --ink-soft: #8a8a8a;
  --ink-dim: #5e5e5e;

  /* One alert red for both БПЛА and ракетная опасность; the mode is told apart
     by the icons in the sheet, not by the colour of the region. */
  --alert: #ff3b2f;
  --alert-fill: #7d1610;
  --cover: #cfcfcf;
  /* «Ожидание» — quiet here, but a neighbouring region is under threat. */
  --waiting: #f2c200;
  --waiting-fill: #4a3a06;

  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--canvas);
  color: var(--ink);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
}

/* none, not manipulation: the map handles dragging itself. */
.stage { position: relative; height: 100%; touch-action: none; }

#map { width: 100%; height: 100%; display: block; }

#viewport { transition: transform .3s cubic-bezier(.22, .61, .36, 1); }
/* The drag must follow the finger, so no easing while it is in progress. */
#viewport.dragging { transition: none; }

/* ---------- regions ---------- */

.region {
  fill: var(--land);
  stroke: var(--land-edge);
  stroke-width: 1;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: fill .25s linear, stroke .25s linear;
}

/* The monitored region stands out even when nothing is happening. */
.region--focus { fill: var(--land-focus); stroke: #4a4a4a; }

/* Alerts burn steadily: no blinking, and the fill is saturated rather than
   washed out, so a threatened region reads instantly on the dark canvas. */
/* "Спокойно" is deliberately not coloured: a calm region looks like the map's
   default, so any colour on the map means something is happening. */
.region[data-level="drone"],
.region[data-level="missile"] { fill: var(--alert-fill); stroke: var(--alert); stroke-width: 1.6; }
.region[data-level="cover"]   { fill: #2b2b2b; stroke: var(--cover); }
.region[data-level="waiting"] { fill: var(--waiting-fill); stroke: var(--waiting); }

/* Doubled class so the selection outline also wins over the status colours.
   White, not the accent: the accent is what «спокойно» is painted with, and a
   calm region would then look exactly like a selected one. */
.region.region--selected { stroke: #ffffff; stroke-width: 2.6; }

.label {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  fill: var(--ink-soft);
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}
.label--focus { fill: var(--ink); font-size: 9.5px; }
.label--callout { fill: var(--ink-dim); }

/* ---------- zoom controls ---------- */

.zoom {
  position: absolute;
  right: 16px;
  bottom: calc(22px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: bottom .28s cubic-bezier(.22, .61, .36, 1);
}

.zoom__btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid #2e2e2e;
  background: rgba(20, 20, 20, .88);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  transition: background .12s linear, transform .1s ease;
}
.zoom__btn:active { background: #242424; transform: scale(.92); }
.zoom__btn[disabled] { color: #4a4a4a; cursor: default; }

/* Regional capitals. The dark ring separates the dot from the region's fill. */
/* Same easing as the map itself, so pins and regions move as one. */
.pin {
  pointer-events: none;
  transition: transform .3s cubic-bezier(.22, .61, .36, 1);
}
#viewport.dragging .pin { transition: none; }

.capital {
  fill: #e2e2e2;
  stroke: var(--canvas);
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
}
.capital--focus { fill: #ffffff; }

/* City names only appear once the map is zoomed in far enough to have room. */
.capital-name {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
  fill: #f0f0f0;
  text-anchor: middle;
  paint-order: stroke;
  stroke: var(--canvas);
  stroke-width: 3px;
  stroke-linejoin: round;
  opacity: 0;
  transition: opacity .18s linear;
}
#map[data-zoomed="1"] .capital-name { opacity: 1; }

.leader {
  fill: none;
  stroke: #3a3a3a;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.leader-dot { fill: #4a4a4a; pointer-events: none; }

/* ---------- bottom sheet ---------- */

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 22px calc(22px + var(--safe-bottom));
  background: #141414;
  border-top: 1px solid #272727;
  transform: translateY(110%);
  transition: transform .28s cubic-bezier(.22, .61, .36, 1);
  will-change: transform;
}
.sheet[data-open="1"] { transform: translateY(0); }

.sheet__bar {
  width: 30px;
  height: 2px;
  margin: 0 auto 18px;
  background: #3a3a3a;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.eyebrow__mark {
  width: 8px;
  height: 8px;
  background: var(--accent);
  flex: none;
}

.sheet__name {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -.02em;
  color: #b9b9b9;
}

/* Spread across the full width of the sheet rather than huddling on the left. */
.sheet__icons {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 16px;
}
.sheet__icons:empty { display: none; }

.chip {
  display: grid;
  place-items: center;
  color: var(--ink-soft);
}
.chip svg { width: 26px; height: 26px; display: block; }
/* The artwork is a white silhouette on a square transparent canvas. */
.chip img { width: 40px; height: 40px; display: block; object-fit: contain; }
.chip[data-mode="alert"]   { color: var(--alert); }
.chip[data-mode="calm"]    { color: var(--accent); }
.chip[data-mode="waiting"] { color: var(--waiting); }

/* Active modes are combined, so they are joined by a plus. */
.plus {
  font-family: var(--mono);
  font-size: 17px;
  line-height: 1;
  color: var(--ink-dim);
  user-select: none;
}

.sheet__meta {
  margin: 18px 0 0;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.sheet__meta::before { content: "▸ "; color: var(--accent); }

/* ---------- toast ---------- */

/* Anchored to the top so it can never sit on top of the sheet. */
.toast {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: 16px;
  right: 16px;
  padding: 10px 14px;
  border: 1px solid #4d2326;
  background: #1a1112;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  line-height: 1.4;
  color: #d78b91;
  text-align: center;
}
.toast[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  #viewport, .sheet { transition: none; }
}
