/* =========================================================
   Vibe 学堂 · 题库练习 & 试卷生成系统 - 主样式
   命名空间: .exam-*
   设计 token 全部复用 frontend/css/main.css 的 :root
   ========================================================= */

body {
    background: var(--bg);
}

/* ---------- 顶部导航（子应用统一） ---------- */
.exam-topnav {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 50;
}

.exam-topnav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    font-weight: 800;
    font-size: 16px;
}

.exam-topnav-logo:hover {
    color: var(--primary);
}

.exam-topnav-links {
    display: flex;
    gap: 4px;
    align-items: center;
}

.exam-topnav-link {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-light);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s;
}

.exam-topnav-link:hover {
    color: var(--primary);
    background: var(--bg-alt);
}

.exam-topnav-link.is-active {
    color: var(--primary);
    background: var(--bg-alt);
}

@media (max-width: 640px) {
    .exam-topnav {
        padding: 10px 16px;
    }
    .exam-topnav-link {
        padding: 5px 10px;
        font-size: 13px;
    }
}

/* ---------- 页面容器 ---------- */
.exam-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 20px 80px;
}

.exam-container-narrow {
    max-width: 880px;
    margin: 0 auto;
    padding: 32px 20px 80px;
}

/* ---------- 顶部 hero ---------- */
.exam-hero {
    background: var(--gradient-soft);
    border-radius: var(--radius-lg);
    padding: 48px 32px;
    margin-bottom: 32px;
    position: relative;
    overflow: hidden;
}

.exam-hero::before {
    content: "";
    position: absolute;
    top: -60px;
    right: -60px;
    width: 200px;
    height: 200px;
    background: var(--gradient);
    opacity: 0.08;
    border-radius: 50%;
}

.exam-hero-eyebrow {
    display: inline-block;
    background: var(--bg-card);
    color: var(--primary);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.exam-hero h1 {
    font-size: 36px;
    color: var(--text);
    margin-bottom: 12px;
    font-weight: 800;
}

.exam-hero p {
    color: var(--text-light);
    font-size: 16px;
    max-width: 640px;
    line-height: 1.7;
}

.exam-hero-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

/* ---------- 卡片网格 ---------- */
.exam-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.exam-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all 0.2s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}

.exam-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.exam-card-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    background: var(--gradient-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 16px;
}

.exam-card h3 {
    font-size: 18px;
    color: var(--text);
    margin-bottom: 8px;
}

.exam-card p {
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.6;
}

/* ---------- 章节标题 ---------- */
.exam-section {
    margin-bottom: 48px;
}

.exam-section-header {
    margin-bottom: 24px;
}

.exam-section-title {
    font-size: 24px;
    color: var(--text);
    font-weight: 800;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.exam-section-subtitle {
    color: var(--text-light);
    font-size: 14px;
}

/* ---------- 筛选器 ---------- */
.exam-filter-bar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.exam-filter-bar label {
    font-size: 14px;
    color: var(--text-light);
    font-weight: 600;
}

.exam-select,
.exam-input {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.15s;
    min-width: 140px;
}

.exam-select:focus,
.exam-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

/* ---------- 科目网格（首页/选择页用） ---------- */
.exam-subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.exam-subject-tile {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
}

.exam-subject-tile:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.exam-subject-tile.is-active {
    border-color: var(--primary);
    background: var(--bg-alt);
}

.exam-subject-tile-emoji {
    font-size: 36px;
    margin-bottom: 8px;
    display: block;
}

.exam-subject-tile-name {
    font-weight: 700;
    color: var(--text);
    font-size: 15px;
    margin-bottom: 4px;
}

.exam-subject-tile-meta {
    font-size: 12px;
    color: var(--text-light);
}

/* ---------- 题目列表 ---------- */
.exam-question-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.exam-question-row {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.15s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.exam-question-row:hover {
    border-color: var(--primary-light);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.exam-question-row-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.exam-question-row-body {
    flex: 1;
    min-width: 0;
}

.exam-question-row-stem {
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
}

.exam-question-row-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-light);
}

/* ---------- 标签 ---------- */
.exam-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--bg-alt);
    color: var(--primary-dark);
}

.exam-tag-difficulty-easy {
    background: #d1fae5;
    color: #065f46;
}

.exam-tag-difficulty-medium {
    background: #fef3c7;
    color: #92400e;
}

.exam-tag-difficulty-hard {
    background: #fee2e2;
    color: #991b1b;
}

.exam-tag-type {
    background: #e0e7ff;
    color: #3730a3;
}

/* ---------- 题目作答卡片 ---------- */
.exam-qcard {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.exam-qcard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px dashed var(--border);
    flex-wrap: wrap;
    gap: 8px;
}

.exam-qcard-num {
    font-weight: 700;
    color: var(--text);
    font-size: 15px;
}

.exam-qcard-stem {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text);
    margin-bottom: 18px;
    white-space: pre-wrap;
}

/* ---------- 图形展示 ---------- */
.exam-figure {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    text-align: center;
}
.exam-figure-svg {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    background: #fff;
    padding: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.exam-figure-caption {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 10px;
    line-height: 1.6;
}
.exam-table {
    width: auto;
    min-width: 40%;
    max-width: 100%;
    border-collapse: collapse;
    margin: 10px auto;
    font-size: 14px;
}
.exam-table th,
.exam-table td {
    border: 1px solid var(--border);
    padding: 6px 14px;
    text-align: center;
}
.exam-table th {
    background: var(--bg-alt);
    font-weight: 600;
}
.exam-table td {
    background: #fff;
}
.exam-figure-img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 6px;
    background: #fff;
    padding: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    object-fit: contain;
}
.exam-option-img {
    max-width: 140px;
    max-height: 110px;
    object-fit: contain;
    margin-top: 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px;
    background: #fff;
}
.exam-figure-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
}
.exam-figure-option img {
    max-width: 120px;
    max-height: 100px;
    object-fit: contain;
}

.exam-qcard-stem img,
.exam-qcard-option img {
    max-width: 100%;
    border-radius: var(--radius-sm);
    margin: 8px 0;
}

/* ---------- 选择题选项 ---------- */
.exam-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.exam-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    background: var(--bg);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
}

.exam-option:hover:not(.is-disabled) {
    border-color: var(--primary-light);
    background: var(--bg-alt);
}

.exam-option-letter {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
    color: var(--text-light);
    transition: all 0.15s;
}

.exam-option-text {
    flex: 1;
}

.exam-option.is-selected {
    border-color: var(--primary);
    background: var(--bg-alt);
}

.exam-option.is-selected .exam-option-letter {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.exam-option.is-correct {
    border-color: var(--success);
    background: #ecfdf5;
}

.exam-option.is-correct .exam-option-letter {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.exam-option.is-wrong {
    border-color: #ef4444;
    background: #fef2f2;
}

.exam-option.is-wrong .exam-option-letter {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

.exam-option.is-disabled {
    cursor: not-allowed;
    opacity: 0.85;
}

/* ---------- 多选题标识 ---------- */
.exam-option-multi-hint {
    font-size: 11px;
    color: var(--text-light);
    margin-left: 6px;
    font-weight: 600;
}

/* ---------- 填空题/简答题输入 ---------- */
.exam-blank-input,
.exam-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    line-height: 1.6;
    transition: all 0.15s;
    resize: vertical;
}

.exam-blank-input:focus,
.exam-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.exam-textarea {
    min-height: 120px;
}

/* ---------- 判断题 ---------- */
.exam-judge-group {
    display: flex;
    gap: 12px;
}

.exam-judge-btn {
    flex: 1;
    padding: 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    cursor: pointer;
    text-align: center;
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
    transition: all 0.15s;
}

.exam-judge-btn:hover:not(.is-disabled) {
    border-color: var(--primary);
    background: var(--bg-alt);
}

.exam-judge-btn.is-selected {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

.exam-judge-btn.is-correct {
    border-color: var(--success);
    background: var(--success);
    color: white;
}

.exam-judge-btn.is-wrong {
    border-color: #ef4444;
    background: #ef4444;
    color: white;
}

.exam-judge-btn.is-disabled {
    cursor: not-allowed;
    opacity: 0.85;
}

/* ---------- 答案解析 ---------- */
.exam-explain {
    margin-top: 16px;
    padding: 14px 18px;
    background: var(--bg-alt);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
    display: none;
}

.exam-explain.is-shown {
    display: block;
}

.exam-explain-label {
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 4px;
}

/* ---------- 试卷头部（答题中） ---------- */
.exam-paper-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
    gap: 12px;
}

.exam-paper-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.exam-paper-meta {
    display: flex;
    gap: 16px;
    font-size: 14px;
    color: var(--text-light);
    flex-wrap: wrap;
}

.exam-paper-timer {
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    padding: 4px 12px;
    background: var(--bg-alt);
    border-radius: var(--radius-sm);
}

.exam-paper-timer.is-warning {
    color: #92400e;
    background: #fef3c7;
}

.exam-paper-timer.is-danger {
    color: #991b1b;
    background: #fee2e2;
    animation: exam-pulse 1s infinite;
}

@keyframes exam-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* ---------- 答题卡侧栏 ---------- */
.exam-paper-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 24px;
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 20px;
}

@media (max-width: 900px) {
    .exam-paper-layout {
        grid-template-columns: 1fr;
    }
    .exam-answer-sheet {
        position: static !important;
    }
}

.exam-answer-sheet {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.exam-answer-sheet-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.exam-answer-sheet-section {
    margin-bottom: 14px;
}

.exam-answer-sheet-section-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 6px;
}

.exam-answer-sheet-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
}

.exam-answer-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    background: var(--bg);
    transition: all 0.1s;
}

.exam-answer-cell:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.exam-answer-cell.is-answered {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.exam-answer-cell.is-current {
    box-shadow: 0 0 0 2px var(--secondary);
    border-color: var(--secondary);
}

/* ---------- 按钮 ---------- */
.exam-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.15s;
    text-decoration: none;
}

.exam-btn-primary {
    background: var(--gradient);
    color: white;
    box-shadow: var(--shadow);
}

.exam-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.exam-btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border: 1.5px solid var(--border);
}

.exam-btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.exam-btn-ghost {
    background: transparent;
    color: var(--text-light);
}

.exam-btn-ghost:hover {
    color: var(--primary);
    background: var(--bg-alt);
}

.exam-btn-danger {
    background: #fee2e2;
    color: #991b1b;
}

.exam-btn-danger:hover {
    background: #fecaca;
}

.exam-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.exam-btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

/* ---------- 工具栏 ---------- */
.exam-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

.exam-toolbar-left,
.exam-toolbar-right {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* ---------- 组卷配置卡片 ---------- */
.exam-config-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

.exam-config-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border);
}

.exam-config-row:last-child {
    border-bottom: none;
}

.exam-config-label {
    flex: 0 0 100px;
    font-weight: 600;
    color: var(--text);
    font-size: 14px;
}

.exam-config-controls {
    display: flex;
    gap: 10px;
    flex: 1;
    align-items: center;
    flex-wrap: wrap;
}

.exam-config-controls .exam-input {
    width: 80px;
    min-width: auto;
    text-align: center;
}

.exam-config-controls .exam-select {
    flex: 1;
    min-width: 120px;
}

/* ---------- Tab 切换 ---------- */
.exam-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-alt);
    padding: 4px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    width: fit-content;
}

.exam-tab {
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-light);
    transition: all 0.15s;
    border: none;
    background: transparent;
    font-family: inherit;
}

.exam-tab.is-active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* ---------- 成绩展示 ---------- */
.exam-score-board {
    background: var(--gradient-soft);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    margin-bottom: 32px;
}

.exam-score-num {
    font-size: 56px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin: 8px 0;
}

.exam-score-total {
    font-size: 18px;
    color: var(--text-light);
    margin-bottom: 16px;
}

.exam-score-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.exam-score-stat {
    text-align: center;
}

.exam-score-stat-num {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

.exam-score-stat-label {
    font-size: 12px;
    color: var(--text-light);
}

/* ---------- 空状态 ---------- */
.exam-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.exam-empty-icon {
    font-size: 56px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.exam-empty-text {
    font-size: 15px;
}

/* ---------- 题目勾选 + 操作栏 ---------- */
.exam-question-row.is-checked {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 6%, transparent);
}

.exam-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    background: var(--bg-card);
    color: transparent;
    font-size: 12px;
    user-select: none;
}
.exam-checkbox:hover {
    border-color: var(--primary-light);
}
.exam-checkbox.is-checked {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.exam-select-bar {
    background: var(--bg-card);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    position: sticky;
    top: 0;
    z-index: 10;
}
.exam-select-bar-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    margin-right: auto;
}
.exam-select-bar .exam-btn {
    font-size: 13px;
}

/* ---------- 错题本/历史记录项 ---------- */
.exam-history-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.15s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.exam-history-item:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow);
    transform: translateX(2px);
}

.exam-history-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    background: var(--gradient-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.exam-history-body {
    flex: 1;
    min-width: 0;
}

.exam-history-title {
    font-weight: 700;
    color: var(--text);
    font-size: 15px;
    margin-bottom: 4px;
}

.exam-history-meta {
    font-size: 13px;
    color: var(--text-light);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.exam-history-score {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary);
    flex-shrink: 0;
    min-width: 60px;
    text-align: right;
}

.exam-history-score.is-low {
    color: #ef4444;
}

/* ---------- 单题详情弹层 ---------- */
.exam-modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.exam-modal-mask.is-shown {
    display: flex;
}

.exam-modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    max-width: 720px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

.exam-modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
}

.exam-modal-title {
    font-weight: 700;
    color: var(--text);
    font-size: 16px;
}

.exam-modal-close {
    background: transparent;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-light);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.exam-modal-close:hover {
    background: var(--bg-alt);
    color: var(--text);
}

.exam-modal-body {
    padding: 24px;
}

/* ---------- 知识点标签 ---------- */
.exam-kp-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.exam-kp {
    display: inline-block;
    padding: 2px 10px;
    background: var(--bg-alt);
    color: var(--text-light);
    border-radius: 999px;
    font-size: 12px;
}

/* ---------- 移动端适配 ---------- */
@media (max-width: 640px) {
    .exam-hero {
        padding: 32px 20px;
    }
    .exam-hero h1 {
        font-size: 26px;
    }
    .exam-qcard {
        padding: 20px;
    }
    .exam-paper-header {
        padding: 12px 16px;
    }
    .exam-paper-meta {
        gap: 10px;
        font-size: 13px;
    }
    .exam-config-label {
        flex: 0 0 80px;
        font-size: 13px;
    }
}

/* ---------- 公式渲染（数学） ---------- */
.exam-formula {
    font-family: "Cambria Math", "Latin Modern Math", "STIX Two Math", "Times New Roman", serif;
    font-style: italic;
    color: var(--text);
    font-size: 1.05em;
}

.exam-formula sup,
.exam-formula sub {
    font-style: normal;
    font-size: 0.75em;
}
