/* ════════════════════════════════════════════════════════════════════════════════
   INGENIO — Design System
   A collegiate-clinical identity: ink, oxblood crimson and antique gold, built
   around the artifacts of a med-school exam — the answer sheet, the grade stamp,
   the chart tab. Serif for words, mono for data, generous room to breathe.
   ════════════════════════════════════════════════════════════════════════════════ */

/* ─── CSS Variables: Light Mode ──────────────────────────────────────────────── */
:root[data-theme="light"] {
    --bg-primary: #EDEEE7;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F1F2EB;
    --text-primary: #1B1F27;
    --text-secondary: #4C5160;
    --text-tertiary: #737684;
    --border-color: #DEDFD5;
    --border-light: #E9EAE2;

    --accent-primary: #7E2436;
    --accent-secondary: #9B2F45;
    --accent-light: #F2E0E3;
    --accent-gradient: linear-gradient(135deg, #7E2436 0%, #9B2F45 100%);
    --accent-rgb: 126, 36, 54;

    --gold: #976F29;
    --gold-light: #F0E2C2;
    --gold-rgb: 151, 111, 41;

    --success: #1F8B5C;
    --success-rgb: 31, 139, 92;
    --danger: #C0392B;
    --danger-rgb: 192, 57, 43;
    --warning: #B8801F;
    --warning-rgb: 184, 128, 31;
    --info: #2E6B9E;
    --info-rgb: 46, 107, 158;

    --shadow-sm: 0 1px 2px rgba(27, 31, 39, 0.06);
    --shadow-md: 0 4px 12px rgba(27, 31, 39, 0.08);
    --shadow-lg: 0 12px 28px rgba(27, 31, 39, 0.11);
    --shadow-xl: 0 24px 48px rgba(27, 31, 39, 0.16);
}

/* ─── CSS Variables: Dark Mode ──────────────────────────────────────────────── */
:root[data-theme="dark"] {
    --bg-primary: #10131A;
    --bg-secondary: #171B24;
    --bg-tertiary: #1F2530;
    --text-primary: #F1F1EA;
    --text-secondary: #C4C7D1;
    --text-tertiary: #888EA0;
    --border-color: #2B313D;
    --border-light: #232936;

    --accent-primary: #DD6B81;
    --accent-secondary: #E9879A;
    --accent-light: #36222A;
    --accent-gradient: linear-gradient(135deg, #DD6B81 0%, #E9879A 100%);
    --accent-rgb: 221, 107, 129;

    --gold: #D9A94D;
    --gold-light: #352A15;
    --gold-rgb: 217, 169, 77;

    --success: #45B884;
    --success-rgb: 69, 184, 132;
    --danger: #E0685F;
    --danger-rgb: 224, 104, 95;
    --warning: #D9A94D;
    --warning-rgb: 217, 169, 77;
    --info: #6BA3D6;
    --info-rgb: 107, 163, 214;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 14px 30px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 26px 50px rgba(0, 0, 0, 0.6);
}

/* ─── Fixed brand tokens (same in both themes — the masthead never changes) ──── */
:root {
    --navbar-bg: #14141C;
    --navbar-text: #ECEDE6;
    --navbar-text-dim: #9499AC;
    --navbar-border: #272A38;
    --navbar-accent: #E27288;
    --navbar-gold: #DCAE57;

    --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
    --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
}

/* ─── Global Styles ──────────────────────────────────────────────────────────── */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.72;
    transition: background-color 0.3s ease, color 0.3s ease;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
}

/* ─── Typography ─────────────────────────────────────────────────────────────── */
h1,
h2,
h3 {
    font-family: var(--font-display);
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: var(--space-2);
    letter-spacing: -0.02em;
}

h2 {
    font-size: 26px;
    margin-bottom: var(--space-3);
}

h3 {
    font-size: 20px;
    margin-bottom: var(--space-2);
}

.subtitle {
    color: var(--text-tertiary);
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: var(--space-6);
    max-width: 56ch;
}

/* ─── Universal page hero card ──────────────────────────────────────────────
   Drop <div class="page-hero"> around any page's h1 + eyebrow + subtitle.
   Renders a white card on the warm linen background, with an entrance
   animation and a subtle left-accent line in --accent-primary.
   Modifier: .page-hero--row  →  flex-row layout (title left, slot right).
   ────────────────────────────────────────────────────────────────────────── */
@keyframes heroFadeUp {
    from {
        opacity: 0;
        transform: translateY(14px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-hero {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-primary);
    border-radius: var(--radius-lg);
    padding: 32px 36px;
    margin-bottom: var(--space-7);
    position: relative;
    /* entrance — card slides up and fades in */
    animation: heroFadeUp 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* h1 inside hero — don't add extra margin-bottom, card padding handles it */
.page-hero h1 {
    margin-bottom: 0;
}

/* subtitle inside hero */
.page-hero .subtitle,
.page-hero .mastery-subtitle,
.page-hero .page-hero-sub {
    margin-bottom: 0;
    margin-top: var(--space-2);
}

/* eyebrow inside hero already has margin-bottom from .eyebrow rule */

/* row variant: title/eyebrow on left, an action slot on the right */
.page-hero--row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);
}

.page-hero--row .page-hero-left {
    flex: 1;
    min-width: 0;
}

.page-hero--row .page-hero-right {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* Generic top-level page containers (archive, results, review) that previously
   had no styling at all beyond the browser defaults. */
.archive-container,
.results-container,
.review-container {
    max-width: 100%;
}

.archive-container h1,
.results-container h1,
.review-container h1 {
    font-size: 32px;
}

/* page-hero h1 always uses the global 36px h1 size, regardless of container */
.archive-container .page-hero h1,
.results-container .page-hero h1,
.review-container .page-hero h1 {
    font-size: 36px;
}

.review-container>a:first-child {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: var(--space-4);
    transition: color 0.18s ease;
}

.review-container>a:first-child:hover {
    color: var(--accent-primary);
}

.score-summary {
    font-family: var(--font-mono);
    color: var(--text-secondary);
    font-size: 14px;
    margin: var(--space-2) 0 var(--space-6);
}

/* eyebrow / section label utility — small mono caps, used wherever a section
   needs a quiet data-sheet label above a serif heading */
.eyebrow {
    display: block;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-primary);
    margin-bottom: var(--space-2);
}

/* ─── Navbar (fixed masthead — does not change with light/dark theme) ───────── */
.navbar {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 20px;
    padding: 18px 44px;
    background: var(--navbar-bg);
    border-bottom: 1px solid var(--navbar-border);
    box-shadow: 0 1px 0 rgba(226, 114, 136, 0.18);
    position: sticky;
    top: 0;
    z-index: 500;
    overflow: visible;
    filter: none;
    transform: none;
    contain: none;
    isolation: auto;
}

.navbar-brand {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 600;
    color: var(--navbar-text);
    letter-spacing: 0.01em;
    display: flex;
    align-items: baseline;
    gap: 1px;
    position: relative;
    z-index: 2;
}

.navbar-brand:hover {
    color: var(--navbar-text);
    text-decoration: none;
}

.brand-i {
    font-style: italic;
    font-weight: 600;
    color: var(--navbar-accent);
}

.brand-dot {
    color: var(--navbar-gold);
}

.navbar-links {
    display: flex;
    align-items: center;
    gap: 28px;
    position: relative;
    z-index: 2;
    flex-wrap: nowrap;
    margin-left: auto;
}

.navbar-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
}

.navbar-link-group {
    display: contents;
}

.navbar-group-label {
    display: none;
}

.navbar-utilities {
    display: flex;
    align-items: center;
    gap: 16px;
}

.navbar-logout-form {
    display: inline;
    margin: 0;
}

.navbar-link-group a {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    color: var(--navbar-text-dim);
    transition: all 0.2s ease;
    position: relative;
}

.navbar-link-group a:hover {
    color: var(--navbar-text);
    text-decoration: none;
}

.navbar-link-group a::after {
    content: '';
    position: absolute;
    bottom: -19px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--navbar-accent);
    transition: width 0.25s ease;
}

.navbar-link-group a:hover::after {
    width: 100%;
}

.navbar-divider {
    width: 1px;
    height: 18px;
    background: var(--navbar-border);
}

.navbar-logout {
    background: none;
    border: 1px solid var(--navbar-border);
    border-radius: var(--radius-sm);
    color: var(--navbar-text-dim);
    font-family: var(--font-body);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 14px;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
    white-space: nowrap;
}

.navbar-logout:hover {
    border-color: var(--accent-secondary);
    color: #fff;
    background: rgba(126, 36, 54, 0.2);
}

.theme-toggle {
    background: none;
    border: none;
    font-size: 17px;
    cursor: pointer;
    color: var(--navbar-text-dim);
    transition: all 0.3s ease;
    padding: 6px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--navbar-gold);
    transform: rotate(20deg);
}

/* ─── Main Content ──────────────────────────────────────────────────────────── */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 52px 36px;
    width: 100%;
    min-width: 0;
    flex: 1 0 auto;
    overflow-x: clip;
}

/* ─── Alerts ─────────────────────────────────────────────────────────────────── */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    border-left: 4px solid;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
    box-shadow: var(--shadow-md);
    font-size: 14px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: rgba(var(--success-rgb), 0.1);
    border-left-color: var(--success);
    color: var(--success);
}

.alert-danger {
    background: rgba(var(--danger-rgb), 0.1);
    border-left-color: var(--danger);
    color: var(--danger);
}

.alert-warning {
    background: rgba(var(--warning-rgb), 0.1);
    border-left-color: var(--warning);
    color: var(--warning);
}

.alert-info {
    background: rgba(var(--info-rgb), 0.1);
    border-left-color: var(--info);
    color: var(--info);
}

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: var(--font-body);
    text-decoration: none;
    white-space: nowrap;
}

button[class*="btn"],
a[class*="btn"] {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

button[class*="btn"] svg,
a[class*="btn"] svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

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

.btn-primary {
    background: var(--accent-primary);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    text-decoration: none;
}

.btn-outline {
    background: transparent;
    color: var(--accent-primary);
    border: 1.5px solid var(--accent-primary);
}

.btn-outline:hover:not(:disabled) {
    background: var(--accent-primary);
    color: white;
    text-decoration: none;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1.5px solid transparent;
}

.btn-ghost:hover:not(:disabled) {
    background: var(--bg-secondary);
    color: var(--text-primary);
    text-decoration: none;
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1.5px solid var(--danger);
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger);
    color: white;
    text-decoration: none;
}

/* Color utility classes */
.text-danger {
    color: var(--danger);
}

.text-danger.btn-outline {
    color: var(--danger);
    border-color: var(--danger);
}

.text-danger.btn-outline:hover:not(:disabled) {
    background: var(--danger);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Plain unclassed .btn (e.g. "Back to Exam") */
.btn:not(.btn-primary):not(.btn-secondary):not(.btn-outline):not(.btn-danger):not(.btn-success) {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn:not(.btn-primary):not(.btn-secondary):not(.btn-outline):not(.btn-danger):not(.btn-success):hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    text-decoration: none;
}

.btn-full {
    width: 100%;
}

.btn-large {
    padding: 15px 34px;
    font-size: 15.5px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

/* ─── Forms ──────────────────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 22px;
}

.form-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
    margin-bottom: 0;
}

.form-row .form-group-wide {
    flex: 2 1 220px;
    min-width: 180px;
}

.form-row .form-group-narrow {
    flex: 0 0 96px;
    min-width: 72px;
    max-width: 120px;
}

label {
    display: block;
    margin-bottom: 9px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.015em;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14.5px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
    line-height: 1.5;
}

input:hover:not(:focus):not(:disabled),
select:hover:not(:focus):not(:disabled),
textarea:hover:not(:focus):not(:disabled) {
    border-color: color-mix(in srgb, var(--border-color) 55%, var(--accent-primary) 25%);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

.optional {
    color: var(--text-tertiary);
    font-size: 12px;
    font-weight: 400;
}

/* ─── Auth ───────────────────────────────────────────────────────────────────── */
.auth-container {
    display: flex;
    align-items: stretch;
    min-height: calc(100vh - 80px);
    overflow: hidden;
}

.auth-container>.auth-card {
    margin: auto;
    padding: 56px;
}

.auth-form-panel {
    flex: 1 1 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 48px 28px;
    animation: slideInLeft 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-36px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.auth-card {
    position: relative;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 56px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    isolation: isolate;
    z-index: 1;
}

/* Rotating gold ring */
.auth-card::before {
    content: "";
    position: absolute;
    width: 250%;
    height: 250%;
    left: -75%;
    top: -75%;
    background: conic-gradient(from 0deg,
            transparent 0deg,
            transparent 130deg,
            color-mix(in srgb, var(--navbar-accent) 70%, transparent) 148deg,
            var(--navbar-accent) 160deg,
            color-mix(in srgb, var(--navbar-accent) 70%, transparent) 172deg,
            transparent 190deg,
            transparent 310deg,
            color-mix(in srgb, var(--navbar-gold) 70%, transparent) 328deg,
            var(--navbar-gold) 340deg,
            color-mix(in srgb, var(--navbar-gold) 70%, transparent) 352deg,
            transparent 360deg);
    filter:
        drop-shadow(0 0 4px var(--navbar-gold)) drop-shadow(0 0 10px color-mix(in srgb, var(--navbar-gold) 80%, transparent)) drop-shadow(0 0 22px color-mix(in srgb, var(--navbar-gold) 60%, transparent)) drop-shadow(0 0 4px var(--navbar-accent)) drop-shadow(0 0 10px color-mix(in srgb, var(--navbar-accent) 80%, transparent)) drop-shadow(0 0 22px color-mix(in srgb, var(--navbar-accent) 60%, transparent));
    animation: authCardSpin 10s linear infinite;
    z-index: -2;
}

/* Inner fill — uses the card's own bg variable so light/dark both work */
.auth-card::after {
    content: "";
    position: absolute;
    inset: 2px;
    border-radius: calc(var(--radius-lg) - 2px);
    background: var(--bg-secondary);
    z-index: -1;
}

/* Keep content above the pseudo-elements */
.auth-card>* {
    position: relative;
    z-index: 1;
}

@keyframes authCardSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}




/* ─── Auth showcase panel (right side) ──────────────────────────────────────── */
.auth-showcase-panel {
    flex: 1 1 50%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: var(--bg-primary);

}

.auth-showcase-orbit {
    position: absolute;
    width: 380px;
    height: 380px;
    border: 1px solid var(--navbar-border);
    border-radius: 50%;
    opacity: 0.5;
    animation: orbitSpin 18s linear infinite;
}

.auth-showcase-orbit::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    width: 9px;
    height: 9px;
    margin-left: -5px;
    border-radius: 50%;
    background: var(--navbar-accent);
    box-shadow: 0 0 16px var(--navbar-accent);
}

.auth-showcase-orbit.orbit-outer {
    width: 460px;
    height: 460px;
    animation-duration: 26s;
    animation-direction: reverse;
    opacity: 0.3;
}

.auth-showcase-orbit.orbit-outer::before {
    background: var(--navbar-gold);
    box-shadow: 0 0 16px var(--navbar-gold);
}

@keyframes orbitSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.auth-showcase-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 0 40px;
}

.auth-wordmark {
    display: flex;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 62px;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.3;
    color: var(--navbar-text);
}

.auth-wordmark .wm-letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(28px) scale(0.85);
    animation: letterLoop 4.5s ease-in-out infinite;
}

.auth-wordmark .wm-letter.wm-i {
    font-style: italic;
    color: var(--navbar-accent);
}

.auth-wordmark .wm-letter:nth-child(1) {
    animation-delay: 0.00s;
}

.auth-wordmark .wm-letter:nth-child(2) {
    animation-delay: 0.08s;
}

.auth-wordmark .wm-letter:nth-child(3) {
    animation-delay: 0.16s;
}

.auth-wordmark .wm-letter:nth-child(4) {
    animation-delay: 0.24s;
}

.auth-wordmark .wm-letter:nth-child(5) {
    animation-delay: 0.32s;
}

.auth-wordmark .wm-letter:nth-child(6) {
    animation-delay: 0.40s;
}

.auth-wordmark .wm-letter:nth-child(7) {
    animation-delay: 0.48s;
    color: var(--navbar-gold);
}

@keyframes letterLoop {
    0% {
        opacity: 0;
        transform: translateY(28px) scale(0.85);
        filter: blur(4px);
    }

    14% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }

    45% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }

    65% {
        opacity: 1;
        transform: translateY(-6px) scale(1.04);
        filter: blur(0);
    }

    85% {
        opacity: 0.85;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }

    100% {
        opacity: 0;
        transform: translateY(-18px) scale(0.92);
        filter: blur(3px);
    }
}

.auth-showcase-tagline {
    margin-top: 16px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--navbar-text-dim);
}

.auth-showcase-bars {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 5px;
    margin-top: 28px;
    height: 18px;
}

.auth-showcase-bars span {
    width: 4px;
    height: 100%;
    border-radius: 2px;
    background: var(--navbar-accent);
    opacity: 0.85;
    transform-origin: bottom;
    animation: barPulse 1.8s ease-in-out infinite;
}

.auth-showcase-bars span:nth-child(1) {
    animation-delay: 0s;
}

.auth-showcase-bars span:nth-child(2) {
    animation-delay: 0.15s;
}

.auth-showcase-bars span:nth-child(3) {
    animation-delay: 0.3s;
    background: var(--navbar-gold);
}

.auth-showcase-bars span:nth-child(4) {
    animation-delay: 0.45s;
}

.auth-showcase-bars span:nth-child(5) {
    animation-delay: 0.6s;
}

@keyframes barPulse {

    0%,
    100% {
        transform: scaleY(0.35);
        opacity: 0.45;
    }

    50% {
        transform: scaleY(1);
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {

    .auth-form-panel,
    .auth-showcase-orbit,
    .auth-wordmark .wm-letter,
    .auth-showcase-bars span,
    .auth-card::before {
        animation: none !important;
    }

    .auth-wordmark .wm-letter {
        opacity: 1;
        transform: none;
        filter: none;
    }
}

/* ─── Auth showcase phase cards (centered below the auth panels) ───────────── */
.auth-phases-section {
    display: flex;
    justify-content: center;
    padding: 60px 28px 72px;
    background: var(--bg-primary);
}

.auth-phases {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: stretch;
    gap: 108px;
    justify-content: center;
    width: 100%;
    max-width: 1400px;
}

.auth-phase-card {
    /* keep a fixed width so increasing gap doesn't shrink cards */
    flex: 0 0 350px;
    width: 350px;
    display: flex;
    flex-direction: column;
    position: relative;
    padding: 30px 28px 28px;
    border-radius: var(--radius-lg);
    /* match the login card background */
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    /* remove expensive backdrop-filter from moving elements */
    /* backdrop-filter: blur(6px); */
    box-shadow: var(--shadow-lg);
    opacity: 0;
    /* promote to compositor and hint the browser to optimize for transforms */
    will-change: transform, opacity;
    backface-visibility: hidden;
    transform: translate3d(0, 22px, 0);
    animation: phaseCardIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards,
        phaseCardFloat 6s ease-in-out infinite;
    animation-delay: var(--phase-delay, 0s), calc(var(--phase-delay, 0s) + 1.2s);
    transition: border-color 0.3s ease, background 0.3s ease;
}

.auth-phase-card:hover {
    border-color: color-mix(in srgb, var(--navbar-accent) 55%, var(--navbar-border));
    background: color-mix(in srgb, var(--navbar-text) 9%, transparent);
}

.auth-phase-card:nth-child(1) {
    --phase-delay: 0.15s;
}

.auth-phase-card:nth-child(2) {
    --phase-delay: 0.32s;
}

.auth-phase-card:nth-child(3) {
    --phase-delay: 0.49s;
}

@keyframes phaseCardIn {
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes phaseCardFloat {

    0%,
    100% {
        transform: translate3d(0, 0, 0);
    }

    50% {
        transform: translate3d(0, -4px, 0);
    }
}

.auth-phase-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
}

.auth-phase-icon {
    flex: none;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: var(--navbar-accent);
    background: color-mix(in srgb, var(--navbar-accent) 14%, transparent);
    animation: phaseIconPulse 3.2s ease-in-out infinite;
    animation-delay: var(--phase-delay, 0s);
}

.auth-phase-card:nth-child(2) .auth-phase-icon {
    color: var(--navbar-gold);
    background: color-mix(in srgb, var(--navbar-gold) 14%, transparent);
}

.auth-phase-card:nth-child(3) .auth-phase-icon {
    color: var(--navbar-accent);
    background: color-mix(in srgb, var(--navbar-accent) 14%, transparent);
}

.auth-phase-icon svg {
    width: 21px;
    height: 21px;
}

@keyframes phaseIconPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 35%, transparent);
    }

    50% {
        box-shadow: 0 0 0 7px color-mix(in srgb, currentColor 0%, transparent);
    }
}

.auth-phase-title {
    font-family: var(--font-display);
    font-size: 16.5px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--navbar-text);
    margin: 0 0 4px;
}

.auth-phase-objective {
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--navbar-text-dim);
    margin: 0;
}

.auth-phase-stats {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--navbar-border);
}

.stat-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--navbar-border);
}

.stat-label {
    font-size: 12.5px;
    color: var(--navbar-text-dim);
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--navbar-text);
    white-space: nowrap;
}

.stat-value.stat-highlight {
    color: var(--navbar-gold);
}

.auth-phase-badges {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.phase-badge {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 12px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--navbar-text) 4%, transparent);
    border: 1px solid var(--navbar-border);
}

.phase-badge-label {
    font-size: 10.5px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--navbar-text-dim);
}

.phase-badge-value {
    font-family: var(--font-mono);
    font-size: 12.5px;
    font-weight: 600;
}

.phase-badge-good .phase-badge-value {
    color: var(--success);
}

.phase-badge-warn .phase-badge-value {
    color: var(--danger);
}

.auth-phase-modes {
    font-size: 12px;
    line-height: 1.5;
    color: var(--navbar-text-dim);
}

.auth-phase-question {
    margin: auto 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--navbar-border);
    font-family: var(--font-display);
    font-style: italic;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--navbar-text-dim);
}

@media (prefers-reduced-motion: reduce) {
    .auth-phase-card {
        animation: none !important;
        opacity: 1;
        transform: none;
    }

    .auth-phase-icon {
        animation: none !important;
    }
}

@media (max-width: 900px) {
    .auth-showcase-panel {
        display: none;
    }
}

@media (max-width: 980px) {
    .auth-phases {
        flex-direction: column;
        align-items: stretch;
        max-width: 480px;
    }
}

/* ─── About jump link (inside the login card, visible on every viewport) ── */
.auth-about-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin: 14px auto 0;
    width: fit-content;
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.auth-about-link:hover {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
    background: color-mix(in srgb, var(--accent-primary) 8%, transparent);
}

.auth-about-link svg {
    width: 13px;
    height: 13px;
    flex: none;
}

/* ─── Supporting tools section (below the three phase cards) ────────────── */
.auth-tools-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    padding: 8px 28px 80px;
    background: var(--bg-primary);
}

.auth-tools-intro {
    text-align: center;
    max-width: 520px;
}

.auth-tools-title {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.auth-tools-sub {
    font-size: 13.5px;
    color: var(--text-tertiary);
}

.auth-tools {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
    gap: 20px;
    width: 100%;
    max-width: 1180px;
}

.auth-tool-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 20px;
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.auth-tool-icon {
    flex: none;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: var(--navbar-accent);
    background: color-mix(in srgb, var(--navbar-accent) 14%, transparent);
}

.auth-tool-card:nth-child(2) .auth-tool-icon {
    color: var(--navbar-gold);
    background: color-mix(in srgb, var(--navbar-gold) 14%, transparent);
}

.auth-tool-icon svg {
    width: 19px;
    height: 19px;
}

.auth-tool-title {
    font-family: var(--font-display);
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.auth-tool-desc {
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--text-tertiary);
}

@media (max-width: 900px) {
    .auth-tools {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-width: 700px;
    }
}

@media (max-width: 560px) {
    .auth-tools {
        grid-template-columns: 1fr;
        max-width: 480px;
    }
}

.auth-logo {
    text-align: center;
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.logo-i {
    font-style: italic;
    font-weight: 600;
    color: var(--accent-primary);
}

.logo-name {
    letter-spacing: 0.04em;
}

.auth-tagline {
    text-align: center;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    font-size: 11.5px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-top: 6px;
}

.auth-title {
    text-align: center;
    margin: 32px 0 24px;
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 600;
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 13.5px;
    color: var(--text-tertiary);
}

.auth-switch a {
    color: var(--accent-primary);
    font-weight: 600;
}

/* ─── Cards & Grid ──────────────────────────────────────────────────────────── */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
    gap: 20px;
    margin-top: 24px;
}

.card,
.module-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--accent-primary);
    border-radius: var(--radius-lg);
    padding: 26px 28px;
    color: var(--text-primary);
    transition: all 0.24s ease;
    cursor: pointer;
    display: block;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}

.card:hover,
.module-card:hover {
    transform: translateY(-4px);
    border-left-color: var(--gold);
    box-shadow: var(--shadow-lg);
    text-decoration: none;
}

.card-title {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 600;
    margin-bottom: 7px;
    color: var(--text-primary);
    line-height: 1.3;
}

.card-subtitle,
.card-meta {
    color: var(--text-tertiary);
    font-size: 14px;
    margin-top: 4px;
    line-height: 1.5;
}

.card-shortcut-note {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-color);
}

.card-header {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.badge {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
    background: var(--bg-tertiary);
    color: var(--accent-primary);
    border: 1px solid var(--border-color);
}

.badge-success {
    background: rgba(var(--success-rgb), 0.1);
    color: var(--success);
    border-color: rgba(var(--success-rgb), 0.3);
}

.badge-danger {
    background: rgba(var(--danger-rgb), 0.1);
    color: var(--danger);
    border-color: rgba(var(--danger-rgb), 0.3);
}

.badge-warning {
    background: rgba(var(--warning-rgb), 0.1);
    color: var(--warning);
    border-color: rgba(var(--warning-rgb), 0.3);
}

.result-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-mono);
    margin-left: 10px;
}

.result-badge.badge-correct {
    background: rgba(var(--success-rgb), 0.12);
    color: var(--success);
}

.result-badge.badge-incorrect {
    background: rgba(var(--danger-rgb), 0.12);
    color: var(--danger);
}

.year-header {
    margin-top: 36px;
    margin-bottom: 16px;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--accent-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.module-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 16px 20px;
}

/* ─── Exam Detail ────────────────────────────────────────────────────────────── */
.exam-detail-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--accent-primary);
    border-radius: var(--radius-lg);
    padding: 36px;
    margin-top: 24px;
    box-shadow: var(--shadow-md);
}

.exam-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: 20px;
    margin: 24px 0;
}

.exam-meta-grid .label {
    color: var(--text-tertiary);
    display: block;
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.exam-meta-grid .value {
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 6px;
}

.mode-buttons {
    display: flex;
    gap: 16px;
    margin-top: 24px;
}

.mode-option {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-tertiary);
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-color);
    flex: 1;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.mode-option input[type="radio"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

/* ─── Tables ─────────────────────────────────────────────────────────────────── */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

thead {
    background: var(--bg-tertiary);
}

th,
td {
    text-align: left;
    padding: 15px 18px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

th {
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 11.5px;
}

tr:hover {
    background: var(--bg-tertiary);
}

/* ─── Exam Taking Interface ──────────────────────────────────────────────────── */
.exam-sticky-header {
    position: sticky;
    top: 80px;
    z-index: 50;
    margin-bottom: 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.exam-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 16px 20px;
}

.topbar-left {
    flex: 1;
    min-width: 0;
}

.exam-title-section {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.exam-title {
    font-family: var(--font-display);
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.progress-badge {
    display: inline-flex;
    align-items: center;
    background: var(--accent-gradient);
    color: white;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 6px -2px rgba(var(--accent-rgb), 0.35);
}

.topbar-center {
    flex: 2;
    min-width: 180px;
    padding: 0 8px;
}

.exam-progress-bar-compact {
    height: 9px;
    background: var(--bg-tertiary);
    border-radius: 999px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.exam-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), color-mix(in srgb, var(--accent-primary) 65%, var(--gold)));
    border-radius: 999px;
    transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 0 8px -1px rgba(var(--accent-rgb), 0.5);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}

.topbar-right .btn-sm {
    border-radius: 999px;
    padding: 8px 18px;
}

.timer-section {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 7px 14px;
}

.timer-label {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.exam-timer {
    font-size: 17px;
    font-weight: 600;
    color: var(--accent-primary);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.timer-warning {
    color: var(--warning);
    animation: pulse 1s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.question-nav-wrapper {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 22px 18px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
}

.question-nav-label {
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    white-space: nowrap;
}

.question-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 132px;
    overflow-y: auto;
}

.question-nav-item {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.18s cubic-bezier(.22, 1, .36, 1), border-color 0.18s ease, color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
    position: relative;
}

.question-nav-item:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: scale(1.08);
}

.question-nav-item.answered {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.question-nav-item.flagged::after {
    content: '';
    position: absolute;
    top: -3px;
    right: -3px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gold);
    border: 2px solid var(--bg-tertiary);
}

.question-nav-item.current {
    box-shadow: 0 0 0 2px var(--bg-tertiary), 0 0 0 4px var(--accent-primary), 0 0 10px -2px rgba(var(--accent-rgb), 0.5);
}

.question-block {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 30px;
    margin-bottom: 24px;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.question-block:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
}

.question-block.page-enter {
    animation: questionFadeIn 0.32s cubic-bezier(.22, 1, .36, 1) both;
}

@keyframes questionFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .question-block.page-enter {
        animation: none;
    }
}

.question-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.question-number {
    font-family: var(--font-mono);
    color: var(--accent-primary);
    font-weight: 600;
    font-size: 14.5px;
}

.question-text {
    font-size: 16.5px;
    line-height: 1.65;
}

.question-type-badge {
    background: var(--bg-tertiary);
    padding: 4px 11px;
    border-radius: 5px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.flag-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.flag-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.flag-btn.flagged {
    background: var(--gold);
    color: white;
    border-color: var(--gold);
}

.answers-list {
    display: flex;
    flex-direction: column;
    gap: 11px;
    margin-top: 18px;
}

.answer-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 18px;
    background: var(--bg-tertiary);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
    font-size: 15px;
}

.answer-option:hover {
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
    transform: scale(1.006);
    box-shadow: var(--shadow-sm);
}

.answer-option:has(input:checked) {
    border-color: var(--accent-primary);
    background: color-mix(in srgb, var(--bg-secondary) 90%, var(--accent-primary) 10%);
    box-shadow: 0 0 0 1px var(--accent-primary), 0 4px 12px -6px rgba(var(--accent-rgb), 0.3);
}

.answer-option input {
    width: auto;
    margin: 0;
    cursor: pointer;
    accent-color: var(--accent-primary);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin: 32px 0 16px;
    padding: 12px;
}

.pagination-btn-edge {
    font-weight: 700;
}

.pagination-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-decoration: none;
    transition: border-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.pagination-page:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.pagination-page.is-current {
    background: var(--accent-gradient);
    border-color: var(--accent-primary);
    color: white;
    box-shadow: 0 4px 12px -4px rgba(var(--accent-rgb), 0.4);
}

.pagination-ellipsis {
    padding: 0 4px;
    color: var(--text-secondary);
    font-size: 14px;
}

.exam-bottom-actions {
    text-align: center;
    padding: 32px 0;
}

/* ─── Results & the grade stamp ──────────────────────────────────────────────── */
.score-card {
    text-align: center;
    padding: 56px 48px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin: 28px 0;
    box-shadow: var(--shadow-lg);
}

/* The signature "grade stamp" — a hand-stamped seal for the score that matters. */
.score-big {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 164px;
    height: 164px;
    margin: 0 auto 24px;
    border-radius: 50%;
    border: 3px solid var(--accent-primary);
    outline: 1.5px solid var(--accent-primary);
    outline-offset: -10px;
    transform: rotate(-5deg);
    color: var(--accent-primary);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    letter-spacing: -0.02em;
    background: radial-gradient(circle at 50% 32%, rgba(var(--accent-rgb), 0.07) 0%, transparent 72%);
    box-shadow: 0 0 32px rgba(var(--accent-rgb), 0.08);
    transition: transform 0.3s cubic-bezier(.22, 1, .36, 1);
}

.score-card:hover .score-big {
    transform: rotate(-1.5deg) scale(1.035);
}

.score-mode {
    color: var(--text-tertiary);
    margin-top: 14px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Shared by any page that animates a number counting up on load */
.count-up {
    font-variant-numeric: tabular-nums;
}

.comparison-card,
.share-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.comparison-card p,
.share-section p {
    margin-bottom: 10px;
    font-size: 15px;
}

.comparison-card p:last-child,
.share-section p:last-child {
    margin-bottom: 0;
}

.actions-row {
    display: flex;
    gap: 16px;
    margin: 28px 0;
    flex-wrap: wrap;
}

/* ─── Review ─────────────────────────────────────────────────────────────────── */
.review-question {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 30px;
    margin-bottom: 22px;
    border-left: 4px solid var(--border-color);
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.review-question:hover {
    box-shadow: var(--shadow-md);
}

.review-question.correct {
    border-left-color: var(--success);
    background: rgba(var(--success-rgb), 0.04);
}

.review-question.incorrect {
    border-left-color: var(--danger);
    background: rgba(var(--danger-rgb), 0.04);
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.review-header-left {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.time-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 3px 10px;
}

.badge-correct {
    color: var(--success);
    font-weight: 700;
}

.badge-incorrect {
    color: var(--danger);
    font-weight: 700;
}

.answer-review {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    background: var(--bg-tertiary);
    border-left: 3px solid var(--border-color);
    font-size: 14.5px;
}

.is-correct-answer {
    border-left-color: var(--success);
    background: rgba(var(--success-rgb), 0.08);
}

.is-wrong-selected {
    border-left-color: var(--danger);
    background: rgba(var(--danger-rgb), 0.08);
}

.explanation-box,
.note-box {
    margin-top: 16px;
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-primary);
}

.explanation-box summary,
.note-box summary {
    cursor: pointer;
    color: var(--accent-primary);
    font-size: 13.5px;
    font-weight: 700;
    user-select: none;
}

.explanation-box summary:hover,
.note-box summary:hover {
    color: var(--accent-secondary);
}

.reference {
    color: var(--text-tertiary);
    font-size: 12px;
    margin-top: 12px;
    font-style: italic;
}

/* ─── Admin ──────────────────────────────────────────────────────────────────── */
.admin-container h1 {
    font-size: 28px;
    margin-bottom: 24px;
}

.admin-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    margin: 24px 0;
    overflow: visible;
}

.main-content.admin-hospital-v2-content {
    max-width: none;
    width: 100%;
    padding: 36px clamp(24px, 4vw, 56px) 64px;
    overflow: visible;
}

.admin-hospital-v2-content .admin-section .form-row {
    display: grid;
    gap: 16px 18px;
    align-items: end;
}

.admin-hospital-v2-content .admin-section .admin-form-identity {
    grid-template-columns: minmax(140px, 0.9fr) minmax(180px, 1.3fr) minmax(180px, 1.3fr) 92px 88px;
}

.admin-hospital-v2-content .admin-section .admin-form-copy {
    grid-template-columns: 1fr 1fr;
}

.admin-hospital-v2-content .admin-section .form-row .form-group,
.admin-hospital-v2-content .admin-section .form-row .form-group-wide,
.admin-hospital-v2-content .admin-section .form-row .form-group-narrow {
    min-width: 0;
    max-width: none;
    flex: unset;
    width: auto;
    margin-bottom: 0;
}

.admin-hospital-v2-content .table-scroll-horizontal {
    border: none;
    border-radius: 0;
}

.admin-stat-group {
    margin: 8px 0 32px;
}

.admin-stat-group > h2 {
    margin: 0 0 4px;
    font-size: 18px;
}

.admin-stat-group .stats-grid {
    margin: 12px 0 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 18px;
    margin: 28px 0;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--accent-primary);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    text-align: center;
    transition: all 0.22s ease;
    box-shadow: var(--shadow-sm);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-top-color: var(--gold);
    box-shadow: var(--shadow-lg);
}

.stat-card--warn {
    border-top-color: var(--danger);
}

.dashboard-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.stat-number {
    font-family: var(--font-mono);
    font-size: 34px;
    font-weight: 700;
    color: var(--accent-primary);
    line-height: 1;
}

.admin-analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin: 16px 0 12px;
}

.admin-analytics-stat {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 14px;
}

.admin-analytics-value {
    display: block;
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 700;
    color: var(--accent-primary);
    line-height: 1.2;
}

.admin-analytics-label {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.admin-analytics-meta {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-tertiary);
}

.admin-subheading {
    margin: 18px 0 8px;
    font-size: 14px;
    font-weight: 600;
}

.admin-analytics-list {
    margin: 0;
    padding-left: 20px;
    line-height: 1.55;
}

.admin-patient-handover-card {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.admin-patient-handover-card:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.stat-label {
    color: var(--text-tertiary);
    font-size: 12px;
    margin-top: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.admin-agency-preview {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 18px;
    margin: 16px 0 24px;
    background: var(--bg-tertiary);
}

.admin-agency-preview h3,
.admin-agency-card-head h3 {
    margin: 0 0 8px;
    font-size: 16px;
}

.admin-agency-preview-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    margin: 10px 0 14px;
}

.admin-agency-preview-card {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    background: var(--bg-secondary);
    font-size: 13px;
    line-height: 1.4;
}

.admin-agency-preview-card strong {
    font-size: 14px;
}

.admin-agency-preview-list {
    margin: 8px 0 14px;
    padding-left: 0;
    list-style: none;
}

.admin-agency-block {
    display: grid;
    gap: 8px;
    margin: 0 0 20px;
}

.admin-agency-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 18px 14px;
    margin: 0;
    overflow: visible;
}

.admin-agency-card .form-row {
    margin-top: 12px;
}

.admin-agency-card-head {
    margin-bottom: 4px;
}

.admin-agency-kicker {
    margin: 0 0 4px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.admin-agency-flag {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
}

.admin-agency-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.admin-agency-delete {
    margin: 0;
    justify-self: start;
}

.admin-replay-path {
    list-style: none;
    margin: 12px 0 20px;
    padding: 0;
    display: grid;
    gap: 8px;
}

.admin-replay-step {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: baseline;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.admin-replay-step time {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-tertiary);
}

.admin-replay-kind {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.admin-replay-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin: 8px 0 20px;
}

.admin-replay-grid h3 {
    margin: 0 0 8px;
    font-size: 15px;
}

.admin-table {
    width: 100%;
    margin-top: 0;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    vertical-align: middle;
    padding: 10px 12px;
}

.admin-table td.admin-actions-cell {
    width: 1%;
    white-space: nowrap;
    vertical-align: middle;
}

.admin-table .admin-row-actions {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.admin-table .admin-row-actions form {
    display: inline-flex;
    margin: 0;
    width: auto;
    flex: 0 0 auto;
}

.admin-table .admin-row-actions .btn,
.admin-table .admin-row-actions form .btn {
    width: auto;
    min-width: 0;
    flex: 0 0 auto;
    display: inline-flex;
}

.table-scroll-horizontal {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.table-scroll-horizontal table {
    margin-top: 0;
}

.table-scroll-horizontal .admin-table {
    margin-bottom: 0;
    min-width: 720px;
}

.form-group-narrow {
    flex: 0 0 110px;
    min-width: 88px;
}

.dashboard-panel {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
}

.dashboard-panel h3 {
    margin: 0 0 12px;
    font-size: 16px;
}

.dashboard-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}

.dashboard-list li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.dashboard-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.empty-state-inline {
    color: var(--text-tertiary);
    font-size: 14px;
}

.question-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin-bottom: 16px;
    transition: all 0.2s ease;
}

.question-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
}

.question-header {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.answer-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.answer-row input[type="text"] {
    flex: 1;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    cursor: pointer;
}

.tags-section {
    margin: 16px 0;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.tags-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.tag-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-bottom: 12px;
}

.tag-checkbox {
    font-size: 13px;
    color: var(--text-primary);
}

.checkbox-label input {
    width: auto;
    margin: 0;
    accent-color: var(--accent-primary);
}

/* ─── Discussions ────────────────────────────────────────────────────────────── */
.discussions-section {
    margin-top: 32px;
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
}

.comment-form {
    margin-bottom: 24px;
    background: var(--bg-tertiary);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.comment-input {
    min-height: 100px;
    margin-bottom: 12px;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.comment-item {
    display: flex;
    gap: 16px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.3);
}

.comment-content {
    flex: 1;
    background: var(--bg-secondary);
    padding: 18px 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.comment-user {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
}

.comment-date {
    color: var(--text-tertiary);
    font-size: 12px;
}

.comment-text {
    font-size: 14px;
    white-space: pre-wrap;
    color: var(--text-secondary);
    line-height: 1.6;
}

.comment-actions {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    font-size: 12px;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    font-weight: 600;
    transition: all 0.2s ease;
}

.action-btn:hover {
    color: var(--accent-primary);
}

.action-btn.active {
    color: var(--accent-secondary);
}

.replies-list {
    margin-top: 16px;
    margin-left: 24px;
    border-left: 2px solid var(--accent-primary);
    padding-left: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.reply-form-container {
    margin-top: 12px;
    display: none;
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: var(--radius-sm);
}

.reply-form-container.active {
    display: block;
}

/* ─── Bookmarks ──────────────────────────────────────────────────────────────── */
.bookmark-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 22px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 6px;
    line-height: 1;
    border-radius: var(--radius-sm);
}

.bookmark-btn:hover {
    transform: scale(1.15);
    color: var(--gold);
    background: var(--bg-tertiary);
}

.bookmark-btn.active {
    color: var(--gold);
}

.bookmarks-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 24px;
}

.bookmark-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.bookmark-card:hover {
    border-color: var(--gold);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.bookmark-info {
    flex: 1;
}

.bookmark-exam-title {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 600;
}

.bookmark-question-text {
    font-size: 15px;
    margin-top: 7px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-primary);
    line-height: 1.5;
}

/* ─── Collapsible Discussion ─────────────────────────────────────────────────── */
.discussion-details {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    overflow: hidden;
    margin-top: 18px;
}

.discussion-summary {
    padding: 16px 22px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    list-style: none;
    font-weight: 700;
    font-size: 14.5px;
    color: var(--accent-primary);
    background: var(--bg-tertiary);
    transition: all 0.2s ease;
    user-select: none;
}

.discussion-summary::-webkit-details-marker {
    display: none;
}

.discussion-summary:hover {
    background: var(--border-color);
}

.discussion-content {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.comment-count-badge {
    background: var(--accent-primary);
    color: white;
    font-family: var(--font-mono);
    padding: 3px 11px;
    border-radius: 12px;
    font-size: 11.5px;
    font-weight: 700;
}

.discussion-title::before {
    content: '💬 ';
    margin-right: 6px;
}

/* ─── Improved Explanations ──────────────────────────────────────────────────── */
.explanation-container {
    margin-top: 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--accent-primary);
    border-radius: var(--radius-sm);
    padding: 20px;
    position: relative;
}

.explanation-label {
    position: absolute;
    top: -12px;
    left: 20px;
    background: var(--bg-primary);
    padding: 0 8px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 700;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.explanation-content {
    font-size: 14.5px;
    line-height: 1.7;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.explanation-reference {
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
    font-size: 12px;
    color: var(--text-tertiary);
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ref-icon {
    font-style: normal;
    font-size: 14px;
}

/* ─── Collapsible Explanation Toggle ─────────────────────────────────────────── */
.explanation-details {
    margin-top: 16px;
}

.explanation-summary {
    display: inline-block;
    padding: 8px 18px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 700;
    font-size: 12.5px;
    line-height: 1.65;
    box-sizing: border-box;
    transition: transform 0.18s cubic-bezier(.22, 1, .36, 1), box-shadow 0.18s ease;
    user-select: none;
}

.explanation-summary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px -4px rgba(var(--accent-rgb), 0.4);
}

.explanation-summary::marker {
    display: none;
}

.explanation-details[open] .explanation-summary {
    border-radius: 999px 999px 0 0;
}

/* ─── Explain with AI button ─────────────────────────────────────────────────── */
.ai-explain-btn {
    background: var(--accent-gradient);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font: inherit;
    font-weight: 700;
    font-size: 12.5px;
    margin: 0;
    vertical-align: top;
}

.ai-explain-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.ai-explain-remaining {
    font-weight: 500;
    opacity: 0.85;
    font-size: 11px;
}

.ai-explain-spinner {
    display: inline-block;
}

.ai-explain-report-link {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 11.5px;
    cursor: pointer;
    padding: 6px 0 0;
    text-decoration: underline;
    display: block;
}

.ai-explain-report-link:hover {
    color: var(--text-secondary, #555);
}

.ai-explain-report-form {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    align-items: flex-start;
}

.ai-explain-report-text {
    flex: 1;
    font-size: 12.5px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid var(--border-color, #ddd);
    resize: vertical;
    font-family: inherit;
}

.ai-explain-report-submit {
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 999px;
    border: none;
    background: var(--accent-gradient);
    color: white;
    font-weight: 700;
    cursor: pointer;
}

.ai-explain-report-done {
    margin-top: 6px;
    font-size: 11.5px;
    color: var(--success, #2e7d32);
}


/* ─── Filter Section ─────────────────────────────────────────────────────────── */
.filters-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--accent-primary);
    padding: 1.5rem 1.75rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.filters-title {
    color: var(--accent-primary);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1.1rem;
    display: block;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 1rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.filter-label {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-select {
    padding: 0.65rem 0.85rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-select:hover {
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}

.filter-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.filter-select option:checked,
.filter-select option:hover,
.filter-select option:focus {
    background: var(--accent-light);
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .filters-grid {
        grid-template-columns: 1fr;
    }
}

/* ─── Responsive Design ──────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .main-content {
        padding: 28px 18px;
    }

    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
        gap: 16px;
    }

    .exam-meta-grid {
        grid-template-columns: 1fr;
    }

    .mode-buttons {
        flex-direction: column;
    }

    .form-row {
        flex-direction: column;
    }

    .form-row .form-group {
        min-width: 100%;
    }

    .admin-hospital-v2-content .admin-section .form-row {
        grid-template-columns: 1fr;
    }

    .auth-card {
        padding: 32px 20px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .exam-sticky-header {
        position: static;
        border-radius: var(--radius-md);
    }

    .exam-topbar {
        flex-wrap: wrap;
        padding: 14px 16px;
        gap: 12px;
    }

    .topbar-center {
        order: 3;
        flex: 1 1 100%;
        min-width: 100%;
        padding: 0;
    }

    .question-nav-wrapper {
        padding: 12px 16px 14px;
    }

    .question-nav-item {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .question-nav {
        max-height: 84px;
    }
}


/* ─── Password Toggle ────────────────────────────────────────────────────── */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    padding-right: 40px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    width: 28px;
    height: 28px;
}

.password-toggle:hover {
    color: var(--accent-primary);
}

.password-toggle:active {
    transform: translateY(-50%) scale(0.95);
}

.password-icon-eye,
.password-icon-eye-off {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

/* ─── Auth Page Light Mode Override ──────────────────────────────────────── */
.auth-container {
    background: var(--bg-primary);
}

.auth-form-panel {
    background: var(--bg-primary);
}

.auth-card {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

/* ─── SRS and New Features ────────────────────────────────────────────────── */
.srs-badge {
    background: var(--accent-primary);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 4px;
    vertical-align: middle;
}

.question-stats {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-tertiary);
    margin-left: 10px;
}

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

.btn-outline-warning {
    border: 1px solid var(--warning);
    color: var(--warning);
    background: transparent;
}

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

.priority-high {
    border-left: 4px solid var(--danger);
}

.priority-normal {
    border-left: 4px solid var(--warning);
}

.priority-low {
    border-left: 4px solid var(--info);
}

/* ════════════════════════════════════════════════════════════════════════════
   "Your university" / "your year" — primary + collapsible secondary content
   ════════════════════════════════════════════════════════════════════════════ */

/* Soft tint palette used to visually tell universities apart once the list
   expands beyond the student's own school. Six hues, tuned separately for
   light/dark so they stay quiet rather than competing with the brand accent. */
:root[data-theme="light"] {
    --tint-1-bg: #EAF2FB;
    --tint-1-border: #BFD8F2;
    --tint-2-bg: #FBF1E4;
    --tint-2-border: #F0DAB6;
    --tint-3-bg: #EAF7EE;
    --tint-3-border: #BFE3CB;
    --tint-4-bg: #F6EAF8;
    --tint-4-border: #DEC0E8;
    --tint-5-bg: #FCEAF0;
    --tint-5-border: #F1C2D2;
    --tint-6-bg: #EAF6F6;
    --tint-6-border: #BCE0E0;
}

:root[data-theme="dark"] {
    --tint-1-bg: #16202E;
    --tint-1-border: #28415E;
    --tint-2-bg: #241D14;
    --tint-2-border: #4A3A22;
    --tint-3-bg: #142A1D;
    --tint-3-border: #25503A;
    --tint-4-bg: #221A28;
    --tint-4-border: #432F4C;
    --tint-5-bg: #2A1820;
    --tint-5-border: #50293A;
    --tint-6-bg: #142625;
    --tint-6-border: #234B49;
}

/* Hero card for the student's own university / own year — full-width,
   gradient-filled, unmistakably "this one is yours". */
.primary-pick-card {
    display: block;
    position: relative;
    overflow: hidden;
    background: var(--accent-gradient);
    border-radius: var(--radius-lg);
    padding: 30px 36px;
    margin-top: 4px;
    text-decoration: none;
    box-shadow: var(--shadow-lg);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.primary-pick-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
    text-decoration: none;
}

.primary-pick-card::after {
    content: '';
    position: absolute;
    top: -40%;
    right: -8%;
    width: 220px;
    height: 220px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 50%;
}

.primary-pick-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 13px;
    border-radius: 999px;
    margin-bottom: 16px;
}

.primary-pick-title {
    font-family: var(--font-display);
    font-size: 25px;
    font-weight: 700;
    color: #fff;
    line-height: 1.25;
    max-width: 80%;
    position: relative;
    z-index: 1;
}

.primary-pick-sub {
    color: rgba(255, 255, 255, 0.82);
    font-size: 13.5px;
    margin-top: 6px;
    position: relative;
    z-index: 1;
}

.primary-pick-arrow {
    position: absolute;
    right: 34px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 26px;
    color: rgba(255, 255, 255, 0.75);
}

/* Quiet divider with a centered "show more" toggle between the primary pick
   and the rest of the (collapsed-by-default) list. */
.reveal-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 34px 0 22px;
}

.reveal-divider::before,
.reveal-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.reveal-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-color);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 10px 18px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

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

.reveal-toggle .chevron {
    display: inline-block;
    font-size: 9px;
    transition: transform 0.25s ease;
}

.reveal-toggle.is-expanded .chevron {
    transform: rotate(180deg);
}

.reveal-panel {
    display: none;
}

.reveal-panel.is-expanded {
    display: block;
    animation: revealDown 0.22s ease;
}

@keyframes revealDown {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* University cards once expanded — same card shape, tinted per-school so a
   long list of unfamiliar names is easier to scan at a glance. */
.uni-card.tint-1 {
    background: var(--tint-1-bg);
    border-color: var(--tint-1-border);
    border-left-color: var(--tint-1-border);
}

.uni-card.tint-2 {
    background: var(--tint-2-bg);
    border-color: var(--tint-2-border);
    border-left-color: var(--tint-2-border);
}

.uni-card.tint-3 {
    background: var(--tint-3-bg);
    border-color: var(--tint-3-border);
    border-left-color: var(--tint-3-border);
}

.uni-card.tint-4 {
    background: var(--tint-4-bg);
    border-color: var(--tint-4-border);
    border-left-color: var(--tint-4-border);
}

.uni-card.tint-5 {
    background: var(--tint-5-bg);
    border-color: var(--tint-5-border);
    border-left-color: var(--tint-5-border);
}

.uni-card.tint-6 {
    background: var(--tint-6-bg);
    border-color: var(--tint-6-border);
    border-left-color: var(--tint-6-border);
}

.uni-card.tint-1:hover,
.uni-card.tint-2:hover,
.uni-card.tint-3:hover,
.uni-card.tint-4:hover,
.uni-card.tint-5:hover,
.uni-card.tint-6:hover {
    border-left-color: var(--gold);
}

/* Banner marking "your year" at the top of a module list, so the eye lands
   there before anything else on the page. */
.current-year-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 18px;
    padding: 11px 16px;
    background: var(--accent-light);
    border-left: 3px solid var(--accent-primary);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--accent-primary);
}

/* ════════════════════════════════════════════════════════════════════════════
   Language switcher — segmented pill control (replaces bare <select> / plain
   radio rows wherever the student picks French or English).
   ════════════════════════════════════════════════════════════════════════════ */
.lang-toggle {
    display: inline-flex;
    align-items: center;
    background: var(--bg-tertiary);
    border: 1.5px solid var(--border-color);
    border-radius: 999px;
    padding: 4px;
    gap: 2px;
}

.lang-toggle input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.lang-pill {
    /* .lang-pill is a <label> (it has to be, to stay clickable for its
       paired radio), so it inherits the global `label { margin-bottom: 8px }`
       rule below unless reset here. That stray margin is the real source of
       any vertical offset in this control: with the track's default
       align-items: stretch, an 8px bottom-only margin shrinks the pill's
       stretched box asymmetrically, leaving extra space under it and
       making it sit visibly above center relative to neighboring elements.
       The line below is therefore load-bearing — do not remove it in favor
       of padding/border tweaks on the track, which only resize the
       (invisible) outer box and won't move the visible pill back to center. */
    margin: 0;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    white-space: nowrap;
}

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

.lang-toggle input:checked+.lang-pill {
    background: var(--accent-primary);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.lang-toggle input:focus-visible+.lang-pill {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.lang-pill .flag {
    display: inline-flex;
    align-items: center;
    width: 20px;
    height: 15px;
    overflow: hidden;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.lang-pill .flag svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Compact variant for inline toolbars (e.g. the Study Center action row).
   Trims both the outer pill-track and the inner pill so the control's
   rendered height matches .btn-sm (36.625px at the default 1.65 line-height
   / 12.5px font-size). This sizing alone is NOT what keeps the pill
   centered against neighboring toolbar buttons — that's handled by the
   `margin: 0` reset on .lang-pill above, which cancels the global
   `label { margin-bottom: 8px }` rule. Without that reset, the pill's
   stretched box is shortened asymmetrically (bottom-only), so it floats
   visibly above center regardless of how this compact variant is sized. */
.lang-toggle-sm {
    padding: 2px;
    border-width: 1px;
}

.lang-toggle-sm .lang-pill {
    padding: 5px 14px;
    font-size: 12.5px;
}

.lang-toggle-sm .lang-pill .flag {
    width: 16px;
    height: 12px;
}

/* Visible "selected" state for the existing Timed/Free mode cards — was
   previously only conveyed by the tiny native radio dot. */
.mode-option:has(input:checked) {
    border-color: var(--accent-primary);
    background: var(--accent-light);
    box-shadow: 0 0 0 1px var(--accent-primary);
}

/* ════════════════════════════════════════════════════════════════════════════
   UX REDESIGN — Responsive Nav · Active States · Toasts · Phase 2 Shared
   ════════════════════════════════════════════════════════════════════════════ */

/* ─── Page Entry Animation ─────────────────────────────────────────────────── */
@keyframes pageFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.main-content {
    animation: pageFadeIn 0.22s ease both;
}

/* ─── Active Nav Link ──────────────────────────────────────────────────────── */
.navbar-link-group a.nav-active {
    color: var(--navbar-text) !important;
}

.navbar-link-group a.nav-active::after {
    width: 100% !important;
    background: var(--navbar-accent);
}

/* ─── Mobile Menu Button ───────────────────────────────────────────────────── */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(226, 114, 136, 0.45);
}

.mobile-menu-btn.open {
    background: rgba(226, 114, 136, 0.16);
    border-color: rgba(226, 114, 136, 0.4);
}

.hamburger-bar {
    display: block;
    width: 16px;
    height: 2px;
    background: var(--navbar-text);
    border-radius: 999px;
    transition: transform 0.22s ease, opacity 0.18s ease, width 0.18s ease;
    transform-origin: center;
}

.mobile-menu-btn.open .hamburger-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mobile-menu-btn.open .hamburger-bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.mobile-menu-btn.open .hamburger-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Compact inline bar on laptops — hamburger is phone-only (≤860px). */
@media (max-width: 1400px) and (min-width: 861px) {
    .navbar {
        padding: 12px 18px;
        gap: 10px;
    }

    .navbar-links {
        gap: 12px;
        flex-wrap: wrap;
        justify-content: flex-end;
        row-gap: 6px;
    }

    .navbar-link-group a {
        font-size: 12.5px;
        white-space: nowrap;
    }

    .navbar-utilities {
        gap: 8px;
    }

    .navbar-logout {
        padding: 5px 10px;
        font-size: 12.5px;
    }
}

@media (min-width: 861px) {
    .mobile-menu-btn {
        display: none !important;
    }

    .navbar-group-label {
        display: none !important;
    }

    .navbar-links,
    body > .navbar-links {
        display: flex !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        inset: auto !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        flex-direction: row !important;
        align-items: center !important;
        overflow: visible !important;
        padding: 0 !important;
        margin: 0 0 0 auto !important;
        background: transparent !important;
        box-shadow: none !important;
        z-index: 2 !important;
    }

    .navbar-link-group {
        display: contents;
    }

    .navbar-utilities {
        width: auto;
        border-top: none;
        margin-top: 0;
        padding: 0;
    }
}

/* ─── Phone / small-tablet drawer ──────────────────────────────────────────── */
@media (max-width: 860px) {
    /* Keep the bar on screen after scroll. sticky fails inside the
       flex body on mobile, so the hamburger vanished until you
       scrolled back to the top — and the drawer opened off-screen. */
    body.app-authenticated {
        padding-top: 58px;
    }

    .navbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        z-index: 640;
        padding: 10px 16px;
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
        flex-wrap: nowrap;
        row-gap: 0;
        align-items: center;
        overflow: visible;
    }

    .navbar-toolbar {
        margin-left: auto;
        gap: 6px;
    }

    .navbar-toolbar .notif-bell-btn {
        width: 44px;
        height: 44px;
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .navbar-toolbar .notif-bell-btn.is-active,
    .navbar-toolbar .notif-bell-btn:hover {
        background: rgba(226, 114, 136, 0.16);
        border-color: rgba(226, 114, 136, 0.4);
        color: var(--navbar-gold);
    }

    .mobile-menu-btn {
        display: flex !important;
        position: relative;
        z-index: 710;
        margin-left: 0;
    }

    .navbar-link-group {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 4px;
        padding: 10px 10px 12px;
        border-radius: 18px;
        background: rgba(255, 255, 255, 0.045);
        border: 1px solid rgba(255, 255, 255, 0.07);
    }

    .navbar-group-label {
        display: block;
        padding: 2px 10px 8px;
        font-family: var(--font-mono);
        font-size: 10px;
        font-weight: 700;
        letter-spacing: 0.16em;
        text-transform: uppercase;
        color: rgba(255, 255, 255, 0.42);
    }

    .navbar-links,
    body > .navbar-links {
        display: none;
        position: fixed !important;
        top: 56px;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        inset-inline: 0 !important;
        width: auto !important;
        min-width: 100vw !important;
        max-width: none !important;
        min-height: calc(100dvh - 56px);
        height: auto !important;
        max-height: none;
        flex: none !important;
        align-self: stretch !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start;
        gap: 12px !important;
        padding: 16px 16px max(28px, env(safe-area-inset-bottom));
        margin: 0 !important;
        border: 0;
        border-bottom: none;
        background:
            radial-gradient(ellipse 80% 40% at 10% -10%, rgba(226, 114, 136, 0.16), transparent 55%),
            radial-gradient(ellipse 60% 30% at 100% 0%, rgba(212, 175, 55, 0.1), transparent 50%),
            #14141c;
        box-shadow: none;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        z-index: 700;
        filter: none !important;
        transform: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        box-sizing: border-box;
    }

    .navbar-links.mobile-open,
    body > .navbar-links.mobile-open {
        display: flex !important;
    }

    .navbar-link-group a {
        display: flex;
        align-items: center;
        min-height: 48px;
        padding: 12px 14px;
        font-size: 16px;
        font-weight: 600;
        border-bottom: none;
        border-radius: 12px;
        color: rgba(255, 255, 255, 0.88);
        letter-spacing: 0.01em;
    }

    .navbar-link-group a:last-child {
        border-bottom: none;
    }

    .navbar-link-group a:hover {
        background: rgba(255, 255, 255, 0.06);
        color: #fff;
    }

    /* No underline animation on mobile — use a filled chip instead */
    .navbar-link-group a::after {
        display: none !important;
    }

    .navbar-link-group a.nav-active {
        color: #fff !important;
        padding-left: 14px;
        border-left: none;
        background: rgba(226, 114, 136, 0.2);
        box-shadow: inset 0 0 0 1px rgba(226, 114, 136, 0.35);
    }

    .navbar-divider {
        display: none;
    }

    .navbar-utilities {
        width: 100%;
        justify-content: stretch;
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px;
        border-top: none;
        margin-top: 4px;
        border-radius: 18px;
        background: rgba(255, 255, 255, 0.045);
        border: 1px solid rgba(255, 255, 255, 0.07);
    }

    .navbar-logout-form {
        margin-left: 0;
        width: 100%;
        order: 5;
    }

    .navbar-logout-form .navbar-logout {
        width: 100%;
        justify-content: center;
        min-height: 44px;
    }

    .theme-toggle,
    .onb-help-btn {
        width: 44px;
        height: 44px;
        border-radius: 14px;
    }

    .main-content {
        padding: 24px 16px;
        overflow-x: clip;
        max-width: 100%;
        min-width: 0;
    }
}

html.nav-open,
body.nav-open {
    overflow: hidden;
}

body.nav-open .navbar {
    z-index: 710;
}

body.nav-open::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(8, 10, 16, 0.55);
    z-index: 690;
    pointer-events: none;
}

@media (max-width: 720px) {
    h1,
    .archive-container .page-hero h1,
    .results-container .page-hero h1,
    .review-container .page-hero h1 {
        font-size: 26px;
    }

    h2 {
        font-size: 21px;
    }

    .page-hero {
        padding: 20px 16px;
        margin-bottom: 24px;
    }

    .page-hero--row {
        flex-direction: column;
        align-items: stretch;
    }

    .page-hero--row .page-hero-right {
        flex-wrap: wrap;
        width: 100%;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .exam-meta-grid {
        grid-template-columns: 1fr 1fr;
    }

    .main-content img,
    .main-content video {
        max-width: 100%;
        height: auto;
    }

    .main-content table {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
    }
}

/* ─── Toast Notification System ─────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 380px;
    width: min(380px, calc(100% - 24px));
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    line-height: 1.5;
    pointer-events: all;
    border-left: 4px solid var(--border-color);
    animation: toastIn 0.3s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

.toast.toast-success {
    border-left-color: var(--success);
}

.toast.toast-danger {
    border-left-color: var(--danger);
}

.toast.toast-warning {
    border-left-color: var(--warning);
}

.toast.toast-info {
    border-left-color: var(--info);
}

.toast-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
    font-family: var(--font-mono);
    font-weight: 700;
    width: 18px;
    text-align: center;
}

.toast.toast-success .toast-icon {
    color: var(--success);
}

.toast.toast-danger .toast-icon {
    color: var(--danger);
}

.toast.toast-warning .toast-icon {
    color: var(--warning);
}

.toast.toast-info .toast-icon {
    color: var(--info);
}

.toast-body {
    flex: 1;
    color: var(--text-primary);
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
    color: var(--text-tertiary);
    padding: 0;
    flex-shrink: 0;
    transition: color 0.15s;
}

.toast-close:hover {
    color: var(--text-primary);
}

.toast.toast-leaving {
    animation: toastOut 0.22s ease forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(16px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
        max-height: 120px;
    }

    to {
        opacity: 0;
        transform: translateX(16px);
        max-height: 0;
        padding: 0;
        margin: 0;
        border-width: 0;
    }
}

@media (max-width: 600px) {
    .toast-container {
        left: 12px;
        right: 12px;
        bottom: 12px;
        max-width: none;
        width: auto;
    }
}

/* ─── Phase 2 Global Shared Styles ──────────────────────────────────────────── */
/* Tier chips — consistent across mastery index, chapter, profile, admin */
.tier-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    letter-spacing: 0.04em;
    font-family: var(--font-mono);
    white-space: nowrap;
}

.tier-chip.tier-mastered,
.tier-chip-sm.tier-mastered {
    background: rgba(var(--success-rgb), .12);
    color: var(--success);
}

.tier-chip.tier-proficient,
.tier-chip-sm.tier-proficient {
    background: rgba(var(--info-rgb), .12);
    color: var(--info);
}

.tier-chip.tier-learning,
.tier-chip-sm.tier-learning {
    background: rgba(var(--gold-rgb), .12);
    color: var(--gold);
}

.tier-chip.tier-not_started,
.tier-chip-sm.tier-not_started {
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
}

/* Mastery progress bars — shared across mastery, profile */
.mastery-bar-wrap {
    flex: 1;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.mastery-bar-fill {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.tier-fill-mastered {
    background: var(--success) !important;
}

.tier-fill-proficient {
    background: var(--info) !important;
}

.tier-fill-learning {
    background: var(--gold) !important;
}

.tier-fill-not_started {
    background: var(--text-tertiary) !important;
}

/* ─── Submit Button Loading State ────────────────────────────────────────────── */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btnSpin 0.7s linear infinite;
}

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

/* ─── Empty / Loading States ──────────────────────────────────────────────── */
.content-skeleton {
    display: grid;
    gap: 10px;
}

.content-skeleton-item {
    height: 64px;
    border-radius: var(--radius-md);
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, rgba(255, 255, 255, 0.04) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeletonPulse 1.2s ease-in-out infinite;
}

.content-empty {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 16px 18px;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
}

.content-empty strong {
    color: var(--text-primary);
}

@keyframes skeletonPulse {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ─── Better Focus States (keyboard accessibility) ──────────────────────────── */
:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

/* suppress outline on mouse clicks */
:focus:not(:focus-visible) {
    outline: none;
}

/* ─── Better scrollbar (webkit) ───────────────────────────────────────────────── */
.profile-recent-missions-list {
    max-height: 380px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ─── Question Images (exam take + review) ──────────────────────────────────── */
.question-image-wrap {
    margin: 14px 0 18px;
    text-align: center;
}

.question-exam-img {
    max-width: 100%;
    max-height: 380px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: inline-block;
}

@media (max-width: 600px) {
    .question-exam-img {
        max-height: 240px;
    }
}

/* ─── App Footer ─────────────────────────────────────────────────────────────── */
.app-footer {
    position: relative;
    flex-shrink: 0;
    margin-top: var(--space-8);
    padding: 32px 24px 22px;
    overflow: visible;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.app-footer::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-light);
    opacity: 1;
}

.app-footer::after {
    content: '';
    position: absolute;
    inset: 3px 0 auto;
    display: none;
    pointer-events: none;
}

.footer-shell {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(240px, 1fr) auto;
    gap: 28px;
    align-items: center;
    position: relative;
    z-index: 1;
}

.footer-brand-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
}

.footer-social {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--bg-primary) 70%, transparent);
    box-shadow: var(--shadow-sm);
}

.footer-social-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    padding: 0;
    font: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    text-decoration: none;
    transition: transform 0.25s ease, background 0.25s ease, border-color 0.25s ease,
        box-shadow 0.25s ease, color 0.25s ease;
}

.footer-social--bottom {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    gap: 8px;
}

.footer-social--bottom .footer-social-link {
    width: 32px;
    height: 32px;
    border-color: var(--border-color);
    background: var(--bg-tertiary);
}

.footer-social-link svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.footer-social--bottom .footer-social-link svg {
    width: 15px;
    height: 15px;
}

.footer-social-link:hover,
.footer-social-link:focus-visible {
    color: #fff;
    border-color: transparent;
    background: var(--accent-gradient);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -10px rgba(var(--accent-rgb), 0.55);
    text-decoration: none;
}

.footer-social-soon {
    /* * { margin: 0 } kills the UA dialog centering (margin: auto). */
    position: fixed;
    inset: 0;
    margin: auto;
    width: min(440px, calc(100vw - 32px));
    height: fit-content;
    max-height: calc(100dvh - 40px);
    overflow: auto;
    padding: 28px 28px 24px;
    border: 1px solid color-mix(in srgb, var(--navbar-gold) 22%, var(--border-color) 78%);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    z-index: 1100;
}

.footer-social-soon::backdrop {
    background: rgba(8, 9, 13, .72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.footer-social-soon h2 {
    margin: 0 36px 10px 0;
    font-size: 22px;
}

.footer-social-soon p {
    margin: 0 0 20px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.footer-social-soon-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.footer-social-soon-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: color-mix(in srgb, var(--text-primary) 10%, transparent);
    color: var(--text-primary);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.footer-social-soon-close:hover,
.footer-social-soon-close:focus-visible {
    background: color-mix(in srgb, var(--text-primary) 18%, transparent);
}

/* Tooltip (theme-invariant — always reads on the dark masthead tokens) */
.footer-social-link::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--navbar-bg);
    color: var(--navbar-text);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: var(--shadow-md);
    z-index: 5;
}

.footer-social-link::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--navbar-bg);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 5;
}

.footer-social-link:hover::after,
.footer-social-link:hover::before,
.footer-social-link:focus-visible::after,
.footer-social-link:focus-visible::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.footer-connect {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-self: end;
    gap: 12px;
}

.footer-brand {
    display: inline-flex;
    width: fit-content;
    font-family: var(--font-display);
    font-size: 27px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: 0;
    text-decoration: none;
    transition: color 0.2s ease, transform 0.2s ease;
}

.footer-brand:hover,
.footer-brand:focus-visible {
    color: var(--accent-primary);
    text-decoration: none;
    transform: translateY(-1px);
}

.footer-brand-i {
    font-style: italic;
    font-weight: 600;
    color: var(--accent-primary);
}

.footer-brand-dot {
    color: var(--gold);
}

.footer-tagline {
    max-width: 32ch;
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
}

.footer-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px 22px;
    justify-self: end;
}

.footer-nav a,
.footer-contact {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease, transform 0.2s ease;
}

.footer-nav a {
    position: relative;
    width: fit-content;
    font-size: 14px;
    font-weight: 600;
}

.footer-nav a::after,
.footer-contact::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -4px;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.2s ease;
}

.footer-nav a:hover,
.footer-nav a:focus-visible,
.footer-contact:hover,
.footer-contact:focus-visible {
    color: var(--accent-primary);
    text-decoration: none;
}

.footer-nav a:hover::after,
.footer-nav a:focus-visible::after,
.footer-contact:hover::after,
.footer-contact:focus-visible::after {
    transform: scaleX(1);
}

.footer-label {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.footer-bottom {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 24px auto 0;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.footer-copyright,
.footer-contact {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-tertiary);
    letter-spacing: 0.02em;
    margin: 0;
}

.footer-contact {
    position: relative;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .app-footer {
        padding: 34px 16px 22px;
        padding-bottom: max(22px, env(safe-area-inset-bottom));
    }

    .footer-shell {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .footer-brand-panel {
        max-width: none;
    }

    .footer-brand {
        font-size: 27px;
    }

    .footer-nav {
        display: grid;
        grid-template-columns: 1fr 1fr;
        justify-self: stretch;
        justify-content: stretch;
        align-items: start;
        gap: 10px 16px;
    }

    .footer-bottom {
        margin-top: 26px;
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 420px) {
    .footer-nav {
        grid-template-columns: 1fr;
    }
}

/* ─── Phase 1 additions ────────────────────────────────────── */

/* Email verification banner */
.verify-banner {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    padding: .55rem 1.25rem;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
    font-size: .85rem;
    color: var(--text-primary);
}

.verify-banner span {
    flex: 1;
}

.verify-banner .btn-link {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: inherit;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.verify-banner-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0 .25rem;
}

.verify-banner-close:hover {
    color: var(--text-primary);
}

/* Form hints & inline validation */
.form-hint {
    display: block;
    font-size: .78rem;
    margin-top: .25rem;
    color: var(--text-tertiary);
    transition: color .2s;
}

.field-error {
    display: block;
    font-size: .78rem;
    margin-top: .25rem;
    transition: color .2s;
}

/* Forgot-password link under login button */
.auth-forgot {
    text-align: center;
    margin-top: .5rem;
    font-size: .82rem;
}

.auth-forgot a {
    color: var(--text-tertiary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.auth-forgot a:hover {
    color: var(--text-primary);
}

/* Auth subtitle text (forgot / reset password) */
.auth-subtitle {
    font-size: .88rem;
    color: var(--text-secondary);
    margin: 0 auto 1.5rem;
    max-width: 34em;
    line-height: 1.55;
    text-align: center;
}

/* Standalone auth pages (forgot / reset) — centered card, no leftover split */
.main-content.main-content--auth {
    max-width: none;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 36px 20px 56px;
}

.auth-container--solo {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: min(68vh, calc(100vh - 240px));
    overflow: visible;
}

.auth-container--solo > .auth-card,
.auth-card--solo {
    margin: 0 auto;
    width: 100%;
    max-width: 440px;
}

.auth-card--solo::before,
.auth-card--solo::after {
    display: none;
}

.auth-card--solo {
    background: color-mix(in srgb, var(--bg-secondary) 78%, transparent);
    border: 1px solid color-mix(in srgb, var(--navbar-gold) 22%, var(--border-color) 78%);
    box-shadow:
        var(--shadow-lg),
        inset 0 1px 0 color-mix(in srgb, white 8%, transparent);
    backdrop-filter: blur(22px) saturate(150%);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
}

.auth-card--solo .auth-title {
    margin: 22px 0 10px;
}

@media (max-width: 560px) {
    .auth-card--solo {
        padding: 36px 22px;
    }
}

/* ─── Auth experience refinement ───────────────────────────────────────── */
.auth-container {
    position: relative;
    isolation: isolate;
}

.auth-container::before,
.auth-container::after {
    content: '';
    position: fixed;
    z-index: -1;
    width: min(42vw, 520px);
    aspect-ratio: 1;
    border-radius: 50%;
    filter: blur(2px);
    pointer-events: none;
}

.auth-container::before {
    left: -14vw;
    top: 8vh;
    background: radial-gradient(circle, rgba(var(--accent-rgb), .13), transparent 68%);
}

.auth-container::after {
    right: -16vw;
    bottom: -14vh;
    background: radial-gradient(circle, rgba(var(--gold-rgb), .12), transparent 68%);
}

.auth-card {
    border: 1px solid color-mix(in srgb, var(--border-color) 86%, var(--accent-primary) 9%);
    box-shadow: 0 22px 50px -34px rgba(var(--accent-rgb), .34), var(--shadow-md);
}

.auth-card .auth-title {
    letter-spacing: -.025em;
}

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

.auth-card input,
.auth-card select {
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.auth-card input:focus,
.auth-card select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .13);
}

.auth-card .btn-full {
    min-height: 46px;
    box-shadow: 0 10px 20px -14px rgba(var(--accent-rgb), .58);
}

.auth-card .btn-full:hover {
    transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
    .auth-card .btn-full:hover {
        transform: none;
    }
}

@media (max-width: 720px) {
    .main-content,
    .archive-container,
    .clinical-container,
    .diag-wrap,
    .phys-landing,
    .phys-workspace,
    .cso-page,
    .ranking-page,
    .lwbe-header,
    .as-hero {
        max-width: 100%;
        min-width: 0;
    }

    .main-content {
        overflow-x: clip;
    }

    .btn,
    .action-buttons .btn,
    .page-hero-right .btn {
        white-space: normal;
        max-width: 100%;
    }
}