/* ============================================================
 * A4 试卷样式 + 打印样式
 * （从 A4Paper.vue 迁移，SCSS 嵌套已展开为原生 CSS）
 * ============================================================ */

.papers-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.a4-paper {
  width: 210mm;
  min-height: 297mm;
  padding: 15mm 20mm;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  margin: 0 auto;
  font-family: 'SimSun', '宋体', serif;
  color: #000;
  box-sizing: border-box;
}

@media screen and (max-width: 768px) {
  .a4-paper {
    width: 100%;
    padding: 10mm;
  }
}

.paper-header {
  text-align: center;
  border-bottom: 2px solid #333;
  padding-bottom: 4px;
  margin-bottom: 10px;
}

.paper-title {
  font-size: 20px;
  font-weight: bold;
  margin: 0 0 12px 0;
  letter-spacing: 2px;
}

.paper-info {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 5px;
}

.page-indicator {
  font-size: 12px;
  color: #666;
}

.empty-state {
  text-align: center;
  color: #999;
  padding: 60px 0;
  font-size: 15px;
}

/* ---------- 普通题型：三列布局，每列16题，共48题 ---------- */
.questions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0 30px;
}

/* 连加连减填空题型：两列布局，每列16题，共32题 */
.chain-fill-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 40px;
}

/* ---------- 钟表题型：3列×4行，每页12题 ---------- */
.clock-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 50px 30px;
}

.clock-question-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 20px;
  line-height: 1.2;
}

.clock-question-item .question-number {
  font-weight: bold;
  margin-bottom: 2px;
  font-size: 16px;
}

.clock-question-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.question-time-text {
  font-size: 18px;
  font-weight: bold;
  color: #333;
  margin-bottom: 2px;
}

.clock-svg {
  width: 130px;
  height: 130px;
}

.clock-svg svg {
  width: 100%;
  height: 100%;
}

.answer-area {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 16px;
  font-weight: bold;
}

.answer-blank {
  min-width: 32px;
  border-bottom: 2px solid #333;
  text-align: center;
  line-height: 1;
}

/* ---------- 破十法题型：3列×4行，每页12题 ---------- */
.pole-shi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px 2px; /* 行间距2px，列间距2px */
}

.pole-shi-question-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 18px;
  line-height: 1.4;
}

.pole-shi-question-item .question-number {
  font-weight: bold;
  margin-bottom: 6px;
  font-size: 18px;
}

.pole-shi-question-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.pole-shi-question-body svg {
  width: 210px;
  height: auto;
}

/* ---------- 凑十法题型：3列×4行，每页12题 ---------- */
.cou-shi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px 2px; /* 行间距2px，列间距2px */
}

.cou-shi-question-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 18px;
  line-height: 1.4;
}

.cou-shi-question-item .question-number {
  font-weight: bold;
  margin-bottom: 6px;
  font-size: 18px;
}

.cou-shi-question-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.cou-shi-question-body svg {
  width: 210px;
  height: auto;
}

/* ---------- 汉字字帖题型：田字格布局，一行8格，10行 ---------- */
.chazi-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px 0; /* 行间距4px，列间距0 */
}

.chazi-question-item {
  display: flex;
  align-items: center;
  justify-content: center;
}

.chazi-question-item .chazi-question-body {
  width: 100%;
}

.chazi-question-item .chazi-question-body svg {
  width: 100%;
  height: auto;
}

/* ---------- 笔画字帖题型：田字格布局，一行8格，10行 ---------- */
.bihua-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px 0; /* 行间距4px，列间距0 */
}

.bihua-question-item {
  display: flex;
  align-items: center;
  justify-content: center;
}

.bihua-question-item .bihua-question-body {
  width: 100%;
}

.bihua-question-item .bihua-question-body svg {
  width: 100%;
  height: auto;
}

/* ---------- 应用题题型：垂直列表布局，每题留出答题空隙 ---------- */
.word-problem-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 100%;
  min-height: 680px;
}

.word-problem-item {
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: center;
  padding-top: 10px;
  padding-bottom: 50px;
  border-bottom: 1px dashed #ddd;
}

.word-problem-item:last-child {
  border-bottom: none;
}

.word-problem-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 18px;
  color: #333;
  padding: 10px 0;
}

.word-problem-header .question-number {
  font-weight: bold;
  font-size: 18px;
  min-width: 28px;
  flex-shrink: 0;
}

.word-problem-header .word-problem-story {
  flex: 1;
  font-size: 18px;
  font-weight: bold;
}

/* ---------- 列与题目条目 ---------- */
.column {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.question-item {
  display: flex;
  align-items: baseline;
  font-size: 20px;
  line-height: 1.6;
  padding: 4px 0;
  border-bottom: 1px dotted #eee;
}

.question-item .question-number {
  font-weight: bold;
  margin-right: 6px;
  min-width: 28px;
  flex-shrink: 0;
  font-size: 20px;
}

.question-item .question-content {
  flex: 1;
  font-weight: bold;
  font-size: 20px;
}

.paper-footer {
  text-align: center;
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid #ddd;
  font-size: 12px;
  color: #999;
}

/* ---------- 打印样式 ---------- */
@media print {
  .papers-wrapper {
    gap: 0;
  }

  .a4-paper {
    box-shadow: none;
    margin: 0;
    padding: 15mm 20mm;
    min-height: auto;
    width: 210mm;
    page-break-after: always;
  }

  .a4-paper:last-child {
    page-break-after: auto;
  }

  /* 钟表题型打印样式 */
  .clock-question-item {
    break-inside: avoid;
  }

  /* 汉字字帖题型打印样式 */
  .chazi-question-item {
    break-inside: avoid;
  }

  /* 笔画字帖题型打印样式 */
  .bihua-question-item {
    break-inside: avoid;
  }

  /* 应用题题型打印样式 */
  .word-problem-item {
    break-inside: avoid;
  }

  .clock-svg svg {
    max-width: 100%;
    height: auto;
  }
}
