/* Запас — стили главной (карта станций) и страницы точки. Подключён в index.html после /screens.css.
   Цвета — только переменные из /shared/tokens.css. Слои Leaflet занимают z-index до 1000 — всё своё лежит выше,
   а сам экран карты — отдельный слой (isolation), чтобы не спорить с нижним меню и листами. */

/* ───────── карта ───────── */
.mp { position: relative; height: 100%; overflow: hidden; isolation: isolate; background: var(--surface-2); --vis: 46%; }
.mp-map { position: absolute; inset: 0; z-index: 0; }
/* если плитки не загрузились (нет интернета) — спокойная «сетка улиц», а не серый квадрат */
.mp-map.leaflet-container, .vn-map-in.leaflet-container { font: inherit; background:
  linear-gradient(var(--line) 0 0) 0 30% / 100% 10px no-repeat, linear-gradient(var(--line) 0 0) 0 68% / 100% 6px no-repeat,
  linear-gradient(var(--line) 0 0) 22% 0 / 8px 100% no-repeat, linear-gradient(var(--line) 0 0) 71% 0 / 12px 100% no-repeat,
  repeating-linear-gradient(0deg, transparent 0 63px, color-mix(in oklab, var(--line) 70%, transparent) 63px 64px),
  repeating-linear-gradient(90deg, transparent 0 63px, color-mix(in oklab, var(--line) 70%, transparent) 63px 64px), var(--surface-2); }
.mp .leaflet-tile-pane, .vn-map .leaflet-tile-pane { filter: saturate(.72) contrast(.96); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) :is(.mp, .vn-map) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) saturate(.45) brightness(.82) contrast(.92); } }
:root[data-theme="dark"] :is(.mp, .vn-map) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) saturate(.45) brightness(.82) contrast(.92); }
:is(.mp, .vn-map) .leaflet-control-attribution { font: 500 10px/1.6 var(--font); padding: 0 7px; border-radius: 8px 0 0 0; background: color-mix(in oklab, var(--surface) 78%, transparent); color: var(--muted); }
:is(.mp, .vn-map) .leaflet-control-attribution a { color: inherit; }
.mp:not(.is-wide) .leaflet-bottom { bottom: var(--vis); transition: bottom .3s var(--ease); }
.mp .leaflet-bar { border: 0; border-radius: 16px; overflow: hidden; box-shadow: var(--sh-2); margin: 0 16px 28px 0; }
.mp .leaflet-bar a { width: 44px; height: 44px; line-height: 44px; background: var(--surface); color: var(--ink); border-color: var(--line); font-size: 20px; }
.mp .leaflet-bar a:hover { background: var(--surface-2); }
.mp-noMap { position: absolute; z-index: 1090; left: 12px; right: 12px; top: 76px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 14px; border-radius: 14px; background: var(--surface); box-shadow: var(--sh-2); font-size: 14px; color: var(--muted); }

/* метки точек */
.pin-wrap { background: none; border: 0; }
.pin { position: absolute; left: 0; top: 0; transform: translate(-50%, calc(-100% - 8px)); display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px 0 10px; border-radius: 17px;
  background: var(--device); color: var(--on-device); font: 750 15px/1 var(--font); font-variant-numeric: tabular-nums; white-space: nowrap; cursor: pointer;
  box-shadow: 0 6px 14px rgba(14, 18, 16, .28), inset 0 0 0 1px var(--device-line); transition: transform .22s var(--ease), background .2s var(--ease); }
.pin::after { content: ''; position: absolute; z-index: -1; left: 50%; bottom: -5px; width: 12px; height: 12px; margin-left: -6px; border-radius: 0 0 3px 0; background: inherit; transform: rotate(45deg); }
.pin svg { color: var(--brand); flex: none; }
.pin-slot { display: block; width: 14px; height: 10px; border-radius: 3px; box-shadow: inset 0 0 0 2px var(--brand); flex: none; }
.pin.zero { background: var(--surface); color: var(--muted); box-shadow: 0 3px 8px rgba(14, 18, 16, .16), inset 0 0 0 1px var(--line-strong); }
.pin.zero svg { color: var(--faint); }
.pin.zero .pin-slot { box-shadow: inset 0 0 0 2px var(--faint); }
.pin.off { padding: 0 10px; background: var(--surface); color: var(--faint); box-shadow: inset 0 0 0 1.5px var(--line-strong); opacity: .92; }
.pin.off svg { color: var(--faint); }
.pin.off .pin-slot { box-shadow: inset 0 0 0 2px var(--faint); }
.pin.on { background: var(--brand); color: #10180A; transform: translate(-50%, calc(-100% - 8px)) scale(1.16); box-shadow: 0 10px 22px rgba(14, 18, 16, .36), inset 0 0 0 1.5px #10180A; }
.pin.on svg { color: #10180A; }
.pin.on .pin-slot { box-shadow: inset 0 0 0 2px #10180A; }
/* несколько близких точек одной меткой: «стопка» и кружок с числом точек */
.pin.grp { padding-right: 9px; box-shadow: 0 6px 14px rgba(14, 18, 16, .28), inset 0 0 0 1px var(--device-line), 4px -4px 0 -1px var(--device), 4px -4px 0 0 var(--device-hollow); }
.pin.grp.zero { box-shadow: 0 3px 8px rgba(14, 18, 16, .16), inset 0 0 0 1px var(--line-strong), 4px -4px 0 -1px var(--surface), 4px -4px 0 0 var(--line-strong); }
.pin-n { display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; margin-left: 1px; border-radius: 9px; background: var(--brand); color: #10180A; font: 800 11px/1 var(--font); font-style: normal; }
.pin.zero .pin-n { background: var(--surface-3); color: var(--muted); }
.leaflet-marker-icon:focus-visible { box-shadow: none; }
.leaflet-marker-icon:focus-visible .pin { outline: 3px solid var(--accent); outline-offset: 2px; }
/* в тёмной теме карта тёмная — метке нужен свой контур */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pin:not(.on):not(.zero):not(.off) { background: #0A0D0B; box-shadow: 0 6px 14px rgba(0, 0, 0, .5), inset 0 0 0 1.5px var(--device-hollow); } }
:root[data-theme="dark"] .pin:not(.on):not(.zero):not(.off) { background: #0A0D0B; box-shadow: 0 6px 14px rgba(0, 0, 0, .5), inset 0 0 0 1.5px var(--device-hollow); }
.me-dot { position: absolute; left: -10px; top: -10px; width: 20px; height: 20px; border-radius: 50%; background: #2563EB; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
.me-dot::after { content: ''; position: absolute; inset: -3px; border-radius: 50%; box-shadow: 0 0 0 0 rgba(37, 99, 235, .45); animation: me-pulse 2.4s ease-out infinite; }
@keyframes me-pulse { 70%, 100% { box-shadow: 0 0 0 16px rgba(37, 99, 235, 0); } }
@media (prefers-reduced-motion: reduce) { .me-dot::after { animation: none; } }

/* поверх карты: плашка аренды, «Взять / Вернуть», «Где я» */
.mp-top { position: absolute; z-index: 1100; top: calc(10px + env(safe-area-inset-top)); left: 12px; right: 12px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.mp-top > * { pointer-events: auto; }
.mp-rent { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 12px 0 16px; border-radius: 18px; border: 1px solid var(--device-line); box-shadow: var(--sh-2); text-decoration: none !important; min-width: 0; }
.mp-rent-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: none; animation: st-live 2.2s ease-out infinite; }
.mp-rent-t { font-size: 19px; font-weight: 750; letter-spacing: -.01em; flex: none; }
.mp-rent-sum { color: var(--brand); font-size: 16px; flex: none; }
.mp-ctl { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mp-seg { padding: 4px; border-radius: 16px; background: var(--surface); box-shadow: var(--sh-2); }
.mp .mp-seg .seg-i { min-width: 92px; min-height: 40px; border-radius: 12px; font-size: 15px; }
.mp .mp-seg .seg-i.on { background: var(--ink); color: var(--bg); box-shadow: none; }
.mp-fab { width: 48px; height: 48px; display: grid; place-items: center; flex: none; border: 0; border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: var(--sh-2); }
.mp-fab.on { color: var(--accent-ink); }
.mp-fab:disabled { opacity: .6; }

/* список точек — лист, который тянется вверх */
.mp-sheet { position: absolute; z-index: 1100; left: 0; right: 0; bottom: 0; height: calc(100% - 132px); display: flex; flex-direction: column; background: var(--surface);
  border-radius: 28px 28px 0 0; box-shadow: 0 -8px 30px rgba(14, 18, 16, .16); transition: transform .42s var(--bm-ease-out, var(--ease)); will-change: transform; }
.mp-grip { flex: none; padding: 8px 20px 10px; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; border-radius: 28px 28px 0 0; }
.mp-grip:active { cursor: grabbing; }
.mp-grip > i { display: block; width: 40px; height: 4px; margin: 0 auto 12px; border-radius: 4px; background: var(--line-strong); }
.mp-head h1 { font-size: 21px; letter-spacing: -.02em; }
.mp-head p { margin-top: 2px; }
.mp-list { flex: 1 1 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 8px calc(var(--off, 0px) + var(--fab-rise) + 16px); }
.mp-sk { display: flex; flex-direction: column; gap: 8px; padding: 4px 4px 0; }
.mp-near { display: flex; align-items: center; gap: 10px; width: calc(100% - 8px); margin: 2px 4px 6px; padding: 12px 14px; border: 0; border-radius: 16px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; font-size: 14px; text-align: left; }
.mp-links { display: flex; justify-content: center; gap: 20px; padding: 18px 0 6px; font-size: 14px; font-weight: 600; }
/* карточка выбранной точки */
.mp-card { position: absolute; z-index: 1150; left: 12px; right: 12px; bottom: calc(var(--fab-rise) + 14px); display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 26px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--sh-3); }
.mp-card-main { display: flex; align-items: flex-start; gap: 12px; padding-right: 34px; color: var(--ink); text-decoration: none !important; min-width: 0; }
.mp-card-main .vr-name { font-size: 18px; white-space: normal; }
.mp-card-x { position: absolute; top: 6px; right: 6px; }
.mp-card .row-btns { margin-top: 0; }
.mp.has-sel:not(.is-wide) { --vis: 262px; }
@media (min-width: 900px) {
  .mp.is-wide .mp-sheet { left: 16px; top: 16px; bottom: 16px; right: auto; width: 392px; height: auto; border-radius: 26px; border: 1px solid var(--line); box-shadow: var(--sh-3); transform: none !important; }
  .mp.is-wide .mp-grip { cursor: default; padding: 20px 22px 12px; }
  .mp.is-wide .mp-grip > i { display: none; }
  .mp.is-wide .mp-head h1 { font-size: 24px; }
  .mp.is-wide .mp-list { padding: 0 10px 12px; }
  .mp.is-wide .mp-top { left: 424px; right: 16px; top: 16px; flex-direction: row; align-items: flex-start; }
  .mp.is-wide .mp-ctl { order: 1; }
  .mp.is-wide .mp-rent { order: 2; margin-left: auto; max-width: 420px; }
  .mp.is-wide .mp-card { left: 424px; right: auto; bottom: 16px; width: 380px; }
}

/* ───────── точка ───────── */
.vn-photo { height: 190px; border-radius: 24px; margin: 4px 0 12px; }
.vn-map { position: relative; display: block; height: 164px; margin: 4px 0 16px; border-radius: 24px; overflow: hidden; border: 1px solid var(--line); isolation: isolate; background: var(--surface-2); }
.vn-map-in { position: absolute; inset: 0; pointer-events: none; }
.vn-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.vn-where { display: flex; flex-direction: column; gap: 3px; }
.vn-where b { font-size: 20px; letter-spacing: -.015em; line-height: 1.2; }
.vn-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.vn-tags .tag { padding: 5px 11px; font-size: 13px; }
.vn-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vn-num { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 22px; border: 1px solid var(--device-line); min-width: 0; }
.vn-num b { font-size: 36px; color: var(--brand); flex: none; }
.vn-num.ret b { color: var(--on-device); }
.vn-num.is-zero b { color: var(--device-hollow); }
.vn-num span { font-size: 13px; line-height: 1.3; color: var(--on-device-muted); min-width: 0; }
.vn-st { display: grid; gap: 12px; }
.vn-station { display: flex; flex-direction: column; gap: 14px; padding: 16px; border-radius: 26px; border: 1px solid var(--device-line); box-shadow: var(--sh-1); text-decoration: none !important; }
.vn-station .zs { align-self: flex-start; }
.vn-station.is-off .zs-body { opacity: .5; }
.vn-station-sk { width: 174px; height: calc(var(--rows, 3) * 40px + 10px); border-radius: 17px; background: var(--device-2); box-shadow: inset 0 0 0 1px var(--device-line); }
.vn-station-bot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.vn-hours { margin: 0; padding: 4px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }
.vn-hours > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.vn-hours > div:last-child { border-bottom: 0; }
.vn-hours dt { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.vn-hours dd { margin: 0; font-weight: 600; }
.vn-hours .on dt, .vn-hours .on dd { font-weight: 700; color: var(--ink); }
@media (min-width: 620px) { .vn-st { grid-template-columns: 1fr 1fr; } }
