:root {
    --primary-bg: #ffffff;
    --overlay-bg: rgba(0, 0, 0, 0.4);
    --accent-blue: #0066ff;
    --text-dark: #333333;
    --glass-blur: blur(10px);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--primary-bg);
}

/* Map Container */
#viewport {
    width: 100vw;
    height: 100vh;
    cursor: grab;
    overflow: hidden;
    position: relative;
    background: #f0f2f5;
    touch-action: none;
}

#map-container {
    position: absolute;
    transform-origin: 0 0;
    will-change: transform;
    filter: brightness(1.05) saturate(1.15);  
    user-drag: none;
}

#map-image {
    display: block;
    user-select: none;
    width: 2560px; 
    height: 1440px;
    pointer-events: none;
    user-drag: none;
    touch-action: none;
}

/* Pins */
.pin {
    position: absolute;
    width: 32px;
    height: 32px;
    background: #ffab1c;
    border: 3px solid white;
    border-radius: 50% 50% 50% 0;
    transform: translate(-50%, -100%) rotate(-45deg);
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: transform 0.2s;
    z-index: 10;
}

.pin:active {
    transform: translate(-50%, -100%) rotate(-45deg) scale(1.2);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.modal-overlay:not(.active) * {
    pointer-events: none!important;
}

.modal-overlay.active {
    opacity: 1;
}

.modal-content {
    position: relative;
    width: 80%;
    height: 80%;
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    transform: scale(0.5);
    opacity: 0;
    transition: opacity 0.5s, transform 0.5s;
    pointer-events: none;
    background: linear-gradient(0deg, #cee2ff, #7c96bd);
}

.modal-content  .bg-img {
    display: none;
    position: absolute;
    left: 0; bottom: 0;
    width: 100%;
    height: 70%;
    background-image: url(setka.png);
    background-position: top;
    background-size: cover;
    background-repeat: no-repeat;
    opacity: 0.45;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
    opacity: 1;
    pointer-events: all;
}

/* Viewer & Loader */
.viewer-container {
    flex: 1;
    position: relative;
    /* background-color: #f8f9fa; */
}

model-viewer {
    position: absolute;
    bottom: 200vh;
    left: -2px;
    width: calc(100% + 4px);
    height: calc(100% + 4px);
    opacity: 0;
    transition: opacity 0.4s ease;
}

model-viewer.loaded {
    opacity: 1;
    bottom: -2px;
}

.modal-overlay.active  model-viewer {
    bottom: 0;
}

.loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    /* border-top: 4px solid var(--accent-blue); */
    border-top: 5px solid #ffab1c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
}

.loader.visible {
    display: block;
}

.progress {
    display: none;
    position: absolute;
    left: 50%; top: 50%; 
    transform: translate(-50%, 45px);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 20px;
    /* font-weight: bold; */
    /* color: var(--accent-blue); */
    color: #ffffff;
}

.progress.visible {
    display: block;
}

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

/* Controls */
.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 110;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    font-size: 30px;
    font-weight: lighter;
    color: #141414;
    transform: rotate(45deg);
    border: none;
}

.info-btn {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 30px;
    background: var(--accent-blue);
    background: #ffab1c;
    color: white;
    border-radius: 30px;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    z-index: 105;
    box-shadow: 0 4px 15px rgba(0,102,255,0.3);
}

/* Info Layer */
#info-layer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(10px);
    z-index: 120;
    
    overflow-y: auto;
    pointer-events: none;
    opacity: 0;
    transform: translateY(100%);
    transition: opacity 0.5s, transform 0.5s;
    will-change: opacity;
}

#info-layer [data-scrollbar-scroller] {
    position: absolute;
    left: 0; top: 0; width: 100%; height: 100%;
    overflow-y: auto;
    padding: 40px 50px;
}

scroll-bar {
    position: absolute;
    width: 20px; height: 20px;
    --track-width: 2px;
    --track-color: #00000011;
    --thumb-width: 4px;
    --thumb-color: #ffab1c;
}

scroll-bar:not([horizontal]) { 
    right: 4px; 
    top: 80px; 
    height: calc(100% - 100px);
}

scroll-bar[horizontal] { 
    left: 0; 
    bottom: 0; 
    width: 100% 
}

:root, /* optional to hide page scrollbars */
.hide-scrollbars, /* additional helper optional*/
[data-scrollbar-scroller] {
    -ms-overflow-style: none;  /* Hide native scrollbars IE and Edge */
    scrollbar-width: none;  /* Hide native scrollbars Firefox */
}

:root::-webkit-scrollbar, /* optional to hide page scrollbars */
.hide-scrollbars::-webkit-scrollbar, /* additional helper optional*/
[data-scrollbar-scroller]::-webkit-scrollbar {
    display: none; width: 0; height: 0;  /* Hide native scrollbars Webkit */
}


#info-layer.active {
    transform: translateY(0%);
    opacity: 1;
    pointer-events: all;
}

.info-header {
    font-size: 26px;
    margin-bottom: 20px;
    color: #444;
    padding-right: 40px;
}

.info-body,
.info-tiles-title {
    color: #444;
    font-size: 20px;
    line-height: 24px;
}

.info-tiles-title { display: none; margin-top: 20px; }
.info-tiles-title.visible { display: block; }

.info-body ul {
    margin: 0;
    padding: 10px 0 10px 20px;
}

.info-body ul li {
    margin: 0;
    padding: 0;
    padding-left: 10px;
}


#info-tiles {
    width: 100%;
    height: auto;
    margin-top: 20px;

    display: grid;
    /* Задает минимальную ширину плитки (250px) и позволяет ей расти до 1fr */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px; /* Отступы между плитками */
    padding: 0px;
}

#info-tiles .tile {
    width: 100%;
    height: auto;

    background-color: #ffab1c; /* Тот самый CMYK 0/33/89/0 */
    border: 1px solid #d48a00;
    border-radius: 4px;
    /* min-height: 150px; */
}

@media (max-width: 700px) {

    .info-header {
        font-size: 20px;
        margin-bottom: 20px;
        color: #444;
        padding-right: 40px;
    }

    .info-body,
    .info-tiles-title {
        color: #444;
        font-size: 16px;
        line-height: 18px;
    }

}

/* UI Helpers */
.zoom-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 50;
}

.zoom-btn {
    width: 45px;
    height: 45px;
    background: white;
    border: none;
    border-radius: 8px;
    font-size: 30px;
    font-weight: lighter;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    cursor: pointer;
    color: #141414;
    touch-action: none;
}

#logo {
    position: absolute;
    left: 20px; top: 20px;
    width: 60px; height: auto;
    pointer-events: none;
    z-index: 1000;
}

#logo-text  {
    position: absolute;
    left: 90px; top: 60px; transform: translateY(-50%);
    width: auto; height: 36px;
    pointer-events: none;
    z-index: 1000;
}

@media (max-width: 700px) {
    .modal-content {
        width: 100%;
        height: 100%;
        border-radius: 0px;
    }
}

model-viewer::part(default-ar-button) {
    position: absolute !important;
    left: 16px !important;
    bottom: 16px !important;
    right: auto !important;
    top: auto !important;
    
    /* Сброс дефолтных трансформаций, если они мешают */
    transform: none !important;
    margin: 0 !important;
}