/* Мини-приложение ТОР-ЭВАКУАТОР. Токены и компоненты — tor.css (дизайн-система), здесь раскладка.
   Правила мобильного: экран не сползает (overflow-x, overscroll, touch-action), поля 16 px (iOS не зумит),
   безопасные зоны (вырез, полоска «Домой»), высота 100dvh, без «залипающего» hover на тач-экранах. */
*, *::before, *::after { box-sizing: border-box; margin: 0; -webkit-tap-highlight-color: transparent; }
/* замок экрана: страница не прокручивается и не тянется, прокручивается только #view (уроки MBGuitars, ВебПриёмки) */
html, body { position: fixed; inset: 0; overflow: hidden; max-width: 100%; overscroll-behavior: none; background: var(--bg);
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
:root { color-scheme: dark; } html.t-light { color-scheme: light; }
body { touch-action: manipulation; }
button, [role=button], [role=checkbox] { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
  font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font: inherit; font-size: 16px; color: var(--text); }
:root { --bar: 52px; --tab: 62px;
  /* верх: вырез iPhone и шапка полноэкранного Telegram; низ: полоска «Домой» не больше 10 px (в PWA iOS даёт 34 — мёртвая полоса) */
  --st: max(env(safe-area-inset-top, 0px), var(--tg-content-safe-area-inset-top, 0px));
  --sb: calc(min(max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px)), 10px) + var(--tg-content-safe-area-inset-bottom, 0px));
  --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px);
  --appvh: var(--tg-viewport-stable-height, 100dvh); }

#app { position: fixed; left: 0; right: 0; top: 0; height: var(--appvh); display: flex; flex-direction: column; overflow: hidden; overflow-x: clip; }
[hidden] { display: none !important; }
.bar { flex: none; z-index: 20; height: calc(var(--bar) + var(--st)); padding: var(--st) calc(var(--pad) + var(--sr)) 0 calc(var(--pad) + var(--sl));
  display: flex; align-items: center; gap: 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
.bar .brand { flex: 1; display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.brand b { font: 700 22px/1 var(--f-disp); letter-spacing: .06em; }
.brand span { font: 500 11px/1 var(--f-disp); letter-spacing: .22em; color: var(--mute); }
.brand .mark { width: 10px; height: 10px; background: var(--acc); transform: rotate(45deg); align-self: center; margin-right: 2px; flex: none; }
.bar-title { flex: 1; min-width: 0; font: 600 15px/1 var(--f-disp); text-transform: uppercase; letter-spacing: .08em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-r { display: flex; gap: 6px; justify-content: flex-end; }
.icn { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: var(--r-btn); display: grid; place-items: center; color: var(--text); flex: none; }
.icn:active { background: var(--surf2); }

.view { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; width: 100%; padding: 16px calc(var(--pad) + var(--sr)) calc(var(--tab) + var(--sb) + 24px) calc(var(--pad) + var(--sl)); }
body.no-tabs .view { padding-bottom: calc(96px + var(--sb)); }
.view > * + * { margin-top: 14px; }
.h1 { font: 700 clamp(26px, 8.4vw, 34px)/1.02 var(--f-disp); text-transform: uppercase; letter-spacing: .01em; overflow-wrap: normal; }
.h2 { font: 600 var(--h3)/1.1 var(--f-disp); text-transform: uppercase; letter-spacing: .06em; }
.lead { color: var(--mute); font-size: 15px; }
.muted { color: var(--mute); }
.small { font-size: 13px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stack { display: grid; gap: 10px; }

/* герой: место под кадр (Higgsfield) — пока графитовая сталь с отсветом фар */
.hero { position: relative; border-radius: 14px; overflow: hidden; min-height: 210px; padding: 18px; display: flex; flex-direction: column; justify-content: flex-end;
  background: radial-gradient(120% 80% at 82% 22%, rgba(255, 214, 140, .22), transparent 55%), linear-gradient(160deg, #23262B, #0E0F11); color: #ECE6D8; }
.t-light .hero { background: radial-gradient(120% 80% at 82% 22%, rgba(255, 214, 140, .35), transparent 55%), linear-gradient(160deg, #3A3D42, #1C1E22); }
.hero::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(135deg, rgba(255,255,255,.035) 0 14px, transparent 14px 28px); pointer-events: none; }
.hero > * { position: relative; z-index: 1; }
.hero .h1 { color: #ECE6D8; }
.hero p { margin-top: 8px; color: rgba(236, 230, 216, .78); font-size: 14px; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.spec { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--r-card); padding: 14px 6px; text-align: center; }
.spec div + div { border-left: 1px solid var(--line); }
.spec b { display: block; font: 600 20px/1 var(--f-disp); }
.spec small { color: var(--mute); font-size: 11px; }

/* шаги анкеты */
.steps { display: flex; gap: 6px; }
.steps i { flex: 1; height: 3px; border-radius: 2px; background: var(--line); }
.steps i.on { background: var(--acc); }
.opt { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; padding: 14px 16px; min-height: 56px;
  background: var(--surf); border: 1px solid var(--line); border-radius: var(--r-card); }
.opt .rd { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line); flex: none; display: grid; place-items: center; }
.opt.on { border-color: var(--acc); box-shadow: inset 0 0 0 1px var(--acc); }
.opt.on .rd { border-color: var(--acc); }
.opt.on .rd::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--acc); }
.opt small { display: block; color: var(--mute); font-size: 12px; }
.opt .tor-icon { color: var(--acc-text); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 9px 14px; border-radius: var(--r-btn); border: 1px solid var(--line); background: var(--surf); font: 600 13px/1 var(--f-disp); text-transform: uppercase; letter-spacing: .05em; }
.chip.on { border-color: var(--acc); color: var(--acc-text); box-shadow: inset 0 0 0 1px var(--acc); }

.field { display: grid; gap: 6px; }
.field label { font-size: 13px; color: var(--mute); }
.inp { width: 100%; height: 50px; padding: 0 14px; border-radius: var(--r-btn); border: 1px solid var(--line); background: var(--surf); outline: none; }
.inp:focus { border-color: var(--acc); }
.sugg { display: grid; gap: 6px; }
.sugg button { text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--surf); font-size: 14px; }
.pt { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: start; padding: 12px 14px; background: var(--surf); border: 1px solid var(--line); border-radius: var(--r-card); }
.pt .m { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 600 13px/1 var(--f-disp); border: 1px solid var(--acc-text); color: var(--acc-text); }
.pt .m.b { background: var(--acc); color: var(--acc-ink); border-color: var(--acc); }
.pt b { display: block; font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.pt small { color: var(--mute); font-size: 12px; }
.pt .x { color: var(--mute); padding: 2px; }

/* карта */
.map { height: 230px; border-radius: var(--r-card); overflow: hidden; border: 1px solid var(--line); background: var(--surf2); position: relative; }
.map .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--mute); font-size: 13px; }
.mpin { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 600 14px/1 var(--f-disp);
  border: 2px solid var(--acc); background: var(--bg); color: var(--acc-text); box-shadow: 0 2px 10px rgba(0,0,0,.4); }
.mpin.b { background: var(--acc); color: var(--acc-ink); }
.mpin.tr { background: var(--acc); border-color: var(--acc-ink); width: 34px; height: 34px; }
.mpin.tr svg { width: 20px; height: 20px; stroke: var(--acc-ink); }
.mpin.base { border-style: dashed; color: var(--text); }
.maplibregl-ctrl-attrib { font-size: 9px !important; }

.sticky { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; padding: 12px calc(var(--pad) + var(--sr)) calc(12px + var(--sb)) calc(var(--pad) + var(--sl));
  background: var(--bg); border-top: 1px solid var(--line); display: grid; gap: 8px; grid-auto-flow: column; grid-auto-columns: 1fr; }
.sticky .tor-btn--secondary { flex: 0; }
.note { padding: 12px 14px; border-radius: var(--r-card); background: var(--acc-soft); font-size: 13px; display: flex; gap: 10px; }
.note .tor-icon { color: var(--acc-text); width: 20px; height: 20px; }
.err { padding: 12px 14px; border-radius: var(--r-card); border: 1px solid var(--warn); color: var(--warn); font-size: 14px; }

/* заявки */
.ocard { background: var(--surf); border: 1px solid var(--line); border-radius: var(--r-card); padding: 14px 16px; display: grid; gap: 6px; text-align: left; width: 100%; }
.ocard .top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.ocard .sum { font: 700 20px/1 var(--f-disp); white-space: nowrap; }
.badge { display: inline-block; font: 600 11px/1 var(--f-disp); letter-spacing: .08em; text-transform: uppercase; color: var(--acc-text); border: 1px solid var(--acc-text); padding: 5px 8px; border-radius: 6px; }
.eta { display: flex; justify-content: space-between; align-items: end; }
.eta b { font: 700 48px/.9 var(--f-disp); }
.eta b small { font-size: 20px; margin-left: 4px; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: var(--bg); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(4, 1fr); padding: 6px calc(6px + var(--sr)) calc(6px + var(--sb)) calc(6px + var(--sl)); }
.tabs button { display: grid; justify-items: center; gap: 3px; font-size: 11px; color: var(--mute); padding: 4px 0; }
.tabs button.on { color: var(--acc-text); }
body.no-tabs .tabs { display: none; }

.sheet-bg { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.5); }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 86dvh; overflow: auto; overscroll-behavior: contain;
  background: var(--bg); border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; padding: 10px calc(var(--pad) + var(--sr)) calc(18px + var(--sb)) calc(var(--pad) + var(--sl)); }
.sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 14px; }
.sheet > * + * { margin-top: 12px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg button { display: flex; align-items: center; justify-content: center; gap: 6px; height: 44px; border-radius: var(--r-btn); border: 1px solid var(--line); background: var(--surf); font-size: 14px; }
.seg button.on { border-color: var(--acc); color: var(--acc-text); box-shadow: inset 0 0 0 1px var(--acc); }
.toast { position: fixed; left: 50%; bottom: calc(var(--tab) + var(--sb) + 14px); transform: translate(-50%, 20px); opacity: 0; z-index: 50; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: calc(100vw - 32px); transition: .2s; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.credit { text-align: center; font-size: 10px; color: var(--mute); opacity: .8; padding-top: 6px; }
.skel { height: 64px; border-radius: var(--r-card); background: linear-gradient(90deg, var(--surf) 0, var(--surf2) 50%, var(--surf) 100%); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }
@media (hover: hover) and (pointer: fine) { .tor-btn--primary:hover { filter: brightness(1.06); } .opt:hover, .chip:hover { border-color: var(--acc-text); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
/* широкий экран (Telegram Desktop, браузер) — колонка приложения по центру с полями, не растягиваем телефонный UI */
@media (min-width: 640px) { .view { max-width: 560px; margin: 0 auto; } .tabs, .sticky { max-width: 560px; margin: 0 auto; border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }

/* согласие на обработку данных — свой чекбокс (глобальный appearance:none убивал галочку на iOS) */
.ck { display: flex; gap: 12px; align-items: flex-start; text-align: left; font-size: 13px; color: var(--mute); min-height: 44px; }
.ck i { width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--line); flex: none; display: grid; place-items: center; margin-top: 1px; }
.ck[aria-checked=true] i { background: var(--acc); border-color: var(--acc); }
.ck[aria-checked=true] i::after { content: ""; width: 10px; height: 6px; border: 2px solid var(--acc-ink); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.tor-btn:disabled { opacity: .45; }
.map { touch-action: none; }
.pick-wrap { position: relative; }
.pick-cross { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -100%); pointer-events: none; }
.pick-cross i { display: block; width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--acc); border: 2px solid var(--acc-ink); box-shadow: 0 4px 10px rgba(0,0,0,.4); }
