html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
}

#map {
    height: 100vh;
    width: 100%;
}

/* ===== ЛЕГЕНДА ===== */

#layersLegend {
    position:absolute;
    right:12px;
    bottom:12px;
    z-index:9999;
    background:white;
    padding:12px;
    border-radius:8px;
    border:1px solid #ccc;
    box-shadow:0 6px 18px rgba(0,0,0,0.18);
    font-size:13px;
    min-width:180px;
}

.legend-row{
    display:flex;
    align-items:center;
    margin-bottom:6px;
}

.legend-circle{
    width:14px;
    height:14px;
    border-radius:50%;
    margin-right:8px;
    border:2px solid rgba(0,0,0,0.2);
}

/* ===== АВТОРИЗАЦИЯ ===== */

.auth-box {
    position:absolute;
    top:12px;
    left:12px;
    z-index:10000;
    background:white;
    padding:10px;
    border-radius:6px;
    box-shadow:0 2px 6px rgba(0,0,0,0.2);
    display:flex;
    flex-direction:column;
    gap:6px;
}

.auth-buttons{
    display:flex;
    gap:6px;
}

/* ===== ФИЛЬТРЫ ===== */

#toggleFiltersBtn {
    padding:10px 14px;
    background:white;
    border:1px solid #ccc;
    cursor:pointer;
    border-radius:6px;
    font-size:14px;
    box-shadow:0 2px 6px rgba(0,0,0,0.15);
    position:absolute;
    top:112px;
    left:12px;
    z-index:9999;
}

#filtersBox {
    position:absolute;
    top:152px;
    left:12px;
    z-index:9999;
    width:360px;
    max-height:86vh;
    overflow:auto;
    background:white;
    border:1px solid #ccc;
    border-radius:8px;
    padding:12px;
    display:none;
    box-shadow:0 6px 18px rgba(0,0,0,0.18);
}

.tag-btn{
    display:inline-block;
    padding:6px 10px;
    margin:4px;
    border-radius:6px;
    border:1px solid #888;
    background:#f7f7f7;
    cursor:pointer;
    font-size:13px;
}

.tag-btn.active{
    background:#4CAF50;
    color:white;
    border-color:#4CAF50;
}

.clear-btn{
    padding:6px 12px;
    margin-top:10px;
    background:#e53935;
    color:white;
    border:none;
    border-radius:6px;
    font-size:13px;
    cursor:pointer;
}

/* ===== PREVIEW ОКНО ===== */

.preview-window{
    width:360px;
    max-width:90vw;
    display:flex;
    flex-direction:column;
    padding:14px;
    box-sizing:border-box;
}

.preview-main-image{
    width:100%;
    height:200px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:#f3f3f3;
    border-radius:12px;
    overflow:hidden;
}

.preview-main-image img{
    max-width:100%;
    max-height:100%;
    object-fit:contain;
}

.preview-gallery{
    display:flex;
    gap:6px;
    margin-top:8px;
    overflow-x:auto;
}

.preview-gallery img{
    width:60px;
    height:60px;
    object-fit:cover;
    border-radius:6px;
    cursor:pointer;
    flex-shrink:0;
}

.preview-text{
    margin-top:10px;
    font-size:14px;
    max-height:120px;
    overflow:auto;
}

.preview-3d{
    width:100%;
    padding:8px;
    margin-top:8px;
    background:#4CAF50;
    color:white;
    border:none;
    border-radius:8px;
    cursor:pointer;
}

.preview-3d:hover{
    background:#388E3C;
}

.preview-close{
    width:100%;
    padding:10px;
    margin-top:10px;
    background:#e53935;
    color:white;
    border:none;
    border-radius:8px;
    font-weight:bold;
    cursor:pointer;
}

.preview-close:hover{
    background:#c62828;
}

/* ===== МОДАЛКА QR ===== */

.qr-modal{
    display:none;
    position:fixed;
    z-index:10001;
    left:50%;
    top:50%;
    transform:translate(-50%,-50%);
    background:white;
    padding:20px;
    border-radius:8px;
    box-shadow:0 4px 12px rgba(0,0,0,0.3);
}

.qr-modal-close{
    position:absolute;
    top:8px;
    right:8px;
    cursor:pointer;
    font-size:16px;
    font-weight:bold;
}

/* ===== GOOGLE INFO WINDOW FIX ===== */

.gm-style .gm-style-iw-c{
    padding:0 !important;
    border-radius:16px !important;
    box-shadow:0 12px 35px rgba(0,0,0,0.25) !important;
}

.gm-style .gm-style-iw-d{
    overflow:hidden !important;
}

.gm-style-iw-chr{
    display:none !important;
}

/* ===== Мобильная адаптация ===== */

@media (max-width:600px){
    .preview-main-image{
        height:160px;
    }

    .preview-window{
        width:95vw;
    }
}

/* ===== Маркеры ===== */
.petroglyph-marker{
    width:36px;
    height:36px;
    cursor:pointer;
    display:block;
    transition: transform 0.15s ease;
    transform-origin:center;
}

.petroglyph-marker:hover{
    transform: scale(1.8);
}

.petroglyph-marker svg{
    width:100%;
    height:100%;
    display:block;
}