@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600&family=Inter:wght@400;500&display=swap');

:root {
    --text-color: #FFFFFF;
    --text-dim: rgba(255, 255, 255, 0.6);
    --primary-gold: #D6B47C;
    --bg-dark: #0B0B0C;
    --bg-glass: rgba(21, 21, 23, 0.4);
    --border-glass: rgba(255, 255, 255, 0.1);
    --transition: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --font: 'Manrope', 'Inter', sans-serif;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: var(--font);
    color: var(--text-color);
}

/* Premium Visual Utilities */
.glass-panel {
    background: rgba(21, 21, 23, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
}

.glass-btn {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass);
    color: var(--text-color);
    border-radius: 40px;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.glass-btn:hover {
    background: rgba(40, 40, 45, 0.6);
}

.primary-btn {
    background: var(--primary-gold);
    color: var(--bg-dark);
    border: none;
    border-radius: 40px;
    transition: all var(--transition);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
}

.primary-btn:hover {
    background: #E8CA98;
    box-shadow: 0 4px 15px rgba(214, 180, 124, 0.4);
}

.glow-effect {
    box-shadow: 0 0 20px rgba(214, 180, 124, 0.15);
}


#app-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background-color: #000;
    overflow: hidden;
}

.scroll-wrapper {
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-behavior: smooth;
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}
.scroll-wrapper::-webkit-scrollbar {
    display: none;
}

#aspect-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    max-width: 100vw;
    overflow: hidden;
}

#aspect-wrapper.aspect-16-9 {
    aspect-ratio: 16 / 9;
    height: auto;
    max-width: 100vw;
    max-height: 100vh;
    max-height: 100dvh;
}
@media (min-aspect-ratio: 16/9) {
    #aspect-wrapper.aspect-16-9 {
        height: 100vh;
        height: 100dvh;
        width: auto;
    }
}

#aspect-wrapper.aspect-9-16 {
    aspect-ratio: 9 / 16;
    width: auto;
    max-width: 100vw;
    max-height: 100vh;
    max-height: 100dvh;
}
@media (max-aspect-ratio: 9/16) {
    #aspect-wrapper.aspect-9-16 {
        width: 100vw;
        height: auto;
    }
}

#video-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.video-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.6s ease-in-out; /* Плавный переход при смене */
    pointer-events: none;
}

.video-player.active {
    opacity: 1;
    z-index: 2;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none; /* Пропускаем клики сквозь пустые места */
}

/* Градиентные тени для премиального вида и читаемости текста */
#ui-layer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 15vw;
    min-height: 100px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
    z-index: -1;
}

#ui-layer::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 20vw;
    min-height: 150px;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    z-index: -1;
}

/* Делаем элементы UI интерактивными */
#ui-layer > * {
    pointer-events: auto;
}

.top-info-dropdown {
    position: absolute;
    top: 30px;
    left: 30px;
    width: auto;
    max-width: 420px;
    background: rgba(20, 20, 20, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-light);
    border-radius: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    animation: fadeInDown 0.6s ease forwards;
}

.top-info-dropdown.open {
    border-radius: 20px;
    width: 420px;
}

.top-info-header {
    display: flex;
    align-items: center;
    padding: 6px 14px 6px 6px;
    cursor: pointer;
    gap: 12px;
}

.top-info-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-info-title {
    flex: 1;
    font-weight: 500;
    font-size: 15px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 5px;
}

.top-info-toggle-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.chevron-icon {
    transition: transform var(--transition);
}

.top-info-dropdown.open .chevron-icon {
    transform: rotate(180deg);
}

.top-info-content-wrapper {
    max-height: 0;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    pointer-events: none;
}

.top-info-dropdown.open .top-info-content-wrapper {
    max-height: 60vh;
    opacity: 1;
    pointer-events: auto;
}

.top-info-content-scroll {
    padding: 0 25px 25px 25px;
    max-height: 60vh;
    overflow-y: auto;
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* Custom Scrollbar */
.top-info-content-scroll::-webkit-scrollbar {
    width: 6px;
}
.top-info-content-scroll::-webkit-scrollbar-track {
    background: transparent; 
}
.top-info-content-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2); 
    border-radius: 10px;
}
.top-info-content-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4); 
}

/* Drawer Content Styling */
.floating-desc-box {
    font-size: 15px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 5px;
    padding-top: 15px;
    margin-bottom: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 400;
    letter-spacing: 0.2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.floating-desc-box:empty {
    display: none;
}

.floating-gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.floating-gallery-grid .gallery-item {
    aspect-ratio: 16 / 9;
    border-radius: 8px;
}

/* Instruction Overlay */
.instruction-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.instruction-overlay.fade-out {
    animation: fadeOut 0.4s ease forwards;
}

@keyframes fadeOut {
    to { opacity: 0; }
}

/* Instruction Modal */
.instruction-modal {
    background: rgba(20, 20, 20, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 35px;
    width: 90%;
    max-width: 550px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-sizing: border-box;
}

/* Custom Scrollbar for Instruction Modal */
.instruction-modal::-webkit-scrollbar {
    width: 6px;
}
.instruction-modal::-webkit-scrollbar-track {
    background: transparent; 
}
.instruction-modal::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2); 
    border-radius: 10px;
}

.instruction-modal h2 {
    margin: 0 0 5px 0;
    font-size: 22px;
    font-weight: 600;
    text-align: center;
    color: white;
    letter-spacing: 0.5px;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(255, 255, 255, 0.03);
    padding: 16px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.instruction-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.instruction-icon svg {
    width: 24px; 
    height: 24px;
}

.instruction-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.instruction-text strong {
    font-size: 15px;
    color: white;
    font-weight: 600;
}

.instruction-text span {
    font-size: 13px;
    line-height: 1.5;
    color: #a1a1aa;
}

.instruction-ok-btn {
    background: #f97316;
    color: white;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font);
    border: none;
    padding: 16px;
    border-radius: 30px;
    cursor: pointer;
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.4);
    transition: var(--transition);
}

.instruction-ok-btn:hover {
    background: #ea580c;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.5);
}

.genplan-back-btn {
    background: #f97316;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 600;
    font-family: var(--font);
    font-size: 15px;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.4);
    transition: var(--transition);
    display: flex;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
}

.genplan-back-btn.icon-only {
    padding: 12px;
    border-radius: 50%;
    aspect-ratio: 1;
}

.genplan-back-btn:hover {
    background: #ea580c;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.5);
}

@keyframes eyeSlowBlink {
    0%, 75%, 100% {
        transform: translate(-50%, -50%) scaleY(1);
    }
    85% {
        transform: translate(-50%, -50%) scaleY(0.1);
    }
}

.nested-marker .marker-icon {
    transform-origin: center;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

#loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(10, 10, 10, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 20px 30px;
    border-radius: 16px;
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    pointer-events: none;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

#loading-indicator.visible {
    opacity: 1;
    visibility: visible;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.nav-controls {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 0 20px;
    z-index: 100;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--btn-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-light);
    color: var(--primary);
    padding: 14px 30px;
    font-family: var(--font);
    font-size: 16px;
    font-weight: 500;
    border-radius: 40px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.nav-btn .icon {
    width: 20px;
    height: 20px;
    transition: transform var(--transition);
}

.nav-btn.icon-only {
    padding: 12px;
    border-radius: 50%;
    aspect-ratio: 1;
}

.nav-btn.icon-only .icon {
    margin: 0;
}

.nav-btn:hover:not(.hidden) {
    background: var(--btn-hover);
    border-color: rgba(255,255,255,0.4);
    transform: translateY(-3px);
    box-shadow: 0 15px 25px rgba(0,0,0,0.3);
}

.nav-btn:active:not(.hidden) {
    transform: translateY(0);
}

#btn-next:hover:not(.hidden) .icon {
    transform: translateX(4px);
}

#btn-prev:hover:not(.hidden) .icon {
    transform: translateX(-4px);
}

/* Скрываем кнопки, оставляя их в DOM */
.nav-btn.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: scale(0.95);
    position: absolute; /* Убираем из потока, чтобы центрировать оставшуюся кнопку */
}

/* Когда одна скрыта, вторая должна оставаться по центру. 
   Поскольку flex container, position absolute ломает обычный поток,
   что нам и нужно для одинокой кнопки */
.nav-btn:not(.hidden) {
    position: relative;
}

.header-menu {
    display: flex;
    gap: 15px;
    align-items: center;
}

.sales-widget-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6) !important;
}

/* Base positioning for bottom buttons */
.mobile-lower-btn-controls {
    bottom: 60px;
}
.mobile-lower-btn-cta {
    bottom: 80px;
}

@media (max-width: 768px) {    
    .scroll-wrapper {
        justify-content: flex-start;
    }
    
    .mobile-lower-btn-controls {
        bottom: 25px !important;
    }
    
    .mobile-lower-btn-cta {
        bottom: 25px !important;
    }

    #aspect-wrapper.aspect-16-9 {
        height: 100dvh !important;
        width: calc(100dvh * (16 / 9)) !important;
        max-width: none !important;
        flex-shrink: 0;
    }
    
    .nav-btn {
        padding: 8px 14px;
        font-size: 13px;
    }
    .nav-btn.icon-only {
        padding: 8px;
    }
    .nav-controls {
        bottom: 75px;
        width: 100%;
        gap: 10px;
        padding: 0 10px;
        box-sizing: border-box;
        justify-content: center;
    }
    .top-info-dropdown {
        top: 15px;
        left: 15px;
        width: auto;
        max-width: calc(100vw - 30px);
    }
    .top-info-dropdown.open {
        width: calc(100vw - 30px);
    }
    #camera-label {
        margin: 10px;
        padding: 6px 10px;
        font-size: 12px;
    }
    .instruction-modal {
        padding: 20px;
        gap: 12px;
        border-radius: 16px;
    }
    .instruction-modal h2 {
        font-size: 18px;
    }
    .instruction-item {
        gap: 10px;
        padding: 10px;
    }
    .instruction-icon {
        width: 32px;
        height: 32px;
    }
    .gp-marker-btn {
        width: 48px;
        height: 48px;
        padding: 0;
    }
}

/* ================================= */
/*          SETUP SCREEN             */
/* ================================= */

#setup-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
    overflow-y: auto;
    padding: 20px;
}

.setup-card {
    background: rgba(20, 25, 35, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 1400px;
    margin: auto;
    margin-top: 40px;
    margin-bottom: 40px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
    animation: setupFadeIn 0.5s ease-out forwards;
}

@keyframes setupFadeIn {
    from { opacity: 0; transform: scale(0.95) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.setup-card h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 12px;
    background: linear-gradient(90deg, #fff, #a5b4fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.setup-card p {
    color: #94a3b8;
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 30px;
}

.camera-block {
    background: rgba(10, 15, 25, 0.5);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    transition: var(--transition);
}

.camera-header {
    font-size: 18px;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.upload-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

@media (min-width: 650px) {
    .upload-grid.has-transitions {
        grid-template-columns: 1fr 1fr;
    }
    .upload-grid.has-transitions .full-width {
        grid-column: span 2;
    }
}

.upload-group {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 15px;
    transition: var(--transition);
}

.upload-group:hover {
    border-color: rgba(255,255,255,0.15);
    background: rgba(0, 0, 0, 0.4);
}

.upload-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #cbd5e1;
    margin-bottom: 10px;
}

.upload-group input[type="file"] {
    width: 100%;
    font-size: 13px;
    color: #94a3b8;
}

.upload-group input[type="file"]::file-selector-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    margin-right: 10px;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font);
}

.upload-group input[type="file"]::file-selector-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.action-btn {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font);
}

.outline-btn {
    background: transparent;
    color: #a5b4fc;
    border: 2px dashed rgba(165, 180, 252, 0.3);
}

.outline-btn:hover {
    background: rgba(165, 180, 252, 0.1);
    border-color: rgba(165, 180, 252, 0.6);
}

.media-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}
.media-preview-item {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.2);
    transition: box-shadow 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 1;
}
.media-preview-item:hover {
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    z-index: 50;
}
.media-preview-item img, .media-preview-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.media-preview-item .remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.media-preview-item .remove-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* --- Toggle Switch --- */
.loop-toggle-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
    padding: 15px 20px;
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.05);
}

.loop-label-text {
    font-size: 14px;
    font-weight: 500;
    color: #e2e8f0;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255,255,255,0.1);
    transition: .4s;
    border-radius: 34px;
    border: 1px solid rgba(255,255,255,0.2);
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent);
    border-color: var(--accent);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

.loop-camera-block {
    background: rgba(165, 180, 252, 0.05);
    border: 1px solid rgba(165, 180, 252, 0.2);
}

.setup-btn {
    width: 100%;
    background: var(--accent);
    color: white;
    border: none;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.setup-btn:hover {
    background: #2563eb;
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
    transform: translateY(-2px);
}

.setup-btn:active {
    transform: translateY(0);
}

/* --- Модальное окно (Share Modal) --- */
.modal-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-card {
    background: var(--surface);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 30px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.modal-card h2 {
    color: #e2e8f0;
    margin-top: 0;
    margin-bottom: 5px;
    font-size: 20px;
}

.modal-card p {
    color: #94a3b8;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 20px;
}

#modal-link-input {
    width: 100%;
    box-sizing: border-box;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(165, 180, 252, 0.3);
    color: #a5b4fc;
    padding: 12px;
    border-radius: 8px;
    font-size: 16px;
    font-family: monospace;
    text-align: center;
    outline: none;
}

/* --- GENPLAN MARKERS --- */
.genplan-marker {
    opacity: 0.7;
    position: absolute;
    padding: 6px 14px;
    background-color: rgba(239, 68, 68, 0.9);
    border: 2px solid white;
    border-radius: 20px;
    transform: translate(-50%, -50%);
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 13px;
    pointer-events: auto; /* Required for dragging */
    z-index: 10;
    white-space: nowrap;
    cursor: grab;
}

.genplan-marker:active {
    cursor: grabbing;
}

.genplan-marker:hover {
    opacity: 1;
}

.marker-icon {
    width: 14px;
    height: 14px;
    margin-right: 6px;
    flex-shrink: 0;
}

.nested-marker .marker-icon {
    margin: 0;
    width: 24px;
    height: 24px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Placed in viewer */
.gp-marker-btn {
    opacity: 0.9;
    position: absolute;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 20;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.gp-marker-btn:hover,
.gp-marker-btn.touch-active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.15);
    z-index: 999;
}

.gp-marker-btn .marker-container {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
    position: relative;
}

.gp-marker-btn .marker-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    animation: markerPulseLight 2s infinite cubic-bezier(0.3, 0, 0, 1);
    z-index: -1;
    pointer-events: none;
}

@keyframes markerPulseLight {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
    }
    70% {
        box-shadow: 0 0 0 16px rgba(255, 255, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

.marker-inner-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.marker-icon-custom {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.gp-marker-btn.has-custom-icon .marker-container {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Spinner Type */
.gp-marker-btn.type-spinner .marker-container {
    border: 1px solid rgba(214, 180, 124, 0.5);
    box-shadow: 0 0 20px rgba(214, 180, 124, 0.4), inset 0 0 10px rgba(214, 180, 124, 0.2);
}
.gp-marker-btn.type-spinner .marker-inner-dot {
    background: var(--accent-gold);
    box-shadow: 0 0 8px var(--accent-gold);
}

/* Location Type */
.gp-marker-btn.type-media .marker-container {
    border: 1px solid rgba(165, 180, 252, 0.5);
    box-shadow: 0 0 20px rgba(100, 150, 255, 0.4), inset 0 0 10px rgba(100, 150, 255, 0.2);
}
.gp-marker-btn.type-media .marker-inner-dot {
    background: #eff6ff;
    box-shadow: 0 0 8px #a5b4fc;
}

/* Layout Type */
.gp-marker-btn.type-layout .marker-container {
    border: 1px solid rgba(168, 85, 247, 0.5);
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.4), inset 0 0 10px rgba(168, 85, 247, 0.2);
}
.gp-marker-btn.type-layout svg {
    width: 14px !important;
    height: 14px !important;
    color: #e9d5ff;
    filter: drop-shadow(0 0 4px #c084fc);
}

/* Custom tooltip for descriptions */
.marker-tooltip {
    position: fixed !important;
    top: 50% !important;
    left: 80px !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    width: 350px !important;
    max-width: 350px !important;
    text-align: left !important;
    color: #fff;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    z-index: 5000 !important;
}

.marker-tooltip img, .marker-tooltip video {
    margin: 0;
}

.marker-tooltip::after {
    display: none !important;
}

/* Hover rules are consolidated at the bottom of the file */

/* --- SIDEBAR LAYOUT (For 9:16 format with Genplan) --- */
#app-container.with-sidebar {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 30px;
    padding: 20px;
    box-sizing: border-box;
}

#app-container.with-sidebar #aspect-wrapper {
    height: calc(100vh - 40px);
    max-height: calc(100vh - 40px);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    flex-shrink: 0;
}

#sidebar-panel {
    width: 400px;
    max-width: 100%;
    height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    background: rgba(20, 25, 35, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5);
    position: relative;
    font-family: var(--font);
    overflow: hidden;
}

.sidebar-header {
    padding: 25px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background: rgba(0,0,0,0.3);
}

#sidebar-title {
    font-size: 20px;
    font-weight: 600;
    color: #f8fafc;
    letter-spacing: 0.5px;
}

.sidebar-content {
    padding: 25px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.sidebar-desc-box {
    font-size: 15px;
    line-height: 1.6;
    color: #cbd5e1;
    white-space: pre-wrap;
}

#sidebar-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.gallery-item {
    aspect-ratio: 1;
    background: rgba(0,0,0,0.5);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.1);
    transition: var(--transition);
}

.gallery-item:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    border-color: rgba(255,255,255,0.4);
}

.gallery-item img, .gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* --- LIGHTBOX MODAL --- */
#lightbox-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

#lightbox-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#lightbox-content img {
    width: 50vw;
    max-width: 900px;
    max-height: 70vh;
    object-fit: cover;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    background: #000;
    border: 1px solid rgba(255,255,255,0.1);
}

.custom-video-wrapper {
    position: relative;
    display: flex;
    overflow: hidden;
    width: 50vw;
    max-width: 900px;
    max-height: 70vh;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    background: #000;
    border: 1px solid rgba(255,255,255,0.1);
}

.custom-video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
    box-shadow: none;
    border: none;
}

.custom-video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
    display: flex;
    align-items: center;
    gap: 15px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.custom-video-wrapper:hover .custom-video-controls {
    opacity: 1;
}

.custom-play-btn {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.custom-play-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.custom-play-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    stroke: currentColor;
}

.custom-progress-container {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(5px);
}

.custom-progress-filled {
    height: 100%;
    background: var(--accent);
    width: 0%;
    border-radius: 3px;
    pointer-events: none;
    box-shadow: 0 0 10px var(--accent);
}

.custom-time-display {
    color: white;
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font);
    font-variant-numeric: tabular-nums;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    flex-shrink: 0;
}

@media (max-width: 768px) {
    #lightbox-content img, .custom-video-wrapper {
        width: 90vw;
        max-height: 50vh;
    }
}

#btn-lightbox-close {
    position: absolute;
    top: 30px;
    right: 30px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    font-family: var(--font);
    font-size: 16px;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    transition: var(--transition);
    z-index: 1001;
}

#btn-lightbox-close.icon-only {
    padding: 12px;
    border-radius: 50%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

#btn-lightbox-close:hover {
    background: #ef4444;
    border-color: #ef4444;
}

/* Floor Plan CTA Button */
.floorplan-cta-btn {
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(168, 85, 247, 0.6);
    color: #e9d5ff;
    font-size: 16px;
    padding: 18px 45px;
    border-radius: 40px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition, all 0.3s ease);
    box-shadow: 0 4px 15px rgba(0,0,0,0.5), inset 0 0 10px rgba(168, 85, 247, 0.1);
    text-shadow: 0 0 4px rgba(192, 132, 252, 0.5);
}

.floorplan-cta-btn:hover {
    background: rgba(20, 20, 25, 0.95);
    border-color: rgba(168, 85, 247, 0.9);
    box-shadow: 0 10px 25px rgba(0,0,0,0.6), inset 0 0 15px rgba(168, 85, 247, 0.4);
    transform: translateY(-2px);
    color: #fff;
    text-shadow: 0 0 8px rgba(192, 132, 252, 0.8);
}

/* Spinner Arrow Button (Gold) */
.spinner-arrow-btn {
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(214, 180, 124, 0.5);
    color: #d6b47c;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5), inset 0 0 10px rgba(214, 180, 124, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner-arrow-btn svg {
    filter: drop-shadow(0 0 2px rgba(214, 180, 124, 0.5));
    transition: all 0.3s ease;
}

.spinner-arrow-btn:hover {
    background: rgba(20, 20, 25, 0.95);
    border-color: rgba(214, 180, 124, 0.9);
    box-shadow: 0 10px 25px rgba(0,0,0,0.6), inset 0 0 15px rgba(214, 180, 124, 0.4);
    transform: translateY(-2px);
    color: #fff;
}

.spinner-arrow-btn:hover svg {
    filter: drop-shadow(0 0 6px #d6b47c);
    color: #d6b47c;
}

/* ================================= */
/* ================================= */
/*          INFO DROPDOWN            */
/* ================================= */
/* Base styles updated at the top of the file */


#aspect-wrapper.aspect-9-16 .floating-open-btn,
#aspect-wrapper.aspect-9-16 .floating-panel {
    display: none !important;
}

/* --- Вложенные и Скрытые маркеры --- */
.genplan-marker.hidden-marker {
    opacity: 0.3;
    pointer-events: none; /* In editor, maybe they should be clickable to re-drag? We let them be clickable in editor by overriding later if needed */
}

.nested-marker {
    opacity: 0.9;
    position: absolute;
    background: var(--btn-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-light);
    color: var(--primary);
    width: 48px;
    height: 48px;
    padding: 0;
    box-sizing: border-box;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translate(-50%, -50%);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    transition: var(--transition);
    z-index: 50;
    cursor: grab;
    pointer-events: auto;
}

.nested-marker::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    animation: markerPulseLight 2s infinite cubic-bezier(0.3, 0, 0, 1);
    z-index: -1;
    pointer-events: none;
}

.nested-marker:active {
    cursor: grabbing;
}

.nested-marker:hover,
.nested-marker.touch-active {
    opacity: 1;
    background: var(--btn-hover);
    border-color: rgba(255,255,255,0.4);
    transform: translate(-50%, -50%) scale(1.05);
    box-shadow: 0 15px 25px rgba(0,0,0,0.3);
    z-index: 999;
}


.mobile-enter-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 14px;
    font-family: var(--font);
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    width: 100%;
    box-sizing: border-box;
    backdrop-filter: blur(5px);
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.mobile-enter-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.url-input {
    width: 100%;
    box-sizing: border-box;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 10px;
    border-radius: 8px;
    font-family: var(--font);
    font-size: 13px;
    margin-top: 8px;
}
.url-input:focus {
    outline: none;
    border-color: #38bdf8;
    background: rgba(0,0,0,0.5);
}

.nav-btn-bottom { background: transparent; color: rgba(255,255,255,0.6); padding: 10px 24px; border-radius: 30px; border: none; font-size: 14px; display: flex; align-items: center; gap: 8px; cursor: pointer; transition: all 0.3s ease; }
.nav-btn-bottom:hover { color: white; background: rgba(255,255,255,0.05); }
.nav-btn-bottom.active { background: rgba(255,255,255,0.1); color: white; }

/* Custom Webkit Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(214, 180, 124, 0.4);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(214, 180, 124, 0.8);
}
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(214, 180, 124, 0.4) transparent;
}

#btn-explore-project:hover, .glass-btn:hover, .nav-btn-bottom:hover {
    background: rgba(214, 180, 124, 0.15) !important;
    box-shadow: 0 0 20px rgba(214, 180, 124, 0.4) !important;
    border-color: rgba(214, 180, 124, 0.6) !important;
    color: #fff !important;
}

#btn-explore-project:hover, .glass-btn:hover {
    transform: translateY(-2px);
}

/* =========================================
   MOBILE RESPONSIVENESS OVERRIDES
========================================= */
.mobile-drawer-handle {
    display: none;
}

@media screen and (max-width: 768px) {
    /* Global Headers */
    #global-header {
        padding: 15px !important;
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    #header-left {
        width: 100%;
        justify-content: space-between;
    }
    
    #header-right {
        position: absolute !important;
        top: 15px !important;
        right: 15px !important;
        width: auto !important;
    }
    
    #btn-genplan-back, #btn-guided-tour, .top-info-dropdown {
        left: 15px !important;
        top: 15px !important;
    }
    
    .top-info-dropdown.open {
        width: calc(100vw - 30px) !important;
    }
    
    /* Hamburger Menu Overrides */
    #btn-hamburger {
        display: flex !important;
    }
    
    #hamburger-menu {
        display: none; /* JS toggles to flex */
        position: absolute;
        top: 50px;
        right: 0;
        flex-direction: column;
        background: rgba(21, 21, 23, 0.6);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 16px;
        padding: 15px;
        gap: 12px;
        min-width: 180px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.5);
        z-index: 1000;
        align-items: stretch !important;
    }
    
    #btn-guided-tour {
        width: 100%;
        justify-content: center;
        position: relative !important;
        left: auto !important;
        top: auto !important;
    }

    /* Force Horizontal Panorama Scroll on Mobile */
    #scroll-wrapper {
        align-items: flex-start; /* Keep at top */
    }
    
    #aspect-wrapper {
        height: 100vh !important;
        width: calc(100vh * (16 / 9)) !important;
        max-width: none !important;
        max-height: none !important;
        flex-shrink: 0 !important;
    }
    
    /* Floating UI Panels (Genplan, Location, Layout) - SLIDE OUT EFFECT */
    #ui-state-genplan, #ui-state-location, #ui-state-layout-ext {
        left: 0 !important;
        top: 45% !important;
        transform: translate(0, -50%) !important; /* Visible position by default */
        transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
        
        width: calc(100% - 40px) !important;
        max-width: 350px !important;
        padding: 25px !important;
        text-align: center;
        box-sizing: border-box;
    }
    
    /* The toggled hidden state */
    #ui-state-genplan.mobile-collapsed, #ui-state-location.mobile-collapsed, #ui-state-layout-ext.mobile-collapsed {
        transform: translate(calc(-100% + 24px), -50%) !important;
    }
    
    /* Pull Handle UI */
    .mobile-drawer-handle {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 50%;
        right: 0;
        transform: translate(100%, -50%);
        width: 24px;
        height: 64px;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-left: none;
        border-radius: 0 8px 8px 0;
        cursor: pointer;
        z-index: 100;
        box-shadow: 5px 0 15px rgba(0,0,0,0.3);
    }
    .handle-arrow {
        width: 14px;
        height: 14px;
        color: rgba(255, 255, 255, 0.9);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    /* When collapsed (hidden), arrow points right to open */
    .mobile-collapsed .handle-arrow {
        transform: rotate(180deg);
    }
    
    #genplan-title, #location-title, #house-title {
        font-size: 26px !important;
    }
    
    #genplan-metrics, #location-metrics, #house-metrics {
        justify-content: center !important;
        gap: 15px !important;
        flex-wrap: wrap !important;
    }
    
    #btn-explore-project, #btn-location-details {
        margin: 0 auto;
        width: 100%;
        justify-content: center;
    }

    /* Bottom Filters */
    #genplan-nav-bottom {
        bottom: 15px !important;
        width: 95%;
        z-index: 95; /* ensure under modals */
    }
    
    #genplan-nav-bottom .glass-panel {
        width: 100%;
        justify-content: space-between;
    }
    
    .nav-btn-bottom {
        padding: 10px !important;
        font-size: 11px !important;
        flex-direction: column;
        gap: 4px;
        flex: 1;
        justify-content: center;
        text-align: center;
    }
    
    #nav-label-1, #nav-label-2, #nav-label-3 {
        display: none !important;
    }
    
    #nav-icon-spinner, #nav-icon-media, #nav-icon-layout {
        transform: scale(1.6);
        margin: 4px 0;
    }
    
    #btn-filter-toggle {
        font-size: 10px !important;
    }

    /* Floorplan & Controls */
    #ui-bottom-controls {
        bottom: 75px !important;
    }
    
    #btn-enter-floorplan {
        bottom: 60px !important;
    }

    /* Sales Widget - Move to hamburger menu */
    #btn-sales-widget {
        position: relative !important;
        top: auto !important; 
        bottom: auto !important;
        right: auto !important;
        left: auto !important;
        width: 100%;
        padding: 12px 20px !important;
        border-radius: 30px !important;
        font-size: 14px !important;
    }

    /* Modals (Onboarding & Sales) */
    .instruction-modal, .sales-modal-content {
        padding: 20px !important;
        width: 95% !important;
        max-height: 85vh !important;
        overflow-y: auto !important;
        gap: 20px !important;
    }
    
    #btn-instruction-close-x, #btn-sales-close {
        top: 10px !important;
        right: 10px !important;
    }
    
    .sales-form-grid, .sales-contact-grid {
        grid-template-columns: 1fr !important;
    }
    
    .sales-feature {
        align-items: flex-start !important;
    }
}
