/* ============ DESE — Транспорт. Демо-интерфейс ============ */

:root {
  --bg: #F4F7FB;
  --card: #FFFFFF;
  --ink: #0F172A;
  --ink-2: #334155;
  --muted: #64748B;
  --muted-2: #94A3B8;
  --line: #E8EDF4;
  --line-2: #F1F5F9;
  --glass: rgba(255, 255, 255, .96);
  --blue: #2563EB;
  --blue-soft: #EAF1FE;
  --green: #16A34A;
  --violet: #7C3AED;
  --amber: #F59E0B;
  --red: #EF4444;
  --shadow: 0 6px 24px rgba(15, 23, 42, .06);
  --shadow-2: 0 10px 34px rgba(15, 23, 42, .10);
  --r-lg: 22px;
  --r-md: 18px;
  --r-sm: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: #DDE4EE;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex; align-items: center; justify-content: center;
}

/* ---------- корпус телефона ---------- */
.phone {
  position: relative;
  width: 430px; height: 932px;
  max-width: 100vw; max-height: 100vh;
  background: var(--bg);
  border-radius: 46px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, .28);
  display: flex; flex-direction: column;
  overflow: hidden;
}

@media (max-width: 520px), (max-height: 940px) {
  .phone { width: 100vw; height: 100vh; border-radius: 0; box-shadow: none; }
}

/* ---------- статус-бар ---------- */
.statusbar {
  flex: 0 0 auto;
  height: 52px; padding: 0 30px 0 34px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 17px; font-weight: 600; color: var(--ink);
  background: var(--bg);
}
.sb-right { display: flex; align-items: center; gap: 6px; }
.sb-batt {
  width: 25px; height: 12px; border: 1.6px solid var(--ink); border-radius: 3.5px;
  position: relative; display: inline-block; padding: 1.4px;
}
.sb-batt::after {
  content: ''; position: absolute; right: -3.6px; top: 3.4px;
  width: 2px; height: 4px; background: var(--ink); border-radius: 0 2px 2px 0;
}
.sb-batt i { display: block; height: 100%; width: 100%; background: var(--ink); border-radius: 1.6px; }

/* ---------- контент ---------- */
.app {
  flex: 1 1 auto; overflow-y: auto; overflow-x: hidden;
  background: var(--bg);
  -webkit-overflow-scrolling: touch;
}
.app.no-scroll { overflow: hidden; }
.app::-webkit-scrollbar { width: 0; }

.pad { padding: 0 20px; }
.pb { padding-bottom: 24px; }

/* ---------- полоса под системные часы ----------
   В оболочке на Android окно рисуется под строкой состояния — там часы
   и значки сети. Синяя полоса той же высоты подкладывает им свой фон,
   а содержимое опускается ниже. В браузере высота нулевая, полосы нет. */
.phone::before {
  content: '';
  flex: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  background: var(--blue);
}

/* ---------- шапка экрана ---------- */
/*
| Шапка не уезжает при прокрутке: на длинных списках остановок человек
| терял и название маршрута, и кнопку «назад».
*/
.topbar {
  position: sticky; top: 0; z-index: 400;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; gap: 12px;
  background: var(--blue); color: #fff;
}
.topbar .tb-title {
  flex: 1 1 auto; text-align: center;
  font-size: 22px; font-weight: 800; letter-spacing: -.2px;
  color: #fff;
}
.topbar .tb-title.left { flex: 0 0 auto; text-align: left; }

/* Выбранный город и район — в шапке главной, на месте бывшего меню. */
.tb-place {
  flex: 1 1 auto; min-width: 0; justify-self: center;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  border: 0; border-radius: 999px; padding: 7px 10px;
  background: rgba(255, 255, 255, .16); color: #fff;
  font-size: 13px; font-weight: 700; line-height: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.tb-place.one { background: transparent; cursor: default; opacity: .9; }
.tb-place svg { flex: none; opacity: .85; }

/* Кнопки в шапке — белые: на синем фоне синие были бы не видны. */
.topbar .iconbtn,
.topbar .iconbtn.ghost { color: #fff; }
.topbar .iconbtn.round { background: rgba(255, 255, 255, .16); color: #fff; }
.iconbtn {
  flex: 0 0 auto; width: 42px; height: 42px; border: 0; padding: 0;
  background: transparent; color: var(--blue);
  display: grid; place-items: center; cursor: pointer; border-radius: 50%;
}
.iconbtn:active { background: rgba(37, 99, 235, .08); }
.iconbtn.round {
  background: var(--card); box-shadow: var(--shadow); width: 44px; height: 44px;
}
.iconbtn.ghost { color: var(--ink); }
.iconbtn.star.on { color: var(--amber); }

/* ---------- заголовок ---------- */
.hero { padding: 12px 20px 20px; }
.hero h1 { margin: 0; font-size: 32px; line-height: 1.15; font-weight: 800; letter-spacing: -.8px; }
.hero p { margin: 8px 0 0; font-size: 17px; color: var(--muted); }

.sec-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 20px 12px;
}
.sec-title h2 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.3px; }
.sec-title a { font-size: 14px; font-weight: 600; color: var(--blue); text-decoration: none; }

/* ---------- 3 карточки разделов ---------- */
.cards {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  padding: 0 20px;
}
.tcard {
  position: relative; border: 0; padding: 16px 10px 18px; cursor: pointer;
  border-radius: var(--r-lg); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font: inherit; color: var(--ink);
  transition: transform .15s ease, box-shadow .15s ease;
}
.tcard:active { transform: scale(.97); }
.tcard .tc-art { width: 100%; height: 92px; display: grid; place-items: center; }
.tcard .tc-art svg { width: 100%; height: 100%; }
.tcard .tc-title { font-size: 17px; font-weight: 800; letter-spacing: -.3px; }
.tcard .tc-sub { font-size: 12.5px; line-height: 1.35; color: var(--muted); min-height: 34px; }
.tcard .tc-go {
  margin-top: 4px; width: 38px; height: 38px; border-radius: 50%;
  background: var(--card); display: grid; place-items: center;
  box-shadow: 0 3px 10px rgba(15, 23, 42, .10);
}
.tcard .tc-badge {
  position: absolute; top: 10px; right: 10px;
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  background: rgba(255, 255, 255, .85); color: #334155;
}

/* ---------- поиск ---------- */
.searchbar {
  margin: 20px 20px 0; background: var(--card); border-radius: var(--r-md);
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px;
  padding: 0 8px 0 18px; height: 62px;
}
.searchbar svg { color: var(--muted-2); flex: 0 0 auto; }
.searchbar input {
  flex: 1 1 auto; border: 0; outline: 0; background: transparent;
  font-size: 16.5px; color: var(--ink); min-width: 0;
}
.searchbar input::placeholder { color: var(--muted-2); }
.searchbar .sep { width: 1px; height: 30px; background: var(--line); flex: 0 0 auto; }

/* ---------- подсказка ---------- */
.hint {
  margin: 16px 20px 0; background: var(--blue-soft); border-radius: var(--r-md);
  padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start;
  font-size: 14.5px; line-height: 1.45; color: var(--ink-2);
}
.hint svg { flex: 0 0 auto; color: var(--blue); margin-top: 1px; }

/* ---------- сводка «на линии» ---------- */
.live-card {
  margin: 16px 20px 0; background: var(--card); border-radius: var(--r-md);
  box-shadow: var(--shadow); padding: 16px 18px;
}
.live-head { display: flex; align-items: center; gap: 10px; }
.live-head .lh-title { font-size: 16px; font-weight: 800; flex: 1 1 auto; }
.live-head .lh-go { color: var(--muted-2); }
.dot-live {
  width: 9px; height: 9px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 0 rgba(22, 163, 74, .5); animation: pulse 1.8s infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

/* ---------- фильтр-табы ---------- */
.chips { display: flex; gap: 8px; padding: 4px 20px 4px; overflow-x: auto; }
.chips::-webkit-scrollbar { height: 0; }
.chip {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 9px 16px; font: inherit; font-size: 14px;
  font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ---------- список маршрутов ---------- */
.list { padding: 12px 20px 0; display: flex; flex-direction: column; gap: 10px; }
.rrow {
  background: var(--card); border-radius: var(--r-md); box-shadow: var(--shadow);
  padding: 14px 14px; display: flex; align-items: center; gap: 14px; cursor: pointer;
  border: 0; font: inherit; color: inherit; text-align: left; width: 100%;
}
.rrow:active { transform: scale(.995); }
/* Район без маршрутов: виден, но нажать нечего. */
.rrow.off { opacity: .5; cursor: default; box-shadow: none; }
.rrow.off:active { transform: none; }
.badge-num {
  flex: 0 0 auto; min-width: 52px; height: 52px; border-radius: 15px;
  display: grid; place-items: center; color: #fff;
  font-size: 20px; font-weight: 800; letter-spacing: -.5px; padding: 0 8px;
}
.badge-num.sm { min-width: 42px; height: 42px; border-radius: 12px; font-size: 16px; }
.rrow .r-body { flex: 1 1 auto; min-width: 0; }
.rrow .r-dir { font-size: 15.5px; font-weight: 700; letter-spacing: -.2px; }
.rrow .r-dir span { color: var(--muted-2); font-weight: 600; margin: 0 4px; }
.rrow .r-meta { margin-top: 4px; font-size: 13px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.rrow .r-meta i { font-style: normal; display: inline-flex; align-items: center; gap: 4px; }
.onair { color: var(--green); font-weight: 700; }
.offair { color: var(--muted-2); font-weight: 600; }
.rrow .r-go { color: var(--muted-2); flex: 0 0 auto; }

.empty { padding: 60px 30px; text-align: center; color: var(--muted); }
.empty svg { color: #CBD5E1; margin-bottom: 14px; }
.empty b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 6px; }

/* ---------- карточка маршрута ---------- */
.info-card {
  margin: 8px 20px 0; background: var(--card); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 18px;
}
.ic-top { display: flex; gap: 14px; align-items: flex-start; }
.ic-top .ic-text { flex: 1 1 auto; min-width: 0; padding-top: 2px; }
.ic-dir { display: block; font-size: 19px; font-weight: 800; letter-spacing: -.4px; line-height: 1.25; }
.ic-dir span { color: var(--muted-2); margin: 0 6px; font-weight: 700; }
.ic-sub { display: block; margin-top: 6px; font-size: 14px; color: var(--muted); }
.ic-sub b { color: var(--ink-2); font-weight: 600; }
.ic-sub em { font-style: normal; color: var(--muted-2); margin: 0 7px; }

.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line);
}
.stat { text-align: center; }
.stat .st-ico { color: var(--muted); display: grid; place-items: center; height: 24px; }
.stat .st-lbl { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.stat .st-val { font-size: 14px; font-weight: 800; margin-top: 2px; letter-spacing: -.2px; }

/* ---------- остановки ---------- */
.stops-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 20px 12px; gap: 10px;
}
.stops-head h2 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.3px; }
.dir-toggle {
  display: flex; align-items: center; gap: 8px; border: 0; background: transparent;
  color: var(--blue); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
  padding: 0;
}
.dir-toggle .dt-ico {
  width: 32px; height: 32px; border-radius: 10px; background: var(--card);
  box-shadow: var(--shadow); display: grid; place-items: center;
}

.stops {
  margin: 0 20px; background: var(--card); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 6px 16px 6px 0; overflow: hidden;
}
.stop {
  display: flex; align-items: center; gap: 14px; padding: 0;
  border: 0; background: transparent; width: 100%; font: inherit; color: inherit;
  text-align: left; cursor: pointer; position: relative;
}
.stop .s-rail { flex: 0 0 auto; width: 56px; align-self: stretch; position: relative; }
.stop .s-rail::before,
.stop .s-rail::after {
  content: ''; position: absolute; left: 27px; width: 2px; background: var(--blue);
}
.stop .s-rail::before { top: 0; height: 50%; }
.stop .s-rail::after { bottom: 0; height: 50%; }
.stop:first-child .s-rail::before { display: none; }
.stop:last-child .s-rail::after { display: none; }
.stop.dashed-next .s-rail::after {
  background: repeating-linear-gradient(to bottom, var(--blue) 0 5px, transparent 5px 10px);
}
.stop .s-dot {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; z-index: 1; line-height: 0;
}
.stop .s-dot svg { display: block; filter: drop-shadow(0 1px 2px rgba(15, 23, 42, .25)); }

.stop .s-body { flex: 1 1 auto; min-width: 0; padding: 15px 0; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.stop:last-child .s-body { border-bottom: 0; }
.stop .s-name { flex: 1 1 auto; min-width: 0; }
.stop .s-name b { display: block; font-size: 16px; font-weight: 700; letter-spacing: -.2px; }
.stop .s-name small { display: block; font-size: 13px; color: var(--muted); margin-top: 3px; }
.stop .s-num {
  flex: 0 0 auto; min-width: 40px; height: 34px; border-radius: 10px;
  background: var(--blue-soft); color: var(--blue);
  display: grid; place-items: center; font-size: 15px; font-weight: 700;
}
.stop .s-go { flex: 0 0 auto; color: var(--muted-2); }
.stop .s-eta {
  flex: 0 0 auto; font-size: 12px; font-weight: 700; color: var(--green);
  background: #E8F6EC; border-radius: 8px; padding: 4px 8px;
}


/* ---------- карта ---------- */
.mapwrap { position: relative; height: 100%; display: flex; flex-direction: column; }
.map { flex: 1 1 auto; width: 100%; background: #E8EDF4; z-index: 0; }
.leaflet-container { font-family: inherit; }
.leaflet-control-attribution { font-size: 10px; }
.map-topbar {
  position: absolute; top: 10px; left: 12px; right: 12px; z-index: 500;
  display: flex; align-items: center; gap: 10px;
}
.map-topbar .mt-title {
  flex: 1 1 auto; background: var(--card); border-radius: 14px; box-shadow: var(--shadow-2);
  padding: 11px 16px; font-size: 15.5px; font-weight: 800; letter-spacing: -.2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.map-topbar .iconbtn.round { box-shadow: var(--shadow-2); }

/* На карте своя шапка поверх тайлов: её опускаем на ту же высоту. */
.map-topbar { padding-top: calc(10px + env(safe-area-inset-top, 0px)); }

/*
| Лист с бортами занимает три четверти экрана: в списке бывает десяток
| машин, а раньше было видно две с половиной. Нажатие на ручку или на
| заголовок сворачивает его к одной строке, открывая карту целиком.
*/
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 500;
  background: var(--card); border-radius: 24px 24px 0 0; box-shadow: 0 -8px 30px rgba(15, 23, 42, .14);
  /* Снизу добавляем системную полосу: иначе последняя строка списка
     уходит под кнопки «назад — домой — обзор» и её не прочитать. */
  padding: 10px 0 calc(14px + env(safe-area-inset-bottom, 0px));
  max-height: 54%; display: flex; flex-direction: column;
  transition: max-height .25s ease;
}
/* Развёрнутый — когда человек сам потянул за ручку. */
.sheet.full { max-height: 86%; }
.sheet.shut { max-height: calc(74px + env(safe-area-inset-bottom, 0px)); }

/*
| Крестик посередине карты на экране выбора точки: куда его навели,
| оттуда и считаются остановки. Насквозь для нажатий — карта под ним
| должна двигаться как обычно.
*/
.pick-pin {
  position: absolute; left: 50%; top: 40%; z-index: 450;
  transform: translate(-50%, -100%); pointer-events: none;
  color: var(--blue); filter: drop-shadow(0 2px 4px rgba(15, 23, 42, .35));
  transition: top .25s ease;
}

/* Кнопки «открыть в навигаторе» на экране пешего пути. */
.walk-nav {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  padding: 10px 18px 0; flex-wrap: wrap;
}
.wn-label { font-size: 12.5px; color: var(--muted); margin-right: auto; }
.wn-btn {
  text-decoration: none; font-size: 13px; font-weight: 700; color: var(--blue);
  background: var(--blue-soft, #EAF1FE); border-radius: 999px; padding: 7px 14px;
}

/* Пусто — так и пишем, чтобы лист не выглядел сломанным. */
.near-empty { padding: 18px; text-align: center; font-size: 13.5px; color: var(--muted); }

/*
| Выходы из пустой карточки. В строку они не помещаются: по-каракалпакски
| подписи длинные и ломались на две строки разной высоты. Поэтому друг
| под другом, во всю ширину, одинаковые.
*/
.near-acts { display: flex; flex-direction: column; gap: 8px; padding: 2px 0 2px; }
.near-acts .near-btn { margin: 0 18px; width: calc(100% - 36px); white-space: nowrap; }
.near-acts .near-btn:last-child { margin-bottom: 16px; }
.near-btn.ghost { background: transparent; color: var(--muted); }
.near-btn.ghost:active { background: var(--blue-soft); }

/*
| Карта-картинка в карточке «остановки рядом»: видно, где человек
| и что вокруг. Нажатие открывает экран, где точку можно подвинуть.
| Жесты у неё выключены — иначе она перехватывала бы прокрутку главной.
*/
.near-map {
  display: block; position: relative; width: 100%; height: 128px;
  margin: 10px 0 2px; padding: 0; border: 0; border-radius: 14px;
  overflow: hidden; cursor: pointer; background: #E2E8F0;
}
.near-map #nearmap { position: absolute; inset: 0; display: block; }
.near-map .nm-hint {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); z-index: 500;
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
  background: rgba(255, 255, 255, .94); color: var(--blue);
  border-radius: 999px; padding: 6px 12px; font-size: 12.5px; font-weight: 700;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .18);
}

/* Подсказка, что карта сворачивает список. */
.sheet .sh-hint {
  flex: 0 0 auto; padding: 0 18px 8px; font-size: 11.5px; color: var(--muted-2);
  display: flex; align-items: center; gap: 6px;
}
.sheet.shut .sh-hint { display: none; }
.sheet.shut .sh-body { opacity: 0; }
.sheet .sh-grip {
  width: 48px; height: 5px; border-radius: 3px; background: #E2E8F0;
  margin: 0 auto 10px; border: 0; padding: 0; display: block; cursor: pointer;
}
.sheet .sh-head { cursor: pointer; }
.sheet .sh-head { padding: 0 18px 10px; display: flex; align-items: center; gap: 10px; }
.sheet .sh-head b { font-size: 16px; font-weight: 800; flex: 1 1 auto; }
.sheet .sh-body { overflow-y: auto; padding: 0 14px; }
.sheet .sh-body::-webkit-scrollbar { width: 0; }

.vrow {
  display: flex; align-items: center; gap: 12px; padding: 11px 6px;
  border-bottom: 1px solid var(--line); cursor: pointer; width: 100%;
  border-left: 0; border-right: 0; border-top: 0; background: transparent; font: inherit;
  text-align: left; color: inherit;
}
.vrow:last-child { border-bottom: 0; }
.vrow .v-body { flex: 1 1 auto; min-width: 0; }
.vrow .v-plate { font-size: 15px; font-weight: 700; letter-spacing: -.2px; }
.vrow .v-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.vrow .v-right { flex: 0 0 auto; text-align: right; }
.vrow .v-eta { font-size: 14px; font-weight: 800; color: var(--green); }
.vrow .v-eta.off { color: var(--muted-2); }
.vrow .v-sub { font-size: 11.5px; color: var(--muted-2); margin-top: 2px; }

/*
| Полоска слежения на карточке маршрута: за каким бортом смотрим,
| сколько ему осталось до ближайшей остановки. Появляется, когда борт
| выбран на карте, и уводит внимание к списку остановок ниже.
*/
.track-card {
  margin: 14px 16px 0; padding: 12px 14px; border-radius: 16px;
  background: var(--card); box-shadow: var(--shadow);
}
.tr-top { display: flex; align-items: center; gap: 8px; }
.tr-plate { flex: 1 1 auto; font-size: 15px; font-weight: 800; letter-spacing: -.2px; }
.tr-state { font-size: 13px; color: var(--text); margin-top: 8px; font-weight: 600; }
.tr-close { flex: none; width: 28px; height: 28px; border: 0; background: transparent; color: var(--muted-2); }
.tr-bar {
  height: 6px; border-radius: 3px; background: #E2E8F0; margin: 10px 0 8px; overflow: hidden;
}
.tr-bar i { display: block; height: 100%; border-radius: 3px; transition: width .6s linear; }
.tr-next { font-size: 13px; color: var(--muted); }

/* Остановки под слежением: пройденные гаснут, ближайшая мигает. */
.stop.done .s-name b { color: var(--muted-2); }
.stop.now .s-name b { font-weight: 800; }
.stop.now .s-dot { animation: vs-blink 1.1s ease-in-out infinite; }
@keyframes vs-blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(1.4); }
}
@media (prefers-reduced-motion: reduce) {
  .stop.now .s-dot { animation: none; }
}


/* маркеры транспорта */
.veh-marker { width: 48px; height: 48px; position: relative; }

/*
| Кружок с носом по курсу — одна фигура. Поворачивается только она;
| автобус внутри и номер под меткой стоят прямо.
*/
.vm-pin {
  position: absolute; inset: 0; transform-origin: 50% 50%;
  filter: drop-shadow(0 2px 3px rgba(15, 23, 42, .4));
}
.vm-pin svg { display: block; }
.vm-bus {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  line-height: 0; pointer-events: none;
}
.vm-bus svg { display: block; }

/* Номер маршрута — отдельной плашкой под меткой: не режется даже у «24А». */
.vm-num {
  position: absolute; left: 50%; top: 42px; transform: translateX(-50%);
  padding: 2px 6px; border-radius: 8px; background: #fff; white-space: nowrap;
  font-size: 11.5px; font-weight: 800; line-height: 1.1;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .35);
}
.veh-marker.off { opacity: .45; }
/* Знак остановки на столбике: табличка сверху, стойка, точка у земли. */
.stop-marker { position: relative; line-height: 0; }
.stop-marker svg { position: relative; display: block; filter: drop-shadow(0 2px 3px rgba(15, 23, 42, .4)); }
.stop-marker .sm-pole {
  position: absolute; left: 50%; bottom: 3px; width: 3px; height: 45%;
  margin-left: -1.5px; border-radius: 2px; background: #475569;
}
.stop-marker .sm-foot {
  position: absolute; left: 50%; bottom: 0; width: 7px; height: 7px; margin-left: -3.5px;
  border-radius: 50%; background: #475569; box-shadow: 0 0 0 1.5px #fff;
}
.stop-marker .sm-term {
  position: absolute; left: 3px; right: 3px; top: 62%; height: 4px; border-radius: 2px;
  box-shadow: 0 0 0 1.5px #fff;
}
.leaflet-div-icon { background: transparent; border: 0; }

.legend {
  position: absolute; left: 12px; bottom: 12px; z-index: 500;
  background: rgba(255, 255, 255, .95); color: #0F172A; border-radius: 12px; box-shadow: var(--shadow);
  padding: 8px 12px; font-size: 12px; display: flex; flex-direction: column; gap: 5px;
}
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; }

/* ---------- уведомления ---------- */
.note {
  background: var(--card); border-radius: var(--r-md); box-shadow: var(--shadow);
  padding: 15px 16px; display: flex; gap: 13px; align-items: flex-start;
}
.note .n-ico { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.note .n-body { flex: 1 1 auto; min-width: 0; }
.note .n-title { font-size: 15.5px; font-weight: 700; }
.note .n-text { font-size: 13.5px; color: var(--muted); margin-top: 4px; line-height: 1.45; }
.note .n-time { font-size: 12px; color: var(--muted-2); margin-top: 7px; }
.note.unread { border-left: 3px solid var(--blue); }

/* ---------- настройки ---------- */
.group { margin: 0 20px 14px; background: var(--card); border-radius: var(--r-md); box-shadow: var(--shadow); overflow: hidden; }
.group .g-cap { padding: 14px 18px 6px; font-size: 12.5px; font-weight: 700; color: var(--muted-2); text-transform: uppercase; letter-spacing: .4px; }
.srow { display: flex; align-items: center; gap: 13px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.srow:last-child { border-bottom: 0; }
.srow .s-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 auto; }
.srow .s-txt { flex: 1 1 auto; font-size: 15.5px; font-weight: 600; }
.srow .s-val { font-size: 14px; color: var(--muted); }
.srow .s-txt small { display: block; margin-top: 2px; font-size: 12.5px; font-weight: 500; color: var(--muted); line-height: 1.35; }
.switch { width: 46px; height: 28px; border-radius: 999px; background: #E2E8F0; position: relative; cursor: pointer; flex: 0 0 auto; transition: background .18s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.2); transition: transform .18s; }
.switch.on { background: var(--blue); }
.switch.on::after { transform: translateX(18px); }

.profile-head { display: flex; align-items: center; gap: 14px; margin: 8px 20px 18px; }
.avatar { width: 62px; height: 62px; border-radius: 50%; background: var(--blue-soft); display: grid; place-items: center; color: var(--blue); flex: 0 0 auto; }
.profile-head .ph-name { font-size: 19px; font-weight: 800; }
.profile-head .ph-sub { font-size: 14px; color: var(--muted); margin-top: 3px; }

/* ---------- нижнее меню ---------- */
/* Вкладки делят ширину поровну, сколько бы их ни было: при жёсткой
   сетке на пять колонок четыре вкладки оставляли пустое место справа. */
.tabbar {
  flex: 0 0 auto; height: 84px; background: var(--glass);
  backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  display: flex; padding-bottom: 14px;
}
.tab {
  flex: 1 1 0; min-width: 0;
  border: 0; background: transparent; cursor: pointer; font: inherit;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--muted-2); padding: 8px 2px 0;
}
.tab span { font-size: 11.5px; font-weight: 600; letter-spacing: -.1px; }
.tab.on { color: var(--blue); }
.tab.on span { font-weight: 700; }
.tabbar.hidden { display: none; }

/* ---------- служебное ---------- */
.fade-in { animation: fade .22s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.screen { min-height: 100%; display: flex; flex-direction: column; }
.spacer { flex: 1 1 auto; }

/* ---------- блочные строки внутри строчных контейнеров ---------- */
.rrow .r-body, .rrow .r-dir,
.vrow .v-body, .vrow .v-plate, .vrow .v-meta, .vrow .v-right, .vrow .v-eta, .vrow .v-sub,
.note .n-body, .note .n-title, .note .n-text, .note .n-time,
.stop .s-body, .stop .s-name,
.info-card .ic-text { display: block; }

.rrow .r-meta { display: flex; }
.stop .s-body { display: flex; }
.vrow .v-right { text-align: right; }

/* ---------- нижняя шторка на карте ---------- */
.sheet .sh-grip, .sheet .sh-head, .sheet .chips { flex: 0 0 auto; }
.sheet .sh-body { flex: 1 1 auto; min-height: 0; }
.legend { left: auto; right: 12px; bottom: auto; top: 66px; }

/* ---------- реальный телефон: убираем макетный статус-бар ---------- */
@media (max-width: 520px), (max-height: 940px) {
  .phone { height: 100vh; height: 100dvh; }
}
@media (max-width: 520px) and (pointer: coarse) {
  .statusbar { display: none; }
  .topbar { padding-top: 10px; }
  .tabbar { padding-bottom: calc(14px + env(safe-area-inset-bottom)); height: auto; min-height: 84px; }
}

/* ---------- карточки разделов: иллюстрация без внутренней плашки ---------- */
.tcard { padding: 14px 8px 18px; gap: 4px; }
.tcard .tc-art { height: 104px; margin-bottom: 4px; }
.tcard .tc-art svg { width: 104%; height: 100%; overflow: visible; }
.tcard .tc-title { font-size: 16.5px; }
.tcard .tc-sub { font-size: 12px; min-height: 32px; }
.tcard .tc-go { margin-top: 8px; width: 36px; height: 36px; }
.tcard .tc-badge {
  top: 8px; right: 8px; font-size: 10.5px; font-weight: 700;
  padding: 3px 7px; background: rgba(255, 255, 255, .78);
  box-shadow: 0 1px 4px rgba(15, 23, 42, .07);
}

/* ---------- одинаковая высота карточек, стрелка прижата к низу ---------- */
.tcard .tc-sub { min-height: 0; }
.tcard .tc-go { margin-top: auto; }

/* ---------- карточки разделов: иллюстрация из макета во всю ширину ---------- */
.tcard { padding: 0 0 16px; gap: 0; overflow: hidden; }
.tcard .tc-art {
  width: 100%; height: auto; margin: 0 0 10px;
  display: block; aspect-ratio: auto;
}
.tcard .tc-art img { display: block; width: 100%; height: auto; }
.tcard .tc-title { padding: 0 8px; font-size: 16.5px; }
.tcard .tc-sub { padding: 0 8px; margin-top: 4px; font-size: 12px; }
.tcard .tc-go { margin-top: 14px; }
.tcard .tc-badge { top: 8px; right: 8px; }

/* Разделов на главной может остаться меньше трёх — например, если заведены
   только автобусы. Без ограничения ширины одна карточка растягивается
   на весь экран, и картинка в ней превращается в плакат. */
.cards .tcard { max-width: 240px; width: 100%; margin: 0 auto; }

/* ---------- счётчик «на линии» под подзаголовком, не поверх картинки ---------- */
.tcard .tc-badge { display: none; }
.tcard .tc-live {
  margin-top: 8px; padding: 0 8px; font-size: 11.5px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
}
.tcard .tc-live i { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; }
.tcard .tc-go { margin-top: 12px; }
.tcard .tc-sub { min-height: 48px; }

/* строка «На линии» на карточках разделов не нужна — счётчики живут в сводке */
.tcard .tc-live { display: none; }
.tcard .tc-go { margin-top: 14px; }

/* счётчик «На линии» на карточках разделов — снова показываем */
.tcard .tc-live { display: inline-flex; }
.tcard .tc-go { margin-top: 12px; }

/* Когда движение не отслеживается, вместо счётчика стоит целая фраза.
   Одной строкой она в карточку не влезает, а nowrap срезает её с двух
   сторон — на месте остаётся «жение не отслежива». Даём перенос. */
.tcard .tc-live.off {
  display: block; white-space: normal; text-align: center;
  line-height: 1.25; padding: 0 4px;
}

/*
| Кнопки на карточках разделов стоят в одну линию. Подписи под ними
| разной длины — где-то «31 на линии», где-то целая фраза в две строки,
| и стрелки разъезжались по высоте. Поэтому строка состояния занимает
| одинаковое место, а сама кнопка прижата к низу карточки.
*/
.tcard .tc-live,
.tcard .tc-live.off {
  min-height: 32px; display: flex; align-items: center; justify-content: center;
  white-space: normal; text-align: center; line-height: 1.2;
}
.tcard .tc-go { margin-top: auto; }

/* ---------- заставка на время загрузки справочника ---------- */
.boot {
  min-height: 60vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; padding: 40px 30px;
  text-align: center;
}
.boot-mark {
  width: 44px; height: 44px; border-radius: 50%;
  border: 3px solid var(--blue-soft); border-top-color: var(--blue);
  animation: boot-spin .9s linear infinite;
}
@keyframes boot-spin { to { transform: rotate(360deg); } }
.boot-title { font-size: 16px; font-weight: 700; color: var(--ink); }
.boot-sub { font-size: 13.5px; color: var(--muted); max-width: 260px; line-height: 1.45; }

/* ---------- кнопка «показать на карте» под строкой «на линии» ---------- */
.map-btn {
  margin: 12px 20px 0; width: calc(100% - 40px);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 15px 18px; border: 0; border-radius: var(--r-md);
  background: var(--blue); color: #fff; font: inherit; font-size: 16px; font-weight: 750;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .28); cursor: pointer;
}
.map-btn:active { transform: translateY(1px); filter: brightness(.96); }
.lh-work { margin-top: 8px; font-size: 13px; color: var(--muted); line-height: 1.45; }
.dot-live.off { animation: none; }
.sh-empty { padding: 18px 4px; color: var(--muted); font-size: 14px; text-align: center; }


/* ---------- полоса «нет сети» ---------- */
.offline-bar {
  flex: 0 0 auto;
  background: #FEF3C7; color: #92400E;
  font-size: 12.5px; font-weight: 650; text-align: center;
  padding: 7px 16px; border-top: 1px solid #FDE68A;
}
.offline-bar[hidden] { display: none !important; }

/* ---------- выбор языка в настройках ---------- */
.lang-row { cursor: pointer; }
.lang-row:active { background: var(--surface-2, #FAFBFE); }
.lang-row.on .s-txt { font-weight: 700; }

/* ---------- остановки рядом ---------- */
.near-card {
  margin: 16px 20px 0; background: var(--card); border-radius: var(--r-md);
  box-shadow: var(--shadow); overflow: hidden;
}
.near-head {
  display: flex; align-items: center; gap: 12px; padding: 16px 18px 12px;
  color: var(--blue);
}
.near-head b { display: block; font-size: 15.5px; font-weight: 800; color: var(--ink); letter-spacing: -.2px; }
.near-head small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.near-head > span { flex: 1 1 auto; min-width: 0; }
.near-refresh {
  flex: 0 0 auto; width: 34px; height: 34px; border: 0; border-radius: 10px;
  background: var(--blue-soft); color: var(--blue);
  display: grid; place-items: center; cursor: pointer;
}
.near-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: calc(100% - 36px); margin: 0 18px 16px; height: 44px;
  border: 0; border-radius: var(--r-sm); cursor: pointer;
  background: var(--blue-soft); color: var(--blue);
  font: inherit; font-size: 15px; font-weight: 700;
}
.near-btn:active { filter: brightness(.96); }
.near-btn[disabled] { opacity: .6; }

/* Список прокручивается внутри карточки: восемь остановок в неё не влезут,
   а растягивать главную ради них незачем. */
.near-list {
  border-top: 1px solid var(--line);
  max-height: 268px; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.near-list::-webkit-scrollbar { width: 0; }
.near-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 13px 18px; border: 0; border-bottom: 1px solid var(--line-2, #F1F5F9);
  background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.near-row:last-child { border-bottom: 0; }
.near-row:active { background: #FBFCFE; }
.near-body { flex: 1 1 auto; min-width: 0; }
.near-name {
  display: block; font-size: 15px; font-weight: 700; letter-spacing: -.2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.near-chips { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.rt-chip {
  display: inline-grid; place-items: center; min-width: 26px; height: 20px;
  padding: 0 6px; border-radius: 6px; color: #fff;
  font-size: 11.5px; font-weight: 800; letter-spacing: -.2px;
}
.near-dist {
  flex: 0 0 auto; text-align: right; font-size: 14px; font-weight: 800;
  color: var(--blue); letter-spacing: -.2px;
}
.near-dist small { display: block; font-size: 11.5px; font-weight: 600; color: var(--muted-2); margin-top: 2px; }

/* ---------- «вы здесь» на карте ---------- */
.me-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: #2563EB; border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, .55);
}
.map-topbar .iconbtn.busy { opacity: .5; }
.map-topbar .iconbtn.denied { color: var(--muted-2); }

/* ================= тёмная тема =================
   Переопределяем только переменные — правила остаются общими.

   За системной настройкой телефона намеренно не идём: приложение
   открывается светлым всегда, а тёмное — только если человек сам
   включил его в настройках. Тогда на <html> появляется data-theme. */

:root[data-theme="dark"] {
  --bg:        #0E1520;
  --card:      #172231;
  --ink:       #E8EEF6;
  --ink-2:     #C2CDDB;
  --muted:     #93A3B8;
  --muted-2:   #6B7C93;
  --line:      #24334A;
  --line-2:    #1E2C40;
  --glass:     rgba(23, 34, 49, .96);
  --blue-soft: #1B2C48;
  --shadow:    0 6px 24px rgba(0, 0, 0, .35);
  --shadow-2:  0 10px 34px rgba(0, 0, 0, .45);
}

/* Ободок корпуса и мелочи, где цвет задан мимо переменных. */
:root[data-theme="dark"] body { background: #060A11; }
:root[data-theme="dark"] .switch { background: #2A3A52; }
:root[data-theme="dark"] .chip { background: var(--card); }
:root[data-theme="dark"] .near-row:active,
:root[data-theme="dark"] .rrow:hover { background: #1D2A3C; }
:root[data-theme="dark"] .offline-bar { background: #3B2F12; color: #F6D58A; border-top-color: #4A3B18; }

/*
| Карта остаётся светлой: тайлы OpenStreetMap светлые, и затемнять их
| фильтром — значит испортить читаемость подписей. Приглушаем только
| яркость, чтобы карта не слепила на тёмном экране.
*/
:root[data-theme="dark"] .leaflet-tile-pane { filter: brightness(.88) saturate(.92); }

/* ---------- как дойти до остановки ---------- */
.info-card .near-btn { width: 100%; margin: 14px 0 0; }
.sheet .near-btn { width: 100%; margin: 6px 0 10px; }
.pop-walk {
  display: block; margin-top: 8px; font-weight: 700;
  color: var(--blue); text-decoration: none;
}
.walk-sum { padding: 4px 6px 0; font-size: 22px; font-weight: 800; }
.walk-sum span { font-size: 16px; font-weight: 600; color: var(--muted); }
.walk-note { padding: 4px 6px 10px; font-size: 14px; color: var(--muted); }
.walk-routes {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 10px 6px 4px; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--muted);
}

/* ---------- мои остановки ---------- */
.my-stops { margin: 16px 20px 0; }
.my-stops.flat { margin-top: 4px; }
.my-head {
  display: flex; align-items: center; gap: 8px; margin: 0 2px 10px;
  font-size: 15px; font-weight: 800; color: var(--ink);
}
.my-head svg { color: #F59E0B; }
.my-card {
  display: block; width: 100%; text-align: left; font: inherit; color: inherit;
  background: var(--card); border: 0; border-radius: var(--r-md); box-shadow: var(--shadow);
  padding: 14px 16px; margin-bottom: 10px; cursor: pointer;
}
.my-card:active { transform: translateY(1px); }
.my-name { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 750; }
.my-name > span { flex: 1 1 auto; min-width: 0; }
.my-name svg:first-child { color: var(--blue); flex: 0 0 auto; }
.my-name svg:last-child { color: var(--muted-2); flex: 0 0 auto; }
.my-arrs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.my-arr {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px;
  border-radius: 999px; background: var(--line-2); font-size: 13.5px; font-weight: 750; color: var(--ink);
}
.my-arr b {
  min-width: 34px; padding: 3px 7px; border-radius: 999px; color: #fff; text-align: center;
  font-size: 12.5px; font-weight: 800;
}
.my-arr.idle { color: var(--muted); font-weight: 600; }
.my-arr.idle b { background: #CBD5E1; }

/* ---------- знак остановки в списках ---------- */
.near-row > .stop-sign, .my-name > .stop-sign { flex: 0 0 auto; }
.stop-badge { flex: 0 0 auto; line-height: 0; }
.stop-badge svg { display: block; filter: drop-shadow(0 3px 8px rgba(37, 99, 235, .3)); }

/* ---------- экран остановки: кто подъезжает ---------- */
.arr-map {
  margin: 16px 20px 0; height: 210px; border-radius: var(--r-md); overflow: hidden;
  box-shadow: var(--shadow); position: relative; background: #E8EDF4;
}
.arr-map #stopmap { position: absolute; inset: 0; }
.arr-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 13px 16px; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.arr-row:last-child { border-bottom: 0; }
.arr-body { flex: 1 1 auto; min-width: 0; }
.arr-dir {
  display: block; font-size: 15px; font-weight: 700; letter-spacing: -.2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.arr-sub { display: block; font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.arr-time { flex: 0 0 auto; font-size: 17px; font-weight: 800; color: var(--green); white-space: nowrap; }
.arr-row.here .arr-time { color: var(--blue); }
.arr-empty { padding: 18px 16px; color: var(--muted); font-size: 14px; text-align: center; }
.arr-list {
  margin: 12px 20px 0; background: var(--card); border-radius: var(--r-md);
  box-shadow: var(--shadow); overflow: hidden;
}
