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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8f8f8;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

#scene-container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

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

.ui-element {
    position: absolute;
    pointer-events: auto;
}

#loading {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: opacity 0.5s ease;
}

.pulse {
    width: 40px;
    height: 40px;
    background: #e8f4f8;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.2); opacity: 0.4; }
}

#loading p {
    color: #666;
    font-size: 14px;
    margin: 0;
}

#reset-btn {
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 8px;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

#reset-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#reset-btn:active {
    transform: translateY(0);
}

#reset-btn svg {
    stroke: #666;
}

#instructions {
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 14px;
    text-align: center;
    transition: opacity 0.5s ease;
    backdrop-filter: blur(10px);
}

#instructions p {
    margin: 0;
}

.berrry-footer {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    text-align: center;
    pointer-events: auto;
}

.berrry-footer p {
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    color: #666;
    margin: 0;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.berrry-footer a {
    color: #ff6b6b;
    text-decoration: none;
    font-weight: 500;
}

.berrry-footer a:hover {
    text-decoration: underline;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    #reset-btn {
        top: 15px;
        right: 15px;
        padding: 8px 12px;
        font-size: 13px;
    }
    
    #instructions {
        bottom: 80px;
        font-size: 13px;
        padding: 10px 16px;
    }
    
    .berrry-footer {
        bottom: 15px;
    }
    
    .berrry-footer p {
        font-size: 11px;
        padding: 6px 12px;
    }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    #instructions {
        bottom: 40px;
    }
    
    .berrry-footer {
        bottom: 10px;
    }
}

/* High contrast mode for accessibility */
@media (prefers-contrast: high) {
    #reset-btn {
        background: white;
        border: 2px solid #333;
    }
    
    #instructions {
        background: black;
        border: 1px solid white;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .pulse {
        animation: none;
    }
    
    #reset-btn {
        transition: none;
    }
    
    #instructions {
        transition: none;
    }
}