/* ========== 共享打印样式（组卷预览 & 错题本打印） ========== */
@page {
    size: A4 portrait;
    margin: 2cm 2cm;
    @bottom-center {
        content: "第 " counter(page) " 页 共 " counter(pages) " 页";
        font-size: 10pt;
        color: #333;
        font-family: "宋体", serif;
    }
}

@media print {
    body { margin: 0; padding: 0; font-family: "宋体", "Times New Roman", serif; font-size: 10.5pt; line-height: 1.5; color: #000 !important; }
    .no-print { display: none !important; }
    .paper { box-shadow: none !important; margin: 0 !important; max-width: none !important; padding: 0 !important; width: auto !important; min-height: auto !important; }
    .question { page-break-inside: auto; }
    .section-title { page-break-after: avoid; }
    .question-content, .question-num, .option, .paper-info, .paper-title { color: #000 !important; }
    .paper-header-line, .section-title, .answer-line, .answer-student, .answer-correct,
    .answer-toggle, .log-toggle, .explain-toggle, .answer-explain { color: #000 !important; }
    .analysis-line, .footer-line, .stats-box { color: #000 !important; }
    table td, table th { color: #000 !important; }
}

* { box-sizing: border-box; }

body {
    font-family: "宋体", "Times New Roman", serif;
    background: #e8e8e8;
    color: #303133;
    padding: 20px;
    font-size: 10.5pt;
    line-height: 1.5;
}

/* ========== 工具栏 ========== */
.toolbar {
    max-width: 960px;
    margin: 0 auto 20px;
    background: #fff;
    padding: 12px 20px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.toolbar button {
    padding: 6px 18px;
    border: 1px solid #dcdfe6;
    background: #fff;
    cursor: pointer;
    border-radius: 3px;
    font-size: 13px;
    color: #606266;
}
.toolbar button:hover { color: #409eff; border-color: #409eff; }
.toolbar button.primary {
    background: #409eff;
    color: #fff;
    border-color: #409eff;
}
.toolbar button.primary:hover { background: #66b1ff; border-color: #66b1ff; }
.toolbar .spacer { margin-left: auto; }
.toolbar label { color: #606266; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; }
.toolbar input[type="checkbox"] { margin-right: 4px; cursor: pointer; }

/* ========== 试卷容器 ========== */
.paper {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto 20px;
    background: #fff;
    padding: 50px 60px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.paper-title {
    text-align: center;
    font-size: 28px;
    font-weight: bold;
    font-family: "黑体", sans-serif;
    margin-bottom: 10px;
    letter-spacing: 6px;
}
.paper-info {
    text-align: center;
    font-size: 10.5pt;
    color: #606266;
    padding-bottom: 15px;
    border-bottom: 2px solid #333;
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}
.section-title {
    font-size: 13pt;
    font-weight: bold;
    font-family: "黑体", sans-serif;
    margin: 18px 0 12px;
    padding: 2px 2px;
    background: #ffffffef;
    border-left: 4px solid #409eff;
}

/* ========== 试题 ========== */
.question {
    margin-bottom: 8px;
    padding: 4px 0;
}
.question:last-child { border-bottom: none; }
.question-num { font-weight: bold; color: #409eff; }
.question-content { color: #303133; line-height: 1.8; font-size: 10.5pt; padding-left: 2em; text-indent: -2em; }
.question-content p, .question-content div { line-height: 1.8; }

/* ========== 选项 ========== */
.options {
    margin-top: 8px;
    padding-left: 2em;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px 8px;
}
.options[data-cols="2"] { grid-template-columns: repeat(2, 1fr); }
.options[data-cols="1"] { grid-template-columns: 1fr; }
.option { padding: 3px 0 3px 1.5em; line-height: 1.5; color: #606266; font-size: 10.5pt; }
.option-letter { display: inline-block; width: 1.5em; margin-left: -1.5em; white-space: nowrap; vertical-align: middle; }

/* ========== 答案 / 解析 ========== */
.answer-line, .analysis-line {
    margin-top: 8px;
    padding: 8px 14px;
    border-radius: 3px;
    font-size: 10.5pt;
    line-height: 1.5;
    display: none;
}
.answer-line { color: #67c23a; }
.analysis-line { background: #ecf5ff; color: #409eff; }
.answer-line.show, .analysis-line.show { display: block; }
.answer-line .label, .analysis-line .label { font-weight: bold; }

.answer-student { color: #e74c3c; }
.answer-correct { color: #27ae60; }

/* ========== 表格 ========== */
table {
    border-collapse: collapse;
    margin: 8px 0;
    max-width: 100%;
}
table td, table th {
    border: 1px solid #b3b8bf;
    padding: 6px 10px;
    vertical-align: middle;
    word-break: break-word;
    word-wrap: break-word;
    white-space: normal;
    font-size: 13px;
}
table th {
    background-color: #f5f7fa;
    font-weight: 600;
    text-align: center;
}

/* ========== 通用内联元素 ========== */
p { margin: 0; line-height: 1.5; }
div { line-height: 1.5; }
img { max-width: 100%; height: auto; display: inline-block; vertical-align: middle; margin: 4px 2px; }
sup { font-size: 0.7em; vertical-align: super; }
sub { font-size: 0.7em; vertical-align: sub; }

/* ========== 富文本元素 ========== */
ul, ol { padding-left: 24px; margin: 4px 0; }
li { margin: 2px 0; line-height: 1.7; }
hr { border: none; border-top: 1px solid #e4e7ed; margin: 10px 0; }
pre {
    background: #f5f7fa;
    border: 1px solid #dcdfe6;
    padding: 10px;
    margin: 8px 0;
    font-family: Consolas, monospace;
    font-size: 13px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}
blockquote {
    border-left: 3px solid #409eff;
    padding: 4px 12px;
    margin: 8px 0;
    background: #ecf5ff;
    color: #5e6d82;
}

/* ========== 页脚 ========== */
.footer-line {
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px dashed #ccc;
    text-align: center;
    color: #909399;
    font-size: 12px;
}

/* ========== 统计 ========== */
.stats-box {
    margin: 10px 0 20px;
    padding: 12px;
    background: #f5f7fa;
    border: 1px solid #e4e7ed;
    border-radius: 4px;
    font-size: 13px;
    color: #606266;
}
.stats-box b { color: #409eff; }

/* ========== 弹窗 ========== */
.modal-overlay { display:none; position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0.4); z-index:1000; }
.modal-box { position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); background:#fff; border-radius:6px; padding:28px 32px; min-width:420px; box-shadow:0 4px 20px rgba(0,0,0,0.2); }
.modal-box h3 { margin:0 0 18px; font-size:16px; color:#303133; }
.modal-field { margin-bottom:14px; }
.modal-field label { display:block; font-size:13px; color:#606266; margin-bottom:4px; }
.modal-field input[type="text"],
.modal-field input[type="number"] { width:100%; padding:6px 10px; border:1px solid #dcdfe6; border-radius:3px; font-size:13px; color:#303133; }
.modal-field input:focus { outline:none; border-color:#409eff; }
.modal-btns { text-align:right; margin-top:20px; }
.modal-btns button { padding:6px 20px; border-radius:3px; font-size:13px; cursor:pointer; margin-left:10px; }
.modal-btns .btn-ok { background:#409eff; color:#fff; border:1px solid #409eff; }
.modal-btns .btn-ok:hover { background:#66b1ff; }
.modal-btns .btn-cancel { background:#fff; color:#606266; border:1px solid #dcdfe6; }
.modal-btns .btn-cancel:hover { color:#409eff; border-color:#409eff; }