/* ========== 全局 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #667eea;
    --primary-dark: #764ba2;
    --bg: #f0f4f8;
    --card: #fff;
    --text: #334155;
    --text-muted: #94a3b8;
    --text-dark: #1e293b;
    --border: #e2e8f0;
    --red: #ef4444;
    --orange: #f59e0b;
    --blue: #3b82f6;
    --green: #22c55e;
    --radius: 14px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* ========== 登录页 ========== */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: var(--card);
    border-radius: 16px;
    padding: 48px 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header .logo { font-size: 48px; margin-bottom: 8px; }
.login-header h1 { font-size: 24px; color: var(--text-dark); margin-bottom: 8px; }
.login-header p { color: var(--text-muted); font-size: 14px; }

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: #fef2f2;
    color: var(--red);
    border: 1px solid #fecaca;
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.alert-success {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.vocab-sync-hint {
    font-size: 14px;
    color: var(--text);
    margin: 0 0 12px;
    line-height: 1.6;
}
.vocab-sync-hint strong { color: var(--primary); }

/* ========== 表单 ========== */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}
.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

/* ========== 按钮 ========== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4); }
.btn-full { width: 100%; padding: 14px; font-size: 16px; }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 8px; }
.btn-link { background: transparent; color: var(--primary); padding: 6px 0; }
.btn-link:hover { color: var(--primary-dark); }
.btn-outline {
    background: transparent;
    color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.5);
}
.btn-outline:hover { background: rgba(255, 255, 255, 0.15); }
.btn-outline-dark {
    background: transparent;
    color: var(--text);
    border: 1.5px solid var(--border);
}
.btn-outline-dark:hover { background: #f1f5f9; }

/* ========== 顶栏 ========== */
.topbar {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    max-width: 1200px;
    margin: 0 auto;
    gap: 24px;
}
.topbar-brand { font-size: 18px; font-weight: 700; white-space: nowrap; }
.topbar-nav { display: flex; gap: 4px; }
.nav-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}
.nav-link:hover { color: #fff; background: rgba(255, 255, 255, 0.12); }
.nav-link.active { color: #fff; background: rgba(255, 255, 255, 0.2); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-user { font-size: 14px; white-space: nowrap; }

/* ========== Dashboard 主布局 ========== */
.dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}
.dashboard-header { margin-bottom: 32px; }
.dashboard-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.dashboard-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}
.header-filter-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.header-filter-form .form-select.small {
    padding: 6px 10px;
    font-size: 13px;
    border-radius: 8px;
    min-width: 120px;
}
.dashboard-header h2 { font-size: 28px; color: var(--text-dark); margin-bottom: 4px; }
.app-version {
    display: inline-block;
    vertical-align: middle;
    font-size: 13px;
    font-weight: 500;
    color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 999px;
    padding: 2px 10px;
    margin-left: 8px;
    letter-spacing: 0.3px;
}
.mode-tag {
    display: inline-block;
    vertical-align: middle;
    font-size: 12px;
    font-weight: 600;
    border-radius: 999px;
    padding: 2px 10px;
    margin-left: 6px;
    letter-spacing: 0.3px;
}
.mode-local {
    color: #b45309;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
}
.mode-cloud {
    color: #047857;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
}
.schema-tag {
    display: inline-block;
    vertical-align: middle;
    font-size: 12px;
    font-weight: 600;
    border-radius: 999px;
    padding: 2px 10px;
    margin-left: 6px;
    letter-spacing: 0.3px;
    color: #6d28d9;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.35);
}
.vocab-tag {
    display: inline-block;
    vertical-align: middle;
    font-size: 12px;
    font-weight: 600;
    border-radius: 999px;
    padding: 2px 10px;
    margin-left: 6px;
    letter-spacing: 0.3px;
    color: #1d4ed8;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.35);
}
.guest-tag {
    display: inline-block;
    vertical-align: middle;
    font-size: 12px;
    font-weight: 600;
    border-radius: 999px;
    padding: 2px 10px;
    margin-left: 6px;
    letter-spacing: 0.3px;
    color: #b45309;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.4);
}
.dashboard-header p { color: var(--text-muted); font-size: 15px; }

/* ========== 高考倒计时 ========== */
.gaokao-countdown {
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.10), rgba(16, 185, 129, 0.10));
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: var(--radius);
    padding: 18px 24px;
    margin-bottom: 24px;
}
.gaokao-countdown-icon { font-size: 36px; line-height: 1; }
.gaokao-countdown-text { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.gaokao-countdown-label { font-size: 15px; color: var(--text-muted); font-weight: 600; }
.gaokao-countdown-days {
    font-size: 34px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 1px;
}
.gaokao-countdown-unit { font-size: 16px; color: var(--text); font-weight: 600; }
.gaokao-countdown-date {
    font-size: 13px;
    color: var(--text-muted);
    margin-left: 10px;
}

/* ========== 统计卡片 ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    text-align: center;
    transition: transform 0.15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); }
.stat-icon { font-size: 28px; margin-bottom: 6px; }
.stat-value { font-size: 32px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 14px; color: var(--text); font-weight: 600; margin-top: 4px; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* 可点击的统计卡片（链接样式） */
a.stat-card-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}
a.stat-card-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.15);
    border: 1px solid rgba(102, 126, 234, 0.3);
}
a.stat-card-link:hover .stat-icon {
    transform: scale(1.15);
    transition: transform 0.2s;
}
a.stat-card-link .stat-value {
    color: var(--primary);
}

/* ========== 双栏布局 ========== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}
.dashboard-grid .section {
    margin-bottom: 0;
}
.dashboard-grid .grid-full {
    grid-column: 1 / -1;
}
@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .dashboard-grid .grid-full { grid-column: 1 / -1; }
}

/* ========== 卡片公用 ========== */
.section {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.section h3 {
    font-size: 17px;
    color: var(--text-dark);
    margin-bottom: 16px;
}
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.section-header h3 { margin-bottom: 0; }

/* ========== 图表容器 ========== */
.chart-container {
    position: relative;
    width: 100%;
}

/* ========== 迷你统计 ========== */
.mini-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.mini-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text);
}
.mini-stat-link {
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 8px;
    transition: background 0.15s, transform 0.15s;
    cursor: pointer;
}
.mini-stat-link:hover {
    background: #f1f5f9;
    transform: translateY(-1px);
}
.mini-stat-link:hover strong {
    color: var(--primary);
}
.mini-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.level-0 { background: var(--red); }
.level-1 { background: var(--orange); }
.level-2 { background: var(--blue); }
.level-3 { background: var(--green); }

/* ========== 薄弱知识点筛选 ========== */
.wp-filter {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.wp-filter .form-select.small {
    padding: 5px 8px;
    font-size: 12px;
    border-radius: 6px;
    min-width: 100px;
}

/* ========== 排行榜 ========== */
.rank-list { display: flex; flex-direction: column; gap: 0; }
/* 薄弱知识点排行占满整行时，用多列布局充分利用宽度 */
.dashboard-grid .grid-full .rank-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0 24px;
}
.dashboard-grid .grid-full .rank-item {
    flex: 1 1 300px;
    max-width: calc(50% - 12px);
    box-sizing: border-box;
}
.rank-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f8fafc;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background 0.15s ease;
}
.rank-item:hover { background: #f8fafc; }
.rank-item:last-child { border-bottom: none; }
.rank-num {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    background: #f1f5f9;
    color: var(--text-muted);
    flex-shrink: 0;
}
.rank-num.top { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; }
.rank-info { flex: 1; min-width: 0; }
.rank-name { font-size: 14px; font-weight: 600; color: var(--text-dark); }
.rank-meta { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

/* ========== 表格 ========== */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    padding: 12px 14px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 2px solid #f1f5f9;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
td {
    padding: 12px 14px;
    font-size: 13px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
tr:hover td { background: #f8fafc; }
.answer-cell { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content-cell {
    max-width: 300px;
    word-break: break-word;
    line-height: 1.5;
    font-size: 13px;
}
.text-muted { color: var(--text-muted); font-style: italic; }
.answer-text { color: #475569; }
.correct-text { color: #166534; font-weight: 600; }
.wrong-text { color: #b91c1c; font-weight: 600; }
.question-preview { color: #1e293b; line-height: 1.5; }
.answer-inline { margin-top: 4px; font-size: 12px; color: #64748b; }
.answer-inline .label { font-weight: 600; color: #94a3b8; }

/* ========== 复习按钮 ========== */
.review-form {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
}
.review-buttons {
    display: flex;
    gap: 4px;
}
.btn-review {
    flex: 1;
    padding: 4px 8px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.btn-review-up {
    background: #dcfce7;
    color: #166534;
}
.btn-review-up:hover { background: #bbf7d0; }
.btn-review-down {
    background: #fef2f2;
    color: #991b1b;
}
.btn-review-down:hover { background: #fecaca; }

/* ========== 错误层次选择器 ========== */
.error-level-select {
    padding: 3px 6px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 11px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    max-width: 110px;
    outline: none;
}
.error-level-select:focus { border-color: var(--primary); }

/* ========== 错误层次徽章 ========== */
.error-level-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    background: #f8fafc;
    border: 1px solid var(--border);
}

/* ========== 掌握度星级 ========== */
.mastery-stars {
    font-size: 14px;
    letter-spacing: 1px;
    cursor: default;
}

/* ========== 验证页样式 ========== */
.diff-list {
    list-style: none;
    padding: 0;
}
.diff-item {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 14px;
}
.diff-ok {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}
.diff-warn {
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fed7aa;
}
.action-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.btn-outline-info {
    background: transparent;
    color: #0284c7;
    border: 1.5px solid #7dd3fc;
}
.btn-outline-info:hover { background: #f0f9ff; }

/* 进度条 */
.bar-wrapper {
    position: relative;
    width: 100%;
    height: 20px;
    background: #f1f5f9;
    border-radius: 10px;
    overflow: hidden;
}
.bar-fill {
    height: 100%;
    background: #ef4444;
    border-radius: 10px;
    transition: width 0.3s;
    min-width: 2px;
}
.bar-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: 700;
    color: #475569;
}

/* ========== 徽章 ========== */
.subject-tag {
    display: inline-block;
    padding: 2px 10px;
    background: #eef2ff;
    color: var(--primary);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.error-type-badge {
    display: inline-block;
    padding: 2px 10px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.answer-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
}
.answer-badge.correct { background: #dcfce7; color: #166534; }
.answer-badge.partial { background: #fef3c7; color: #92400e; }
.answer-badge.wrong { background: #fef2f2; color: #991b1b; }
.mastery-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.mastery-badge.mastery-未掌 { background: #fef2f2; color: #991b1b; }
.mastery-badge.mastery-初步 { background: #fff7ed; color: #c2410c; }
.mastery-badge.mastery-基本 { background: #eff6ff; color: #1d4ed8; }
.mastery-badge.mastery-熟练 { background: #f0fdf4; color: #166534; }

/* ========== 筛选栏 ========== */
.filter-bar { margin-bottom: 0; }
.filter-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.filter-input {
    flex: 1;
    min-width: 180px;
    padding: 9px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.filter-input:focus { border-color: var(--primary); }
.filter-select {
    padding: 9px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    background: #fff;
    outline: none;
    cursor: pointer;
    min-width: 140px;
}
.filter-select:focus { border-color: var(--primary); }

/* ========== 生成错题工具栏 ========== */
.generate-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin: 14px 0;
}
.generate-toolbar-form {
    display: flex;
    align-items: center;
    gap: 14px;
}
.selected-hint {
    font-size: 14px;
    color: var(--text-muted);
}
.selected-hint strong {
    color: var(--primary);
    font-size: 16px;
}
.mistake-check {
    width: 17px;
    height: 17px;
    cursor: pointer;
    accent-color: var(--primary);
}
#checkAll {
    width: 17px;
    height: 17px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* ========== 分页 ========== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    padding: 20px 0 4px;
}
.page-info { font-size: 14px; color: var(--text-muted); }

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 48px 0;
    color: var(--text-muted);
    font-size: 15px;
}

/* ========== 错题生成页 ========== */
.from-list-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 18px;
    margin-bottom: 20px;
    background: #eef2ff;
    border: 1.5px solid #c7d2fe;
    border-radius: 12px;
    font-size: 14px;
    color: #3730a3;
    flex-wrap: wrap;
}
.from-list-banner strong {
    font-size: 16px;
    color: var(--primary);
}
.generate-panel { margin-bottom: 28px; }
.generate-form {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}
.generate-fields {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    flex: 1;
}
.generate-fields .form-group {
    margin-bottom: 0;
    min-width: 140px;
}
.generate-fields .form-group label {
    font-size: 13px;
    margin-bottom: 4px;
}
.form-select {
    width: 100%;
    padding: 9px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    background: #fff;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}
.form-select:focus { border-color: var(--primary); }
.form-select.small { padding: 5px 8px; font-size: 12px; border-radius: 6px; width: auto; min-width: 120px; }

.form-group-check {
    display: flex;
    align-items: flex-end;
}
.generate-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    padding: 9px 14px;
    border: 1.5px dashed var(--border);
    border-radius: 10px;
    transition: border-color 0.2s, background 0.2s;
    white-space: nowrap;
}
.generate-check:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.04);
}
.generate-check input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

.btn-generate {
    padding: 10px 28px;
    font-size: 15px;
    white-space: nowrap;
}
.generate-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.generate-buttons .btn {
    white-space: nowrap;
}
.btn-print {
    background: #1e293b;
    color: #fff;
    padding: 8px 18px;
    font-size: 14px;
}
.btn-print:hover { background: #334155; transform: translateY(-1px); }
.btn-large { padding: 14px 36px; font-size: 16px; }

/* ========== 结果区 ========== */
.result-area { margin-top: 8px; }
.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.result-title { font-size: 17px; color: var(--text-dark); }
.result-title strong { color: var(--primary); }
.result-actions { display: flex; gap: 8px; }

/* ========== 练习题单 ========== */
.worksheet {
    background: #fff;
    border-radius: 12px;
    padding: 36px 40px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-bottom: 24px;
}
.worksheet-header {
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 28px;
}
.worksheet-header h1 {
    font-size: 24px;
    color: #1e293b;
    margin-bottom: 10px;
}
.worksheet-info {
    display: flex;
    justify-content: center;
    gap: 32px;
    font-size: 14px;
    color: #64748b;
}

/* ========== 题目卡片 ========== */
.question-card {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px dashed #e2e8f0;
    page-break-inside: avoid;
}
.question-card:last-child { border-bottom: none; }
.question-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.question-num {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}
.question-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}
.subject-tag.small { font-size: 11px; padding: 1px 7px; }
.mastery-stars.small { font-size: 12px; }
.question-body {
    font-size: 15px;
    color: #1e293b;
    line-height: 1.7;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 3px solid var(--primary);
}

/* ========== 答题留白区 ========== */
.answer-area { margin: 14px 0 10px; }
.answer-lines { display: flex; flex-direction: column; gap: 10px; }
.answer-line {
    height: 1px;
    background: #e2e8f0;
    width: 100%;
}

/* ========== 批改区 ========== */
.grading-section {
    margin-top: 14px;
    padding: 14px 16px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
}
.grading-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    font-size: 13px;
}
.grading-label { font-weight: 600; color: #92400e; }
.grading-options { display: flex; gap: 14px; }
.radio-label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 3px 10px;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: all 0.15s;
}
.radio-label:has(input:checked) {
    background: #fef3c7;
    border-color: #f59e0b;
    font-weight: 600;
}
.radio-label input { accent-color: var(--primary); }

.correct-answer-hint {
    cursor: pointer;
    color: #92400e;
    font-size: 13px;
    position: relative;
}
.hint-content {
    display: none;
    margin-top: 6px;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #fde68a;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    color: #475569;
    max-width: 500px;
}
.correct-answer-hint.expanded .hint-content { display: block; }
.hint-trigger { text-decoration: underline; }
.error-type-select {
    display: flex;
    align-items: center;
    gap: 6px;
}

.submit-section {
    text-align: center;
    padding: 24px 0 8px;
}

/* ========== 打印样式 ========== */
@media print {
    body { background: #fff !important; color: #000 !important; }
    .no-print { display: none !important; }
    .topbar, .generate-panel, .result-header, .grading-section, .submit-section { display: none !important; }
    .dashboard { max-width: 100%; padding: 0; margin: 0; }
    .worksheet { box-shadow: none; border-radius: 0; padding: 20px 30px; }
    .question-body {
        background: #fff;
        border: 1px solid #ddd;
        border-left: 3px solid #333;
    }
    .answer-area { margin: 20px 0 30px; }
    .answer-line {
        height: 1px;
        background: #ccc;
    }
    .question-images { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
    .question-img {
        max-width: 100%;
        max-height: 250px;
        border-radius: 4px;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }
    @page { margin: 1.5cm; size: A4; }
}

/* ========== 图片上传 ========== */
.cell-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.upload-form {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}
.btn-upload {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #e0e7ff;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s;
}
.btn-upload:hover { background: #c7d2fe; transform: scale(1.1); }
.img-count { color: var(--text-muted); font-size: 11px; }

/* ========== 题目图片 ========== */
.question-images {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 12px 0;
}

/* 图片控制区 */
.question-img-wrapper {
    position: relative;
    display: inline-block;
}
.img-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 5px;
}
.print-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
}
.print-checkbox { accent-color: var(--primary); cursor: pointer; }
.toggle-label { user-select: none; }

.btn-img-crop {
    width: 24px; height: 24px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.btn-img-crop:hover { border-color: var(--primary); background: #eef2ff; }

/* 已裁剪状态标识 */
.question-img.img-cropped {
    border: 2px dashed var(--primary);
}

/* 打印时隐藏未选中的图片 */
@media print {
    .no-print-img { display: none !important; }
    .question-img.img-cropped { border: none; }
}

/* ========== 可点击行 ========== */
.clickable-row { cursor: pointer; }
.clickable-row:hover td { background: #eef2ff !important; }

/* ========== 详情弹窗 ========== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.modal-content {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}
.modal-header h3 { font-size: 18px; color: var(--text-dark); }
.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.btn-edit {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}
.btn-edit:hover { background: #fde68a; }
.btn-save {
    background: var(--green);
    color: #fff;
}
.btn-save:hover { background: #16a34a; }
.btn-cancel {
    background: #f1f5f9;
    color: var(--text);
}
.btn-cancel:hover { background: #e2e8f0; }

/* 编辑输入框 */
.edit-input {
    width: 100%;
    padding: 6px 10px;
    border: 1.5px solid var(--primary);
    border-radius: 6px;
    font-size: 13px;
    outline: none;
}
.edit-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1.5px solid var(--primary);
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
    resize: vertical;
    line-height: 1.6;
}
.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 16px 24px 24px; }
.modal-loading { text-align: center; padding: 48px; color: var(--text-muted); }
.modal-error { text-align: center; padding: 48px; color: var(--red); }

/* 详情网格 */
.detail-grid {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 8px 16px;
    margin-bottom: 20px;
    padding: 14px;
    background: #f8fafc;
    border-radius: 10px;
}
.detail-label { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.detail-value { font-size: 14px; color: var(--text-dark); }

/* 详情分区 */
.detail-section { margin-bottom: 18px; }
.detail-section h4 { font-size: 14px; color: var(--text-dark); margin-bottom: 8px; }
.detail-text {
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.7;
    color: #334155;
    border-left: 3px solid var(--primary);
}

/* 详情图片 */
.detail-images { display: flex; flex-wrap: wrap; gap: 8px; }
.detail-img {
    max-width: 45%;
    max-height: 280px;
    border-radius: 8px;
    border: 1px solid var(--border);
    cursor: pointer;
    object-fit: contain;
}
.detail-img:hover { transform: scale(1.02); }

/* 复习日志 */
.review-log-list { display: flex; flex-direction: column; gap: 6px; }
.review-log-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    background: #f8fafc;
    border-radius: 6px;
    font-size: 13px;
}
.log-date { color: var(--text-muted); font-size: 12px; min-width: 120px; }
.log-result { font-weight: 700; }
.log-correct { color: #166534; }
.log-wrong { color: #991b1b; }

/* ========== 图片放大查看器 ========== */
.image-viewer-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.88);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 60px 20px 20px;
    cursor: default;
}
.viewer-toolbar {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(30,41,59,0.9);
    padding: 8px 16px;
    border-radius: 10px;
    z-index: 2001;
    backdrop-filter: blur(8px);
}
.viewer-btn {
    padding: 6px 14px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.viewer-btn:hover { background: rgba(255,255,255,0.25); }
.viewer-btn-confirm {
    background: var(--green);
    color: #fff;
    border-color: var(--green);
    font-weight: 700;
}
.viewer-btn-confirm:hover { background: #16a34a; }
.viewer-sep {
    width: 1px;
    height: 20px;
    background: rgba(255,255,255,0.2);
    margin: 0 4px;
}
.viewer-zoom-info {
    color: #fff;
    font-size: 12px;
    min-width: 40px;
    text-align: center;
    font-weight: 600;
}
.viewer-close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.7;
}
.viewer-close-btn:hover { opacity: 1; }
.viewer-hint {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    background: rgba(0,0,0,0.6);
    padding: 8px 20px;
    border-radius: 20px;
}

#viewerImageContainer {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 90vw;
    max-height: 80vh;
}
#viewerImage {
    max-width: 90vw;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    object-fit: contain;
    transition: transform 0.15s ease;
}
#cropCanvas {
    border-radius: 8px;
}
.viewer-close {
    position: absolute;
    top: 20px;
    right: 30px;
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: none;
    font-size: 36px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 2001;
}
.viewer-close:hover { background: rgba(255,255,255,0.35); }

/* ========== 同步结果 ========== */
.sync-result-block {
    margin-top: 24px;
    padding: 24px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.sync-result-block h3 { font-size: 17px; margin-bottom: 12px; }
.sync-log {
    max-height: 300px;
    overflow-y: auto;
    background: #f8fafc;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    font-family: "SF Mono", "Consolas", monospace;
    margin: 8px 0 12px;
    border: 1px solid var(--border);
}
.sync-log-item {
    padding: 3px 0;
    border-bottom: 1px solid #f1f5f9;
}
.sync-log-item:last-child { border-bottom: none; }
.sync-log-ok { color: #166534; }
.sync-log-error { color: #991b1b; }
.sync-summary {
    font-size: 14px;
    color: var(--text);
    margin-top: 4px;
}

/* ========== 缺失明细展开 ========== */
.row-expanded td { background: #eef2ff !important; }
.missing-detail-list {
    padding: 8px 14px 14px;
    background: #fafafa;
}
.sub-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.sub-table th {
    padding: 6px 10px;
    background: #f1f5f9;
    font-size: 11px;
}
.sub-table td {
    padding: 5px 10px;
    border-bottom: 1px solid #f1f5f9;
}
.sub-table .clickable-row:hover td { background: #eef2ff; }

/* 缺失字段高亮 */
.detail-text.field-empty {
    border-left-color: #ef4444;
    background: #fef2f2;
}

/* ========== AI 助手 ========== */
.ai-container {
    display: flex;
    gap: 24px;
    height: calc(100vh - 150px);
    overflow: hidden;
}
.ai-sidebar {
    width: 260px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}
.ai-sidebar-section {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.ai-sidebar-section h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* 快捷指令按钮 */
.quick-actions { display: flex; flex-direction: column; gap: 6px; }
.quick-action-btn {
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s;
}
.quick-action-btn:hover {
    border-color: var(--primary);
    background: #eef2ff;
    color: var(--primary);
}

/* 上下文状态 */
.context-status { margin-bottom: 10px; }
.context-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    background: #f1f5f9;
    color: var(--text-muted);
}
.context-badge.loaded {
    background: #dcfce7;
    color: #166534;
}
.context-hint { color: var(--text-muted); font-size: 12px; margin-left: 6px; }
.context-summary {
    margin-top: 12px;
    padding: 10px;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 12px;
    color: var(--text);
    line-height: 1.6;
}
.btn-block { display: block; width: 100%; text-align: center; }

/* 聊天主区域 */
.ai-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    overflow: hidden;
}
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
}
.chat-header h2 { font-size: 17px; color: var(--text-dark); }
.chat-model-badge {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 12px;
    background: #eef2ff;
    color: var(--primary);
    font-weight: 600;
}

/* 消息区域 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #fafbfc;
}
.chat-message { display: flex; gap: 10px; max-width: 90%; }
.chat-message.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-message.assistant { align-self: flex-start; }
.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    background: #f1f5f9;
}
.chat-message.user .chat-avatar { background: #e0e7ff; }
.chat-bubble {
    padding: 12px 18px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-dark);
}
.chat-message.assistant .chat-bubble {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 4px 16px 16px 16px;
}
.chat-message.user .chat-bubble {
    background: var(--primary);
    color: #fff;
    border-radius: 16px 4px 16px 16px;
}
.chat-message.error .chat-bubble {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}
.chat-bubble p { margin: 0 0 8px; }
.chat-bubble p:last-child { margin-bottom: 0; }
.chat-bubble ul { margin: 4px 0; padding-left: 20px; }
.chat-bubble li { margin-bottom: 4px; font-size: 13px; }
.chat-bubble h2, .chat-bubble h3, .chat-bubble h4 {
    margin: 12px 0 6px;
    color: var(--text-dark);
}
.chat-bubble code {
    background: #f1f5f9;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 13px;
    color: #e11d48;
}
.chat-model-info {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid #f1f5f9;
}

/* 代码块容器 */
.code-block-wrapper {
    margin: 10px 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    background: #1e293b;
}
.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 14px;
    background: #334155;
    font-size: 11px;
}
.code-lang {
    color: #94a3b8;
    text-transform: uppercase;
    font-weight: 600;
}
.download-html-btn {
    background: #3b82f6;
    color: #fff;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.2s;
}
.download-html-btn:hover {
    background: #2563eb;
}
.chat-bubble pre {
    margin: 0;
    padding: 14px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.6;
    background: #1e293b;
    color: #e2e8f0;
}
.chat-bubble pre code {
    background: transparent;
    color: #e2e8f0;
    padding: 0;
    font-size: 13px;
}

/* 打字动画 */
.typing-dots span {
    display: inline-block;
    animation: typingDot 1.4s infinite;
    font-size: 24px;
    line-height: 1;
    color: var(--text-muted);
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDot {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-4px); }
}

/* 输入区域 */
.chat-input-area {
    display: flex;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: #fff;
}
.chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
}
.chat-input:focus { border-color: var(--primary); }
.send-btn {
    align-self: flex-end;
    padding: 10px 24px;
    border-radius: 12px;
    white-space: nowrap;
}
.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== 图片上传 & 识别结果 ========== */
.image-upload-btn {
    align-self: flex-end;
    width: 42px;
    height: 42px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}
.image-upload-btn:hover {
    border-color: var(--primary);
    background: #eef2ff;
}

/* 图片预览区域 */
.image-preview-area {
    padding: 12px 24px;
    border-top: 1px solid var(--border);
    background: #fafbfc;
}
.image-preview-inner {
    position: relative;
    display: inline-block;
    max-width: 320px;
}
.image-preview-inner img {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.image-preview-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: #fff;
    color: #666;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.image-preview-remove:hover { background: #fef2f2; color: #dc2626; }
.image-preview-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}
.image-status { font-size: 12px; color: var(--text-muted); }

/* 识别结果卡片 */
.recognize-result { padding: 0 24px 16px; }
.recognize-card {
    background: #fff;
    border-radius: 12px;
    border: 1.5px solid #e0e7ff;
    overflow: hidden;
}
.recognize-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #eef2ff;
    font-weight: 700;
    font-size: 14px;
    color: var(--primary);
}
.recognize-card-body { padding: 6px 16px; }
.recognize-field {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
}
.recognize-field:last-child { border-bottom: none; }
.recognize-field.full-width { flex-direction: column; }
.recognize-label {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 80px;
}
.recognize-value {
    font-size: 13px;
    color: var(--text-dark);
    flex: 1;
    line-height: 1.5;
}
.recognize-value[contenteditable="true"] {
    background: #fffbeb;
    border: 1px dashed #fbbf24;
    border-radius: 4px;
    padding: 2px 6px;
    outline: none;
}
.recognize-card-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid #f1f5f9;
}
.saved-badge {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 10px;
    background: #dcfce7;
    color: #166534;
    font-weight: 600;
}

/* 图片快捷按钮 */
.quick-action-btn.image-quick-btn {
    border-color: #e0e7ff;
    background: #eef2ff;
    color: var(--primary);
    font-weight: 600;
}
.quick-action-btn.image-quick-btn:hover {
    background: #dde4ff;
    border-color: var(--primary);
}

/* ========== 响应式 ========== */
/* 手机/小屏：顶栏导航改为横向滑动，整体紧凑 */
@media (max-width: 768px) {
    .topbar { padding: 0 12px; }
    .topbar-inner { flex-wrap: wrap; height: auto; padding: 8px 0; gap: 8px; }
    .topbar-brand { font-size: 16px; }
    .topbar-nav {
        order: 3;
        width: 100%;
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 2px;
    }
    .topbar-nav::-webkit-scrollbar { display: none; }
    .nav-link { padding: 6px 11px; font-size: 13px; white-space: nowrap; flex-shrink: 0; }
    .topbar-user { font-size: 13px; }
    .topbar-right { gap: 10px; }
}

@media (max-width: 640px) {
    .login-card { padding: 32px 24px; }
    .dashboard { padding: 20px 12px; }
    .dashboard-header { margin-bottom: 20px; }
    .dashboard-header h2 { font-size: 22px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .filter-form { flex-direction: column; }
    .filter-input, .filter-select { width: 100%; }
    .ai-container { flex-direction: column; height: auto; overflow: visible; }
    .ai-sidebar { width: 100%; }
}

/* ========== 英语背诵 ========== */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    margin-bottom: 20px;
    overflow: hidden;
}
.card-body { padding: 24px; }

.vocab-generate {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.vocab-label { font-size: 15px; font-weight: 600; color: var(--text-dark); }
.vocab-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-dark);
    cursor: pointer;
    user-select: none;
}
.vocab-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}
.vocab-quiz-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.vocab-toolbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.vocab-toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.vocab-tip { color: var(--text-muted); font-size: 13px; margin-top: 12px; }

.vocab-question {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}
.vocab-question:last-child { border-bottom: none; }
.vocab-q-number {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #eef2ff;
    color: var(--primary);
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.vocab-q-meaning { flex: 1; min-width: 0; }
.vocab-cn { font-size: 16px; color: var(--text-dark); line-height: 1.5; }
.vocab-phonetic { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.vocab-input {
    flex: 0 0 220px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    color: var(--text-dark);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.vocab-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.vocab-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.vocab-result-title { font-size: 17px; color: var(--text-dark); margin-bottom: 16px; }
.vocab-score {
    text-align: center;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    margin-bottom: 20px;
}
.vocab-score-main {
    font-size: 42px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.vocab-score-sub { font-size: 14px; color: var(--text-muted); margin-top: 6px; }

.vocab-result-row {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.vocab-result-row:last-child { border-bottom: none; }
.vocab-result-body { flex: 1; min-width: 0; }
.vocab-result-cn { font-size: 15px; color: var(--text-dark); }
.vocab-result-word { font-size: 14px; margin-top: 4px; }
.vocab-result-word strong { color: #16a34a; }
.vocab-result-your { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.vocab-result-tag {
    display: inline-block;
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
}
.vocab-tag-correct { background: #dcfce7; color: #166534; }
.vocab-tag-wrong { background: #fee2e2; color: #b91c1c; }
.vocab-tag-blank { background: #f1f5f9; color: #64748b; }
.vocab-result-wrong .vocab-result-word strong { color: #b91c1c; }

/* ========== 打印背诵单 ========== */
#vocab-print-area { display: none; }

@media print {
    /* 打印时只显示背诵单，隐藏其他所有页面内容。
       关键点：不能把打印区的祖先元素也 display:none，
       否则子级不会被渲染（之前的版本就是这个 bug）。
       改为：隐藏所有内容容器（header/section/footer 等），
       但让 <main> 自身保持可见，仅把 main 内的内容区隐藏。
       注意：所有规则用 body.vocab-page 前缀限定，只作用于单词背诵页，
       避免污染其他页面（如错题生成的打印练习题）。 */
    body.vocab-page {
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        color: #000 !important;
    }
    /* 隐藏所有顶层非 main 元素 */
    body.vocab-page > *:not(main) {
        display: none !important;
    }
    /* 隐藏 main 内除打印区外的所有内容区 */
    body.vocab-page main > *:not(#vocab-print-area) {
        display: none !important;
    }
    /* 释放 main 自身的占位与边距 */
    body.vocab-page main {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    body.vocab-page #vocab-print-area {
        display: block !important;
        width: 100%;
        padding: 0;
        margin: 0;
    }
    /* 压缩打印区，让 20 个词条尽量塞进一页 A4 */
    @page {
        size: A4;
        margin: 1cm;
    }
    body.vocab-page #vocab-print-area .vocab-print-header {
        margin-bottom: 6px;
        padding-bottom: 6px;
        border-bottom-width: 1px;
    }
    body.vocab-page #vocab-print-area .vocab-print-title {
        font-size: 17px;
    }
    body.vocab-page #vocab-print-area .vocab-print-count {
        font-size: 11px;
        margin-top: 2px;
    }
    body.vocab-page #vocab-print-area .vocab-print-row {
        gap: 8px;
        padding: 3px 2px;
        line-height: 1.2;
        page-break-inside: avoid;
    }
    body.vocab-page #vocab-print-area .vocab-print-num {
        width: 22px;
        font-size: 12px;
    }
    body.vocab-page #vocab-print-area .vocab-print-cn {
        font-size: 13px;
    }
    body.vocab-page #vocab-print-area .vocab-print-phonetic {
        flex-basis: 130px;
        font-size: 12px;
    }
    body.vocab-page #vocab-print-area .vocab-print-word {
        flex-basis: 140px;
        font-size: 14px;
    }
}

.vocab-print-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #333;
}
.vocab-print-title {
    font-size: 22px;
    font-weight: 800;
    color: #000;
}
.vocab-print-count {
    font-size: 13px;
    color: #555;
    margin-top: 4px;
}
.vocab-print-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 4px;
    border-bottom: 1px dashed #ccc;
    page-break-inside: avoid;
}
.vocab-print-num {
    flex-shrink: 0;
    width: 28px;
    font-size: 13px;
    color: #555;
    text-align: center;
}
.vocab-print-cn {
    flex: 1;
    font-size: 14px;
    color: #000;
}
.vocab-print-phonetic {
    flex: 0 0 160px;
    font-size: 13px;
    color: #666;
}
.vocab-print-word {
    flex: 0 0 180px;
    font-size: 15px;
    font-weight: 700;
    color: #000;
}

/* ========== 展示背诵单（屏幕电子版） ========== */
.vocab-sheet-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
/* 展示区复用打印区的行结构，但屏幕版更舒展 */
#vocab-sheet-area .vocab-print-row {
    gap: 16px;
    padding: 12px 8px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
#vocab-sheet-area .vocab-print-row:hover {
    background: #f8fafc;
}
#vocab-sheet-area .vocab-print-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
}
#vocab-sheet-area .vocab-print-title {
    font-size: 20px;
}
#vocab-sheet-area .vocab-print-word {
    flex: 0 0 200px;
    font-size: 17px;
}
#vocab-sheet-area .vocab-print-phonetic {
    flex: 0 0 200px;
    font-size: 14px;
    color: #666;
}
#vocab-sheet-area .vocab-print-cn {
    font-size: 15px;
}

@media (max-width: 768px) {
    .vocab-question { flex-wrap: wrap; }
    .vocab-input { flex: 1 1 100%; }
}

/* ========== 英语单词统计版块（汇总报告页） ========== */
.vocab-stats-section { margin-top: 20px; }
.vocab-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.vocab-stat-card {
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}
.vocab-stat-value {
    font-size: 30px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
}
.vocab-stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
}
.vocab-stats-sub {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.vocab-sub-tag {
    font-size: 13px;
    padding: 4px 12px;
    border-radius: 14px;
    font-weight: 600;
}
.vocab-sub-correct { background: #dcfce7; color: #166534; }
.vocab-sub-wrong { background: #fee2e2; color: #b91c1c; }
.vocab-sub-blank { background: #f1f5f9; color: #64748b; }

@media (max-width: 768px) {
    .vocab-stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ========== 知识背诵统计（科目进度） ========== */
.knowledge-subject-list {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.knowledge-subject-item {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}
.knowledge-subject-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.knowledge-subject-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
}
.knowledge-subject-rate {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
}
.knowledge-progress-bar {
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
}
.knowledge-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 4px;
    transition: width 0.3s;
}
.knowledge-subject-meta {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

/* 复习阶段分布 */
.knowledge-stage-dist,
.knowledge-wrong-top {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px dashed var(--border);
}
.knowledge-stage-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 12px;
}
.knowledge-stage-bars {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    height: 80px;
}
.knowledge-stage-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    height: 100%;
    justify-content: flex-end;
}
.knowledge-stage-bar {
    width: 100%;
    max-width: 40px;
    height: 50px;
    background: #f1f5f9;
    border-radius: 4px;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}
.knowledge-stage-fill {
    width: 100%;
    background: linear-gradient(180deg, #8b5cf6 0%, #6366f1 100%);
    border-radius: 4px;
    min-height: 2px;
}
.knowledge-stage-label {
    font-size: 11px;
    color: var(--text-muted);
}
.knowledge-stage-count {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dark);
}

/* 高频错误知识点 */
.knowledge-wrong-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
}
.knowledge-wrong-item:last-child {
    border-bottom: none;
}
.knowledge-wrong-badge {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 6px;
    background: #fee2e2;
    color: #dc2626;
    font-size: 12px;
    font-weight: 700;
}
.knowledge-wrong-question {
    flex: 1;
    font-size: 13px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.knowledge-wrong-subject {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--text-muted);
}

/* ========== 单词表展示页 ========== */
.vocab-table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}
.vocab-table-info {
    font-size: 14px;
    color: var(--text-muted);
}
.vocab-table-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.control-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text);
}
.select-control {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text);
    background: #fff;
    cursor: pointer;
    outline: none;
}
.select-control:focus {
    border-color: var(--primary);
}
.vocab-table-pager,
.vocab-table-pager-bottom {
    display: flex;
    align-items: center;
    gap: 12px;
}
.vocab-table-pager-bottom {
    margin-top: 16px;
    justify-content: center;
}
.page-indicator {
    font-size: 14px;
    color: var(--text);
    min-width: 90px;
    text-align: center;
}
.table-wrap {
    overflow-x: auto;
}
.vocab-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.vocab-table thead th {
    text-align: left;
    padding: 10px 12px;
    background: #f8fafc;
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
}
.vocab-table tbody td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: top;
}
.vocab-table tbody tr:hover {
    background: #f8fafc;
}
.vocab-table .col-num {
    width: 48px;
    color: #94a3b8;
    text-align: center;
    white-space: nowrap;
}
.vocab-table .col-word {
    width: 140px;
    font-weight: 700;
    color: var(--text-dark);
    white-space: nowrap;
}
.vocab-table .col-phonetic {
    width: 160px;
    color: #64748b;
    white-space: nowrap;
}
.vocab-table .col-meaning {
    min-width: 200px;
    line-height: 1.6;
}
.vocab-table .col-stat {
    width: 70px;
    text-align: center;
    font-weight: 600;
    white-space: nowrap;
}
.vocab-table .col-stat.correct { color: #16a34a; }
.vocab-table .col-stat.wrong { color: #dc2626; }
.vocab-table .col-stat.blank { color: #94a3b8; }
.vocab-table .empty-cell {
    text-align: center;
    color: #94a3b8;
    padding: 32px 12px;
}

/* ========== 错题复习/做错次数徽章 ========== */
.review-count {
    display: inline-block;
    margin-right: 4px;
    padding: 2px 8px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #475569;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.wrong-count-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    background: #fee2e2;
    color: #dc2626;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.wrong-count-zero {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    background: #f0fdf4;
    color: #16a34a;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

/* ========== 学习档案占位页 ========== */
.archive-placeholder {
    text-align: center;
    padding: 80px 20px;
}
.archive-placeholder .archive-icon {
    font-size: 64px;
    line-height: 1;
    margin-bottom: 20px;
}
.archive-placeholder h3 {
    font-size: 24px;
    color: var(--text-dark);
    margin-bottom: 12px;
}
.archive-placeholder p {
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.archive-placeholder .archive-sub {
    font-size: 13px;
    color: #94a3b8;
}

/* ========== 学科知识背诵页 ========== */
.vocab-generate-row {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}
.btn-danger {
    background: #dc2626;
    color: #fff;
}
.btn-danger:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}
.btn-success {
    background: #16a34a;
    color: #fff;
}
.btn-success:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.4);
}

.knowledge-quiz-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px 24px;
    margin: 16px 0;
    background: #fafbfc;
}
.knowledge-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
}
.knowledge-question {
    font-size: 18px;
    line-height: 1.8;
    color: var(--text-dark);
    font-weight: 500;
}
.knowledge-answer {
    margin-top: 18px;
    padding: 14px 16px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.7;
    color: #166534;
}
.knowledge-answer .answer-label {
    font-size: 13px;
    font-weight: 700;
    color: #16a34a;
    margin-bottom: 6px;
}
.knowledge-hint {
    margin-top: 12px;
    padding: 12px 16px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    color: #92400e;
}
.knowledge-hint .hint-label {
    font-size: 13px;
    font-weight: 700;
    color: #d97706;
    margin-bottom: 6px;
}
.knowledge-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 20px;
}
.quiz-progress {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 600;
}
.result-title {
    text-align: center;
    font-size: 20px;
    margin-bottom: 16px;
}
.fill-input-wrap {
    margin-top: 16px;
}
.fill-input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    color: var(--text-dark);
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.fill-input:focus {
    border-color: var(--primary);
}
.fill-result {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.6;
}
.fill-correct {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}
.fill-wrong {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}
.fill-std-answer {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(0,0,0,0.1);
    font-size: 14px;
}
.fill-reason {
    margin-top: 4px;
    font-size: 13px;
    color: #b45309;
}

/* ========== 手工登记 ========== */
.manual-list {
    margin-top: 12px;
}
.manual-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    background: #fff;
}
.manual-num {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
}
.manual-body {
    flex: 1;
    min-width: 0;
}
.manual-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.manual-question {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-dark);
    margin-bottom: 4px;
}
.manual-answer {
    font-size: 13px;
    color: #16a34a;
    line-height: 1.5;
}
.manual-actions {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
    align-items: center;
}
.manual-btn {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    opacity: 0.65;
    transition: opacity 0.15s, box-shadow 0.15s;
}
.manual-btn:hover { opacity: 1; }
.manual-btn.selected {
    opacity: 1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.5);
}

/* ========== 单词备考（艾宾浩斯背词队列） ========== */
.vocab-plan-streak {
    font-size: 15px;
    font-weight: 700;
    color: #ea580c;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    padding: 6px 14px;
    border-radius: 20px;
    white-space: nowrap;
}
.vocab-plan-stats {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
    margin-bottom: 16px;
}
.vocab-plan-stat {
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 12px;
    text-align: center;
}
.vp-num {
    font-size: 30px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
}
.vp-num.vp-green { color: #16a34a; }
.vp-num.vp-blue { color: #2563eb; }
.vp-num.vp-orange { color: #ea580c; }
.vp-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
}
.vocab-plan-settings {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.vp-input {
    width: 110px;
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-dark);
    background: #fff;
    outline: none;
}
..vp-input:focus { border-color: var(--primary); }
/* 日期输入框加宽，避免「考试日期」显示不全 */
.vp-input[type="date"] { width: 160px; }
.vocab-plan-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.vocab-plan-actions .vocab-tip { margin-top: 0; }
.btn-large {
    padding: 12px 32px;
    font-size: 17px;
}
.vp-badge {
    display: inline-block;
    min-width: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}
.vocab-plan-progress { margin-bottom: 20px; }
.vp-progress-text {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.vp-progress-bar {
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
}
.vp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 4px;
    transition: width 0.3s;
}
.vocab-plan-card {
    max-width: 560px;
    margin: 0 auto;
    min-height: 260px;
    border-radius: 18px;
    background: linear-gradient(145deg, #ffffff 0%, #eef2ff 100%);
    border: 1.5px solid var(--border);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.12);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    text-align: center;
    user-select: none;
    transition: transform 0.2s, box-shadow 0.2s;
}
.vocab-plan-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(99, 102, 241, 0.2);
}
.vp-card-face { width: 100%; }
.vp-word {
    font-size: 44px;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.2;
}
.vp-phonetic {
    font-size: 18px;
    color: var(--text-muted);
    margin-top: 10px;
}
.vp-hint {
    font-size: 13px;
    color: #94a3b8;
    margin-top: 26px;
}
.vp-word-sm {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 14px;
}
.vp-definition {
    font-size: 20px;
    line-height: 1.7;
    color: var(--text-dark);
}
.vocab-plan-btns {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 22px;
    flex-wrap: wrap;
}
.btn-rate {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.btn-rate:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}
.btn-rate:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-rate-known { background: #16a34a; }
.btn-rate-fuzzy { background: #f59e0b; }
.btn-rate-unknown { background: #dc2626; }
.vocab-plan-done { text-align: center; padding: 20px 0; }
.vp-done-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 12px;
}
.vp-done-sub {
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.vocab-plan-notebook { display: flex; flex-direction: column; gap: 10px; }
.vocab-plan-nb-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}
.vp-nb-main { flex: 1; min-width: 0; }
.vp-nb-word {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-dark);
}
.vp-nb-phonetic {
    font-size: 13px;
    color: var(--text-muted);
    margin-left: 8px;
    font-weight: 400;
}
.vp-nb-def {
    font-size: 14px;
    color: var(--text);
    margin-top: 4px;
}
.vp-nb-actions {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
}

@media (max-width: 768px) {
    .vocab-plan-stats { grid-template-columns: repeat(3, 1fr); }
    .vp-word { font-size: 34px; }
    .vp-definition { font-size: 17px; }
}
@media (max-width: 480px) {
    .vocab-plan-stats { grid-template-columns: repeat(2, 1fr); }
    .vp-num { font-size: 24px; }
}

/* ========== 单词备考 Tab 栏 ========== */
.vocab-plan-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.vp-tab {
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-muted);
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
}
.vp-tab:hover { border-color: var(--primary); color: var(--primary); }
.vp-tab.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    border-color: var(--primary);
}

/* ========== 单词自测（练习 Tab） ========== */
.quiz-progress {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 16px;
    text-align: right;
}
.quiz-question-box { min-height: 180px; }
.quiz-type-tag {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: 12px;
    background: #eef2ff;
    color: var(--primary);
    margin-bottom: 16px;
}
.quiz-word {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.3;
    margin-bottom: 8px;
}
.quiz-cn {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.4;
    margin-bottom: 8px;
}
.quiz-phonetic {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.quiz-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 20px;
}
.quiz-option {
    padding: 14px 16px;
    font-size: 16px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: #fff;
    color: var(--text-dark);
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
}
.quiz-option:hover { border-color: var(--primary); background: #f8faff; }
.quiz-option.correct {
    border-color: #16a34a;
    background: #f0fdf4;
    color: #166534;
    font-weight: 700;
}
.quiz-option.wrong {
    border-color: #dc2626;
    background: #fef2f2;
    color: #991b1b;
}
.quiz-option:disabled { cursor: default; }
.quiz-spell-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 20px;
    flex-wrap: wrap;
}
.quiz-spell-row .fill-input { flex: 1; min-width: 200px; }
.quiz-feedback {
    margin-top: 20px;
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
}
.quiz-feedback.correct {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}
.quiz-feedback.wrong {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* 自测错题报告 */
.quiz-report {
    margin-top: 20px;
    text-align: left;
}
.quiz-report-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
    text-align: center;
    margin-bottom: 16px;
}
.quiz-report-all {
    text-align: center;
    font-size: 15px;
    color: #16a34a;
    font-weight: 600;
    padding: 8px 0;
}
.quiz-report-item {
    border: 1px solid #f3d4d4;
    border-left: 4px solid #dc2626;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 14px;
    background: #fffafa;
}
.quiz-report-word {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
}
.quiz-report-phonetic {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 400;
}
.quiz-report-cn {
    font-size: 14px;
    color: var(--text-muted);
    margin: 6px 0 10px;
}
.quiz-report-line {
    font-size: 14px;
    margin-top: 3px;
}
.quiz-report-ok {
    color: #16a34a;
    font-weight: 700;
}
.quiz-report-bad {
    color: #b91c1c;
    font-weight: 600;
}

/* 学习档案：自测逐题明细 */
.quiz-detail {
    padding: 6px 0;
    text-align: left;
}
.quiz-detail-item {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    align-items: center;
    padding: 10px 14px;
    margin-bottom: 8px;
    border-radius: 8px;
    font-size: 14px;
}
.quiz-detail-item.qdi-correct {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}
.quiz-detail-item.qdi-wrong {
    background: #fef2f2;
    border: 1px solid #fecaca;
}
.qdi-word {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 16px;
}
.qdi-phonetic {
    color: var(--text-muted);
    font-size: 13px;
}
.qdi-cn {
    color: var(--text-muted);
}
.qdi-result {
    font-weight: 600;
}
.qdi-correct .qdi-result { color: #16a34a; }
.qdi-wrong .qdi-result { color: #b91c1c; }
.qdi-line {
    width: 100%;
    color: var(--text-muted);
}
.qdi-line.qdi-std {
    color: #16a34a;
}
.quiz-detail-empty {
    color: var(--text-muted);
    font-size: 13px;
    padding: 10px 0;
    text-align: center;
}

/* 近 14 天走势图 */
.quiz-trend {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 160px;
    padding: 10px 0;
}
.quiz-trend-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    gap: 6px;
}
.quiz-trend-bar {
    width: 70%;
    max-width: 28px;
    background: linear-gradient(180deg, #8b5cf6 0%, #6366f1 100%);
    border-radius: 4px 4px 0 0;
    min-height: 3px;
    transition: height 0.3s;
}
.quiz-trend-bar.empty { background: #e2e8f0; }
.quiz-trend-label {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
}

@media (max-width: 768px) {
    .quiz-options { grid-template-columns: 1fr; }
    .quiz-word { font-size: 26px; }
    .quiz-cn { font-size: 19px; }
}

/* ========== 打印错题薄预览 ========== */
.mb-question {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 10px;
}
.mb-q-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 6px;
    margin-bottom: 8px;
    border-bottom: 1px solid #e5e5e5;
}
.mb-q-index {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    border-radius: 50%;
    background: #6366f1;
    color: #fff;
    font-weight: 700;
    font-size: 12px;
}
.mb-q-meta { font-size: 12px; color: #555; }
.mb-field { display: flex; margin: 4px 0; font-size: 13px; line-height: 1.5; }
.mb-label { flex-shrink: 0; width: 72px; color: #888; font-size: 12px; }
.mb-value { flex: 1; white-space: pre-wrap; word-break: break-word; }
.mb-images { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.book-img {
    max-width: 220px;
    max-height: 180px;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
}
.book-img:hover { border-color: #6366f1; }

/* 打印错题薄时只显示预览内容（body.printing-book 限定，避免污染其他页面打印） */
@media print {
    body.printing-book > *:not(#printModal) {
        display: none !important;
    }
    body.printing-book #printModal {
        display: flex !important;
        position: static;
        background: #fff;
        padding: 0;
        margin: 0;
    }
    body.printing-book #printModal .modal-content {
        box-shadow: none;
        border: none;
        border-radius: 0;
        max-width: 100%;
        max-height: none;
        margin: 0;
        overflow: visible;
    }
    body.printing-book #printModal .modal-body {
        overflow: visible;
    }
    body.printing-book #printModal .no-print {
        display: none !important;
    }
    body.printing-book .mb-question {
        page-break-inside: avoid;
        break-inside: avoid;
        page-break-after: always;
        break-after: page;
        border-color: #ccc;
    }
    body.printing-book .mb-question:last-child {
        page-break-after: auto;
        break-after: auto;
    }
}


