* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

body {
    background: url("../img/fondo_mate.png") no-repeat center center fixed !important;
    background-size: cover;
    color: #f5f5f5;

    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    min-height: 100vh;

    padding-top: 40px;
    gap: 20px;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65); /* oscurece un poco la imagen */
    z-index: -1;
}

.game-container {
    width: 100%;
    max-width: 600px;
    padding: 1.5rem;
    background: #1e1e1e;
    border-radius: 1.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

h1 {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

/* Contenedor de la fila Tiempo / Puntos / Nivel */
.top-info {
    display: flex;
    flex-direction: column; /* Cada cosa en una línea */
    align-items: flex-start; /* Todo alineado a la izquierda */
    gap: 0.5rem;
    width: 100%;
}

/* Contenedor del selector de nivel + descripción */
.level-wrapper {
    display: flex;
    flex-direction: column; /* 🔹 uno debajo de otro */
    align-items: flex-start; /* 🔹 alineado a la izquierda */
    gap: 0.25rem;
}

/* Descripción del nivel */
.level-description {
    font-size: 0.9rem;
    max-width: 220px; /* 🔹 para que no se desborde hacia fuera */
    line-height: 1.2;
    color: #ffd700; /* el amarillo que usabas */
}

.question-box {
    text-align: center;
    padding: 1.2rem;
    border-radius: 1rem;
    background: #272727;
    margin-bottom: 1.2rem;
    font-size: 1.8rem;
    font-weight: bold;
}

.answers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
    margin-bottom: 1rem;
}

button.answer {
    padding: 0.9rem;
    border-radius: 0.8rem;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    background: #333;
    color: #f5f5f5;
    cursor: pointer;
    transition:
        transform 0.1s ease,
        background 0.1s ease;
}

button.answer:active {
    transform: scale(0.97);
}

button.answer.correct {
    background: #2e7d32;
}

button.answer.wrong {
    background: #c62828;
}

.controls {
    text-align: center;
}

.btn-main {
    padding: 0.8rem 1.2rem;
    border-radius: 999px;
    border: none;
    background: #1976d2;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

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

.message {
    text-align: center;
    margin-top: 0.6rem;
    font-size: 0.95rem;
    min-height: 1.2rem;
}

/* --- FORZAR el ranking debajo y centrado --- */
.ranking-container {
    width: 100%;
    max-width: 320px; /* MÁS PEQUEÑO */
    margin: 25px auto; /* CENTRADO */
    padding: 15px;
    background: rgba(0, 0, 0, 0.25); /* semitransparente */
    border-radius: 12px;
    text-align: center;
}

/* Título más pequeño */
.ranking-container h2 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: #ffd700;
}

/* Quitar los puntos de las listas del ranking */
.ranking-container ul {
    list-style: none; /* quita los bullets */
    margin: 0;
    padding-left: 0; /* quita sangrado izquierdo */
}

/* (Opcional) un poco de espacio entre filas */
.ranking-container li {
    margin-bottom: 4px;
}

/* Lista centrada */
#rankingList {
    list-style: none;
    padding: 0;
    margin: 0 auto;
    width: 100%;
}

/* Cada entrada más pequeña */
#rankingList li {
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.15);
    margin: 6px 0;
    padding: 8px 10px;
    border-radius: 8px;
    text-align: left;
}

/* Hover bonito */
#rankingList li:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Estilos para los niveles de dificultad */
/* Contenedor de la fila Tiempo / Puntos / Nivel */
.top-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

/* Contenedor del selector de nivel + descripción */
.level-wrapper {
    display: flex;
    flex-direction: column; /* 🔹 uno debajo de otro */
    align-items: flex-start; /* 🔹 alineado a la izquierda */
    gap: 0.25rem;
}

/* Descripción del nivel */
.level-description {
    font-size: 0.9rem;
    max-width: 220px; /* 🔹 para que no se desborde hacia fuera */
    line-height: 1.2;
    color: #ffd700; /* el amarillo que usabas */
}

/* Centramos el enlace usando flex o block */
.back-link {
    display: block; /* Con esto ya lo centra */
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    color: #f5f5f5;
}

.back-link:hover {
    background: #666;
    transform: translateY(-2px);
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.4);
}

.footer {
    margin-top: 30px;
    padding: 10px 0;
    text-align: center;
    color: #aaa;
    font-size: 0.85rem;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

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

.footer:hover {
    opacity: 1;
}
