/* ============================================
   PIZZICA MASTER V6 PRO - STYLE
   - VERSION RISQUEE avec animations dynamiques
   - Mouvements de bras/jambes animes
   - Balancement rythmique des danseurs
   - Pulsations au rythme de la musique
   ============================================ */

:root {
    /* --dancer-size: fallback; en pratique toujours ecrase par le style
       inline pose par Couple.computeGeometry() (proportionnel au carreau) */
    --dancer-size: 40px;
    --move-duration: 2250ms;

    --neon-pink: #ff0055;
    --neon-cyan: #00ffcc;
    --neon-blue: #0088ff;
    --neon-gold: #ffd700;
    --neon-purple: #aa00ff;
    --dark-bg: #0a0a0a;
}

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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    background: url('pizz2.jpg') no-repeat center center fixed;
    background-size: cover;
    color: white;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

/* V7: video d'ambiance pizzica (YouTube) derriere tout le jeu */
#video-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

#video-bg video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.55;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 1;
}

/* ============================================
   PROJECTEURS DISCO - GAUCHE ET DROITE
   ============================================ */
.spotlight {
    position: fixed;
    width: 16px;
    height: 16px;
    background: radial-gradient(circle, #fff 0%, #aaa 50%, #555 100%);
    border-radius: 50%;
    z-index: 5;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

/* Positions GAUCHE */
.spotlight-left-top { left: 15px; top: 15%; }
.spotlight-left-mid { left: 10px; top: 45%; }
.spotlight-left-bottom { left: 15px; top: 75%; }

/* Positions DROITE */
.spotlight-right-top { right: 15px; top: 15%; }
.spotlight-right-mid { right: 10px; top: 45%; }
.spotlight-right-bottom { right: 15px; top: 75%; }

.spotlight-beam {
    position: absolute;
    top: 8px;
    left: 50%;
    width: 120px;
    height: 350px;
    transform-origin: top center;
    transform: translateX(-50%);
    clip-path: polygon(40% 0%, 60% 0%, 100% 100%, 0% 100%);
    opacity: 0;
    pointer-events: none;
}

.beam-pink {
    background: linear-gradient(180deg, rgba(255,255,255,0.35) 0%, rgba(255,0,85,0.2) 40%, transparent 100%);
}
.beam-cyan {
    background: linear-gradient(180deg, rgba(255,255,255,0.35) 0%, rgba(0,255,204,0.2) 40%, transparent 100%);
}
.beam-purple {
    background: linear-gradient(180deg, rgba(255,255,255,0.35) 0%, rgba(170,0,255,0.2) 40%, transparent 100%);
}
.beam-gold {
    background: linear-gradient(180deg, rgba(255,255,255,0.35) 0%, rgba(255,215,0,0.2) 40%, transparent 100%);
}

.spotlight.active .spotlight-beam {
    opacity: 1;
    animation: spotlightMove 3.5s ease-in-out infinite;
}

.spotlight-left-top.active .spotlight-beam { animation-delay: 0s; }
.spotlight-left-mid.active .spotlight-beam { animation-delay: 0.6s; }
.spotlight-left-bottom.active .spotlight-beam { animation-delay: 1.2s; }
.spotlight-right-top.active .spotlight-beam { animation-delay: 0.3s; }
.spotlight-right-mid.active .spotlight-beam { animation-delay: 0.9s; }
.spotlight-right-bottom.active .spotlight-beam { animation-delay: 1.5s; }

@keyframes spotlightMove {
    0%, 100% { transform: translateX(-50%) rotate(-25deg); }
    50% { transform: translateX(-50%) rotate(25deg); }
}

.spotlight.active {
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.9), 0 0 30px var(--neon-cyan);
}

/* ============================================
   ECRAN D'ACCUEIL
   ============================================ */
#home-screen {
    position: relative;
    z-index: 10;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

/* Instructions a gauche - proche de la demo */
#instructions-panel {
    position: relative;
    width: 200px;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid var(--neon-cyan);
    border-radius: 15px;
    padding: 15px;
    z-index: 20;
    backdrop-filter: blur(5px);
    margin-right: 25px;
}

#instructions-panel h3 {
    color: var(--neon-gold);
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--neon-cyan);
}

.instruction-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}

.instruction-item .icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    background: var(--neon-blue);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
}

.instruction-item.warning .icon {
    background: var(--neon-pink);
    font-size: 0.85rem;
}

.instruction-item p {
    font-size: 0.7rem;
    color: #ccc;
    line-height: 1.25;
}

.instruction-item p strong { color: white; }
.instruction-item p em { color: var(--neon-cyan); }

.instruction-item.warning {
    background: rgba(255, 0, 85, 0.15);
    padding: 6px;
    border-radius: 8px;
    margin: 8px 0;
}

.instruction-item.warning p { color: #ffccdd; }

.legend {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #444;
}

.legend h4 {
    color: var(--neon-cyan);
    font-size: 0.65rem;
    margin-bottom: 5px;
}

.legend p {
    font-size: 0.65rem;
    color: #aaa;
    margin: 2px 0;
}

.move-tag {
    display: inline-block;
    background: var(--neon-blue);
    color: white;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.6rem;
    font-weight: bold;
    margin-right: 4px;
}

/* Zone centrale */
#home-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

#game-header {
    margin-bottom: 15px;
}

#school-name {
    color: var(--neon-gold);
    font-size: 1rem;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-style: italic;
    letter-spacing: 2px;
    text-shadow: 0 0 10px var(--neon-gold);
    margin-bottom: 5px;
}

#game-header h1 {
    color: var(--neon-pink);
    font-size: 2rem;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: 0 0 15px var(--neon-pink);
    margin-bottom: 8px;
}

#level-display, #level-display-game {
    color: var(--neon-gold);
    font-size: 1.1rem;
    font-weight: bold;
    text-shadow: 0 0 10px var(--neon-gold);
}

#music-info {
    color: var(--neon-cyan);
    font-size: 0.85rem;
    font-style: italic;
    margin-top: 5px;
}

/* Demo preview sur l'accueil - V7: agrandi pour englober completement les danseurs */
#demo-preview {
    width: 260px;
    height: 260px;
    margin: 15px 0;
}

#status-text {
    color: var(--neon-cyan);
    font-size: 0.95rem;
    margin: 10px 0;
}

/* V6 PRO: CLICCA text scintillant/clignotant JAUNE */
#game-status {
    color: var(--neon-gold);
    font-size: 1.1rem;
    font-weight: bold;
    margin: 10px 0;
    animation: sparkleText 0.8s ease-in-out infinite;
    text-shadow:
        0 0 10px var(--neon-gold),
        0 0 20px var(--neon-gold),
        0 0 30px var(--neon-gold),
        0 0 40px rgba(255, 215, 0, 0.5);
}

@keyframes sparkleText {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
        text-shadow:
            0 0 10px var(--neon-gold),
            0 0 20px var(--neon-gold),
            0 0 30px var(--neon-gold),
            0 0 40px rgba(255, 215, 0, 0.5);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
        text-shadow:
            0 0 20px var(--neon-gold),
            0 0 30px var(--neon-gold),
            0 0 40px var(--neon-gold),
            0 0 50px rgba(255, 215, 0, 0.8);
    }
}

button {
    background: linear-gradient(135deg, var(--neon-pink) 0%, #cc0044 100%);
    color: white;
    border: none;
    padding: 14px 40px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    border-radius: 50px;
    text-transform: uppercase;
    transition: transform 0.2s, box-shadow 0.2s;
    margin: 5px;
    touch-action: manipulation;
}

button:hover, button:active {
    transform: scale(1.05);
    box-shadow: 0 0 25px var(--neon-pink);
}

button:disabled {
    background: #444;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#btn-next-level {
    background: linear-gradient(135deg, #00cc44 0%, #008833 100%);
}

#btn-retry-demo {
    background: linear-gradient(135deg, var(--neon-gold) 0%, #cc9900 100%);
}

#btn-restart {
    background: linear-gradient(135deg, var(--neon-blue) 0%, #0055aa 100%);
}

/* ============================================
   ECRAN DE JEU
   ============================================ */
#game-screen {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

#game-ui-small {
    text-align: center;
    margin-bottom: 10px;
}

#game-ui-small h2 {
    color: var(--neon-pink);
    font-size: 1.3rem;
    text-shadow: 0 0 10px var(--neon-pink);
}

#dance-floor {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    width: min(85vw, 560px);
    height: min(78vh, 560px);
    gap: 6px;
    padding: 8px;
    background: rgba(17, 17, 17, 0.9);
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(0, 255, 204, 0.3);
}

/* Carreau - V6 PRO: Fond plus gai et coloré */
.tile {
    position: relative;
    background:
        radial-gradient(circle at 30% 30%, rgba(255, 105, 180, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 70% 70%, rgba(0, 191, 255, 0.15) 0%, transparent 50%),
        linear-gradient(135deg, #1a1a3e 0%, #2d2d5f 50%, #1a1a3e 100%);
    border: 2px solid #5555ff;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-shadow: inset 0 0 30px rgba(100, 100, 255, 0.2);
}

.tile::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(0, 255, 204, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

/* V6 PRO: Guide cercle avec axes X/Y */
.tile::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url('cercle.jpg') no-repeat center center;
    background-size: contain;
    opacity: 0.15;
    pointer-events: none;
    z-index: 1;
}

.tile:active {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 20px var(--neon-cyan);
}

.tile.selected-correct {
    border-color: #00ff00;
    box-shadow: 0 0 30px #00ff00;
}

.tile.selected-wrong {
    border-color: #ff0000;
    box-shadow: 0 0 30px #ff0000;
}

.tile.disco-active {
    animation: discoTile 2s ease-in-out infinite;
}

@keyframes discoTile {
    0%, 100% { box-shadow: inset 0 0 20px rgba(255,0,85,0.2); border-color: #444; }
    33% { box-shadow: inset 0 0 25px rgba(0,136,255,0.3); border-color: var(--neon-blue); }
    66% { box-shadow: inset 0 0 25px rgba(0,255,204,0.3); border-color: var(--neon-cyan); }
}

/* ============================================
   SYSTEME DE ROUE
   ============================================ */
.couple-wheel {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    transition: transform var(--move-duration) linear;
}

.dancer-wrapper {
    position: absolute;
    width: var(--dancer-size);
    height: var(--dancer-size);
    left: calc(var(--dancer-size) / -2);
    top: calc(var(--dancer-size) / -2);
    transition: transform var(--move-duration) linear;
}

.dancer {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform-origin: center bottom;
}

/* ============================================
   V6 PRO - ANIMATIONS DYNAMIQUES DES DANSEURS
   ============================================ */

/* Animation de base - balancement rythmique */
.dancer-wrapper.dancing .dancer {
    animation: dancerSway 0.6s ease-in-out infinite;
}

/* V6 PRO: ETAT STATIQUE - Agiter les bras pour montrer que c'est un etat */
.dancer-wrapper.static-state .dancer {
    animation: armWave 0.5s ease-in-out infinite;
}

/* Animation pendant rotation - mouvement expressif AVEC INCLINAISON 20-30% - 3X PLUS LENT */
.dancer-wrapper.rotating .dancer {
    animation: dancerSpin 1.2s ease-in-out infinite;
}

/* V6 PRO: Animation FLIP pour TOUS les niveaux - retournement comme piece de monnaie */
.dancer-wrapper.rotating.flip .dancer {
    animation: dancerFlip 1.8s ease-in-out infinite;
}

/* Animation pendant translation - pas de danse */
.dancer-wrapper.translating .dancer {
    animation: dancerStep 0.5s ease-in-out infinite;
}

/* Animation pause proche - intimite */
.dancer-wrapper.close .dancer {
    animation: dancerPulse 0.8s ease-in-out infinite;
}

/* Balancement naturel */
@keyframes dancerSway {
    0%, 100% {
        transform: rotate(-3deg) scaleY(1);
    }
    25% {
        transform: rotate(0deg) scaleY(0.98);
    }
    50% {
        transform: rotate(3deg) scaleY(1);
    }
    75% {
        transform: rotate(0deg) scaleY(0.98);
    }
}

/* V6 PRO: Agiter les bras - ETAT STATIQUE visible */
@keyframes armWave {
    0%, 100% {
        transform: scaleX(1) skewX(0deg);
        filter: brightness(1);
    }
    25% {
        transform: scaleX(1.1) skewX(5deg);
        filter: brightness(1.2);
    }
    50% {
        transform: scaleX(1) skewX(0deg);
        filter: brightness(1);
    }
    75% {
        transform: scaleX(1.1) skewX(-5deg);
        filter: brightness(1.2);
    }
}

/* Mouvement de rotation expressif - INCLINAISON FORTE 20-30% */
@keyframes dancerSpin {
    0%, 100% {
        transform: rotate(-25deg) scale(1.02) skewY(-5deg);
    }
    50% {
        transform: rotate(25deg) scale(0.98) skewY(5deg);
    }
}

/* V6 PRO: Animation FLIP niveau 3+ - retournement 3D comme piece */
@keyframes dancerFlip {
    0% {
        transform: rotateY(0deg) scale(1);
        filter: brightness(1) drop-shadow(0 5px 5px rgba(255, 215, 0, 0.5));
    }
    25% {
        transform: rotateY(90deg) scale(0.8);
        filter: brightness(1.5) drop-shadow(0 8px 8px rgba(255, 0, 85, 0.6));
    }
    50% {
        transform: rotateY(180deg) scale(1);
        filter: brightness(1) drop-shadow(0 5px 5px rgba(0, 255, 204, 0.5));
    }
    75% {
        transform: rotateY(270deg) scale(0.8);
        filter: brightness(1.5) drop-shadow(0 8px 8px rgba(255, 215, 0, 0.6));
    }
    100% {
        transform: rotateY(360deg) scale(1);
        filter: brightness(1) drop-shadow(0 5px 5px rgba(255, 0, 85, 0.5));
    }
}

/* Pas de danse - translation */
@keyframes dancerStep {
    0%, 100% {
        transform: translateY(0) scaleX(1);
    }
    25% {
        transform: translateY(-2px) scaleX(0.97);
    }
    50% {
        transform: translateY(0) scaleX(1);
    }
    75% {
        transform: translateY(-2px) scaleX(1.03);
    }
}

/* Pulsation proche - moment intime */
@keyframes dancerPulse {
    0%, 100% {
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.05);
        filter: brightness(1.1);
    }
}

/* Effet de glow pendant la danse */
.dancer-wrapper.dancing::after {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 0, 85, 0.2) 0%, transparent 70%);
    animation: glowPulse 1s ease-in-out infinite;
    pointer-events: none;
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
}

/* Ombre dynamique sous les danseurs */
.dancer-wrapper.dancing .dancer {
    filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.4));
}

.dancer-wrapper.rotating .dancer {
    filter: drop-shadow(0 5px 5px rgba(255, 0, 85, 0.3));
}

.dancer-wrapper.translating .dancer {
    filter: drop-shadow(0 4px 4px rgba(0, 255, 204, 0.3));
}

/* ============================================
   OVERLAY DEMO - avec fond pizz2.jpg
   ============================================ */
#demo-overlay {
    position: fixed;
    inset: 0;
    /* V7: fond transparent pour laisser la video d'ambiance visible */
    background: transparent;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

#demo-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: -1;
}

#demo-overlay h2 {
    color: var(--neon-cyan);
    font-size: 1.3rem;
    margin-bottom: 8px;
    text-shadow: 0 0 10px var(--neon-cyan);
}

#demo-level-info {
    color: var(--neon-gold);
    font-size: 1rem;
    margin-bottom: 8px;
}

/* V6 PRO: Timer visible qui decremente */
#demo-timer {
    color: var(--neon-pink);
    font-size: 3rem;
    font-weight: bold;
    text-shadow: 0 0 20px var(--neon-pink), 0 0 40px var(--neon-pink);
    margin-bottom: 10px;
    animation: timerPulse 1s ease-in-out infinite;
}

@keyframes timerPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* V7: carreau principal de la demo agrandi de 25% (200 -> 250) */
#demo-overlay .tile {
    width: 250px;
    height: 250px;
    margin: 12px;
    cursor: default;
}

#demo-progress {
    width: 250px;
    height: 6px;
    background: #333;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 10px;
}

#bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-blue));
    transition: width 0.1s linear;
}

#btn-replay {
    margin-top: 12px;
    padding: 10px 25px;
    font-size: 0.9rem;
}

/* ============================================
   COUNTDOWN
   ============================================ */
#countdown {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 8rem;
    font-weight: bold;
    color: var(--neon-pink);
    text-shadow: 0 0 40px var(--neon-pink), 0 0 80px var(--neon-pink);
    display: none;
    z-index: 60;
    animation: countdownPulse 1s ease-in-out infinite;
}

@keyframes countdownPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
}

/* ============================================
   GO MESSAGE
   ============================================ */
#go-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10rem;
    font-weight: bold;
    color: var(--neon-gold);
    text-shadow:
        0 0 20px var(--neon-gold),
        0 0 40px var(--neon-gold),
        0 0 60px var(--neon-gold),
        0 0 80px rgba(255, 215, 0, 0.8);
    display: none;
    z-index: 65;
    animation: goAppear 0.5s ease-out;
}

@keyframes goAppear {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* ============================================
   ECCO MESSAGE (for comparison divergence)
   ============================================ */
#ecco-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10rem;
    font-weight: bold;
    color: #ff0055;
    text-shadow:
        0 0 20px #ff0055,
        0 0 40px #ff0055,
        0 0 60px #ff0055,
        0 0 80px rgba(255, 0, 85, 0.8);
    display: none;
    z-index: 120;
    animation: eccoFlash 0.6s ease-out;
}

@keyframes eccoFlash {
    0% {
        transform: translate(-50%, -50%) scale(0.3);
        opacity: 0;
    }
    40% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* ============================================
   RESULTAT
   ============================================ */
#result {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 25px 35px;
    background: rgba(0, 0, 0, 0.95);
    border: 3px solid white;
    border-radius: 20px;
    display: none;
    z-index: 100;
    text-align: center;
    max-width: 90vw;
}

#result.win { border-color: #00ff00; box-shadow: 0 0 30px #00ff00; }
#result.lose { border-color: #ff0000; box-shadow: 0 0 30px #ff0000; }
#result.complete { border-color: var(--neon-gold); box-shadow: 0 0 50px var(--neon-gold); }

#result h2 { font-size: 1.8rem; margin-bottom: 10px; }
#result p { font-size: 0.95rem; color: #ccc; margin-bottom: 12px; }
#result .level-info { color: var(--neon-gold); font-size: 1rem; }

/* Emoji inline */
.emoji-inline {
    display: inline-block;
    height: 1.2em;
    width: auto;
    vertical-align: middle;
    margin: 0 4px;
    background: transparent !important;
}

/* Frustrato button styling */
#btn-show-error {
    padding: 8px 20px;
    margin-top: 5px;
}

.frustrato-text {
    font-size: 0.75rem;
    font-weight: normal;
}

/* ============================================
   COMPARISON OVERLAY (Error Analysis)
   ============================================ */
#comparison-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.97);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 110;
    padding: 20px;
}

#comparison-overlay h2 {
    color: var(--neon-cyan);
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-shadow: 0 0 20px var(--neon-cyan);
    text-align: center;
}

#comparison-container {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    justify-content: center;
    margin-bottom: 20px;
}

.comparison-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.comparison-side h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    text-shadow: 0 0 10px currentColor;
}

.comparison-side h3:first-child {
    color: #00ff00;
}

.comparison-side:last-child h3 {
    color: #ff4444;
}

#comparison-demo,
#comparison-user {
    width: 200px;
    height: 200px;
}

.comparison-label {
    font-size: 0.85rem;
    color: #aaa;
    max-width: 200px;
    text-align: center;
    font-style: italic;
}

#comparison-message {
    color: var(--neon-gold);
    font-size: 1.1rem;
    font-weight: bold;
    margin: 20px 0;
    text-align: center;
    min-height: 50px;
    text-shadow: 0 0 15px var(--neon-gold);
}

#btn-comparison-retry,
#btn-comparison-replay {
    margin-top: 15px;
    margin-left: 10px;
    margin-right: 10px;
}

#btn-comparison-replay {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    border: 2px solid var(--neon-cyan);
}

#btn-comparison-replay:hover {
    background: linear-gradient(135deg, #7a21db 0%, #3585ff 100%);
    box-shadow: 0 0 30px var(--neon-cyan);
}

/* ============================================
   CREDITS
   ============================================ */
#credits {
    position: fixed;
    bottom: 15px;
    right: 20px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 1rem;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-style: italic;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
    z-index: 5;
}

/* ============================================
   FIREWORKS - EFFET FEU D'ARTIFICE VICTOIRE
   ============================================ */
#fireworks-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 150;
    display: none;
}

.firework {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    animation: fireworkExplode 1.5s ease-out forwards;
}

@keyframes fireworkExplode {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

.firework-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    box-shadow: 0 0 10px currentColor;
}

/* ============================================
   RESPONSIVE - MOBILE (Android/iOS)
   ============================================ */
@media (max-width: 768px) {
    /* V7: l'accueil peut depasser 100vh sur petit ecran -> scrollable
       (flex-start obligatoire: avec center + scroll, le haut serait inatteignable) */
    #home-screen {
        flex-direction: column;
        overflow-y: auto;
        justify-content: flex-start;
        padding-top: 16px;
    }

    #instructions-panel {
        position: relative;
        width: 90%;
        max-width: 300px;
        padding: 10px;
        font-size: 0.85em;
        margin: 0 0 15px 0;
    }

    #instructions-panel h3 { font-size: 0.75rem; }
    .instruction-item p { font-size: 0.6rem; }
    .instruction-item .icon { width: 16px; height: 16px; font-size: 0.6rem; }
    .legend { display: none; }

    #game-header h1 { font-size: 1.5rem; letter-spacing: 2px; }
    #level-display { font-size: 0.95rem; }
    #demo-preview { width: min(220px, 30vh); height: min(220px, 30vh); }

    button { padding: 12px 30px; font-size: 1rem; }

    /* V7: les 4 carreaux occupent plus de 80% de l'ecran Android */
    #game-ui-small { margin-bottom: 4px; }
    #game-ui-small h2 { font-size: 1rem; }
    #level-display-game { font-size: 0.85rem; }
    #game-status { font-size: 0.9rem; margin: 6px 0; }

    #dance-floor {
        width: 96vw;
        height: min(86vh, calc(100dvh - 110px));
    }

    #demo-overlay .tile { width: min(250px, 66vw); height: min(250px, 66vw); }
    #demo-progress { width: min(250px, 66vw); }

    #countdown { font-size: 6rem; }
    #go-message { font-size: 7rem; }
    #ecco-message { font-size: 7rem; }

    /* Comparison overlay mobile */
    #comparison-overlay h2 { font-size: 1.1rem; }
    #comparison-container {
        flex-direction: column;
        gap: 20px;
    }
    #comparison-demo,
    #comparison-user {
        width: 160px;
        height: 160px;
    }
    #comparison-message { font-size: 0.95rem; }

    .spotlight { width: 12px; height: 12px; }
    .spotlight-beam { width: 80px; height: 250px; }

    /* V7: sur mobile les credits chevauchent le statut de jeu */
    #credits { display: none; }
}

@media (max-width: 480px) {
    #instructions-panel {
        width: 95%;
        max-width: 280px;
        padding: 8px;
        margin: 0 0 10px 0;
    }

    .instruction-item.warning { padding: 4px; }

    #game-header h1 { font-size: 1.3rem; }
    #demo-preview { width: min(200px, 30vh); height: min(200px, 30vh); }

    /* V7: pleine occupation de l'ecran Android (>80%) */
    #dance-floor {
        width: 97vw;
        height: min(86vh, calc(100dvh - 100px));
        gap: 4px;
        padding: 5px;
    }

    /* V7: +25% par rapport aux 160px d'origine */
    #demo-overlay .tile { width: min(200px, 62vw); height: min(200px, 62vw); }
    #demo-progress { width: min(200px, 62vw); }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    #instructions-panel { display: none; }

    #home-main { flex-direction: row; gap: 20px; }
    #game-header { margin-bottom: 0; }
    #demo-preview { width: min(180px, 42vh); height: min(180px, 42vh); }

    /* V7: paysage - les carreaux dominent l'ecran */
    #game-ui-small { display: none; }
    #dance-floor {
        width: min(92vw, 700px);
        height: 84vh;
    }

    #demo-overlay .tile { width: min(250px, 52vh); height: min(250px, 52vh); }
    #demo-progress { width: min(250px, 52vh); }

    #countdown { font-size: 5rem; }
    #go-message { font-size: 6rem; }
    #ecco-message { font-size: 6rem; }
}
