* { 
    box-sizing: border-box; 
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

:root {
    --bg-main: #f4f3f0;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --accent-btn: #0f172a;
    --accent-btn-text: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.94);
    --glass-border: rgba(0, 0, 0, 0.08);
    --card-sub-bg: #f1f5f9;
}

body.dark-mode {
    --bg-main: #090d16;
    --bg-card: #111827;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #1f293d;
    --accent-btn: #38bdf8;
    --accent-btn-text: #0f172a;
    --glass-bg: rgba(17, 24, 39, 0.92);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-sub-bg: #1e293b;
}

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    -webkit-text-size-adjust: 100%;
    overscroll-behavior: none;
}

#app-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    display: none;
    background: var(--bg-main);
    overflow: hidden;
}

body.dark-mode #map [class*="ground-pane"] {
    filter: invert(90%) hue-rotate(180deg) brightness(90%) contrast(110%) saturate(80%);
}

#authGate {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: #0f172a;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.auth-gate-card {
    background: #ffffff;
    width: 100%;
    max-width: 380px;
    border-radius: 26px;
    padding: 32px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}
.auth-gate-icon {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
}
.auth-gate-title { font-size: 1.3rem; font-weight: 800; color: #0f172a; line-height: 1.25; }
.auth-gate-desc { font-size: 0.88rem; color: #64748b; line-height: 1.45; }

.tg-direct-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    text-decoration: none;
    padding: 14px 18px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 6px 18px rgba(2, 132, 199, 0.35);
    cursor: pointer;
    transition: transform 0.15s ease;
}
.tg-direct-btn:active { transform: scale(0.98); }

.auth-input-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}
.auth-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    font-size: 0.9rem;
    text-align: center;
    outline: none;
    background: #f8fafc;
    letter-spacing: 1px;
    font-weight: 600;
}
.auth-submit-btn {
    background: #0f172a;
    color: #ffffff;
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s ease;
}
.auth-submit-btn:hover { background: #1e293b; }

.auth-divider {
    display: flex;
    align-items: center;
    width: 100%;
    color: #94a3b8;
    font-size: 0.75rem;
    gap: 10px;
}
.auth-divider::before, .auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

#sidebar { 
    width: 390px; 
    height: 100%;
    background: var(--bg-card); 
    border-right: 1px solid var(--border-color);
    box-shadow: 2px 0 12px rgba(0,0,0,0.04); 
    z-index: 20; 
    display: flex; 
    flex-direction: column; 
    flex-shrink: 0; 
    position: relative;
}

.sidebar-header { 
    padding: max(calc(env(safe-area-inset-top) + 16px), 20px) 16px 12px 16px; 
    background: var(--bg-card); 
    border-bottom: 1px solid var(--border-color); 
}

.header-top-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 12px;
}

.tg-badge {
    flex: 1;
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #ffffff; 
    text-decoration: none; 
    padding: 10px 14px;
    border-radius: 14px; 
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
    cursor: pointer;
    user-select: none;
    transition: transform 0.15s ease;
}
.tg-badge:active { transform: scale(0.98); }

.channel-link-btn {
    width: 48px;
    background: #0284c7;
    color: #ffffff;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
    flex-shrink: 0;
    transition: transform 0.15s ease, background 0.15s ease;
}
.channel-link-btn:hover { background: #0369a1; }
.channel-link-btn:active { transform: scale(0.95); }

.search-container { 
    position: relative; 
    width: 100%; 
}
.search-input {
    width: 100%; 
    padding: 10px 12px 10px 38px; 
    border: 1px solid var(--border-color);
    border-radius: 10px; 
    font-size: 0.88rem; 
    outline: none; 
    background: var(--card-sub-bg);
    color: var(--text-main);
}
.search-icon { 
    position: absolute; 
    left: 12px; 
    top: 50%; 
    transform: translateY(-50%); 
    font-size: 0.88rem; 
    color: var(--text-muted); 
    pointer-events: none; 
}

.sidebar-cat-scroll-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.sidebar-cat-scroll-wrap::-webkit-scrollbar { display: none; }

#locations-list { 
    flex: 1; 
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch;
    padding: 12px; 
    padding-bottom: calc(env(safe-area-inset-bottom) + 90px); 
    background: var(--bg-card);
}

.category-group {
    margin-bottom: 12px; 
    background: var(--bg-card); 
    border: 1px solid var(--border-color); 
    border-radius: 12px; 
    overflow: hidden;
}
.category-header { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: 12px 14px; 
    background: var(--card-sub-bg); 
    user-select: none; 
}
.category-title-wrap { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    cursor: pointer; 
    flex: 1; 
}
.category-title { font-weight: 600; font-size: 0.92rem; color: var(--text-main); }
.category-count {
    font-size: 0.75rem; 
    background: var(--border-color); 
    color: var(--text-muted); 
    padding: 2px 7px; 
    border-radius: 10px; 
    font-weight: 600;
}
.category-controls { display: flex; align-items: center; gap: 10px; }
.toggle-visibility-btn { background: none; border: none; cursor: pointer; font-size: 1.1rem; padding: 4px 6px; border-radius: 6px; }
.chevron { font-size: 0.8rem; transition: transform 0.2s; color: var(--text-muted); cursor: pointer; padding: 4px; }
.category-group.collapsed .chevron { transform: rotate(-90deg); }
.category-group.collapsed .category-content { display: none; }
.category-content { padding: 8px; }

.location-card {
    background: var(--bg-card); 
    border: 1px solid var(--border-color); 
    border-radius: 10px; 
    padding: 12px; 
    margin-bottom: 8px; 
    cursor: pointer;
}
.location-card.active { border-color: var(--accent-btn); background-color: var(--card-sub-bg); }
.card-title { font-size: 1rem; font-weight: 600; color: var(--text-main); line-height: 1.3; }
.card-address-block { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; width: 100%; }
.card-address {
    display: flex; 
    align-items: center; 
    gap: 6px; 
    background: var(--card-sub-bg); 
    color: var(--text-muted); 
    font-size: 0.78rem; 
    font-weight: 500; 
    padding: 6px 10px; 
    border-radius: 8px; 
    word-break: break-word; 
    border: 1px solid var(--border-color); 
    width: 100%;
}

.card-metro-block { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.metro-badge { 
    display: inline-flex; 
    align-items: center; 
    gap: 5px; 
    background: var(--bg-card); 
    color: var(--text-main); 
    font-size: 0.74rem; 
    font-weight: 600; 
    padding: 3px 8px; 
    border-radius: 6px; 
    border: 1px solid var(--border-color); 
}
.metro-icon-svg { width: 14px; height: 11px; flex-shrink: 0; }

.card-actions-row { display: flex; gap: 6px; width: 100%; }
.copy-btn, .route-btn {
    flex: 1; 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    gap: 5px; 
    padding: 8px 10px; 
    font-size: 0.78rem; 
    font-weight: 600; 
    border-radius: 8px; 
    text-decoration: none; 
    cursor: pointer; 
    border: 1px solid var(--border-color);
}
.copy-btn { background: var(--bg-card); color: var(--text-main); }
.route-btn { background: var(--accent-btn); border-color: var(--accent-btn); color: var(--accent-btn-text); }

.card-desc { font-size: 0.85rem; color: var(--text-muted); line-height: 1.4; margin-bottom: 10px; white-space: pre-line; }
.card-photos { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-top: 6px; }
.card-photo-thumb {
    height: 80px; 
    width: auto; 
    max-width: 150px; 
    border-radius: 8px; 
    object-fit: cover; 
    flex-shrink: 0; 
    cursor: pointer; 
    border: 1px solid rgba(0,0,0,0.08);
    transition: transform 0.15s ease;
}
.card-photo-thumb:hover { transform: scale(1.02); }

#map-container {
    position: absolute;
    top: 0;
    left: 390px;
    right: 0;
    bottom: 0;
    width: auto;
    height: 100%;
    z-index: 1;
    background: var(--bg-main);
}
#map { 
    width: 100% !important; 
    height: 100% !important; 
    background: var(--bg-main);
}

.custom-map-pin {
    width: 38px; 
    height: 38px; 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 18px; 
    box-shadow: 0 4px 14px rgba(0,0,0,0.35); 
    border: 2px solid #ffffff; 
    cursor: pointer; 
    user-select: none; 
    color: #ffffff; 
    transition: transform 0.2s;
}
.custom-map-pin:hover { transform: scale(1.1); }

.user-loc-pin-wrap {
    position: relative;
    width: 24px;
    height: 24px;
}
.user-loc-dot {
    width: 18px;
    height: 18px;
    background: #0284c7;
    border: 3px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.6);
    position: absolute;
    top: 3px;
    left: 3px;
    z-index: 2;
}
.user-loc-pulse {
    width: 40px;
    height: 40px;
    background: rgba(2, 132, 199, 0.35);
    border-radius: 50%;
    position: absolute;
    top: -8px;
    left: -8px;
    animation: pulseRing 1.8s ease-out infinite;
    z-index: 1;
}
@keyframes pulseRing {
    0% { transform: scale(0.5); opacity: 1; }
    100% { transform: scale(1.4); opacity: 0; }
}

/* Балун */
.balloon-wrapper { min-width: 210px; max-width: 260px; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif; color: #1e293b; }
.balloon-title { font-size: 0.95rem; font-weight: 700; color: #0f172a; line-height: 1.25; margin-bottom: 8px; }
.balloon-address-block { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; width: 100%; }
.balloon-address { font-size: 0.78rem; color: #475569; background: #f1f5f9; padding: 6px 8px; border-radius: 6px; line-height: 1.35; word-break: break-word; border: 1px solid #e2e8f0; width: 100%; }
.balloon-metro-block { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.balloon-actions-row { display: flex; gap: 6px; width: 100%; }
.balloon-btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 6px 8px; font-size: 0.75rem; font-weight: 600; border-radius: 6px; text-decoration: none; cursor: pointer; text-align: center; }
.balloon-copy-btn { background: #ffffff; border: 1px solid #cbd5e1; color: #334155; }
.balloon-route-btn { background: #0f172a; border: 1px solid #0f172a; color: #ffffff; }
.balloon-desc { font-size: 0.82rem; color: #334155; line-height: 1.4; margin-top: 8px; margin-bottom: 8px; white-space: pre-line; border-top: 1px solid #f1f5f9; padding-top: 6px; }
.balloon-photos { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; padding-bottom: 2px; }
.balloon-photo-img { height: 65px; width: auto; border-radius: 6px; cursor: pointer; object-fit: cover; border: 1px solid rgba(0,0,0,0.08); flex-shrink: 0; }

/* Верхний фильтр категорий */
.top-cat-filter-bar {
    position: fixed;
    top: max(calc(env(safe-area-inset-top) + 12px), 14px);
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 24px);
    max-width: 620px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 9999px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    z-index: 1000;
}

.toggle-all-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 9999px;
    background: var(--accent-btn);
    color: var(--accent-btn-text);
    font-size: 0.78rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}
.toggle-all-btn.off { background: var(--border-color); color: var(--text-muted); }

.cat-chips-scroll { display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; width: 100%; }
.cat-chips-scroll::-webkit-scrollbar { display: none; }
.cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 9999px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
}
.cat-chip.active { background: var(--accent-btn); color: var(--accent-btn-text); border-color: var(--accent-btn); }
.cat-chip.disabled { opacity: 0.45; background: var(--card-sub-bg); color: var(--text-muted); }

/* Кнопка метро */
.metro-floating-btn {
    position: fixed;
    top: max(calc(env(safe-area-inset-top) + 64px), 68px);
    left: max(calc(env(safe-area-inset-left) + 16px), 16px);
    z-index: 1000;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 9999px;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-main);
    transition: all 0.2s ease;
}
.metro-floating-btn.active {
    background: var(--accent-btn);
    color: var(--accent-btn-text);
}
.metro-floating-btn .metro-badge-dot {
    width: 9px; height: 9px; border-radius: 50%; display: none;
}
.metro-floating-btn.active .metro-badge-dot { display: inline-block; }

/* Кнопка темы */
.theme-toggle-floating-btn {
    position: fixed;
    top: max(calc(env(safe-area-inset-top) + 64px), 68px);
    right: max(calc(env(safe-area-inset-right) + 16px), 16px);
    z-index: 1000;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    cursor: pointer;
    font-size: 1.15rem;
    color: var(--text-main);
    transition: transform 0.15s ease;
}
.theme-toggle-floating-btn:active { transform: scale(0.92); }

/* Кастомная кнопка геолокации */
.custom-geoloc-btn {
    position: fixed;
    bottom: max(calc(env(safe-area-inset-bottom) + 78px), 82px);
    right: max(calc(env(safe-area-inset-right) + 16px), 16px);
    z-index: 1000;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    cursor: pointer;
    color: var(--text-main);
    transition: transform 0.15s ease, color 0.15s ease;
}
.custom-geoloc-btn:active { transform: scale(0.92); }
.custom-geoloc-btn.locating { animation: spin 1s linear infinite; }
.custom-geoloc-btn.active-loc { color: #0284c7; }

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Боковое меню метро */
.metro-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: flex-start;
    justify-content: flex-start;
}
.metro-sidebar-overlay.active { display: flex; }

.metro-sidebar-drawer {
    background: var(--bg-card);
    width: 360px;
    max-width: 90vw;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 10px 0 25px rgba(0,0,0,0.15);
    padding-top: max(calc(env(safe-area-inset-top) + 10px), 16px);
    padding-bottom: max(calc(env(safe-area-inset-bottom) + 10px), 16px);
    animation: slideIn 0.25s ease-out;
}
@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

.metro-drawer-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.metro-drawer-title { font-weight: 700; font-size: 1.05rem; color: var(--text-main); }
.metro-drawer-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text-muted); padding: 4px; }

.metro-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.metro-section-label { font-size: 0.8rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.metro-lines-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 6px;
    background: var(--card-sub-bg);
}
.metro-line-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-main);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    transition: all 0.15s ease;
}
.metro-line-item:hover, .metro-line-item.selected {
    border-color: var(--accent-btn);
    background: var(--card-sub-bg);
}
.metro-line-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}
.metro-line-color-dot.mck-ring {
    border: 2.5px solid #DF4842 !important;
    background: #ffffff !important;
}

.metro-stations-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 6px;
    background: var(--bg-card);
}
.metro-station-item {
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.metro-station-item:hover, .metro-station-item.active {
    background: var(--accent-btn);
    color: var(--accent-btn-text);
    font-weight: 600;
}
.metro-station-count {
    font-size: 0.72rem;
    background: rgba(0,0,0,0.06);
    padding: 2px 6px;
    border-radius: 999px;
}
.metro-station-item.active .metro-station-count {
    background: rgba(255,255,255,0.2);
    color: #ffffff;
}

.metro-reset-btn {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fca5a5;
    border-radius: 10px;
    padding: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    text-align: center;
    margin-top: auto;
}

/* Lightbox */
.lightbox-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.94);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
    touch-action: none;
}
.lightbox-modal.active { display: flex; }
.lightbox-img { 
    width: 92vw; 
    height: auto; 
    max-height: 85vh; 
    object-fit: contain; 
    border-radius: 8px; 
    user-select: none; 
}
.lightbox-close { position: absolute; top: max(calc(env(safe-area-inset-top) + 12px), 20px); right: 20px; color: #ffffff; font-size: 32px; cursor: pointer; padding: 10px; z-index: 10001; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); color: #ffffff; font-size: 36px; cursor: pointer; padding: 16px; opacity: 0.7; z-index: 10001; user-select: none; }
.lightbox-prev { left: 10px; } .lightbox-next { right: 10px; }
.lightbox-counter { position: absolute; bottom: max(calc(env(safe-area-inset-bottom) + 16px), 24px); color: rgba(255,255,255,0.85); font-size: 13px; font-weight: 500; }

.mobile-toggle-bar { display: none; }
.mobile-search-overlay {
    display: none;
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(env(safe-area-inset-bottom) + 84px);
    z-index: 1001;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 8px 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--glass-border);
    align-items: center;
    gap: 8px;
}
.mobile-search-overlay.active { display: flex; }
.mobile-search-input { flex: 1; border: none; background: transparent; font-size: 16px; outline: none; color: var(--text-main); padding-left: 4px; }
.mobile-search-close { background: none; border: none; font-size: 1.1rem; color: var(--text-muted); cursor: pointer; padding: 4px 8px; }

/* Мобильная адаптация */
@media (max-width: 768px) {
    #sidebar { 
        width: 100%; 
        height: 100%; 
        display: none; 
    }
    
    #map-container {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important;
        z-index: 1 !important;
        background-color: var(--bg-main) !important;
    }
    #map {
        width: 100% !important;
        height: 100% !important;
        background-color: var(--bg-main) !important;
    }

    .show-list #map-container { display: none !important; }
    .show-list #sidebar { display: flex !important; }
    .show-list .top-cat-filter-bar { display: none !important; }
    .show-list .metro-floating-btn { display: none !important; }
    .show-list .theme-toggle-floating-btn { display: none !important; }
    .show-list .custom-geoloc-btn { display: none !important; }
    
    body:not(.show-list) #sidebar { display: none !important; }
    body:not(.show-list) #map-container { display: block !important; }

    .metro-floating-btn {
        left: 12px;
        top: max(calc(env(safe-area-inset-top) + 60px), 64px);
    }

    .theme-toggle-floating-btn {
        right: 12px;
        top: max(calc(env(safe-area-inset-top) + 60px), 64px);
    }

    .custom-geoloc-btn {
        right: 12px;
        bottom: max(calc(env(safe-area-inset-bottom) + 78px), 82px);
    }

    .mobile-toggle-bar {
        display: flex;
        position: fixed;
        bottom: max(calc(env(safe-area-inset-bottom) + 14px), 20px);
        left: 50%;
        transform: translateX(-50%);
        background: var(--glass-bg);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        padding: 4px;
        border-radius: 9999px;
        border: 1px solid var(--glass-border);
        box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12);
        z-index: 1000;
        gap: 4px;
        align-items: center;
    }
    .toggle-btn {
        padding: 9px 18px;
        border-radius: 9999px;
        border: none;
        background: transparent;
        font-size: 0.85rem;
        font-weight: 600;
        cursor: pointer;
        color: var(--text-muted);
    }
    .toggle-btn.icon-btn { padding: 9px 12px; font-size: 0.95rem; }
    .toggle-btn.active {
        background: var(--accent-btn);
        color: var(--accent-btn-text);
        box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
    }
}
