/* ============================================
   VARIABLES Y RESET
   ============================================ */
:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --radius: 0.75rem;
    --radius-sm: 0.5rem;
    --radius-lg: 1rem;
}

/* DARK MODE */
[data-theme="dark"] {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    
    --bg-primary: #1e293b;
    --bg-secondary: #0f172a;
    --bg-tertiary: #334155;
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --border: #334155;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.4), 0 1px 2px -1px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
}

html {
    transition: background-color 0.3s ease, color 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

.oculto {
    display: none !important;
}

/* ============================================
   SISTEMA DE PANTALLAS
   ============================================ */
.screen {
    display: none;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   DASHBOARD
   ============================================ */
.dashboard-header {
    position: relative;
    text-align: center;
    padding: 2rem 1rem 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    margin-bottom: 2rem;
}

.header-content {
    position: relative;
    z-index: 1;
}

.dashboard-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
}

.theme-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(20deg);
}

.theme-icon {
    font-size: 1.5rem;
}

/* ESTADÍSTICAS */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    padding: 0 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
}

.stat-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* MENÚ PRINCIPAL */
.menu-principal {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    padding: 0 1rem 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.menu-card {
    background: var(--bg-primary);
    border: none;
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow);
}

.menu-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.menu-card:active {
    transform: translateY(-2px);
}

.menu-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.menu-card h3 {
    color: var(--text-primary);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.menu-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ============================================
   PANTALLAS SECUNDARIAS
   ============================================ */
.screen-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.screen-header h2 {
    flex: 1;
    font-size: 1.5rem;
}

.btn-back {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.btn-back:hover {
    background: var(--bg-tertiary);
}

/* ============================================
   CONFIGURACIÓN MODO ESTUDIO
   ============================================ */
.config-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.config-section {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.config-section h3 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.temas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.tema-checkbox {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.tema-checkbox:hover {
    border-color: var(--primary);
    background: var(--bg-tertiary);
}

.tema-checkbox.selected {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.tema-checkbox input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

.tema-info {
    flex: 1;
}

.tema-nombre {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.tema-stats {
    font-size: 0.85rem;
    opacity: 0.9;
}

.cantidad-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin: 1.5rem 0;
}

.cantidad-selector button {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.cantidad-selector button:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.cantidad-selector input[type="number"] {
    width: 80px;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-large {
    width: 100%;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    margin-top: 1rem;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
}

/* ============================================
   MODO SIMULACRO
   ============================================ */
.simulacro-info {
    max-width: 700px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.info-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 2rem;
}

.info-card h3 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.info-card ul {
    list-style: none;
    padding: 0;
}

.info-card li {
    padding: 0.5rem 0;
    font-size: 1.05rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

/* ============================================
   PANTALLA TEST
   ============================================ */
.test-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.test-info {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.cronometro {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.barra-progreso-container {
    position: relative;
    height: 8px;
    background: var(--bg-secondary);
}

.barra-progreso {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--success) 100%);
    transition: width 0.3s ease;
}

.progreso-texto {
    text-align: center;
    padding: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.pregunta-container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.pregunta-numero {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.pregunta-texto {
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.opciones-container {
    max-width: 900px;
    margin: 0 auto 2rem;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.opcion {
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.opcion:hover {
    border-color: var(--primary);
    background: var(--bg-secondary);
}

.opcion-letra {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--text-secondary);
}

.opcion-texto {
    flex: 1;
    padding-top: 0.25rem;
}

.opcion.selected {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.opcion.selected .opcion-letra {
    background: var(--primary);
    color: white;
}

.opcion.correcta {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.05);
}

.opcion.correcta .opcion-letra {
    background: var(--success);
    color: white;
}

.opcion.incorrecta {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.05);
}

.opcion.incorrecta .opcion-letra {
    background: var(--danger);
    color: white;
}

.opcion.disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.explicacion-container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.explicacion-content {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    padding: 1.5rem;
    line-height: 1.8;
}

.test-actions {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
}

.btn-nav {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-nav:hover:not(:disabled) {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-guardar {
    background: transparent;
    border: 2px solid var(--warning);
    color: var(--warning);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-guardar:hover {
    background: var(--warning);
    color: white;
}

.btn-guardar.guardada {
    background: var(--warning);
    color: white;
}

.test-navegacion {
    max-width: 900px;
    margin: 1rem auto 2rem;
    padding: 0 1rem;
}

.mini-mapa {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.mini-pregunta {
    width: 2.5rem;
    height: 2.5rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-primary);
    color: var(--text-secondary);
}

.mini-pregunta:hover {
    border-color: var(--primary);
    transform: scale(1.1);
}

.mini-pregunta.actual {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.mini-pregunta.respondida {
    background: var(--bg-secondary);
    border-color: var(--success);
}

.mini-pregunta.correcta {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.mini-pregunta.incorrecta {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

/* ============================================
   PREGUNTAS GUARDADAS
   ============================================ */
.guardadas-container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
    min-height: 400px;
}

.lista-guardadas {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pregunta-guardada {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.pregunta-guardada-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.pregunta-guardada-tema {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.btn-eliminar {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.25rem 0.5rem;
}

.mensaje-vacio {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
    display: block;
}

.mensaje-vacio p {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

/* ============================================
   ESTADÍSTICAS DETALLADAS
   ============================================ */
.stats-detalladas {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tema-stat-card {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.tema-stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.tema-stat-nombre {
    font-weight: 600;
    font-size: 1.1rem;
}

.tema-stat-porcentaje {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.tema-stat-barra {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.tema-stat-progreso {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--success) 100%);
    transition: width 0.3s ease;
}

.tema-stat-detalles {
    display: flex;
    gap: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ============================================
   RESULTADOS
   ============================================ */
.resultados-container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.resultado-general {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    margin-bottom: 2rem;
}

.puntuacion-grande {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.resultado-detalles {
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.detalle-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detalle-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.detalle-valor {
    font-size: 1.5rem;
    font-weight: 700;
}

.detalle-valor.correctas {
    color: var(--success);
}

.detalle-valor.incorrectas {
    color: var(--danger);
}

.acciones-resultado {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.acciones-resultado button {
    flex: 1;
    min-width: 200px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 640px) {
    .dashboard-header h1 {
        font-size: 1.5rem;
    }
    
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .menu-principal {
        grid-template-columns: 1fr;
    }
    
    .puntuacion-grande {
        font-size: 3rem;
    }
    
    .resultado-detalles {
        flex-direction: column;
        gap: 1rem;
    }
    
    .temas-grid {
        grid-template-columns: 1fr;
    }
}
/* ===== Pantalla de Login ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--card-bg, #fff);
    padding: 40px 30px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    max-width: 420px;
    width: 100%;
    text-align: center;
}

.login-card h1 {
    margin: 0 0 8px;
    font-size: 2em;
}

.login-subtitle {
    color: #666;
    margin: 0 0 24px;
    font-size: 1em;
}

.login-desc {
    color: #444;
    margin-bottom: 28px;
    line-height: 1.5;
}

.btn-google {
    width: 100%;
    padding: 14px 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    color: #333;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.2s;
}

.btn-google:hover {
    background: #f5f5f5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.login-info {
    margin-top: 20px;
    font-size: 0.85em;
    color: #888;
}
/* ===== Muro de Pago ===== */
.muro-pago {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
 
.muro-pago.active {
    display: flex;
}
 
.muro-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}
 
.muro-card {
    position: relative;
    background: var(--card-bg, #fff);
    border-radius: 20px;
    max-width: 460px;
    width: 100%;
    padding: 36px 30px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: muroAparece 0.3s ease-out;
}
 
@keyframes muroAparece {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
 
.muro-icono {
    font-size: 3em;
    margin-bottom: 8px;
}
 
.muro-card h2 {
    margin: 0 0 8px;
    font-size: 1.5em;
}
 
.muro-card p {
    color: #666;
    margin: 0 0 20px;
    line-height: 1.5;
}
 
.muro-features {
    text-align: left;
    margin: 24px 0;
    padding: 20px;
    background: rgba(26, 54, 93, 0.05);
    border-radius: 12px;
}
 
.muro-feature {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    font-size: 0.95em;
}
 
.muro-feature .check {
    color: #2ecc71;
    font-weight: bold;
    font-size: 1.1em;
}
 
.btn-suscribirse {
    display: block;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #1a365d 0%, #2c5282 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1.05em;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 10px;
    transition: transform 0.15s, box-shadow 0.15s;
}
 
.btn-suscribirse:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(26, 54, 93, 0.3);
}
 
.btn-secundario {
    display: block;
    width: 100%;
    padding: 12px;
    background: transparent;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 0.95em;
    cursor: pointer;
    transition: background 0.15s;
}
 
.btn-secundario:hover {
    background: #f5f5f5;
}
 
.muro-info {
    margin-top: 16px;
    font-size: 0.85em;
    color: #999;
}
/* ===== Stat global por pregunta ===== */
.stat-global-pregunta {
    margin-top: 12px;
    padding: 8px 12px;
    background: rgba(26, 54, 93, 0.06);
    border-left: 3px solid #1a365d;
    border-radius: 4px;
    font-style: italic;
    color: #555;
}

.stat-global-pregunta small {
    font-size: 0.9em;
}

/* ===== Comparativa por tema ===== */
.tema-stat-comparativa {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(0, 0, 0, 0.08);
    font-size: 0.9em;
    color: #666;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.diff-mejor {
    color: #2ecc71;
    font-weight: 600;
}

.diff-peor {
    color: #e74c3c;
    font-weight: 600;
}

.diff-neutro {
    color: #888;
    font-weight: 500;
}

/* ===== Pantalla de Ranking ===== */
.ranking-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: rgba(0, 0, 0, 0.04);
    padding: 4px;
    border-radius: 10px;
    overflow-x: auto;
}

.tab-periodo {
    flex: 1;
    padding: 10px 14px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    color: #666;
    transition: all 0.15s;
    white-space: nowrap;
}

.tab-periodo:hover {
    background: rgba(0, 0, 0, 0.04);
}

.tab-periodo.activa {
    background: #fff;
    color: #1a365d;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.ranking-tabla {
    background: var(--card-bg, #fff);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.ranking-header-fila {
    display: grid;
    grid-template-columns: 50px 1fr 90px 80px;
    padding: 12px 14px;
    background: rgba(26, 54, 93, 0.06);
    font-weight: 600;
    font-size: 0.85em;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ranking-fila {
    display: grid;
    grid-template-columns: 50px 1fr 90px 80px;
    padding: 12px 14px;
    align-items: center;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    transition: background 0.1s;
}

.ranking-fila:hover {
    background: rgba(26, 54, 93, 0.03);
}

.ranking-fila.es-yo {
    background: linear-gradient(90deg, rgba(46, 204, 113, 0.12) 0%, rgba(46, 204, 113, 0.04) 100%);
    font-weight: 600;
}

.ranking-fila.es-yo:hover {
    background: linear-gradient(90deg, rgba(46, 204, 113, 0.18) 0%, rgba(46, 204, 113, 0.06) 100%);
}

.ranking-fila .r-pos {
    font-weight: 700;
    color: #1a365d;
    font-size: 1.05em;
}

.ranking-fila .r-nombre {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ranking-fila .r-nombre small {
    color: #2ecc71;
    font-weight: 500;
}

.ranking-fila .r-acert {
    font-weight: 600;
    text-align: right;
    color: #2c5282;
}

.ranking-fila .r-pct {
    text-align: right;
    color: #666;
}

.ranking-separador {
    text-align: center;
    padding: 12px 0;
    color: #aaa;
    font-size: 1.2em;
    letter-spacing: 4px;
}

.ranking-vecinos {
    background: var(--card-bg, #fff);
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid rgba(46, 204, 113, 0.4);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.ranking-loading,
.ranking-vacio,
.ranking-no-aparezco {
    text-align: center;
    padding: 40px 20px;
    color: #888;
}

.ranking-vacio small {
    display: block;
    margin-top: 8px;
    font-size: 0.9em;
}

.ranking-no-aparezco {
    margin-top: 16px;
    padding: 20px;
    background: rgba(26, 54, 93, 0.04);
    border-radius: 12px;
    font-size: 0.95em;
}

/* Botón editar nombre */
.btn-editar-nombre {
    padding: 8px 14px;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    color: #555;
    transition: all 0.15s;
}

.btn-editar-nombre:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: #999;
}

/* Móvil */
@media (max-width: 600px) {
    .ranking-header-fila,
    .ranking-fila {
        grid-template-columns: 36px 1fr 60px 60px;
        padding: 10px;
        font-size: 0.9em;
    }
    
    .tab-periodo {
        padding: 8px 10px;
        font-size: 0.85em;
    }
}
.header-acciones {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-logout {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: inherit;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}
/* ===== Pantalla Bizum ===== */
.bizum-card {
    max-width: 480px;
}
 
.bizum-numero-bloque {
    background: linear-gradient(135deg, #6c2eb5 0%, #8b3dd6 100%);
    color: #fff;
    padding: 24px 20px;
    border-radius: 14px;
    text-align: center;
    margin: 20px 0;
}
 
.bizum-label {
    font-size: 0.95em;
    opacity: 0.9;
    margin-bottom: 8px;
}
 
.bizum-numero {
    font-size: 2em;
    font-weight: 700;
    letter-spacing: 2px;
    margin: 8px 0 16px;
    font-family: 'Courier New', monospace;
}
 
.btn-copiar {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.15s;
}
 
.btn-copiar:hover {
    background: rgba(255, 255, 255, 0.3);
}
 
.bizum-instrucciones {
    background: rgba(255, 196, 0, 0.12);
    border-left: 3px solid #ffc400;
    padding: 14px 16px;
    border-radius: 6px;
    margin: 16px 0;
    font-size: 0.92em;
    text-align: left;
}
 
.bizum-email {
    margin-top: 8px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #1a365d;
    word-break: break-all;
    text-align: center;
}
 
.bizum-pasos {
    text-align: left;
    margin-top: 16px;
}
 
.bizum-pasos .paso {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    font-size: 0.95em;
}
 
.paso-num {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #6c2eb5;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85em;
}
