/* ==========================================================================
   QuizBack Design System
   Layered on top of Pico CSS v2 (vendored). Single source of truth for
   tokens and components. Page templates may add page-scoped rules in their
   own {% block extra_head %} but must not redefine these components.
   ========================================================================== */

/* --- 1. Tokens ------------------------------------------------------- */
:root {
    /* Brand */
    --ae-primary: #4f46e5;
    --ae-primary-hover: #4338ca;
    --ae-primary-active: #3730a3;
    --ae-primary-focus: rgba(79, 70, 229, 0.15);
    --ae-primary-light: #eef2ff;
    --ae-primary-border: #c7d2fe;
    --ae-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);

    /* Semantic (AA-compliant text-on-light pairs) */
    --ae-success: #047857;
    --ae-success-strong: #065f46;
    --ae-success-light: #ecfdf5;
    --ae-success-border: #a7f3d0;
    --ae-warning: #b45309;
    --ae-warning-strong: #92400e;
    --ae-warning-light: #fffbeb;
    --ae-warning-border: #fde68a;
    --ae-danger: #dc2626;
    --ae-danger-strong: #b91c1c;
    --ae-danger-light: #fef2f2;
    --ae-danger-border: #fecaca;

    /* Neutrals */
    --ae-text: #111827;
    --ae-text-soft: #374151;
    --ae-muted: #5b6472;
    --ae-faint: #9ca3af;
    --ae-border: #e5e7eb;
    --ae-bg-subtle: #f9fafb;
    --ae-bg-card: #ffffff;

    /* Depth */
    --ae-shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.05);
    --ae-shadow: 0 1px 3px rgba(17, 24, 39, 0.08), 0 1px 2px rgba(17, 24, 39, 0.05);
    --ae-shadow-md: 0 4px 10px rgba(17, 24, 39, 0.07), 0 2px 4px rgba(17, 24, 39, 0.05);
    --ae-shadow-lg: 0 12px 28px rgba(17, 24, 39, 0.12), 0 4px 10px rgba(17, 24, 39, 0.06);

    /* Shape & motion */
    --ae-radius-sm: 6px;
    --ae-radius: 10px;
    --ae-radius-lg: 14px;
    --ae-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --ae-t-fast: 140ms;
    --ae-t: 200ms;
}

/* Pico overrides */
:root:not([data-theme="dark"]) {
    --pico-primary: var(--ae-primary);
    --pico-primary-hover: var(--ae-primary-hover);
    --pico-primary-focus: var(--ae-primary-focus);
    --pico-primary-background: var(--ae-primary);
    --pico-primary-hover-background: var(--ae-primary-hover);
    --pico-border-radius: var(--ae-radius-sm);
    --pico-color: var(--ae-text-soft);
    --pico-h1-color: var(--ae-text);
    --pico-h2-color: var(--ae-text);
    --pico-h3-color: var(--ae-text);
    --pico-h4-color: var(--ae-text);
}

/* --- 2. Base --------------------------------------------------------- */
/* Inter (variable, latin subset) — vendored; no CDN dependency */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../vendor/fonts/inter-latin-var.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

body {
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { font-weight: 650; letter-spacing: -0.015em; }
code, kbd, pre, samp {
    font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", Consolas, monospace;
}

.container { max-width: 720px; margin: 0 auto; padding: 2rem 1rem; }
.container.wide { max-width: 1080px; }
.container.mid { max-width: 800px; }

.skip-link {
    position: absolute; left: -9999px; top: 0; z-index: 100;
    background: var(--ae-primary); color: #fff; padding: 0.5rem 1rem;
    border-radius: 0 0 var(--ae-radius-sm) 0; font-size: 0.85rem;
}
.skip-link:focus { left: 0; }

/* --- 3. Icons (fixed boxes: no pop-in layout shift) ------------------ */
[data-lucide] { display: inline-block; vertical-align: -0.125em; flex-shrink: 0; }
.ic-12 { width: 12px; height: 12px; }
.ic-14 { width: 14px; height: 14px; }
.ic-16 { width: 16px; height: 16px; }
.ic-18 { width: 18px; height: 18px; }
.ic-20 { width: 20px; height: 20px; }
.ic-24 { width: 24px; height: 24px; }
.ic-32 { width: 32px; height: 32px; }
.ic-48 { width: 48px; height: 48px; }

/* --- 3b. Brand wordmark (nav, login, footers, student headers) -------- */
.wordmark {
    display: inline-flex; align-items: center; gap: 0.45rem;
    font-weight: 700; font-size: 1.1rem;
    color: var(--ae-primary); text-decoration: none;
}
.wordmark-lg { font-size: 1.25rem; }

/* Sub-section heading (h3 inside cards/sections) */
.h-sub { font-size: 1rem; margin-bottom: 0.75rem; }

/* --- 4. Top nav ------------------------------------------------------ */
.top-nav {
    display: flex; justify-content: space-between; align-items: center;
    gap: 1rem; flex-wrap: wrap;
    padding-bottom: 1rem; margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--ae-border);
}
.top-nav .brand {
    display: inline-flex; align-items: center; gap: 0.45rem;
    font-weight: 700; font-size: 1.1rem;
    color: var(--ae-primary); text-decoration: none;
}
.top-nav .nav-links { display: flex; gap: 1.1rem; align-items: center; font-size: 0.88rem; }
.top-nav .nav-links a {
    display: inline-flex; align-items: center; gap: 0.3rem;
    text-decoration: none; color: var(--ae-muted);
    transition: color var(--ae-t-fast);
}
.top-nav .nav-links a:hover { color: var(--ae-primary); }

/* --- 5. Buttons ------------------------------------------------------ */
button, [role="button"], input[type="submit"] {
    font-weight: 600;
    transition: background var(--ae-t-fast), border-color var(--ae-t-fast),
                box-shadow var(--ae-t-fast), transform var(--ae-t-fast);
}
button:not(.outline):not(.secondary):not(:disabled),
[role="button"]:not(.outline):not(.secondary) {
    box-shadow: var(--ae-shadow-sm);
}
button:not(:disabled):hover, [role="button"]:hover { transform: translateY(-1px); box-shadow: var(--ae-shadow); }
button:not(:disabled):active, [role="button"]:active { transform: translateY(0); box-shadow: var(--ae-shadow-sm); }

.btn-icon { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.83rem; width: auto; }
.btn-lg { padding: 0.8rem 1.75rem; font-size: 1rem; }
.btn-danger {
    --pico-background-color: var(--ae-danger);
    --pico-border-color: var(--ae-danger);
    --pico-color: #fff;
    background: var(--ae-danger); border-color: var(--ae-danger); color: #fff;
}
.btn-danger:hover { background: var(--ae-danger-strong); border-color: var(--ae-danger-strong); color: #fff; }
.btn-danger.outline {
    background: transparent; color: var(--ae-danger); border-color: var(--ae-danger);
}
.btn-danger.outline:hover { background: var(--ae-danger-light); }
a[role="button"] { text-decoration: none; }

/* Buttons showing in-flight state (HTMX or manual) */
[aria-busy="true"] { pointer-events: none; }

/* --- 6. Badges ------------------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.22rem 0.6rem; border-radius: 9999px;
    font-size: 0.74rem; font-weight: 600; letter-spacing: 0.01em;
    white-space: nowrap; line-height: 1.4;
}
.badge-success { background: var(--ae-success-light); color: var(--ae-success-strong); border: 1px solid var(--ae-success-border); }
.badge-warning { background: var(--ae-warning-light); color: var(--ae-warning-strong); border: 1px solid var(--ae-warning-border); }
.badge-danger  { background: var(--ae-danger-light); color: var(--ae-danger-strong); border: 1px solid var(--ae-danger-border); }
.badge-info    { background: var(--ae-primary-light); color: var(--ae-primary-active); border: 1px solid var(--ae-primary-border); }
.badge-muted   { background: var(--ae-bg-subtle); color: var(--ae-text-soft); border: 1px solid var(--ae-border); }

/* --- 7. Cards -------------------------------------------------------- */
.card {
    background: var(--ae-bg-card);
    border: 1px solid var(--ae-border);
    border-radius: var(--ae-radius);
    padding: 1.25rem;
    box-shadow: var(--ae-shadow-sm);
}
.card + .card { margin-top: 0.75rem; }
.card-hover { transition: box-shadow var(--ae-t), transform var(--ae-t), border-color var(--ae-t); }
.card-hover:hover { box-shadow: var(--ae-shadow-md); transform: translateY(-2px); border-color: var(--ae-primary-border); }

/* --- 8. Stat cards --------------------------------------------------- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.75rem; margin-bottom: 1.5rem;
}
.stat-card {
    text-align: center; padding: 0.9rem 0.75rem;
    background: var(--ae-bg-card);
    border: 1px solid var(--ae-border);
    border-radius: var(--ae-radius);
    box-shadow: var(--ae-shadow-sm);
}
.stat-card .stat-value {
    font-size: 1.55rem; font-weight: 700;
    color: var(--ae-primary); line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
.stat-card .stat-label {
    font-size: 0.72rem; color: var(--ae-muted);
    text-transform: uppercase; letter-spacing: 0.05em;
    margin-top: 0.15rem;
}

/* --- 9. Tables ------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap > table { margin-bottom: 0.5rem; }
table { font-size: 0.88rem; }
table th {
    font-weight: 600; font-size: 0.73rem;
    text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--ae-muted); white-space: nowrap;
}
table td { vertical-align: middle; }
tbody tr { transition: background var(--ae-t-fast); }
tbody tr:hover { background: var(--ae-bg-subtle); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* --- 10. Alerts / flash messages ------------------------------------- */
.alert {
    padding: 0.75rem 1rem; border-radius: var(--ae-radius);
    font-size: 0.88rem; margin-bottom: 1rem;
    display: flex; align-items: flex-start; gap: 0.55rem;
}
.alert-success { background: var(--ae-success-light); color: var(--ae-success-strong); border: 1px solid var(--ae-success-border); }
.alert-error   { background: var(--ae-danger-light); color: var(--ae-danger-strong); border: 1px solid var(--ae-danger-border); }
.alert-warning { background: var(--ae-warning-light); color: var(--ae-warning-strong); border: 1px solid var(--ae-warning-border); }
.alert-info    { background: var(--ae-primary-light); color: var(--ae-primary-active); border: 1px solid var(--ae-primary-border); }
.error { color: var(--ae-danger-strong); }

/* --- 11. Forms ------------------------------------------------------- */
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus {
    border-color: var(--ae-primary);
    box-shadow: 0 0 0 3px var(--ae-primary-focus);
}
ul.errorlist {
    list-style: none; padding: 0.6rem 0.9rem; margin: 0 0 1rem;
    background: var(--ae-danger-light); color: var(--ae-danger-strong);
    border: 1px solid var(--ae-danger-border); border-radius: var(--ae-radius-sm);
    font-size: 0.86rem;
}
ul.errorlist li { margin: 0; }
ul.errorlist li + li { margin-top: 0.25rem; }
.field-error { color: var(--ae-danger-strong); font-size: 0.82rem; margin: -0.5rem 0 0.75rem; }

.form-section {
    border: 1px solid var(--ae-border); border-radius: var(--ae-radius);
    padding: 1.25rem 1.25rem 0.5rem; margin-bottom: 1.25rem;
    background: var(--ae-bg-card);
}
.form-section > legend {
    display: inline-flex; align-items: center; gap: 0.4rem;
    font-weight: 650; font-size: 0.95rem; color: var(--ae-text);
    padding: 0 0.5rem; margin-left: -0.5rem;
}
.form-section .hint { font-size: 0.8rem; color: var(--ae-muted); margin-top: -0.6rem; margin-bottom: 0.9rem; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Confirm dialog (instructor interventions, void reasons) */
dialog.ae-dialog {
    border: none; border-radius: var(--ae-radius-lg); padding: 0;
    max-width: 26rem; width: 92vw; box-shadow: var(--ae-shadow-lg);
}
dialog.ae-dialog::backdrop { background: rgba(17, 24, 39, 0.45); }
dialog.ae-dialog article { margin: 0; padding: 1.5rem; }
dialog.ae-dialog h3 { margin-bottom: 0.35rem; font-size: 1.05rem; }
dialog.ae-dialog footer {
    display: flex; justify-content: flex-end; gap: 0.5rem;
    margin-top: 1rem; padding: 0; background: none; border: none;
}
dialog.ae-dialog textarea { margin-bottom: 0.25rem; }

/* --- 12. Loading: spinner, htmx indicator, skeleton ------------------ */
@keyframes ae-spin { to { transform: rotate(360deg); } }
.spinner {
    display: inline-block; width: 20px; height: 20px;
    border: 2.5px solid var(--ae-primary-light);
    border-top-color: var(--ae-primary);
    border-radius: 50%;
    animation: ae-spin 0.7s linear infinite;
}
.spinner-lg { width: 42px; height: 42px; border-width: 3.5px; }
.spin { animation: ae-spin 1.1s linear infinite; }

.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-block; }
.htmx-request .htmx-hide-on-request { display: none; }

@keyframes ae-shimmer { 100% { transform: translateX(100%); } }
.skeleton {
    position: relative; overflow: hidden;
    background: var(--ae-border); border-radius: var(--ae-radius-sm);
    min-height: 0.9rem;
}
.skeleton::after {
    content: ""; position: absolute; inset: 0; transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.65), transparent);
    animation: ae-shimmer 1.4s infinite;
}

/* --- 13. Progress bars ----------------------------------------------- */
.progress-track {
    width: 100%; height: 8px;
    background: var(--ae-border); border-radius: 9999px; overflow: hidden;
}
.progress-fill {
    height: 100%; background: var(--ae-gradient); border-radius: 9999px;
    transition: width 500ms var(--ae-ease);
}
.progress-fill.success { background: var(--ae-success); }
progress {
    height: 8px; border-radius: 9999px;
    color: var(--ae-primary);
}

/* --- 14. Empty states ------------------------------------------------- */
.empty-state {
    text-align: center; padding: 2.5rem 1.5rem;
    border: 1px dashed var(--ae-border); border-radius: var(--ae-radius);
    background: var(--ae-bg-subtle);
}
.empty-state .empty-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 3rem; height: 3rem; border-radius: 50%;
    background: var(--ae-primary-light); color: var(--ae-primary);
    margin-bottom: 0.75rem;
}
.empty-state h3 { font-size: 1rem; margin-bottom: 0.3rem; }
.empty-state p { font-size: 0.88rem; color: var(--ae-muted); margin-bottom: 1rem; }

/* --- 15. Section headers ---------------------------------------------- */
.section-header {
    display: flex; justify-content: space-between; align-items: center;
    gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.section-header h2, .section-header h3 { margin-bottom: 0; }
.section-header .actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-left: auto; }

/* --- 16. Motion (HTMX swaps, page load) ------------------------------- */
@keyframes ae-fade-slide-up {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes ae-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ae-pop {
    0% { transform: scale(0.6); opacity: 0; }
    70% { transform: scale(1.06); }
    100% { transform: scale(1); opacity: 1; }
}
.anim-in { animation: ae-fade-slide-up 320ms var(--ae-ease) both; }
.anim-fade { animation: ae-fade-in 260ms ease both; }
.anim-pop { animation: ae-pop 420ms var(--ae-ease) both; }

@keyframes ae-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(0.85); }
}
.live-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: var(--ae-success); animation: ae-pulse 1.6s ease-in-out infinite;
}

/* --- 17. Quiz components (product core) ------------------------------- */
.quiz-progress {
    display: flex; justify-content: space-between; align-items: center;
    gap: 0.75rem; padding: 0.75rem 0 0.6rem; margin-bottom: 1rem;
    position: sticky; top: 0; z-index: 10;
    background: var(--pico-background-color, #fff);
    border-bottom: 1px solid var(--ae-border);
}
.quiz-progress .progress-label { font-size: 0.85rem; font-weight: 600; color: var(--ae-muted); white-space: nowrap; }
.quiz-progress .progress-track { flex: 1; max-width: 320px; }

.quiz-timer {
    font-size: 1.6rem; font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--ae-primary);
    display: inline-flex; align-items: center; gap: 0.4rem;
    transition: color var(--ae-t);
}
.quiz-timer.warning { color: var(--ae-danger); animation: ae-pulse 1.2s ease-in-out infinite; }
.quiz-timer.done { color: var(--ae-muted); animation: none; }

.question-text {
    font-size: 1.05rem; line-height: 1.65; margin-bottom: 1.25rem;
    color: var(--ae-text); white-space: pre-wrap;
}
.question-text code, .quiz-option-text code {
    background: #f1f5f9; padding: 0.1rem 0.35rem;
    border-radius: 4px; font-size: 0.92em;
}

.quiz-options { border: none; padding: 0; margin: 0 0 1.5rem; }
.quiz-option {
    display: flex; align-items: flex-start; gap: 0.75rem;
    padding: 0.85rem 1rem; margin: 0 0 0.6rem;
    border: 2px solid var(--ae-border); border-radius: var(--ae-radius);
    cursor: pointer; background: var(--ae-bg-card);
    transition: border-color var(--ae-t-fast), background var(--ae-t-fast),
                box-shadow var(--ae-t-fast), transform var(--ae-t-fast);
    font-size: 0.94rem; line-height: 1.55; color: var(--ae-text-soft);
}
.quiz-option:hover { border-color: var(--ae-primary-border); background: #fafaff; }
.quiz-option:focus-visible { outline: none; border-color: var(--ae-primary); box-shadow: 0 0 0 3px var(--ae-primary-focus); }
.quiz-option.selected {
    border-color: var(--ae-primary); background: var(--ae-primary-light);
    box-shadow: 0 0 0 2px var(--ae-primary), var(--ae-shadow-sm);
    transform: translateX(2px);
}
.quiz-option input[type="radio"] {
    appearance: none; -webkit-appearance: none;
    width: 20px; height: 20px; min-width: 20px;
    border: 2px solid var(--ae-faint); border-radius: 50%;
    margin: 2px 0 0; padding: 0; cursor: pointer;
    transition: border-color var(--ae-t-fast), background var(--ae-t-fast);
    background: #fff;
}
.quiz-option input[type="radio"]:checked {
    border-color: var(--ae-primary); background: var(--ae-primary);
    box-shadow: inset 0 0 0 3px #fff;
}
.quiz-option-label {
    flex-shrink: 0; width: 1.5rem; height: 1.5rem;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; background: var(--ae-bg-subtle);
    font-size: 0.75rem; font-weight: 700; color: var(--ae-muted);
    transition: background var(--ae-t-fast), color var(--ae-t-fast);
}
.quiz-option.selected .quiz-option-label { background: var(--ae-primary); color: #fff; }
.quiz-option-text { flex: 1; padding-top: 1px; white-space: pre-wrap; }

.quiz-submit {
    display: inline-flex; align-items: center; gap: 0.45rem;
    padding: 0.6rem 1.5rem; font-size: 0.9rem; font-weight: 600;
    border-radius: var(--ae-radius); cursor: pointer; width: auto;
}
.quiz-submit:disabled { opacity: 0.4; cursor: not-allowed; }

/* Score reveal (results) */
.score-ring {
    --pct: 0;
    width: 168px; height: 168px; border-radius: 50%;
    background: conic-gradient(var(--ae-primary) calc(var(--pct) * 1%), var(--ae-border) 0);
    display: inline-flex; align-items: center; justify-content: center;
}
.score-ring > .score-ring-inner {
    width: 138px; height: 138px; border-radius: 50%;
    background: var(--ae-bg-card);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.score-ring .score-big {
    font-size: 2.3rem; font-weight: 750; color: var(--ae-primary);
    line-height: 1.1; font-variant-numeric: tabular-nums;
}
.score-ring .score-sub { font-size: 0.8rem; color: var(--ae-muted); }

/* --- 18. Bar charts (pure CSS data-viz) ------------------------------- */
.bar-row { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.45rem; font-size: 0.84rem; }
.bar-row .bar-label { flex: 0 0 7.5rem; text-align: right; color: var(--ae-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .bar-track { flex: 1; height: 18px; background: var(--ae-bg-subtle); border-radius: 4px; overflow: hidden; }
.bar-row .bar-fill {
    height: 100%; background: var(--ae-primary); border-radius: 4px;
    min-width: 2px; transition: width 600ms var(--ae-ease);
}
.bar-row .bar-fill.success { background: var(--ae-success); }
.bar-row .bar-fill.warning { background: var(--ae-warning); }
.bar-row .bar-fill.danger { background: var(--ae-danger); }
.bar-row .bar-value { flex: 0 0 3.2rem; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ae-text-soft); }

/* --- 19. Toast (global HTMX error feedback) --------------------------- */
.toast {
    position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
    z-index: 10000; display: none; align-items: center; gap: 0.5rem;
    max-width: min(92vw, 480px);
    background: #1f2937; color: #f9fafb;
    padding: 0.7rem 1.1rem; border-radius: var(--ae-radius);
    font-size: 0.86rem; box-shadow: var(--ae-shadow-lg);
}
.toast.show { display: flex; animation: ae-fade-slide-up 240ms var(--ae-ease) both; }

/* --- 20. Utilities ----------------------------------------------------- */
.text-center { text-align: center; }
.text-muted { color: var(--ae-muted); }
.text-small { font-size: 0.85rem; }
.text-gradient {
    background: var(--ae-gradient);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
}
.flex { display: flex; align-items: center; gap: 0.5rem; }
.flex-wrap { flex-wrap: wrap; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }

/* --- 21. Print --------------------------------------------------------- */
@media print {
    .no-print, .top-nav, .toast, .skip-link { display: none !important; }
    body { font-size: 11pt; color: #000; }
    .container, .container.wide, .container.mid { max-width: 100%; padding: 0; }
    .card, table, .stat-card, .form-section { break-inside: avoid; box-shadow: none; }
    .badge { border: 1px solid #666 !important; background: none !important; color: #000 !important; }
    a { text-decoration: none; color: #000; }
    .print-header { display: block !important; }
}
.print-header { display: none; }

/* --- 22. Responsive ----------------------------------------------------- */
@media (max-width: 600px) {
    .container { padding: 1.25rem 0.75rem; }
    .field-grid { grid-template-columns: 1fr; }
    .quiz-timer { font-size: 1.25rem; }
    .quiz-option { padding: 1rem; font-size: 1rem; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .section-header .actions { margin-left: 0; }
    .quiz-progress .progress-track { max-width: 130px; }
}

/* --- 23. Reduced motion -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .spinner, .spin { animation-duration: 0.7s !important; animation-iteration-count: infinite !important; }
}
