/*
 * Estilos básicos para la Cyber‑Arena.
 * Se ha elegido una paleta de colores neón y un fondo oscuro
 * para dar un aspecto cyberpunk. Ajusta los colores según tu gusto.
 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #0d0d0d;
    color: #e0e0e0;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    /* Prevent horizontal scroll */
    overflow-y: auto;
    /* Allow vertical scroll */
}

/* Permitir desplazamiento vertical en la página de resultados */
body.result-page {
    overflow-y: auto;
}

/* Ajustar ancho de contenedor en la página de resultados */
.result-page .container {
    max-width: 1000px;
}

/* Botón de reinicio al final de resultados */
.restart-button {
    text-align: center;
    margin-top: 2rem;
}

.btn-restart {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background: linear-gradient(45deg, #00ffff, #00b3ff);
    color: #0d0d0d;
    border: 2px solid #00ffff;
    border-radius: 10px;
    font-weight: bold;
    font-size: 1rem;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px #00ffff, inset 0 0 10px #00ffff;
}

.btn-restart:hover {
    background: linear-gradient(45deg, #00b3ff, #00ffff);
    box-shadow: 0 0 15px #00ffff, inset 0 0 15px #00ffff;
}

/* Fondo con imagen o video. Ajusta la opacidad en la regla ::before */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('background.png') no-repeat center center fixed;
    background-size: cover;
    opacity: 0.3;
    z-index: -1;
}

/* Página de registro con fondo de circuito neon */
body.register-page::before {
    background: url('register-bg.png') no-repeat center center fixed;
    background-size: cover;
    opacity: 0.4;
}

/* Tarjeta de registro con estilo futurista */
.register-card {
    background-color: rgba(10, 10, 20, 0.85);
    /* Un poco más opaco para mejor lectura */
    border: 2px solid #00ffff;
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 700px;
    /* Ancho máximo optimizado */
    margin: 2rem auto;
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.5), 0 0 40px rgba(255, 0, 255, 0.3) inset;
    backdrop-filter: blur(5px);
    /* Efecto de desenfoque en el fondo */
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

/* Colores de texto para la tarjeta de registro */
.register-card h1 {
    color: #00ffff;
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 2.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.7);
}

.register-card p,
.register-card label {
    color: #e0e0e0;
}

.register-card label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: block;
}

/* Inputs de la tarjeta de registro */
.register-card input[type="text"],
.register-card input[type="number"],
.register-card select {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(0, 0, 0, 0.6);
    color: #00ffff;
    border: 1px solid #00ffff;
    border-radius: 10px;
    margin-bottom: 1.2rem;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.register-card input[type="text"]::placeholder,
.register-card input[type="number"]::placeholder {
    color: rgba(0, 255, 255, 0.5);
}

.register-card input[type="text"]:focus,
.register-card input[type="number"]:focus,
.register-card select:focus {
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
    border-color: #fff;
    background: rgba(0, 0, 0, 0.8);
}

/* Radio buttons personalizados */
.register-card input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #00ffff;
    border-radius: 50%;
    margin-right: 10px;
    position: relative;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
}

.register-card input[type="radio"]:checked {
    background-color: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 10px #00ffff;
}

.register-card input[type="radio"]:checked::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #00ffff;
}

.register-card label input[type="radio"] {
    vertical-align: middle;
    margin-bottom: 0;
    /* Reset margin */
}

/* Botón del formulario en estilo neon */
.register-card button {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(90deg, #00ffff, #00b3ff);
    color: #000;
    border: none;
    border-radius: 12px;
    font-weight: 800;
    font-size: 1.2rem;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.4);
    margin-top: 1rem;
}

.register-card button:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.6);
    background: linear-gradient(90deg, #00b3ff, #00ffff);
}

/* Estilos para la selección de modo con avatares */
.user-types {
    display: flex;
    justify-content: center;
    gap: 3rem;
    /* Mayor separación para elegancia */
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

.mode {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Centrado vertical y horizontal */
    cursor: pointer;
    padding: 1.5rem;
    border-radius: 20px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Efecto rebote suave */
    border: 2px solid rgba(0, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    flex: 0 1 200px;
    /* Ancho base fijo pero flexible */
    min-width: 160px;
    position: relative;
    overflow: hidden;
}

.mode:hover {
    background: rgba(0, 255, 255, 0.1);
    transform: translateY(-8px);
    border-color: #00ffff;
    box-shadow: 0 10px 20px rgba(0, 255, 255, 0.2);
}

/* Estilo para el modo seleccionado */
.mode:has(input:checked) {
    background: linear-gradient(145deg, rgba(0, 255, 255, 0.2), rgba(0, 100, 255, 0.1));
    border-color: #00ffff;
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.3), inset 0 0 10px rgba(0, 255, 255, 0.1);
}

/* Ocultar el radio button nativo pero mantenerlo accesible */
.mode input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Indicador visual de selección (opcional, o usar el borde del contenedor) */
.mode::after {
    content: '';
    width: 12px;
    height: 12px;
    background-color: #00ffff;
    border-radius: 50%;
    margin-top: 10px;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: scale(0);
    box-shadow: 0 0 10px #00ffff;
}

.mode:has(input:checked)::after {
    opacity: 1;
    transform: scale(1);
}

.avatar {
    width: 110px;
    height: 110px;
    object-fit: cover;
    border: 4px solid rgba(0, 255, 255, 0.5);
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
    margin-bottom: 1rem;
    transition: all 0.4s ease;
    background-color: #000;
    /* Fondo por si la imagen es transparente */
}

.mode:hover .avatar {
    transform: scale(1.1);
    border-color: #00ffff;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.6);
}

.mode span {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    margin-top: 0.5rem;
}

/* Distribución de los campos del formulario en filas */
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
}

/* Cada campo ocupa el espacio disponible */
.form-row .field {
    flex: 1 1 250px;
    /* Base de 250px, crece para llenar */
    min-width: 0;
    /* Evita desbordamientos en flex items */
}

/* Separación inferior entre campos */
.field {
    margin-bottom: 1rem;
}

/* Subtítulo en la tarjeta de registro */
.subtitle {
    color: #aaa;
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.1rem;
    line-height: 1.5;
}

/* Enlace para volver al sitio principal */
.back-link {
    color: #00ffff;
    margin-top: 1.5rem;
    display: inline-block;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.3s ease;
    opacity: 0.8;
}

.back-link:hover {
    text-decoration: none;
    color: #fff;
    opacity: 1;
    text-shadow: 0 0 8px #00ffff;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .register-card {
        padding: 2rem;
        width: 95%;
    }

    .register-card h1 {
        font-size: 2rem;
    }

    .user-types {
        gap: 1rem;
    }

    .avatar {
        width: 80px;
        height: 80px;
    }
}

@media (max-width: 480px) {
    body {
        align-items: flex-start;
        /* Start from top to allow scrolling */
        padding: 2rem 0;
        /* Add vertical padding */
        height: auto;
        /* Ensure height can grow */
    }

    .register-card {
        padding: 1.5rem;
        margin: 0 auto;
        border-width: 1px;
        width: 90%;
        /* Ensure some margin on sides */
    }

    .register-card h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }

    /* Stack user types vertically on very small screens if needed, 
       but keeping row with wrap is usually fine. Let's ensure they fit. */
    .user-types {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .mode {
        min-width: 110px;
        /* Slightly smaller min-width */
        padding: 0.5rem;
    }

    .avatar {
        width: 60px;
        height: 60px;
    }

    .form-row {
        gap: 1rem;
    }

    .form-row .field {
        flex: 1 1 100%;
        /* Full width fields */
    }

    .register-card button {
        font-size: 1.1rem;
        padding: 0.9rem;
        margin-bottom: 1rem;
        /* Ensure space at bottom */
    }
}


.container {
    background-color: rgba(26, 26, 26, 0.85);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
    width: 90%;
    max-width: 600px;
    z-index: 1;
    position: relative;
    /* Ensure z-index works if not flex item, though it is */
}

@media (max-width: 480px) {
    .container {
        padding: 1.5rem;
        width: 95%;
    }
}

h1 {
    color: #00ffff;
    text-align: center;
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

input[type="text"] {
    width: 100%;
    padding: 0.5rem;
    border: none;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 1rem;
}

button {
    display: block;
    width: 100%;
    padding: 0.7rem;
    background-color: #00ffff;
    color: #0d0d0d;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #00b3b3;
}

.question {
    margin-bottom: 1rem;
}

.options label {
    display: block;
    margin-bottom: 0.5rem;
    cursor: pointer;
}

.scoreboard {
    margin-top: 2rem;
}

.hearts {
    margin-bottom: 1rem;
    color: #ff4d4d;
}

.timer {
    color: #00ffff;
    font-weight: bold;
}

.leaderboard {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.leaderboard th,
.leaderboard td {
    border: 1px solid #00ffff;
    padding: 0.5rem;
    text-align: left;
}

.leaderboard th {
    background-color: #002626;
    color: #00ffff;
}

.leaderboard tr:nth-child(even) {
    background-color: #0f3333;
}

/* Animación de sacudida cuando se pierde una vida */
.shake {
    animation: shake 0.5s;
}

@keyframes shake {
    0% {
        transform: translate(2px, 0);
    }

    20% {
        transform: translate(-2px, 0);
    }

    40% {
        transform: translate(2px, 0);
    }

    60% {
        transform: translate(-2px, 0);
    }

    80% {
        transform: translate(2px, 0);
    }

    100% {
        transform: translate(0, 0);
    }
}

/* Color rojo tenue cuando la respuesta es incorrecta */
.wrong {
    background-color: rgba(255, 0, 0, 0.2) !important;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.5);
}

/* Estilos para mostrar rankings en columnas */
.rankings {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
}

.ranking {
    flex: 1 1 45%;
}

/* Lista de explicaciones de preguntas incorrectas */
.explicaciones {
    margin-top: 1rem;
    padding-left: 1rem;
}

.explicaciones li {
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

/* Distribución en columnas de ranking y explicaciones en la página de resultados */
.result-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: space-between;
}

.ranking-section {
    flex: 1 1 55%;
}

.explanation-section {
    flex: 1 1 40%;
    max-width: 100%;
}

/* Sección de campeones (Top 3) */
.champions {
    display: flex;
    justify-content: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.champion-item {
    display: flex;
    align-items: center;
    background-color: rgba(0, 51, 51, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
}

.champion-item .medal {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 0.5rem;
    position: relative;
}

.medal.gold {
    background: radial-gradient(circle, #ffd700 0%, #b8860b 100%);
}

.medal.silver {
    background: radial-gradient(circle, #c0c0c0 0%, #808080 100%);
}

.medal.bronze {
    background: radial-gradient(circle, #cd7f32 0%, #8b4513 100%);
}

.champion-item .medal::after {
    content: '\2605';
    /* estrella */
    color: #000;
    font-size: 14px;
    line-height: 24px;
    text-align: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.champion-info {
    display: flex;
    flex-direction: column;
    color: #e0e0e0;
    font-size: 0.85rem;
}

/* Contenedor deslizante para las explicaciones de respuestas incorrectas */
.explicaciones-scroll {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Personalización de la barra de desplazamiento para navegadores WebKit (Chrome, Edge) */
.explicaciones-scroll::-webkit-scrollbar {
    width: 6px;
}

.explicaciones-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.explicaciones-scroll::-webkit-scrollbar-thumb {
    background: #00ffff;
    border-radius: 3px;
}

.explicaciones-scroll::-webkit-scrollbar-thumb:hover {
    background: #00b3b3;
}

/* Ajuste para pantallas pequeñas: mostrar las columnas apiladas */
@media (max-width: 768px) {
    .result-columns {
        flex-direction: column;
    }

    .ranking-section,
    .explanation-section {
        flex: 1 1 100%;
    }
}