/* Экран навигации по маршруту (client/js/navigate.js). Цвета — токены тем из style.css. */
html.nav-on #panel,
html.nav-on #tabbar,
html.nav-on #btn-open,
html.nav-on #place-card,
html.nav-on #btn-map-reset,
html.nav-on #help-hint { display: none !important; }

.nav { position: fixed; inset: 0; z-index: 20; pointer-events: none; display: flex; flex-direction: column; align-items: center; justify-content: space-between; }
.nav > * { pointer-events: auto; width: calc(100% - 16px); max-width: 540px; }
.nav .hidden { display: none !important; }

/* Верхний баннер: куда и через сколько */
.nav-top {
  margin-top: calc(8px + env(safe-area-inset-top)); display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  background: var(--green); color: var(--on-accent); border-radius: 16px; box-shadow: 0 6px 22px rgba(0, 0, 0, .28);
}
.nav-arrow { flex: none; width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; }
.nav-arrow .ic { width: 56px; height: 56px; stroke-width: 2.4; }
.nav-arrow.flip .ic { transform: scaleX(-1); }
.nav-main { flex: 1; min-width: 0; }
.nav-dist { font-size: 30px; font-weight: 800; line-height: 1.05; letter-spacing: -.01em; }
.nav-text { font-size: 20px; font-weight: 700; margin-top: 2px; }
.nav-sub { font-size: 14px; opacity: .88; margin-top: 3px; overflow-wrap: anywhere; }
.nav-top.is-warn { background: var(--danger); }
.nav-top.is-wait { background: var(--muted); }

/* Карточки событий: пришли, сошли с маршрута, конец, симулятор */
.nav-card { margin-bottom: 8px; padding: 14px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 6px 22px rgba(0, 0, 0, .22); animation: pop-in .2s ease-out; }
.nav-card h3 { margin: 0 0 4px; font-size: 18px; }
.nav-card p { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.nav-card .nav-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.nav-card .nav-btns button { flex: 1 1 auto; min-height: 44px; }
.nav-card .nav-chips { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.nav-card .nav-chips button { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-soft); color: var(--text); font: inherit; }
.nav-card .nav-chips button.is-on { background: var(--green); color: var(--on-accent); border-color: var(--green); }

/* Нижняя полоса: сколько осталось и управление */
.nav-bottom { margin-bottom: calc(8px + env(safe-area-inset-bottom)); padding: 10px 12px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 6px 22px rgba(0, 0, 0, .22); }
.nav-row { display: flex; align-items: center; gap: 8px; }
.nav-left { flex: 1; min-width: 0; }
.nav-left b { font-size: 19px; }
.nav-left span { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-bar { height: 5px; margin-top: 8px; border-radius: 3px; background: var(--line); overflow: hidden; }
.nav-bar i { display: block; height: 100%; width: 0; background: var(--green); transition: width .4s; }
.nav-ibtn { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg-soft); color: var(--text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.nav-ibtn .ic { width: 22px; height: 22px; }
.nav-ibtn.is-off { opacity: .55; }
.nav-end { flex: none; min-height: 46px; padding: 0 16px; border-radius: 23px; border: 0; background: var(--danger); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }

/* Положение человека на карте */
.nav-me { position: relative; width: 22px; height: 22px; }
.nav-me i { position: absolute; inset: 0; border-radius: 50%; background: var(--pin-start); border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(0, 0, 0, .18), 0 2px 8px rgba(0, 0, 0, .35); }
.nav-me b { position: absolute; left: 50%; top: -9px; width: 0; height: 0; margin-left: -6px; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 11px solid var(--pin-start); transform-origin: 6px 20px; transform: rotate(var(--hd, 0deg)); display: none; }
.nav-me.has-dir b { display: block; }

@media (prefers-reduced-motion: reduce) { .nav-card { animation: none; } .nav-bar i { transition: none; } }

/* Карта по ходу движения: контейнер — квадрат в диагональ экрана, повёрнут на -курс (--br); значки поворачиваются обратно (--ur) */
html.nav-rot #map { position: fixed; inset: auto; left: 50%; top: 50%; width: var(--rd, 100vmax); height: var(--rd, 100vmax); margin: calc(var(--rd, 100vmax) / -2) 0 0 calc(var(--rd, 100vmax) / -2);
  transform: rotate(var(--br, 0deg)); transition: transform .8s linear; }
html.nav-rot .leaflet-control-container { display: none; }
html.nav-rot .pin, html.nav-rot .map-place { rotate: var(--ur, 0deg); transition: rotate .8s linear; }
.nav-attr { margin-top: 6px; font-size: 10px; color: var(--muted); text-align: center; }
.nav-attr a { color: inherit; }
.nav-ibtn.is-off { opacity: .55; }
@media (prefers-reduced-motion: reduce) { html.nav-rot #map, html.nav-rot .pin, html.nav-rot .map-place { transition: none; } }
