body {
    font-family: 'Courier New', Courier, monospace;
    background-color: #0d0d0d;
    color: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    background-image: 
        linear-gradient(to right, rgba(0, 255, 255, 0.2) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 255, 255, 0.2) 1px, transparent 1px);
    background-size: 40px 40px;
    animation: background-pan 10s linear infinite;
}

@keyframes background-pan {
    from {
        background-position: 0 0;
    }
    to {
        background-position: -40px -40px;
    }
}

.container {
    background-color: #2a2a2a;
    width: 90%;
    max-width: 500px;
    padding: 20px 40px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    text-align: center;
    border: 2px solid #00ff00;
}

h1 {
    color: #00ff00;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.hidden {
    display: none;
}

/* --- Pantalla de Inicio --- */
#initials-input {
    font-family: 'Courier New', Courier, monospace;
    background-color: #333;
    color: #00ff00;
    border: 2px solid #00ff00;
    border-radius: 5px;
    padding: 10px;
    font-size: 1.2em;
    text-align: center;
    text-transform: uppercase;
    width: 100px;
    margin: 20px 0;
}

/* --- Selector de Dificultad --- */
.difficulty-selector {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
}

.difficulty-selector span {
    font-size: 1em;
    text-transform: uppercase;
    color: #ccc;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
    margin: 0 15px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #555;
    transition: .4s;
    border-radius: 34px;
    border: 2px solid #00ff00;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: #00ff00;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #333;
}

input:checked + .slider:before {
    transform: translateX(26px);
    background-color: #ff0000;
}

input:checked ~ span:last-of-type {
    color: #ff0000;
}

input:not(:checked) ~ span:first-of-type {
    color: #00ff00;
}


.mode-selector button {
    margin: 0 10px;
}


/* --- Pantalla de Juego --- */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2em;
    margin-bottom: 20px;
}

#back-to-start-btn {
    position: relative;
    width: 26px;
    height: 26px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

#back-to-start-btn::before { /* Techo */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-left: 13px solid transparent;
    border-right: 13px solid transparent;
    border-bottom: 13px solid #00ff00;
    transition: border-bottom-color 0.3s;
}

#back-to-start-btn::after { /* Cuerpo */
    content: '';
    position: absolute;
    bottom: 0;
    left: 4px;
    width: 18px;
    height: 13px;
    background-color: #0d0d0d;
    border: 2px solid #00ff00;
    border-top: none;
    transition: border-color 0.3s;
}

#back-to-start-btn:hover::before {
    border-bottom-color: #fff;
}

#back-to-start-btn:hover::after {
    border-color: #fff;
}

#lives {
    display: flex;
    align-items: center;
    /* Añadido para alinear el contenedor de vidas con los otros elementos */
    min-height: 34px; 
}

.heart {
    position: relative;
    width: 20px;
    height: 20px;
    margin: 0 5px;
    transform: rotate(45deg);
    background-color: #ff0000;
    box-shadow: 0 0 7px #ff0000, 0 0 10px #ff0000;
}

.heart::before,
.heart::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #ff0000;
    box-shadow: 0 0 7px #ff0000, 0 0 10px #ff0000;
}

.heart::before {
    top: -10px;
    left: 0;
}

.heart::after {
    top: 0;
    left: -10px;
}

.heart.lost {
    background-color: #444;
    box-shadow: none;
}

.heart.lost::before,
.heart.lost::after {
    background-color: #444;
    box-shadow: none;
}

#question {
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 20px;
    color: #ffff00;
}

#answer {
    font-family: 'Courier New', Courier, monospace;
    background-color: #333;
    color: #00ff00;
    border: 2px solid #00ff00;
    border-radius: 5px;
    padding: 10px;
    font-size: 1.2em;
    width: 120px;
    text-align: center;
}

#feedback {
    font-size: 1.2em;
    font-weight: bold;
    min-height: 30px;
    margin-top: 20px;
}

/* --- Pantalla de Fin de Juego --- */
#high-scores-table {
    width: 100%;
    margin: 20px 0;
    border-collapse: collapse;
}

#high-scores-table th, #high-scores-table td {
    border: 1px solid #00ff00;
    padding: 8px;
    text-align: center;
}

#high-scores-table th {
    background-color: #00ff00;
    color: #1a1a1a;
}

/* --- Elementos Comunes --- */
button {
    font-family: 'Courier New', Courier, monospace;
    padding: 10px 20px;
    font-size: 1em;
    color: #1a1a1a;
    background-color: #00ff00;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-left: 10px;
    text-transform: uppercase;
    transition: background-color 0.3s, color 0.3s;
}

button:hover {
    background-color: #333;
    color: #00ff00;
    border: 1px solid #00ff00;
}
