:root {
    --primary-color: #3498db;
    --text-color: #2c3e50;
    --menu-bg: rgba(255, 255, 255, 0.95);
    --menu-blur: blur(12px);
    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
    /* Prevent global scrollbars */
    background: #000;
}

* {
    box-sizing: border-box;
}

.container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.header.hidden {
    transform: translateY(-100%);
}

.title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: -0.5px;
}

/* Category Buttons */
.category-selector {
    display: flex;
    gap: 8px;
    position: relative;
}

.category-group {
    position: relative;
}

.category-btn {
    padding: 8px 16px;
    border: 1px solid transparent;
    background: transparent;
    color: #666;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 20px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.category-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

.category-btn.active {
    background: #2c3e50;
    color: white;
    box-shadow: 0 2px 8px rgba(44, 62, 80, 0.3);
}

/* Scene Menus (Dropdowns) */
.scene-selector {
    display: none;
    position: fixed;
    top: var(--menu-top, 74px);
    left: var(--menu-left, 24px);
    width: var(--menu-width, 280px);
    background: var(--menu-bg);
    backdrop-filter: var(--menu-blur);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 8px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    z-index: 1000;
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: menuSlideDown 0.2s ease-out;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.scene-selector.active {
    display: block;
}

.scene-item {
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    font-size: 0.9rem;
    color: #444;
    transition: all 0.15s ease;
    margin-bottom: 2px;
}

.scene-item:hover {
    background: rgba(0, 0, 0, 0.04);
    transform: translateX(2px);
}

.scene-item.active {
    background: rgba(52, 152, 219, 0.1);
    color: var(--primary-color);
    font-weight: 600;
}

.scene-item-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    opacity: 0.8;
}

.scene-item-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Scrollbars customized */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Viewer Container */
.viewer-container {
    width: 100%;
    height: 100%;
    position: relative;
    background: #111;
}

#viewer {
    width: 100%;
    height: 100%;
}

/* Loading & Error */
.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1.1rem;
    font-weight: 500;
    padding: 16px 24px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    display: none;
    pointer-events: none;
    z-index: 50;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.8;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.8;
    }
}

.error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ff6b6b;
    background: rgba(20, 0, 0, 0.9);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid rgba(255, 107, 107, 0.3);
    display: none;
    z-index: 100;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

/* Toggle Header Button */
.toggle-header-btn {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 90;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.toggle-header-btn:hover {
    transform: scale(1.05);
}

.header:not(.hidden)~.viewer-container .toggle-header-btn {
    display: none;
}

/* Overlay UI: Scene Info & Controls */
.scene-info {
    position: absolute;
    bottom: 60px;
    /* Adjusted to avoid overlap */
    left: 24px;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 50;
    max-width: 500px;
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.scene-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.scene-description {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 400;
    line-height: 1.4;
}

.controls {
    position: absolute;
    bottom: 60px;
    /* Adjusted to avoid overlap */
    right: 24px;
    display: flex;
    gap: 12px;
    z-index: 50;
}

.control-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Hotspots - Premium Look */
.custom-hotspot {
    width: 64px;
    height: 64px;
    transform: translate(-50%, -50%);
    cursor: default;
    position: relative;
    pointer-events: none;
}

.hotspot-root {
    position: relative;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.hotspot-center {
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.6);
    pointer-events: auto;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hotspot-center::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.hotspot-ring {
    width: 100%;
    height: 100%;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    position: absolute;
    top: 0;
    left: 0;
    animation: ring-pulse 2s infinite;
    opacity: 0;
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.4);
}

@keyframes ring-pulse {
    0% {
        transform: scale(0.4);
        opacity: 0;
        border-width: 4px;
    }

    40% {
        opacity: 1;
    }

    100% {
        transform: scale(1.1);
        opacity: 0;
        border-width: 0px;
    }
}

.custom-hotspot:hover .hotspot-center {
    transform: translate(-50%, -50%) scale(1.2);
    box-shadow: 0 0 0 6px rgba(52, 152, 219, 0.8);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .header {
        padding: 0 12px;
        height: 60px;
    }

    .title {
        font-size: 0.9rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 40%;
    }

    .category-selector {
        gap: 4px;
        overflow-x: auto;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
        margin-left: 8px;
        max-width: 60%;
        scrollbar-width: none;
    }

    .category-selector::-webkit-scrollbar {
        display: none;
    }

    .category-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }

    .scene-info {
        bottom: 80px;
        left: 16px;
        max-width: 65%;
    }

    .scene-title {
        font-size: 1.3rem;
    }

    .scene-description {
        font-size: 0.9rem;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .controls {
        bottom: 80px;
        right: 16px;
        gap: 8px;
    }

    .control-btn {
        width: 42px;
        height: 42px;
        font-size: 1rem;
    }

    .scene-selector {
        width: 90% !important;
        left: 5% !important;
        --menu-left: 5% !important;
        max-height: 50vh;
    }

    /* Larger touch target for hotspots on mobile */
    .custom-hotspot {
        width: 80px;
        height: 80px;
    }

    .hotspot-center {
        width: 44px;
        height: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(52, 152, 219, 0.3);
    }

    .hotspot-center::after {
        width: 14px;
        height: 14px;
    }
}