* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    height: 100vh;
    font-family:
        "Inter",
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        sans-serif;
    background: #0f0f0f;
    color: #e0e0e0;
    overflow: hidden;
}

#sidebar {
    width: 300px;
    background: #1e1e1e;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    border-right: 1px solid #333;
    overflow-y: auto;
    flex-shrink: 0;
    position: relative;
    z-index: 1000;
    transition: transform 0.3s ease;
}

#map {
    flex: 1;
    height: 100%;
    z-index: 1;
}

/* --- Мобильная адаптация (Bottom Sheet) --- */
.menu-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    background: #1e1e1e;
    color: #e0e0e0;
    border: 1px solid #333;
    border-radius: 50%; /* Круглая кнопка */
    font-size: 1.5em;
    width: 50px;
    height: 50px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

/* Ползунок для перетаскивания (Drag Handle) */
.drag-handle {
    display: none; /* Скрыт на десктопе */
    width: 40px;
    height: 5px;
    background: #555;
    border-radius: 5px;
    margin: 0 auto 15px auto;
    cursor: grab;
}

h2 {
    font-size: 1.2em;
    font-weight: 600;
    color: #e0e0e0;
    letter-spacing: -0.5px;
}

h3 {
    font-size: 0.85em;
    font-weight: 500;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

/* --- Мемчик --- */
.meme-container {
    display: flex;
    justify-content: center;
}

.wanted-poster {
    background: #2a2a2a;
    border: 1px solid #444;
    padding: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    max-width: 180px;
}

.wanted-poster img {
    width: 100%;
    height: auto;
    display: block;
    border: 1px solid #555;
}

.meme-caption {
    text-align: center;
    font-size: 0.75em;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 8px;
    line-height: 1.3;
}

/* --- Футер --- */
.footer-info {
    margin-top: auto;
    text-align: center;
    font-size: 0.7em;
    color: #555;
    padding-top: 20px;
    letter-spacing: 0.5px;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn {
    padding: 10px 14px;
    border: 1px solid #333;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9em;
    transition: all 0.2s ease;
    color: #e0e0e0;
    background: #2a2a2a;
    text-align: left;
}

.btn:hover {
    background: #3a3a3a;
    border-color: #555;
}

.btn.active {
    background: #3a3a3a;
    border-color: #00d4ff;
    color: #00d4ff;
    box-shadow: 0 0 0 1px #00d4ff;
}

/* Экспорт */
.export-container {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.export-options {
    position: relative;
    background: #2a2a2a;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 4px;
    display: flex;
    gap: 4px;
    z-index: 10;
}

.export-options.hidden {
    display: none;
}

.export-option {
    background: #3a3a3a;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.8em;
    transition: all 0.2s;
    flex: 1;
    text-align: center;
}

.export-option:hover {
    background: #00d4ff;
    color: #000;
    border-color: #00d4ff;
}

#points-list {
    flex: 1;
    overflow-y: auto;
}

#points-list ul {
    list-style: none;
    padding: 0;
    margin-top: 10px;
}

#points-list li {
    padding: 6px 0;
    border-bottom: 1px solid #2a2a2a;
    font-size: 0.85em;
    color: #aaa;
}

#results {
    background: #2a2a2a;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #333;
}

#distance {
    font-size: 0.9em;
    color: #aaa;
    margin-bottom: 4px;
}

#distance span {
    color: #ffffff;
    font-size: 1.4em;
    font-weight: 600;
    display: block;
    margin-top: 4px;
}

#status {
    font-size: 0.8em;
    color: #666;
    margin-top: 12px;
}

/* Стили для километровых меток */
.km-marker {
    background: transparent;
    border: none;
    text-align: center;
}

.km-text {
    font-size: 10px;
    font-weight: 600;
    color: #ffffff;
    text-shadow:
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000,
        0px 0px 4px rgba(0, 0, 0, 0.9);
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 5px;
    border-radius: 3px;
    white-space: nowrap;
    display: block;
}

.km-text.major-text {
    font-size: 11px;
}

/* Переключатель слоев карты */
.layer-switcher {
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 4px;
    display: flex;
    gap: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.layer-btn {
    background: #2a2a2a;
    color: #aaa;
    border: 1px solid transparent;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: 500;
    transition: all 0.2s;
}

.layer-btn:hover {
    background: #3a3a3a;
    color: #fff;
}

.layer-btn.active {
    background: #00d4ff;
    color: #000;
    border-color: #00d4ff;
    font-weight: 600;
}

/* --- Медиа-запрос для мобильных --- */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex; /* Показываем кнопку меню */
    }

    #sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: auto; /* Автовысота */
        max-height: 60vh; /* Не более 60% экрана */
        transform: translateY(
            calc(100% - 30px)
        ); /* По умолчанию торчит только ползунок (30px) */
        border-right: none;
        border-top: 1px solid #333;
        border-radius: 12px 12px 0 0;
        padding: 15px 15px 25px 15px; /* Отступ снизу больше */
        gap: 15px;
        transition: transform 0.3s ease;
    }

    #sidebar.open {
        transform: translateY(0); /* Полностью открыто */
    }

    /* Показываем ползунок */
    .drag-handle {
        display: block;
    }

    /* Скрываем мемчик и футер на мобильных, чтобы экономить место */
    .meme-container,
    .footer-info {
        display: none;
    }

    /* Меню внутри должно скроллиться, если контента много */
    #sidebar {
        overflow-y: auto;
    }
}
