:root {
    --ink: #242c2c;
    --muted: #667373;
    --accent: #087f71;
    --line: #dce3e1;
    --surface: rgba(255,255,255,.96);
    --shadow: 0 3px 16px #12282024;
    --edge: max(16px, env(safe-area-inset-left));
    --top: max(16px, env(safe-area-inset-top));
}
* { box-sizing: border-box; letter-spacing: 0; }
html, body, #map { height: 100dvh; width: 100%; overflow: hidden; }
body, button, input { font-family: "Segoe UI", Tahoma, Arial, sans-serif; color: var(--ink); }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid #20a99a; outline-offset: 3px; }
button:disabled { cursor: wait; opacity: .5; }
[hidden] { display: none !important; }
.vector-badge { top: var(--top); left: var(--edge); border-radius: 8px; padding: 10px 14px; font-size: 17px; font-weight: 650; color: var(--ink); box-shadow: var(--shadow); border: 1px solid var(--line); background: var(--surface); }
.vector-badge::before { content: ''; display: inline-block; width: 9px; height: 9px; margin-right: 9px; background: var(--accent); border-radius: 50%; }
.map-zoom-badge { position: fixed; top: calc(var(--top) + 52px); bottom: auto; left: var(--edge); right: auto; transform: none; padding: 5px 8px; border-radius: 4px; background: var(--surface); color: var(--muted); font-size: 11px; font-weight: 500; box-shadow: var(--shadow); z-index: 2; }
.search-toggle-control, .voice-search-button, .driver-companion-control, .layer-toggle-control, .location-center-control {
    width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 0;
    border-radius: 8px; background: var(--surface); border: 1px solid var(--line);
    color: var(--ink); box-shadow: var(--shadow); font-size: 0; transform: none;
}
.search-toggle-control { top: calc(var(--top) + 94px); left: var(--edge); }
.voice-search-button { top: calc(var(--top) + 146px); left: var(--edge); }
.driver-companion-control { top: calc(var(--top) + 198px); left: var(--edge); }
.search-toggle-control::after, .voice-search-button::after, .driver-companion-control::after, .layer-toggle-control::after, .layer-toggle-control span, .location-center-control::after { display: none; }
.search-toggle-control::before, .voice-search-button::before, .driver-companion-control::before, .layer-toggle-control::before, .location-center-control::before, .icon-button::before {
    content: ''; display: block; position: absolute; inset: 50% auto auto 50%;
    width: 21px; height: 21px; border: 0; border-radius: 0;
    transform: translate(-50%, -50%); background: currentColor;
    mask: var(--icon) center / contain no-repeat;
    -webkit-mask: var(--icon) center / contain no-repeat;
}
.search-toggle-control, .icon-search { --icon: url('vendor/lucide/search.svg'); }
.voice-search-button { --icon: url('vendor/lucide/mic.svg'); }
.driver-companion-control { --icon: url('vendor/lucide/user-round.svg'); }
.layer-toggle-control { --icon: url('vendor/lucide/layers.svg'); }
.location-center-control { --icon: url('vendor/lucide/locate-fixed.svg'); }
.icon-close { --icon: url('vendor/lucide/x.svg'); }
.icon-copy { --icon: url('vendor/lucide/copy.svg'); }
.icon-share { --icon: url('vendor/lucide/share-2.svg'); }
.icon-delete { --icon: url('vendor/lucide/trash-2.svg'); }
.icon-button { position: relative; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 6px; border: 0; background: transparent; color: var(--muted); }
.icon-button:hover { background: #edf3f1; color: var(--accent); }
.search-toggle-control.is-active, .voice-search-button.is-listening, .driver-companion-control.is-active, .location-center-control.is-locked, .map-layer-control.is-open .layer-toggle-control { background: var(--accent); color: white; border-color: var(--accent); box-shadow: var(--shadow); }
.map-layer-control { right: 16px; top: var(--top); width: 44px; z-index: 12; }
.map-layer-control .map-mode-control { right: 54px !important; top: 0 !important; width: 224px !important; padding: 10px !important; border-radius: 8px !important; background: rgba(245,255,252,.28) !important; border: 1px solid #ffffff80 !important; backdrop-filter: blur(16px) saturate(1.2) !important; -webkit-backdrop-filter: blur(16px) saturate(1.2) !important; box-shadow: var(--shadow); visibility: hidden; }
.map-layer-control.is-open .map-mode-control { visibility: visible; }
.map-mode-control::before { content: 'Map layers'; display: block; width: 100%; text-align: left; padding: 4px 8px 10px; color: #172c27; font-size: 13px; font-weight: 650; text-shadow: 0 1px 3px #fff; }
.map-layer-row { min-height: 44px; width: 100%; border-radius: 6px; font-weight: 600; font-size: 13px; gap: 12px; padding: 0 10px; background: #ffffff85; }
.map-layer-row input { accent-color: var(--accent); width: 18px; height: 18px; }
.map-layer-control .map-layer-row:has(input:checked) { background: #087f71dd; color: white; }
.orbit-control { top: calc(var(--top) + 60px); right: 14px; width: 48px; height: 48px; background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line); }
.orbit-control::before { width: 38px; height: 38px; border-color: #c3ceca; }
.orbit-control::after { display: none; }
.orbit-control span { width: 36px; height: 36px; background: transparent; }
.orbit-control span::before { height: 28px; width: 14px; border-radius: 0; clip-path: polygon(50% 0, 95% 50%, 50% 100%, 5% 50%); background: linear-gradient(#df4b49 50%, #71827e 50%); }
.orbit-control span::after { width: 5px; height: 5px; background: white; }
.orbit-control i { display: none; }
.orbit-control b { top: -9px; font-size: 9px; background: white; color: #b73331; width: 14px; height: 14px; line-height: 14px; }
.orbit-control.is-following, .orbit-control.is-dragging { background: var(--accent); }
.location-center-control { right: 16px; bottom: max(184px, calc(env(safe-area-inset-bottom) + 184px)); }
.maplibregl-ctrl-bottom-right { right: 6px; bottom: max(22px, env(safe-area-inset-bottom)); }
.maplibregl-ctrl-group { border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
.maplibregl-ctrl-group button { width: 42px; height: 42px; }
.maplibregl-ctrl-bottom-left { bottom: max(12px, env(safe-area-inset-bottom)); left: 6px; }
.maplibregl-ctrl-scale { box-sizing: content-box; border: 2px solid #263732; border-top: 0; background: rgba(255,255,255,.92); color: #20352e; font: 600 11px/20px "Segoe UI",sans-serif; padding: 0 5px; text-align: center; border-radius: 0 0 2px 2px; }
.maplibregl-ctrl-attrib { display: none !important; }
.route-search-control { left: var(--edge); top: calc(var(--top) + 94px); transform: none; bottom: auto; width: 368px; max-width: calc(100vw - 90px); max-height: calc(var(--available-height, 100dvh) - 126px); padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 8px 32px #152f292b; overflow: auto; z-index: 20; }
.route-search-control.is-open { transform: none; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -5px -5px 10px 0; }
.panel-heading h1 { margin: 0; font-size: 17px; font-weight: 650; }
.route-search-row { display: grid; grid-template-columns: minmax(0,1fr) 44px; gap: 6px; }
.route-search-row input { width: 100%; min-width: 0; height: 44px; border: 1px solid #c8d4ce; border-radius: 6px; background: white; padding: 0 12px; font-size: 16px; font-weight: 400; }
.route-search-row button { min-width: 44px; width: 44px; height: 44px; padding: 0; border-radius: 6px; background: var(--accent); color: white; }
.route-search-row input::placeholder { font-weight: 400; color: #73807b; }
.route-search-results { gap: 0; max-height: none; overflow: visible; margin-top: 12px; }
.route-search-results:empty { margin: 0; }
.route-search-results button { background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; padding: 12px 4px; min-height: 50px; text-align: start; width: 100%; }
.route-search-results button:hover { background: #eaf5f0; }
.route-search-results button strong { font-size: 14px; font-weight: 600; white-space: normal; overflow-wrap: anywhere; }
.route-search-results button small { font-size: 12px; color: var(--muted); font-weight: 400; line-height: 1.5; white-space: normal; overflow-wrap: anywhere; }
.destination-active-panel { border: 0; border-left: 3px solid var(--accent); border-radius: 0; background: #edf6f2; padding: 10px; margin: 0 0 12px; }
.destination-active-panel > div { min-width: 0; }
.destination-active-panel strong { font-size: 13px; font-weight: 600; }
.destination-active-panel small { font-size: 11px; font-weight: 400; }
.destination-remove-button { border-radius: 6px; font-weight: 500; }
.map-point-panel { bottom: 72px; left: 50%; transform: translateX(-50%); width: 360px; max-width: calc(100vw - 32px); padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); z-index: 21; }
.map-point-panel strong { font-size: 16px; font-weight: 600; }
.point-coordinates { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); margin-top: 8px; }
.map-point-panel code { margin: 0; font-size: 13px; color: var(--muted); }
.map-point-actions { display: flex; gap: 8px; margin-top: 12px; }
.map-point-actions button { min-height: 42px; border-radius: 6px; font-size: 13px; font-weight: 600; }
.map-point-actions .primary-action { flex: 1; background: var(--accent); color: white; border: 0; }
.map-point-actions .icon-button { min-width: 42px; background: #edf3f1; color: var(--ink); }
.speed-hud { left: var(--edge); bottom: 68px; width: 64px; height: 64px; box-shadow: var(--shadow); border-width: 3px; }
.route-status { left: 50%; top: var(--top); max-width: calc(100vw - 500px); min-height: 48px; border-radius: 8px; background: #163e34; padding: 10px 18px; box-shadow: var(--shadow); }
.route-status strong { font-size: 17px; font-weight: 600; }
.route-status span { font-size: 12px; font-weight: 400; white-space: normal; }
.turn-guidance { top: calc(var(--top) + 62px); left: 50%; right: auto; transform: translateX(-50%); max-width: calc(100vw - 180px); border-radius: 8px; background: #163e34; box-shadow: var(--shadow); }
.turn-guidance strong { background: var(--accent); border-radius: 6px; flex: 0 0 42px; }
.turn-guidance span { font-size: 14px; font-weight: 600; }
.turn-guidance small { font-size: 12px; font-weight: 400; overflow-wrap: anywhere; }
.connection-status, .map-notice { position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; z-index: 30; background: #253c34; color: white; border-radius: 6px; padding: 10px 16px; font-size: 13px; max-width: calc(100vw - 32px); box-shadow: var(--shadow); }
.connection-status { top: var(--top); bottom: auto; background: #a65714; }
.maplibregl-popup-content { padding: 14px 32px 14px 14px; border-radius: 8px; box-shadow: var(--shadow); font-size: 14px; line-height: 1.5; max-width: 280px; overflow-wrap: anywhere; }
@media (max-width: 700px) {
    :root { --edge: max(12px, env(safe-area-inset-left)); --top: max(12px, env(safe-area-inset-top)); }
    .vector-badge { font-size: 15px; padding: 10px 12px; }
    .route-search-control { top: var(--top); left: var(--edge); max-width: calc(100vw - 24px); width: 368px; max-height: calc(var(--available-height, 100dvh) - 24px); }
    .route-status { left: auto; right: 76px; top: calc(var(--top) + 86px); max-width: calc(100vw - 152px); transform: none; padding: 10px 12px; }
    .route-status strong { font-size: 15px; white-space: normal; }
    .turn-guidance { left: 76px; right: 76px; top: calc(var(--top) + 154px); max-width: none; transform: none; padding: 8px; }
    .turn-guidance span { font-size: 12px; }
    .turn-guidance small { font-size: 11px; }
    .map-layer-control .map-mode-control { width: min(224px, calc(100vw - 86px)) !important; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
