:root {
  --ink: #202124;
  --muted: #5f6368;
  --line: #d8dde3;
  --paper: #ffffff;
  --accent: #175cd3;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: #e9edf2;
  font-family: "Malgun Gothic", "Yu Gothic", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}
.exam-app { max-width: 1180px; margin: 0 auto; padding: 18px; }
.toolbar {
  display: grid;
  grid-template-columns: 240px 1fr 150px;
  gap: 14px;
  align-items: start;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  background: #fff;
}
.brand h1 { margin: 0; font-size: 20px; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.controls { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 8px; align-items: end; }
label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
input, select, button { height: 34px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; padding: 0 8px; }
button { cursor: pointer; font-weight: 700; white-space: nowrap; }
.actions { display: grid; gap: 8px; align-self: start; }
.range-status { grid-column: 2 / 3; color: var(--muted); font-size: 12px; min-height: 20px; align-self: end; }
.range-status.is-warning { color: #b54708; font-weight: 700; }
.check { display: flex; align-items: center; gap: 6px; height: 34px; }
.check input { width: 16px; height: 16px; }
.paper,
.answer-paper {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto 18px;
  padding: 14mm 12mm 9mm;
  background: var(--paper);
  box-shadow: 0 4px 18px rgba(32,33,36,.12);
}
.paper { display: flex; flex-direction: column; }
.paper-head,
.answer-head {
  display: grid;
  grid-template-columns: 1fr 68px;
  gap: 10px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 7px;
  margin-bottom: 8px;
}
.answer-head { display: block; }
.paper-head h2,
.answer-head h2 { margin: 0; font-size: 20px; }
.paper-head p,
.answer-head p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.score-box { border: 1px solid var(--ink); min-height: 38px; text-align: center; padding-top: 6px; font-size: 12px; }
.questions {
  --question-rows: 10;
  counter-reset: question;
  display: grid;
  grid-template-columns: repeat(var(--question-cols, 5), minmax(0, 1fr));
  grid-template-rows: repeat(var(--question-rows), minmax(0, 1fr));
  flex: 1;
  gap: 4px 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.question {
  counter-increment: question;
  break-inside: avoid;
  min-height: 0;
  padding: 4px 3px;
  border: 1px solid #e1e6eb;
}
.question.empty-question { grid-column: 1 / -1; min-height: 28mm; color: var(--muted); border-bottom: 1px solid #e1e6eb; }
.prompt { display: grid; grid-template-columns: auto auto; align-items: baseline; gap: 4px; margin-bottom: 22px; }
.prompt::before { content: counter(question) "."; font-weight: 700; font-size: 11px; }
.glyph { font-size: 28px; font-weight: 700; min-width: 0; line-height: 1; }
.answer-lines { display: grid; grid-template-columns: auto 1fr; row-gap: 10px; column-gap: 4px; align-items: end; font-size: 9px; }
.answer-lines div:nth-child(odd) { font-size: 13.5px; font-weight: 700; line-height: 1; }
.line { border-bottom: 1px solid var(--line); height: 12px; }
.answer-key { break-before: page; page-break-before: always; }
.answer-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: start; }
.answer-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
  line-height: 1.35;
}
.answer-table th,
.answer-table td {
  border: 1px solid var(--line);
  padding: 2px 4px;
  vertical-align: middle;
}
.answer-table th { background: #f5f7fa; font-weight: 700; }
.answer-table th:nth-child(1),
.answer-table td:nth-child(1) { width: 8%; text-align: center; }
.answer-table th:nth-child(2),
.answer-table td:nth-child(2) { width: 8%; text-align: center; }
.answer-table th:nth-child(3),
.answer-table td:nth-child(3) { width: 10%; text-align: center; }
.answer-table th:nth-child(4),
.answer-table td:nth-child(4) { width: 10%; text-align: center; }
.answer-table th:nth-child(5),
.answer-table td:nth-child(5) { width: 40%; }
.answer-table th:nth-child(6),
.answer-table td:nth-child(6) { width: 24%; }
.answer-glyph { font-size: 18px; font-weight: 700; }
.copyright { margin-top: 6px; color: var(--muted); font-size: 10px; text-align: right; }
@media (max-width: 980px) {
  .toolbar { grid-template-columns: 1fr; }
  .range-status { grid-column: 1 / -1; }
  .controls { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .paper,
  .answer-paper { width: 100%; min-height: auto; padding: 18px; }
  .questions { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; }
}
@media print {
  @page { size: A4; margin: 10mm; }
  body { background: #fff; }
  .toolbar { display: none; }
  .exam-app { max-width: none; padding: 0; }
  .paper,
  .answer-paper { width: auto; height: calc(297mm - 20mm); min-height: 0; margin: 0; padding: 0; box-shadow: none; }
  .paper { display: flex; flex-direction: column; break-after: page; page-break-after: always; }
  .paper-head { grid-template-columns: 1fr 58px; gap: 8px; margin-bottom: 6px; }
  .paper-head h2 { font-size: 18px; }
  .score-box { min-height: 34px; padding-top: 5px; }
  .questions { grid-template-columns: repeat(var(--question-cols, 5), minmax(0, 1fr)); grid-template-rows: repeat(var(--question-rows, 10), minmax(0, 1fr)); flex: 1; gap: 4px 5px; }
  .question { min-height: 0; padding: 4px 3px; }
  .glyph { font-size: 30px; }
  .prompt { margin-bottom: 22px; }
  .answer-lines { row-gap: 10px; }
  .answer-lines div:nth-child(odd) { font-size: 13.5px; }
  .answer-key { break-before: page; page-break-before: always; }
  .answer-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; align-items: start; }
  .answer-table { font-size: 10.5px; line-height: 1.32; }
  .answer-table th,
  .answer-table td { padding: 1.5px 2.5px; }
  .answer-glyph { font-size: 16px; }
  .copyright { font-size: 9px; }
}









.print-log {
  margin: 0 0 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
  color: var(--muted);
}
.print-log h2 { margin: 0 0 6px; font-size: 13px; color: var(--ink); }
.print-log ol { margin: 0; padding-left: 20px; }
.print-log li { margin: 2px 0; }
@media print { .print-log { display: none; } }

.log-restore { margin-left: 8px; height: 24px; padding: 0 8px; font-size: 11px; }
.print-log li { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }


.print-log-status { min-height: 18px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.print-log-status.is-error { color: #b42318; font-weight: 700; }
.print-log-status.is-ok { color: #067647; font-weight: 700; }

