/* ========================================
   Trivia Mobile First - Premium Metallic Edition
   MEJORADO UX/UI
   ======================================== */

:root {
    /* Paleta Metálica y Neón */
    --bg-page: #0f1115;
    --card-bg-top: #2a2d35;
    --card-bg-bottom: #16181d;
    
    /* Colores de acento (Iluminación/Neón) */
    --primary: #38bdf8;       /* Azul brillante tipo LED */
    --primary-dark: #0284c7;
    --secondary: #34d399;     /* Verde esmeralda brillante */
    --danger: #f87171;        /* Rojo alerta */
    --danger-dark: #dc2626;
    --warning: #fbbf24;       /* Dorado Metálico */
    
    /* Textos sobre fondos oscuros */
    --text-dark: #f1f5f9;     /* Blanco titanio */
    --text-gray: #94a3b8;     /* Gris plata oscuro */
    --text-light: #64748b;
    
    /* Efectos de relieve y bisel */
    --border-light: rgba(255, 255, 255, 0.1);
    --highlight-top: rgba(255, 255, 255, 0.15); /* Reflejo especular superior */
    --shadow-dark: rgba(0, 0, 0, 0.6);
    
    --shadow-sm: 0 2px 5px var(--shadow-dark);
    --shadow-md: 0 15px 35px var(--shadow-dark), 0 5px 15px rgba(0,0,0,0.4);
    
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    /* Fondo radial para dar profundidad como si hubiera un foco de luz detrás */
    background: radial-gradient(circle at top center, #1e2128 0%, #050505 100%);
    color: var(--text-dark);
    padding: 20px 12px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-weight: 400; /* Corregido de 100px a 400 */
}

/* ========== BOTÓN VOLVER AL PORTFOLIO (NUEVO ESTILO) ========== */
.btn-back-portfolio {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(180deg, #2b2e38 0%, #1f2229 100%);
    border: 1px solid #000;
    border-top: 1px solid rgba(255,255,255,0.1);
    border-radius: 40px;
    padding: 10px 20px;
    font-weight: 600;
    color: var(--text-gray);
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 16px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
    align-self: flex-start;
}
.btn-back-portfolio:hover {
    background: linear-gradient(180deg, #353945 0%, #262933 100%);
    color: var(--text-dark);
    border-top-color: rgba(255,255,255,0.2);
    transform: translateY(-1px);
}
.btn-back-portfolio:active {
    transform: scale(0.96);
    background: #14161a;
    box-shadow: inset 0 3px 8px rgba(0,0,0,0.8);
}
.btn-back-portfolio svg {
    width: 18px;
    height: 18px;
}

/* Contenedor principal */
.trivia-container {
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card {
    background: linear-gradient(145deg, var(--card-bg-top) 0%, var(--card-bg-bottom) 100%);
    border: 1px solid rgba(0,0,0,0.8);
    box-shadow: inset 0 1px 1px var(--highlight-top), var(--shadow-md);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
}

h1 {  
    letter-spacing: 2px;
    font-size: 2.5rem;
    text-align: center;    
    background: linear-gradient(to bottom, #ffffff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

/* ========== TRANSICIONES ENTRE VISTAS (NUEVO) ========== */
.view {
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.view-hidden {
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    position: absolute;
    width: 100%;
    left: 0;
}

/* ========== SELECTOR DE MODOS ========== */
.mode-selector { text-align: center; }

.mode-selector h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.mode-selector p {
    color: var(--text-gray);
    font-size: 0.95rem;
    margin-bottom: 24px;
}

.mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mode-btn {
    background: linear-gradient(180deg, #3a3f4c 0%, #242730 100%);
    border: 1px solid #000;
    border-top: 1px solid #5a6072; 
    padding: 18px;
    border-radius: 999px;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-dark);
    text-shadow: 0 1px 2px #000;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1);
}

.mode-btn:hover {
    background: linear-gradient(180deg, #444a59 0%, #2d313d 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.15);
}

.mode-btn:active {
    transform: scale(0.97);
    background: #1e2128;
    box-shadow: inset 0 4px 8px rgba(0,0,0,0.8);
    border-top: 1px solid #000;
}

.mode-btn[data-mode="facil"]:hover { box-shadow: 0 0 15px rgba(52, 211, 153, 0.3), inset 0 1px 0 rgba(255,255,255,0.1); color: var(--secondary); border-color: var(--secondary); }
.mode-btn[data-mode="normal"]:hover { box-shadow: 0 0 15px rgba(56, 189, 248, 0.3), inset 0 1px 0 rgba(255,255,255,0.1); color: var(--primary); border-color: var(--primary); }
.mode-btn[data-mode="maradona"]:hover { 
    background: linear-gradient(180deg, #b4850d 0%, #785805 100%);
    border-top: 1px solid #ffd700;
    color: white;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.4); 
}

.mode-description {
    margin-top: 24px;
    font-size: 0.85rem;
    color: var(--text-gray);
    background: #0a0b0e;
    border-radius: var(--radius-sm);
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.8), 0 1px 0 rgba(255,255,255,0.05);
    padding: 14px;
    font-weight: 600;
    border: 1px solid #000;
}

/* ========== ÁREA DE JUEGO ========== */
.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #000;
    box-shadow: 0 1px 0 rgba(255,255,255,0.05);
}

.progress-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-gray);
    letter-spacing: 1px;
}

.timer-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Temporizador LED mejorado */
.timer {
    font-size: 1.2rem;
    font-weight: 800;
    font-family: 'Courier New', Courier, monospace;
    background: #050608;
    color: var(--primary);
    text-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid #000;
    box-shadow: inset 0 2px 6px rgba(0,0,0,1), 0 1px 0 rgba(255,255,255,0.1);
    transition: color 0.3s, text-shadow 0.3s, box-shadow 0.3s;
}

.timer.danger {
    color: var(--danger);
    text-shadow: 0 0 8px rgba(248, 113, 113, 0.8);
    animation: gentlePulse 1.2s infinite alternate;
}

@keyframes gentlePulse {
    0% { text-shadow: 0 0 5px #f87171, 0 0 2px #dc2626; }
    100% { text-shadow: 0 0 15px #f87171, 0 0 8px #dc2626; }
}

.question-text {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 28px;
    text-align: center;
    color: var(--text-dark);
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* Opciones en grid */
.options-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-btn {
    background: linear-gradient(180deg, #2b2e38 0%, #1f2229 100%);
    border: 1px solid #000;
    border-top: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    font-size: 1.05rem;
    font-weight: 600;
    text-align: center;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.option-btn:hover {
    background: linear-gradient(180deg, #353945 0%, #262933 100%);
    border-color: var(--text-gray);
}

.option-btn:active {
    background: #14161a;
    box-shadow: inset 0 3px 8px rgba(0,0,0,0.8);
    border-top: 1px solid #000;
    color: var(--primary);
    transform: scale(0.98);
}

/* NUEVO: Estado seleccionado (feedback inmediato) */
.option-btn.selected {
    background: linear-gradient(180deg, #0ea5e9 0%, #0284c7 100%);
    border-top-color: #7dd3fc;
    color: white;
    box-shadow: 0 0 15px rgba(56,189,248,0.4), inset 0 1px 4px rgba(255,255,255,0.3);
    transform: scale(0.99);
}

/* Contenedor de los puntos (Panel incrustado) */
.answer-tracker {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    margin: 1.5rem 0;
    padding: 12px;
    background: #08090b;
    border-radius: 50px;
    box-shadow: inset 0 3px 6px rgba(0,0,0,0.8), 0 1px 0 rgba(255,255,255,0.05);
    border: 1px solid #000;
}

/* MEJORA: Tracker con números y transición suave */
.tracker-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #1e2128 0%, #121418 100%);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.8), 0 1px 0 rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7);
    font-size: 0.8rem;
    font-weight: bold;
    transition: background 0.3s, box-shadow 0.3s, transform 0.2s;
    border: 1px solid #000;
}

.tracker-dot svg {
    width: 14px;
    height: 14px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}

.tracker-dot.active {
    background: linear-gradient(180deg, #0ea5e9 0%, #0284c7 100%);
    border-color: #38bdf8;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.6), inset 0 2px 4px rgba(255,255,255,0.3);
}

.tracker-dot.correct {
    background: linear-gradient(180deg, #10b981 0%, #047857 100%);
    border-color: #34d399;
    color: white;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5), inset 0 2px 4px rgba(255,255,255,0.3);
}

.tracker-dot.wrong {
    background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%);
    border-color: #f87171;
    color: white;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5), inset 0 2px 4px rgba(255,255,255,0.3);
}

/* ========== BOTONES GENERALES ========== */
.btn {
    border: 1px solid #000;
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    margin-top: 12px;
    transition: all 0.2s;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(180deg, #0ea5e9 0%, #0284c7 100%);
    border-top: 1px solid #7dd3fc;
    color: white;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.4);
}
.btn-primary:active {
    background: #0369a1;
    box-shadow: inset 0 3px 8px rgba(0,0,0,0.6);
    border-top-color: #000;
}
.btn-primary:disabled {
    opacity: 0.6;
    pointer-events: none;
}

.btn-success {
    background: linear-gradient(180deg, #10b981 0%, #059669 100%);
    border-top: 1px solid #6ee7b7;
    color: white;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.4);
}

.btn-secondary {
    background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
    border-top: 1px solid #64748b;
    color: white;
}

.btn-danger {
    background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
    border-top: 1px solid #fca5a5;
    color: white;
    width: auto;
    padding: 10px 18px;
    font-size: 0.9rem;
}

/* ========== RESULTADOS & FORMULARIO ========== */
.results-area h2 {
    font-size: 1.8rem;
    margin-bottom: 12px;
    color: var(--text-dark);
}

.score-display {
    font-size: 4rem;
    font-family: 'Ranchers', sans-serif;
    background: linear-gradient(to bottom, #7dd3fc 0%, #0284c7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 16px 0;
    display: block;
    filter: drop-shadow(0 4px 10px rgba(2, 132, 199, 0.4));
    text-align: center;
}

.stats-text {
    color: var(--text-gray);
    font-size: 1rem;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-container {
    margin-top: 32px;
    text-align: left;
    background: #14161a;
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.6), 0 1px 0 rgba(255,255,255,0.05);
    border: 1px solid #000;
}

.form-container h4 {
    margin-bottom: 16px;
    font-size: 1.15rem;
    color: var(--text-dark);
}

/* Inputs Metálicos (Placa grabada) */
.form-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #000;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    margin-bottom: 12px;
    background: #0b0c0f;
    color: var(--primary);
    box-shadow: inset 0 2px 4px rgba(0,0,0,1), 0 1px 0 rgba(255,255,255,0.05);
    transition: all 0.3s;
}
.form-input::placeholder {
    color: #475569;
}
.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: inset 0 2px 4px rgba(0,0,0,1), 0 0 0 2px rgba(56, 189, 248, 0.2);
}
.form-input.error {
    border-color: var(--danger);
    box-shadow: inset 0 2px 4px #000, 0 0 0 2px rgba(248,113,113,0.2);
}

.error-text {
    color: var(--danger);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ========== LEADERBOARD ========== */
.leaderboard-column h3 {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 20px;
    text-align: center;
    color: var(--text-dark);
    padding-bottom: 16px;
    border-bottom: 1px solid #000;
    box-shadow: 0 1px 0 rgba(255,255,255,0.05);
}

.leaderboard-list {
    list-style: none;
    counter-reset: rank;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid #000;
    box-shadow: 0 1px 0 rgba(255,255,255,0.02);
    position: relative;
    padding-left: 36px;
    background: linear-gradient(90deg, rgba(255,255,255,0.02) 0%, transparent 100%);
    margin-bottom: 4px;
    border-radius: 12px;
}

.leaderboard-item::before {
    counter-increment: rank;
    content: counter(rank);
    position: absolute;
    left: 0;
    font-weight: 800;
    color: var(--text-light);
    font-size: 1.1rem;
    background: #1e2128;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid #000;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}

.leaderboard-item:nth-child(1)::before { content: "🥇"; background: none; border: none; box-shadow: none; font-size: 1.5rem; left: -4px; }
.leaderboard-item:nth-child(2)::before { content: "🥈"; background: none; border: none; box-shadow: none; font-size: 1.5rem; left: -4px; }
.leaderboard-item:nth-child(3)::before { content: "🥉"; background: none; border: none; box-shadow: none; font-size: 1.5rem; left: -4px; }

.leaderboard-item strong {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-dark);
}

/* Placa de puntuación mejorada (dorada) */
.points {
    background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
    padding: 6px 14px;
    border-radius: 12px;
    font-weight: 800;
    color: #0f1115;
    font-size: 0.85rem;
    border-top: 1px solid #fde68a;
    border-bottom: 1px solid #000;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* ========== ACCESIBILIDAD - FOCO VISIBLE (NUEVO) ========== */
button:focus-visible,
a:focus-visible,
.option-btn:focus-visible,
.mode-btn:focus-visible,
.btn:focus-visible,
.form-input:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    box-shadow: 0 0 0 3px rgba(56,189,248,0.3);
}

/* ========== SPINNER DE CARGA (OPCIONAL) ========== */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(56,189,248,0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    box-shadow: 0 0 15px var(--primary);
    margin: 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
