/* ============ 奥数练习纸排版（叠加在 sheet.css 之上） ============
   纸张骨架（.sheet / .sheet-head / .sheet-meta / .sheet-foot）与打印规则
   全部复用 sheet.css；本文件只定义奥数自己的两种网格：
   题目页 .aoshu-grid 与解析页 .sol-grid。每页块数不固定：块高由
   js/aoshu-render.js 实测内容后以内联 style 写死（动态装页），
   打印段的 min-height 与那边的 MM.capacity（225mm）硬对应。 */

/* ---------- 题目页：单列网格，块高由 JS 内联给定 ---------- */

.aoshu-grid {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
}

.aq {
  display: flex;
  flex-direction: column;
  padding: 3mm 0 2mm;
  overflow: hidden; /* 兜底同 .q：极端情况不侵入邻块 */
  break-inside: avoid;
  page-break-inside: avoid;
  border-bottom: 1px dashed #bbb; /* 分题虚线，孩子看题不串行 */
}

.aq:last-child {
  border-bottom: none;
}

.aq-num {
  font-size: 13px;
  margin-right: 2mm;
}

.aq-stem {
  font-size: 16px; /* 一年级可读字号 */
  line-height: 1.8;
}

/* 题干里的图形（SVG）限高，防止题块被撑得过高 */
.aq-stem svg {
  display: block;
  max-height: 18mm;
  width: auto;
  margin: 0.5mm 0 0;
}

.sol-stem svg {
  display: block;
  max-height: 13mm;
  width: auto;
}

/* 演算留白：高度由 aoshu-render.js 内联给定（有上限），不再吃掉整块剩余高度 */
.aq-work {
  flex: none;
}

/* 收尾留白：块高摊分后多出来的部分落在答题线下方，充当题与题之间的距离 */
.aq-tail {
  flex: 1;
}

.aq-ans {
  font-size: 15px;
}

.aq-ans .blank {
  display: inline-block;
  width: 3em;
  height: 1em;
  border-bottom: 2px solid #000;
  vertical-align: -3px;
}

.aq-ans .blank-expr {
  width: 12em; /* 「列式：」后的长横线 */
}

/* ---------- 解析页：块高按内容实测，由 JS 内联给定 ---------- */

.sol-grid {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
}

.sol {
  padding: 3mm 0 2mm;
  overflow: hidden;
  break-inside: avoid;
  page-break-inside: avoid;
  border-bottom: 1px dashed #bbb;
}

.sol:last-child {
  border-bottom: none;
}

.sol-stem {
  font-size: 13px;
  color: #444;
  line-height: 1.6;
}

/* 综合复习卷：解析里标出这道题出自哪个知识点 */
.sol-topic {
  display: inline-block;
  margin-right: 1.5mm;
  padding: 0 1.2mm;
  font-size: 11px;
  color: #333;
  border: 1px solid #999;
  border-radius: 1mm;
}

.sol-steps {
  margin: 1.5mm 0 0;
  padding-left: 1.2em;
  font-size: 13.5px;
  line-height: 1.75;
}

.sol-steps li {
  list-style: none;
}

.sol-steps .step-tag {
  font-weight: 700;
  color: #000;
}

/* 圆点对比图 */
.sol-diagram {
  margin: 1.5mm 0 0.5mm;
  font-size: 13px;
}

.sol-diagram .dot-row {
  line-height: 1.6;
  white-space: nowrap;
}

.sol-diagram .dot-label {
  display: inline-block;
  min-width: 3em;
  color: #444;
}

.sol-diagram .dots {
  letter-spacing: 2px;
}

.sol-diagram .dot-note {
  font-size: 12px;
  color: #666;
}

/* 线段图（条形示意图）：知识点生成器用 diagramHTML 输出，宽度用内联 style 按比例给 mm */
.seg-diagram {
  margin: 1.5mm 0 0.5mm;
  font-size: 12px;
}

.seg-diagram .seg-row {
  display: flex;
  align-items: center;
  line-height: 1.9;
}

.seg-diagram .seg-label {
  flex: none;
  width: 3.5em;
  color: #444;
}

.seg-diagram .seg {
  display: inline-block;
  height: 4.5mm;
  border: 1px solid #000;
  box-sizing: border-box;
  margin-right: -1px; /* 相邻段边框重合成一条线 */
  text-align: center;
  font-size: 11px;
  line-height: 4mm;
  background: #fff;
}

.seg-diagram .seg-note {
  font-size: 12px;
  color: #666;
}

.sol-answer {
  margin-top: 1mm;
  font-size: 14px;
  font-weight: 700;
}

/* ---------- 知识点讲解页：自由排版（非网格），内容手工编写保证一页放得下 ---------- */

.lesson-sec {
  margin-bottom: 6mm;
}

.lesson-h {
  margin: 0 0 2mm;
  padding-left: 2.5mm;
  font-size: 16px;
  border-left: 3.5px solid #000;
}

.lesson-p {
  margin: 0 0 1.5mm;
  font-size: 14.5px;
  line-height: 1.85;
}

/* 一个例题一块；多个例题相邻时靠 .lesson-sec 的 margin-bottom 隔开 */
/*
 * 「怎么想」里按题型逐条列的思路。每条一句话，前面挂题型名的标签。
 * 用 list-style:none + 标签本身当项目符号，比圆点更清楚「这条属于哪种题型」。
 */
.lesson-ideas {
  margin: 2mm 0 0;
  padding: 0;
}

.lesson-ideas li {
  list-style: none;
  margin-bottom: 1.2mm;
  font-size: 14px;
  line-height: 1.75;
}

.lesson-ideas .lesson-vtag {
  margin: 0 1.5mm 0 0;
  vertical-align: 1px;
}

.lesson-example {
  padding: 2.5mm 3.5mm;
  border: 1px solid #999;
  border-radius: 2mm;
}

/*
 * 例题上方的题型名。一页上可能并排三四个例题（勾了几种题型就有几个），
 * 不标名字家长分不清哪个例题对应面板上的哪一项。
 */
.lesson-vtag {
  display: inline-block;
  margin-bottom: 1.5mm;
  padding: 0.2mm 1.8mm;
  font-size: 11.5px;
  font-weight: 700;
  /*
   * 【不能靠背景色】：浏览器打印默认丢掉背景，深底白字会直接印成一片空白。
   * 这里跟 .sol-topic 用同一套「深字 + 细框」，屏幕和纸上都清楚。
   */
  color: #222;
  background: none;
  border: 1px solid #888;
  border-radius: 1mm;
}

.lesson-stem {
  margin-bottom: 1mm;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.7;
}

.lesson-chant {
  padding: 2mm 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 2px;
  text-align: center;
}

/* ---------- 打印：与 sheet.css 同套路，用最小高度锁定网格区 ---------- */

@media print {
  .aoshu-grid {
    min-height: 225mm; /* 与 aoshu-render.js 的 MM.capacity 对应 */
  }

  .sol-grid {
    min-height: 225mm; /* 同上 */
  }

  .lesson-flow {
    min-height: 225mm; /* 撑满内容区，把页脚推到纸张底部 */
  }
}
