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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    width: 100vw;
    margin: 0;
    padding: 0;
    overflow: hidden;
    color: #333;
}

/* Bouton Labs en bas à gauche */
.labs-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.labs-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

#app {
    width: 100vw;
    height: 100vh;
    position: relative;
}

.header {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    text-align: center;
    width: auto;
}

.header h1 {
    color: white;
    font-size: 2rem;
    margin: 0 0 10px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.countdown {
    color: #ffeb3b;
    font-size: 1.1rem;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    margin-bottom: 15px;
    animation: pulse 2s ease-in-out infinite alternate;
}

@keyframes pulse {
    from { text-shadow: 2px 2px 4px rgba(0,0,0,0.5), 0 0 10px rgba(255,235,59,0.3); }
    to { text-shadow: 2px 2px 4px rgba(0,0,0,0.5), 0 0 20px rgba(255,235,59,0.8); }
}

.main-content {
    width: 100%;
    height: 100%;
    position: relative;
}

.video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    overflow: hidden;
}

.video-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: 
        radial-gradient(circle at 10% 20%, rgba(255,255,255,0.1) 0%, transparent 50%),
        radial-gradient(circle at 90% 80%, rgba(255,255,255,0.1) 0%, transparent 50%),
        radial-gradient(circle at 30% 70%, rgba(255,255,255,0.05) 0%, transparent 40%),
        radial-gradient(circle at 70% 30%, rgba(255,255,255,0.05) 0%, transparent 40%);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.video-container.frost::after {
    opacity: 1;
}

#video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    transform: scaleX(-1); /* Effet miroir pour le selfie */
}

#canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    transform: scaleX(-1); /* Effet miroir pour le selfie */
}

.controls {
    position: absolute;
    top: 80px;
    right: 20px;
    width: 280px;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
    z-index: 10;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.control-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    margin-bottom: 5px;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    background: #5a67d8;
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.control-group span {
    display: inline-block;
    width: 30px;
    text-align: center;
    font-weight: bold;
    color: #667eea;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-active {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.4);
}

.btn-active:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(72, 187, 120, 0.6);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
    width: 100%;
    margin-top: 10px;
}

.btn-secondary:hover {
    background: #cbd5e0;
    transform: translateY(-1px);
}

/* Menu hamburger */
.hamburger-menu {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    padding: 15px;
    cursor: pointer;
    z-index: 1000;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    width: 60px;
    height: 60px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.hamburger-menu span {
    display: block;
    width: 25px;
    height: 3px;
    background: #333;
    margin: 3px 0;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

.hamburger-menu:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(0,0,0,0.4);
}

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

/* Classes utilitaires */
.desktop-only {
    display: inline-block;
}

.mobile-only {
    display: none;
}

.full-width {
    width: 100%;
}

.controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.controls-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.2rem;
}

.close-controls {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border: none;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    color: white;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(231, 76, 60, 0.3);
}

.close-controls:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.5);
}

.close-controls:active {
    transform: scale(0.95);
}

/* Support pour les environnements avec barres de navigation */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .hamburger-menu {
        bottom: calc(20px + env(safe-area-inset-bottom));
    }
    
    .controls {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .hamburger-menu {
        display: flex;
    }
    
    .desktop-only {
        display: none;
    }
    
    .mobile-only {
        display: block;
    }
    
    .controls {
        position: fixed;
        top: 0;
        right: -100%;
        width: 320px;
        height: 100vh;
        background: rgba(255, 255, 255, 0.95);
        padding: 80px 20px 20px;
        border-radius: 0;
        box-shadow: -5px 0 20px rgba(0,0,0,0.3);
        backdrop-filter: blur(15px);
        z-index: 999;
        max-height: none;
        overflow-y: auto;
        transition: right 0.3s ease-in-out;
    }
    
    .controls.open {
        right: 0;
    }
    
    .header {
        top: 10px;
        width: calc(100% - 80px);
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .controls {
        width: 100%;
        padding: 80px 15px 100px;
        bottom: 0;
    }
    
    .hamburger-menu {
        bottom: 20px;
        right: 15px;
        width: 55px;
        height: 55px;
        padding: 12px;
    }
    
    .hamburger-menu span {
        width: 22px;
        height: 2.5px;
        margin: 2.5px 0;
    }
    
    .labs-btn {
        bottom: 20px;
        left: 15px;
        padding: 10px 18px;
        font-size: 0.85rem;
    }
    
    .header {
        width: 100%;
    }
}

/* Support spécifique Android - hauteur d'écran réduite */
@media (max-width: 480px) and (max-height: 640px) {
    .hamburger-menu {
        bottom: 15px;
        transform: scale(0.9);
    }
    
    .controls {
        padding-bottom: 80px;
        font-size: 0.9rem;
    }
    
    .control-group {
        margin-bottom: 15px;
    }
    
    .header h1 {
        font-size: 1.3rem;
    }
    
    .countdown {
        font-size: 1rem;
        margin-bottom: 10px;
    }
}

/* Écrans très petits (iPhone SE, Galaxy S20, etc.) */
@media (max-width: 375px) or (max-height: 667px) {
    .hamburger-menu {
        bottom: 10px !important;
        right: 10px !important;
        width: 50px !important;
        height: 50px !important;
        padding: 10px !important;
    }
    
    .hamburger-menu span {
        width: 20px !important;
        height: 2px !important;
        margin: 2px 0 !important;
    }
    
    .labs-btn {
        bottom: 10px !important;
        left: 10px !important;
        padding: 10px 16px !important;
        font-size: 0.8rem !important;
    }
    
    .header {
        top: 5px;
    }
    
    .header h1 {
        font-size: 1.2rem;
    }
    
    .countdown {
        font-size: 0.9rem;
    }
}

/* Overlay pour fermer le menu mobile */
.menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

@media (max-width: 768px) {
    .controls.open ~ .menu-overlay {
        display: block;
        opacity: 1;
    }
}

/* Améliorations des animations */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

/* Animation du compteur de Noël */
.countdown {
    animation: pulse 2s ease-in-out infinite alternate, glow 3s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { 
        text-shadow: 2px 2px 4px rgba(0,0,0,0.5), 0 0 10px rgba(255,235,59,0.3); 
    }
    50% { 
        text-shadow: 2px 2px 4px rgba(0,0,0,0.5), 0 0 20px rgba(255,235,59,0.8), 0 0 30px rgba(255,235,59,0.4); 
    }
}

/* Animation de chargement */
.video-container::before {
    content: '❄️ Chargement...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1.2rem;
    z-index: 1;
    pointer-events: none;
    animation: loadingPulse 1.5s ease-in-out infinite;
}

@keyframes loadingPulse {
    0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
}

.video-container:has(#canvas) {
    background: transparent;
}

.video-container:has(#canvas)::before {
    display: none;
}

/* Effet de neige sur l'interface */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y="50" font-size="20">❄️</text></svg>') repeat;
    opacity: 0.1;
    animation: fall 20s linear infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes fall {
    0% {
        transform: translateY(-100vh);
    }
    100% {
        transform: translateY(100vh);
    }
}