/* 打印版样式：A4、黑白友好 */
:root { --ink: #111; --line: #999; --soft: #666; }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: #f2f2f2; }
body {
  font: 11pt/1.7 "Songti SC", "STSong", "SimSun", serif;
  color: var(--ink);
}
#out { background: #fff; }
.sheet { max-width: 190mm; margin: 0 auto; padding: 12mm 0; }

/* 工具条（打印时隐藏） */
.toolbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center;
  padding: 10px 14px; background: #fffdf6; border-bottom: 1px solid #ddd;
  font: 13px/1.5 -apple-system, "PingFang SC", sans-serif;
}
.toolbar select { font: inherit; padding: 4px 6px; max-width: 46vw; }
.toolbar button {
  font: inherit; padding: 5px 14px; border: 1px solid #bbb; border-radius: 6px;
  background: #fff; cursor: pointer;
}
.toolbar button:hover { background: #f6f2e8; }
.toolbar a { color: #666; text-decoration: none; }

/* 卷头 */
.head { border-bottom: 2px solid var(--ink); padding-bottom: 6px; margin-bottom: 14px; }
.head h1 { font-size: 15pt; margin: 0 0 4px; letter-spacing: .04em; }
.head .meta { font-size: 10pt; color: var(--soft); }
.head .fill { margin-top: 8px; font-size: 10.5pt; color: var(--soft); letter-spacing: .1em; }

/* 材料与题 */
.group { margin: 0 0 16px; page-break-inside: auto; }
.material { margin: 0 0 8px; text-align: justify; }
.material p { margin: 0 0 .5em; }
table.qtab { border-collapse: collapse; width: 100%; margin: 6px 0; font-size: 10pt; }
table.qtab th, table.qtab td { border: 1px solid var(--line); padding: 3px 5px; text-align: center; }
.tabnote { font-size: 9.5pt; color: var(--soft); }

figure.media { margin: 8px 0; page-break-inside: avoid; }
figure.media img { max-width: 100%; max-height: 88mm; display: block; margin: 0 auto; }

.q { margin: 0 0 10px; page-break-inside: avoid; }
.q-head { display: flex; gap: 6px; align-items: baseline; }
.q-no { flex: 0 0 auto; font-weight: 700; }
.q-text { white-space: pre-wrap; text-align: justify; }
.q-multi { font-size: 9.5pt; color: var(--soft); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; }
.opts { margin: 4px 0 0 1.4em; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 16px; }
.opts.wide { grid-template-columns: 1fr; }
.opt { white-space: normal; }
.opt .k { font-weight: 600; margin-right: 4px; }
.space { height: 1.5cm; border-bottom: 1px dotted #bbb; margin: 6px 0 10px; }
.space.tall { height: 3cm; }

/* 答案页 */
.answers { page-break-before: always; border-top: 2px solid var(--ink); padding-top: 10px; margin-top: 20mm; }
.answers h2 { font-size: 13pt; margin: 0 0 8px; }
.atable { border-collapse: collapse; margin-bottom: 10px; }
.atable th, .atable td { border: 1px solid var(--line); padding: 2px 8px; font-size: 10.5pt; text-align: center; }
.sol { font-size: 10pt; margin: 0 0 6px; color: #222; }
.sol b { color: #000; }

/* 打印 */
@page { size: A4; margin: 14mm 12mm; }
@media print {
  html, body { background: #fff; }
  .noprint { display: none !important; }
  .sheet { max-width: none; padding: 0; }
  a { color: inherit; text-decoration: none; }
  .answers { margin-top: 0; }
}
