@property --pct {
    syntax: '<number>';
    inherits: false;
    initial-value: 0;
}

:root {
    --primary: #1b2a56;
    --primary-rgb: 27, 42, 86;
    --primary-dark: #101a3d;
    --primary-light: #e7eaf3;
    --primary-text: #1b2a56;
    --accent: #c9a256;
    --accent2: #c9a256;
    --info: #3b5a8a;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --text: #0f172a;
    --text-muted: #64748b;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --surface-muted: #f8fafc;
    --bg-gradient: linear-gradient(120deg, #f7f8fb, #eef1f8, #f6f1e4, #f7f8fb);
    --radius: 26px;
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
}

body[data-nivel="Primaria"] {
    --radius: 30px;
}

body[data-nivel="Preuniversitario"] {
    --primary: #101a3d;
    --primary-rgb: 16, 26, 61;
    --primary-dark: #0a1228;
    --primary-light: #dde3f0;
    --primary-text: #101a3d;
    --accent2: #9c7c3d;
    --radius: 20px;
}

@media (prefers-color-scheme: dark) {
    body:not([data-theme="light"]) {
        --primary-light: #1b2440;
        --primary-text: #a9b8de;
        --danger-light: #451a1a;
        --text: #e2e8f0;
        --text-muted: #94a3b8;
        --card-bg: #1e293b;
        --border: #334155;
        --surface-muted: #0f172a;
        --bg-gradient: linear-gradient(120deg, #0f172a, #111827, #1c1a12, #0f172a);
    }

    body[data-nivel="Preuniversitario"]:not([data-theme="light"]) {
        --primary: #8a99c4;
        --primary-rgb: 138, 153, 196;
        --primary-dark: #6577a8;
        --primary-light: #1b2440;
        --primary-text: #b3c0e0;
        --accent2: #dcbb78;
    }
}

* { box-sizing: border-box; }

@keyframes auroraShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-gradient);
    background-size: 300% 300%;
    animation: auroraShift 18s ease infinite;
    color: var(--text);
    margin: 0;
    padding: 20px 15px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.app-container {
    width: 100%;
    max-width: 460px;
}

.app-container.wide-mode {
    max-width: 1100px;
}

.aula-nav {
    position: sticky;
    top: 12px;
    z-index: 20;
    width: 100%;
    max-width: 1100px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 12px 20px;
    margin-bottom: 22px;
    box-shadow: var(--shadow-sm);
}

.aula-nav-logo {
    height: 48px;
    width: auto;
    display: block;
}

.aula-nav-user {
    display: flex;
    align-items: center;
    gap: 14px;
}

.aula-nav-user-info {
    text-align: right;
    line-height: 1.25;
}

.aula-nav-user-name {
    display: block;
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--text);
}

.aula-nav-user-empresa {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.aula-nav form {
    margin: 0;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    animation: cardIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.widget {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    box-shadow: var(--shadow-sm);
}

.widget-cta {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
}

.widget-cta-text h2 {
    margin: 0 0 4px;
    font-size: 1.25rem;
    font-weight: 800;
}

.widget-cta-text p {
    margin: 0;
    opacity: 0.85;
    font-size: 0.88rem;
}

.widget-cta-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.widget-cta-buttons button {
    width: auto;
    margin: 0;
    white-space: nowrap;
}

.widget-cta-buttons button:not(.secondary) {
    background: #fff;
    color: var(--primary-dark);
    box-shadow: none;
}

.widget-cta-buttons button.secondary {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.widget-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.widget-stat {
    display: block;
    font-size: 1.9rem;
    font-weight: 900;
    color: var(--text);
    line-height: 1.1;
}

.widget-sub {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.widget-empty {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

.widget-progreso {
    grid-column: 1 / -1;
}

.progreso-svg {
    width: 100%;
    height: auto;
    display: block;
    margin-top: 6px;
}

.widget-progreso-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 0;
}

.widget-progreso-header .widget-label {
    margin-bottom: 0;
}

.widget-link {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary-text);
    text-decoration: none;
    white-space: nowrap;
}

.widget-link:hover {
    text-decoration: underline;
}

.historial-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 22px;
}

.historial-titulo {
    margin: 0 0 4px;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text);
}

.historial-subtitulo {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.historial-tabla-wrap {
    overflow-x: auto;
}

.historial-tabla {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.historial-tabla th {
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    padding: 10px 14px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.historial-tabla td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    white-space: nowrap;
}

.historial-tabla tbody tr:hover {
    background: var(--surface-muted);
}

.historial-fecha-abs {
    display: block;
    font-weight: 700;
}

.historial-fecha-rel {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.puntaje-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.82rem;
}

.puntaje-badge.badge-alto {
    background: #dcfce7;
    color: #15803d;
}

.puntaje-badge.badge-medio {
    background: #fef3c7;
    color: #a16207;
}

.puntaje-badge.badge-bajo {
    background: var(--danger-light);
    color: #b91c1c;
}

.historial-paginacion {
    margin-top: 20px;
}

.paginacion {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.paginacion-btn {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary-text);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 10px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
}

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

.paginacion-btn.deshabilitado {
    opacity: 0.4;
    pointer-events: none;
}

.paginacion-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px 26px;
    box-shadow: 0 20px 45px -12px rgba(var(--primary-rgb), 0.25), 0 8px 16px -8px rgba(15, 23, 42, 0.08);
    position: relative;
    overflow: hidden;
    animation: cardIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 6px;
    background: linear-gradient(90deg, var(--primary), var(--info), var(--accent2));
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(14px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.brand {
    text-align: center;
    margin-bottom: 26px;
}

body.login-split-body {
    display: block;
    padding: 0;
    margin: 0;
    background: var(--card-bg);
    animation: none;
    min-height: 100vh;
}

.login-split {
    display: flex;
    min-height: 100vh;
}

.login-visual {
    flex: 1 1 50%;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px;
    background: linear-gradient(150deg, var(--primary), var(--primary-dark) 70%);
    color: #fff;
}

.login-visual-halo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.login-visual-brand {
    position: relative;
    z-index: 1;
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    color: #f1d9a3;
    margin-bottom: 40px;
}

.login-visual-content {
    position: relative;
    z-index: 1;
    max-width: 420px;
}

.login-visual-content h2 {
    font-size: 1.9rem;
    font-weight: 800;
    line-height: 1.32;
    margin: 0 0 16px;
}

.login-visual-content p {
    font-size: 1rem;
    line-height: 1.6;
    margin: 0;
    opacity: 0.85;
}

.login-form-panel {
    flex: 1 1 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
    background: var(--card-bg);
}

.login-form-inner {
    width: 100%;
    max-width: 380px;
}

.login-form-inner {
    text-align: center;
}

.login-form-inner form,
.login-form-inner .form-group,
.login-form-inner label {
    text-align: left;
}

.login-form-inner .brand-logo {
    max-width: 170px;
    margin: 0 auto 22px;
}

.login-form-inner input {
    padding: 12px 14px;
    font-size: 0.92rem;
    border-radius: 12px;
}

.login-form-titulo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    margin: 0 0 6px;
}

.login-form-subtitulo {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin: 0 0 24px;
}

@media (max-width: 900px) {
    .login-split {
        flex-direction: column;
    }

    .login-visual {
        flex: none;
        padding: 40px 28px;
        text-align: center;
        align-items: center;
    }

    .login-visual-brand {
        margin-bottom: 20px;
    }

    .login-form-panel {
        flex: none;
        padding: 36px 24px 48px;
    }
}

.brand-logo {
    display: block;
    max-width: 220px;
    width: 100%;
    height: auto;
    margin: 0 auto 16px;
}

.brand h1 {
    font-size: 1.4rem;
    font-weight: 800;
    margin: 0 0 6px;
    background: linear-gradient(90deg, var(--primary-text), var(--info));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: -0.02em;
}

.brand p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.form-group { margin-bottom: 18px; }

label {
    display: block;
    font-weight: 700;
    margin-bottom: 7px;
    font-size: 0.83rem;
    color: var(--text);
    letter-spacing: 0.01em;
}

input, select, button {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 2px solid var(--border);
    font-size: 1rem;
    font-family: inherit;
    background: var(--card-bg);
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

button {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    font-weight: 800;
    cursor: pointer;
    margin-top: 8px;
    letter-spacing: 0.02em;
    box-shadow: 0 10px 20px -8px rgba(var(--primary-rgb),0.5);
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.15s ease;
}

button:hover { filter: brightness(1.06); transform: translateY(-1px); }
button:active { transform: scale(0.98) translateY(0); }

button.secondary {
    background: var(--primary-light);
    color: var(--primary-text);
    box-shadow: none;
}

.error-box {
    background: var(--danger-light);
    color: #b91c1c;
    border-radius: 14px;
    padding: 12px 16px;
    font-size: 0.85rem;
    margin-bottom: 18px;
    font-weight: 600;
}

.hint {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-top: 20px;
}

.hidden { display: none !important; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.topbar h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text);
}

.link-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    width: auto;
    padding: 8px 12px;
    margin: 0;
    box-shadow: none;
    text-decoration: underline;
    cursor: pointer;
}

.pill-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.pill {
    flex: 1 1 auto;
    text-align: center;
    padding: 11px 14px;
    border-radius: 999px;
    border: 2px solid var(--border);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    color: var(--text-muted);
    background: var(--card-bg);
    transition: all 0.15s ease;
}

.pill-group.scroll-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
    -webkit-mask-image: linear-gradient(to right, #000 92%, transparent 100%);
    mask-image: linear-gradient(to right, #000 92%, transparent 100%);
    scrollbar-width: none;
}

.pill-group.scroll-row::-webkit-scrollbar { display: none; }

.pill-group.scroll-row .pill {
    flex: 0 0 auto;
    scroll-snap-align: start;
    min-width: max-content;
    padding-left: 18px;
    padding-right: 18px;
}

.pill:hover { border-color: var(--primary); color: var(--primary-text); }

.pill.selected {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 8px 16px -6px rgba(var(--primary-rgb),0.5);
    transform: translateY(-1px);
}

.pill.pill-facil.selected {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 8px 16px -6px rgba(34, 197, 94, 0.5);
}

.pill.pill-intermedio.selected {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 8px 16px -6px rgba(245, 158, 11, 0.5);
}

.pill.pill-dificil.selected {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 8px 16px -6px rgba(239, 68, 68, 0.5);
}

.ajustes-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-muted);
    border: 2px solid var(--border);
    border-radius: 14px;
    padding: 12px 16px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    box-shadow: none;
    margin: 0;
}

.ajustes-toggle:hover { border-color: var(--primary); }

.ajustes-caret {
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.ajustes-toggle.abierto .ajustes-caret {
    transform: rotate(180deg);
}

.ajustes-panel {
    margin-top: 14px;
}

.ajustes-panel .form-group:last-child {
    margin-bottom: 0;
}

.quiz-progress-track {
    height: 8px;
    border-radius: 999px;
    background: var(--primary-light);
    overflow: hidden;
    margin-bottom: 14px;
}

.quiz-progress-bar {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary), var(--info));
    transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    width: 10%;
}

.quiz-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.quiz-progress {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
}

.quiz-timer {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--primary-text);
    background: var(--primary-light);
    padding: 5px 12px;
    border-radius: 999px;
    transition: color 0.3s ease, background-color 0.3s ease;
}

.quiz-timer.alerta {
    color: #b91c1c;
    background: var(--danger-light);
}

#question-title {
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1.5;
    margin: 6px 0 20px;
}

#question-title img,
#question-title svg {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 14px auto;
}

.option-btn {
    background: var(--surface-muted);
    color: var(--text);
    text-align: left;
    margin-bottom: 10px;
    border: 2px solid var(--border);
    font-weight: 600;
    box-shadow: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.option-btn:hover { border-color: var(--primary); transform: none; filter: none; }

.option-btn.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, var(--primary-light), var(--surface-muted));
    color: var(--primary-text);
    font-weight: 800;
    box-shadow: 0 6px 14px -8px rgba(var(--primary-rgb),0.4);
}

.option-letra {
    flex: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 2px solid var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
}

.option-btn.selected .option-letra {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.resultado-score {
    text-align: center;
    padding: 6px 0 18px;
}

.score-ring {
    width: 140px;
    height: 140px;
    margin: 0 auto 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: conic-gradient(var(--primary) calc(var(--pct) * 1%), var(--primary-light) 0);
    transition: --pct 0.8s ease;
}

.score-ring::before {
    content: '';
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    background: var(--card-bg);
}

.score-ring .num {
    position: relative;
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary-text);
}

.resultado-score .label {
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 600;
}

.resultado-mensaje {
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 18px;
    padding: 10px 14px;
    border-radius: 14px;
    background: var(--primary-light);
    color: var(--primary-text);
}

.solucionario-item {
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
}

.solucionario-item p:first-child {
    margin: 0 0 8px;
    font-weight: 700;
}

.solucionario-item .respuesta-linea {
    margin: 0;
    font-size: 0.85rem;
    color: #b91c1c;
    font-weight: 600;
}

.explicacion-box {
    margin-top: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--primary-light);
    border: 1px solid var(--border);
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text);
}

.explicacion-box img,
.explicacion-box svg {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 10px auto;
}

.explicacion-label {
    display: block;
    font-weight: 800;
    font-size: 0.78rem;
    color: var(--primary-text);
    margin-bottom: 6px;
}

.tutor-fab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, var(--accent2), #8a6d3b);
    color: #fff;
    border: none;
    font-size: 0.82rem;
    padding: 9px 16px;
    border-radius: 999px;
    margin-top: 12px;
    width: auto;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 8px 16px -8px rgba(201, 162, 86, 0.5);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 50;
    animation: fadeIn 0.2s ease;
}

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

.modal-card {
    background: var(--card-bg);
    width: 100%;
    max-width: 460px;
    border-radius: 24px 24px 0 0;
    padding: 24px 24px 30px;
    max-height: 75vh;
    overflow-y: auto;
    animation: slideUp 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.tutor-mensajes {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 40vh;
    overflow-y: auto;
    margin-bottom: 14px;
    padding-right: 2px;
}

.tutor-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.88rem;
    line-height: 1.45;
}

.tutor-bubble.tutor {
    align-self: flex-start;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

.tutor-bubble.alumno {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--accent2), #8a6d3b);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.tutor-input-row {
    display: flex;
    gap: 8px;
}

.tutor-input-row input {
    flex: 1 1 auto;
    width: auto;
    margin: 0;
}

.tutor-input-row button {
    flex: none;
    width: 48px;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.modal-card h3 {
    margin-top: 0;
    font-weight: 800;
    background: linear-gradient(90deg, var(--accent2), #8a6d3b);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 3px solid var(--primary-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}

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

.confetti-piece {
    position: fixed;
    top: -10px;
    z-index: 60;
    border-radius: 2px;
    animation: confettiFall linear forwards;
}

@keyframes confettiFall {
    to { transform: translateY(105vh) rotate(540deg); opacity: 0.9; }
}

.quiz-stepper {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
}

.stepper-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--card-bg);
    cursor: pointer;
    transition: all 0.15s ease;
}

.stepper-dot:hover { border-color: var(--primary); }

.stepper-dot.respondida {
    background: var(--primary-light);
    border-color: var(--primary-light);
    color: var(--primary-text);
}

.stepper-dot.actual {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 10px -4px rgba(var(--primary-rgb),0.6);
}

.quiz-nav-buttons {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.quiz-nav-buttons button {
    margin-top: 0;
}

.quiz-nav-buttons #btn-prev {
    flex: 0 0 auto;
    width: auto;
    padding-left: 22px;
    padding-right: 22px;
}

.quiz-nav-buttons #btn-next {
    flex: 1 1 auto;
}

.quiz-nav-buttons #btn-prev:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
    body, .card, .pill, button, .modal-card, .modal-overlay, .confetti-piece {
        animation: none !important;
        transition: none !important;
    }
}

@media (min-width: 640px) {
    body { padding: 40px 24px; }
    .app-container { max-width: 560px; }
    .card { padding: 38px 42px; }
    .brand h1 { font-size: 1.6rem; }
    .pill { padding: 13px 18px; font-size: 0.9rem; }
    input, select, button { padding: 15px 18px; font-size: 1.05rem; }
}

@media (min-width: 1024px) {
    .app-container { max-width: 640px; }
    .card { padding: 44px 48px; }
}
