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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    background: #000;
}

/* Model Viewer - Full Screen */
model-viewer {
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1e 100%);
    position: fixed;
    top: 0;
    left: 0;
}

/* AR Button */
#ar-button {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
    z-index: 10;
    transition: all 0.3s ease;
}

#ar-button:active {
    transform: translateX(-50%) scale(0.95);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Menu Toggle Button - Right Side */
.menu-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-toggle:active {
    transform: scale(0.9);
}

.menu-toggle.active {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* Overlay */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 998;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Control Menu - Slide from Right */
.control-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 400px;
    height: 100vh;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.5);
    z-index: 999;
    overflow-y: auto;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-overflow-scrolling: touch;
}

.control-menu.active {
    right: 0;
}

/* Menu Header */
.menu-header {
    position: sticky;
    top: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.menu-header h2 {
    color: white;
    font-size: 24px;
    font-weight: 700;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-btn:active {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0.9);
}

/* Menu Content */
.menu-content {
    padding: 20px;
    padding-bottom: 100px;
}

.menu-section {
    margin-bottom: 30px;
}

.menu-section h3 {
    color: #667eea;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Model Buttons */
.model-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.model-btn {
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.model-btn:active {
    transform: scale(0.98);
}

.model-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Animation Select */
.animation-select {
    margin-bottom: 20px;
}

.animation-select label {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    margin-bottom: 8px;
    font-weight: 500;
}

select {
    width: 100%;
    padding: 14px;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    font-size: 16px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='white' d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

/* Playback Buttons */
.playback-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.control-btn {
    padding: 16px 8px;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
}

.control-btn .icon {
    font-size: 24px;
}

.control-btn:active {
    transform: scale(0.95);
}

.play-btn:active {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
}

.pause-btn:active {
    background: rgba(245, 158, 11, 0.2);
    border-color: #f59e0b;
}

.stop-btn:active {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

/* Slider Control */
.slider-control {
    margin-bottom: 20px;
}

.slider-control label {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    margin-bottom: 10px;
    font-weight: 500;
}

.slider-control span {
    color: #667eea;
    font-weight: 700;
}

input[type="range"] {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

/* Checkbox Control */
.checkbox-control {
    margin-bottom: 20px;
}

.checkbox-control label {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

.checkbox-control label:active {
    background: rgba(255, 255, 255, 0.1);
}

input[type="checkbox"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: #667eea;
}

/* Scrollbar */
.control-menu::-webkit-scrollbar {
    width: 8px;
}

.control-menu::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.control-menu::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 4px;
}

.control-menu::-webkit-scrollbar-thumb:active {
    background: rgba(102, 126, 234, 0.8);
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Safe Area for iPhone Notch */
@supports (padding: max(0px)) {
    .menu-header {
        padding-top: max(20px, env(safe-area-inset-top));
    }
    
    .menu-toggle {
        top: max(20px, env(safe-area-inset-top));
        right: max(20px, env(safe-area-inset-right));
    }
    
    #ar-button {
        bottom: max(30px, env(safe-area-inset-bottom));
    }
}

/* Landscape Mode */
@media (orientation: landscape) {
    .control-menu {
        width: 50%;
        max-width: 500px;
    }
}

/* Large Tablets */
@media (min-width: 768px) {
    .control-menu {
        width: 60%;
        max-width: 450px;
    }
}
