.custom-file-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

#generate-quiz-modal input[type="file"] {
    display: none;
}

.custom-file-label {
    display: inline-block;
    padding: 0.5rem 1.1rem;
    background: var(--btn-bg);
    color: var(--text-primary);
    border: 1px solid var(--btn-border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.15s, border 0.15s;
}
.custom-file-label:hover {
    background: var(--btn-hover-bg);
    border-color: var(--btn-hover-border);
}
.file-chosen-label {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin-left: 0.5rem;
    min-width: 120px;
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* ===== CSS CUSTOM PROPERTIES (DARK/LIGHT) ===== */
:root {
    --bg-body: radial-gradient(circle at 20% 25%, #12172a 0%, #070b16 55%, #02040b 100%);
    --text-primary: #f1f5ff;
    --text-secondary: #d8e1ff;
    --text-muted: #9aa8cc;
    --bg-header: linear-gradient(120deg, #0f1f34 0%, #121f3e 50%, #172a46 100%);
    --header-border: rgba(165, 190, 250, 0.2);
    --bg-main: rgba(18, 25, 40, 0.98);
    --main-border: rgba(87, 117, 180, 0.25);
    --bg-card: rgba(16, 24, 42, 0.82);
    --card-border: rgba(98, 146, 255, 0.3);
    --bg-question: #1b233d;
    --question-border: #2b3350;
    --bg-option: #1f2a46;
    --option-border: #2f3a58;
    --option-hover-bg: #283353;
    --option-hover-border: #5ebcff;
    --option-selected-bg: rgba(55, 100, 210, 0.3);
    --option-selected-border: #6aa5ff;
    --bg-input: #111a2f;
    --input-border: #4e6aa8;
    --bg-select: #0f1c38;
    --select-border: #4d6eb7;
    --bg-progress: #2b3350;
    --progress-border: #2f3a58;
    --bg-score-summary: #121a32;
    --score-summary-border: #2b3b6d;
    --bg-score-cell: rgba(26, 37, 60, 0.95);
    --score-cell-border: rgba(90, 130, 230, 0.3);
    --bg-history-panel: rgba(15, 23, 40, 0.7);
    --history-panel-border: rgba(98, 146, 255, 0.2);
    --bg-history-item: rgba(20, 31, 52, 0.9);
    --history-item-border: rgba(95, 134, 212, 0.28);
    --bg-history-summary: rgba(16, 25, 44, 0.72);
    --history-summary-border: rgba(106, 146, 230, 0.28);
    --bg-userbar: rgba(16, 25, 43, 0.85);
    --userbar-border: rgba(109, 157, 255, 0.3);
    --bg-auth: rgba(18, 27, 46, 0.92);
    --auth-border: rgba(98, 146, 255, 0.25);
    --bg-dashboard-cell: rgba(20, 31, 55, 0.92);
    --dashboard-cell-border: rgba(111, 157, 255, 0.25);
    --h1-color: #e8f4ff;
    --h2-color: #3c70e6;
    --link-color: #8db6ff;
    --link-hover: #d0e5ff;
    --btn-bg: #3f6cde;
    --btn-border: #3e79ff;
    --btn-hover-bg: #2b56db;
    --btn-hover-border: #5fb8ff;
    --scenario-color: #7fd6ff;
    --scenario-border: #69c8ff;
    --explanation-bg: #16203a;
    --explanation-border: #3f57af;
    --feedback-correct-bg: rgba(13, 58, 39, 0.85);
    --feedback-correct-border: #4fca9a;
    --feedback-correct-color: #b5ffe1;
    --feedback-incorrect-bg: rgba(50, 31, 31, 0.85);
    --feedback-incorrect-border: #ee8f8f;
    --feedback-incorrect-color: #ffcec5;
    --review-ok-bg: rgba(19, 84, 58, 0.35);
    --review-ok-border: rgba(95, 220, 164, 0.5);
    --review-ok-color: #caffeb;
    --review-item-bg: rgba(22, 31, 50, 0.8);
    --review-item-border: rgba(98, 135, 212, 0.3);
    --review-wrong-bg: rgba(90, 30, 40, 0.45);
    --review-wrong-border: rgba(242, 125, 125, 0.65);
    --review-wrong-color: #ffd6d0;
    --nav-dot-bg: rgba(25, 37, 62, 0.88);
    --nav-dot-border: rgba(94, 140, 230, 0.55);
    --mode-badge-color: #d6ecff;
    --mode-badge-bg: rgba(41, 90, 168, 0.4);
    --mode-badge-border: rgba(107, 169, 255, 0.45);
    --timer-color: #d9edff;
    --timer-bg: rgba(22, 78, 116, 0.4);
    --timer-border: rgba(113, 198, 255, 0.5);
    --timer-warn-color: #ffe0df;
    --timer-warn-bg: rgba(116, 37, 37, 0.42);
    --timer-warn-border: rgba(255, 154, 154, 0.55);
    --badge-pass-bg: rgba(23, 107, 68, 0.6);
    --badge-pass-border: rgba(110, 225, 171, 0.7);
    --badge-pass-color: #b9ffdd;
    --badge-fail-bg: rgba(131, 44, 44, 0.55);
    --badge-fail-border: rgba(255, 147, 147, 0.72);
    --badge-fail-color: #ffd2cb;
    --shadow-main: rgba(0, 0, 0, 0.55);
    --accent: #3f6cde;
    --accent-hover: #2b56db;
    --exam-card-bg: rgba(255, 255, 255, 0.05);
    --exam-card-border: rgba(255, 255, 255, 0.1);
    --exam-card-text: #ffffff;
    --exam-card-action-border: rgba(255, 255, 255, 0.25);
    --exam-card-delete-border: rgba(255, 255, 255, 0.15);
    --notice-warning-bg: rgba(255, 197, 61, 0.12);
    --notice-warning-border: rgba(255, 197, 61, 0.45);
    --notice-warning-text: #ffd989;
    --tier-free-bg: #2a3a66;
    --tier-free-color: #ffffff;
    --tier-free-border: #4a6cb8;
    --tier-premium-bg: #5b3da8;
    --tier-premium-color: #ffffff;
    --tier-premium-border: #8a6cd6;
    --tier-pro-bg: #1f7a52;
    --tier-pro-color: #ffffff;
    --tier-pro-border: #4cc28f;
    --delete-warning-bg: rgba(220, 80, 80, 0.10);
    --delete-warning-border: rgba(220, 80, 80, 0.45);
    --delete-warning-text: #ffd0d0;
    --delete-warning-heading: #ffb4b4;
}

[data-theme="light"] {
    --bg-body: linear-gradient(135deg, #eef2f7 0%, #dfe6ef 100%);
    --text-primary: #1a2030;
    --text-secondary: #334155;
    --text-muted: #6b7a96;
    --bg-header: linear-gradient(120deg, #ffffff 0%, #f0f4ff 50%, #e8eeff 100%);
    --header-border: rgba(100, 130, 200, 0.25);
    --bg-main: rgba(255, 255, 255, 0.96);
    --main-border: rgba(100, 130, 200, 0.2);
    --bg-card: rgba(255, 255, 255, 0.9);
    --card-border: rgba(100, 130, 200, 0.25);
    --bg-question: #f7f9ff;
    --question-border: #d0d8e8;
    --bg-option: #ffffff;
    --option-border: #c8d4ea;
    --option-hover-bg: #edf2ff;
    --option-hover-border: #4a90e2;
    --option-selected-bg: rgba(66, 133, 244, 0.12);
    --option-selected-border: #4285f4;
    --bg-input: #ffffff;
    --input-border: #b0bdd4;
    --bg-select: #ffffff;
    --select-border: #b0bdd4;
    --bg-progress: #dde4f0;
    --progress-border: #c8d4ea;
    --bg-score-summary: #f0f4ff;
    --score-summary-border: #c0cde6;
    --bg-score-cell: rgba(240, 245, 255, 0.95);
    --score-cell-border: rgba(100, 130, 200, 0.25);
    --bg-history-panel: rgba(245, 248, 255, 0.9);
    --history-panel-border: rgba(100, 130, 200, 0.2);
    --bg-history-item: rgba(255, 255, 255, 0.95);
    --history-item-border: rgba(100, 130, 200, 0.25);
    --bg-history-summary: rgba(240, 245, 255, 0.85);
    --history-summary-border: rgba(100, 130, 200, 0.2);
    --bg-userbar: rgba(255, 255, 255, 0.9);
    --userbar-border: rgba(100, 130, 200, 0.25);
    --bg-auth: rgba(255, 255, 255, 0.95);
    --auth-border: rgba(100, 130, 200, 0.2);
    --bg-dashboard-cell: rgba(248, 250, 255, 0.95);
    --dashboard-cell-border: rgba(100, 130, 200, 0.2);
    --h1-color: #1a2844;
    --h2-color: #2b5bc5;
    --link-color: #2563eb;
    --link-hover: #1d4ed8;
    --btn-bg: #3b6ce7;
    --btn-border: #3b6ce7;
    --btn-hover-bg: #2b5bc5;
    --btn-hover-border: #2b5bc5;
    --scenario-color: #1d6fa5;
    --scenario-border: #3a9ed8;
    --explanation-bg: #f0f5ff;
    --explanation-border: #4a7acc;
    --feedback-correct-bg: rgba(220, 252, 231, 0.85);
    --feedback-correct-border: #22c55e;
    --feedback-correct-color: #166534;
    --feedback-incorrect-bg: rgba(254, 226, 226, 0.85);
    --feedback-incorrect-border: #ef4444;
    --feedback-incorrect-color: #991b1b;
    --review-ok-bg: rgba(220, 252, 231, 0.5);
    --review-ok-border: rgba(34, 197, 94, 0.5);
    --review-ok-color: #166534;
    --review-item-bg: rgba(248, 250, 255, 0.9);
    --review-item-border: rgba(100, 130, 200, 0.25);
    --review-wrong-bg: rgba(254, 226, 226, 0.5);
    --review-wrong-border: rgba(239, 68, 68, 0.5);
    --review-wrong-color: #991b1b;
    --nav-dot-bg: rgba(240, 245, 255, 0.9);
    --nav-dot-border: rgba(100, 130, 200, 0.4);
    --mode-badge-color: #1e3a6e;
    --mode-badge-bg: rgba(59, 130, 246, 0.12);
    --mode-badge-border: rgba(59, 130, 246, 0.35);
    --timer-color: #1a4a6e;
    --timer-bg: rgba(14, 116, 182, 0.1);
    --timer-border: rgba(14, 116, 182, 0.3);
    --timer-warn-color: #991b1b;
    --timer-warn-bg: rgba(239, 68, 68, 0.1);
    --timer-warn-border: rgba(239, 68, 68, 0.4);
    --badge-pass-bg: rgba(220, 252, 231, 0.7);
    --badge-pass-border: rgba(34, 197, 94, 0.6);
    --badge-pass-color: #166534;
    --badge-fail-bg: rgba(254, 226, 226, 0.7);
    --badge-fail-border: rgba(239, 68, 68, 0.6);
    --badge-fail-color: #991b1b;
    --shadow-main: rgba(0, 0, 0, 0.1);
    --accent: #3b6ce7;
    --accent-hover: #2b5bc5;
    --exam-card-bg: rgba(248, 250, 255, 0.95);
    --exam-card-border: rgba(100, 130, 200, 0.25);
    --exam-card-text: #1a2030;
    --exam-card-action-border: rgba(100, 130, 200, 0.35);
    --exam-card-delete-border: rgba(100, 130, 200, 0.25);
    --notice-warning-bg: rgba(180, 110, 0, 0.10);
    --notice-warning-border: rgba(180, 110, 0, 0.45);
    --notice-warning-text: #8a5a00;
    --tier-free-bg: #3b6ce7;
    --tier-free-color: #ffffff;
    --tier-free-border: #2b5bc5;
    --tier-premium-bg: #7a4dd1;
    --tier-premium-color: #ffffff;
    --tier-premium-border: #5e35a8;
    --tier-pro-bg: #22a06b;
    --tier-pro-color: #ffffff;
    --tier-pro-border: #178353;
    --delete-warning-bg: #fff3f3;
    --delete-warning-border: #d04a4a;
    --delete-warning-text: #7a1a1a;
    --delete-warning-heading: #b32424;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
    /* Sticky footer setup: body fills the viewport, main grows, footer pinned. */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body > main,
body > #app-shell {
    flex: 1 0 auto;
    /* In a column flex container, auto margins on cross-axis (left/right)
       suppress the default `align-items: stretch`. Forcing width:100% +
       box-sizing brings back the pre-flex behaviour so `main`'s
       max-width:980px + margin:auto keeps centring like before. */
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

body > .site-footer {
    flex-shrink: 0;
}

small {
    color: var(--text-muted);
}

header {
    text-align: center;
    background: var(--bg-header);
    color: var(--text-primary);
    padding: 26px;
    box-shadow: 0 10px 34px var(--shadow-main);
    border-bottom: 1px solid var(--header-border);
}

.header-top {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.header-actions {
    position: absolute;
    right: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lang-toggle {
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid var(--input-border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.lang-toggle:hover {
    border-color: #3b82f6;
}

.flag {
    display: inline-block;
    width: 20px;
    height: 14px;
    border-radius: 2px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.flag-gb {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 30'%3E%3CclipPath id='a'%3E%3Cpath d='M0 0v30h60V0z'/%3E%3C/clipPath%3E%3CclipPath id='b'%3E%3Cpath d='M30 15h30v15zv15H0zH0V0zV0h30z'/%3E%3C/clipPath%3E%3Cg clip-path='url(%23a)'%3E%3Cpath d='M0 0v30h60V0z' fill='%23012169'/%3E%3Cpath d='M0 0l60 30m0-30L0 30' stroke='%23fff' stroke-width='6'/%3E%3Cpath d='M0 0l60 30m0-30L0 30' clip-path='url(%23b)' stroke='%23C8102E' stroke-width='4'/%3E%3Cpath d='M30 0v30M0 15h60' stroke='%23fff' stroke-width='10'/%3E%3Cpath d='M30 0v30M0 15h60' stroke='%23C8102E' stroke-width='6'/%3E%3C/g%3E%3C/svg%3E");
}

.flag-nl {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 6'%3E%3Crect width='9' height='6' fill='%2321468B'/%3E%3Crect width='9' height='4' fill='%23FFF'/%3E%3Crect width='9' height='2' fill='%23AE1C28'/%3E%3C/svg%3E");
}

.profile-toggle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--input-border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 1.15rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: border-color 0.15s, background 0.15s;
}

.profile-toggle:hover {
    border-color: #3b82f6;
    background: var(--option-hover-bg);
}

/* ===== HAMBURGER MENU (hidden on desktop) ===== */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--input-border);
    background: var(--bg-input);
    cursor: pointer;
    padding: 0;
    position: absolute;
    right: 0;
    z-index: 101;
    transition: border-color 0.15s;
}

.hamburger-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.25s;
}

.hamburger-btn.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger-btn.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.hamburger-btn:hover {
    border-color: #3b82f6;
}

.hamburger-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-card);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 8px;
    min-width: 180px;
    box-shadow: 0 8px 24px var(--shadow-main);
    z-index: 100;
    flex-direction: column;
    gap: 4px;
}

.hamburger-menu.open {
    display: flex;
}

.hamburger-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    width: 100%;
    text-align: left;
}

.hamburger-item:hover {
    background: var(--option-hover-bg);
}

main {
    max-width: 980px;
    margin: 18px auto;
    background-color: var(--bg-main);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--main-border);
    box-shadow: 0 14px 32px var(--shadow-main);
}

/* When the app shell is active (user is logged in on index.html), make
   `main` a flex column so the visible content section can grow to fill
   the card and back-buttons stay anchored to the bottom. Auth-only
   pages (login, request-reset, reset) keep the default block layout so
   their small card sits naturally at the top. */
body.app-active main {
    display: flex;
    flex-direction: column;
}

body.app-active #app-shell {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

h1 {
    font-family: 'Chakra Petch', 'Inter', sans-serif;
    font-size: 2.8rem;
    letter-spacing: 0.03em;
    margin: 0;
    color: var(--h1-color);
}

p {
    color: var(--text-secondary);
}

#progress-text {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
}

#progress-container {
    border: 1px solid var(--progress-border);
}

#progress-bar {
    box-shadow: 0 0 8px rgba(117, 216, 255, 0.6);
}

.question {
    background: var(--bg-question);
    border: 1px solid var(--question-border);
    backdrop-filter: blur(5px);
    color: var(--text-primary);
}

.question p,
.question .scenario,
.question strong {
    color: var(--text-primary);
}

.option {
    background: var(--bg-option);
    border: 1px solid var(--option-border);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.option:hover {
    background: var(--option-hover-bg);
    border-color: var(--option-hover-border);
}

button {
    border: 1px solid var(--btn-border);
    background: var(--btn-bg);
    box-shadow: 0 8px 16px rgba(39, 83, 170, 0.4);
}

button:hover {
    background: var(--btn-hover-bg);
}

#results {
    background: var(--bg-card);
    border: 1px solid var(--card-border);
}

.feedback.correct {
    background: var(--feedback-correct-bg);
    border-color: var(--feedback-correct-border);
    color: var(--feedback-correct-color);
}

.feedback.incorrect {
    background: var(--feedback-incorrect-bg);
    border-color: var(--feedback-incorrect-border);
    color: var(--feedback-incorrect-color);
}

/* Open vragen */
.open-question { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; min-width: 0; }
.open-answer-input {
    width: 100%;
    max-width: 100%;
    min-height: 140px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--option-border);
    background: var(--bg-option);
    color: inherit;
    font: inherit;
    /* Voorkom dat het tekstvlak buiten de vraagkaart kan worden gesleept */
    resize: none;
    box-sizing: border-box;
    display: block;
}
.open-answer-input:focus { outline: none; border-color: var(--option-hover-border); }
.open-question-actions { display: flex; gap: 8px; }
.open-reveal-btn {
    padding: 8px 14px; border-radius: 8px; border: 1px solid var(--option-border);
    background: var(--bg-option); color: inherit; cursor: pointer;
}
.open-reveal-btn:hover:not(:disabled) { border-color: var(--option-hover-border); }
.open-reveal-btn:disabled { opacity: .6; cursor: default; }
.open-model-answer {
    border: 1px solid var(--option-border);
    background: var(--bg-option);
    border-radius: 8px;
    padding: 12px 14px;
}
.open-model-answer h4 { margin: 0 0 6px; font-size: .95rem; }
.open-model-answer p, .open-model-answer li { white-space: pre-wrap; }
.open-self-grade { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.open-self-grade p { margin: 0 6px 0 0; flex-basis: 100%; }
.open-grade-btn {
    padding: 8px 12px; border-radius: 8px; border: 1px solid var(--option-border);
    background: var(--bg-option); color: inherit; cursor: pointer;
}
.open-grade-btn.selected { border-color: var(--option-selected-border); background: var(--option-selected-bg); }
.review-item blockquote {
    margin: 4px 0 8px;
    padding: 8px 10px;
    border-left: 3px solid var(--option-border);
    background: rgba(255,255,255,0.03);
    white-space: pre-wrap;
}

.explanation {
    background: var(--explanation-bg);
    border-left: 4px solid var(--explanation-border);
}

.quiz-header {
    margin-bottom: 18px;
}

#progress-container {
    width: 100%;
    height: 12px;
    background-color: var(--bg-progress);
    border-radius: 8px;
    margin-top: 8px;
    overflow: hidden;
    border: 1px solid var(--progress-border);
}

#progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #4a95ff, #58cfb9);
    border-radius: 8px;
    transition: width 0.2s ease;
}

.back-btn,
.subject-buttons button,
#exam-items button,
.controls button,
#results button {
    font-weight: 600;
    padding: 10px 14px;
    margin: 0.25rem;
    border-radius: 10px;
    cursor: pointer;
    min-width: 150px;
}

.subject-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: stretch;
    margin-bottom: 12px;
}

.subject-buttons button {
    flex: 1 1 0;
    min-width: 0;
    box-sizing: border-box;
}

#exam-items {
    margin-top: 8px;
    list-style: none;
    padding-left: 0;
}

#exam-items li {
    margin-bottom: 8px;
}

#exam-items li button {
    width: auto;
    text-align: left;
}

#exam-items .exam-card {
    background: var(--exam-card-bg);
    border: 1px solid var(--exam-card-border);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    list-style: none;
}

.exam-card-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1 1 0;
}

.exam-card-title {
    font-size: 15px;
    color: var(--exam-card-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.exam-card-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.exam-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

#exam-items .exam-card-start {
    padding: 8px 16px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    min-width: 0;
    margin: 0;
}

#exam-items .exam-card-start:hover {
    background: var(--accent-hover);
}

#exam-items .exam-card-share {
    padding: 8px 14px;
    background: transparent;
    border: 1px solid var(--exam-card-action-border);
    border-radius: 8px;
    color: var(--exam-card-text);
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    margin: 0;
}

#exam-items .exam-card-delete {
    padding: 8px 12px;
    background: transparent;
    border: 1px solid var(--exam-card-delete-border);
    border-radius: 8px;
    color: var(--exam-card-text);
    font-size: 14px;
    cursor: pointer;
    min-width: 0;
    margin: 0;
}

.exam-card-shared-label {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.exam-list-warning {
    background: rgba(220, 80, 80, 0.12);
    border: 1px solid rgba(220, 80, 80, 0.35);
    color: #d04a4a;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    list-style: none;
}

.exam-list-empty {
    color: var(--text-muted);
    font-size: 14px;
    padding: 8px 0;
    list-style: none;
}

.exam-pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.exam-pagination-btn {
    min-width: 36px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--exam-card-border);
    background: var(--exam-card-bg);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.exam-pagination-btn:hover:not(:disabled):not(.is-active) {
    border-color: var(--accent);
}

.exam-pagination-btn.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 600;
}

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

.back-btn {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 12px;
    color: white;
    border-color: var(--card-border);
}

.question {
    margin-bottom: 16px;
    padding: 16px;
    border: 1px solid var(--question-border);
    border-radius: 10px;
    background-color: var(--bg-question);
}

.options {
    margin-top: 12px;
}

.option {
    display: block;
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid var(--option-border);
    border-radius: 8px;
    background-color: var(--bg-option);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.option:hover {
    background-color: var(--option-hover-bg);
    border-color: var(--option-hover-border);
}

.option.selected {
    background-color: var(--option-selected-bg);
    border-color: var(--option-selected-border);
    box-shadow: inset 0 0 0 1px rgba(106, 165, 255, 0.4);
}

.option input {
    margin-right: 10px;
}

.controls {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 22px;
}

button {
    background-color: var(--btn-bg);
    color: white;
    border: 1px solid var(--btn-border);
    padding: 10px 18px;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

button:hover {
    background-color: var(--btn-hover-bg);
    border-color: var(--btn-hover-border);
}

button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.score-summary {
    margin-top: 12px;
    margin-bottom: 14px;
    padding: 16px;
    background-color: var(--bg-score-summary);
    border: 1px solid var(--score-summary-border);
    border-radius: 14px;
    text-align: center;
}

.score-summary h2 {
    margin: 0 0 4px;
    font-size: 3.8rem;
    line-height: 1;
}

.score-summary h2.score-high { color: #22c55e; }
.score-summary h2.score-mid  { color: #f59e0b; }
.score-summary h2.score-low  { color: #ef4444; }

.score-summary p {
    margin: 3px 0;
    color: var(--text-secondary);
}

.score-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.score-cell {
    background: var(--bg-score-cell);
    border: 1px solid var(--score-cell-border);
    border-radius: 10px;
    padding: 8px 10px;
}

.score-cell strong {
    display: block;
    font-size: 1.3rem;
    color: var(--text-primary);
}

.score-cell span {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.score-message {
    margin-top: 8px;
    font-size: 1rem;
    color: #ade4b8;
}

.feedback {
    margin-top: 14px;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
}

.feedback.correct {
    border: 1px solid var(--feedback-correct-border);
    color: var(--feedback-correct-color);
}

.feedback.incorrect {
    border: 1px solid var(--feedback-incorrect-border);
    color: var(--feedback-incorrect-color);
}

.correct {
    color: #7be79f;
    font-weight: bold;
}

.incorrect {
    color: #ff9f94;
    font-weight: bold;
}

.explanation {
    margin-top: 8px;
    background: var(--explanation-bg);
    border-left: 4px solid var(--explanation-border);
    padding: 10px;
    border-radius: 4px;
}

#exam-list ul,
#exam-list li {
    padding: 0;
    margin: 0;
}

#exam-list li {
    margin: 10px 0;
}

#exam-list a {
    display: inline-block;
    font-weight: 700;
    color: var(--link-color);
}

#exam-list a:hover {
    color: var(--link-hover);
}

#progress-text {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 2px;
}

.scenario {
    margin: 10px 0 8px;
    color: var(--scenario-color);
    font-size: 0.95rem;
    border-left: 3px solid var(--scenario-border);
    padding-left: 10px;
    opacity: 0.92;
}

.quiz-header {
    margin-bottom: 18px;
}

h2 {
    color: var(--h2-color);
    display: flex;
    justify-content: center;
    align-items: center;
}

ul {
    list-style-type: none;
    padding: 0;
}

li {
    margin: 10px 0;
}

a {
    text-decoration: none;
    color: var(--link-color);
    font-weight: bold;
}

a:hover {
    color: var(--link-hover);
}

/* ===== MOBILE FIXES ===== */
@media (max-width: 600px) {

    header {
        padding: 16px 12px;
    }

    .header-top {
        justify-content: center;
    }

    .header-top h1 {
        font-size: 1.4rem;
        text-align: center;
    }

    .header-actions {
        display: none !important;
    }

    .hamburger-btn {
        display: flex;
    }

    header p {
        font-size: 0.8rem;
        margin-top: 4px;
    }

    main {
        margin: 8px;
        padding: 12px;
        border-radius: 10px;
    }

    /* Mobile: main has 8px margin all sides (from the rule above), so
       width:100% from the sticky-footer rule overflows by 16px. Subtract
       the margin so the card fits perfectly inside the viewport. */
    body > main,
    body > #app-shell {
        width: calc(100% - 16px);
    }
    /* Legal pages keep auto-margins on .legal-main (no fixed left/right
       margins), so they stay at the natural 100% width. */
    body.legal-body > main.legal-main {
        width: 100%;
    }

    h2 {
        font-size: 1.3rem;
        text-align: center;
    }

    /* Auth kaart full width */
    .auth-card {
        padding: 14px;
        margin-left: 0;
        margin-right: 0;
    }

    .auth-card form {
        max-width: 100%;
    }

    .auth-card button {
        width: 100%;
    }

    .auth-tab {
        width: auto;
    }

    .social-login-buttons {
        grid-template-columns: 1fr;
    }

    /* User bar wrappen bij kleine schermen */
    #user-bar {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Buttons full width */
    .subject-buttons {
        flex-direction: column;
    }

    .subject-buttons button,
    .controls button,
    .back-btn,
    #exam-items li button {
        width: 100%;
        min-width: unset;
        box-sizing: border-box;
    }

    /* Verberg zoekbalk op mobiel */
    .search-input {
        display: none;
    }

    /* Controls onder elkaar */
    .controls {
        flex-direction: column;
    }

    /* Vraag blok iets compacter */
    .question {
        padding: 12px;
    }

    /* Opties beter klikbaar (touch targets) */
    .option {
        padding: 14px 12px;
        font-size: 15px;
    }

    /* Score samenvatting kleiner */
    .score-summary h2 {
        font-size: 2.8rem;
    }

    /* Score grid netjes stacken */
    .score-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Progress bar spacing */
    #progress-text {
        font-size: 12px;
    }

    /* History toolbar */
    .history-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .history-toolbar select {
        width: 100%;
    }

    /* Result box */
    #results {
        padding: 14px;
    }

    /* Kleinere score cells op heel kleine schermen */
    .score-cell strong {
        font-size: 1.2rem;
    }

    .result-badge {
        font-size: 0.75rem;
    }

    /* User bar compact on mobile */
    #user-bar {
        font-size: 1rem;
    }

    /* Auth card mobile polish */
    .auth-tabs {
        border-radius: 8px 8px 0 0;
    }

    .auth-tab {
        font-size: 0.9rem;
        padding: 10px 12px;
    }

    .social-login-buttons {
        grid-template-columns: 1fr;
    }

    .social-btn {
        font-size: 0.85rem;
        padding: 10px 14px;
    }

    /* Nav tabs on mobile */
    .main-nav-tab {
        font-size: 0.85rem;
        padding: 8px 12px;
    }

    /* Exam tools stacked */
    .exam-tools {
        flex-direction: column;
        gap: 8px;
    }

    .exam-tools select,
    .exam-tools label {
        width: 100%;
    }

    /* Exam meta compact */
    .exam-meta {
        flex-wrap: wrap;
        gap: 6px;
    }

    /* Question nav dots smaller */
    .nav-dot {
        width: 28px;
        height: 28px;
        min-width: 28px;
        font-size: 0.75rem;
    }

    /* Dashboard grid on mobile */
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.auth-card {
    background: var(--bg-auth);
    border: 1px solid var(--auth-border);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 18px;
    max-width: 620px;
    margin-left: auto;
    margin-right: auto;
}

.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 460px;
    margin: 10px auto 0;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-card label {
    font-weight: 600;
    color: var(--text-secondary);
}

.auth-card input {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--input-border);
    background: var(--bg-input);
    color: var(--text-primary);
}

.auth-card form > button[type="submit"] {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
    margin-top: 4px;
}

.auth-card select {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--input-border);
    background: var(--bg-input);
    color: var(--text-primary);
}

.auth-tabs {
    display: flex;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--auth-border);
    overflow: hidden;
    border-radius: 10px 10px 0 0;
    background: rgba(255,255,255,0.03);
}

.auth-tab {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    min-width: 0;
}

.auth-tab:hover {
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.05);
}

.auth-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

.auth-message {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.auth-error {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.auth-success {
    background: rgba(40, 167, 69, 0.15);
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 18px auto 14px;
    gap: 12px;
    max-width: 460px;
}

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

.auth-divider span {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.social-login-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    max-width: 460px;
    margin: 0 auto;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid var(--input-border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    width: 100%;
}

.social-btn:hover {
    border-color: #3b82f6;
}

.social-btn svg {
    flex-shrink: 0;
}

.google-btn:hover { border-color: #4285F4; }
.microsoft-btn:hover { border-color: #00a4ef; }
.facebook-btn:hover { border-color: #1877F2; }
.apple-btn:hover { border-color: #555; }

#user-bar {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 12px 14px;
    margin-bottom: 0;
    font-size: 1.25rem;
}

#user-bar .user-welcome {
    color: var(--text-muted);
}

#user-bar strong {
    color: var(--text-primary);
    font-weight: 700;
}

.logout-ghost {
    background: transparent;
    border: 1px solid var(--input-border);
    color: var(--text-secondary);
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.logout-ghost:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
    background: rgba(0,0,0,0.04);
}

.modal-logout {
    width: 100%;
    margin-top: 12px;
    padding: 9px 14px;
    font-size: 0.88rem;
    border-color: rgba(220, 53, 69, 0.4);
    color: #e05560;
}

.modal-logout:hover {
    border-color: #e05560;
    background: rgba(220, 53, 69, 0.08);
    color: #ff6b76;
}

.modal-delete-account {
    width: 100%;
    margin-top: 6px;
    padding: 9px 14px;
    font-size: 0.88rem;
    border-color: rgba(180, 30, 45, 0.4);
    color: #b91c1c;
}

.modal-delete-account:hover {
    border-color: #b91c1c;
    background: rgba(180, 30, 45, 0.12);
    color: #ef4444;
}

.main-nav {
    display: flex;
    border-bottom: 2px solid var(--auth-border);
    margin-bottom: 16px;
    background: rgba(255,255,255,0.03);
    border-radius: 10px 10px 0 0;
    overflow: hidden;
}

.main-nav-tab {
    flex: 1;
    padding: 11px 16px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    text-align: center;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.main-nav-tab:hover {
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.05);
}

.main-nav-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

.history-panel {
    margin-top: 16px;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--history-panel-border);
    background: var(--bg-history-panel);
}

#history-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.history-item {
    padding: 10px;
    border: 1px solid var(--history-item-border);
    border-radius: 8px;
    background: var(--bg-history-item);
}

.history-empty {
    color: var(--text-muted);
}

.history-summary {
    margin: 10px 0 14px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--history-summary-border);
    background: var(--bg-history-summary);
}

.history-summary p {
    margin: 0 0 6px;
}

.history-summary ul {
    margin: 0;
    padding-left: 16px;
}

.history-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.history-toolbar select {
    border: 1px solid var(--select-border);
    background: var(--bg-select);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 8px 10px;
}

.exam-tools {
    display: flex;
    gap: 12px;
    align-items: center;
    margin: 10px 0 12px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1 1 280px;
    min-width: 220px;
    border: 1px solid var(--select-border);
    background: var(--bg-select);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 10px 12px;
}

.shuffle-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-weight: 600;
}

.result-badge {
    display: inline-block;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border-radius: 999px;
    padding: 4px 10px;
    margin-right: 6px;
}

.result-badge.pass {
    color: var(--badge-pass-color);
    background: var(--badge-pass-bg);
    border: 1px solid var(--badge-pass-border);
}

.result-badge.fail {
    color: var(--badge-fail-color);
    background: var(--badge-fail-bg);
    border: 1px solid var(--badge-fail-border);
}

.history-duration {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.review-ok {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--review-ok-border);
    background: var(--review-ok-bg);
    color: var(--review-ok-color);
}

.review-item {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--review-item-bg);
    border: 1px solid var(--review-item-border);
}

.review-item.wrong {
    border-color: var(--review-wrong-border);
    background: var(--review-wrong-bg);
}

.review-item.wrong p {
    color: var(--review-wrong-color);
}

@media (max-width: 400px) {
    h1 {
        font-size: 1.2rem;
    }

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

    .score-summary h2 {
        font-size: 2.2rem;
    }

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

/* ===== TABLET (iPad) ===== */
@media (max-width: 1024px) and (min-width: 601px) {
    .search-input {
        display: none;
    }

    .header-actions {
        display: none !important;
    }

    .hamburger-btn {
        display: flex;
    }

    .header-top h1 {
        font-size: 2.2rem;
    }
}

.dashboard-card {
    margin-bottom: 16px;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: var(--bg-card);
}

.dashboard-card h3 {
    margin: 0 0 10px;
}

/* ===== TOPIC PROGRESS ===== */
.topic-progress-panel {
    margin-bottom: 16px;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: var(--bg-card);
}

.topic-progress-panel h3 {
    margin: 0 0 12px;
}

.topic-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.topic-filter-row label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.topic-filter-row select {
    border: 1px solid var(--select-border);
    background: var(--bg-select);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.9rem;
    min-width: 0;
    max-width: 240px;
}

.topic-filter-row select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 600px) {
    .topic-filter-row {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }
    .topic-filter-row select {
        max-width: 100%;
        width: 100%;
    }
}

.topic-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.topic-label {
    min-width: 130px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.topic-bar-track {
    flex: 1;
    height: 10px;
    border-radius: 6px;
    background: var(--bg-progress);
    overflow: hidden;
}

.topic-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.4s ease;
}

.topic-bar-high {
    background: linear-gradient(90deg, #2ecc71, #27ae60);
}

.topic-bar-mid {
    background: linear-gradient(90deg, #f39c12, #e67e22);
}

.topic-bar-low {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
}

.topic-pct {
    min-width: 40px;
    text-align: right;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.topic-subject-header {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--h2-color);
    margin: 14px 0 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--card-border);
}

.topic-subject-header:first-child {
    margin-top: 0;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(110px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}

.dashboard-cell {
    border-radius: 10px;
    border: 1px solid var(--dashboard-cell-border);
    background: var(--bg-dashboard-cell);
    padding: 10px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: default;
}

.dashboard-cell:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px var(--shadow-main);
}

.dashboard-cell strong {
    display: block;
    font-size: 1.35rem;
    color: var(--text-primary);
}

.dashboard-cell span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.exam-tools label,
.exam-tools select {
    color: var(--text-secondary);
    font-weight: 600;
}

.exam-tools select {
    border: 1px solid var(--select-border);
    background: var(--bg-select);
    border-radius: 8px;
    padding: 9px 10px;
}

.exam-tools select:disabled {
    opacity: 0.5;
}

.exam-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0 4px;
}

.mode-badge,
.timer-text {
    display: inline-block;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border-radius: 999px;
    padding: 5px 10px;
}

.mode-badge {
    color: var(--mode-badge-color);
    background: var(--mode-badge-bg);
    border: 1px solid var(--mode-badge-border);
}

/* Forgot password link */
.forgot-password-link {
    display: block;
    text-align: center;
    margin-top: 10px;
    color: var(--link-color, #6aa5ff);
    font-size: 0.85rem;
    text-decoration: none;
    cursor: pointer;
}

.forgot-password-link:hover {
    text-decoration: underline;
}

.reset-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 12px;
    text-align: center;
}

/* Profile edit modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    z-index: 1000;
    padding: 16px;
    box-sizing: border-box;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-overlay > .modal-card {
    margin-block: auto;
    flex-shrink: 0;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.profile-modal-card {
    max-width: 440px;
}

.profile-tier-card {
    background: linear-gradient(135deg, rgba(106, 165, 255, 0.10), rgba(79, 202, 154, 0.08));
    border: 1px solid rgba(106, 165, 255, 0.25);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-tier-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.profile-tier-label {
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-tier-badge {
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--tier-free-bg);
    color: var(--tier-free-color);
    border: 1px solid var(--tier-free-border);
}

.profile-tier-badge.profile-tier-premium {
    background: var(--tier-premium-bg);
    color: var(--tier-premium-color);
    border-color: var(--tier-premium-border);
}

.profile-tier-badge.profile-tier-pro {
    background: var(--tier-pro-bg);
    color: var(--tier-pro-color);
    border-color: var(--tier-pro-border);
}

.profile-tier-badge.profile-tier-admin {
    background: linear-gradient(135deg, #6a3df0, #c14bff);
    color: #fff;
    border-color: #c14bff;
}

.profile-tier-quota {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.profile-tier-quota strong {
    color: var(--text-primary);
}

.profile-upgrade-btn {
    align-self: flex-start;
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s ease;
}

.profile-upgrade-btn:hover {
    filter: brightness(1.1);
}

.profile-locked-input {
    opacity: 0.65;
    cursor: not-allowed;
}

.profile-locked-note {
    margin: 6px 0 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.delete-account-card {
    border-color: rgba(220, 80, 80, 0.45);
}

.delete-account-card h3 {
    color: var(--delete-warning-heading);
}

.delete-account-warning {
    background: var(--delete-warning-bg);
    border: 1px solid var(--delete-warning-border);
    border-radius: 10px;
    padding: 10px 12px;
    color: var(--delete-warning-text);
    font-size: 0.92rem;
    font-weight: 500;
    line-height: 1.5;
    margin: 0 0 14px;
}

.confirm-uppercase-input {
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
}

.btn-danger {
    background: #c14a4a !important;
    border-color: #c14a4a !important;
    color: #fff !important;
}

.btn-danger:hover:not(:disabled) {
    background: #d35a5a !important;
    border-color: #d35a5a !important;
}

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

.app-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    background: rgba(20, 30, 50, 0.95);
    color: #fff;
    border: 1px solid rgba(106, 165, 255, 0.35);
    border-radius: 10px;
    padding: 12px 18px;
    font-size: 0.92rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 9999;
    max-width: calc(100% - 32px);
}

.app-toast-success {
    border-color: rgba(79, 202, 154, 0.45);
}

.app-toast-error {
    border-color: rgba(220, 80, 80, 0.45);
    background: rgba(70, 20, 20, 0.95);
}

.modal-card h3 {
    margin: 0 0 16px;
    color: var(--text-primary);
    font-size: 1.2rem;
}

.modal-card .auth-field {
    margin-bottom: 12px;
}

.modal-card .auth-field input,
.modal-card .auth-field select {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--input-border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.9rem;
    box-sizing: border-box;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.modal-actions button {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--input-border);
    font-size: 0.9rem;
}

.modal-actions button[type="submit"] {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.modal-actions button[type="button"] {
    background: var(--bg-input);
    color: var(--text-primary);
}

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

.timer-text.warning {
    color: var(--timer-warn-color);
    background: var(--timer-warn-bg);
    border-color: var(--timer-warn-border);
}

.question-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 14px;
}

/* ===== SUBMIT KNOP ===== */
#submit-btn {
    background: linear-gradient(145deg, #28a060 0%, #1e8a50 100%);
    border-color: rgba(80, 220, 150, 0.7);
    box-shadow: 0 4px 14px rgba(30, 138, 80, 0.4);
    font-size: 15px;
    letter-spacing: 0.02em;
}

#submit-btn:hover {
    background: linear-gradient(145deg, #30b870 0%, #23a05a 100%);
}

/* ===== SECTIES FADE-IN ===== */
#dashboard-view,
#year-list,
#subject-list,
#exam-list,
#exam-container {
    animation: fadeIn 0.25s ease;
}

#subject-list,
#exam-list {
    flex-direction: column;
}

@media (min-width: 601px) {
    /* Let the active list grow inside #app-shell so its footer sits at
       the bottom-left of the card. `margin-top: auto` on the footer
       pushes only the footer down — content above stays at its natural
       size. Since #app-shell only grows up to the card's height, the
       back button never falls below the fold. */
    #subject-list,
    #exam-list {
        flex: 1 1 auto;
    }

    #subject-list .subject-list-footer,
    #exam-list .exam-list-footer {
        margin-top: auto;
    }
}

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

.nav-dot {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 50%;
    border: 2px solid var(--nav-dot-border);
    background: var(--nav-dot-bg);
    color: var(--text-secondary);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.nav-dot:hover {
    transform: scale(1.12);
    box-shadow: 0 0 8px rgba(110, 174, 255, 0.4);
}

.nav-dot.answered {
    border-color: rgba(89, 210, 162, 0.75);
    background: rgba(15, 77, 55, 0.5);
}

.nav-dot.correct {
    border-color: rgba(93, 231, 175, 0.9);
    background: rgba(17, 108, 73, 0.72);
    color: #d7ffe8;
}

.nav-dot.incorrect {
    border-color: rgba(255, 132, 132, 0.9);
    background: rgba(112, 34, 47, 0.75);
    color: #ffe2e2;
}

.nav-dot.flagged {
    border-color: rgba(255, 188, 104, 0.85);
    background: rgba(110, 71, 22, 0.58);
}

.nav-dot.active {
    box-shadow: 0 0 0 2px rgba(110, 174, 255, 0.6);
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }
}

@media (max-width: 600px) {
    .exam-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .main-nav {
        border-radius: 0;
    }

    .main-nav-tab {
        font-size: 0.85rem;
        padding: 9px 10px;
    }

    .question-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        gap: 6px;
        padding: 4px 4px;
        justify-content: flex-start;
        align-items: center;
    }

    .nav-dot {
        width: 36px;
        height: 36px;
        min-width: 36px;
        font-size: 12px;
        flex-shrink: 0;
    }

    /* Exam list still uses flex-direction column for ordering controls
       on mobile (search/mode/timer stack above the list). Subject list
       has its back button in a footer now, so it no longer needs the
       reordering hack. */
    #exam-list {
        flex-direction: column;
    }

    .subject-list-footer {
        flex-direction: column;
        align-items: stretch;
        margin-top: 16px;
    }

    .subject-list-footer .back-btn-compact {
        width: 100%;
        padding: 10px 14px;
        border-radius: 10px;
        font-size: 1rem;
    }

    .exam-list-footer {
        flex-direction: column;
        align-items: stretch;
        margin-top: 16px;
        gap: 12px;
    }

    /* Generate above, back below on mobile */
    .exam-list-footer .btn-generate-quiz {
        order: 1;
    }
    .exam-list-footer .back-btn-compact {
        order: 2;
    }

    .exam-list-footer .back-btn-compact,
    .exam-list-footer .btn-generate-quiz {
        display: block;
        width: 100%;
        box-sizing: border-box;
        margin: 0;
        padding: 10px 14px;
        border-radius: 10px;
        font-size: 1rem;
    }

    .generate-quiz-wrapper {
        margin-top: 16px;
        text-align: center;
    }

    .exam-tools {
        flex-direction: column;
        align-items: stretch;
    }

    .exam-tools label {
        margin-top: 4px;
    }

    .exam-tools select {
        width: 100%;
    }
}

/* ===== THEME TOGGLE ===== */
.theme-toggle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--input-border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 1.15rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: border-color 0.15s, background 0.15s;
}

.theme-toggle:hover {
    border-color: #3b82f6;
    background: var(--option-hover-bg);
}

/* ===== COLOR-CODED HISTORY SCORES ===== */
.history-item.score-high {
    border-left: 4px solid #22c55e;
}

.history-item.score-mid {
    border-left: 4px solid #f59e0b;
}

.history-item.score-low {
    border-left: 4px solid #ef4444;
}

/* ===== HISTORY PAGINATION ===== */
.history-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.history-pagination button {
    min-width: auto;
    padding: 6px 14px;
    font-size: 13px;
}

.history-page-info {
    display: inline-flex;
    align-items: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* ===== LOADING SPINNER ===== */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.loading-spinner::before {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid var(--bg-progress);
    border-top-color: var(--btn-bg);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* ===== OFFLINE NOTICE ===== */
.offline-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 16px;
    background: var(--feedback-incorrect-bg);
    border-top: 2px solid var(--feedback-incorrect-border);
    color: var(--feedback-incorrect-color);
    text-align: center;
    font-size: 0.88rem;
    font-weight: 600;
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.offline-bar.visible {
    transform: translateY(0);
}

/* ===== FOCUS INDICATORS (a11y) ===== */
*:focus-visible {
    outline: 3px solid rgba(66, 133, 244, 0.7);
    outline-offset: 2px;
}

/* ===== AI TOETS GENEREREN ===== */

/* Modal maximale breedte aanpassen voor AI modal */
#generate-quiz-modal .modal-card {
    max-width: 560px;
    position: relative; /* anker voor lock-overlay */
}

/* UI-lock overlay tijdens generatie: dekt het hele modal-card,
   blokkeert clicks/keys op alles eronder. */
.gq-lock-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 17, 26, 0.78);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: none; /* JS zet dit op flex */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    z-index: 50;
    border-radius: inherit;
    text-align: center;
    padding: 1.5rem;
    cursor: wait;
}
.gq-lock-overlay .loading-spinner {
    margin: 0;
}
.gq-lock-text {
    font-weight: 600;
    color: #fff;
    margin: 0;
    font-size: 1rem;
}
.gq-lock-hint {
    color: rgba(255, 255, 255, 0.75);
    margin: 0;
    font-size: 0.9rem;
    max-width: 28rem;
}
/* Wanneer modal aan het genereren is: verhinder pointer events op het form. */
#generate-quiz-modal.is-generating #gq-form,
#generate-quiz-modal.is-generating #gq-mismatch {
    pointer-events: none;
    user-select: none;
    opacity: 0.55;
}
#generate-quiz-modal.is-generating .modal-close-btn {
    opacity: 0.4;
    cursor: not-allowed;
}

#generate-quiz-modal .modal-card h2 {
    color: var(--h2-color);
    margin-bottom: 1.25rem;
    font-size: 1.2rem;
}

.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: 0;
    transition: color 0.15s;
}

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

#generate-quiz-modal textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 0.75rem;
    font-size: 0.9rem;
    resize: vertical;
    box-sizing: border-box;
}

#generate-quiz-modal input[type="file"] {
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.checkbox-field label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.checkbox-field input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--btn-bg);
    flex-shrink: 0;
}

.gq-success {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.gq-success p {
    margin: 0;
}

/* Vaknaam banner */
.gq-subject-banner {
    background: rgba(59, 108, 212, 0.15);
    border: 1px solid rgba(59, 108, 212, 0.4);
    border-radius: 8px;
    padding: 0.6rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
 
.gq-subject-banner strong {
    color: var(--text-primary);
}

/* Quota banner inside generate-quiz modal */
.gq-quota-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 8px;
    padding: 0.55rem 0.9rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.gq-quota-banner.gq-quota-warning {
    background: rgba(247, 167, 49, 0.10);
    border-color: rgba(247, 167, 49, 0.40);
    color: #ffd9a8;
}

.gq-quota-banner.gq-quota-full {
    background: rgba(220, 80, 80, 0.10);
    border-color: rgba(220, 80, 80, 0.40);
    color: #ffb4b4;
}

.gq-quota-banner strong {
    color: var(--text-primary);
    font-weight: 700;
}

.gq-quota-tier {
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(106, 165, 255, 0.15);
    color: #cfe1ff;
}

.gq-quota-reset {
    flex-basis: 100%;
    font-size: 0.78rem;
    opacity: 0.85;
}

/* Upgrade modal */
.upgrade-modal-card {
    max-width: 880px !important;
}

.upgrade-modal-card h2 {
    color: var(--h2-color);
    margin: 0 0 0.5rem;
    text-align: center;
}

.upgrade-intro {
    text-align: center;
    color: var(--text-secondary);
    margin: 0 0 1.5rem;
}

.upgrade-tiers {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 1rem;
}

.upgrade-tier {
    position: relative;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 18px 16px 16px;
    display: flex;
    flex-direction: column;
    text-align: center;
}

.upgrade-tier-recommended {
    border-color: rgba(106, 165, 255, 0.55);
    background: linear-gradient(180deg, rgba(63, 108, 222, 0.18), rgba(63, 108, 222, 0.04));
}

.upgrade-recommended-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: #3f6cde;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 3px 10px;
    border-radius: 999px;
}

.upgrade-tier h3 {
    margin: 0 0 0.4rem;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.upgrade-price {
    margin: 0 0 0.85rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

.upgrade-price .upgrade-period {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

.upgrade-features {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
    text-align: left;
    flex: 1;
}

.upgrade-features li {
    position: relative;
    padding: 4px 0 4px 20px;
    color: var(--text-secondary);
    font-size: 0.86rem;
}

.upgrade-features li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #4fca9a;
    font-weight: 700;
}

.upgrade-btn {
    width: 100%;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: not-allowed;
    opacity: 0.7;
}

.upgrade-btn-primary {
    background: var(--btn-bg);
    border-color: var(--btn-border);
    color: #fff;
    opacity: 1;
}

.upgrade-tier-current .upgrade-btn {
    background: rgba(79, 202, 154, 0.15);
    border-color: rgba(79, 202, 154, 0.45);
    color: #b5ffe1;
}

.upgrade-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.78rem;
    margin: 0.5rem 0 0;
}

.upgrade-reset-info {
    text-align: center;
    color: #ffd9a8;
    font-size: 0.85rem;
    margin: 0.75rem 0 0;
}

@media (max-width: 720px) {
    .upgrade-tiers {
        grid-template-columns: 1fr;
    }
}

/* Mismatch bevestigingspaneel */
.gq-mismatch-panel {
    text-align: center;
    padding: 0.5rem 0;
}
 
.gq-mismatch-icon {
    font-size: 2.5rem;
    margin: 0 0 0.5rem;
}
 
.gq-mismatch-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}
 
.gq-mismatch-reason {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0 0 1rem;
    line-height: 1.5;
}
 
.gq-mismatch-question {
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.75rem;
}
 
.gq-mismatch-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
 
.btn-mismatch-confirm {
    background: var(--btn-bg);
    color: #fff;
    border: 1px solid var(--btn-border);
    border-radius: 8px;
    padding: 0.65rem 1rem;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: background 0.15s;
}
 
.btn-mismatch-confirm:hover {
    background: var(--btn-hover-bg);
}
 
.btn-mismatch-confirm strong {
    font-weight: 700;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    border-radius: 8px;
    padding: 0.6rem 1.2rem;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.15s, color 0.15s;
}

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

/* AI-toetsen paneel in de exam-list view */
.ai-quizzes-panel {
    margin-top: 1.5rem;
    border-top: 1px solid var(--card-border);
    padding-top: 1.25rem;
}

.ai-quizzes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ai-quizzes-header h3 {
    color: var(--text-primary);
    font-size: 1rem;
    margin: 0;
}

.generate-quiz-wrapper {
    margin-top: 1.5rem;
    text-align: right;
}

.exam-list-footer {
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.subject-list-footer {
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
}

@media (min-width: 601px) {
    .exam-list-footer .back-btn-compact,
    .subject-list-footer .back-btn-compact {
        display: inline-flex;
        align-items: center;
        width: auto;
        margin: 0;
        min-width: 0;
        padding: 0.45rem 0.9rem;
        border-radius: 8px;
        font-size: 0.88rem;
        font-weight: 600;
        color: #fff;
    }
}

.btn-generate-quiz {
    background: var(--btn-bg);
    color: #fff;
    border: 1px solid var(--btn-border);
    border-radius: 8px;
    padding: 0.45rem 0.9rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.88rem;
    transition: background 0.15s, border-color 0.15s;
}

.btn-generate-quiz:hover {
    background: var(--btn-hover-bg);
    border-color: var(--btn-hover-border);
}

.ai-quiz-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background: var(--bg-history-item);
    border: 1px solid var(--history-item-border);
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.ai-quiz-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ai-quiz-info strong {
    color: var(--text-primary);
    font-size: 0.95rem;
}

.ai-quiz-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.ai-quiz-badge {
    font-size: 0.72rem;
    padding: 0.1rem 0.5rem;
    border-radius: 99px;
    font-weight: 600;
    display: inline-block;
    margin-top: 0.1rem;
}

.ai-quiz-badge.shared  { background: rgba(30, 90, 40, 0.5); color: #6dffaa; border: 1px solid rgba(80, 200, 120, 0.4); }
.ai-quiz-badge.private { background: rgba(40, 40, 60, 0.5); color: var(--text-muted); border: 1px solid var(--card-border); }

.ai-quiz-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.ai-quiz-actions button {
    font-size: 0.8rem;
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    border: 1px solid var(--card-border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.ai-quiz-actions button:hover {
    background: var(--bg-option);
    color: var(--text-primary);
}

.ai-quiz-actions .btn-start-ai-quiz {
    background: var(--btn-bg);
    border-color: var(--btn-border);
    color: #fff;
    font-weight: 600;
}

.ai-quiz-actions .btn-start-ai-quiz:hover {
    background: var(--btn-hover-bg);
}

.ai-quiz-actions .btn-delete-ai-quiz {
    color: var(--feedback-incorrect-color);
    border-color: rgba(242, 125, 125, 0.3);
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ai-quiz-actions .btn-delete-ai-quiz:hover,
.ai-quiz-actions .btn-delete-ai-quiz:focus-visible {
    background: rgba(220, 80, 80, 0.18);
    border-color: rgba(242, 125, 125, 0.65);
    color: #ff9b9b;
}

@media (max-width: 600px) {
    .ai-quiz-item {
        flex-direction: column;
        align-items: flex-start;
    }
    .ai-quiz-actions {
        width: 100%;
    }
    .modal-overlay {
        padding: 8px;
    }

    .modal-card {
        padding: 1.25rem;
    }

    #generate-quiz-modal .modal-card {
        padding: 1.25rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
        border-radius: 14px;
    }

    #generate-quiz-modal .modal-card h2 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
        padding-right: 2rem;
    }

    #generate-quiz-modal .gq-subject-banner {
        font-size: 0.85rem;
        padding: 0.55rem 0.75rem;
        line-height: 1.35;
        word-break: break-word;
    }

    #generate-quiz-modal .auth-field {
        margin-bottom: 0.85rem;
    }

    #generate-quiz-modal .custom-file-input-wrapper {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    #generate-quiz-modal .custom-file-label {
        flex-shrink: 0;
    }

    #generate-quiz-modal .file-chosen-label {
        margin-left: 0;
        flex: 1 1 auto;
        min-width: 0;
    }

    #generate-quiz-modal textarea {
        min-height: 110px;
    }

    #gq-submit {
        width: 100%;
        padding: 0.85rem;
        font-size: 1rem;
        margin-top: 0.5rem;
    }

    .gq-mismatch-actions button {
        width: 100%;
    }

    /* ===== EXAM CARD COMPACT (mobile) =====
       Inline styles win normally; we use !important here to compact the
       buttons on phones without restructuring the layout. */
    .exam-card {
        padding: 12px 14px !important;
        gap: 8px !important;
    }
    .exam-card-start {
        padding: 7px 12px !important;
        font-size: 12px !important;
    }
    .exam-card-share {
        padding: 7px 10px !important;
        font-size: 12px !important;
    }
    .exam-card-delete {
        padding: 7px 10px !important;
        font-size: 13px !important;
    }
    .exam-card-info strong {
        font-size: 14px !important;
    }
}

@media (max-width: 420px) {
    /* On very narrow phones, hide the share button label so only the lock/link
       icon stays visible — keeps the row horizontal without overflowing. */
    .exam-card-share .exam-card-share-label {
        display: none;
    }
    .exam-card-share {
        padding: 7px 9px !important;
    }
}

/* ===== SITE FOOTER ===== */
.site-footer {
    margin-top: 2.5rem;
    padding: 1.25rem 1rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--card-border);
    background: rgba(0, 0, 0, 0.18);
    color: var(--text-muted);
    font-size: 0.82rem;
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.6rem 1.25rem;
}

.footer-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem 1.1rem;
}

.footer-nav a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s;
}

.footer-nav a:hover {
    color: var(--link-color);
    text-decoration: underline;
}

@media (max-width: 600px) {
    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }
    .footer-nav {
        gap: 0.4rem 0.9rem;
    }
}

/* ===== LEGAL PAGES (about / privacy / terms / contact) ===== */
/* Strip the global main card styling on legal pages so we don't get a
   card-inside-a-card; only .legal-card should look like a card. */
body.legal-body > main.legal-main {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0 1rem;
    border-radius: 0;
}

.legal-main {
    max-width: 820px;
    margin: 1.5rem auto 2rem;
    padding: 0 1rem;
}

.legal-card {
    background: var(--bg-card);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 2rem clamp(1.25rem, 4vw, 2.5rem);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    color: var(--text-secondary);
    line-height: 1.6;
}

.legal-card h2 {
    color: var(--h2-color);
    margin: 0 0 0.4rem;
    font-size: 1.6rem;
}

.legal-card h3 {
    color: var(--text-primary);
    margin: 1.5rem 0 0.6rem;
    font-size: 1.05rem;
}

.legal-card p,
.legal-card ul {
    margin: 0 0 0.85rem;
}

.legal-card ul {
    padding-left: 1.25rem;
}

.legal-card ul li {
    margin-bottom: 0.35rem;
}

.legal-card a {
    color: var(--link-color);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.legal-card a:hover {
    color: var(--link-hover);
}

.legal-callout {
    background: var(--notice-warning-bg);
    border: 1px solid var(--notice-warning-border);
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--notice-warning-text);
    font-size: 0.92rem;
    line-height: 1.55;
    margin: 0 0 14px;
}

.legal-callout strong {
    color: var(--notice-warning-text);
}

.legal-lead {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 1.25rem !important;
}

.legal-meta {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1.5rem !important;
}

.header-home-link {
    color: inherit;
    text-decoration: none;
}

.header-home-link:hover {
    color: var(--link-color);
}

/* ===== CONTACT FORM ===== */
.contact-form {
    margin: 1.5rem 0 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contact-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.contact-field label {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
}

.contact-field input,
.contact-field textarea {
    background: var(--bg-input);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 0.65rem 0.85rem;
    font-size: 0.95rem;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.contact-field input:focus,
.contact-field textarea:focus {
    outline: none;
    border-color: var(--btn-bg);
    box-shadow: 0 0 0 3px rgba(63, 108, 222, 0.18);
}

.contact-field textarea {
    resize: vertical;
    min-height: 140px;
    line-height: 1.5;
}

/* Honeypot — visually hidden but still focusable for assistive tech.
   Bots auto-fill it because they parse the DOM, not the rendered page. */
.contact-honeypot {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.contact-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.25rem;
}

.contact-submit {
    background: var(--btn-bg);
    color: #fff;
    border: 1px solid var(--btn-border);
    border-radius: 8px;
    padding: 0.7rem 1.4rem;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.05s;
}

.contact-submit:hover:not(:disabled) {
    background: var(--btn-hover-bg);
    border-color: var(--btn-hover-border);
}

.contact-submit:active:not(:disabled) {
    transform: translateY(1px);
}

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

.contact-status {
    min-height: 1.5em;
    margin: 0.5rem 0 0;
    font-size: 0.92rem;
    color: var(--text-muted);
}

.contact-status-success {
    color: var(--feedback-correct-color, #b5ffe1);
}

.contact-status-invalid,
.contact-status-captcha,
.contact-status-generic {
    color: var(--feedback-incorrect-color, #ffcec5);
}

.contact-footnote {
    margin-top: 1.25rem !important;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.55;
}

@media (max-width: 600px) {
    .contact-actions {
        justify-content: stretch;
    }
    .contact-submit {
        width: 100%;
    }
}

/* Results screen: "Terug naar toetsen" + "Volgende Toets" side by side. */
.result-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
}

.result-actions .result-back-btn,
.result-actions .result-next-btn {
    flex: 0 1 auto;
}

@media (max-width: 600px) {
    .result-actions {
        flex-direction: column;
        align-items: stretch;
    }
    /* Stack on mobile, next-button on top so the primary action is closest to thumb. */
    .result-actions .result-next-btn { order: 1; }
    .result-actions .result-back-btn  { order: 2; }
}