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

body {
    background-color: #e9f0e6;
    font-family: '宋体', 'SimSun', 'Times New Roman', '微软雅黑', serif;
    padding: 30px 20px;
    color: #2c3e2f;
}

/* 主容器 — 模拟传统试卷质感 */
.exam-container {
    max-width: 1100px;
    margin: 0 auto;
    background: #fffef7;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    border: 1px solid #cfd8c6;
    overflow: hidden;
    transition: all 0.2s;
    position: relative;
}

/* 返回首页按钮 */
.back-home-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(45, 106, 79, 0.1);
    color: #2d6a4f;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid rgba(45, 106, 79, 0.2);
    z-index: 10;
}

.back-home-btn:hover {
    background: rgba(45, 106, 79, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(45, 106, 79, 0.2);
}

.back-icon {
    font-size: 1.1rem;
}

/* 试卷头部 — 密封线+校训风格 */
.paper-header {
    background: #faf7e6;
    padding: 20px 28px 12px 28px;
    border-bottom: 2px solid #bc9a6c;
    position: relative;
    background-image: repeating-linear-gradient(90deg, #e5d9c3 0px, #e5d9c3 1px, transparent 1px, transparent 8px);
}

.seal-area {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    border-left: 3px dashed #a07e4c;
    padding-left: 20px;
    margin-bottom: 10px;
}

.school-info {
    font-size: 14px;
    color: #5d4a2e;
    line-height: 1.6;
    letter-spacing: 1px;
}

.school-info span {
    display: inline-block;
    margin-right: 20px;
}

.exam-title {
    text-align: center;
    margin: 15px 0 10px 0;
}

.exam-title h1 {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: 4px;
    color: #2b4b2b;
    font-family: '黑体', 'Microsoft YaHei', sans-serif;
}

.exam-title .sub {
    font-size: 14px;
    color: #6f5b3e;
    border-top: 1px solid #ddd2bc;
    display: inline-block;
    padding-top: 6px;
    margin-top: 6px;
}

.meta-info {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    font-size: 13px;
    background: #f3efdf;
    padding: 8px 15px;
    border-radius: 20px;
    color: #3d5a3b;
}

/* 科目控制栏 */
.toolbar {
    background: #f0ebdb;
    padding: 12px 28px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    border-bottom: 1px solid #dad0b5;
}

.subject-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #ffffffcc;
    padding: 4px 16px;
    border-radius: 40px;
}

.subject-selector label {
    font-weight: bold;
    color: #3b5c2a;
}

select {
    background: white;
    border: 1px solid #b9aa82;
    padding: 6px 12px;
    border-radius: 24px;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: 0.2s;
}

select:focus {
    border-color: #6f9e3f;
    box-shadow: 0 0 0 2px #cbe2b0;
}

.generate-btn {
    background: #2d6a4f;
    border: none;
    color: white;
    font-size: 16px;
    font-weight: bold;
    padding: 6px 20px;
    border-radius: 32px;
    cursor: pointer;
    font-family: inherit;
    transition: 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.generate-btn:hover {
    background: #1f543d;
    transform: scale(0.97);
}

/* 内容区域：题目区和答案区完全分开 */
.content-split {
    padding: 20px 30px 30px 30px;
}

/* 试卷题目区域 (符合九年义务教育样式) */
.questions-area {
    background: #ffffff;
    margin-bottom: 40px;
    border-radius: 12px;
    padding: 8px 0 20px 0;
    position: relative;
}

.section-title {
    font-size: 22px;
    font-weight: 600;
    border-left: 8px solid #4c7a34;
    padding-left: 18px;
    margin: 15px 0 20px 0;
    color: #2b4b2b;
    font-family: '黑体', sans-serif;
}

.question-item {
    margin-bottom: 28px;
    padding: 0 10px 0 20px;
    page-break-inside: avoid;
    break-inside: avoid;
}

.q-title {
    font-weight: 700;
    font-size: 17px;
    color: #1e3a2f;
    display: inline-block;
    background: #f4f0e2;
    padding: 0 8px 0 0;
    margin-right: 8px;
}

.q-content {
    font-size: 16px;
    line-height: 1.55;
    margin-top: 6px;
    margin-left: 28px;
    color: #1f2e1c;
}

.q-content p, .q-content div {
    margin-bottom: 6px;
}

.choice-list {
    list-style: none;
    padding-left: 24px;
    margin: 8px 0;
}

.choice-list li {
    margin: 4px 0;
    font-size: 15px;
}

.blank {
    background: #f9f3da;
    display: inline-block;
    min-width: 70px;
    border-bottom: 1px dashed #3c5e2b;
    margin: 0 4px;
    padding: 0 10px;
}

/* 答案区域 (完全独立，符合分开生成) */
.answers-area {
    background: #fefaf0;
    border-top: 3px double #c3b58c;
    border-radius: 16px;
    padding: 20px 20px 25px 20px;
    margin-top: 15px;
    box-shadow: inset 0 1px 4px #e9e0ca, 0 2px 6px rgba(0,0,0,0.05);
}

.answer-title {
    font-size: 22px;
    font-weight: bold;
    color: #af7f41;
    border-bottom: 2px solid #dbbb87;
    display: inline-block;
    padding-right: 35px;
    margin-bottom: 20px;
    letter-spacing: 2px;
}

.answer-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.answer-item {
    border-bottom: 1px dashed #ded1b0;
    padding-bottom: 12px;
}

.answer-num {
    font-weight: 800;
    font-size: 16px;
    background: #e5d8b8;
    display: inline-block;
    width: 32px;
    text-align: center;
    border-radius: 20px;
    margin-right: 14px;
    color: #3f5c2c;
}

.answer-text {
    font-size: 15px;
    line-height: 1.5;
    color: #2c4724;
    display: inline-block;
    width: calc(100% - 55px);
    vertical-align: top;
}

/* 模拟密封线装饰 */
.seal-line {
    position: absolute;
    left: 0;
    top: 80px;
    bottom: 40px;
    width: 28px;
    background: repeating-linear-gradient(180deg, #bc9a6c, #bc9a6c 8px, #fef3db 8px, #fef3db 16px);
    opacity: 0.2;
    pointer-events: none;
}

/* 分数标注 */
.score-badge {
    float: right;
    font-size: 13px;
    background: #eae2ce;
    padding: 2px 12px;
    border-radius: 20px;
    color: #5c461f;
}

footer {
    text-align: center;
    font-size: 12px;
    padding: 15px;
    border-top: 1px solid #e0d6bf;
    color: #8f7a58;
    background: #fcf9ef;
}

@media (max-width: 700px) {
    .content-split {
        padding: 12px;
    }
    .q-content {
        margin-left: 12px;
    }
    .answer-text {
        width: calc(100% - 48px);
    }
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    /* 移动端返回首页按钮调整 */
    .back-home-btn {
        top: 10px;
        right: 12px;
        padding: 6px 12px;
        font-size: 0.85rem;
    }
    .back-text {
        display: none;
    }
}

/* 印刷风格 */
@media print {
    body {
        background: white;
        padding: 0;
    }
    .toolbar, .generate-btn, footer {
        display: none;
    }
    .exam-container {
        box-shadow: none;
        margin: 0;
        border: none;
    }
    .answers-area {
        page-break-before: always;
    }
}
