/* =========================================
   1. VARIABLES Y TEMA
   ========================================= */
:root {
    /* Colores Base */
    --primary: #1a1a1a;
    --accent: #3b82f6;
    /* Azul moderno */
    --accent-light: #e3f2fd;
    /* Fondo selección */
    --accent-hover: #2563eb;
    --bg-color: #f8f9fa;

    /* Colores del Grid */
    --grid-border: #1a1a1a;
    --cell-bg: #ffffff;
    --cell-text: #000000;
    --black-cell-bg: #222;

    /* UI General */
    --header-bg: #ffffff;
    --footer-bg: #f1f2f6;
    --border-light: #e5e7eb;
    --input-focus: #bbdefb;
    --input-bg: #ffffff;

    /* Teclado Virtual */
    --keyboard-bg: #d1d5db;
    --key-bg: #ffffff;

    /* Dimensiones Default (Escritorio) */
    --cell-size: 44px;
    --rows: 12;
    --cols: 12;
}

/* MODO OSCURO */
body.dark-mode {
    --primary: #f0f0f0;
    --bg-color: #121212;

    --grid-border: #555;
    --cell-bg: #2c2c2c;
    --cell-text: #ffffff;
    --black-cell-bg: #a0a0a0;

    --accent: #60a5fa;
    --accent-light: #1e3a8a;
    --accent-hover: #3b82f6;

    --input-focus: #1e40af;
    --header-bg: #1f2937;
    --footer-bg: #111827;
    --border-light: #374151;
    --input-bg: #2f3640;

    --keyboard-bg: #374151;
    --key-bg: #4b5563;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    color: var(--primary);
    display: flex;
    flex-direction: column;
    height: 100vh;
    /* Altura fija para que funcione como app */
    overflow: hidden;
    /* Scroll controlado internamente */
    transition: background-color 0.3s, color 0.3s;
}

/* =========================================
   2. HEADER
   ========================================= */
.main-nav {
    background: var(--header-bg);
    border-bottom: 1px solid var(--border-light);
    padding: 0 15px;
    height: 50px;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    z-index: 100;
}

.nav-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Merriweather', serif;
    font-weight: 900;
    font-size: 1.2rem;
    color: var(--primary);
}

.logo span {
    color: #ef4444;
}

.timers-area {
    display: flex;
    gap: 15px;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9rem;
}

.timer-box {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: bold;
}

#countdown-timer {
    color: #ef4444;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.menu-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 15px;
}

.menu-links a {
    text-decoration: none;
    color: var(--primary);
    font-weight: 600;
    opacity: 0.7;
    font-size: 0.9rem;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--primary);
    opacity: 0.8;
}

/* =========================================
   3. ÁREA PRINCIPAL (Scrollable)
   ========================================= */
main {
    flex: 1;
    overflow-y: auto;
    /* El scroll ocurre aquí, no en todo el body */
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 240px;
    /* Espacio reservado para el teclado virtual */
}

/* Barra de Controles */
.game-controls-bar {
    background: var(--header-bg);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 8px 15px;
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    gap: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 800px;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.label {
    font-size: 0.75rem;
    font-weight: bold;
    opacity: 0.6;
}

.code-display {
    font-family: 'Roboto Mono';
    font-size: 1.1rem;
    color: var(--accent);
    cursor: pointer;
    letter-spacing: 1px;
}

/* Input Unirse */
.join-wrapper {
    display: flex;
    gap: 5px;
}

#input-join-code {
    width: 60px;
    padding: 4px;
    text-align: center;
    text-transform: uppercase;
    font-family: 'Roboto Mono';
    border: 1px solid var(--border-light);
    border-radius: 4px;
    background: var(--input-bg);
    color: var(--primary);
}

.icon-btn-small {
    background: var(--primary);
    color: var(--bg-color);
    border: none;
    border-radius: 4px;
    width: 70px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Botón Comprobar */
.check-dropdown {
    position: relative;
}

.action-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dropdown-content {
    position: absolute;
    top: 110%;
    right: 0;
    background: var(--header-bg);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    min-width: 130px;
    z-index: 100;
}

.dropdown-content.hidden {
    display: none;
}

.dropdown-content button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border-light);
    color: var(--primary);
    cursor: pointer;
}

/* =========================================
   4. GRID Y CELDAS
   ========================================= */
.date-display {
    font-family: 'Roboto Mono';
    font-size: 0.85rem;
    opacity: 0.5;
    margin-bottom: 10px;
}

.crossword-layout {
    display: flex;
    gap: 30px;
    justify-content: center;
    width: 100%;
    align-items: flex-start;
}

.grid-wrapper {
    background: var(--cell-bg);
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.crossword-grid {
    display: grid;
    grid-template-columns: repeat(var(--cols), var(--cell-size));

    gap: 1px;
    background-color: var(--grid-border);
    border: 2px solid var(--grid-border);
}

.cell {
    background-color: var(--cell-bg);
    width: var(--cell-size);
    height: var(--cell-size);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.cell.black {
    background-color: var(--black-cell-bg);
}

.cell input {
    width: 100%;
    height: 100%;
    border: none;
    text-align: center;
    font-size: calc(var(--cell-size) * 0.6);
    /* Fuente escala con la celda */
    font-weight: 700;
    text-transform: uppercase;
    background: transparent;
    color: var(--cell-text);
    outline: none;
    padding: 0;
    margin: 0;
    cursor: default;
    z-index: 5;
    caret-color: transparent;
    /* Ocultar cursor nativo */
}

.cell-number {
    position: absolute;
    top: 1px;
    left: 2px;
    font-size: calc(var(--cell-size) * 0.25);
    color: var(--primary);
    opacity: 0.7;
    pointer-events: none;
    z-index: 10;
}

/* Estados de selección */
.active-cell {
    background-color: var(--input-focus) !important;
}

.active-word {
    background-color: var(--accent-light) !important;
}

.cell input:focus {
    background-color: var(--input-focus);
}

/* Correcciones */
.correct-mark input {
    color: #16a34a;
    background-color: rgba(22, 163, 74, 0.1);
}

.wrong-mark input {
    color: #dc2626;
    background-color: rgba(220, 38, 38, 0.1);
}

/* =========================================
   5. PISTAS Y BARRA MÓVIL
   ========================================= */
/* Panel de escritorio */
.clues-panel {
    width: 350px;
    height: 550px;
    background: var(--cell-bg);
    border-radius: 8px;
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
}

.clues-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-light);
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary);
    opacity: 0.6;
    font-weight: bold;
}

.tab-btn.active {
    opacity: 1;
    color: var(--accent);
    border-bottom: 3px solid var(--accent);
}

.clues-content {
    flex: 1;
    overflow-y: auto;
}

.clue-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.clue-item {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    font-size: 0.9rem;
}

.clue-item.highlighted {
    background-color: var(--accent-light);
    border-left: 4px solid var(--accent);
}

.clue-number {
    font-weight: bold;
    color: var(--accent);
    margin-right: 8px;
}

/* Barra de Pista Actual (Móvil - Estilo El País) */
#current-clue-bar {
    display: none;
    /* Se activa en media query */
    width: 100%;
    background: var(--accent);
    color: white;
    padding: 12px 15px;
    border-radius: 6px;
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: 15px;
    min-height: 50px;
    align-items: center;
    justify-content: center;
}

/* =========================================
   6. TECLADO VIRTUAL
   ========================================= */
#virtual-keyboard {
    display: none;

}


/* =========================================
   7. FOOTER Y MODAL
   ========================================= */
.footer-mini {
    background: var(--footer-bg);
    padding: 10px;
    text-align: center;
    font-size: 0.8rem;
    color: #888;
    border-top: 1px solid var(--border-light);
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.footer-mini a {
    color: #666;
    text-decoration: none;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.connected {
    background: #2ecc71;
    box-shadow: 0 0 4px #2ecc71;
}

.status-dot.disconnected {
    background: #ef4444;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    background: var(--header-bg);
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    color: var(--primary);
}



/* =========================================
   8. OCULTAR BARRA DE SCROLL (Estética App)
   ========================================= */

/* Para Chrome, Safari y Opera */
main::-webkit-scrollbar {
    display: none;
}

/* Para Firefox, IE y Edge */
main {
    -ms-overflow-style: none;
    /* IE y Edge */
    scrollbar-width: none;
    /* Firefox */
}

/* =========================================
   9. SECCIÓN MÁS JUEGOS
   ========================================= */
.more-games-container {
    width: 100%;
    max-width: 800px;
    margin: 40px auto 20px;
    padding: 0 10px;
}

.section-title {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 10px;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
}

.game-card {
    display: flex;
    align-items: center;
    background-color: var(--cell-bg);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 15px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.game-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-color: var(--accent);
}

.game-icon {
    font-size: 2rem;
    margin-right: 15px;
}

.game-info h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--primary);
}

.game-info p {
    margin: 3px 0 0 0;
    font-size: 0.8rem;
    color: #777;
}

/* Añadir en styles/game.css */

.clue-completed {
    text-decoration: line-through;
    opacity: 0.5;
    color: #888;
    transition: opacity 0.3s;
}

/* styles/game.css */

body {
    overflow-y: auto;
    /* Permitir scroll vertical siempre */
    overflow-x: hidden;
    /* Evitar scroll horizontal indeseado */
}

/* Ajuste para el texto SEO que añadimos */
.seo-content {
    width: 100%;
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.5);
    /* Fondo semitransparente sutil */
    border-radius: 12px;
}

/* --- RESALTADO DEL CRUCIGRAMA --- */

/* Celda seleccionada (Input activo) */
.cell.active-cell {
    background-color: #bbdefb !important;
    /* Azul claro para la celda actual */
    outline: 2px solid #007bff;
    /* Borde azul fuerte */
    z-index: 10;
}

/* Palabra activa (Highlight) */
.cell.highlight {
    background-color: #b1daf8 !important;
    /* Azul muy clarito para toda la fila/columna */
}

/* Asegurar que el input sea transparente para ver el color del div de fondo */
.cell-input {
    background-color: transparent;
}

.cell-input:focus {
    background-color: transparent !important;
    /* Evitar que el foco nativo tape el highlight */
}

/* Pista activa en la lista lateral */
.clue-item.active {
    background-color: #e3f2fd;
    border-left: 4px solid #007bff;
    font-weight: bold;
    color: #007bff;
}

/* styles/game.css */

/* ... tus estilos anteriores ... */

/* Definición completada (tachada) */
.clue-done {
    text-decoration: line-through;
    color: #aaa;
    /* Color más apagado */
    opacity: 0.7;
}

/* Asegurar que la lista tenga posición relativa para el cálculo del scroll */
#active-clues-list {
    position: relative;
    /* Asegúrate de que tenga overflow-y: auto en tus estilos base */
}

/* styles/game.css */

/* ERROR: Rojo vibrante y animación de temblor */
.cell-input.error-cell {
    background-color: #ffcdd2 !important;
    /* Rojo claro */
    color: #c62828 !important;
    /* Rojo oscuro texto */
    animation: shake 0.3s;
    font-weight: bold;
}

/* ÉXITO: Verde momentáneo para confirmar que está bien */
.cell-input.success-cell {
    background-color: #c8e6c9 !important;
    /* Verde claro */
    color: #2e7d32 !important;
    /* Verde oscuro texto */
    transition: background-color 0.5s;
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    50% {
        transform: translateX(5px);
    }

    75% {
        transform: translateX(-5px);
    }

    100% {
        transform: translateX(0);
    }
}

/* --- BANNER DE COOKIES (RGPD/ADSENSE) --- */
.cookie-consent-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(150%);
    /* Oculto abajo */
    width: 90%;
    max-width: 600px;
    background-color: var(--bg-secondary, #ffffff);
    color: var(--text-main, #333);
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    border: 1px solid var(--border-light, #eee);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-family: 'Inter', sans-serif;
}

/* Modo Oscuro para el banner */
body.dark-mode .cookie-consent-banner {
    background-color: #1f2937;
    color: #f3f4f6;
    border-color: #374151;
}

.cookie-consent-banner.visible {
    transform: translateX(-50%) translateY(0);
    /* Visible */
}

.cookie-content h3 {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary, #333);
}

body.dark-mode .cookie-content h3 {
    color: #fff;
}

.cookie-content p {
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 20px;
    color: var(--text-muted, #666);
}

body.dark-mode .cookie-content p {
    color: #d1d5db;
}

.cookie-content a {
    color: var(--accent, #3b82f6);
    text-decoration: underline;
}

.cookie-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.cookie-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.cookie-btn.primary {
    background-color: var(--accent, #3b82f6);
    color: white;
}

.cookie-btn.primary:hover {
    background-color: #2563eb;
    transform: translateY(-1px);
}

.cookie-btn.outline {
    background-color: transparent;
    border: 1px solid var(--border-light, #ccc);
    color: var(--text-main, #333);
}

body.dark-mode .cookie-btn.outline {
    border-color: #4b5563;
    color: #e5e7eb;
}

.cookie-btn.outline:hover {
    background-color: var(--bg-main, #f3f4f6);
}

body.dark-mode .cookie-btn.outline:hover {
    background-color: #374151;
}


/* --- ESTILO MÓVIL FINAL (Ajuste Perfecto al Ancho) --- */
/* --- ESTILO MÓVIL: FLUJO VERTICAL (SCROLL NORMAL) --- */
@media (max-width: 768px) {

    /* 1. HABILITAR SCROLL GLOBAL */
    html,
    body {
        height: auto !important;
        /* Altura automática según contenido */
        min-height: 100%;
        width: 100%;
        margin: 0;
        padding: 0;
        overflow-y: auto !important;
        /* SCROLL SÍ */
        overflow-x: hidden;
        background-color: #f0f2f5;
    }

    main {
        display: flex;
        flex-direction: column;
        /* Apilar elementos verticalmente */
        height: auto !important;
        width: 100%;
        padding: 0;
        padding-bottom: 40px;
        /* Un poco de aire al final */
    }

    /* Ocultar paneles laterales de PC */
    .clues-panel,
    .main-nav .logo-text,
    .main-nav .logo-icon,
    .menu-links {
        display: none !important;
    }

    /* Cabecera */
    .main-nav,
    .game-controls-bar {
        /* Opcional: Si quieres que la cabecera se quede fija al hacer scroll, usa sticky */
        /* position: sticky; top: 0; */
        flex-shrink: 0;
        min-height: 40px;
        padding: 5px;
        background: white;
        z-index: 50;
    }

    /* 2. CONTENEDOR DEL GRID */
    .crossword-layout {
        display: block;
        width: 100%;
        height: auto;
        padding-top: 10px;
        padding-bottom: 10px;
        text-align: center;
    }

    .grid-wrapper {
        display: inline-block;
        width: 96vw;
        /* 96% del ancho */
        max-width: 96vw;
        margin: 0 auto;
    }

    #grid-container {
        display: grid;
        grid-template-columns: repeat(var(--cols, 13), 1fr);

        width: 100% !important;
        height: auto !important;
        aspect-ratio: 1 / 1;
        /* Mantiene el cuadrado perfecto */

        gap: 1px;
        background: #000;
        border: 2px solid #000;
        box-sizing: border-box;
    }

    /* Celdas */
    .cell {
        background: white;
        width: 100% !important;
        height: 100% !important;
        border: none !important;
        margin: 0 !important;
        position: relative;
        aspect-ratio: 1 / 1;
    }

    .cell.black {
        background: #000;
    }

    .cell-input {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border: none;
        background: transparent;
        text-align: center;
        padding: 0;
        margin: 0;
        color: black;
        font-weight: bold;
        font-size: clamp(10px, 4.5vw, 22px);
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
    }

    .cell-number {
        font-size: clamp(6px, 2.5vw, 9px);
        top: 0;
        left: 1px;
        z-index: 5;
    }

    /* 3. BARRA DE PISTAS (Debajo del grid, no fija) */
    #current-clue-bar {
        position: relative;
        /* Flujo normal */
        bottom: auto;
        left: auto;
        width: 96vw;
        /* Mismo ancho que el grid para que quede alineado */
        margin: 10px auto 0 auto;
        /* Centrado y separado del grid */

        min-height: 50px;
        background: #ea580c;
        color: white;
        z-index: 10;

        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0;
        border-radius: 4px;
        /* Un poco de borde redondeado queda bien aquí */
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    #mobile-clue-text {
        flex: 1;
        text-align: center;
        font-size: 0.95rem;
        padding: 5px;
        line-height: 1.2;
    }

    .clue-nav-btn {
        background: rgba(0, 0, 0, 0.1);
        border: none;
        color: white;
        font-size: 1.2rem;
        font-weight: bold;
        width: 45px;
        height: 50px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* 4. TECLADO (Debajo de la barra, no fijo) */
    #virtual-keyboard {
        position: relative;
        /* Flujo normal */
        bottom: auto;
        left: auto;

        width: 98vw;
        /* Casi todo el ancho */
        margin: 15px auto;
        /* Separación arriba y abajo */
        height: auto;
        /* Altura automática */

        background: transparent;
        /* Quitar fondo gris bloque si quieres que parezca más ligero */
        /* O déjalo en #d1d5db si prefieres el bloque */

        z-index: 10;
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .kb-row {
        display: flex;
        width: 100%;
        gap: 3px;
        justify-content: center;
        margin-bottom: 2px;
    }

    .kb-key {
        flex: 1;
        height: 48px;
        /* Teclas altas */
        background: white;
        border: 1px solid #ccc;
        border-radius: 5px;
        font-size: 1.2rem;
        font-weight: bold;
        color: #333;
        box-shadow: 0 2px 0 #bbb;
    }

    .kb-key:active {
        transform: translateY(2px);
        box-shadow: none;
    }

    .kb-key.action {
        flex: 1.4;
        background: #9ca3af;
        color: white;
        border: none;
    }

    /* 5. RESTO DEL CONTENIDO (Visible debajo) */
    .footer-mini,
    .more-games-container,
    .seo-content {
        display: block !important;
        width: 94vw;
        margin: 20px auto;
        padding: 10px;
    }
}

/* =========================================================
   EFECTO "MENÚ DE PAUSA" (GLASSMORPHISM) - VERSIÓN CORREGIDA
   ========================================================= */

/* 1. EL FONDO DEL BOSQUE */
/* 1. EL FONDO DEL BOSQUE (Dinámico) */
body {
    /* Esta variable cambiará automáticamente con JavaScript. Ponemos la 1 por si el JS falla */
    --bg-image: url('/img/fondo1.jpg');

    background: linear-gradient(rgba(15, 23, 42, 0.75), rgba(15, 23, 42, 0.85)),
        var(--bg-image);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;

    color: #f1f5f9;
    min-height: 100vh;
}

/* 2. FORZAR TEXTOS CLAROS EN TODA LA INTERFAZ */
/* Hacemos que todo lo que antes era negro ahora sea blanco tiza */
.logo,
.timer-box,
.menu-links a,
.label,
.code-display,
.section-title,
.game-info h4,
.game-info p,
.clue-item {
    color: #f1f5f9 !important;
}

.logo span {
    color: #3b82f6 !important;
    /* Azul en vez de rojo para el logo, pega más con el bosque */
}

/* 3. BARRA DE NAVEGACIÓN SUPERIOR Y FOOTER (Cristal oscuro) */
.main-nav,
.footer-mini {
    background: rgba(15, 23, 42, 0.5) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: none !important;
    color: #cbd5e1 !important;
}

.main-nav {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.footer-mini {
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.footer-mini a {
    color: #f1f5f9 !important;
}

.footer-mini a:hover {
    color: #3b82f6 !important;
}

/* 4. CONTENEDORES PRINCIPALES (Cristal translúcido) */
.game-controls-bar,
.crossword-layout,
.more-games-container,
.seo-content,
.game-card {
    background: rgba(255, 255, 255, 0.03) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.game-controls-bar {
    margin-bottom: 24px;
    padding: 15px;
}

/* Inputs y botones del panel de control */
#input-join-code {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.dropdown-content {
    background: rgba(15, 23, 42, 0.85) !important;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.dropdown-content button {
    color: #f1f5f9 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.dropdown-content button:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

/* 5. PANEL DE PISTAS (TEXTOS "HORIZONTALES / VERTICALES") */
.grid-wrapper,
.clues-panel {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Pestañas */
.tab-btn {
    color: #64748b !important;
    /* Gris apagado cuando no están activas */
}

.tab-btn.active {
    color: #ffffff !important;
    /* Blanco brillante cuando están activas */
    border-bottom-color: #3b82f6 !important;
}

/* Lista de pistas */
.clues-content {
    background: rgba(0, 0, 0, 0.3) !important;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.clue-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.clue-item.active,
.clue-item.highlighted {
    background: rgba(59, 130, 246, 0.25) !important;
    /* Azul transparente */
    border-left: 4px solid #3b82f6 !important;
}

.clue-number {
    color: #60a5fa !important;
    /* Número de la pista en azul clarito */
}

/* 6. TABLERO (CELDAS BLANCAS Y NEGRAS) */
.crossword-grid .cell {
    background: rgba(255, 255, 255, 0.95);
    /* Muy blanco para que se lea fácil */
    border: 1px solid #94a3b8;
}

.crossword-grid .cell-input {
    color: #0f172a !important;
    /* La letra que escribes es oscura */
}

.crossword-grid .cell-number {
    color: #475569 !important;
    /* El numerito de la celda oscuro */
}

/* Casillas negras como cristal ahumado */
.crossword-grid .cell.black {
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
}

/* 7. TECLADO VIRTUAL EN MÓVILES (Estilo cristal) */
.kb-key {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2) !important;
}

.kb-key:active {
    background: rgba(255, 255, 255, 0.25) !important;
    transform: translateY(2px);
    box-shadow: none !important;
}

.kb-key.action {
    background: rgba(59, 130, 246, 0.5) !important;
    /* Teclas especiales azuladas */
}

/* Colores SEO finales */
.seo-content p,
.seo-content h1,
.seo-content h2,
.seo-content li {
    color: #f1f5f9 !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* =========================================================
   CORRECCIONES: Z-INDEX Y MÁS JUEGOS
   ========================================================= */

/* Arreglo del Menú Comprobar (z-index) */
.game-controls-bar {
    position: relative;
    z-index: 9999 !important;
    /* Obligamos a toda la barra a flotar por encima del tablero */
}

.dropdown-content {
    z-index: 10000 !important;
}

/* Arreglo de los márgenes en la caja de Más Juegos */
.more-games-container {
    padding: 30px !important;
    /* Más aire por dentro */
}

.games-grid {
    gap: 20px !important;
    /* Más espacio entre tarjetas */
    margin-top: 20px !important;
}

.game-card {
    margin: 0 !important;
    /* Evita que empujen los bordes del cristal */
    background: rgba(255, 255, 255, 0.05) !important;
}

/* =========================================================
   MENÚS DESPLEGABLES (COMPROBAR Y REVELAR)
   ========================================================= */
.dropdown {
    position: relative;
    display: inline-block;
}

/* Caja de opciones flotante */
.dropdown-content {
    position: absolute;
    top: 115%;
    /* Aparece justo debajo del botón */
    left: 0;
    min-width: 170px;
    display: flex;
    flex-direction: column;

    /* Efecto Cristal Oscuro */
    background: rgba(15, 23, 42, 0.85) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;

    z-index: 10000 !important;
    /* Para que pase por encima del tablero siempre */
    overflow: hidden;
    /* Para que los bordes redondeados recorten los botones */
}

/* Ocultar menú */
.dropdown-content.hidden {
    display: none !important;
}

/* Botones dentro del menú */
.dropdown-content button {
    background: transparent !important;
    color: #f1f5f9 !important;
    padding: 12px 16px;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    text-align: left;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.dropdown-content button:last-child {
    border-bottom: none !important;
}

/* Hover general de los botones del menú */
.dropdown-content button:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    padding-left: 20px;
    /* Pequeño efecto de desplazamiento al pasar el ratón */
}

/* ⚠️ Hover especial para el botón peligroso ("Revelar Cuadrícula") */
#btn-reveal-all {
    color: #f87171 !important;
    /* Texto rojo clarito */
}

#btn-reveal-all:hover {
    background: rgba(239, 68, 68, 0.2) !important;
    /* Fondo rojizo translúcido */
    color: #fca5a5 !important;
}

/* =========================================================
   SCROLLBAR MODERNO (GLASSMORPHISM)
   ========================================================= */

/* 1. Para Firefox (Usa propiedades más nuevas y simples) */
* {
    scrollbar-width: thin;
    /* Hace la barra más fina */
    scrollbar-color: rgba(255, 255, 255, 0.3) rgba(15, 23, 42, 0.2);
    /* Color del pulgar y color del fondo */
}

/* 2. Para navegadores WebKit (Chrome, Edge, Safari, Opera) */
::-webkit-scrollbar {
    width: 10px;
    /* Ancho de la barra vertical */
    height: 10px;
    /* Alto de la barra horizontal (por si la hay en el móvil) */
}

/* El "carril" de la barra (fondo) */
::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.2) !important;
    /* Azul muy oscuro y casi transparente */
    border-radius: 10px;
}

/* El "pulgar" (la barrita que arrastras) */
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2) !important;
    /* Blanco cristalino */
    border-radius: 10px;
    /* Bordes totalmente redondeados */

    /* Este borde transparente hace de "margen" para que la barra no toque los bordes de la pantalla */
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* Cuando pasas el ratón por encima del scroll */
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4) !important;
    /* Brilla más al tocarlo */
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* =========================================================
   MODAL DE VICTORIA (GLASSMORPHISM PREMIUM)
   ========================================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7);
    /* Fondo azulado muy oscuro */
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.modal-content {
    background: rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 24px;
    padding: 40px;
    text-align: center;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    color: #f1f5f9;
}

.modal-content h2 {
    font-family: 'Merriweather', serif;
    font-size: 2.2rem;
    margin-bottom: 10px;
    color: #fff;
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

.stats-ranking {
    margin: 25px 0;
    padding: 20px;
    background: rgba(59, 130, 246, 0.15);
    border-radius: 16px;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.rank-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: #60a5fa;
    display: block;
}

.rank-percentile {
    font-size: 1.1rem;
    color: #94a3b8;
    font-weight: 600;
}

#btn-close-modal {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 10px;
}

#btn-close-modal:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.4);
}