/* Карта тривог України — спільні стилі вебаплікухи. Темна тема за
   замовчуванням (prefers-color-scheme), перемикач light/dark через
   data-theme на <html> + localStorage (js/app.js). */

:root {
  --bg: #f4f6f8;
  --bg-elevated: #ffffff;
  --bg-sunken: #e9edf1;
  --text: #11151a;
  --text-muted: #566270;
  --border: #d7dde3;
  --accent: #0057b7;
  --accent-ink: #ffffff;
  --accent-contrast: #c9960a;
  --danger: #c23b3b;
  --ok: #1f8a4c;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 10px rgba(20, 24, 30, 0.08);
  --maxw: 640px;

  --lvl-none: #7c8794;
  --lvl-airYellow: #d8a81f;
  --lvl-airRed: #c23b3b;
  --lvl-artillery: #a6460f;
  --lvl-urbanFights: #7a1626;
  --lvl-chemical: #7a4fb0;
  --lvl-nuclear: #d6279c;
  --lvl-unknown: #9aa3ad;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0d10;
    --bg-elevated: #161a1f;
    --bg-sunken: #0f1216;
    --text: #edf1f4;
    --text-muted: #96a2ae;
    --border: #262c34;
    --accent: #4a90e2;
    --accent-ink: #081322;
    --accent-contrast: #ffd84d;
    --danger: #ff6b6b;
    --ok: #3ddc84;
    --shadow: 0 2px 14px rgba(0, 0, 0, 0.5);

    --lvl-none: #3c4552;
    --lvl-airYellow: #e8c547;
    --lvl-airRed: #e3524f;
    --lvl-artillery: #d9701f;
    --lvl-urbanFights: #b23552;
    --lvl-chemical: #9c6fd6;
    --lvl-nuclear: #ff4fc3;
    --lvl-unknown: #4b5460;
  }
}

:root[data-theme="dark"] {
  --bg: #0b0d10;
  --bg-elevated: #161a1f;
  --bg-sunken: #0f1216;
  --text: #edf1f4;
  --text-muted: #96a2ae;
  --border: #262c34;
  --accent: #4a90e2;
  --accent-ink: #081322;
  --accent-contrast: #ffd84d;
  --danger: #ff6b6b;
  --ok: #3ddc84;
  --shadow: 0 2px 14px rgba(0, 0, 0, 0.5);

  --lvl-none: #3c4552;
  --lvl-airYellow: #e8c547;
  --lvl-airRed: #e3524f;
  --lvl-artillery: #d9701f;
  --lvl-urbanFights: #b23552;
  --lvl-chemical: #9c6fd6;
  --lvl-nuclear: #ff4fc3;
  --lvl-unknown: #4b5460;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body {
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
}

.topbar .brand svg { width: 22px; height: 22px; flex: none; }

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--bg-sunken);
  color: var(--text);
  border-radius: 999px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.theme-toggle svg { width: 18px; height: 18px; }

h1 { font-size: 22px; margin: 4px 0 6px; }
h2 { font-size: 17px; margin: 22px 0 8px; }
h3 { font-size: 15px; margin: 16px 0 6px; }
p { line-height: 1.5; color: var(--text); }
.muted { color: var(--text-muted); }
.small { font-size: 13px; }

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-sunken);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}
.btn-outline { background: transparent; }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps > li {
  counter-increment: step;
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.steps > li:last-child { border-bottom: none; }
.steps > li::before {
  content: counter(step);
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}
.step-body svg { width: 100%; max-width: 220px; height: auto; margin: 8px 0; display: block; }

.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab {
  flex: 1;
  text-align: center;
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-sunken);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}
.tab[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.tabpanel[hidden] { display: none; }

details.faq {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 8px;
  background: var(--bg-elevated);
}
details.faq summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::before { content: "▸ "; color: var(--accent); }
details.faq[open] summary::before { content: "▾ "; }

.navbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 20;
}
.navbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 2px 8px;
  color: var(--text-muted);
  font-size: 11px;
  text-decoration: none;
}
.navbar a svg { width: 22px; height: 22px; }
.navbar a[aria-current="page"] { color: var(--accent); }

input[type="text"], input[type="search"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-sunken);
  color: var(--text);
  font-size: 15px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
}
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.badge.stale .dot { background: var(--danger); }
.badge.stale { color: var(--danger); }

.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 10px 0 2px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.legend-swatch { width: 14px; height: 14px; border-radius: 3px; flex: none; }

#mapHolder { width: 100%; }
#mapHolder svg { width: 100%; height: auto; display: block; }
.region-path {
  stroke: var(--bg);
  stroke-width: 0.6;
  transition: fill 0.4s ease;
  cursor: pointer;
}
.region-path.unknown { fill: url(#hatchUnknown) !important; }
.region-path.partial { fill-opacity: 0.72; }
.region-path.untrusted { stroke-dasharray: 1.4 1.2; stroke: var(--danger); stroke-width: 0.9; }

.tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12px;
  box-shadow: var(--shadow);
  max-width: 220px;
  z-index: 30;
  display: none;
}
.tooltip.show { display: block; }
.tooltip b { display: block; margin-bottom: 2px; font-size: 13px; }

.release {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.release:last-child { border-bottom: none; }
.release-ver { font-weight: 700; }
.release-date { color: var(--text-muted); font-size: 12px; }
.release-notes { margin: 6px 0 0; font-size: 13px; color: var(--text-muted); }
.release-notes li { margin: 2px 0; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }

.qr-box {
  display: flex;
  justify-content: center;
  padding: 16px;
  background: #fff;
  border-radius: var(--radius-md);
  margin: 10px 0;
}

.callout {
  border-left: 4px solid var(--accent);
  background: var(--bg-sunken);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin: 12px 0;
}
.callout.warn { border-left-color: var(--danger); }

.print-label { background: #fff; color: #000; padding: 10px; border-radius: 10px; }

@media print {
  .topbar, .navbar, .no-print { display: none !important; }
  body { padding-bottom: 0; background: #fff; }
}
