    html, body {
        height: 100%;
        padding: 0;
        margin: 0;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    }
    #map {
        width: 100%;
        height: 100%;
    }
    .leaflet-control-attribution > a {
        display: none;
    }

    #geo-banner {
        position: fixed;
        top: 12px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 50000;
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 12px 16px;
        background: rgba(20, 20, 20, 0.92);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        color: #fff;
        border-radius: 14px;
        box-shadow: 0 4px 20px rgba(0,0,0,0.35);
        font-size: 13px;
        width: calc(100vw - 40px);
        max-width: 420px;
        box-sizing: border-box;
    }
    #geo-banner.geo-banner-denied { background: rgba(160, 30, 10, 0.92); }
    .geo-banner-top {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 8px;
    }
    .geo-banner-text { flex: 1; line-height: 1.4; }
    .geo-banner-actions {
        display: flex;
        gap: 8px;
    }
    #geo-allow-btn {
        flex: 1;
        padding: 8px 14px;
        background: #4caf50;
        color: #fff;
        border: none;
        border-radius: 8px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
    }
    #geo-allow-btn:hover { background: #43a047; }
    #geo-banner-close {
        flex-shrink: 0;
        background: none;
        border: none;
        color: rgba(255,255,255,0.6);
        font-size: 18px;
        cursor: pointer;
        padding: 0;
        line-height: 1;
        align-self: flex-start;
    }
    #geo-banner-close:hover { color: #fff; }

    .user-name-label {
        display: flex;
        justify-content: center;
        align-items: center;
        white-space: nowrap;
        pointer-events: none;
        text-align: center;
    }

    .user-name-text {
        color: rgba(58, 58, 58, 0.47);
        font-size: 8px;
        font-weight: 500;
    }

    .msg {
        position: absolute;
        font-size: 2em;
        color: #ffffff;
        z-index: 10000;
        margin-left: 40%;
        margin-top: 5%;
        background-color: rgba(63, 62, 62, 0.55);
    }

    @keyframes screen-blink {
        0% { background-color: rgba(255, 0, 0, 0.1); }
        50% { background-color: rgba(255, 0, 0, 0.5); }
        100% { background-color: rgba(255, 0, 0, 0.1); }
    }

    .screen-blink {
        display: none;
        font-size: 2em;
        color: #ffffff;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1000;
        pointer-events: none; /* Не блокировать клики */
        animation: screen-blink 0.5s linear infinite;
    }

    #overlay-text {
        position: absolute;
        top: 45%;
        left: 50%;
        transform: translate(-50%, -50%);
        color: white;
        font-size: 24px;
        font-weight: bold;
        text-align: center;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    }

    #bg-text {
        display: none;
        position: fixed;
        top: 0;
        width: 100%;
        height: 12%;
        z-index: 99999;
        pointer-events: none;
        background-color: rgba(0, 0, 0, 0.7); /* Более темный фон для четкости */
    }

    .downloadGPX, .custom-button {
        font-size: 0.8em;
        background-color: white;
        padding: 5px;
        width: 115px;
        border-radius: 5px;
        border: none;
        cursor: pointer;
        margin-bottom: 0;
    }

    .one-gpx-download {
        background-color: #e8e7e7;
        margin-top: 10px;
        border-radius: 5px;
        border: solid 1px #850202;
    }

    .main-menu-buttons {
        background-color: #e8e7e7;
        margin-top: 10px;
        border-radius: 5px;
        border: solid 1px #850202;
        display: flex;
        flex-direction: column;
        height: 2.5em;
        width: 10em;
        justify-content: center;
        align-items: center;
    }

    .main-menu-buttons:hover {
        background-color: #b5b5b5;
    }

    .hide {
        display: none;
    }

    .leaflet-control-measure {
        background: white;
        padding: 3px 8px;
        border-radius: 4px;
        cursor: pointer;
        font-size: 14px;
        font-weight: bold;
        border: 1px solid #333;
        user-select: none;
    }
    .leaflet-control-measure.active {
        background: #ff4d4d;
        color: white;
    }
    .leaflet-control-record {
        background: white;
        width: 36px;
        box-sizing: border-box;
        padding: 3px 6px;
        border-radius: 4px;
        cursor: pointer;
        border: 1px solid #333;
        user-select: none;
        text-align: center;
        line-height: 1;
    }
    .leaflet-control-record:hover {
        background: #f4f4f4;
    }
    .rec-icon {
        display: block;
        font-size: 11px;
        color: #333;
    }
    .rec-icon.rec-stop {
        color: #e00;
    }
    .rec-label {
        display: block;
        font-size: 8px;
        font-weight: 800;
        color: #333;
        letter-spacing: 0.5px;
    }
    .distance-label {
        background: white;
        padding: 4px;
        border-radius: 4px;
        font-size: 14px;
        font-weight: bold;
        border: 1px solid #333;
    }

    .load-history {
        margin-top: 0.7em;
    }

    #map-controls-right {
        position: fixed;
        bottom: 8px;
        right: 10px;
        z-index: 10000;
        display: flex;
        flex-direction: column;
        gap: 6px;
        align-items: stretch;
    }

    #routes-toggle-btn {
        background: rgba(255, 255, 255, 0.55);
        backdrop-filter: blur(10px) saturate(1.3);
        -webkit-backdrop-filter: blur(10px) saturate(1.3);
        border: 1px solid rgba(255, 255, 255, 0.65);
        border-radius: 10px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
        width: 152px;
        padding: 6px 10px;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.4px;
        text-transform: uppercase;
        color: rgba(0, 0, 0, 0.55);
        cursor: pointer;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        text-align: left;

        @media screen and (max-width: 710px) {
            width: 136px;
            font-size: 10px;
        }
    }
    #routes-toggle-btn:hover { background: rgba(255, 255, 255, 0.75); }
    #routes-toggle-btn.active { color: rgba(0, 0, 0, 0.8); }

    .routes-btn-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    .routes-new-badge {
        font-size: 9px;
        font-weight: 600;
        color: #c0392b;
        letter-spacing: 0.1px;
        margin-top: 3px;
        text-transform: none;
        pointer-events: none;
        opacity: 0.85;
    }

    #points-info {
        background: rgba(255, 255, 255, 0.55);
        backdrop-filter: blur(10px) saturate(1.3);
        -webkit-backdrop-filter: blur(10px) saturate(1.3);
        border: 1px solid rgba(255, 255, 255, 0.65);
        border-radius: 10px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
        width: 152px;
        font-size: 12px;
        overflow: hidden;

        @media screen and (max-width: 710px) {
            width: 136px;
            font-size: 11px;
        }
    }

    #layers-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 6px 10px;
        font-weight: 700;
        font-size: 11px;
        letter-spacing: 0.4px;
        text-transform: uppercase;
        color: rgba(0, 0, 0, 0.55);
        cursor: pointer;
        user-select: none;
    }

    #layers-header:hover {
        background: rgba(0, 0, 0, 0.04);
    }

    #layers-arrow {
        font-size: 10px;
    }

    #layers-body {
        padding: 2px 9px 8px;
    }

    #type-toggles {
        display: block;
        width: 100%;
    }

    .layer-row {
        display: flex;
        align-items: center;
        gap: 5px;
        padding: 3px 0;
        cursor: pointer;
        user-select: none;
        line-height: 1.3;
    }

    .layer-row input[type="checkbox"] {
        flex-shrink: 0;
        width: 13px;
        height: 13px;
        margin: 0;
        cursor: pointer;
        accent-color: #2a6cff;
    }

    .type-label {
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .type-count {
        font-size: 11px;
        font-weight: 600;
        color: rgba(0, 0, 0, 0.4);
        min-width: 18px;
        text-align: right;
    }

    .layer-master {
        font-weight: 600;
    }

    .layer-type {
        padding-left: 3px;
    }

    #type-toggles.disabled label {
        opacity: 0.3;
        pointer-events: none;
    }

    .layer-divider {
        border: none;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
        margin: 4px 0;
    }

    #noInstall {
        display: inline-block;
        padding: 3px 8px;
        width: 10.5em;
        margin-top: 1px;
        font-size: 11px;
        font-weight: 600;
        color: rgba(0, 0, 0, 0.65);
        background: rgba(0, 0, 0, 0.07);
        border-radius: 5px;
        cursor: pointer;
        transition: background 0.2s ease;
    }

    #noInstall:hover {
        background: rgba(0, 0, 0, 0.13);
    }

    /* Крестик в центре карты */
    .map-crosshair {
        position: absolute;
        top: 50%;
        left: 50%;
        width: 30px;
        height: 30px;
        transform: translate(-50%, -50%);
        pointer-events: none;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 10000;
    }

    .map-crosshair::before,
    .map-crosshair::after {
        content: "";
        position: absolute;
        background: #888686;
    }

    /* Горизонтальная линия */
    .map-crosshair::before {
        width: 20px;
        height: 2px;
        border-radius: 15%;
    }

    /* Вертикальная линия */
    .map-crosshair::after {
        width: 2px;
        height: 20px;
        border-radius: 15%;
    }


    /* Окно с координатами */
    .coord-display {
        position: absolute;
        bottom: 8px;
        left: 50%;
        transform: translateX(-50%);
        background-color: rgba(230, 229, 229, 0.6);
        color: #1b1b1b;
        padding: 5px 10px;
        border-radius: 5px;
        font-size: 14px;
        pointer-events: auto;
        z-index: 10000;
        cursor: pointer;

        @media screen and (max-width: 710px) {
            /*bottom: 19em;*/
            /*left: 87%;*/
            /*width: 9em;*/
            /*height: 2em;*/
            font-size: 8px;
            /*display: flex;*/
            /*align-items: center;*/
        }
    }

    #auth-container {
        display: none;
        z-index: 100000;
    }

    .map-logo {
        width: 115px;
        height: auto;
        border-radius: 8px;
        display: block;
        pointer-events: none;
        margin-top: 6px;
        align-self: flex-end;
    }

    .start-button {
        display: block;
        width: 100%;
        box-sizing: border-box;
        background-color: #b7f65a;
        color: #000000;
        padding: 5px 10px;
        margin-bottom: 6px;
        cursor: pointer;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
        border-radius: 8px;
        font-weight: bold;
        font-family: sans-serif;
        text-align: center;
        user-select: none;
        transition: background-color 0.3s ease;
    }

    .start-button:hover {
        background-color: #f8e94d;
    }

    .popup-btn {
        width: 100%;
        margin-top: 6px;
        padding: 8px 12px;
        font-size: 13px;
        font-weight: 500;
        border-radius: 14px;
        border: none;
        background: #f2f2f7;
        color: #111;
        cursor: pointer;
        text-align: center;
    }

    .popup-btn:hover {
        background: #e5e5ea;
    }

    .popup-btn:active {
        background: #d1d1d6;
    }

    .popup-btn-link {
        display: block;
        text-decoration: none;
        color: #007aff;
        background: #eaf3ff;
    }

    /* Текстовые мелочи */
    .popup-link {
        color: #007aff;
        cursor: pointer;
    }

    .popup-comment {
        margin: 6px 0;
        padding: 6px 8px;
        background: #f2f2f7;
        border-radius: 10px;
        font-size: 13px;
    }

    .popup-time {
        font-size: 12px;
        color: #666;
        margin-bottom: 4px;
    }

    .popup-toggle {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 12px;
        margin-top: 6px;
    }

    .popup-image {
        width: 100%;
        margin-top: 6px;
        border-radius: 12px;
        cursor: pointer;
    }

    .popup-actions-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        margin-top: 6px;
    }

    .popup-btn {
        padding: 7px 0;
        font-size: 13px;
        font-weight: 500;
        border-radius: 12px;
        border: none;
        background: #f2f2f7;
        color: #111;
        cursor: pointer;
        text-align: center;
    }

    .popup-btn:hover {
        background: #e5e5ea;
    }

    .popup-btn:active {
        background: #d1d1d6;
    }

    .popup-btn-link {
        display: block;
        text-decoration: none;
        color: #007aff;
        background: #eaf3ff;
        margin-top: 6px;
    }

    .popup-btn-full {
        width: 100%;
    }

    .popup-image {
        width: 100%;
        max-height: 220px;
        object-fit: contain;
        border-radius: 12px;
        background: #f2f2f7;
        cursor: zoom-in;
    }

    .circle-toggle {
        display: flex;
        align-items: center;
        margin: 1em 0 1em 0;
        gap: 5px; /* расстояние между чекбоксом и текстом */
        cursor: pointer;
    }

    .circle-toggle input[type="checkbox"] {
        margin: 0;
        vertical-align: middle;
    }

    /* ============================= */
    /* GLASS CONTAINER (BUTTON + SLIDER) */
    /* ============================= */

    .glass-control,
    .leaflet-control-layers.glass-control {
        box-sizing: border-box;
        position: relative;
        width: 130px;
        padding: 6px;

        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        box-shadow: none;
        border: none;
        border-radius: 10px;

        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    /* ============================= */
    /* BUTTON */
    /* ============================= */

    .glass-button {
        width: 100%;
        padding: 4px 0;

        background: transparent;
        border: none;
        border-radius: 6px;

        font-size: 11px;
        font-weight: 600;
        line-height: 1.2;
        color: rgba(0, 0, 0, 0.9);

        cursor: pointer;
    }

    .glass-button:hover {
        background: rgba(255, 255, 255, 0.25);
    }

    .glass-button:active {
        transform: scale(0.96);
    }

    /* ============================= */
    /* LEAFLET CLEANUP */
    /* ============================= */

    .leaflet-control-layers,
    .leaflet-control-layers-expanded {
        background: transparent !important;
        box-shadow: none !important;
    }

    .leaflet-control-layers-toggle,
    .leaflet-control-layers-separator {
        display: none;
    }

    .leaflet-control-layers-base,
    .leaflet-control-layers-overlays,
    .leaflet-control-layers-list {
        margin: 0;
        padding: 0;
    }

    /* ============================= */
    /* SLIDER LABEL */
    /* ============================= */

    .leaflet-control-layers span {
        margin-bottom: 4px;

        font-size: 11px;
        font-weight: 600;
        line-height: 1.2;
        color: rgba(0,0,0,0.85);

        white-space: nowrap;

        display: flex;
        justify-content: center;
        align-items: center;

        text-align: center;
    }

    /* ============================= */
    /* RANGE SLIDER (VISUAL) */
    /* ============================= */

    .leaflet-control-layers input[type='range'] {
        -webkit-appearance: none;
        appearance: none;

        width: 100%;
        height: 6px;

        margin: 0;
        border-radius: 999px;
        border: none;

        background: linear-gradient(
                to right,
                rgba(255,255,255,0.9),
                rgba(255,255,255,0.4)
        );

        outline: none;
        cursor: default;

        position: relative;
        z-index: 2;
    }

    /* ============================= */
    /* RANGE THUMB */
    /* ============================= */

    .leaflet-control-layers input[type='range']::-webkit-slider-thumb {
        -webkit-appearance: none;

        width: 14px;
        height: 14px;
        border-radius: 50%;

        background: rgba(42,108,255,0.85);
        cursor: pointer;
    }

    .leaflet-control-layers input[type='range']::-moz-range-thumb {
        width: 14px;
        height: 14px;
        border-radius: 50%;
        border: none;

        background: rgba(42,108,255,0.85);
        cursor: pointer;
    }

    .popup-image-wrapper {
        position: relative;
        /*width: 200px;*/
        height: 200px;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }

    .popup-image {
        max-width: 100%;
        max-height: 100%;
        display: none;
    }

    .spinner {
        width: 30px;
        height: 30px;
        border: 3px solid rgba(0,0,0,0.2);
        border-top: 3px solid #333;
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }

    @keyframes spin {
        to { transform: rotate(360deg); }
    }

    /* ============================= */
    /* 🔑 SLIDER HIT AREA (MAGIC) */
    /* ============================= */

    /* Невидимая зона захвата по всей карточке */
    .leaflet-control-layers.glass-control::after {
        content: '';
        position: absolute;

        left: 0;
        right: 0;
        bottom: 0;

        height: 36px;              /* 👈 зона касания пальцем */
        cursor: pointer;
    }

    /* ============================= */
    /* MOBILE */
    /* ============================= */

    @media (max-width: 768px) {
        .glass-control,
        .leaflet-control-layers.glass-control {
            width: 140px;
        }

        .leaflet-control-layers input[type='range'] {
            height: 7px;
        }

        .leaflet-control-layers input[type='range']::-webkit-slider-thumb,
        .leaflet-control-layers input[type='range']::-moz-range-thumb {
            width: 18px;
            height: 18px;
        }
    }

    /* ============================= */
    /* CAPACITOR — SAFE AREA         */
    /* ============================= */

    body.capacitor-app #map-controls-right {
        bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    }

    body.capacitor-app .coord-display {
        bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    }

    body.capacitor-app #bg-text {
        top: env(safe-area-inset-top, 0px);
    }

    /* Выравниваем нижние Leaflet-контролы с правым блоком (bottom: 8px) */
    .leaflet-bottom {
        bottom: 8px;
    }
    .leaflet-bottom .leaflet-control {
        margin-bottom: 0;
    }

    /* Кнопки Leaflet в левом нижнем углу */
    body.capacitor-app .leaflet-bottom {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    body.capacitor-app .leaflet-top {
        padding-top: env(safe-area-inset-top, 0px);
    }

    /* Скрываем кнопку истории в мобильном приложении — слишком много точек */
    body.capacitor-app #showButton {
        display: none !important;
    }
