:root {
  --death: #e5322d;
  --serious: #f2b705;
  --seen: #9a9ca3;
  --ink: #1f1f1f;
  --ink2: #5f6065;
  --ink3: #8d8f94;
  --line: #e6e4df;
  --bg: #ffffff;
  --bg2: #f4f3f0;
  --accent: #1f6fe5;
  --shadow: 0 2px 10px rgba(0, 0, 0, .14), 0 0 1px rgba(0, 0, 0, .2);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg2); }
a { color: var(--accent); }
button { font: inherit; color: inherit; }

/* ---------- карта ---------- */
body.mapview { overflow: hidden; height: 100dvh; }
#map { position: fixed; inset: 0; background: #f4f2ec; }

.top {
  position: fixed; z-index: 5; top: calc(8px + var(--safe-t)); left: 8px; right: 8px;
  background: var(--bg); border-radius: 14px; box-shadow: var(--shadow);
  padding: 6px 6px 6px 14px; max-width: 520px;
}
.top .bar { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.top h1 { font-size: 18px; margin: 0; flex: 1; font-weight: 700; letter-spacing: -.01em; }
.tolist {
  text-decoration: none; color: var(--ink); background: var(--bg2); border-radius: 10px;
  padding: 8px 14px; font-weight: 600; font-size: 15px;
}
.legend { display: flex; flex-wrap: wrap; gap: 0 4px; margin: 4px 0 2px -8px; }
.legend::-webkit-scrollbar { display: none; }
.lg {
  display: flex; align-items: center; gap: 6px; border: 0; background: none; padding: 6px 8px;
  border-radius: 9px; font-size: 14px; white-space: nowrap; cursor: pointer; color: var(--ink);
}
.lg i { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.lg b { font-weight: 600; }
.lg.off { color: var(--ink3); }
.lg.off i { background: transparent !important; box-shadow: inset 0 0 0 2px var(--ink3); }
.lg.user i { background: #fff !important; box-shadow: inset 0 0 0 3px var(--ink2); }
.lg.chk i { border-radius: 4px; background: var(--ink); position: relative; }
.lg.chk i::after { content: ""; position: absolute; left: 4px; top: 1px; width: 3px; height: 7px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.lg.chk.off i::after { display: none; }
.lg.chk.off i { border-radius: 4px; }
.lg.user.off i { box-shadow: inset 0 0 0 3px var(--ink3); }

.fab {
  position: fixed; z-index: 4; left: 50%; transform: translateX(-50%);
  bottom: calc(30px + var(--safe-b));
  border: 0; border-radius: 26px; padding: 15px 24px; font-size: 16px; font-weight: 700;
  background: var(--ink); color: #fff; box-shadow: 0 4px 16px rgba(0, 0, 0, .28); cursor: pointer;
  white-space: nowrap;
}
.locate {
  position: fixed; z-index: 4; right: 10px; bottom: calc(96px + var(--safe-b));
  width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--bg);
  box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; color: var(--ink);
}
.reporting .fab, .reporting .locate, .reporting .top .legend { display: none; }
.carding .fab, .carding .locate { display: none; }
/* шторка открыта — карте нужен каждый пиксель: легенду прячем, поиск оставляем */
@media (max-width: 719px) { .carding .top .legend { display: none; } .sheet { max-height: 58dvh; } }

.sheet {
  position: fixed; z-index: 6; left: 0; right: 0; bottom: 0;
  background: var(--bg); border-radius: 18px 18px 0 0; box-shadow: 0 -2px 18px rgba(0, 0, 0, .18);
  max-height: 62dvh; overflow-y: auto; overscroll-behavior: contain;
  padding: 18px 16px calc(16px + var(--safe-b));
}
.sheet.form { max-height: 60dvh; }
@media (min-width: 720px) {
  .sheet { left: 12px; right: auto; bottom: 12px; width: 420px; border-radius: 16px; max-height: calc(100dvh - 140px); }
  .top { right: auto; width: 420px; }
}
.sheet .x {
  position: sticky; top: -6px; float: right; margin: -8px -6px 0 8px; width: 36px; height: 36px;
  border: 0; border-radius: 50%; background: var(--bg2); font-size: 22px; line-height: 1; cursor: pointer; z-index: 1;
}
.sheet h2 { font-size: 20px; margin: 0 0 12px; }

/* карточка */
.case + .case { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
.meta { color: var(--ink2); font-size: 14px; margin-bottom: 6px; line-height: 1.35; padding-right: 36px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; margin-right: 6px; vertical-align: 0; }
.dot.ring { background: #fff !important; box-shadow: inset 0 0 0 3px currentColor; }
.case h3 { font-size: 18px; line-height: 1.25; margin: 0 0 6px; }
.case p { margin: 0 0 8px; font-size: 15px; line-height: 1.4; }
.case .toll { font-weight: 600; }
.case .outcome { color: var(--ink2); }
.src { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.src a {
  display: inline-flex; align-items: center; gap: 4px; text-decoration: none; background: var(--bg2);
  color: var(--ink); border-radius: 9px; padding: 8px 11px; font-size: 14px; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.src a::after { content: "↗"; color: var(--ink3); }
.noproof { color: var(--ink3); font-size: 14px; }
.del { border: 0; background: none; color: var(--death); padding: 8px 0; cursor: pointer; font-size: 14px; }

/* форма */
.kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 14px; }
.kinds label .dot { margin-right: 0; }
.kinds label {
  display: flex; align-items: center; gap: 8px; padding: 12px 10px; border-radius: 12px;
  background: var(--bg2); font-size: 15px; cursor: pointer; line-height: 1.15; min-height: 50px;
}
.kinds input { position: absolute; opacity: 0; pointer-events: none; }
.kinds label:has(input:checked) { background: #fff; box-shadow: inset 0 0 0 2px var(--ink); font-weight: 600; }
.kinds label:has(input:focus-visible) { outline: 2px solid var(--accent); }
.f { display: block; font-size: 14px; color: var(--ink2); margin-bottom: 12px; }
.f input, .f textarea {
  display: block; width: 100%; margin-top: 5px; font: inherit; font-size: 16px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; background: #fff;
}
.f textarea { resize: vertical; }
.f input:focus, .f textarea:focus { outline: none; border-color: var(--ink); }
.send {
  width: 100%; border: 0; border-radius: 13px; padding: 15px; font-size: 16px; font-weight: 700;
  background: var(--ink); color: #fff; cursor: pointer;
}
.send:disabled { opacity: .5; }
.err { color: var(--death); font-size: 14px; margin: 0 0 10px; }
.hint {
  position: fixed; z-index: 5; left: 50%; transform: translateX(-50%); top: calc(64px + var(--safe-t));
  background: var(--ink); color: #fff; padding: 9px 14px; border-radius: 10px; font-size: 14px;
  box-shadow: var(--shadow); pointer-events: none; text-align: center; width: max-content; max-width: calc(100% - 32px);
}

.pin { width: 34px; height: 46px; cursor: grab; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .35)); }
.me { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .2); }

.maplibregl-ctrl-bottom-right { bottom: var(--safe-b); }
.maplibregl-ctrl-attrib { font-size: 10px; }
.reporting .maplibregl-ctrl-bottom-right, .carding .maplibregl-ctrl-bottom-right { display: none; }

/* ---------- список ---------- */
.listview .wrap { max-width: 720px; margin: 0 auto; padding: calc(12px + var(--safe-t)) 16px 40px; }
.listview header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.listview header h1 { flex: 1; font-size: 24px; margin: 0; }
.listview .tomap { text-decoration: none; color: var(--ink); background: var(--bg); box-shadow: var(--shadow); border-radius: 10px; padding: 9px 14px; font-weight: 600; }
.sum { color: var(--ink2); font-size: 15px; margin: 0 0 12px; line-height: 1.4; }
.ctl { padding: 4px 0 12px; }
.ctl .row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ctl .row + .row { margin-top: 6px; }
.ctl select, .ctl input[type=search] {
  font: inherit; font-size: 15px; border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 9px 10px; color: var(--ink); min-width: 0;
}
.ctl input[type=search] { flex: 1 1 100%; }
.ctl select { flex: 1 1 140px; max-width: 100%; }
.ctl #sort { flex: 0 1 auto; }
.ctl .lg { background: #fff; box-shadow: 0 0 0 1px var(--line); }
.items { display: grid; gap: 10px; }
.item { background: var(--bg); border-radius: 14px; padding: 14px 14px 12px; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); border-left: 5px solid var(--seen); }
.item.death { border-left-color: var(--death); }
.item.serious { border-left-color: var(--serious); }
.item .case h3 { font-size: 17px; }
.item .onmap { font-size: 14px; text-decoration: none; margin-left: auto; padding: 8px 0 8px 10px; }
.foot { display: flex; align-items: flex-end; gap: 8px; }
.empty { color: var(--ink2); text-align: center; padding: 40px 0; }
.more { display: block; width: 100%; margin-top: 12px; border: 0; background: #fff; border-radius: 12px; padding: 13px; font-weight: 600; cursor: pointer; box-shadow: 0 0 0 1px var(--line); }

/* ---------- страницы регионов ---------- */
.listview .brand { flex: 1; font-size: 20px; font-weight: 700; color: var(--ink); text-decoration: none; }
.crumbs { font-size: 14px; color: var(--ink3); margin: 4px 0 10px; }
.crumbs a { color: var(--ink2); text-decoration: none; }
.listview h1 { font-size: 26px; line-height: 1.2; margin: 0 0 8px; }
.listview h2 { font-size: 20px; margin: 28px 0 12px; }
.legend-text { font-size: 13px; color: var(--ink2); line-height: 1.8; margin: 0 0 14px; }
.legend-text .dot { margin-left: 4px; }
.legend-text .dot:first-child { margin-left: 0; }
.regions { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px 16px; }
.regions li { padding: 7px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; font-size: 15px; }
.regions li a { text-decoration: none; color: var(--ink); }
.regions li span { color: var(--ink3); white-space: nowrap; }
.regions.big { grid-template-columns: 1fr; }
.regions.big li { padding: 11px 0; font-size: 16px; }
.foot-note { color: var(--ink2); font-size: 14px; margin-top: 24px; line-height: 1.5; }
.meta a { color: inherit; }

/* ---------- поиск города и региона ---------- */
.search { position: relative; margin: 6px 0 2px -8px; color: var(--ink3); }
.search > svg { position: absolute; left: 11px; top: 11px; pointer-events: none; }
.search input {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); border: 0; background: var(--bg2);
  border-radius: 11px; padding: 10px 12px 10px 37px; -webkit-appearance: none; appearance: none;
}
.search input:focus { outline: 2px solid var(--ink); outline-offset: -2px; background: #fff; }
.sres { margin-top: 4px; max-height: min(52dvh, 420px); overflow-y: auto; overscroll-behavior: contain; }
.sres button {
  display: block; width: 100%; text-align: left; border: 0; background: none; cursor: pointer;
  padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 16px; color: var(--ink);
}
.sres button:last-child { border-bottom: 0; }
.sres button:hover, .sres button.on { background: var(--bg2); }
.sres small { display: block; color: var(--ink3); font-size: 13px; margin-top: 1px; }
.sres .all { color: var(--accent); font-weight: 600; }
.sres p { color: var(--ink2); font-size: 14px; margin: 8px; }
.searching .top .legend { display: none; }
.locate { color: var(--accent); }
.locate.busy svg { animation: bear-pulse 1s ease-in-out infinite; }
@keyframes bear-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .locate.busy svg { animation-duration: 2s; } }
.near-head h2 { font-size: 20px; margin: 0 0 4px; padding-right: 40px; }
.near-head .sub { color: var(--ink2); font-size: 14px; margin: 0 0 8px; }
.near-head .sum { font-size: 15px; line-height: 1.4; margin: 0 0 6px; }
.near-head .more-link { display: inline-block; font-size: 15px; margin: 2px 0 6px; font-weight: 600; text-decoration: none; }
.near-head + .case { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 14px; }
.dist { color: var(--ink); font-weight: 600; }
.place-pin { width: 14px; height: 14px; border-radius: 50%; background: var(--ink); border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }

/* ---------- страница случая и памятка ---------- */
.case h3 a, .item h3 a { color: inherit; text-decoration: none; }
.case h3 a:hover { text-decoration: underline; }
.case-page, .guide { background: var(--bg); border-radius: 16px; padding: 18px 16px 8px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.case-page .meta { padding-right: 0; }
.case-page h1, .guide h1 { font-size: 25px; line-height: 1.2; margin: 4px 0 12px; }
.case-page p, .guide p, .guide li { font-size: 16px; line-height: 1.5; }
.case-page .lead, .guide .lead { font-size: 17px; }
.case-page .toll { font-weight: 600; }
.case-page .outcome { color: var(--ink2); }
.case-page h2, .guide h2 { font-size: 19px; margin: 24px 0 8px; }
.guide ul { padding-left: 20px; margin: 0; }
.guide li { margin-bottom: 8px; }
.srcs { padding-left: 20px; margin: 0; }
.srcs li { margin-bottom: 6px; font-size: 16px; }
.btn { display: inline-block; background: var(--ink); color: #fff; text-decoration: none; border-radius: 12px; padding: 12px 18px; font-weight: 700; margin-top: 8px; }
.near { list-style: none; padding: 0; margin: 0; }
.near li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.near li a { color: var(--ink); text-decoration: none; font-weight: 600; display: block; }
.near li span { color: var(--ink3); font-size: 14px; }
noscript .wrap { position: relative; z-index: 10; background: var(--bg); padding: 16px; }
