/* Страница карты: боковая панель, значки, карточка места. Основа — site.css */
body.map-page { overflow: hidden; }
body.map-page .site-footer { display: none; }
#app { display: flex; height: calc(100dvh - var(--head-h)); }
#sidebar {
  width: 380px; flex: none; display: flex; flex-direction: column; z-index: 1001;
  background: linear-gradient(180deg, rgba(27, 11, 49, .98), rgba(15, 6, 28, .98)); border-right: 1px solid var(--line);
}
#mapWrap { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; background: #07263a; }
#map.crosshair { cursor: crosshair; }

.sb-top { display: flex; gap: 8px; padding: 14px 14px 10px; align-items: center; }
.search-wrap { position: relative; flex: 1; }
.search-wrap .search { width: 100%; flex: none; }
.search-wrap kbd { position: absolute; right: 12px; top: 12px; font: 11px ui-monospace, monospace; padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); }
#searchResults {
  position: absolute; left: 0; right: 0; top: 48px; max-height: 62vh; overflow: auto; margin: 0; padding: 6px; list-style: none; z-index: 20;
  background: #241044; border: 1px solid var(--line-hot); border-radius: 14px; box-shadow: 0 18px 44px rgba(0, 0, 0, .6);
}
#searchResults li { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 10px; cursor: pointer; }
#searchResults li:hover, #searchResults li.hl { background: rgba(255, 255, 255, .08); }
#searchResults img { width: 24px; height: 24px; flex: none; }
#searchResults b { display: block; font-weight: 600; }
#searchResults small { display: block; color: var(--muted); font-size: 12px; }
#searchResults .none { color: var(--muted); cursor: default; }

.mtabs { display: flex; gap: 4px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.mtabs button { flex: 1; background: none; border: 0; padding: 11px 4px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; font: 500 14px/1 var(--font-head); letter-spacing: .08em; text-transform: uppercase; }
.mtabs button:hover { color: #fff; }
.mtabs button.on { color: #fff; border-image: var(--sunset) 1; }
.tab-body { flex: 1; overflow: auto; padding: 12px 14px 18px; }
.hint { color: var(--muted); margin: 0 0 12px; font-size: 13px; }
#sidebar h4 { margin: 16px 0 8px; font: 500 12px/1 var(--font-head); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }

.layers { display: grid; gap: 8px; margin-bottom: 12px; }
.layer { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); cursor: pointer; }
.layer:has(input:checked) { border-color: var(--pink); background: var(--sunset-soft); }
.layer input { accent-color: var(--pink); width: 17px; height: 17px; }
.layer small { display: block; color: var(--muted); font-size: 12px; }

.row-btns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; }
.row-btns.end { justify-content: flex-end; }
.row-btns button, .btn-like, .icon-btn {
  background: rgba(255, 255, 255, .06); border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; cursor: pointer; color: var(--text); text-decoration: none; font: 500 13px/1.2 var(--font-body);
}
.row-btns button:hover, .btn-like:hover, .icon-btn:hover { border-color: rgba(255, 255, 255, .3); }
button.primary { background: var(--sunset) !important; border-color: transparent !important; color: #1a0428 !important; font-weight: 700; }
button.danger { color: #ff7b9c; }
.shown { margin-left: auto; color: var(--muted); font-size: 12px; }

details.grp { margin-bottom: 6px; border-radius: 12px; border: 1px solid transparent; }
details.grp[open] { border-color: var(--line); background: rgba(255, 255, 255, .025); }
details.grp > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 9px 10px; cursor: pointer; border-radius: 12px; user-select: none; }
details.grp > summary::-webkit-details-marker { display: none; }
details.grp > summary:hover { background: rgba(255, 255, 255, .05); }
details.grp > summary .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); flex: none; }
details.grp > summary .nm { flex: 1; font: 700 15px/1 var(--font-head); letter-spacing: .08em; text-transform: uppercase; }
details.grp > summary .cnt { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
details.grp > summary::after { content: "▾"; color: var(--muted); transition: transform .15s; }
details.grp[open] > summary::after { transform: rotate(180deg); }
button.link { background: none; border: 0; color: var(--teal); cursor: pointer; font-size: 12px; padding: 2px 4px; }
.types { padding: 2px 6px 8px; }
.trow { display: flex; align-items: center; gap: 10px; padding: 5px 6px; border-radius: 9px; cursor: pointer; user-select: none; }
.trow:hover { background: rgba(255, 255, 255, .06); }
.trow input { display: none; }
.trow img { width: 26px; height: 26px; flex: none; object-fit: contain; }
.trow .nm { flex: 1; font-size: 14px; }
.trow .cnt { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.trow:has(input:not(:checked)) { opacity: .4; }
.trow:has(input:not(:checked)) img { filter: grayscale(1); }
.opt { display: flex; gap: 9px; align-items: center; padding: 5px 0; cursor: pointer; font-size: 14px; }
.opt input { accent-color: var(--pink); width: 16px; height: 16px; }

.area { display: flex; justify-content: space-between; width: 100%; background: none; border: 0; border-radius: 10px; padding: 9px 10px; cursor: pointer; text-align: left; color: var(--text); font: inherit; }
.area:hover { background: rgba(255, 255, 255, .06); }
.area.on { background: var(--sunset-soft); box-shadow: inset 3px 0 0 var(--pink); }
.area .cnt { color: var(--muted); font-variant-numeric: tabular-nums; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 10px; align-items: center; padding: 9px 8px; border-radius: 10px; cursor: pointer; }
.list li:hover { background: rgba(255, 255, 255, .06); }
.list li > i { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; }
.list li > span { flex: 1; min-width: 0; }
.list li small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.list li > span small { display: block; white-space: normal; }
.list .none { color: var(--muted); cursor: default; }

.prog { margin-bottom: 12px; }
.prog-h { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.prog-h span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.prog-b { height: 7px; border-radius: 5px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.prog-b i { display: block; height: 100%; background: var(--c, var(--pink)); border-radius: 5px; transition: width .3s; }

.sb-foot { padding: 10px 14px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11.5px; }
.sb-foot a { color: #cdbdf0; }

/* ---- элементы карты ---- */
.mtoolbar { position: absolute; top: 12px; right: 12px; z-index: 1000; display: flex; gap: 6px; }
.mtoolbar button, .fab {
  height: 40px; min-width: 40px; padding: 0 10px; font-size: 17px; cursor: pointer; color: var(--text);
  background: rgba(20, 8, 38, .9); border: 1px solid var(--line); border-radius: 12px; backdrop-filter: blur(8px);
}
.mtoolbar button:hover, .fab:hover { border-color: var(--pink); }
.mtoolbar button.on { background: var(--sunset); color: #1a0428; border-color: transparent; }
.fab { position: absolute; top: 12px; left: 12px; z-index: 1000; font: 500 14px/1 var(--font-head); letter-spacing: .08em; text-transform: uppercase; }
.only-mobile { display: none; }
.statusbar { position: absolute; left: 12px; bottom: 12px; z-index: 1000; display: flex; gap: 8px; font: 12px ui-monospace, monospace; }
.statusbar span { background: rgba(20, 8, 38, .9); border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; }
.statusbar span:empty { display: none; }
#toast { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); z-index: 1002; background: #2a1250; border: 1px solid var(--line-hot); padding: 9px 16px; border-radius: 12px; box-shadow: 0 10px 28px rgba(0, 0, 0, .55); }

.leaflet-container { font: inherit; background: #07263a; }
.leaflet-bar a, .leaflet-bar a:hover { background: rgba(20, 8, 38, .92); color: var(--text); border-color: var(--line); }
.leaflet-control-attribution { background: rgba(9, 3, 18, .75) !important; color: var(--muted); font-size: 10.5px; }
.leaflet-control-attribution a { color: #bda8e8; }
.leaflet-tooltip { background: #241044; color: var(--text); border: 1px solid var(--line-hot); border-radius: 10px; box-shadow: 0 8px 22px rgba(0, 0, 0, .55); font-size: 12.5px; padding: 5px 9px; }
.leaflet-tooltip-top::before { border-top-color: var(--line-hot); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #241044; color: var(--text); }
.leaflet-popup-content p { margin: 6px 0; color: var(--muted); }

/* значки: уменьшаем и прячем «мелочь» на дальних масштабах, чтобы карта читалась */
.mk { transition: transform .12s, opacity .2s; transform-origin: 50% 50%; }
.mk.blip { transform-origin: 50% 50%; }
.mk:hover { z-index: 100000 !important; transform: scale(1.22); }
.mk.found { opacity: .42; filter: grayscale(.6); }
.zoom-low .mk.blip { display: none; }
.zoom-mid .mk.blip { transform: scale(.78); }
.zoom-mid .mk.pin { transform: scale(.88); }
.zoom-low .mk.pin { transform: scale(.74); }
.zoom-low .mk.pin:hover, .zoom-mid .mk.pin:hover, .zoom-mid .mk.blip:hover { transform: scale(1.2); }
.zoom-low .mk.place { display: none; }
.sel-ring { pointer-events: none; }
.sel-ring i { display: block; width: 100%; height: 100%; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 3px var(--pink), 0 0 26px var(--pink); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.15); opacity: .75; } }
.upin i { display: block; width: 26px; height: 26px; background: var(--c); border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 3px solid #fff; box-shadow: 0 3px 8px #000a; }

/* ---- карточка ---- */
#card {
  position: absolute; top: 64px; right: 12px; bottom: 12px; width: 380px; z-index: 1001; overflow: auto;
  background: linear-gradient(180deg, rgba(34, 15, 58, .98), rgba(20, 8, 38, .98)); border: 1px solid var(--line-hot); border-radius: 18px; box-shadow: 0 18px 56px rgba(0, 0, 0, .7);
}
#card .close { position: absolute; top: 10px; right: 10px; z-index: 3; background: rgba(9, 3, 18, .8); }
.card-body { padding: 16px 18px 20px; }
.card-body h2 { margin: 10px 0 2px; font: 700 24px/1.15 var(--font-head); letter-spacing: .03em; text-transform: uppercase; padding-right: 28px; }
.card-body .sub { margin: 0 0 10px; color: var(--muted); }
.chip2 { display: inline-flex; align-items: center; gap: 8px; padding: 3px 12px 3px 4px; border-radius: 999px; background: color-mix(in srgb, var(--c) 20%, transparent); color: #fff; font-size: 12.5px; font-weight: 600; border: 1px solid color-mix(in srgb, var(--c) 55%, transparent); }
.chip2 img { width: 24px; height: 24px; }
.flags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.flag { font-size: 11.5px; padding: 2px 8px; border-radius: 6px; background: rgba(255, 255, 255, .07); border: 1px solid var(--line); color: var(--muted); }
.f-enterable { color: var(--ok); border-color: rgba(61, 240, 164, .35); }
.f-unconfirmed { color: var(--yellow); }
.f-demolished, .f-closed { color: #ff8fa3; }
#card dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 10px 0; }
#card dt { color: var(--muted); font-size: 12.5px; }
#card dd { margin: 0; }
#card dd small { color: var(--muted); }
#card code { font: 600 13px ui-monospace, monospace; color: var(--yellow); }
.links { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 13px; }
.ph { margin: 0; position: relative; }
.ph img { display: block; width: 100%; border-radius: 18px 18px 0 0; }
.ph figcaption, .cmp .tag { position: absolute; bottom: 8px; padding: 2px 8px; font-size: 11px; font-weight: 700; border-radius: 6px; background: rgba(0, 0, 0, .65); }
.ph figcaption { left: 8px; }
.cmp { position: relative; overflow: hidden; border-radius: 18px 18px 0 0; --pos: 50%; background: #000; }
.cmp img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cmp-top { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.cmp-bar { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 3px; margin-left: -1.5px; background: #fff; box-shadow: 0 0 8px #000; pointer-events: none; }
.cmp-bar::after { content: "⟷"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 30px; height: 30px; display: grid; place-items: center; background: #fff; color: #000; border-radius: 50%; font-size: 15px; }
.cmp input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; z-index: 2; }
.cmp .tag.l { left: 8px; } .cmp .tag.r { right: 8px; }

dialog { background: #1b0b31; color: var(--text); border: 1px solid var(--line-hot); border-radius: 16px; width: min(400px, 92vw); padding: 18px; }
dialog::backdrop { background: #000a; }
dialog h3 { margin: 0 0 12px; font: 700 22px/1 var(--font-head); text-transform: uppercase; letter-spacing: .04em; }
dialog label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 13px; }
dialog input, dialog textarea, dialog select { display: block; width: 100%; margin-top: 4px; padding: 9px 11px; background: rgba(9, 3, 18, .8); border: 1px solid var(--line); border-radius: 10px; color: var(--text); font: inherit; }

@media (max-width: 860px) {
  .only-mobile { display: inline-block; }
  #sidebar { position: fixed; top: var(--head-h); bottom: 0; left: 0; width: min(92vw, 400px); transform: translateX(-102%); transition: transform .25s; box-shadow: 0 0 40px #000c; }
  #sidebar.open { transform: none; }
  #card { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 58dvh; border-radius: 20px 20px 0 0; }
  .cmp { aspect-ratio: auto !important; height: 30dvh; }
  .ph img { max-height: 30dvh; object-fit: cover; }
  .statusbar { bottom: auto; top: 62px; left: 12px; }
  .leaflet-control-zoom { display: none; }
  .mtoolbar { top: 12px; }
}

.map-title { margin: 12px 14px 0; font: 700 15px/1 var(--font-head); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
details.about { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 10px; color: var(--muted); font-size: 13px; }
details.about summary { cursor: pointer; font: 500 13px/1 var(--font-head); letter-spacing: .12em; text-transform: uppercase; color: var(--text); padding: 6px 0; }
details.about h4 { color: var(--text); margin: 12px 0 4px; text-transform: none; letter-spacing: 0; font: 600 13px/1.3 var(--font-body); }
details.about p { margin: 0 0 8px; }
details.about a { color: var(--teal); }
