/**
 * ============================================
 * COORDINATE SEQUENCE - STYLES
 * ============================================
 * Estilo neón ChessArcade para juego de secuencias
 *
 * @version 1.0.0
 * @author ChessArcade Team
 */

/* ============================================
   VARIABLES GLOBALES
   ============================================ */

:root {
    /* Colores neón */
    --neon-cyan: #00ffff;
    --neon-magenta: #ff0080;
    --neon-green: #00ff80;
    --neon-orange: #ff8000;
    --neon-blue: #0080ff;
    --neon-purple: #8000ff;
    --neon-yellow: #ffff00;
    --neon-pink: #ff0040;
    --neon-red: #ff0000;

    /* Fondos oscuros */
    --dark-bg: #0a0a0a;
    --dark-secondary: #1a0033;
    --dark-accent: #330066;
    --dark-surface: rgba(0, 0, 0, 0.8);
    --dark-surface-glass: rgba(26, 0, 51, 0.6);

    /* Textos */
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;

    /* Espaciado */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Border radius */
    --border-radius: 15px;
}

/* ============================================
   RESET Y BASE
   ============================================ */

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

body {
    font-family: 'Orbitron', monospace;
    background: linear-gradient(135deg, var(--dark-bg) 0%, var(--dark-secondary) 50%, var(--dark-accent) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Grid Background Effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(0, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    animation: gridMove 25s linear infinite;
    z-index: 0;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(40px, 40px); }
}

/* ============================================
   CONTAINER PRINCIPAL
   ============================================ */

.game-container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 1rem 0.5rem 1rem; /* Reducido padding vertical */
    gap: 0.5rem; /* Reducido gap entre elementos */
    min-height: 100vh;
    max-width: 1400px; /* Contenedor máximo para centrar todo */
    margin: 0 auto; /* Centrar el contenedor completo */
}

/* ============================================
   HEADER - Botones de navegación
   ============================================ */

.header {
    display: flex;
    gap: 0.75rem; /* Reducido de var(--spacing-sm) */
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap; /* No permitir wrap en móvil */
    width: 100%;
    max-width: 800px;
    margin-bottom: 0.5rem; /* Reducir espacio con título */
}

/* Móvil: Reducir padding de botones para que quepan */
@media (max-width: 600px) {
    .header {
        gap: 0.5rem;
        padding: 0 0.5rem;
    }

    .btn-icon {
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
    }

    .btn-label {
        font-size: 0.75rem;
    }

    .btn-start-header {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .btn-replay {
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
        width: 100%;
        max-width: 500px;
    }

    .btn-replay .btn-text {
        font-size: 0.75rem;
    }

    /* Todos los botones secundarios en mobile con mismo ancho */
    .btn-secondary {
        width: 100%;
        max-width: 500px;
        padding: 0.75rem 1rem;
    }
}

.btn-icon {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--neon-cyan);
    border-radius: var(--border-radius);
    color: var(--neon-cyan);
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.btn-icon:hover {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
    transform: translateY(-2px);
}

.btn-icon svg {
    width: 20px;
    height: 20px;
}

/* Botón LEADERBOARD: amarillo/gold */
.btn-leaderboard {
    border-color: var(--gold, #ffd700);
    color: var(--gold, #ffd700);
}

.btn-leaderboard:hover {
    box-shadow: 0 0 20px var(--gold, #ffd700);
}

.btn-primary {
    padding: 1rem 2.5rem;
    background: linear-gradient(135deg, var(--neon-magenta), var(--neon-pink));
    border: none;
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-family: 'Orbitron', monospace;
    font-weight: 900;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    box-shadow: 0 0 20px rgba(255, 0, 128, 0.5);
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 0, 128, 0.8);
}

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

.btn-secondary {
    padding: 1rem 2.5rem;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--neon-cyan);
    border-radius: var(--border-radius);
    color: var(--neon-cyan);
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;

    /* Flexbox para alinear icono + texto */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-secondary:hover {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

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

/* ============================================
   WRAPPER: TABLERO + CONTROLES
   ============================================ */

/* Móvil: Controles arriba, tablero abajo (flex column) */
.board-and-controls-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem; /* Reducido para que tablero no quede pegado abajo */
    width: 100%;
    margin-top: 0; /* Sin margin superior */
}

/* Móvil: Orden natural (tablero primero, controles abajo) */
.board-container {
    order: 1; /* Tablero primero visualmente en móvil */
}

.game-controls {
    order: 2; /* Controles abajo visualmente en móvil */
}

/* Desktop: Wrapper con tablero CENTRADO + sidebar derecha ABSOLUTA */
@media (min-width: 900px) {
    .board-and-controls-wrapper {
        position: relative; /* Para posicionar sidebar absoluta */
        flex-direction: column; /* Mantener columna para centrado */
        justify-content: center;
        align-items: center; /* Centrar como los botones del header */
        gap: 0;
        width: 100%;
    }

    /* Desktop: Tablero centrado (como los botones del header) */
    .board-container {
        order: 1;
        flex-shrink: 0;
        /* El tablero queda centrado naturalmente */
    }

    /* Desktop: Sidebar posición absoluta a la derecha */
    .game-controls {
        position: absolute;
        right: 2rem; /* Pegado a la derecha */
        top: 0; /* Alineado con el top del tablero */
        order: 2;
        flex-shrink: 0;
    }
}

/* ============================================
   CONTROLES DEL JUEGO - SIDEBAR
   ============================================ */

/* Móvil: Alargado, cerca del tablero, diferente color */
.game-controls {
    /* Centrar contenido */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);

    /* Ancho en mobile */
    width: 100%;
    max-width: 500px; /* Mismo que tablero */
}

/* Desktop: Barra lateral estilo Memory Matrix */
@media (min-width: 900px) {
    .game-controls {
        /* Fondo semi-transparente */
        background: rgba(0, 0, 0, 0.4);

        /* Borde neón púrpura */
        border: 3px solid var(--neon-purple);
        border-radius: var(--border-radius);

        /* Padding */
        padding: var(--spacing-md);

        /* Glow neón */
        box-shadow:
            0 0 20px var(--neon-purple),
            0 0 40px rgba(128, 0, 255, 0.3),
            inset 0 0 20px rgba(128, 0, 255, 0.05);

        /* Ancho fijo */
        width: 280px;
        max-width: none;
    }
}

/* Botones de control en sidebar - TODOS mismo ancho */
.btn-coordinates,
.btn-hint,
.btn-stats,
.btn-end-game {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%; /* Ancho completo en sidebar */
}

.btn-coordinates .icon-coordinates {
    flex-shrink: 0;
}

.btn-coordinates .btn-text {
    display: inline; /* Visible también en móvil */
}

/* Móvil: Botón alargado, color diferente */
@media (max-width: 899px) {
    .btn-coordinates {
        width: 95%; /* Alargado */
        padding: 0.75rem 1.5rem;
        background: rgba(255, 128, 0, 0.1); /* Naranja suave */
        border-color: var(--neon-orange);
        color: var(--neon-orange);
        border-radius: 12px;
    }

    .btn-coordinates .icon-coordinates {
        stroke: var(--neon-orange);
    }

    .btn-coordinates:hover {
        background: rgba(255, 128, 0, 0.2);
        box-shadow: 0 0 20px rgba(255, 128, 0, 0.5);
    }

    .btn-coordinates.active {
        background: rgba(0, 255, 128, 0.2);
        border-color: var(--neon-green);
        color: var(--neon-green);
    }

    .btn-coordinates.active .icon-coordinates {
        stroke: var(--neon-green);
    }
}

/* Desktop: Mostrar texto completo */
@media (min-width: 900px) {
    .btn-coordinates .btn-text {
        display: inline;
    }

    /* Estado activo en desktop */
    .btn-coordinates.active {
        background: rgba(0, 255, 255, 0.2);
        border-color: var(--neon-green);
        color: var(--neon-green);
    }

    .btn-coordinates.active .icon-coordinates {
        stroke: var(--neon-green);
    }
}

/* ============================================
   TÍTULO
   ============================================ */

.title-section {
    text-align: center;
    margin: 0.25rem 0; /* Reducido para que tablero entre */
}

.game-title {
    font-size: clamp(2rem, 7vw, 4rem);
    font-weight: 900;
    color: var(--neon-cyan);
    text-shadow:
        0 0 10px var(--neon-cyan),
        0 0 20px var(--neon-cyan),
        0 0 30px var(--neon-cyan);
    animation: titlePulse 3s ease-in-out infinite;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* Logo tipo Tetris con bloques coloridos */
.tetris-logo {
    display: inline-flex;
    gap: 0.1em;
    margin-right: 0.3em;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.5));
}

.tetris-block {
    font-size: 0.8em;
    display: inline-block;
    animation: blockFloat 3s ease-in-out infinite;
}

.block-pink {
    animation-delay: 0s;
    filter: drop-shadow(0 0 10px var(--neon-magenta));
}

.block-yellow {
    animation-delay: 0.5s;
    filter: drop-shadow(0 0 10px var(--neon-yellow));
}

.block-cyan {
    animation-delay: 1s;
    filter: drop-shadow(0 0 10px var(--neon-cyan));
}

@keyframes blockFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-5px) rotate(2deg); }
    75% { transform: translateY(5px) rotate(-2deg); }
}

.game-subtitle {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    color: var(--neon-cyan);
    text-align: center;
    margin: -0.5rem 0 0.5rem 0; /* Reducido espacio inferior */
    opacity: 0.9;
    letter-spacing: 0.05em;
}

@keyframes titlePulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* ============================================
   ESTADÍSTICAS DEL JUEGO
   ============================================ */

.game-stats {
    display: flex;
    gap: 0.75rem; /* Reducido de var(--spacing-md) */
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    max-width: 800px;
    margin-bottom: 0.5rem; /* Reducir espacio debajo */
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--neon-cyan);
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
    min-width: 120px;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--neon-cyan);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--neon-magenta);
    text-shadow: 0 0 10px var(--neon-magenta);
}

.stat-value.lives {
    font-size: 1.2rem;
}

/* ============================================
   TABLERO DE AJEDREZ
   ============================================ */

.board-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-md);
    background: rgba(0, 0, 0, 0.4);
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
    position: relative; /* Para btn-play-overlay */
}

.chessboard {
    /* Grid 8x8 con fracciones fluidas (responsive) */
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 2px;

    /* Tamaño del tablero (mobile first) */
    width: 95vw;
    max-width: 500px;
    aspect-ratio: 1; /* Mantener cuadrado */

    /* Padding para coordenadas */
    padding: 20px;

    /* Borde y fondo */
    background: #222;
    border-radius: var(--border-radius);
    border: 4px solid var(--neon-cyan);
    box-shadow:
        0 0 30px rgba(0, 255, 255, 0.5),
        inset 0 0 30px rgba(0, 255, 255, 0.1);

    /* Posición relativa para coordenadas absolutas */
    position: relative;

    /* Transición suave para efectos de replay */
    transition: filter 0.5s ease, box-shadow 0.5s ease;
}

/* Efecto VINTAGE para modo REPLAY */
.chessboard.replay-mode {
    /* Filtro vintage: sepia + desaturación + contraste reducido */
    filter: sepia(0.3) saturate(0.6) contrast(0.9);

    /* Animación de grain/noise sutil (parpadeo de opacidad) */
    animation: vintageGrain 0.15s infinite alternate;

    /* Borde más oscuro durante replay */
    border-color: rgba(0, 255, 255, 0.4);
    box-shadow:
        0 0 20px rgba(0, 255, 255, 0.3),
        inset 0 0 30px rgba(0, 0, 0, 0.3);
}

/* Animación de grain/noise (simula película vieja) */
@keyframes vintageGrain {
    0% {
        opacity: 0.97;
    }
    100% {
        opacity: 1;
    }
}

/* Responsive: Tablero más grande en tablets */
@media (min-width: 600px) {
    .chessboard {
        width: 85vw;
        max-width: 550px;
        padding: 24px; /* Más espacio para coordenadas */
    }
}

/* Responsive: Tablero más grande en desktop */
@media (min-width: 900px) {
    .chessboard {
        width: 70vw;
        max-width: 600px;
        padding: 28px; /* Aún más espacio en desktop */
    }
}

/* ============================================
   PARTÍCULAS - Mini confeti al acertar
   ============================================ */

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 15;
    animation: particleExplode 0.8s ease-out forwards;
}

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

.square {
    /* Tamaño se define por el grid (1fr) */
    display: flex;
    align-items: center;
    justify-content: center;

    /* Cursor y transiciones */
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;

    /* Posición relativa para coordenadas */
    position: relative;
    border-radius: 4px;

    /* Tipografía */
    font-size: 0.7rem;
    font-weight: 700;
    user-select: none;
}

/* ============================================
   COORDENADAS DEL TABLERO (a-h, 1-8)
   Posicionadas en el BORDE NEGRO del tablero
   ============================================ */

/* Coordenadas horizontales (a-h) - En el borde inferior */
.coord-file {
    position: absolute;
    bottom: -16px; /* Fuera de la casilla, en el padding del tablero */
    left: 50%;
    transform: translateX(-50%);

    /* Texto blanco fuerte */
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;

    pointer-events: none;
    user-select: none;
    z-index: 20;
}

/* ============================================
   COORDENADAS DENTRO DE CASILLAS (modo ayuda)
   Estilo igual a Square Rush
   ============================================ */

.coordinate-label {
    font-size: 14px;
    font-weight: 900;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    pointer-events: none;
    user-select: none;
    position: absolute;
    z-index: 25;
    color: #ffffff;
    text-transform: uppercase;
}

/* Responsive coordinate labels */
@media (min-width: 600px) {
    .coordinate-label {
        font-size: 16px;
    }
}

@media (min-width: 900px) {
    .coordinate-label {
        font-size: 18px;
    }
}

/* Coordenadas verticales (1-8) - En el borde izquierdo */
.coord-rank {
    position: absolute;
    left: -14px; /* Fuera de la casilla, en el padding del tablero */
    top: 50%;
    transform: translateY(-50%);

    /* Texto blanco fuerte */
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;

    pointer-events: none;
    user-select: none;
    z-index: 20;
}

/* Tamaño de coordenadas responsive */
@media (min-width: 600px) {
    .coord-file {
        bottom: -18px;
        font-size: 12px;
    }

    .coord-rank {
        left: -16px;
        font-size: 12px;
    }
}

@media (min-width: 900px) {
    .coord-file {
        bottom: -20px;
        font-size: 13px;
    }

    .coord-rank {
        left: -18px;
        font-size: 13px;
    }
}

.square.light {
    background: linear-gradient(135deg, #f5deb3 0%, #f0d9b5 50%, #e8c78a 100%);
    color: #8b4513;
}

.square.dark {
    background: linear-gradient(135deg, #d2b48c 0%, #b58863 50%, #9d6e47 100%);
    color: #f5deb3;
}

/* Estados de las casillas */

.square.highlighting {
    /* Usa CSS variables si están definidas, sino cyan por defecto */
    --highlight-color: var(--highlight-color, var(--neon-cyan));
    --highlight-shadow: var(--highlight-shadow, rgba(0, 255, 255, 0.8));

    /* COLOR PURO sin degradado */
    background: var(--highlight-color) !important;

    /* BORDE GRUESO del mismo color */
    border: 6px solid var(--highlight-color) !important;

    /* GLOW intenso externo e interno */
    box-shadow:
        0 0 40px var(--highlight-shadow),
        0 0 60px var(--highlight-shadow),
        0 0 80px var(--highlight-shadow),
        inset 0 0 30px rgba(255, 255, 255, 0.6);

    animation: highlightPulse 0.8s ease-in-out;
    transform: scale(1.05);
    z-index: 10;
}

.square.correct {
    background: linear-gradient(45deg, var(--neon-green), #00cc66) !important;
    box-shadow: 0 0 20px var(--neon-green);
    animation: correctFlash 0.5s ease;
}

.square.incorrect {
    background: linear-gradient(45deg, var(--neon-red), #cc0000) !important;
    box-shadow: 0 0 20px var(--neon-red);
    animation: shake 0.5s ease;
}

.square.clickable {
    cursor: pointer;
}

.square.clickable:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
}

@keyframes highlightPulse {
    0%, 100% {
        transform: scale(1.1);
        box-shadow: 0 0 30px var(--neon-cyan);
    }
    50% {
        transform: scale(1.15);
        box-shadow: 0 0 50px var(--neon-cyan);
    }
}

@keyframes correctFlash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

/* ============================================
   HINT - Fondo blanco + coordenadas neón + flechas persistentes + líneas
   ============================================ */

/* SVG overlay para líneas conectoras */
.hint-lines-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;  /* Debajo de las casillas pero visible */
}

.hint-connecting-line {
    opacity: 0.8;
}

/* Casillas de la secuencia: fondo blanco limpio */
.square.hint-sequence {
    background: #fff !important;
    border: 2px solid #ddd !important;
    position: relative;
}

/* Label con coordenada en color neón */
.hint-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Orbitron', monospace;
    font-size: 24px;
    font-weight: 900;
    pointer-events: none;
    z-index: 10;
    text-transform: uppercase;
}

/* Siguiente casilla: borde amarillo MUY grueso + fondo amarillo pulsante */
.square.hint-next {
    border: 8px solid var(--neon-yellow) !important;
    background: rgba(255, 255, 0, 0.2) !important;
    box-shadow:
        0 0 30px var(--neon-yellow),
        0 0 60px var(--neon-yellow),
        inset 0 0 30px rgba(255, 255, 0, 0.4);
    animation: hintPulse 0.8s ease-in-out infinite;
    transform: scale(1.05);
}

/* Label de siguiente casilla: más grande y brillante */
.hint-next-label {
    font-size: 32px !important;
    animation: hintLabelPulse 1s ease-in-out infinite;
}

@keyframes hintPulse {
    0%, 100% {
        box-shadow:
            0 0 30px var(--neon-yellow),
            0 0 60px var(--neon-yellow),
            inset 0 0 30px rgba(255, 255, 0, 0.4);
        border-width: 8px;
    }
    50% {
        box-shadow:
            0 0 50px var(--neon-yellow),
            0 0 100px var(--neon-yellow),
            inset 0 0 50px rgba(255, 255, 0, 0.6);
        border-width: 10px;
    }
}

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

/* Flecha direccional GRANDE: indica hacia dónde continúa la secuencia */
.hint-arrow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    margin-top: -30px;
    margin-left: -30px;
    pointer-events: none;
    z-index: 12;
    transform-origin: center;
    animation: arrowPulse 1.5s ease-in-out infinite;
}

.hint-arrow svg {
    width: 100%;
    height: 100%;
}

@keyframes arrowPulse {
    0%, 100% {
        opacity: 0.8;
        transform: scale(1) rotate(var(--rotation, 0deg));
    }
    50% {
        opacity: 1;
        transform: scale(1.15) rotate(var(--rotation, 0deg));
    }
}

/* Símbolo de repetición: cuando la secuencia repite la misma casilla */
.hint-repeat {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 28px;
    font-weight: 900;
    pointer-events: none;
    z-index: 11;
    animation: hintRotate 2s ease-in-out infinite;
}

@keyframes hintRotate {
    0%, 100% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(180deg) scale(1.15);
    }
}

/* ============================================
   BOTÓN PLAY CENTRAL TRANSPARENTE
   ============================================ */

.btn-play-overlay {
    /* Posicionamiento centrado absoluto sobre el tablero */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;

    /* Tamaño grande y responsivo */
    width: clamp(120px, 30vw, 180px);
    height: clamp(120px, 30vw, 180px);

    /* Fondo semi-transparente con blur */
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border: 3px solid var(--neon-cyan);
    border-radius: 50%;

    /* Sin padding ni margin */
    padding: 0;
    margin: 0;

    /* Cursor pointer */
    cursor: pointer;

    /* Color del ícono */
    color: var(--neon-cyan);

    /* Glow neón */
    box-shadow:
        0 0 30px rgba(0, 255, 255, 0.6),
        0 0 50px rgba(0, 255, 255, 0.4),
        inset 0 0 20px rgba(0, 255, 255, 0.2);

    /* Transiciones suaves */
    transition: all 0.3s ease;

    /* Animación pulsante */
    animation: playPulse 2s ease-in-out infinite;
}

.btn-play-overlay:hover {
    /* Aumentar glow al hover */
    box-shadow:
        0 0 40px rgba(0, 255, 255, 0.8),
        0 0 70px rgba(0, 255, 255, 0.6),
        inset 0 0 30px rgba(0, 255, 255, 0.4);

    /* Escala ligeramente */
    transform: translate(-50%, -50%) scale(1.1);

    /* Color más brillante */
    border-color: var(--neon-green);
    color: var(--neon-green);
}

.btn-play-overlay:active {
    transform: translate(-50%, -50%) scale(0.95);
}

/* Ícono SVG del play */
.play-icon {
    width: 100%;
    height: 100%;
    display: block;
    filter: drop-shadow(0 0 10px currentColor);
}

/* Animación de pulso */
@keyframes playPulse {
    0%, 100% {
        box-shadow:
            0 0 30px rgba(0, 255, 255, 0.6),
            0 0 50px rgba(0, 255, 255, 0.4),
            inset 0 0 20px rgba(0, 255, 255, 0.2);
    }
    50% {
        box-shadow:
            0 0 40px rgba(0, 255, 255, 0.8),
            0 0 70px rgba(0, 255, 255, 0.6),
            inset 0 0 30px rgba(0, 255, 255, 0.3);
    }
}

/* Estado oculto */
.btn-play-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.5);
}

/* Responsive para mobile */
@media (max-width: 600px) {
    .btn-play-overlay {
        width: clamp(100px, 35vw, 150px);
        height: clamp(100px, 35vw, 150px);
    }
}

/* ============================================
   MENSAJE DE ESTADO
   ============================================ */

.status-section {
    text-align: center;
    padding: var(--spacing-md);
}

.status-message {
    font-size: 1.1rem;
    color: var(--neon-cyan);
    background: rgba(0, 0, 0, 0.6);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius);
    border: 2px solid var(--neon-cyan);
    backdrop-filter: blur(10px);
    animation: messagePulse 2s ease-in-out infinite;
}

@keyframes messagePulse {
    0%, 100% { box-shadow: 0 0 10px rgba(0, 255, 255, 0.3); }
    50% { box-shadow: 0 0 20px rgba(0, 255, 255, 0.6); }
}

/* ============================================
   HOW TO PLAY
   ============================================ */

.how-to-play-section {
    width: 100%;
    max-width: 800px;
    padding: var(--spacing-lg);
}

.instructions {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--neon-cyan);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    backdrop-filter: blur(10px);
}

.instructions h2 {
    color: var(--neon-cyan);
    font-size: 1.5rem;
    margin-bottom: var(--spacing-sm);
    text-shadow: 0 0 10px var(--neon-cyan);
}

.instructions p {
    margin-bottom: var(--spacing-sm);
    line-height: 1.8;
}

.instructions ul {
    margin-left: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.instructions li {
    margin-bottom: 0.5rem;
}

.instructions strong {
    color: var(--neon-magenta);
    text-shadow: 0 0 5px var(--neon-magenta);
}

/* ============================================
   OVERLAYS (Success, Fail, Game Over)
   ============================================ */

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: overlayFadeIn 0.3s ease;
}

.overlay.hidden {
    display: none;
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.overlay-content {
    position: relative; /* Para que el botón X se posicione correctamente */
    background: linear-gradient(135deg, var(--dark-secondary), var(--dark-accent));
    border: 3px solid var(--neon-cyan);
    border-radius: var(--border-radius);
    padding: var(--spacing-xl);
    text-align: center;
    max-width: 500px;
    width: 90%;
    animation: overlaySlideIn 0.4s ease;
}

@keyframes overlaySlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.overlay-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-sm);
    animation: iconBounce 0.6s ease;
}

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

.overlay-title {
    font-size: 2rem;
    color: var(--neon-cyan);
    text-shadow: 0 0 20px var(--neon-cyan);
    margin-bottom: var(--spacing-sm);
}

.overlay-message {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-lg);
}

.overlay-stats,
.final-stats {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    margin-bottom: var(--spacing-lg);
}

.overlay-stat,
.final-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-sm);
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--neon-magenta);
    border-radius: var(--border-radius);
    min-width: 100px;
}

.overlay-stat-label,
.final-stat-label {
    font-size: 0.75rem;
    color: var(--neon-cyan);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.overlay-stat-value,
.final-stat-value {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--neon-magenta);
    text-shadow: 0 0 10px var(--neon-magenta);
}

.sequence-display {
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-md);
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--neon-orange);
    border-radius: var(--border-radius);
}

.sequence-label {
    font-size: 0.9rem;
    color: var(--neon-orange);
    margin-bottom: 0.5rem;
}

.sequence-value {
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--neon-yellow);
    text-shadow: 0 0 10px var(--neon-yellow);
    letter-spacing: 0.1em;
}

.overlay-buttons {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    justify-content: center;
}

.btn-overlay {
    margin-top: var(--spacing-sm);
}

/* Colores específicos por tipo de overlay */
.overlay-content.success {
    border-color: var(--neon-green);
}

.overlay-content.success .overlay-title {
    color: var(--neon-green);
    text-shadow: 0 0 20px var(--neon-green);
}

.overlay-content.fail {
    border-color: var(--neon-red);
}

.overlay-content.fail .overlay-title {
    color: var(--neon-red);
    text-shadow: 0 0 20px var(--neon-red);
}

.overlay-content.game-over {
    border-color: var(--neon-purple);
}

.overlay-content.game-over .overlay-title {
    color: var(--neon-purple);
    text-shadow: 0 0 20px var(--neon-purple);
}

.overlay-content.confirm {
    border-color: var(--neon-orange);
}

.overlay-content.confirm .overlay-title {
    color: var(--neon-orange);
    text-shadow: 0 0 20px var(--neon-orange);
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */

@media (max-width: 767px) {
    .game-container {
        padding: var(--spacing-sm);
        gap: var(--spacing-sm);
    }

    .title-section {
        margin: 0.25rem 0;
    }

    .game-title {
        font-size: 1.8rem;
    }

    .game-subtitle {
        font-size: 0.85rem;
        margin: -0.25rem 0 0.5rem 0;
    }

    .game-stats {
        gap: 0.5rem;
    }

    .stat {
        min-width: 80px;
        padding: 0.75rem 1rem;
    }

    .stat-label {
        font-size: 0.65rem;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .chessboard {
        padding: 12px;
        max-width: 95vw;
    }

    .square::after {
        font-size: 0.5rem;
    }

    .btn-icon .btn-label {
        display: none;
    }

    .btn-primary {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }

    .overlay-content {
        padding: var(--spacing-lg);
    }

    .overlay-title {
        font-size: 1.5rem;
    }

    .overlay-icon {
        font-size: 3rem;
    }

    .instructions {
        padding: var(--spacing-md);
    }

    .instructions h2 {
        font-size: 1.2rem;
    }

    .instructions p,
    .instructions li {
        font-size: 0.9rem;
    }
}

@media (max-width: 350px) {
    .stat {
        min-width: 70px;
        padding: 0.5rem 0.75rem;
    }

    .stat-value {
        font-size: 1rem;
    }
}

/* ============================================
   BOTÓN CERRAR OVERLAY (X)
   ============================================ */

.btn-close-overlay {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--neon-cyan);
    border-radius: 50%;
    color: var(--neon-cyan);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 0;
}

.btn-close-overlay:hover {
    background: rgba(0, 255, 255, 0.2);
    border-color: var(--neon-magenta);
    color: var(--neon-magenta);
    box-shadow: 0 0 20px rgba(255, 0, 128, 0.5);
    transform: rotate(90deg) scale(1.1);
}

.btn-close-overlay:active {
    transform: rotate(90deg) scale(0.95);
}

.btn-close-overlay svg {
    width: 20px;
    height: 20px;
}

/* ============================================
   STATS OVERLAY - Estadísticas Detalladas
   ============================================ */

.stats-overlay {
    max-width: 600px !important;
    max-height: 90vh !important; /* No debe exceder 90% de altura de pantalla */
    overflow-y: auto; /* Scroll si es necesario */
}

/* Grid de estadísticas principal (2x2) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}

.stat-card {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--neon-cyan);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    position: relative;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

.stat-card-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.stat-card-label {
    font-size: 0.7rem;
    color: var(--neon-cyan);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.stat-card-value {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--neon-magenta);
    text-shadow: 0 0 15px var(--neon-magenta);
}

.stat-card-value.bonus {
    color: var(--neon-yellow);
    text-shadow: 0 0 15px var(--neon-yellow);
}

/* Badge de velocidad */
.stat-card-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: linear-gradient(135deg, var(--neon-yellow), var(--neon-orange));
    border: 2px solid var(--neon-orange);
    border-radius: 20px;
    padding: 0.25rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    animation: badgePop 0.5s ease;
}

.badge-icon {
    font-size: 0.9rem;
}

.badge-text {
    font-size: 0.65rem;
    font-weight: 900;
    color: #000;
    letter-spacing: 0.05em;
}

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

/* Sección de racha perfecta */
.streak-section {
    background: linear-gradient(135deg, rgba(255, 100, 0, 0.2), rgba(255, 0, 0, 0.2));
    border: 2px solid var(--neon-orange);
    border-radius: 15px;
    padding: 1rem;
    margin: 1.5rem 0;
    text-align: center;
    animation: streakGlow 2s ease-in-out infinite;
}

@keyframes streakGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 100, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 40px rgba(255, 100, 0, 0.8);
    }
}

.streak-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.streak-fire {
    font-size: 2rem;
    animation: fireFlicker 1s ease-in-out infinite;
}

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

.streak-text {
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--neon-orange);
    text-shadow: 0 0 10px var(--neon-orange);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.multiplier-text {
    font-size: 0.95rem;
    color: var(--neon-yellow);
}

.multiplier-value {
    font-weight: 900;
    font-size: 1.3rem;
    color: var(--neon-yellow);
    text-shadow: 0 0 15px var(--neon-yellow);
}

/* Puntos finales (destacado) */
.final-points-section {
    background: linear-gradient(135deg, rgba(255, 0, 128, 0.3), rgba(128, 0, 255, 0.3));
    border: 3px solid var(--neon-magenta);
    border-radius: 20px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    text-align: center;
    animation: pointsGlow 1.5s ease-in-out infinite;
}

@keyframes pointsGlow {
    0%, 100% {
        box-shadow: 0 0 30px rgba(255, 0, 128, 0.6);
    }
    50% {
        box-shadow: 0 0 50px rgba(255, 0, 128, 0.9);
    }
}

.final-points-label {
    font-size: 0.8rem;
    color: var(--neon-cyan);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 0.5rem;
}

.final-points-value {
    font-size: 3rem;
    font-weight: 900;
    color: var(--neon-magenta);
    text-shadow:
        0 0 20px var(--neon-magenta),
        0 0 40px var(--neon-magenta);
    animation: pointsPulse 1s ease-in-out;
}

@keyframes pointsPulse {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* Sección de records batidos */
.records-section {
    background: rgba(255, 215, 0, 0.1);
    border: 2px solid #ffd700;
    border-radius: 15px;
    padding: 1rem;
    margin: 1rem 0 1.5rem 0;
    animation: recordsShine 2s ease-in-out infinite;
}

@keyframes recordsShine {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
    }
    50% {
        box-shadow: 0 0 40px rgba(255, 215, 0, 0.7);
    }
}

.records-title {
    font-size: 1rem;
    font-weight: 900;
    color: #ffd700;
    text-shadow: 0 0 15px #ffd700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
}

.records-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.record-item {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #ffd700;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: #ffd700;
    text-align: center;
}

/* Responsive para móvil */
@media (max-width: 767px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .stat-card-value {
        font-size: 1.5rem;
    }

    .final-points-value {
        font-size: 2.5rem;
    }

    .streak-text {
        font-size: 1rem;
    }
}

/* ============================================
   CONFETTI SYSTEM
   ============================================ */

.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1000;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--neon-green);
    opacity: 0;
    animation: confettiFall 2s ease-out forwards;
}

/* Color variants */
.confetti.cyan { background: var(--neon-cyan); }
.confetti.pink { background: var(--neon-pink); }
.confetti.orange { background: var(--neon-orange); }
.confetti.gold { background: #ffd700; }

/* Confetti fall animation */
@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translateY(-20px) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg);
    }
}

/* ============================================
   REPLAY SYSTEM STYLES - RETRO DESIGN
   ============================================ */

/* Botón VER REPLAY */
.btn-replay {
    background: linear-gradient(135deg, #ff0080, #8000ff);
    border: 2px solid #ff0080;
    box-shadow: 0 0 20px rgba(255, 0, 128, 0.5);
}

.btn-replay:hover {
    background: linear-gradient(135deg, #ff3399, #9933ff);
    box-shadow: 0 0 30px rgba(255, 0, 128, 0.8);
    transform: translateY(-2px);
}

/* ============================================
   BADGE DE CÁMARA RETRO (Esquina superior izquierda)
   ============================================ */
.replay-camera-badge {
    position: fixed;
    top: 95px;  /* Más cerca del tablero */
    left: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 0, 0, 0.15);
    border: 2px solid #ff0000;
    border-radius: 4px;
    padding: 6px 12px;  /* Más compacto */
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 12px;
    color: #ff0000;
    text-shadow: 0 0 10px #ff0000;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.5), inset 0 0 10px rgba(255, 0, 0, 0.2);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.camera-icon {
    font-size: 20px;
    animation: cameraFlicker 0.1s infinite alternate;
}

.rec-text {
    font-size: 16px;
    letter-spacing: 2px;
}

.rec-dot {
    width: 10px;
    height: 10px;
    background: #ff0000;
    border-radius: 50%;
    box-shadow: 0 0 10px #ff0000;
    animation: recBlink 1s ease-in-out infinite;
}

@keyframes recBlink {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 10px #ff0000;
    }
    50% {
        opacity: 0.3;
        box-shadow: 0 0 5px #ff0000;
    }
}

@keyframes cameraFlicker {
    0% { opacity: 1; }
    100% { opacity: 0.95; }
}

/* ============================================
   MARCO RETRO (Estilo VHS/Cámara antigua - líneas continuas)
   ============================================ */
.retro-frame {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    display: none; /* Oculto por defecto, se muestra en replay */
}

/* Marco continuo alrededor del área de juego */
.frame-corner {
    position: absolute;
    border: 2px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
}

/* Línea superior horizontal (con esquina izquierda) */
.frame-top-left {
    top: 90px;
    left: 10px;
    width: 200px;
    height: 40px;
    border-right: none;
    border-bottom: none;
}

/* Línea superior horizontal (con esquina derecha) */
.frame-top-right {
    top: 90px;
    right: 10px;
    width: 200px;
    height: 40px;
    border-left: none;
    border-bottom: none;
}

/* Línea inferior horizontal (con esquina izquierda) */
.frame-bottom-left {
    bottom: 60px;
    left: 10px;
    width: 200px;
    height: 40px;
    border-right: none;
    border-top: none;
}

/* Línea inferior horizontal (con esquina derecha) */
.frame-bottom-right {
    bottom: 60px;
    right: 10px;
    width: 200px;
    height: 40px;
    border-left: none;
    border-top: none;
}

/* Responsive - Marco más pequeño en mobile */
@media (max-width: 768px) {
    .replay-camera-badge {
        top: 10px;
        left: 10px;
        padding: 6px 12px;
        font-size: 11px;
    }

    .camera-icon {
        font-size: 16px;
    }

    .rec-text {
        font-size: 12px;
        letter-spacing: 1px;
    }

    .rec-dot {
        width: 8px;
        height: 8px;
    }

    .frame-corner {
        border-width: 1.5px;
    }

    .frame-top-left,
    .frame-top-right {
        top: 70px;
        width: 100px;
        height: 30px;
    }

    .frame-bottom-left,
    .frame-bottom-right {
        bottom: 50px;
        width: 100px;
        height: 30px;
    }

    .frame-top-left,
    .frame-bottom-left {
        left: 5px;
    }

    .frame-top-right,
    .frame-bottom-right {
        right: 5px;
    }
}

/* COIN COUNTER */
.neon-coin-counter {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, rgba(0,0,0,0.9), rgba(26,0,51,0.8));
    padding: 0.8rem 1.5rem;
    border-radius: 30px;
    border: 3px solid var(--neon-yellow);
    color: var(--neon-yellow);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
    backdrop-filter: blur(10px);
    z-index: 1001;
    transition: all 0.3s ease;
}

.neon-coin-counter:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
}

@media (max-width: 767px) {
    .neon-coin-counter {
        top: 70px;
        right: 10px;
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
        gap: 0.5rem;
    }

    .floating-games-menu {
        top: 130px;
        right: 10px;
    }
}

.neon-coin-icon {
    width: 25px;
    height: 25px;
    background: var(--neon-yellow);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dark-bg);
    font-weight: 900;
    animation: neonCoinSpin 3s linear infinite;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

@keyframes neonCoinSpin {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}

/* FLOATING GAMES MENU */
.floating-games-menu {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1000;
    pointer-events: none;
}

.games-menu-dropdown {
    background: rgba(26, 0, 51, 0.95);
    border: 2px solid var(--neon-yellow);
    border-radius: 10px;
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.4);
    backdrop-filter: blur(10px);
}

.games-menu-dropdown.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.game-menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
}

.game-menu-item:last-child {
    border-bottom: none;
}

.game-menu-item:hover {
    background: rgba(255, 215, 0, 0.1);
    color: var(--neon-yellow);
    padding-left: 2rem;
}

.game-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.5));
}

.game-name {
    font-weight: 600;
    font-family: 'Orbitron', monospace;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
}

/* ============================================
   RANKING ANIMATION
   ============================================ */

.ranking-animation-container {
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid var(--neon-cyan);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    margin: 0.75rem 0;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.5s ease;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
    max-width: 100%;
    overflow: hidden;
}

.ranking-animation-container.show {
    opacity: 1;
    transform: translateY(0);
}

.ranking-animation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(0, 255, 255, 0.3);
    margin-bottom: 0.75rem;
}

.ranking-animation-title {
    font-size: 0.9rem;
    color: var(--neon-cyan);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.ranking-animation-score {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--neon-yellow);
    text-shadow: 0 0 10px rgba(255, 255, 0, 0.5);
}

.ranking-animation-body {
    position: relative;
    min-height: auto;
    max-height: 200px;
    overflow: hidden;
}

.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ranking-list-row {
    display: grid;
    grid-template-columns: 50px 1fr 80px;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.ranking-list-row .rank-position {
    color: var(--neon-cyan);
    font-weight: bold;
}

.ranking-list-row .rank-name {
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ranking-list-row .rank-score {
    text-align: right;
    color: var(--neon-green);
}

/* Player row styling (inline with other rows) */
.ranking-list-row.player-row {
    background: linear-gradient(90deg, rgba(255, 0, 128, 0.3), rgba(0, 255, 255, 0.3));
    border: 2px solid var(--neon-magenta);
    box-shadow: 0 0 15px rgba(255, 0, 128, 0.5);
}

.ranking-list-row.player-row .rank-position {
    color: var(--neon-magenta);
    font-weight: bold;
}

.ranking-list-row.player-row .rank-name {
    color: white;
    font-weight: bold;
    text-transform: uppercase;
}

.ranking-list-row.player-row .rank-score {
    color: var(--neon-yellow);
    font-weight: bold;
}

.ranking-list-row.player-row.found-position {
    animation: pulseGlow 1s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 15px rgba(255, 0, 128, 0.5);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 0, 128, 0.8), 0 0 50px rgba(0, 255, 255, 0.4);
    }
}

.ranking-animation-message {
    text-align: center;
    font-size: 1rem;
    font-weight: bold;
    color: var(--neon-yellow);
    text-shadow: 0 0 15px rgba(255, 255, 0, 0.5);
    margin-top: 0.5rem;
    padding: 0.25rem;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.5s ease;
}

.ranking-animation-message.show {
    opacity: 1;
    transform: scale(1);
}


/* Highlight para el input de nombre */
#gameOverPlayerNameInput.highlight-input {
    animation: highlightPulse 1.5s ease-in-out infinite;
    border-color: var(--neon-magenta) !important;
}

@keyframes highlightPulse {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 0, 128, 0.5);
    }
    50% {
        box-shadow: 0 0 25px rgba(255, 0, 128, 0.8), 0 0 40px rgba(0, 255, 255, 0.4);
    }
}

/* Responsive para la animación */
@media (max-width: 480px) {
    .ranking-animation-container {
        padding: 0.5rem;
        margin: 0.5rem 0;
    }

    .ranking-animation-header {
        flex-direction: row;
        gap: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .ranking-list-row {
        grid-template-columns: 35px 1fr 55px;
        font-size: 0.7rem;
        padding: 0.35rem;
    }

    .ranking-animation-message {
        font-size: 0.9rem;
    }
}

/* ============================================
   GAME OVER - ESTILOS REORGANIZADOS
   ============================================
   Nuevos estilos para el overlay de Game Over:
   - Botones de navegación discretos arriba
   - Input de nombre prominente con animación
   - Mensaje de consuelo para score=0
   ============================================ */

/* ====== BOTONES DE NAVEGACIÓN (arriba, discretos) ====== */
.game-over-nav-buttons {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

/**
 * Botones pequeños y discretos para navegación
 * No compiten visualmente con el contenido principal
 */
.btn-nav-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.7rem;
    font-family: 'Orbitron', monospace;
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 4px;
    color: var(--neon-cyan);
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-nav-small:hover {
    background: rgba(0, 255, 255, 0.2);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

/* ====== INPUT DE NOMBRE PROMINENTE ====== */
.name-input-container {
    margin: 1rem 0;
    padding: 1rem;
    background: rgba(255, 0, 128, 0.1);
    border: 2px solid var(--neon-magenta);
    border-radius: 10px;
    /* Animación de latido para llamar la atención */
    animation: nameContainerPulse 2s ease-in-out infinite;
}

/**
 * Animación de "latido" que hace brillar el contenedor
 * Esto ayuda a que el usuario note que debe ingresar su nombre
 */
@keyframes nameContainerPulse {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 0, 128, 0.3);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 25px rgba(255, 0, 128, 0.6), 0 0 40px rgba(0, 255, 255, 0.3);
        transform: scale(1.02);
    }
}

.name-input-label {
    display: block;
    margin-bottom: 0.75rem;
    color: var(--neon-magenta);
    font-weight: bold;
    font-size: 1.1rem;
    text-align: center;
    text-shadow: 0 0 10px rgba(255, 0, 128, 0.5);
}

/**
 * Campo de input grande y visible
 * Usa colores llamativos para atraer la atención
 */
.name-input-field {
    width: 100%;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--neon-cyan);
    border-radius: 8px;
    color: white;
    font-family: 'Orbitron', monospace;
    font-size: 1.2rem;
    text-align: center;
    transition: all 0.3s ease;
}

.name-input-field:focus {
    outline: none;
    border-color: var(--neon-magenta);
    box-shadow: 0 0 20px rgba(255, 0, 128, 0.5);
}

.name-input-field::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* ====== BOTÓN DE SUBMIT PROMINENTE ====== */
.btn-submit-score {
    width: 100%;
    padding: 15px 20px;
    margin-top: 1rem;
    font-family: 'Orbitron', monospace;
    font-size: 1.1rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: white;
    background: linear-gradient(135deg, var(--neon-magenta), var(--neon-cyan));
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(255, 0, 128, 0.4);
}

.btn-submit-score:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(255, 0, 128, 0.6), 0 5px 20px rgba(0, 0, 0, 0.3);
}

.btn-submit-score:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ====== MENSAJE DE CONSUELO (score=0) ====== */
.zero-score-message {
    text-align: center;
    padding: 1.5rem;
    margin: 1rem 0;
    background: rgba(255, 255, 0, 0.1);
    border: 2px solid var(--neon-yellow);
    border-radius: 10px;
}

.consolation-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    /* Animación de rebote suave */
    animation: consolationBounce 2s ease-in-out infinite;
}

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

.consolation-text {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--neon-yellow);
    margin: 0.5rem 0;
    text-shadow: 0 0 10px rgba(255, 255, 0, 0.5);
}

.consolation-subtext {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 480px) {
    .game-over-nav-buttons {
        gap: 0.3rem;
    }

    .btn-nav-small {
        padding: 0.3rem 0.5rem;
        font-size: 0.6rem;
    }

    .name-input-container {
        padding: 0.75rem;
    }

    .name-input-label {
        font-size: 0.9rem;
    }

    .name-input-field {
        font-size: 1rem;
        padding: 10px;
    }

    .btn-submit-score {
        font-size: 0.9rem;
        padding: 12px 15px;
    }

    .consolation-icon {
        font-size: 2rem;
    }

    .consolation-text {
        font-size: 1.1rem;
    }

    .consolation-subtext {
        font-size: 0.8rem;
    }
}

/* ============================================
   ICONO CLICKEABLE EN OVERLAYS
   ============================================
   Hace que el icono grande (como la X roja) sea clickeable
   para cerrar el modal de forma intuitiva
   ============================================ */

.clickable-icon {
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.clickable-icon:hover {
    transform: scale(1.2);
    filter: brightness(1.3);
}

.clickable-icon:active {
    transform: scale(0.95);
}

/* ============================================
   BOTÓN TERMINAR DESHABILITADO
   ============================================
   El botón Terminar está deshabilitado hasta que el jugador
   tenga al menos un acierto (para evitar terminar sin jugar)
   ============================================ */

#btnTerminar.disabled,
#btnTerminar:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(50%);
}

/* ============================================
   OCULTAR BEST EN MOBILE
   ============================================
   En mobile, el contador BEST 'baja' el tablero
   y queda antiestético. Al ocultarlo el tablero
   queda mejor centrado.
   ============================================ */

@media (max-width: 767px) {
    #bestStat,
    #streakStat {
        display: none !important;
    }
}
