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

body {
    overflow: hidden;
    background: #000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#container {
    width: 100vw;
    height: 100vh;
    position: relative;
    z-index: 1;
}

#container canvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
}

#loading.hidden {
    display: none;
}

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

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

#hotspot-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.hotspot {
    position: absolute;
    pointer-events: auto;
    cursor: pointer;
    transform: translate(-50%, -50%);
    transition: transform 0.2s ease;
}

.hotspot:hover {
    transform: translate(-50%, -50%) scale(1.2);
}

.hotspot-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    font-size: 24px;
}

.hotspot-icon.navigation { background: rgba(52, 199, 89, 0.9); }
.hotspot-icon.info { background: rgba(0, 122, 255, 0.9); }
.hotspot-icon.door { background: rgba(255, 149, 0, 0.9); }
.hotspot-icon.stairs { background: rgba(175, 82, 222, 0.9); }
.hotspot-icon.deck { background: rgba(90, 200, 250, 0.9); }

/* Custom icon image styling */
.hotspot-custom-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

/* When using custom icon, make background transparent */
.hotspot-icon:has(.hotspot-custom-icon) {
    background: transparent;
    box-shadow: none;
}

.hotspot-label {
    position: absolute;
    top: 55px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.hotspot:hover .hotspot-label {
    opacity: 1;
}

/* ============================================
   SETTINGS BUTTON (Minimal Icon Design)
   ============================================ */

#settings-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#settings-button:hover {
    background: rgba(40, 40, 40, 0.85);
    border-color: rgba(255, 255, 255, 0.35);
    transform: scale(1.05);
}

#settings-button:active {
    transform: scale(0.95);
}

/* ============================================
   SETTINGS MENU (Minimal Vertical Stack)
   ============================================ */

#settings-menu {
    position: fixed;
    bottom: 90px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 2001;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
}

#settings-menu.hidden {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    pointer-events: none;
}

/* ============================================
   MENU ICON BUTTONS
   ============================================ */

.menu-icon-button {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.75);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.menu-icon-button:hover {
    background: rgba(40, 40, 40, 0.9);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.08);
}

.menu-icon-button:active {
    transform: scale(0.95);
}

/* Active state for toggles */
.menu-icon-button.active {
    background: rgba(102, 126, 234, 0.85);
    border-color: rgba(102, 126, 234, 1);
}

.menu-icon-button.active:hover {
    background: rgba(102, 126, 234, 0.95);
}

/* ============================================
   BACKDROP
   ============================================ */

#settings-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1999;
    transition: opacity 0.25s;
    pointer-events: none;  /* Default: don't block clicks */
}

#settings-backdrop.visible {
    opacity: 1;
    pointer-events: auto;  /* Only capture clicks when visible */
}

#settings-backdrop.hidden {
    opacity: 0;
    pointer-events: none;
}

/* ============================================
   INFO PANEL
   ============================================ */

#info-panel {
    position: fixed;
    bottom: 90px;
    right: 20px;
    background: rgba(28, 28, 30, 0.95);
    border-radius: 12px;
    padding: 0;
    min-width: 250px;
    z-index: 2001;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

#info-panel.hidden {
    display: none;
}

.info-content {
    padding: 12px 16px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.info-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
}

.info-value {
    color: white;
    font-size: 13px;
    font-weight: 500;
}

.info-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 8px 0;
}

.build-version {
    font-family: monospace;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

/* ============================================
   DEBUG PANEL
   ============================================ */

#debug-panel {
    position: fixed;
    top: 70px;
    right: 10px;
    background: rgba(0, 0, 0, 0.9);
    color: #0f0;
    font-family: monospace;
    font-size: 11px;
    padding: 10px;
    border-radius: 8px;
    z-index: 10000;
    max-width: 200px;
    pointer-events: none;
    white-space: pre;
    line-height: 1.4;
    display: none;
}

/* Panorama title */
#panorama-title {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 16px;
    z-index: 100;
}

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

@media (max-width: 768px) {
    .hotspot-icon {
        width: 56px;
        height: 56px;
        font-size: 28px;
        min-width: 44px;
        min-height: 44px;
    }

    .hotspot-label {
        font-size: 14px;
        padding: 8px 14px;
        top: 65px;
    }

    #panorama-title {
        font-size: 14px;
        padding: 8px 16px;
        max-width: 60%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #settings-button {
        bottom: 15px;
        right: 15px;
        width: 52px;
        height: 52px;
    }

    #settings-menu {
        bottom: 80px;
        right: 15px;
    }

    .menu-icon-button {
        width: 48px;
        height: 48px;
    }
}

/* Touch feedback for mobile */
@media (hover: none) and (pointer: coarse) {
    .hotspot:active {
        transform: translate(-50%, -50%) scale(0.95);
    }

    .hotspot:active .hotspot-label {
        opacity: 1;
    }
}