/* ============================================
   AZ-500 Exam Simulator — Design System v2
   Cybersteps GmbH · Secure Operations Console
   Dark-first with light theme toggle
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── Dark Theme (default) ────────────────────── */
:root,
[data-theme="dark"] {
    --c-bg: #0b1120;
    --c-bg-raised: #111827;
    --c-surface: #1a2332;
    --c-surface-hover: #1f2d3f;
    --c-border: #283548;
    --c-border-subtle: #1c2838;

    --c-text: #e2e8f0;
    --c-text-secondary: #8b9bb5;
    --c-text-muted: #5a6d85;

    --c-primary: #3b82f6;
    --c-primary-hover: #60a5fa;
    --c-primary-muted: rgba(59, 130, 246, 0.15);
    --c-primary-glow: rgba(59, 130, 246, 0.25);

    --c-accent: #06b6d4;
    --c-accent-muted: rgba(6, 182, 212, 0.12);

    --c-success: #22c55e;
    --c-success-muted: rgba(34, 197, 94, 0.12);
    --c-success-text: #4ade80;

    --c-warning: #f59e0b;
    --c-warning-muted: rgba(245, 158, 11, 0.12);
    --c-warning-text: #fbbf24;

    --c-danger: #ef4444;
    --c-danger-muted: rgba(239, 68, 68, 0.12);
    --c-danger-text: #f87171;

    --c-sidebar: #0d1525;
    --c-sidebar-active: rgba(59, 130, 246, 0.12);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);

    --overlay-bg: rgba(0, 0, 0, 0.5);
    color-scheme: dark;
}

/* ── Light Theme ─────────────────────────────── */
[data-theme="light"] {
    --c-bg: #f0f4f8;
    --c-bg-raised: #f8fafc;
    --c-surface: #ffffff;
    --c-surface-hover: #f0f4f8;
    --c-border: #dde4ee;
    --c-border-subtle: #e8eef5;

    --c-text: #1a2332;
    --c-text-secondary: #4b5e76;
    --c-text-muted: #8899ad;

    --c-primary: #2563eb;
    --c-primary-hover: #1d4ed8;
    --c-primary-muted: rgba(37, 99, 235, 0.08);
    --c-primary-glow: rgba(37, 99, 235, 0.12);

    --c-accent: #0891b2;
    --c-accent-muted: rgba(8, 145, 178, 0.08);

    --c-success: #16a34a;
    --c-success-muted: rgba(22, 163, 74, 0.08);
    --c-success-text: #15803d;

    --c-warning: #d97706;
    --c-warning-muted: rgba(217, 119, 6, 0.08);
    --c-warning-text: #b45309;

    --c-danger: #dc2626;
    --c-danger-muted: rgba(220, 38, 38, 0.08);
    --c-danger-text: #b91c1c;

    --c-sidebar: #ffffff;
    --c-sidebar-active: rgba(37, 99, 235, 0.08);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.08);

    --overlay-bg: rgba(0, 0, 0, 0.3);
    color-scheme: light;
}

/* ── Shared Tokens ───────────────────────────── */
:root {
    --font-body: 'Sora', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 50%;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 0.2s var(--ease);
    --sidebar-w: 260px;
}

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

body {
    font-family: var(--font-body);
    color: var(--c-text);
    background: var(--c-bg);
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background 0.3s var(--ease), color 0.3s var(--ease);
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-hover); }

::selection {
    background: var(--c-primary-muted);
    color: var(--c-primary);
}

/* ── Layout ──────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--c-sidebar);
    border-right: 1px solid var(--c-border);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
    transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
}

.sidebar-logo {
    padding: 4px 20px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--c-border);
    margin-bottom: 8px;
}

/* Theme-aware logos: light logo on dark bg, dark logo on light bg */
.logo-light-theme { display: none; }
.logo-dark-theme { display: block; }
[data-theme="light"] .logo-light-theme { display: block; }
[data-theme="light"] .logo-dark-theme { display: none; }

.sidebar-logo img {
    height: 28px;
    width: auto;
    object-fit: contain;
}

.sidebar-cert-switcher {
    padding: 0 16px 12px;
}

.sidebar-section-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--c-text-muted);
    margin-bottom: 8px;
}

.cert-switcher-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    background: var(--c-surface);
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

.cert-switcher-card:hover {
    border-color: var(--c-primary);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
}

.cert-switcher-code {
    min-width: 58px;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    background: var(--c-primary-muted);
    color: var(--c-primary);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    font-family: var(--font-mono);
}

.cert-switcher-copy,
.cert-switcher-empty {
    min-width: 0;
    flex: 1;
}

.cert-switcher-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cert-switcher-meta {
    font-size: 11px;
    color: var(--c-text-muted);
    margin-top: 2px;
}

.cert-switcher-action {
    font-size: 12px;
    font-weight: 600;
    color: var(--c-primary);
    flex-shrink: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    color: var(--c-text-secondary);
    font-weight: 500;
    font-size: 14px;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.nav-item:hover {
    background: var(--c-surface-hover);
    color: var(--c-text);
    text-decoration: none;
}

.nav-item.active {
    background: var(--c-sidebar-active);
    color: var(--c-primary);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px; bottom: 8px;
    width: 3px;
    background: var(--c-primary);
    border-radius: 0 2px 2px 0;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item.active svg,
.nav-item:hover svg { opacity: 1; }

.nav-badge {
    margin-left: auto;
    background: var(--c-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--c-border);
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 34px; height: 34px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.user-name { font-weight: 600; font-size: 13px; }
.user-email { font-size: 11px; color: var(--c-text-muted); }

/* Theme toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 6px;
    background: var(--c-bg);
    border-radius: var(--radius-md);
}

.theme-toggle button {
    flex: 1;
    padding: 5px 0;
    font-size: 12px;
    font-family: var(--font-body);
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: transparent;
    color: var(--c-text-secondary);
    transition: var(--transition);
}

.theme-toggle button.active {
    background: var(--c-surface);
    color: var(--c-text);
    box-shadow: var(--shadow-sm);
}

/* Sidebar controls row (theme + lang toggles) */
.sidebar-controls {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.sidebar-controls .theme-toggle {
    margin-top: 0;
    flex: 1;
}

.lang-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px;
    background: var(--c-bg);
    border-radius: var(--radius-md);
}
.lang-toggle button {
    padding: 5px 8px;
    font-size: 11px;
    font-family: var(--font-mono);
    font-weight: 600;
    letter-spacing: 0.04em;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: transparent;
    color: var(--c-text-secondary);
    transition: var(--transition);
}
.lang-toggle button.active {
    background: var(--c-surface);
    color: var(--c-text);
    box-shadow: var(--shadow-sm);
}

/* ── Main Content ────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 32px 40px;
    min-height: 100vh;
    transition: margin-left 0.3s var(--ease);
}

.shell-context-bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--c-border);
    flex-wrap: wrap;
}

.shell-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--c-text-muted);
}

.shell-breadcrumbs a {
    color: var(--c-text-secondary);
}

.shell-breadcrumbs a:hover {
    color: var(--c-primary);
    text-decoration: none;
}

.shell-breadcrumb-sep {
    color: var(--c-text-muted);
}

.shell-context-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.shell-context-pill {
    font-size: 12px;
}

.shell-context-pill--warning {
    background: var(--c-warning-muted);
    color: var(--c-warning);
}

.shell-context-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text-secondary);
}

.shell-context-note {
    font-size: 12px;
    color: var(--c-text-muted);
}

.page-header {
    margin-bottom: 32px;
}

.page-title {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.page-subtitle {
    font-size: 15px;
    color: var(--c-text-secondary);
}

/* ── Cards ───────────────────────────────────── */
.card {
    background: var(--c-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--c-border);
    padding: 24px;
    transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
}

.card-hover:hover {
    border-color: var(--c-primary);
    box-shadow: var(--shadow-glow);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

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

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--c-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Stat Cards ──────────────────────────────── */
.stat-value {
    font-size: 36px;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: -0.02em;
    line-height: 1;
    background: linear-gradient(135deg, var(--c-text), var(--c-text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 12px;
    color: var(--c-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 4px;
}

/* ── Readiness Gauge ─────────────────────────── */
.readiness-gauge {
    position: relative;
    width: 180px; height: 180px;
    margin: 0 auto 16px;
}

.readiness-gauge svg {
    transform: rotate(-90deg);
    width: 100%; height: 100%;
}

.readiness-gauge .gauge-bg {
    fill: none;
    stroke: var(--c-border);
    stroke-width: 10;
}

.readiness-gauge .gauge-fill {
    fill: none;
    stroke: var(--c-primary);
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s var(--ease);
}

.readiness-gauge .gauge-value {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.readiness-gauge .gauge-pct {
    font-size: 42px;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: -0.03em;
    line-height: 1;
}

.readiness-gauge .gauge-label {
    font-size: 12px;
    color: var(--c-text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 4px;
}

/* ── Progress Bars ───────────────────────────── */
.progress-bar {
    height: 8px;
    background: var(--c-border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s var(--ease);
}

.progress-fill.high { background: var(--c-success); }
.progress-fill.medium { background: var(--c-warning); }
.progress-fill.low { background: var(--c-danger); }
.progress-fill.primary { background: var(--c-primary); }

.progress-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.progress-label {
    width: 220px;
    font-size: 14px;
    font-weight: 500;
    flex-shrink: 0;
}

.progress-value {
    width: 48px;
    text-align: right;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--c-text-secondary);
}

/* ── Buttons ─────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    position: relative;
    overflow: hidden;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--c-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
    background: var(--c-primary-hover);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--c-surface);
    color: var(--c-text);
    border: 1px solid var(--c-border);
}
.btn-secondary:hover {
    background: var(--c-surface-hover);
    border-color: var(--c-text-muted);
}

.btn-success {
    background: var(--c-success);
    color: #fff;
}

.btn-danger {
    background: var(--c-danger);
    color: #fff;
}

.btn-ghost {
    background: transparent;
    color: var(--c-text-secondary);
    padding: 8px 12px;
}
.btn-ghost:hover {
    background: var(--c-surface-hover);
    color: var(--c-text);
}

.btn-outline {
    background: transparent;
    color: var(--c-primary);
    border: 1px solid var(--c-primary);
}
.btn-outline:hover {
    background: var(--c-primary-muted);
}

.btn-lg { padding: 14px 28px; font-size: 15px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }

/* ── Badges ──────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-domain { background: var(--c-primary-muted); color: var(--c-primary); }
.badge-success { background: var(--c-success-muted); color: var(--c-success-text); }
.badge-warning { background: var(--c-warning-muted); color: var(--c-warning-text); }
.badge-danger { background: var(--c-danger-muted); color: var(--c-danger-text); }
.badge-accent { background: var(--c-accent-muted); color: var(--c-accent); }

/* ── Domain Cards (Dashboard) ────────────────── */
.domain-card {
    padding: 20px;
    border-radius: var(--radius-lg);
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    cursor: pointer;
    transition: all 0.25s var(--ease);
}

.domain-card:hover {
    border-color: var(--c-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.domain-card .domain-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.domain-card .domain-weight {
    font-size: 12px;
    color: var(--c-text-muted);
    margin-bottom: 12px;
}

.domain-card .domain-pct {
    font-size: 28px;
    font-weight: 700;
    font-family: var(--font-mono);
    margin-bottom: 8px;
}

/* ── Quick Actions ───────────────────────────── */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.quick-action {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s var(--ease);
    font-family: var(--font-body);
    color: var(--c-text);
    font-size: 14px;
    font-weight: 600;
}

.quick-action:hover {
    border-color: var(--c-primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.quick-action .qa-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.quick-action .qa-icon.learn { background: var(--c-primary-muted); color: var(--c-primary); }
.quick-action .qa-icon.exam { background: var(--c-accent-muted); color: var(--c-accent); }
.quick-action .qa-icon.weak { background: var(--c-danger-muted); color: var(--c-danger-text); }
.quick-action .qa-icon.review { background: var(--c-warning-muted); color: var(--c-warning-text); }

/* ── Streak Display ──────────────────────────── */
.streak-display {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-weight: 600;
}

.streak-flame { font-size: 24px; }
.streak-count { font-size: 24px; color: var(--c-warning-text); }
.streak-label { font-size: 12px; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* ── Question UI ─────────────────────────────── */
.question-container {
    max-width: 820px;
    margin: 0 auto;
    padding-bottom: 100px; /* space for bottom bar */
}

.question-card {
    padding: 28px;
    margin-bottom: 20px;
}

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

.question-number {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text-muted);
    font-family: var(--font-mono);
}

.question-text {
    font-size: 16px;
    line-height: 1.7;
    margin-bottom: 24px;
    color: var(--c-text);
}

/* Markdown tables in question text */
.question-text table,
.question-card table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 14px;
}

.question-text th,
.question-text td,
.question-card th,
.question-card td {
    border: 1px solid var(--c-border);
    padding: 8px 12px;
    text-align: left;
}

.question-text th,
.question-card th {
    background: var(--c-primary-muted);
    font-weight: 600;
    font-size: 13px;
}

.question-text pre,
.explanation-text pre,
.case-study-side-body pre {
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    padding: 16px 18px;
    margin: 16px 0 20px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    color: var(--c-text);
}

.question-text code,
.explanation-text code,
.case-study-side-body code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    padding: 2px 6px;
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: 4px;
    color: var(--c-accent);
    word-break: break-word;
}

.question-text pre code,
.explanation-text pre code,
.case-study-side-body pre code {
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
    font-size: 13px;
    color: inherit;
    word-break: normal;
}

/* ── Options (single/multi choice) ───────────── */
.option-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 18px;
    border: 2px solid var(--c-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s var(--ease);
    font-size: 15px;
    line-height: 1.5;
}

.option-item:hover {
    border-color: var(--c-primary);
    background: var(--c-primary-muted);
}

.option-item.selected {
    border-color: var(--c-primary);
    background: var(--c-primary-muted);
}

.option-item.kb-focus {
    outline: 2px solid var(--c-primary);
    outline-offset: -2px;
}

.option-item.correct {
    border-color: var(--c-success);
    background: var(--c-success-muted);
}

.option-item.incorrect {
    border-color: var(--c-danger);
    background: var(--c-danger-muted);
}

.option-item.disabled {
    pointer-events: none;
    opacity: 0.7;
}

.option-marker {
    width: 28px; height: 28px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--c-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    font-family: var(--font-mono);
    transition: all 0.15s var(--ease);
}

.option-item.selected .option-marker {
    border-color: var(--c-primary);
    background: var(--c-primary);
    color: #fff;
}

.option-item.correct .option-marker {
    border-color: var(--c-success);
    background: var(--c-success);
    color: #fff;
}

.option-item.incorrect .option-marker {
    border-color: var(--c-danger);
    background: var(--c-danger);
    color: #fff;
}

.option-text { flex: 1; }

.option-feedback {
    font-size: 13px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--c-border-subtle);
    color: var(--c-text-secondary);
    line-height: 1.5;
}

/* Multi-choice count hint */
.select-hint {
    font-size: 13px;
    color: var(--c-text-muted);
    margin-bottom: 12px;
    font-weight: 500;
}

/* ── Yes/No Grid ─────────────────────────────── */
.yesno-grid {
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.yesno-header {
    display: grid;
    grid-template-columns: 1fr 80px 80px;
    background: var(--c-primary-muted);
    font-weight: 600;
    font-size: 13px;
}

.yesno-header > div {
    padding: 10px 16px;
    text-align: center;
}

.yesno-header > div:first-child { text-align: left; }

.yesno-row {
    display: grid;
    grid-template-columns: 1fr 80px 80px;
    border-top: 1px solid var(--c-border);
    transition: var(--transition);
}

.yesno-row:hover { background: var(--c-surface-hover); }
.yesno-row.correct-row { background: var(--c-success-muted); }
.yesno-row.incorrect-row { background: var(--c-danger-muted); }

.yesno-statement {
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.5;
}

.yesno-choice {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

.yesno-choice input[type="radio"] {
    width: 18px; height: 18px;
    accent-color: var(--c-primary);
    cursor: pointer;
}

/* ── Dropdown Slots ──────────────────────────── */
.dropdown-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.dropdown-slot {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--c-bg-raised);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
}

.dropdown-slot label {
    font-weight: 600;
    font-size: 14px;
    min-width: 160px;
    color: var(--c-text);
}

.dropdown-slot select {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid var(--c-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 14px;
    background: var(--c-surface);
    color: var(--c-text);
    cursor: pointer;
    transition: var(--transition);
    appearance: auto;
}

.dropdown-slot select:focus {
    border-color: var(--c-primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--c-primary-muted);
}

.dropdown-slot.correct { border-color: var(--c-success); background: var(--c-success-muted); }
.dropdown-slot.incorrect { border-color: var(--c-danger); background: var(--c-danger-muted); }

.code-block-with-dropdowns {
    white-space: pre-wrap;
}

.dropdown-slot-inline {
    display: inline-flex;
    vertical-align: middle;
    padding: 0;
    margin: 0 2px;
    background: none;
    border: none;
    border-radius: 0;
}

.dropdown-slot-inline select {
    min-width: 150px;
    padding: 2px 8px;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.4;
    border: 1px solid var(--c-border);
    border-radius: 4px;
}

.dropdown-slot-inline.correct select {
    border-color: var(--c-success);
    background: var(--c-success-muted);
}

.dropdown-slot-inline.incorrect select {
    border-color: var(--c-danger);
    background: var(--c-danger-muted);
}

/* ── Drag & Drop ─────────────────────────────── */
.drag-drop-container {
    display: flex;
    gap: 24px;
}

.drag-source-pool,
.drag-target-area {
    flex: 1;
    padding: 16px;
    background: var(--c-bg-raised);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
}

.drag-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--c-text-muted);
    margin-bottom: 12px;
}

.drag-pool-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 60px;
}

.drag-chip {
    padding: 10px 14px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    cursor: grab;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s var(--ease);
    user-select: none;
}

.drag-chip:hover { border-color: var(--c-primary); }
.drag-chip:active { cursor: grabbing; }
.drag-chip.dragging { opacity: 0.7; border-style: dashed; }

.target-slot-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 10px;
}

.target-slot-label {
    width: 40%;
    font-weight: 600;
    font-size: 14px;
}

.target-dropzone {
    flex: 1;
    min-height: 44px;
    border: 2px dashed var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-surface);
    display: flex;
    align-items: center;
    padding: 4px;
    transition: all 0.15s var(--ease);
}

.target-dropzone.drag-over {
    border-color: var(--c-primary);
    background: var(--c-primary-muted);
}

.target-dropzone.correct { border-color: var(--c-success); border-style: solid; background: var(--c-success-muted); }
.target-dropzone.incorrect { border-color: var(--c-danger); border-style: solid; background: var(--c-danger-muted); }

/* ── Feedback Toast ──────────────────────────── */
.feedback-toast {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 22px;
    margin-bottom: 20px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    animation: slide-down 0.35s var(--ease);
}

.feedback-toast.correct {
    background: var(--c-success-muted);
    border: 1px solid var(--c-success);
    color: var(--c-success-text);
}

.feedback-toast.incorrect {
    background: var(--c-danger-muted);
    border: 1px solid var(--c-danger);
    color: var(--c-danger-text);
}

.feedback-icon {
    width: 34px; height: 34px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
    color: #fff;
}

.feedback-toast.correct .feedback-icon { background: var(--c-success); }
.feedback-toast.incorrect .feedback-icon { background: var(--c-danger); }

@keyframes slide-down {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Explanation Panel ───────────────────────── */
.explanation-panel {
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-top: 20px;
    background: var(--c-bg-raised);
    border: 1px solid var(--c-border);
    animation: slide-down 0.4s var(--ease);
}

.explanation-section {
    margin-bottom: 20px;
}

.explanation-section:last-child { margin-bottom: 0; }

.explanation-section h4 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.explanation-section h4.expl-title { color: var(--c-primary); }
.explanation-section h4.trap-title { color: var(--c-warning-text); }
.explanation-section h4.incorrect-title { color: var(--c-danger-text); }
.explanation-section h4.concept-title { color: var(--c-accent); }

.explanation-text {
    font-size: 14px;
    line-height: 1.75;
    color: var(--c-text-secondary);
}

/* Exam trap card */
.exam-trap-card {
    padding: 14px 18px;
    background: var(--c-warning-muted);
    border-left: 4px solid var(--c-warning);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin: 8px 0;
    font-size: 14px;
    line-height: 1.65;
    color: var(--c-text);
}

/* Key concept card */
.key-concept-card {
    padding: 14px 18px;
    background: var(--c-accent-muted);
    border-left: 4px solid var(--c-accent);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-size: 14px;
    line-height: 1.65;
    color: var(--c-text);
}

/* Why incorrect table */
.why-incorrect-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.why-incorrect-item {
    display: flex;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: var(--c-danger-muted);
    font-size: 13px;
    line-height: 1.5;
}

.why-incorrect-item .wi-letter {
    font-weight: 700;
    color: var(--c-danger-text);
    flex-shrink: 0;
    font-family: var(--font-mono);
}

/* ── Confidence Buttons ──────────────────────── */
.confidence-wrapper {
    margin-top: 16px;
    padding: 16px 18px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
}

.confidence-hint {
    font-size: 12px;
    color: var(--c-text-muted);
    margin-bottom: 10px;
    text-align: center;
}

.confidence-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.confidence-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--c-text-secondary);
    margin-right: 4px;
}

.confidence-btn {
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--c-border);
    background: var(--c-bg);
    color: var(--c-text-secondary);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.confidence-btn:hover {
    border-color: var(--c-primary);
    color: var(--c-primary);
    background: var(--c-primary-muted);
}

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

/* ── Learning Guide ─────────────────────────── */
.learning-guide {
    max-width: 820px;
    margin: 0 auto 20px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    background: var(--c-surface);
    overflow: hidden;
}

.learning-guide-toggle {
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--c-primary);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.learning-guide-toggle::-webkit-details-marker { display: none; }

.learning-guide-toggle::before {
    content: "\25B6";
    font-size: 10px;
    transition: transform 0.2s;
}

.learning-guide[open] .learning-guide-toggle::before {
    transform: rotate(90deg);
}

.learning-guide-body {
    padding: 0 20px 20px;
}

.learning-guide-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 700px) {
    .learning-guide-grid { grid-template-columns: 1fr; }
}

.learning-guide-card {
    display: flex;
    gap: 12px;
    padding: 14px;
    border-radius: var(--radius-sm);
    background: var(--c-bg);
    border: 1px solid var(--c-border);
}

.learning-guide-card p {
    font-size: 14px;
    color: var(--c-text-secondary);
    line-height: 1.6;
    margin: 4px 0 0;
}

.learning-guide-card ul {
    margin: 6px 0 0;
    padding-left: 16px;
    font-size: 14px;
    color: var(--c-text-secondary);
    line-height: 1.7;
}

.learning-guide-card strong {
    font-size: 15px;
    color: var(--c-text);
}

.learning-guide-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--c-primary-muted);
    color: var(--c-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.learning-guide-table {
    width: 100%;
    margin-top: 8px;
    border-collapse: collapse;
    font-size: 13px;
}

.learning-guide-table th {
    text-align: left;
    padding: 5px 10px;
    border-bottom: 1px solid var(--c-border);
    color: var(--c-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 11px;
}

.learning-guide-table td {
    padding: 5px 10px;
    border-bottom: 1px solid var(--c-border);
    color: var(--c-text-secondary);
}

/* ── Bottom Navigation Bar ───────────────────── */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-w);
    right: 0;
    background: var(--c-surface);
    border-top: 1px solid var(--c-border);
    padding: 12px 32px;
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 50;
    backdrop-filter: blur(12px);
}

.bottom-bar .progress-bar {
    flex: 1;
}

/* ── Timer ───────────────────────────────────── */
.timer {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-xl);
    background: var(--c-bg-raised);
    border: 1px solid var(--c-border);
    font-weight: 600;
    font-size: 15px;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.timer.warning { border-color: var(--c-warning); color: var(--c-warning-text); background: var(--c-warning-muted); }
.timer.danger { border-color: var(--c-danger); color: var(--c-danger-text); background: var(--c-danger-muted); animation: pulse 1s infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ── Question Navigator (sidebar) ────────────── */
.sidebar-navigator {
    padding: 8px 12px;
    border-top: 1px solid var(--c-border);
    overflow-y: auto;
    max-height: 42vh;
}

.sidebar-nav-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--c-text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}

.question-nav {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
}

.q-nav-item {
    width: 30px; height: 30px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: var(--transition);
    background: transparent;
    color: var(--c-text-muted);
}

.q-nav-item:hover { border-color: var(--c-primary); color: var(--c-text); }
.q-nav-item.current { border-color: var(--c-primary); background: var(--c-primary-muted); color: var(--c-primary); }
.q-nav-item.correct { background: var(--c-success-muted); border-color: var(--c-success); color: var(--c-success-text); }
.q-nav-item.incorrect { background: var(--c-danger-muted); border-color: var(--c-danger); color: var(--c-danger-text); }
.q-nav-item.answered { background: var(--c-primary-muted); border-color: var(--c-primary); color: var(--c-primary); }
.q-nav-item.flagged { background: var(--c-warning-muted); border-color: var(--c-warning); color: var(--c-warning-text); }

.nav-compact-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.nav-page-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--c-text-muted);
}

.nav-jump-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--c-border);
}

.nav-jump-input {
    width: 52px;
    padding: 4px 6px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-family: var(--font-mono);
    background: var(--c-surface);
    color: var(--c-text);
}

.nav-jump-input:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 2px var(--c-primary-muted);
}

/* ── Case Study Side Panel ───────────────────── */
.case-study-side-panel {
    position: fixed;
    right: 0; top: 0; bottom: 0;
    width: 540px;
    max-width: 90vw;
    z-index: 200;
    display: flex;
    flex-direction: column;
    background: var(--c-surface);
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.3);
    border-left: 3px solid var(--c-primary);
    transform: translateX(100%);
    transition: transform 0.3s var(--ease);
    overflow: hidden;
}

.case-study-side-panel.open { transform: translateX(0); }

.case-study-side-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: var(--c-primary-muted);
    border-bottom: 1px solid var(--c-border);
    flex-shrink: 0;
}

.case-study-badge {
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: var(--c-primary);
    border-radius: var(--radius-sm);
}

.case-study-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--c-text-secondary);
    padding: 2px 6px;
    line-height: 1;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.case-study-close:hover { background: var(--c-surface-hover); color: var(--c-text); }

.case-study-side-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--c-text-secondary);
}

.case-study-side-body h2,
.case-study-side-body h3 {
    color: var(--c-text);
    margin: 18px 0 8px;
    font-size: 15px;
}

.case-study-side-body h2:first-child,
.case-study-side-body h3:first-child { margin-top: 0; }

.case-study-side-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 13px;
}

.case-study-side-body th,
.case-study-side-body td {
    border: 1px solid var(--c-border);
    padding: 8px 10px;
    text-align: left;
}

.case-study-side-body th {
    background: var(--c-primary-muted);
    font-weight: 600;
}

.case-study-side-body ul,
.case-study-side-body ol {
    padding-left: 20px;
    margin: 8px 0;
}

.case-study-side-body p { margin: 8px 0; }

.case-study-show-btn {
    position: fixed;
    right: 0; top: 50%;
    transform: translateY(-50%);
    z-index: 190;
    padding: 14px 12px;
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font-body);
    background: var(--c-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    cursor: pointer;
    box-shadow: 0 2px 16px rgba(99, 102, 241, 0.4);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    letter-spacing: 0.5px;
    transition: var(--transition);
}

.case-study-show-btn:hover {
    background: var(--c-primary-hover);
    padding-right: 18px;
}

.case-study-info-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    margin-bottom: 14px;
    background: var(--c-primary-muted);
    border: 1px solid var(--c-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.case-study-info-banner:hover {
    box-shadow: var(--shadow-glow);
}

.cs-banner-badge {
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: var(--c-primary);
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.cs-banner-text {
    font-size: 13px;
    font-weight: 500;
}

.cs-banner-arrow {
    margin-left: auto;
    font-size: 18px;
    color: var(--c-primary);
    font-weight: 700;
}

.case-study-backdrop {
    position: fixed;
    inset: 0;
    z-index: 199;
    background: var(--overlay-bg);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s var(--ease);
}

.case-study-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

/* ── Score / Results ─────────────────────────── */
.score-gauge {
    text-align: center;
    padding: 40px 0;
}

.score-value {
    font-size: 64px;
    font-weight: 700;
    font-family: var(--font-mono);
    line-height: 1;
}

.score-total {
    font-size: 20px;
    color: var(--c-text-muted);
    font-weight: 500;
}

.score-status {
    font-size: 18px;
    font-weight: 700;
    margin-top: 12px;
}

.score-status.passed { color: var(--c-success-text); }
.score-status.failed { color: var(--c-danger-text); }

/* ── Recent Sessions Table ───────────────────── */
.sessions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.sessions-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--c-text-muted);
    border-bottom: 1px solid var(--c-border);
}

.sessions-table td {
    padding: 12px;
    border-bottom: 1px solid var(--c-border-subtle);
}

.sessions-table tr:hover td {
    background: var(--c-surface-hover);
}

/* ── Empty State ─────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--c-text-muted);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--c-text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    max-width: 400px;
    margin: 0 auto 20px;
}

/* ── Loading Spinner ─────────────────────────── */
.spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--c-border);
    border-top-color: var(--c-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 40px auto;
}

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

/* ── Mobile hamburger button ─────────────────── */
.mobile-menu-btn {
    display: none;  /* hidden on desktop */
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    width: 40px;
    height: 40px;
    padding: 8px;
    border: none;
    border-radius: 8px;
    background: var(--c-surface);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
}
.mobile-menu-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--c-text);
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.25s;
}
/* Animate to X when open */
.mobile-menu-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mobile-menu-btn.open span:nth-child(2) { opacity: 0; }
.mobile-menu-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* ── Responsive ──────────────────────────────── */
@media (max-width: 768px) {
    .mobile-menu-btn { display: flex; }
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-navigator { display: none; }
    .main-content { margin-left: 0; padding: 16px; padding-top: 60px; }
    .shell-context-bar { margin-bottom: 20px; padding-bottom: 14px; }
    .bottom-bar { left: 0; }
    .card-grid { grid-template-columns: 1fr; }
    .question-container { padding-bottom: 80px; }
    .drag-drop-container { flex-direction: column; }
    .case-study-side-panel { width: 100%; max-width: 100%; }
    .quick-actions { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .quick-actions { grid-template-columns: 1fr; }
}

/* ── Utilities ───────────────────────────────── */
.text-muted { color: var(--c-text-muted); }
.text-secondary { color: var(--c-text-secondary); }
.text-primary { color: var(--c-primary); }
.text-success { color: var(--c-success-text); }
.text-danger { color: var(--c-danger-text); }
.text-warning { color: var(--c-warning-text); }
.text-mono { font-family: var(--font-mono); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }


/* ============================================
   Study Day — Markdown content rendering
   ============================================ */

.study-day-page {
    max-width: 860px;
    margin: 0 auto;
    padding-bottom: 60px;
}

/* Nav bar */
.study-day-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.study-back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--c-text-secondary);
    text-decoration: none;
    transition: color 0.15s;
}
.study-back-link:hover {
    color: var(--c-primary);
}

.study-day-pager {
    display: flex;
    gap: 8px;
}

.study-pager-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--c-text-muted);
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--c-border);
    transition: all 0.15s;
}
.study-pager-btn:hover {
    color: var(--c-primary);
    border-color: var(--c-primary);
    background: var(--c-primary-muted);
}

/* Header */
.study-day-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--c-border);
}

.study-day-badge {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    background: var(--c-primary-muted);
    color: var(--c-primary);
    flex-shrink: 0;
    box-shadow: var(--shadow-glow);
}

.study-day-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--c-text);
    margin: 0 0 4px;
    line-height: 1.3;
}

.study-day-subtitle {
    font-size: 13px;
    color: var(--c-text-muted);
    margin: 0;
}

/* Bottom nav */
.study-day-bottom-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--c-border);
    gap: 12px;
}

/* ── Table of Contents ──────────────────────── */

.study-toc {
    background: var(--c-bg-raised);
    border: 1px solid var(--c-border);
    border-radius: 10px;
    margin-bottom: 32px;
    overflow: hidden;
}

.study-toc-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text-secondary);
    padding: 14px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
    list-style: none;
}
.study-toc-title::-webkit-details-marker {
    display: none;
}
.study-toc-title::before {
    content: "\25b6";
    font-size: 10px;
    transition: transform 0.2s;
    color: var(--c-text-muted);
}
.study-toc[open] > .study-toc-title::before {
    transform: rotate(90deg);
}

.study-toc-body {
    padding: 0 20px 16px;
    max-height: 400px;
    overflow-y: auto;
}

.study-toc-body ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.study-toc-body li {
    margin: 0;
}

.study-toc-body > ul > li > a {
    display: block;
    padding: 6px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text);
    text-decoration: none;
    border-bottom: 1px solid var(--c-border-subtle);
    transition: color 0.15s;
}
.study-toc-body > ul > li > a:hover {
    color: var(--c-primary);
}

.study-toc-body > ul > li > ul > li > a {
    display: block;
    padding: 4px 0 4px 16px;
    font-size: 12px;
    font-weight: 400;
    color: var(--c-text-secondary);
    text-decoration: none;
    transition: color 0.15s;
}
.study-toc-body > ul > li > ul > li > a:hover {
    color: var(--c-primary);
}

/* Nested list indentation */
.study-toc-body ul ul {
    padding-left: 0;
}

/* ── Rendered Markdown article ─────────────── */

.study-content {
    color: var(--c-text);
    font-size: 15px;
    line-height: 1.75;
}

.study-content > *:first-child {
    margin-top: 0;
}

/* Headings */
.study-content h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--c-text);
    margin: 48px 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--c-border);
    line-height: 1.3;
}

.study-content h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--c-text);
    margin: 40px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--c-border-subtle);
    line-height: 1.3;
}

.study-content h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--c-text);
    margin: 32px 0 12px;
    line-height: 1.4;
}

.study-content h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--c-text-secondary);
    margin: 24px 0 8px;
    line-height: 1.4;
}

/* Paragraphs */
.study-content p {
    margin: 0 0 14px;
}

/* Bold & italic */
.study-content strong {
    color: var(--c-text);
    font-weight: 600;
}

/* Links */
.study-content a {
    color: var(--c-primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s;
}
.study-content a:hover {
    border-bottom-color: var(--c-primary);
}

/* Lists */
.study-content ul,
.study-content ol {
    margin: 0 0 16px;
    padding-left: 24px;
}

.study-content li {
    margin-bottom: 6px;
}

.study-content li > ul,
.study-content li > ol {
    margin-top: 6px;
    margin-bottom: 0;
}

/* Tables */
.study-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0 20px;
    font-size: 13.5px;
    line-height: 1.5;
    background: var(--c-bg-raised);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--c-border);
}

.study-content thead {
    background: var(--c-surface);
}

.study-content th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--c-text-secondary);
    border-bottom: 1px solid var(--c-border);
}

.study-content td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--c-border-subtle);
    color: var(--c-text);
    vertical-align: top;
}

.study-content tbody tr:last-child td {
    border-bottom: none;
}

.study-content tbody tr:hover {
    background: var(--c-surface-hover);
}

/* Code blocks */
.study-content pre {
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    padding: 16px 18px;
    margin: 16px 0 20px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: var(--c-text);
}

.study-content code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.88em;
    padding: 2px 6px;
    background: var(--c-surface);
    border: 1px solid var(--c-border-subtle);
    border-radius: 4px;
    color: var(--c-accent);
}

.study-content pre code {
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
    font-size: 13px;
    color: var(--c-text);
}

/* Blockquotes — standard */
.study-content blockquote {
    margin: 16px 0 20px;
    padding: 14px 18px;
    border-left: 3px solid var(--c-primary);
    background: var(--c-primary-muted);
    border-radius: 0 8px 8px 0;
    color: var(--c-text);
    font-size: 14px;
}

.study-content blockquote p {
    margin: 0 0 8px;
}
.study-content blockquote p:last-child {
    margin-bottom: 0;
}

/* Exam trap blockquotes — special amber/warning style */
.study-content blockquote.exam-trap {
    border-left-color: var(--c-warning);
    background: var(--c-warning-muted);
    position: relative;
}

.study-content blockquote.exam-trap::before {
    content: "EXAM TRAP";
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--c-warning-text);
    margin-bottom: 8px;
    font-family: 'JetBrains Mono', monospace;
}

/* Horizontal rules */
.study-content hr {
    border: none;
    border-top: 1px solid var(--c-border);
    margin: 32px 0;
}

/* Checkboxes in review checklist */
.study-content input[type="checkbox"] {
    accent-color: var(--c-primary);
    margin-right: 6px;
}

/* Images (if any) */
.study-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 16px 0;
}

/* Definition-like patterns (used in some materials) */
.study-content dl {
    margin: 12px 0;
}
.study-content dt {
    font-weight: 600;
    color: var(--c-text);
    margin-top: 12px;
}
.study-content dd {
    margin-left: 20px;
    color: var(--c-text-secondary);
}

/* Responsive */
@media (max-width: 640px) {
    .study-day-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .study-day-badge {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    .study-day-title {
        font-size: 18px;
    }
    .study-content {
        font-size: 14px;
    }
    .study-content pre {
        font-size: 12px;
        padding: 12px 14px;
    }
    .study-content table {
        font-size: 12px;
    }
    .study-content th,
    .study-content td {
        padding: 8px 10px;
    }
    .study-day-bottom-nav {
        flex-direction: column;
    }
}

/* ── "Read Material" button in study plan overview ─ */
.study-material-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--c-primary);
    text-decoration: none;
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid var(--c-primary);
    background: var(--c-primary-muted);
    transition: all 0.15s;
    margin-top: 8px;
    cursor: pointer;
}
.study-material-btn:hover {
    background: var(--c-primary);
    color: #fff;
}

/* Button styles used in study day */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.15s;
    cursor: pointer;
    border: none;
}
.btn--primary {
    background: var(--c-primary);
    color: #fff;
}
.btn--primary:hover {
    background: var(--c-primary-hover);
}
.btn--outline {
    background: transparent;
    color: var(--c-text-secondary);
    border: 1px solid var(--c-border);
}
.btn--outline:hover {
    color: var(--c-text);
    border-color: var(--c-text-muted);
    background: var(--c-surface-hover);
}
