:root {
    --bg-color: #1a1a1a;
    --text-color: #00ff00;
    --cell-bg: #000;
    --cell-border: #444;
    --cell-hover: #00ff00;
    --cell-selected: #00ff00;
    --cell-found: #ffcc00;
    --cell-error: #ff0000;
}

body {
    max-width: 3840px;
    min-width: 320px;
    font-family: 'Press Start 2P', cursive;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    overflow: hidden;
    position: relative;
}

body::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        transparent,
        transparent 2px,
        rgba(0, 255, 0, 0.05) 3px
    );
    pointer-events: none;
}

.screen {
    text-align: center;
}

.hidden {
    display: none;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 0 #ff00ff;
}

button {
    font-size: 1rem;
    padding: 10px 20px;
    background-color: #333;
    color: #00ff00;
    border: 2px solid #00ff00;
    border-radius: 0;
    cursor: pointer;
    font-family: 'Press Start 2P', cursive;
    text-transform: uppercase;
    transition: background-color 0.3s, border-color 0.3s;
}
ul{
    list-style-type: none;
}

button:hover {
    background-color: #00ff00;
    color: #333;
    border-color: #ff00ff;
}

#game-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
    margin-top: 20px;
}

#left-panel, #right-panel {
    width: 100%;
}

#left-panel {
    min-width: 30%;
    align-self: center;
}

#right-panel {
    min-width: 30%;
    align-self: center;
    text-align: center;
}

#puzzle-canvas {
    font-family: 'Times New Roman', Times, serif;
    width: 480px;
    height: 480px;
    border: 4px solid #00ff00;
    background-color: var(--cell-bg);
    image-rendering: pixelated;
}

#word-list {
    font-size: 0.8rem;
    text-align: center;
}
#word-list h2 {
    font-size: 1rem;
    color: #00ff00;
    margin-bottom: 10px;
}

#words {
    list-style-type: none;
    padding: 0;
}

#words li {
    color: #ddd;
    margin: 5px 0;
}

#words li.found {
    text-decoration: line-through;
    color: #888;
}

#timer-bar {
    width: 60%;
    height: 2rem;
    margin: 10% 0;
    background-color: #0f04a7;
    border: 2px solid #00ff00;
}

#initials-input {
    margin-top: 20px;
}

#initials {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.5rem;
    padding: 5%;
    text-transform: uppercase;
}

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

.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Press Start 2P', cursive;
    margin: 15% auto;
    padding: 20px;
    border: 2px solid var(--text-color);
    border-radius: 10px;
    width: 80%;
    max-width: 500px;
    text-align: center;
}

.modal-content h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.modal-content p {
    font-size: 0.9rem;
    margin-bottom: 20px;
}

#close-instructions-button {
    font-size: 1rem;
    padding: 10px 20px;
    background-color: var(--bg-color);
    color: var(--text-color);
    border: 2px solid var(--text-color);
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Press Start 2P', cursive;
    transition: background-color 0.3s, color 0.3s;
}

#close-instructions-button:hover {
    background-color: var(--text-color);
    color: var(--bg-color);
    border-color: var(--text-color);
}

/* Estilos para pantallas pequeñas (móviles) */
@media (max-width: 768px) {
    h1 {
        font-size: 1.5rem;
    }

    button {
        font-size: 0.8rem;
        padding: 8px 16px;
    }

    #game-container {
        flex-direction: column;
        align-items: center;
    }

    #puzzle-canvas {
        width: 90vmin;
        height: 90vmin;
    }

    #left-panel, #right-panel {
        width: 100%;
        text-align: center;
    }

    #timer, #points {
        font-size: 0.9rem;
    }

    #word-list {
        font-size: 0.8rem;
    }
}

/* Estilos para pantallas muy pequeñas (ej. móviles en orientación vertical) */
@media (max-width: 480px) {
    h1 {
        font-size: 1.2rem;
    }

    button {
        font-size: 0.7rem;
        padding: 6px 12px;
    }

    #puzzle-canvas {
        width: 95vmin;
        height: 95vmin;
    }

    #timer, #points {
        font-size: 0.8rem;
    }

    #word-list {
        font-size: 0.7rem;
    }
}