/* Reset y variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #003893;
    --primary-dark: #002b7f;
    --secondary: #fcd116;
    --success: #007a3d;
    --warning: #fcd116;
    --danger: #ce1126;
    --disabled: #6b7280;
    --bg: #f4f9ff;
    --card-bg: #ffffff;
    --text: #1f2937;
    --text-light: #4b5563;
    --border: #74acdf;
    --primary-soft: rgba(0, 56, 147, 0.1);
    --primary-soft-strong: rgba(0, 56, 147, 0.7);
    --info-soft: rgba(116, 172, 223, 0.22);
    --warning-soft: #fff7d6;
    --warning-text: #7a5c00;
    --danger-soft: #fdebec;
    --danger-text-strong: #b50f22;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   ACCESSIBILITY STYLES
   ============================================ */

/* Screen reader only - visually hidden but accessible */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Skip link for keyboard navigation */
.skip-link {
    position: absolute;
    top: -70px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 0 0 4px 0;
    z-index: 10000;
    font-weight: 600;
}

.skip-link:focus {
    top: 0;
}

/* Focus indicators for keyboard navigation */
*:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
[role="tab"]:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* Enhanced focus for interactive elements */
.tema-card:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--primary-soft);
}

.respuesta-btn:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    transform: scale(1.02);
}

/* Dot navigation focus */
.dot:focus-visible,
.pregunta-dot:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
    transform: scale(1.3);
}

/* Toast notifications */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: white;
    color: var(--text);
    padding: 16px 20px;
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 250px;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    animation: slideIn 0.3s ease-out;
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.info {
    border-left: 4px solid var(--primary);
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.hiding {
    animation: slideOut 0.3s ease-in forwards;
}

@keyframes slideOut {
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Loading indicator */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

html {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    justify-content: center;
    height: 100%;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    overscroll-behavior-x: contain;
    overscroll-behavior-y: auto;
}
#catalogo,
#mis-temas{
    padding:10px;
}
.app-container {
    width: 100vw;
    max-width: 768px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative; /* Reference for marcador-puntos */
    background: var(--bg);
}

/* Controls container */
.controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 768px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 1000;
    height: auto;
    min-height: 60px;
    flex-shrink: 0;
    background: var(--bg);
    border-top: 1px solid var(--border);
}

.controls-left,
.controls-center,
.controls-right {
    flex: 1;
    display: flex;
    align-items: center;
    height: 100%;
}

.controls-left {
    justify-content: flex-start;
}

.controls-center {
    justify-content: center;
}

.controls-right {
    justify-content: flex-end;
}

/* Indicador de vistas */
.view-indicator {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: var(--transition);
}

.dot.active {
    background: var(--primary);
    width: 24px;
    border-radius: 4px;
}

/* Slider */
.slider-container {
    flex: 1;
    overflow: hidden;
    position: relative; /* Reference for marcador-puntos */
    margin-bottom: 4em;
}

.slides-wrapper {
    display: flex;
    height: 100%;
    width: 100%;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.slide {
    min-width: 100%;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    overscroll-behavior-y: auto;
    overscroll-behavior-x: none;
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

/* Headers */
.slide-header {
    text-align: center;
    margin-bottom: 10px;
}

.slide-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.subtitle {
    font-size: 14px;
    color: var(--text-light);
}

/* Progress stats */
.progress-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 12px;
    padding: 8px 16px;
    background: var(--bg);
    border-radius: 8px;
    font-size: 13px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-label {
    color: var(--text-light);
    font-weight: 500;
}

.stat-value {
    color: var(--primary);
    font-weight: 700;
    font-size: 14px;
}

.stat-divider {
    color: var(--text-light);
    opacity: 0.5;
}

/* Filtro de Nivel */
.nivel-filter {
    background: var(--card-bg);
    padding: 8px 10px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.nivel-filter label {
    font-weight: 600;
    color: var(--text);
}

.nivel-filter select {
    flex: 1;
    padding: 8px 12px;
    max-width:132px;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.nivel-filter select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Buscador de temas */
.search-container {
    flex: 1;
}

.search-container input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    transition: var(--transition);
}

.search-container input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-container input::placeholder {
    color: var(--text-light);
}

/* Highlight para resultados de búsqueda */
.tema-card.search-match {
    background: var(--info-soft);
    border-color: var(--border);
    box-shadow: 0 0 0 2px var(--border);
}

.temas-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 20px;
}

.tema-tree-item {
    margin-bottom: 2px;
}

.tema-card {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    border: 2px solid transparent;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tema-card:active {
    transform: scale(0.98);
}

.tema-card.in-collection {
    border-color: var(--primary);
    background: var(--info-soft);
}

.tema-card.in-collection::after {
    content: '✓';
    position: absolute;
    right: 6px;
    background: var(--primary);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
}

.tema-card.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tema-card.disabled .tema-titulo,
.tema-card.disabled .tema-info {
    color: var(--text-light);
}

.tema-card .tema-info.tema-progreso-pendiente {
    color: var(--primary);
    font-weight: 600;
}

.tema-card .tema-info.tema-completado {
    color: var(--success);
    font-weight: 700;
}

.tema-card .tema-info.tema-subtemas {
    font-weight: 700;
}

/* Highlight animation for incomplete child requirement */
.tema-card.highlight-required {
    animation: highlightPulse 0.6s ease-in-out 3;
    border-color: var(--primary-dark) !important;
    background: var(--primary-soft) !important;
}

@keyframes highlightPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 var(--primary-soft-strong);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 0 10px rgba(0, 56, 147, 0);
    }
}

@keyframes buttonPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(0, 56, 147, 0.3);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 4px 20px rgba(0, 56, 147, 0.5);
    }
}

.btn-pulse {
    animation: buttonPulse 0.4s ease-in-out 2;
}

.tree-icon {
    font-size: 12px;
    color: var(--text-light);
    min-width: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tree-icon.expandable {
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
    padding: 4px 10px;
    margin-left: 0.5em;
    font-size: 14px;
    color: var(--primary);
    font-weight: bold;
    pointer-events: auto;
    background: var(--primary-soft);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.tree-icon.expandable:hover {
    color: white;
    background: var(--primary);
    border-color: var(--primary);
}

.tema-content {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 0.5em;
    pointer-events: none; /* Let clicks pass through to tema-card */
}

.tema-titulo {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

.tema-info {
    font-size: 12px;
    color: var(--text-light);
    white-space: nowrap;
    margin-right: 3em;
}

/* Mis Temas */
.mis-temas-container {
    min-height: 400px;
}

.empty-state {
    text-align: center;
    padding: 20px 10px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-state p {
    color: var(--text-light);
    margin-bottom: 20px;
    font-size: 16px;
}

.empty-state .btn-primary {
    margin-top: 10px;
}

.temas-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.mi-tema-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    border: 2px solid transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mi-tema-card:active {
    transform: scale(0.98);
    border-color: var(--primary);
}

.mi-tema-info {
    flex: 1;
}

.mi-tema-titulo {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

.mi-tema-progress {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.progress-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.3s ease;
}

.play-icon {
    font-size: 32px;
    opacity: 0.5;
    transition: var(--transition);
}

.mi-tema-card:active .play-icon {
    opacity: 1;
    transform: scale(1.1);
}

/* Juego/Lección */
.game-container {
    height:100%;
}

.game-empty-state {
    text-align: center;
    padding: 20px 10px;
}

.tema-actual-header {
    text-align: center;
    padding: 10px;
    background:  var(--primary);
    box-shadow: var(--shadow-lg);
}

.tema-actual-titulo {
    font-size: 22px;
    font-weight: 700;
    color: white;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Examen */
.examen-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 10px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 20px;
}

.examen-header {
    text-align: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
}

.examen-titulo {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.examen-info {
    font-size: 14px;
    color: var(--text-light);
}

.pregunta-numero {
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.pregunta-origen {
    font-size: 13px;
    color: var(--primary);
    margin-bottom: 12px;
    padding: 8px 12px;
    background: var(--primary-soft);
    border-radius: 6px;
    border-left: 3px solid var(--primary);
}

.resultado-examen {
    margin-top: 12px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
}

.resultado-correcto {
    color: var(--success);
}

.resultado-incorrecto {
    color: var(--danger);
}

.leccion-container {
    background: var(--card-bg);
    box-shadow: var(--shadow-lg);
    min-height:100%;
    display: flex;
    flex-direction: column;
}

.leccion-header {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-bottom: 1px solid var(--border);
}

.leccion-titulo {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    width: 100%;
}

.leccion-numero {
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.leccion-contenido{
    padding:10px;
}
.contenido-item {
    margin-bottom: 20px;
}

.contenido-texto {
    font-size: 32px;
    line-height: 1.4;
    padding: 0.5em 0;
    color: var(--text);
}

.contenido-imagen {
    width: 100%;
    border-radius: var(--radius);
    margin: 16px 0;
}

.pregunta-header {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
}

.pregunta-titulo {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    width: 100%;
}

.pregunta-indicador {
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

#pregunta-contador {
    white-space: nowrap;
}

.pregunta-container {
    padding: 0 10px;
}

@media (min-width: 576px) {
    .pregunta-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    .pregunta-titulo {
        flex: 1;
        width: auto;
    }
}

.respuestas-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.respuesta-btn {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text);
}

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

.respuesta-btn:hover {
    border-color: var(--primary);
}

.respuesta-btn.correcta {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.respuesta-btn.incorrecta {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.respuesta-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.explicacion {
    margin-top: 16px;
    padding: 16px;
    background: white;
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
}

.respuesta-item {
    display: flex;
    flex-direction: column;
}

.explicacion-inline {
    padding: 12px;
    background: var(--bg);
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
}

/* Botones */
button {
    font-family: inherit;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: white;
    padding: 10px;
    border-radius: var(--radius);
    font-size: 16px;
    width: 100%;
}

.btn-primary:active {
    background: var(--primary-dark);
    transform: scale(0.98);
}

.btn-fixed-bottom {
    box-shadow: var(--shadow-lg);
}

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

.btn-secondary {
    background: var(--card-bg);
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 15px;
}

.btn-secondary:active {
    background: var(--primary);
    color: white;
}

/* Botón volver al catálogo */
.btn-back-catalog {
    background: var(--card-bg);
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.btn-back-catalog:active {
    background: var(--primary);
    color: white;
    transform: scale(0.95);
}

/* Navegación */
.nav-btn {
    position: fixed;
    bottom: 20px;
    background: var(--primary);
    color: white;
    padding: 14px 24px;
    border-radius: var(--radius);
    font-size: 15px;
    box-shadow: var(--shadow-lg);
    z-index: 50;
}

.nav-btn-left {
    left: 20px;
}

.nav-btn-right {
    right: 20px;
}

.nav-btn:active {
    background: var(--primary-dark);
    transform: scale(0.98);
}

.nav-buttons {
    position: fixed;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 50;
}

/* Responsive - Tablet y Desktop */
@media (min-width: 768px) {
    .slide {
    }

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

    .slide-header h1 {
        font-size: 36px;
    }

    .subtitle {
        font-size: 16px;
    }
}

@media (min-width: 1024px) {
    .slide {
    }

    .temas-grid {
        max-width: 1200px;
        margin-left: auto;
        margin-right: auto;
    }

    .temas-list {
        max-width: 800px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Caja de diálogo de resultado del examen */
.resultado-dialogo {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 200;
    max-width: 400px;
    width: calc(100% - 40px);
    text-align: center;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.resultado-dialogo-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 199;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.resultado-icono {
    font-size: 64px;
    margin-bottom: 16px;
}

.resultado-titulo {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text);
}

.resultado-titulo.aprobado {
    color: var(--success);
}

.resultado-titulo.reprobado {
    color: var(--danger);
}

.resultado-detalles {
    font-size: 16px;
    color: var(--text);
    margin-bottom: 8px;
    line-height: 1.6;
}

.resultado-tema {
    font-size: 14px;
    color: var(--text-light);
    margin-top: 16px;
    margin-bottom: 16px;
    font-style: italic;
}

.resultado-warning {
    background: var(--warning-soft);
    border: 1px solid var(--warning);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--warning-text);
    line-height: 1.5;
}

.resultado-dialogo .btn-primary {
    margin-top: 0;
}

.resultado-errores-por-tema {
    margin-top: 16px;
    padding: 12px;
    background: var(--danger-soft);
    border-radius: 8px;
    border-left: 3px solid var(--danger);
    text-align: left;
}

.resultado-errores-por-tema strong {
    display: block;
    margin-bottom: 8px;
    color: var(--danger);
}

.resultado-errores-por-tema ul {
    margin: 0;
    padding-left: 20px;
    list-style: none;
}

.resultado-errores-por-tema li {
    padding: 4px 0;
    color: var(--text);
    font-size: 14px;
}

.resultado-errores-por-tema li::before {
    content: "• ";
    color: var(--danger);
    font-weight: bold;
    margin-right: 8px;
}

.resultado-errores-por-tema a {
    color: var(--danger);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.resultado-errores-por-tema a:hover {
    color: var(--danger-text-strong);
    text-decoration: underline;
}

/* Slider de preguntas */
.pregunta-slider {
    position: relative;
    margin-bottom: 2em;
}

.pregunta-slider .pregunta-container {
    display: none;
}

.pregunta-slider .pregunta-container:first-child {
    display: block;
}

/* Indicador de preguntas con bolitas */
/* Navigation header for exam questions (number + slider dots) */
.pregunta-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    gap: 16px;
}

.pregunta-numero-exam {
    font-size: 13px;
    color: var(--text);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.pregunta-slider-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

/* Hide the individual question numbers inside exam questions */
.widget-examen .pregunta-numero {
    display: none;
}

.pregunta-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.pregunta-dot:hover:not(.disabled) {
    transform: scale(1.2);
    background: var(--text-light);
}

.pregunta-dot.active {
    background: var(--primary);
    width: 28px;
    border-radius: 5px;
    transform: scale(1);
}

.pregunta-dot.completed:not(.active) {
    background: var(--success);
}

.pregunta-dot.completed:not(.active)::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 8px;
    font-weight: bold;
}

.pregunta-dot.failed:not(.active) {
    background: var(--danger);
}

.pregunta-dot.failed:not(.active)::after {
    content: '✗';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 10px;
    font-weight: bold;
}

.pregunta-dot.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pregunta-dot.disabled:hover {
    transform: none;
    background: var(--border);
}

/* Indicador de navegación de lecciones con dots (reutiliza estilos de preguntas) */
.leccion-slider-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.leccion-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--disabled);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.leccion-dot:hover:not(.disabled) {
    transform: scale(1.2);
    background: var(--text-light);
}

.leccion-dot.active {
    background: var(--primary);
    width: 28px;
    border-radius: 5px;
    transform: scale(1);
}

.leccion-dot.completed:not(.active) {
    background: var(--success);
}

.leccion-dot.completed:not(.active)::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 8px;
    font-weight: bold;
}

.leccion-dot.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.leccion-dot.disabled:hover {
    transform: none;
    background: var(--border);
}

/* Animaciones suaves */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .resultado-dialogo,
    .resultado-dialogo-overlay {
        animation: none !important;
    }
}

.widget-examen{
    padding: 20px 0;
}
/* ============================================
   AUTHENTICATION MODAL
   ============================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-close:hover {
    background: var(--bg);
    color: var(--text);
}

.modal-body {
    padding: 20px;
}

.input-field {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    margin: 10px 0;
    box-sizing: border-box;
}

.input-field:focus {
    outline: none;
    border-color: var(--success);
}

.help-text {
    color: var(--text-light);
    font-size: 0.9rem;
    margin: 5px 0 15px 0;
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    margin: 5px;
}

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

.success-icon {
    font-size: 4rem;
    text-align: center;
    color: var(--success);
    margin: 20px 0;
}

.error-message {
    background: var(--danger-soft);
    color: var(--danger);
    padding: 12px;
    border-radius: 8px;
    margin: 10px 0;
    border-left: 4px solid var(--danger);
}

.loading-message {
    text-align: center;
    color: var(--text-light);
    padding: 10px;
    font-style: italic;
}

@media (min-width: 576px) {
    .leccion-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    .leccion-titulo {
        flex: 1;
        width: auto;
    }
}

/* ============================================
   TOP BAR (Points + Sync)
   ============================================ */

.top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
    background: linear-gradient(90deg, var(--primary-dark), var(--primary));
    border-bottom: 2px solid var(--danger);
    box-shadow: var(--shadow);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.app-badge-logo {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.14);
}

.app-title-wrap {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-title {
    color: var(--card-bg);
    font-size: 14px;
    line-height: 1.1;
    letter-spacing: 0.2px;
}

.app-title a {
    color: inherit;
    text-decoration: none;
}

.app-subtitle {
    color: rgba(255, 255, 255, 0.82);
    font-size: 11px;
    line-height: 1.1;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-sync {
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: var(--card-bg);
    padding: 8px 12px;
    border-radius: 20px;
    box-shadow: none;
    font-size: 17px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-sync:hover {
    background: rgba(255, 255, 255, 0.24);
    transform: translateY(-1px);
}

.btn-sync:active {
    transform: scale(0.95);
}

/* ============================================
   POINTS SCOREBOARD
   ============================================ */

.marcador-puntos {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--card-bg);
    padding: 8px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: none;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
}

.puntos-icono {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.puntos-valor {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    min-width: 30px;
    text-align: center;
    transition: color 0.3s ease, transform 0.2s ease;
}

@media (max-width: 520px) {
    .app-subtitle {
        display: none;
    }

    .top-bar {
        padding-left: 8px;
        padding-right: 8px;
    }

    .top-bar-actions {
        gap: 6px;
    }

    .btn-sync {
        padding: 7px 10px;
    }

    .marcador-puntos {
        padding: 7px 10px;
    }
}

/* Correct answer animation - green */
.marcador-puntos.puntos-correcto {
    background: var(--success);
    box-shadow: 0 0 20px rgba(0, 122, 61, 0.5);
}

.marcador-puntos.puntos-correcto .puntos-valor {
    color: white;
}

.marcador-puntos.puntos-correcto .puntos-icono {
    transform: scale(1.3);
}

/* Incorrect answer animation - red */
.marcador-puntos.puntos-incorrecto {
    background: var(--danger);
    box-shadow: 0 0 20px rgba(206, 17, 38, 0.5);
}

.marcador-puntos.puntos-incorrecto .puntos-valor {
    color: white;
}

.marcador-puntos.puntos-incorrecto .puntos-icono {
    transform: scale(0.8);
}

/* Animation pulse */
.marcador-puntos.puntos-animando {
    animation: puntosPulse 0.6s ease;
}

@keyframes puntosPulse {
    0% {
        transform: scale(1);
    }
    30% {
        transform: scale(1.15);
    }
    60% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
    }
}

/* ============================================
   AUTH MODAL STYLES
   ============================================ */

.auth-description {
    color: var(--text);
    margin-bottom: 16px;
    line-height: 1.5;
}

.code-input {
    font-size: 24px;
    text-align: center;
    letter-spacing: 8px;
    font-family: monospace;
}

.error-text {
    color: var(--danger);
    font-size: 13px;
    min-height: 20px;
    margin: 8px 0;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 14px;
    margin-top: 12px;
    text-decoration: underline;
}

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

#auth-step-success .success-icon {
    font-size: 64px;
    color: var(--success);
    text-align: center;
    margin-bottom: 16px;
}

#auth-modal .btn-primary {
    margin-top: 8px;
}

.feedback-textarea {
    min-height: 110px;
    resize: vertical;
}

.feedback-counter {
    text-align: right;
    font-size: 12px;
    color: var(--text-light);
    margin-top: -4px;
    margin-bottom: 8px;
}
