/* ==================== FNF GAME STYLES ==================== */

/* Modal del juego FNF */
#fnfGameModal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    animation: fadeIn 0.3s ease;
}

/* Contenedor principal del juego */
.fnf-game-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, #1a1a2e 0%, #0f0f1a 100%);
}

.fnf-game-wrapper {
    width: 500px;
    height: 700px;
    position: relative;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    overflow: visible; /* CAMBIAR: de hidden a visible */
}

/* Botón cerrar */
.fnf-close-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #ff69b4;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s;
}

.fnf-close-btn:hover {
    color: #ff1493;
    transform: rotate(90deg);
}

/* ==================== MENÚ PRINCIPAL FNF ==================== */
.fnf-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    text-align: center;
    min-height: 500px;
    position: relative;
    z-index: 100; /* Asegurar que esté por encima del wrapper */
}

.fnf-menu h1 {
    font-size: 3rem;
    background: linear-gradient(135deg, #ff69b4 0%, #ff1493 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    text-shadow: 0 0 30px rgba(255, 105, 180, 0.5);
}

.fnf-menu p {
    color: white;
    font-size: 1.5rem;
    margin-bottom: 30px;
    line-height: 1.6;
}

.fnf-difficulty-select {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 30px;
}

.fnf-difficulty-btn {
    background: linear-gradient(135deg, #ff69b4 0%, #ff1493 100%);
    color: white;
    border: none;
    padding: 20px 40px;
    border-radius: 15px;
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 5px 20px rgba(255, 105, 180, 0.4);
}

.fnf-difficulty-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 10px 30px rgba(255, 105, 180, 0.6);
}

.fnf-difficulty-btn.easy { background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%); }
.fnf-difficulty-btn.normal { background: linear-gradient(135deg, #2196F3 0%, #1565C0 100%); }
.fnf-difficulty-btn.hard { background: linear-gradient(135deg, #f44336 0%, #c62828 100%); }

/* ==================== ÁREA DE JUEGO ==================== */
.fnf-game-area {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.fnf-game-area.active {
    display: block;
}

/* HUD Superior */
.fnf-hud {
    position: absolute;
    top: 75px;  
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    z-index: 50;
}

.fnf-hud > div {
    background: rgba(0, 0, 0, 0.7);
    padding: 5px 15px;
    border-radius: 8px;
}

.fnf-score, .fnf-combo, .fnf-accuracy {
    color: white;
    font-size: 1rem;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.fnf-score, .fnf-combo, .fnf-accuracy {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.fnf-score span, .fnf-combo span, .fnf-accuracy span {
    color: #ff69b4;
}

/* Barra de vida */
.fnf-health-bar-container {
    position: absolute;
    top: 55px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 20px;
    background: #333;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #ff69b4;
    z-index: 50;
}

.fnf-health-bar {
    height: 100%;
    width: 50%;
    background: linear-gradient(90deg, #ff1493 0%, #ff69b4 100%);
    transition: width 0.2s ease;
    border-radius: 12px;
}

/* Campo de juego (carriles) */
.fnf-playfield {
    position: absolute;
    top: 130px;  
    left: 50%;
    transform: translateX(-50%);
    width: 340px;
    height: 480px;
    display: flex;
    justify-content: center;
    gap: 5px;
    overflow: visible;
}

/* Carril individual */
.fnf-lane {
    width: 80px;
    height: 100%;
    position: relative;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 5px;
    flex-shrink: 0;
}

/* Receptores (donde presionas) */
.fnf-receptors {
    position: absolute;
    top: 580px;  /* Bajado 50px */
    left: 50%;
    transform: translateX(-50%);
    width: 340px;
    display: flex;
    justify-content: center;
    gap: 5px;
    z-index: 40;
}

.fnf-receptor {
    width: 80px;
    height: 80px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    transition: all 0.1s;
    border: 3px solid transparent;
    flex-shrink: 0;
}

.fnf-receptor.lane-0 { background: rgba(255, 0, 128, 0.3); border-color: #ff0080; }
.fnf-receptor.lane-1 { background: rgba(0, 255, 255, 0.3); border-color: #00ffff; }
.fnf-receptor.lane-2 { background: rgba(0, 255, 0, 0.3); border-color: #00ff00; }
.fnf-receptor.lane-3 { background: rgba(255, 0, 0, 0.3); border-color: #ff0000; }

.fnf-receptor.pressed {
    transform: scale(1.1);
    filter: brightness(1.5);
    box-shadow: 0 0 20px currentColor;
}

/* Notas */
.fnf-note {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 900;
    transition: opacity 0.1s;
    z-index: 30;
}

.fnf-note.lane-0 { background: linear-gradient(135deg, #ff0080 0%, #ff4da6 100%); }
.fnf-note.lane-1 { background: linear-gradient(135deg, #00ffff 0%, #4dffff 100%); }
.fnf-note.lane-2 { background: linear-gradient(135deg, #00ff00 0%, #4dff4d 100%); }
.fnf-note.lane-3 { background: linear-gradient(135deg, #ff0000 0%, #ff4d4d 100%); }

.fnf-note.hit {
    animation: noteHit 0.2s ease-out forwards;
}

.fnf-note.miss {
    opacity: 0.3;
}

@keyframes noteHit {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* Notas sostenidas (holds) */
.fnf-hold {
    position: absolute;
    width: 30px;
    border-radius: 5px;
    z-index: 25;
}

.fnf-hold.lane-0 { background: rgba(255, 0, 128, 0.6); left: calc(50% - 15px); }
.fnf-hold.lane-1 { background: rgba(0, 255, 255, 0.6); left: calc(50% - 15px); }
.fnf-hold.lane-2 { background: rgba(0, 255, 0, 0.6); left: calc(50% - 15px); }
.fnf-hold.lane-3 { background: rgba(255, 0, 0, 0.6); left: calc(50% - 15px); }

/* Rating popup */
.fnf-rating {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    font-weight: 900;
    text-shadow: 0 0 20px currentColor;
    animation: ratingPop 0.5s ease-out forwards;
    z-index: 60;
    pointer-events: none;
}

.fnf-rating.sick { color: #00ff00; }
.fnf-rating.good { color: #00ffff; }
.fnf-rating.bad { color: #ffff00; }
.fnf-rating.shit { color: #ff8800; }
.fnf-rating.miss { color: #ff0000; }

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

/* Indicador de teclas */
.fnf-key-hints {
    position: absolute;
    top: 680px;  /* Bajado 50px */
    left: 50%;
    transform: translateX(-50%);
    width: 340px;
    display: flex;
    justify-content: space-around;
    z-index: 50;
}

.fnf-key-hint {
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.2rem;
    font-weight: 700;
}

/* ==================== PANTALLA DE RESULTADOS ==================== */
.fnf-results {
    display: none;
    text-align: center;
    padding: 40px;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 20px;
    border: 3px solid #ff69b4;
    max-width: 500px;
}

.fnf-results.active {
    display: block;
}

.fnf-results h2 {
    font-size: 3rem;
    color: #ff69b4;
    margin-bottom: 30px;
    text-shadow: 0 0 20px #ff69b4;
}

.fnf-results-stats {
    text-align: left;
    margin: 30px 0;
    padding: 20px;
    background: rgba(255, 105, 180, 0.1);
    border-radius: 15px;
}

.fnf-results-stats p {
    color: white;
    font-size: 1.3rem;
    margin: 15px 0;
}

.fnf-results-stats span {
    color: #ff69b4;
    font-weight: 700;
}

.fnf-continue-btn {
    background: linear-gradient(135deg, #ff69b4 0%, #ff1493 100%);
    color: white;
    border: none;
    padding: 20px 50px;
    border-radius: 30px;
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 20px;
}

.fnf-continue-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 30px rgba(255, 105, 180, 0.6);
}

/* ==================== MENSAJE FINAL ==================== */
.fnf-final-message {
    display: none;
    text-align: center;
    padding: 50px;
    max-width: 600px;
}

.fnf-final-message.active {
    display: block;
}

.fnf-final-message h2 {
    font-size: 2.5rem;
    color: #ff69b4;
    margin-bottom: 30px;
}

.fnf-final-message p {
    color: white;
    font-size: 1.3rem;
    line-height: 1.8;
    margin-bottom: 30px;
}

/* ==================== GAME OVER ==================== */
.fnf-game-over {
    display: none;
    text-align: center;
    padding: 40px;
}

.fnf-game-over.active {
    display: block;
}

.fnf-game-over h2 {
    font-size: 4rem;
    color: #ff0000;
    text-shadow: 0 0 30px #ff0000;
    margin-bottom: 30px;
}

.fnf-game-over p {
    color: white;
    font-size: 1.5rem;
    margin-bottom: 30px;
}

/* ==================== COUNTDOWN ==================== */
.fnf-countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 8rem;
    color: #ff69b4;
    text-shadow: 0 0 50px #ff69b4;
    font-weight: 900;
    z-index: 100;
    animation: countdownPulse 1s ease-out;
}

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

/* ==================== CARTA SOBRE FNF ==================== */
.fnf-envelope {
    position: relative;
    width: 560px;
    height: 360px;
    margin: 0 auto 20px;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fnf-envelope:hover {
    transform: translateY(-15px) scale(1.05);
}

.fnf-envelope-back {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #fff0f5 0%, #ffe4ec 100%);
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(255, 105, 180, 0.4);
    border: 4px solid #ff69b4;
}

.fnf-envelope-flap {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 280px solid transparent;
    border-right: 280px solid transparent;
    border-top: 180px solid #ff69b4;
    top: 0;
    left: 0;
    transform-origin: top center;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 8px 20px rgba(255, 105, 180, 0.5));
    z-index: 20;
}

.fnf-envelope:hover .fnf-envelope-flap {
    transform: rotateX(-180deg);
}

.fnf-letter {
    position: absolute;
    width: 480px;
    height: 300px;
    background: linear-gradient(135deg, #fff5f8 0%, #ffe8f0 100%);
    top: 30px;
    left: 40px;
    border-radius: 10px;
    box-shadow: inset 0 0 30px rgba(255, 105, 180, 0.2), 0 10px 30px rgba(0, 0, 0, 0.15);
    padding: 30px;
    z-index: 5;
    transition: all 0.6s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 182, 193, 0.5);
}

.fnf-envelope:hover .fnf-letter {
    transform: translateY(-30px);
}

.fnf-letter-title {
    color: #ff1493;
    font-size: 1.8rem;
    font-weight: 800;
    text-align: center;
    text-shadow: 0 2px 10px rgba(255, 20, 147, 0.3);
    font-family: 'Brush Script MT', cursive;
}

.fnf-letter-icon {
    font-size: 4.5rem;
    margin-top: 15px;
}

.fnf-envelope-seal {
    position: absolute;
    top: 70px;
    right: 50px;
    font-size: 3rem;
    z-index: 3;
    animation: heartbeat 1.5s ease-in-out infinite;
}

.fnf-subtitle {
    color: #ff69b4;
    font-size: 1.2rem;
    font-style: italic;
    font-weight: 600;
    text-shadow: 0 2px 8px rgba(255, 105, 180, 0.3);
    margin-top: 25px;
}

/* Responsive */
@media (max-width: 768px) {
    .fnf-playfield, .fnf-receptors {
        width: 320px;
    }
    
    .fnf-lane, .fnf-receptor {
        width: 70px;
    }
    
    .fnf-receptor {
        height: 70px;
        font-size: 2rem;
    }
    
    .fnf-note {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .fnf-menu h1 {
        font-size: 2.5rem;
    }
    
    .fnf-difficulty-select {
        flex-direction: column;
        align-items: center;
    }
    
    .fnf-health-bar-container {
        width: 300px;
    }
}

/* Ghost tap - presionar sin nota */
.fnf-receptor.ghost-tap {
    animation: ghostTapFlash 0.2s ease-out;
}

@keyframes ghostTapFlash {
    0% { box-shadow: 0 0 30px #ff0000; }
    100% { box-shadow: none; }
}

/* ==================== OPPONENT CHARACTER CONTAINER ==================== */
.fnf-opponent-container {
    position: absolute;
    left: -100px; /* CAMBIAR: de -50px a -100px */
    top: 45%;
    transform: translateY(-50%);
    width: 1200px; /* CAMBIAR: de 1000px a 1200px */
    height: 550px;
    z-index: 25;
    pointer-events: none;
    overflow: visible;
    display: none;
}

.fnf-game-area.active ~ .fnf-opponent-container {
    display: block;
}

.fnf-opponent-canvas {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    object-fit: contain;
}

/* Receptores visuales del oponente (automáticos) */
.fnf-opponent-receptors {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 35;
}

.fnf-opponent-receptor {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.1s;
    border: 2px solid transparent;
    opacity: 0.6;
}

.fnf-opponent-receptor.lane-0 { 
    background: rgba(255, 0, 128, 0.2); 
    border-color: #ff0080; 
}
.fnf-opponent-receptor.lane-1 { 
    background: rgba(0, 255, 255, 0.2); 
    border-color: #00ffff; 
}
.fnf-opponent-receptor.lane-2 { 
    background: rgba(0, 255, 0, 0.2); 
    border-color: #00ff00; 
}
.fnf-opponent-receptor.lane-3 { 
    background: rgba(255, 0, 0, 0.2); 
    border-color: #ff0000; 
}

.fnf-opponent-receptor.auto-hit {
    transform: scale(1.2);
    filter: brightness(1.8);
    box-shadow: 0 0 25px currentColor;
    opacity: 1;
}

/* Responsive */
@media (max-width: 1400px) {
    .fnf-opponent-container {
        width: 1000px; /* CAMBIAR: de 300px a 1000px */
        height: 450px;
        left: -80px; /* CAMBIAR: de 30px a -80px */
    }
    
    .fnf-opponent-receptor {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
}

@media (max-width: 768px) {
    .fnf-opponent-container {
        display: none; /* Ocultar en móviles por espacio */
    }
}

.fnf-letter {
    overflow: hidden;
}

.fnf-letter-flower {
    position: absolute;
    font-size: 1.5rem;
    pointer-events: none;
    animation: flowerFall linear infinite;
    z-index: 1;
}

@keyframes flowerFall {
    0% {
        transform: translateY(-20px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(320px) rotate(360deg);
        opacity: 0;
    }
}

/* ==================== ZORRITO CON GLOBO DE DIÁLOGO ==================== */
.fnf-zorrito-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 40px 0 30px 0;
}

.fnf-zorrito {
    width: 120px;
    height: auto;
    position: relative;
    z-index: 1;
    animation: zorroBounce 2s ease-in-out infinite;
}

.fnf-speech-bubble {
    position: absolute;
    left: 50%;
    top: -15px;
    transform: translateX(-50%);
    background: white;
    color: #333;
    padding: 10px 18px;
    border-radius: 18px;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
    z-index: 2;
    animation: bubbleFloat 3s ease-in-out infinite;
}

.fnf-speech-bubble::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -8px;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid white;
}

@keyframes zorroBounce {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes bubbleFloat {
    0%, 100% {
        transform: translateX(-50%) translateY(0px) scale(1);
        opacity: 1;
    }
    50% {
        transform: translateX(-50%) translateY(-5px) scale(1.05);
        opacity: 0.9;
    }
}

/* Responsive para zorrito */
@media (max-width: 768px) {
    .fnf-zorrito {
        width: 90px;
    }
    
    .fnf-speech-bubble {
        font-size: 0.85rem;
        padding: 8px 14px;
    }
}