/* away radar — дизайн-система away from anime: тёмный фон, мятный акцент, Manrope, «жидкое стекло» */
:root {
  --bg: #121316; --surface: #1e2024; --text: #eceef1; --text-2: #a9adb5; --muted: #7d828b;
  --accent: #34d98a; --accent-rgb: 52 217 138; --on-accent: #06231a;
  --danger: #ff7b7f; --danger-rgb: 255 123 127; --warn: #facc15; --warn-rgb: 250 204 21;
  --divider: rgba(255,255,255,.08);
  --clear: color-mix(in srgb, var(--surface) 38%, transparent);
  --spring: cubic-bezier(.34,1.56,.64,1);
  --font: Manrope, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
html { scrollbar-gutter: stable; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
button { font-family: var(--font); }
[hidden] { display: none !important; }

.sky { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.glow { position: fixed; inset: 0; pointer-events: none; z-index: 0; background: radial-gradient(135% 45% at 50% -12%, rgb(var(--accent-rgb) / .18), transparent 62%); transition: background .4s ease; }
body.alarm .glow { background: radial-gradient(135% 45% at 50% -12%, rgb(var(--danger-rgb) / .2), transparent 62%); }

main { position: relative; z-index: 1; max-width: 480px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px calc(env(safe-area-inset-bottom, 0px) + 104px); }
.view, .stack { display: flex; flex-direction: column; gap: 12px; }
.stack:empty { display: none; }
.label + .pane { margin-top: -4px; }

svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.head { display: flex; align-items: center; gap: 10px; padding: 4px 4px 2px; min-height: 40px; }
.brand { flex: 1; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.brand b, .head h2 b { color: var(--accent); }
.head h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; flex: 1; }
.place { cursor: pointer; border: 0; display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px 0 10px; border-radius: 11px; font-weight: 600; font-size: 13px; color: var(--text-2); background: var(--clear); box-shadow: inset 0 0 0 1px var(--divider); white-space: nowrap; }
.place svg.i { width: 16px; height: 16px; }
.place span { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
.label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 6px 0; }
.hint { font-size: 12.5px; color: var(--muted); padding: 0 6px; line-height: 1.45; margin: 0; }
.hint a { color: var(--text-2); }

.pane { border-radius: 18px; overflow: hidden; background: var(--clear); backdrop-filter: blur(1.5px); -webkit-backdrop-filter: blur(1.5px); box-shadow: inset 0 0 0 1px var(--divider); }
.row { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 11px 16px; box-shadow: inset 0 -1px 0 var(--divider); color: inherit; text-decoration: none; width: 100%; border: 0; background: none; font: inherit; text-align: left; }
.row:last-child { box-shadow: none; }
.row > svg.i { width: 18px; height: 18px; color: var(--muted); }
.row .k { flex: 1; min-width: 0; font-weight: 600; }
.row .k small { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); margin-top: 1px; }
.row .v { color: var(--text-2); font-weight: 600; font-size: 13.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row.tap { cursor: pointer; }
.row.tap:active { background: rgba(255,255,255,.03); }
.row.accent .k, .row.accent > svg.i { color: var(--accent); }
.row.disabled { opacity: .45; pointer-events: none; }
.chev { color: var(--muted); width: 16px !important; height: 16px !important; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); }
.dot.danger { background: var(--danger); box-shadow: 0 0 0 4px rgb(var(--danger-rgb) / .15); }
.dot.warn { background: var(--warn); }
.dot.ok { background: var(--accent); }
.empty { padding: 16px; color: var(--muted); font-weight: 500; text-align: center; }

.switch { width: 34px; height: 20px; border-radius: 999px; background: rgba(255,255,255,.16); position: relative; flex: none; border: 0; cursor: pointer; transition: background .18s ease; padding: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); transition: transform .18s var(--spring); }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(14px); }
.switch:disabled { opacity: .4; }
.tabs { display: flex; gap: 6px; }
.tab { flex: 1; height: 34px; border-radius: 11px; border: 0; font-weight: 600; font-size: 13px; background: var(--clear); box-shadow: inset 0 0 0 1px var(--divider); color: var(--text-2); cursor: pointer; }
.tab.on { background: rgb(var(--accent-rgb) / .12); color: var(--accent); box-shadow: inset 0 0 0 1px rgb(var(--accent-rgb) / .35); }

/* Радар */
.radar-wrap { display: grid; place-items: center; padding: 18px 0 4px; }
.radar { width: 240px; height: 240px; max-width: 72vw; max-height: 72vw; }
.state { display: grid; justify-items: center; text-align: center; gap: 3px; }
.state .big { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.state .sub { font-size: 13.5px; color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.state .sub.stale { color: var(--warn); }
body.alarm .state .big { color: var(--danger); }

.ev .k b { font-weight: 700; }
.ev .k.danger b { color: var(--danger); }
.ev .k.ok b { color: var(--accent); }
.ev .v { font-size: 12.5px; }
.live { font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--danger); padding: 3px 7px; border-radius: 7px; background: rgb(var(--danger-rgb) / .12); }

.swatches { display: flex; gap: 12px; padding: 12px 16px; justify-content: space-between; }
.sw { width: 28px; height: 28px; border-radius: 50%; border: 0; cursor: pointer; background: rgb(var(--c)); }
.sw.on { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px rgb(var(--c)); }

/* Нижняя панель */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; padding: 0 14px calc(env(safe-area-inset-bottom, 0px) + 14px); pointer-events: none; }
.bar { max-width: 452px; margin: 0 auto; height: 60px; border-radius: 22px; display: flex; padding: 5px; pointer-events: auto; background: rgba(22,26,32,.5); backdrop-filter: blur(22px) saturate(1.4); -webkit-backdrop-filter: blur(22px) saturate(1.4); border: 1px solid rgba(255,255,255,.14); box-shadow: 0 16px 44px rgba(0,0,0,.45); }
.nav { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: none; color: var(--text-2); font-weight: 600; font-size: 11px; cursor: pointer; position: relative; }
.nav svg.i { width: 22px; height: 22px; }
.nav.on { color: var(--accent); }
.nav.on svg.i { filter: drop-shadow(0 0 5px rgb(var(--accent-rgb) / .6)); }
.nav .badge { position: absolute; top: 6px; left: calc(50% + 6px); width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }

/* Лист установки */
.dim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 8; animation: fade .2s ease; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; max-width: 520px; margin: 0 auto; padding: 18px 16px calc(env(safe-area-inset-bottom, 0px) + 22px); border-radius: 26px 26px 0 0; display: flex; flex-direction: column; gap: 12px;
  background: color-mix(in srgb, var(--surface) 93%, transparent); backdrop-filter: blur(22px) saturate(1.4); -webkit-backdrop-filter: blur(22px) saturate(1.4); box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 -20px 50px rgba(0,0,0,.4); animation: up .32s var(--spring); }
.sheet .grab { width: 36px; height: 4px; border-radius: 99px; background: rgba(255,255,255,.2); align-self: center; margin-top: -8px; }
.sheet h3 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.sheet .lead { margin: 0; color: var(--text-2); font-size: 13.5px; line-height: 1.45; }
.step { display: flex; gap: 12px; align-items: center; padding: 11px 14px; box-shadow: inset 0 -1px 0 var(--divider); font-weight: 600; }
.step:last-child { box-shadow: none; }
.step .n { width: 24px; height: 24px; border-radius: 8px; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: var(--accent); background: rgb(var(--accent-rgb) / .12); }
.step small { display: block; font-weight: 500; color: var(--muted); font-size: 12.5px; }
.main-btn { height: 46px; border-radius: 12px; border: 0; font-weight: 700; font-size: 15px; background: var(--accent); color: var(--on-accent); cursor: pointer; transition: transform .16s var(--spring); }
.main-btn:active, .btn2:active { transform: scale(.97); }
.main-btn:disabled { opacity: .6; }
.btn2 { height: 46px; border-radius: 12px; border: 0; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; font-weight: 700; font-size: 15px; color: var(--text); background: var(--clear); box-shadow: inset 0 0 0 1px var(--divider); transition: transform .16s var(--spring); }

.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 90px); transform: translateX(-50%); z-index: 10; padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 13.5px; max-width: calc(100% - 32px);
  background: rgba(22,26,32,.8); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); border: 1px solid rgba(255,255,255,.14); animation: up .3s var(--spring); }

@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.toast { animation-name: toast; }
@keyframes toast { from { transform: translate(-50%, 20px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
/* смена раздела: мягкое появление без скачка */
.view.enter { animation: view-in .28s cubic-bezier(.2,.8,.2,1); }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } .view.enter { animation: fade .2s ease !important; } }

/* Сегменты, поиск, списки в листах */
.row.col { flex-direction: column; align-items: stretch; gap: 10px; }
.seg { display: flex; gap: 6px; }
.seg .tab { height: 32px; font-size: 12.5px; }
.tab:disabled { opacity: .4; }
.search { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; border-radius: 12px; background: var(--clear); box-shadow: inset 0 0 0 1px var(--divider); color: var(--muted); }
.search svg.i { width: 18px; height: 18px; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font: 600 15px var(--font); }
.list { max-height: 46vh; overflow-y: auto; overscroll-behavior: contain; }
.list .row svg.i { width: 18px; height: 18px; }
.sheet { max-height: 88vh; }

/* Карта */
.map-wrap { position: relative; aspect-ratio: 4 / 3; }
#map { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
#map:active { cursor: grabbing; }
#map path { fill: rgba(255,255,255,.045); stroke: rgba(255,255,255,.16); stroke-width: .6; vector-effect: non-scaling-stroke; stroke-linejoin: round; transition: fill .3s ease; cursor: pointer; }
#map path.on { fill: rgb(var(--danger-rgb) / .62); stroke: rgb(var(--danger-rgb) / .9); animation: pulse 2.4s ease-in-out infinite; }
#map path.sel { fill: rgba(255,255,255,.14); }
#map path.on.sel { fill: rgb(var(--danger-rgb) / .75); }
#map path.mine { stroke: var(--accent); stroke-width: 1.8; }
#map text { fill: var(--text); font-family: var(--font); font-weight: 700; text-anchor: middle; dominant-baseline: middle; paint-order: stroke; stroke: rgba(10,11,14,.7); stroke-linejoin: round; pointer-events: none; }
#map text.calm { fill: var(--accent); }
@keyframes pulse { 50% { fill-opacity: .7; } }
.map-zoom { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; }
.map-zoom button { width: 34px; height: 34px; border-radius: 10px; border: 0; display: grid; place-items: center; cursor: pointer; font: 700 18px var(--font); color: var(--text);
  background: rgba(22,26,32,.6); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.map-zoom button svg.i { width: 16px; height: 16px; }
.btn-row { display: flex; gap: 8px; padding: 4px 16px 16px; }
.row:has(+ .btn-row) { box-shadow: none; padding-bottom: 8px; }
.btn-row .btn2, .btn-row .main-btn { flex: 1; height: 42px; font-size: 14px; }
.nav { font-size: 10.5px; }
