/* ========================================
   PM-Lernplattform — Styles
   Self-hosted Fonts (DSGVO-konform, kein Google CDN)
   ======================================== */

@font-face {
    font-family: 'DM Sans';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/fonts/DMSans-variable.woff2') format('woff2');
}
@font-face {
    font-family: 'DM Sans';
    font-style: italic;
    font-weight: 100 900;
    font-display: swap;
    src: url('/fonts/DMSans-variable-italic.woff2') format('woff2');
}
@font-face {
    font-family: 'Fraunces';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/fonts/Fraunces-variable.woff2') format('woff2');
}
@font-face {
    font-family: 'Fraunces';
    font-style: italic;
    font-weight: 100 900;
    font-display: swap;
    src: url('/fonts/Fraunces-variable-italic.woff2') format('woff2');
}

:root {
    --bg: #f5f3f0;
    --surface: #ffffff;
    --surface-alt: #faf9f7;
    --border: #e8e4df;
    --border-light: #f0ece7;
    --text: #1a1714;
    --text-secondary: #6b6560;
    --text-muted: #9e9790;
    --accent: #2d5a27;
    --accent-light: #e8f0e7;
    --accent-hover: #234a1f;
    --danger: #b33d3d;
    --danger-light: #fdf0f0;
    --success: #2d5a27;
    --success-light: #e8f0e7;
    --warning: #a67c00;
    --warning-light: #fef9e7;
    --nav-answered: #2d5a27;
    --nav-current: #1a1714;
    --nav-unanswered: #e8e4df;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow-sm: 0 1px 3px rgba(26, 23, 20, 0.06);
    --shadow-md: 0 4px 16px rgba(26, 23, 20, 0.08);
    --shadow-lg: 0 8px 32px rgba(26, 23, 20, 0.1);
    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ========================================
   DARK MODE
   ======================================== */
:root[data-theme="dark"] {
    --bg: #141210;
    --surface: #1d1b18;
    --surface-alt: #252220;
    --border: #3a3632;
    --border-light: #302d2a;
    --text: #f0ece6;
    --text-secondary: #a09890;
    --text-muted: #6e6a62;
    --accent: #5aaa52;
    --accent-light: #1a3218;
    --accent-hover: #6ab862;
    --danger: #e05252;
    --danger-light: #2a1212;
    --success: #5aaa52;
    --success-light: #1a3218;
    --warning: #d4a000;
    --warning-light: #2a2000;
    --nav-answered: #5aaa52;
    --nav-current: #f0ece6;
    --nav-unanswered: #3a3632;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- SCREEN MANAGEMENT ---- */
.screen { display: none; }
.screen.active { display: block; }

/* ========================================
   LOGIN / AUTH SCREEN
   ======================================== */
#login-screen {
    min-height: 100vh;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(45, 90, 39, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(166, 124, 0, 0.04) 0%, transparent 50%),
        var(--bg);
}
#login-screen.active { display: flex; }

.auth-container {
    max-width: 440px;
    width: 100%;
}

.auth-logo {
    margin-bottom: 1.5rem;
}
.auth-logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--accent);
    color: #fff;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
}

.auth-title {
    font-family: var(--font-display);
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--text);
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}
.auth-title span {
    font-weight: 300;
    font-style: italic;
    color: var(--text-secondary);
}

.auth-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.auth-form { /* container for each form variant */ }

.form-group {
    margin-bottom: 1.25rem;
}
.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
    color: var(--text);
}
.form-input {
    width: 100%;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    font-family: var(--font-body);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(45, 90, 39, 0.12);
}
.form-input.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(179, 61, 61, 0.1);
}
/* .form-error styles moved to bottom of file */

.form-static {
    padding: 0.8rem 1rem;
    font-size: 1rem;
    background: var(--surface-alt);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-weight: 500;
}

/* Password display card */
.password-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    text-align: center;
}
.password-card-icon {
    color: var(--accent);
    margin-bottom: 0.75rem;
}
.password-card-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.password-card-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    line-height: 1.5;
}
.password-value-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.password-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'DM Sans', monospace;
    letter-spacing: 0.08em;
    color: var(--accent);
    background: var(--accent-light);
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-sm);
    user-select: all;
}
.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}
.btn-icon:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.copy-feedback {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s;
    height: 1.2rem;
}
.copy-feedback.visible { opacity: 1; }

.auth-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 1rem;
    line-height: 1.4;
}
.auth-hint.warning {
    color: var(--warning);
    margin-top: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-body);
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-body);
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-full { width: 100%; }

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--text-secondary);
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
}
.btn-outline:hover {
    border-color: var(--text-secondary);
    color: var(--text);
}

.btn-sm {
    padding: 0.55rem 1rem;
    font-size: 0.85rem;
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: var(--font-body);
    cursor: pointer;
    padding: 0.5rem;
    margin-top: 0.75rem;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s;
}
.btn-text:hover { color: var(--danger); }

/* ========================================
   APP HEADER (shared for dashboard/learn)
   ======================================== */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    min-height: 56px;
}
.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}
.header-mode-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}
.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.8rem;
}
.brand-text {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
}

.btn-header {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--text-secondary);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
}
.btn-header:hover {
    border-color: var(--text-muted);
    color: var(--text);
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: none;
    border: none;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.15s;
}
.btn-back:hover { color: var(--text); }

.learn-counter {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* ========================================
   DASHBOARD
   ======================================== */
#dashboard-screen.active {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.dashboard-main {
    flex: 1;
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.25rem 3rem;
}

.dashboard-welcome {
    margin-bottom: 1.75rem;
}
.welcome-title {
    font-family: var(--font-display);
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.3rem;
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.welcome-sub {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.stat-card-dash {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.1rem 1rem;
    text-align: center;
    transition: box-shadow 0.2s;
}
.stat-card-dash:hover { box-shadow: var(--shadow-sm); }
.stat-card-dash.clickable {
    cursor: pointer;
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
}
.stat-card-dash.clickable:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
    transform: translateY(-1px);
}
.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.65rem;
}
.stat-icon-total { background: #eef0f8; color: #4a5a8a; }
.stat-icon-done { background: var(--warning-light); color: var(--warning); }
.stat-icon-correct { background: var(--success-light); color: var(--success); }
.stat-icon-exams { background: #f3eef8; color: #7a5aaf; }

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    margin-bottom: 0.2rem;
}
.stat-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Progress overview */
.progress-overview {
    margin-bottom: 1.5rem;
}
.progress-overview-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}
.progress-bar-track {
    height: 4px;
    background: var(--border);
    border-radius: 100px;
    overflow: hidden;
}
.progress-bar-track.large { height: 8px; }
.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 100px;
    transition: width 0.4s ease;
}

/* Extra stats row */
.dash-extra-stats {
    display: flex;
    gap: 1.5rem;
    padding: 0.85rem 1rem;
    background: var(--surface-alt);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
    flex-wrap: wrap;
}
.extra-stat {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.extra-stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.extra-stat-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}
.extra-stat.clickable {
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: var(--radius-sm);
    margin: -0.3rem -0.5rem;
    transition: background 0.15s;
}
.extra-stat.clickable:hover {
    background: var(--accent-light);
}

/* Exam History Modal */
.history-list {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.history-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
}
.history-row:last-child { border-bottom: none; }
.history-date {
    color: var(--text-secondary);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.history-score {
    font-weight: 700;
    font-size: 0.95rem;
    min-width: 3rem;
    text-align: right;
}
.history-score.pass { color: var(--success); }
.history-score.fail { color: var(--danger); }
.history-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 100px;
    white-space: nowrap;
}
.history-badge.pass { background: var(--success-light); color: var(--success); }
.history-badge.fail { background: var(--danger-light); color: var(--danger); }

/* Mode Cards */
.mode-cards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.mode-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.25rem;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s;
}
.mode-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.mode-card-icon {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}
.mode-learn .mode-card-icon { background: var(--accent-light); color: var(--accent); }
.mode-exam .mode-card-icon { background: #eef0f8; color: #4a5a8a; }
.mode-resume .mode-card-icon { background: var(--warning-light); color: var(--warning); }
.mode-review .mode-card-icon { background: #f0eeff; color: #6a48c8; }
.mode-bookmarks .mode-card-icon { background: #fff3e0; color: #c05a00; }
.mode-weakness .mode-card-icon { background: var(--danger-light); color: var(--danger); }
.mode-multitraining .mode-card-icon { background: #eef0f8; color: #4a5a8a; }

[data-theme="dark"] .mode-exam .mode-card-icon { background: #1e2038; color: #8aacff; }
[data-theme="dark"] .mode-review .mode-card-icon { background: #1e1830; color: #b09af0; }
[data-theme="dark"] .mode-bookmarks .mode-card-icon { background: #2a1800; color: #ffad60; }
[data-theme="dark"] .mode-multitraining .mode-card-icon { background: #1e2038; color: #8aacff; }

.mode-card-content { flex: 1; }
.mode-card-content h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.2rem;
}
.mode-card-content p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.45;
}
.mode-card-arrow {
    flex-shrink: 0;
    color: var(--text-muted);
    transition: transform 0.2s;
}
.mode-card:hover .mode-card-arrow { transform: translateX(3px); }

/* ========================================
   LEARN MODE
   ======================================== */
#learn-screen.active {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.learn-main {
    flex: 1;
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    padding: 1.25rem 1rem 3rem;
}

.learn-progress-section {
    margin-bottom: 1.25rem;
}

.learn-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

.learn-question-number {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 0.35rem;
}
.learn-question-text {
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.65;
    color: var(--text);
    margin-bottom: 1.5rem;
    white-space: pre-line;
}

/* Learn answers */
.learn-answers {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

.learn-answer-option {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.9rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}
.learn-answer-option:hover:not(.disabled) {
    border-color: var(--accent);
    background: var(--accent-light);
}
.learn-answer-option.selected {
    border-color: var(--accent);
    background: var(--accent-light);
}
.learn-answer-option.disabled {
    cursor: default;
}
.learn-answer-option.correct-answer {
    border-color: var(--success);
    background: var(--success-light);
}
.learn-answer-option.wrong-answer {
    border-color: var(--danger);
    background: var(--danger-light);
}

.learn-answer-marker {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
    transition: all 0.15s;
    background: var(--surface);
    font-size: 0.75rem;
    font-weight: 700;
}
.learn-answer-option.selected .learn-answer-marker {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.learn-answer-option.correct-answer .learn-answer-marker {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}
.learn-answer-option.wrong-answer .learn-answer-marker {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.learn-answer-text {
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text);
    padding-top: 1px;
}

/* Feedback */
.learn-feedback {
    background: var(--surface-alt);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}
.feedback-status {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}
.feedback-status.correct { color: var(--success); }
.feedback-status.wrong { color: var(--danger); }
.feedback-status.partial { color: var(--warning); }
.feedback-correct-answers {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--success);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}
.feedback-explanation {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}
.feedback-strength {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-light);
    flex-wrap: wrap;
}
.feedback-strength .strength-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}
.feedback-strength .strength-dots {
    font-size: 1rem;
    letter-spacing: 0.12em;
    flex-shrink: 0;
}
.feedback-strength.strength-low  .strength-dots { color: var(--danger); }
.feedback-strength.strength-mid  .strength-dots { color: var(--warning); }
.feedback-strength.strength-high .strength-dots { color: var(--success); }
.feedback-strength .strength-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Learn actions */
.learn-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.btn-bookmark {
    margin-left: auto;
}
.btn-bookmark.active {
    background: var(--warning-light);
    border-color: var(--warning);
    color: var(--warning);
}
.btn-bookmark.active svg {
    fill: var(--warning);
}

.learn-nav-strip {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
}

/* ========================================
   EXAM SCREEN
   ======================================== */
#exam-screen {
    min-height: 100vh;
}
#exam-screen.active {
    display: flex;
    flex-direction: column;
}

.exam-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.5rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.header-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text);
}
.header-participant {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.timer-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text);
    transition: background 0.3s, color 0.3s, border-color 0.3s;
}
.timer-box.warning {
    background: var(--warning-light);
    border-color: var(--warning);
    color: var(--warning);
}
.timer-box.danger {
    background: var(--danger-light);
    border-color: var(--danger);
    color: var(--danger);
    animation: pulse-timer 1s ease-in-out infinite;
}
@keyframes pulse-timer {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.exam-body {
    flex: 1;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

.progress-section {
    margin-bottom: 1.25rem;
}
.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* Question Nav */
.question-nav-wrapper {
    margin-bottom: 1.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
}
.question-nav-wrapper::-webkit-scrollbar { height: 4px; }
.question-nav-wrapper::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 100px;
}
.question-nav {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}
.nav-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-body);
    border: 2px solid var(--nav-unanswered);
    background: var(--surface);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}
.nav-btn:hover {
    border-color: var(--text-muted);
    color: var(--text);
}
.nav-btn.answered {
    background: var(--nav-answered);
    border-color: var(--nav-answered);
    color: #fff;
}
.nav-btn.current {
    border-color: var(--nav-current);
    color: var(--nav-current);
    box-shadow: 0 0 0 2px rgba(26, 23, 20, 0.15);
}
.nav-btn.current.answered {
    background: var(--nav-answered);
    border-color: var(--nav-current);
    color: #fff;
}

/* Question Cards */
.question-card {
    display: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}
.question-card.active {
    display: block;
    animation: fadeIn 0.25s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.question-number {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 0.75rem;
}
.question-text {
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.65;
    color: var(--text);
    margin-bottom: 1.5rem;
    white-space: pre-line;
}

.answers-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.answer-option {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.9rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}
.answer-option:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}
.answer-option.selected {
    border-color: var(--accent);
    background: var(--accent-light);
}

.answer-checkbox {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
    transition: all 0.15s;
    background: var(--surface);
}
.answer-option.selected .answer-checkbox {
    background: var(--accent);
    border-color: var(--accent);
}
.answer-checkbox svg {
    opacity: 0;
    transition: opacity 0.15s;
}
.answer-option.selected .answer-checkbox svg {
    opacity: 1;
}

.answer-label {
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text);
    padding-top: 1px;
}

/* Exam bottom nav */
.exam-bottom-nav {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

/* Submit */
.submit-section {
    text-align: center;
    margin-top: 0.5rem;
}
.btn-submit {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.9rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-body);
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.btn-submit:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* ========================================
   RESULT SCREEN
   ======================================== */
#result-screen,
#learn-result-screen {
    min-height: 100vh;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(45, 90, 39, 0.06) 0%, transparent 50%),
        var(--bg);
}
#result-screen.active,
#learn-result-screen.active { display: flex; }

.result-container {
    max-width: 520px;
    width: 100%;
    text-align: center;
}

.result-header-section { margin-bottom: 2rem; }
.result-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.35rem 0.85rem;
    border-radius: 100px;
    margin-bottom: 1rem;
    background: var(--accent-light);
    color: var(--accent);
}
.result-badge.pass { background: var(--success-light); color: var(--success); }
.result-badge.fail { background: var(--danger-light); color: var(--danger); }
.result-title {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.4rem;
}
.result-participant {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.score-circle-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}
.score-circle {
    position: relative;
    width: 160px;
    height: 160px;
}
.score-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}
.score-ring-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 8;
}
.score-ring-fill {
    fill: none;
    stroke: var(--accent);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 339.292;
    stroke-dashoffset: 339.292;
    transition: stroke-dashoffset 1.5s ease;
}

.score-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.score-percent {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}
.score-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 0.75rem;
}
.stat-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.15rem;
}
.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.result-note {
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: var(--surface-alt);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
}

.result-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ========================================
   REVIEW SCREEN
   ======================================== */
#review-screen.active {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Review reuses learn-card styles plus these: */
.review-answer-option {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.9rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    user-select: none;
}
.review-answer-option.correct-answer {
    border-color: var(--success);
    background: var(--success-light);
}
.review-answer-option.wrong-selected {
    border-color: var(--danger);
    background: var(--danger-light);
}
.review-answer-option.user-selected {
    border-color: var(--accent);
    background: var(--accent-light);
}

/* ========================================
   MODAL
   ======================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(26, 23, 20, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeInModal 0.2s ease;
}
@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}
.modal-box {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
}
.modal-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}
.modal-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}
.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}
.modal-btn {
    padding: 0.7rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--font-body);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    border: 2px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
}
.modal-btn:hover { border-color: var(--text-secondary); }
.modal-btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.modal-btn.primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}
.modal-btn.danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}
.modal-btn.danger:hover {
    background: #993333;
    border-color: #993333;
}

/* Lernmodus Beenden-Button */
.btn-end-learn {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-body);
    white-space: nowrap;
    line-height: 1.4;
}
.btn-end-learn:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: var(--danger-light);
}

/* Learn screen header-right: counter + button nebeneinander */
#learn-screen .header-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* Learn Result Screen */
.learn-result-stats {
    grid-template-columns: repeat(4, 1fr);
}
.learn-result-pct-wrapper {
    text-align: center;
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: var(--surface-alt);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}
.learn-result-pct {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
    margin-bottom: 0.3rem;
}
.learn-result-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

/* ========================================
   AI EXPLANATION SECTION
   ======================================== */
.ai-explanation-section {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-light);
}

.btn-ai-explain {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-family: var(--font-body);
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--accent);
    background: var(--accent-light);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.9rem;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.4;
}
.btn-ai-explain:hover:not(:disabled) {
    border-color: var(--accent);
}
.btn-ai-explain:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.ai-explanation-box {
    margin-top: 0.75rem;
    background: var(--surface-alt);
    border: 1px solid var(--border-light);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
}

.ai-explanation-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.625rem;
}

.ai-badge {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-light);
    border: 1px solid var(--accent);
    border-radius: 4px;
    padding: 0.1rem 0.45rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ai-source-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.ai-explanation-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
    white-space: pre-line;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 640px) {
    .auth-title { font-size: 2rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-number { font-size: 1.25rem; }
    .welcome-title { font-size: 1.5rem; }
    .exam-header { padding: 0.7rem 1rem; }
    .header-participant { display: none; }
    .question-card { padding: 1.25rem; }
    .learn-card { padding: 1.25rem; }
    .nav-btn { width: 32px; height: 32px; font-size: 0.75rem; }
    .result-stats { grid-template-columns: 1fr; gap: 0.5rem; }
    .learn-result-stats { grid-template-columns: repeat(2, 1fr); }
    .result-title { font-size: 1.6rem; }
    .brand-text { display: none; }
    .header-center { position: static; transform: none; }
    .dash-extra-stats { gap: 1rem; }
}

@media (max-width: 400px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
    .mode-card { padding: 1rem; }
}

/* ========================================
   AUTH TABS
   ======================================== */
.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.auth-tab {
    flex: 1;
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--font-body);
    border: none;
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}
.auth-tab.active {
    background: var(--accent);
    color: #fff;
}
.auth-tab:not(.active):hover {
    background: var(--surface-alt);
}

/* ========================================
   PASSWORD REQUIREMENTS
   ======================================== */
.password-requirements {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    margin-top: 0.5rem;
}
.pw-req {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    transition: color 0.2s;
}
.pw-req.met {
    color: var(--success);
}
.pw-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border);
    transition: background 0.2s;
}
.pw-req.met .pw-dot {
    background: var(--success);
}

/* ========================================
   FORM ERROR GLOBAL
   ======================================== */
.form-error {
    display: none;
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 0.35rem;
    margin-bottom: 0.75rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    background: var(--danger-light);
    border-radius: var(--radius-sm);
}
.form-error.visible { display: block; }

/* ========================================
   MODE CARD BOOKMARKS
   ======================================== */
.mode-card.mode-bookmarks {
    border-left-color: var(--warning);
}
.mode-card.mode-bookmarks .mode-card-icon {
    color: var(--warning);
}

/* ========================================
   MODE CARD WEAKNESS
   ======================================== */
.mode-card.mode-weakness {
    border-left-color: var(--danger);
}
.mode-card.mode-weakness .mode-card-icon {
    background: var(--danger-light);
    color: var(--danger);
}

/* ========================================
   MODE CARD MULTI-ANSWER TRAINING
   ======================================== */
.mode-card.mode-multitraining {
    border-left-color: #6366f1;
}
.mode-card.mode-multitraining .mode-card-icon {
    background: #ede9fe;
    color: #6366f1;
}

/* ========================================
   MULTI-SELECT HINT (Lernmodus)
   ======================================== */
.multiselect-hint {
    display: inline-block;
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
    padding: 0.25rem 0.75rem;
    background: #ede9fe;
    color: #6366f1;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ========================================
   AI EXTRA EXPLANATION BUTTONS
   ======================================== */
.ai-extras-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}
.btn-ai-extra {
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0.3rem 0.7rem;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.4;
}
.btn-ai-extra:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}
.btn-ai-extra:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.ai-extras-box {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-left: 3px solid var(--text-muted);
    border-radius: var(--radius-sm);
}
.ai-extras-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
}
.ai-extras-text {
    font-size: 0.875rem;
    color: var(--text-body);
    line-height: 1.55;
}

/* ========================================
   THEME FILTER
   ======================================== */
.theme-filter-section {
    margin-bottom: 1.25rem;
}
.theme-filter-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}
.theme-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.theme-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    border: 1.5px solid var(--border);
    border-radius: 100px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--surface);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.theme-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}
.theme-chip.active {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}
.theme-chip-count {
    font-size: 0.7rem;
    opacity: 0.75;
}
.theme-chip.active .theme-chip-count {
    opacity: 0.85;
}
.theme-filter-reset {
    font-size: 0.78rem;
    color: var(--accent);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius-sm);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.theme-filter-reset:hover {
    color: var(--accent-dark, var(--accent));
    opacity: 0.8;
}

/* ========================================
   DANGER ZONE / RESET
   ======================================== */
.danger-zone {
    margin-top: 2rem;
    padding: 1rem 1.25rem;
    border: 1.5px solid var(--danger-light);
    border-radius: var(--radius-lg);
    background: #fff8f8;
}
.danger-zone h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--danger);
    margin-bottom: 0.35rem;
}
.danger-zone p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}
.btn-danger-ghost {
    padding: 0.45rem 1rem;
    border: 1.5px solid var(--danger);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--danger);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-danger-ghost:hover {
    background: var(--danger);
    color: #fff;
}
.btn-danger-ghost:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   HISTORY REVIEW BUTTON
   ======================================== */
.btn-history-review {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border: 1.5px solid var(--accent);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.btn-history-review:hover {
    background: var(--accent);
    color: #fff;
}

/* Modal danger action */
.modal-btn.danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}
.modal-btn.danger:hover {
    background: #c53030;
    border-color: #c53030;
}

/* ========================================
   DARK MODE — hardcodierte Farb-Overrides
   ======================================== */
[data-theme="dark"] .app-header,
[data-theme="dark"] .exam-header {
    background: rgba(29, 27, 24, 0.92);
}
[data-theme="dark"] .modal-overlay {
    background: rgba(0, 0, 0, 0.65);
}
[data-theme="dark"] .danger-zone {
    background: var(--danger-light);
}
[data-theme="dark"] .stat-icon-total {
    background: #1a2040;
    color: #8898cc;
}
[data-theme="dark"] .stat-icon-exams {
    background: #2a1a40;
    color: #a888dd;
}
[data-theme="dark"] .mode-exam .mode-card-icon {
    background: #1a2040;
    color: #8898cc;
}
[data-theme="dark"] .multiselect-hint {
    background: #1e1a40;
    color: #8b8cf8;
}
[data-theme="dark"] .mode-multitraining .mode-card-icon {
    background: #1e1a40;
    color: #8b8cf8;
}
[data-theme="dark"] .nav-btn.current {
    box-shadow: 0 0 0 2px rgba(240, 236, 230, 0.2);
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 320px;
    pointer-events: none;
}
.toast {
    padding: 0.7rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    font-family: var(--font-body);
    line-height: 1.4;
    box-shadow: var(--shadow-md);
    animation: toast-slide-in 0.2s ease;
}
@keyframes toast-slide-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.toast-success { background: var(--success); color: #fff; }
.toast-error   { background: var(--danger);  color: #fff; }
.toast-info    {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}
@media (max-width: 640px) {
    .toast-container {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
}

/* Dark Mode Toggle Button */
.btn-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.45rem 0.7rem;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--text-secondary);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
}
.btn-theme-toggle:hover {
    border-color: var(--text-muted);
    color: var(--text);
}

/* ========================================
   RESULT NAV GRID
   ======================================== */

.result-nav-grid-section {
    margin: 1.5rem 0;
}

.result-nav-grid-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    text-align: center;
}

/* Status-Farben für Ergebnis- und Review-Navigation */
.nav-btn.result-correct {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}
.nav-btn.result-partial {
    background: var(--warning);
    color: #fff;
    border-color: var(--warning);
}
.nav-btn.result-wrong {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}
.nav-btn.result-unanswered {
    background: var(--surface-alt);
    color: var(--text-muted);
    border-color: var(--border);
}

/* Aktives Kästchen in der Review-Navigation: weißer Ring */
.nav-btn.result-correct.current,
.nav-btn.result-partial.current,
.nav-btn.result-wrong.current,
.nav-btn.result-unanswered.current {
    outline: 2px solid var(--text);
    outline-offset: 2px;
}

/* ========================================
   ADMIN
   ======================================== */

.admin-main {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 1rem 4rem;
}

.admin-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}

.admin-tab {
    padding: 0.55rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-body);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: color 0.15s, border-color 0.15s;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.admin-section { }

.admin-section-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1rem;
}

.admin-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.15rem 0.6rem;
}

.admin-loading {
    color: var(--text-secondary);
    padding: 2rem 0;
    text-align: center;
}

.admin-table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.admin-table thead {
    background: var(--surface-alt);
}

.admin-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
    vertical-align: middle;
}

.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: var(--surface-alt); }

.admin-username { font-weight: 600; }
.admin-date { color: var(--text-secondary); font-size: 0.83rem; }
.admin-num { text-align: center; }

.admin-role-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.admin-role-badge.admin {
    background: var(--accent-light);
    color: var(--accent);
}
.admin-role-badge.user {
    background: var(--surface-alt);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.admin-role-badge.danger {
    background: var(--danger-light);
    color: var(--danger);
}

.admin-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.btn-admin-action {
    padding: 0.3rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: var(--font-body);
    background: var(--accent-light);
    color: var(--accent);
    border: 1px solid var(--accent-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
}
.btn-admin-action:hover:not(:disabled) {
    background: var(--accent);
    color: #fff;
}
.btn-admin-action:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-admin-danger {
    padding: 0.3rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: var(--font-body);
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid var(--danger-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
}
.btn-admin-danger:hover:not(:disabled) {
    background: var(--danger);
    color: #fff;
}
.btn-admin-danger:disabled { opacity: 0.5; cursor: not-allowed; }

.admin-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.25rem;
}

.admin-page-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.admin-stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.admin-stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 0.4rem;
    font-family: var(--font-display);
}

.admin-stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.btn-admin-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    color: var(--accent);
    border-color: var(--accent-light);
    background: var(--accent-light);
}
.btn-admin-link:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ── Multi-Modul-Dashboard ─────────────────────────────────────────────────── */

.module-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.module-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    cursor: default;
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
}

.module-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border);
    transform: none;
}

.module-card-preview {
    opacity: 0.6;
    cursor: default;
}

.module-card-preview:hover {
    box-shadow: none;
    border-color: var(--border);
    transform: none;
}

.module-card-icon {
    font-size: 2rem;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex-shrink: 0;
    background: var(--bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.module-card-content {
    flex: 1;
}

.module-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 0.2rem 0;
    font-family: var(--font-display);
    letter-spacing: -0.01em;
}

.module-card-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

.module-badge-preview {
    display: inline-block;
    margin-top: 0.4rem;
    font-size: 0.7rem;
    background: var(--surface);
    color: var(--text-muted);
    border-radius: 4px;
    padding: 2px 7px;
    font-weight: 500;
}

.module-card-arrow {
    color: var(--text-muted);
    transition: transform 0.15s;
    flex-shrink: 0;
}

.module-card:not(.module-card-preview):hover .module-card-arrow {
    transform: translateX(3px);
    color: var(--accent);
}

[data-theme="dark"] .module-card {
    background: var(--surface);
    border-color: var(--border);
}

[data-theme="dark"] .module-card:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-md);
}

[data-theme="dark"] .module-card-icon {
    background: var(--surface-alt);
    border-color: var(--border);
}

/* ── Streak-Badge ─────────────────────────────────────────────────── */
.streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: #c05a00;
    background: #fff3e0;
    border: 1px solid #f5c68a;
    border-radius: 20px;
    padding: 0.2rem 0.65rem;
    line-height: 1.4;
    letter-spacing: 0.01em;
    white-space: nowrap;
}
[data-theme="dark"] .streak-badge {
    color: #ffad60;
    background: #2a1800;
    border-color: #7a4000;
}

/* ── Modulkarte: Fortschrittsanzeige ─────────────────────────────── */
.module-card-progress {
    margin-top: 0.55rem;
}
.module-progress-bar {
    height: 5px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.3rem;
}
.module-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.4s ease;
    min-width: 0;
}
.module-progress-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ── Modal: Header mit Schließen-Button ──────────────────────────── */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    text-align: left;
}
.modal-header .modal-title {
    margin-bottom: 0;
}
.modal-body {
    text-align: left;
}
.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.15s, border-color 0.15s;
}
.modal-close:hover {
    color: var(--text);
    border-color: var(--text-secondary);
}

/* ── Aktivitäts-Heatmap ──────────────────────────────────────────── */
.heatmap-wrapper {
    margin: 1.5rem 0;
    overflow-x: auto;
}
.heatmap-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.6rem;
}
.heatmap-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.heatmap-summary {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.heatmap-grid {
    display: flex;
    gap: 2px;
}
.heatmap-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.heatmap-cell {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}
.hm-future { background: transparent; }
.hm-0      { background: var(--border); }
.hm-1      { background: #bbf7b0; }
.hm-2      { background: #4ade80; }
.hm-3      { background: #16a34a; }
.hm-4      { background: #14532d; }
[data-theme="dark"] .hm-1 { background: #1a4028; }
[data-theme="dark"] .hm-2 { background: #166534; }
[data-theme="dark"] .hm-3 { background: #15803d; }
[data-theme="dark"] .hm-4 { background: #4ade80; }
.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-top: 0.4rem;
    font-size: 0.72rem;
    color: var(--text-muted);
}
.heatmap-legend .heatmap-cell { width: 10px; height: 10px; }

/* ── Prüfungsziel ────────────────────────────────────────────────── */
.goal-section {
    margin: 1rem 0;
}
.goal-display {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--accent-light);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 0.65rem 1rem;
    font-size: 0.88rem;
}
.goal-icon { font-size: 1.1rem; flex-shrink: 0; }
.goal-info { flex: 1; display: flex; flex-direction: column; gap: 0.1rem; }
.goal-date { font-weight: 600; color: var(--text); }
.goal-plan { color: var(--text-secondary); font-size: 0.82rem; }
.goal-past { color: var(--danger); }
.goal-edit-btn {
    background: none;
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    cursor: pointer;
    font-family: var(--font-body);
    transition: background 0.15s;
    flex-shrink: 0;
}
.goal-edit-btn:hover { background: var(--accent); color: #fff; }
.goal-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.goal-input { flex: 1; min-width: 150px; padding: 0.5rem 0.75rem; font-size: 0.88rem; }
.goal-set-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.82rem;
    padding: 0.5rem 0.9rem;
    cursor: pointer;
    font-family: var(--font-body);
    transition: border-color 0.15s, color 0.15s;
    width: 100%;
    justify-content: center;
}
.goal-set-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Themen-Schwachstellen ───────────────────────────────────────── */
.weakness-section {
    margin: 1rem 0;
}
.weakness-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.65rem 1rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    font-family: var(--font-body);
    transition: border-color 0.15s;
}
.weakness-toggle:hover { border-color: var(--accent); }
.weakness-list {
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    padding: 0.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.weakness-row {
    display: grid;
    grid-template-columns: 1fr 120px 40px 80px;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
}
.weakness-theme { color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.weakness-bar-wrap { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.weakness-bar { height: 100%; border-radius: 3px; transition: width 0.4s; }
.weakness-bar.good { background: var(--success); }
.weakness-bar.mid  { background: var(--warning); }
.weakness-bar.bad  { background: var(--danger); }
.weakness-pct { font-weight: 700; text-align: right; font-size: 0.8rem; }
.weakness-pct.good { color: var(--success); }
.weakness-pct.mid  { color: var(--warning); }
.weakness-pct.bad  { color: var(--danger); }
.weakness-detail { color: var(--text-muted); font-size: 0.75rem; text-align: right; }

/* ── Themen-Breakdown Exam-Ergebnis ─────────────────────────────── */
.theme-breakdown {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    text-align: left;
}
.theme-breakdown-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.theme-breakdown-list { display: flex; flex-direction: column; gap: 0.55rem; }
.theme-breakdown-row {
    display: grid;
    grid-template-columns: 1fr 100px 40px 90px;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}
.theme-breakdown-name { color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.theme-breakdown-bar-wrap { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.theme-breakdown-bar { height: 100%; border-radius: 3px; }
.theme-breakdown-bar.good { background: var(--success); }
.theme-breakdown-bar.mid  { background: var(--warning); }
.theme-breakdown-bar.bad  { background: var(--danger); }
.theme-breakdown-pct { font-weight: 700; text-align: center; }
.theme-breakdown-pct.good { color: var(--success); }
.theme-breakdown-pct.mid  { color: var(--warning); }
.theme-breakdown-pct.bad  { color: var(--danger); }
.theme-breakdown-detail { color: var(--text-muted); font-size: 0.73rem; text-align: right; }

/* ── Fehler-Melden Button ────────────────────────────────────────── */
.btn-report-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    font-family: var(--font-body);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: color 0.15s;
}
.btn-report-link:hover { color: var(--danger); }
.btn-report-link:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Leaderboard Dashboard ───────────────────────────────────────── */
.leaderboard-section {
    margin-top: 2rem;
}
.leaderboard-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.65rem 1rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-body);
    transition: border-color 0.15s;
}
.leaderboard-toggle:hover { border-color: var(--accent); color: var(--text); }
.leaderboard-list {
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    overflow: hidden;
}
.leaderboard-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
}
.leaderboard-row:last-child { border-bottom: none; }
.lb-rank { font-weight: 700; color: var(--text-muted); min-width: 1.5rem; font-size: 0.8rem; }
.lb-name { font-weight: 600; color: var(--text); flex: 1; }
.lb-streak { font-size: 0.8rem; color: #c05a00; }
[data-theme="dark"] .lb-streak { color: #ffad60; }
.lb-learned { font-size: 0.78rem; color: var(--text-secondary); }
.lb-pass { font-size: 0.78rem; color: var(--success); }

/* ── Lessons ────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light, #fff3cd); color: var(--warning, #856404); }
[data-theme="dark"] .badge-warning { background: #3a2e00; color: #ffc107; }

.btn-danger {
    background: var(--danger);
    color: #fff;
    border: none;
}
.btn-danger:hover:not(:disabled) { background: var(--danger-dark, #b91c1c); }
.btn-danger:disabled { opacity: 0.55; cursor: not-allowed; }

.progress-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--bg);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Markdown rendered content */
.markdown-body { line-height: 1.7; color: var(--text); }
.markdown-body h1, .markdown-body h2, .markdown-body h3,
.markdown-body h4, .markdown-body h5, .markdown-body h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 700;
    line-height: 1.3;
}
.markdown-body h1 { font-size: 1.6rem; }
.markdown-body h2 { font-size: 1.25rem; }
.markdown-body h3 { font-size: 1.05rem; }
.markdown-body p { margin-bottom: 1em; }
.markdown-body ul, .markdown-body ol { padding-left: 1.5em; margin-bottom: 1em; }
.markdown-body li { margin-bottom: 0.3em; }
.markdown-body blockquote {
    margin: 1em 0;
    padding: 0.5em 1em;
    border-left: 4px solid var(--accent);
    background: var(--surface);
    color: var(--text-secondary);
    border-radius: 0 4px 4px 0;
}
.markdown-body code {
    font-family: var(--font-mono, monospace);
    font-size: 0.88em;
    background: var(--surface);
    padding: 2px 5px;
    border-radius: 3px;
}
.markdown-body pre {
    background: var(--surface);
    padding: 1em;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 1em;
}
.markdown-body pre code { background: none; padding: 0; }
.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1em;
    font-size: 0.9rem;
}
.markdown-body th, .markdown-body td {
    border: 1px solid var(--border);
    padding: 6px 10px;
    text-align: left;
}
.markdown-body th { background: var(--surface); font-weight: 600; }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 1.5em 0; }
.markdown-body a { color: var(--accent); text-decoration: underline; }
.markdown-body strong { font-weight: 700; }
.markdown-body em { font-style: italic; }

/* Confidence selector */
.confidence-selector { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.confidence-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 1rem;
}
.confidence-btn:hover:not(:disabled) {
    border-color: var(--accent);
    background: var(--accent-light, #e0edff);
    color: var(--accent);
}
.confidence-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.confidence-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.confidence-label { font-size: 0.875rem; color: var(--text-secondary); margin-left: 4px; }

/* Lesson card */
.lesson-card {
    display: block;
    padding: 12px 14px 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    border-left: 3px solid var(--border);
    background: var(--surface);
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    position: relative;
}
.lesson-card:hover {
    border-color: var(--accent);
    border-left-color: var(--accent);
    box-shadow: var(--shadow-sm);
    background: var(--surface-alt);
}
.lesson-card.read {
    border-left-color: var(--success);
    background: var(--surface);
}
.lesson-card.read:hover {
    border-color: var(--success);
    border-left-color: var(--success);
}
.lesson-card-title {
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 5px;
    line-height: 1.4;
}
.lesson-card-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}
.lesson-card-minutes { color: var(--text-muted); }
.lesson-card-confidence { color: var(--accent); font-weight: 600; }
.lesson-card-status.read { color: var(--success); font-weight: 600; }
.lesson-card-status.unread { color: var(--text-muted); }
.lesson-card-summary { font-size: 0.8rem; color: var(--text-secondary); margin-top: 5px; line-height: 1.45; }

/* ========================================
   MODULE TABS (Sprint 1 Polish)
   ======================================== */
.module-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 1.25rem;
    background: var(--surface);
    position: sticky;
    top: 56px;
    z-index: 90;
    scrollbar-width: none;
}
.module-tabs::-webkit-scrollbar { display: none; }

.module-tab {
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font-body);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
    line-height: 1.4;
}
.module-tab:hover { color: var(--text); }
.module-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
[data-theme="dark"] .module-tabs {
    background: var(--surface);
}

/* ========================================
   BREADCRUMB
   ======================================== */
.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.2rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    line-height: 1.5;
}
.breadcrumb-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
    padding: 0.1rem 0.2rem;
}
.breadcrumb-link:hover { color: var(--accent); }
.breadcrumb-sep {
    color: var(--text-muted);
    font-size: 0.72rem;
    user-select: none;
    margin: 0 0.1rem;
}
.breadcrumb-current {
    color: var(--text);
    font-weight: 600;
    padding: 0.1rem 0.2rem;
}

/* ========================================
   ONBOARDING BANNER
   ======================================== */
.onboarding-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: var(--accent-light);
    border: 1px solid var(--accent);
    border-radius: var(--radius-md);
    padding: 0.9rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--text);
}
.onboarding-banner-text { flex: 1; }
.onboarding-banner-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: color 0.15s, background 0.15s;
    font-size: 1.1rem;
    padding: 0;
    line-height: 1;
}
.onboarding-banner-close:hover { color: var(--text); background: rgba(0,0,0,0.06); }

/* ========================================
   THEORY PILL (Dashboard module card)
   ======================================== */
.theory-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-light);
    border: 1px solid var(--accent);
    border-radius: 100px;
    padding: 0.15rem 0.5rem;
    white-space: nowrap;
    animation: theory-pulse 2.5s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes theory-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ========================================
   MODULE CARD DUAL-CTA (Dashboard)
   ======================================== */
.module-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}
.module-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

/* ========================================
   LESSON THEME SECTION (LessonsIndexPage)
   ======================================== */
.lesson-theme-section {
    margin-bottom: 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface);
    transition: box-shadow 0.15s, border-color 0.15s;
}
.lesson-theme-section:has(.lesson-theme-header:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}
.lesson-theme-header {
    width: 100%;
    text-align: left;
    padding: 0.85rem 1rem;
    background: var(--surface);
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font: inherit;
    color: var(--text);
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.15s;
    gap: 0.75rem;
}
.lesson-theme-header:hover { background: var(--surface-alt); }
.lesson-theme-header-left { display: flex; align-items: center; gap: 0.6rem; flex: 1; min-width: 0; }
.lesson-theme-header-right { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }
.lesson-theme-body {
    padding: 0.6rem 0.75rem 0.75rem;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    border-top: 1px solid var(--border-light);
}
.lesson-item-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}
.lesson-item-number {
    color: var(--text-muted);
    font-size: 0.75rem;
    padding-top: 10px;
    min-width: 18px;
    flex-shrink: 0;
    text-align: right;
}

/* ========================================
   LESSON PAGE CONTENT
   ======================================== */
.lesson-page-main {
    max-width: 720px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
}
.lesson-content-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}
.lesson-content-inner {
    max-width: 70ch;
    margin: 0 auto;
}
.lesson-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.35rem;
    letter-spacing: -0.01em;
    line-height: 1.25;
    margin-top: 0;
}
.lesson-meta {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-bottom: 1.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.lesson-meta-sep { opacity: 0.5; }
.lesson-section-title {
    font-weight: 700;
    font-size: 0.88rem;
    margin-bottom: 0.6rem;
    color: var(--text);
}
.lesson-nav-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem 0;
}
.lesson-notes-area {
    width: 100%;
    min-height: 96px;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    resize: vertical;
    font-family: var(--font-body);
    font-size: 0.9rem;
    box-sizing: border-box;
    transition: border-color 0.15s;
    line-height: 1.55;
}
.lesson-notes-area:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(45,90,39,0.1);
}
.lesson-cta-box {
    text-align: center;
    padding: 1.75rem 1.25rem;
    background: linear-gradient(135deg, var(--accent-light) 0%, var(--surface) 100%);
    border-radius: var(--radius-md);
    border: 1px solid var(--accent);
    margin-top: 0.5rem;
}
.lesson-cta-box-title {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 1rem;
    color: var(--text);
    font-family: var(--font-display);
}

/* ========================================
   LESSON RECOMMENDATIONS BOX
   ======================================== */
.lesson-recommendations {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.1rem;
    margin-bottom: 1.5rem;
}

/* Responsive fixes for lesson pages */
@media (max-width: 640px) {
    .lesson-content-card { padding: 1.25rem; }
    .lesson-title { font-size: 1.4rem; }
    .module-tabs { padding: 0 0.75rem; }
    .module-tab { padding: 0.6rem 0.75rem; font-size: 0.82rem; }
}
@media (max-width: 400px) {
    .lesson-page-main { padding: 1rem 0.75rem 2rem; }
}
