:root {
    --do: #d41e1e; --re: #f18c4d; --mi: #ffda43; 
    --fa: #10ad54; --sol: #38b6ff; --la: #004aad; --si: #7c45e8;
}

body, html { margin: 0; padding: 0; width: 100%; height: 100%; background: #111; font-family: 'Montserrat', sans-serif; touch-action: none; user-select: none; display: flex; justify-content: center; align-items: center; }

/* === 1. A TRAVA MÁGICA DE VÍDEO (16:9) === */
#cinema-stage {
    width: 100vw;
    aspect-ratio: 16 / 9; 
    max-height: 100vh; 
    position: relative;
    overflow: hidden;
    background: #000;
}

/* === 2. FUNDO === */
#performance-screen {
    position: absolute; inset: 0; 
    cursor: pointer; z-index: 10; 
    background-image: url('fundo-playalong-piano.png'); 
    background-size: cover; 
    background-position: center;
}

/* === 3. A ESTEIRA E OS RAIOS DE LUZ DINÂMICOS === */
#scrolling-track { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 5; will-change: transform; }
#notes-layer { position: absolute; width: 100%; height: 100%; }

.falling-line {
    position: absolute; 
    transform: translate(-50%, -100%);
    border-radius: 15px; 
    background: linear-gradient(to bottom, transparent 0%, var(--cor-nota) 15%, var(--cor-nota) 85%, #ffffff 100%);
    box-shadow: 0 0 15px var(--cor-nota), 0 5px 25px var(--cor-nota);
}
.falling-line.played { display: none; }

.falling-line.hit {
    filter: brightness(1.5);
    box-shadow: 0 0 30px var(--cor-nota), 0 0 60px var(--cor-nota);
}

/* === 4. O PIANO CSS === */
#piano-container {
    position: absolute; 
    bottom: 0; left: 0; width: 100%; 
    height: 25%; 
    display: flex; 
    z-index: 10;
    border-top: 15px solid #bd9777; 
    background: #111;
}

.piano-key {
    cursor: pointer;
    touch-action: none;
}

.white-key {
    flex: 1; 
    height: 100%;
    background: #f1efdf; 
    border-right: 1px solid #333; 
    border-bottom: 2px solid #ccc;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 8px; 
    transition: transform 0.1s, background 0.1s, box-shadow 0.1s;
}
.white-key:last-child { border-right: none; }

.white-key.hit-bell {
    background: #ffffff; 
    transform: translateY(4px) scale(0.98);
    box-shadow: inset 0 5px 10px rgba(0,0,0,0.1), 0 0 30px var(--cor-glow, rgba(255,255,255,0.8));
    border-bottom: 0;
    z-index: 5; 
}

/* SUPER PILAR DE LUZ PARA NOTAS LONGAS */
.white-key.hit-bell-long::after {
    content: '';
    position: absolute;
    bottom: 100%; 
    left: 50%;
    transform: translateX(-50%);
    width: 2vw; 
    height: 100vh; 
    background: linear-gradient(to top, var(--cor-glow) 0%, transparent 60%);
    opacity: 0.7;
    pointer-events: none; 
    animation: pulsarRaio 0.15s infinite alternate;
}

@keyframes pulsarRaio {
    from { opacity: 0.4; filter: brightness(1); }
    to { opacity: 0.8; filter: brightness(1.4); }
}

.black-key {
    width: 1.6%; 
    height: 60%;
    background: #363636;
    margin-left: -0.8%; 
    margin-right: -0.8%; 
    border-radius: 0 0 3px 3px;
    border: 1px solid #111;
    position: relative;
    z-index: 2;
}

.color-dot {
    width: 1.8vw; 
    height: 1.8vw; 
    border-radius: 50%; 
}

/* ================= MENUS E BOTÕES CLAVE DE C ================= */
#controles-canto { position: absolute; top: 15px; right: 20px; display: flex; gap: 12px; z-index: 150; align-items: center; }
.btn-icone { font-size: 1.4rem; color: rgba(0,0,0,0.5); cursor: pointer; background: rgba(255,255,255,0.95); border-radius: 50%; width: 45px; height: 45px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
#progress-container { position: absolute; bottom: 0; left: 0; width: 100%; height: 6px; background: rgba(0,0,0,0.3); z-index: 30; }
#progress-bar { width: 0%; height: 100%; background: var(--sol); transition: width 0.1s linear; }

#play-overlay, #pause-overlay { position: absolute; inset: 0; background: rgba(38, 50, 65, 0.9); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; z-index: 100; }
.play-circle, .pause-icon { font-size: clamp(4rem, 10vw, 7rem); color: #fff; margin-bottom: 10px; text-shadow: 0 10px 20px rgba(0,0,0,0.5); }
#pause-overlay { background: rgba(0,0,0,0.5); }

#countdown-overlay { position: absolute; inset: 0; background: rgba(38, 50, 65, 0.9); display: flex; align-items: center; justify-content: center; z-index: 95; }
#countdown-text { font-size: clamp(6rem, 15vw, 10rem); color: var(--sol); text-shadow: 0 10px 20px rgba(0,0,0,0.2); animation: pulse 0.6s infinite alternate; margin: 0; }

#lock-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.1); display: flex; align-items: flex-start; justify-content: center; z-index: 300; padding-top: 25px; }
.btn-desbloquear { background: rgba(0,0,0,0.6); color: white; padding: 15px 30px; border-radius: 30px; font-weight: bold; font-size: 1.2rem; cursor: pointer; }

#config-modal, #cast-modal { position: absolute; inset: 0; background: rgba(0,0,0,0.8); display: flex; align-items: center; justify-content: center; z-index: 200; cursor: default; }
.cast-box { background: white; padding: 30px; border-radius: 20px; width: 80%; max-width: 400px; text-align: center; }
.estilo-select { width: 100%; padding: 12px; border-radius: 10px; border: 2px solid #ddd; font-size: 1rem; font-weight: bold; color: #555; margin-top: 5px; }

.game-screen { position: absolute; inset: 0; background: rgba(255,255,255,0.95); z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: default; }
.titulo-padrao { font-size: clamp(2.5rem, 6vw, 4rem); color: #333; margin-bottom: 5px; text-align: center; }
.subtitulo-padrao { font-size: clamp(1.2rem, 3vw, 1.5rem); color: #666; margin-bottom: 25px; text-align: center; }

.btn-main { border: none; padding: 15px 40px; border-radius: 30px; font-size: 1.2rem; font-weight: bold; cursor: pointer; transition: transform 0.2s; display: inline-block; }
.btn-main.green { background: #27ae60; color: white; }
.btn-main.gray { background: #e0e0e0; color: #555; margin-top: 15px;}

.confeti-particula { position: absolute; width: 15px; height: 15px; pointer-events: none; z-index: 100; animation: explosaoConfete 0.5s ease-out forwards; }
@keyframes explosaoConfete { 0% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; } 100% { transform: translate(var(--tx), var(--ty)) scale(0.2) rotate(var(--rot)); opacity: 0; } }

/* === PÍLULA FLUTUANTE RESPONSIVA === */
#seletor-maos-pilula {
    position: absolute;
    top: clamp(10px, 2vw, 15px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 40px;
    display: flex;
    gap: clamp(2px, 1vw, 5px); 
    padding: clamp(3px, 1vw, 5px) clamp(5px, 2vw, 10px);
    z-index: 150;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.btn-mao {
    background: transparent;
    border: none;
    color: white;
    font-size: clamp(1rem, 4vw, 1.5rem);
    padding: clamp(5px, 1.5vw, 8px) clamp(10px, 3vw, 20px); 
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
    filter: grayscale(100%);
}

.btn-mao:hover {
    background: rgba(255, 255, 255, 0.2);
    opacity: 0.8;
}

.btn-mao.ativo {
    background: rgba(255, 255, 255, 0.95);
    opacity: 1;
    filter: grayscale(0%);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transform: scale(1.05);
}

@media (max-width: 768px) {
    #seletor-maos-pilula { top: 12px; }
    .btn-mao { font-size: 1.1rem; padding: 5px 12px; }
}