/* 문제지 · 풀이 노트 모양. 디자인을 다듬을 때는 이 파일만 고치면 됩니다.
   종이는 화면 테마와 상관없이 항상 흰 종이로 그립니다. */
.paper-root {
  --paper: #ffffff;
  --paper-ink: #111111;
  --paper-sub: #444444;
  --note-paper: #fffdf6;
  --note-rule: #b9cfe6;
  --note-margin: #f2a3a3;
  --note-ink: #1b2a4a;
  --red-pen: #d22b2b;
  --blue-pen: #1f4fbf;
  --pencil: #666666;
  --marker: #fff27a;
  --sticky: #fff59a;
  --lv-easy: #3a8d5c; --lv-mid: #2f5fa8; --lv-hard: #b23b3b;
  --serif: "Noto Serif KR", "Batang", serif;
  --title: "Nanum Myeongjo", "Noto Serif KR", serif;
  --hand: "Nanum Pen Script", "Noto Serif KR", cursive;
}

.page {
  width: 210mm; min-height: 297mm; position: relative; background: var(--paper); color: var(--paper-ink);
  box-shadow: 0 1px 3px rgba(0,0,0,.18), 0 6px 18px rgba(0,0,0,.08);
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}

/* ---------- 문제지 (문제집 스타일, 한 쪽에 4문항) ---------- */
.paper-root { --orange: #e8692a; --orange-soft: #fdeee4; --rule: #9a9a9a; --gothic: "IBM Plex Sans KR", "Malgun Gothic", sans-serif; }
.exam { min-height: 297mm; padding: 11mm 17mm 12mm 14mm; font-family: var(--serif); display: flex; flex-direction: column; }
.exam-top { display: flex; justify-content: flex-end; height: 7mm; }
.pill { font-family: var(--gothic); font-size: 10.5px; border: 1px solid #555; border-radius: 999px; padding: 1px 10px; height: fit-content; }
.pill b { color: var(--orange); font-weight: 600; margin-left: 3px; }
.side-tab { position: absolute; right: 0; top: 78mm; width: 9mm; height: 44mm; background: var(--orange); color: #fff; border-radius: 3mm 0 0 3mm;
  writing-mode: vertical-rl; display: flex; align-items: center; justify-content: center; gap: 3px; font-family: var(--gothic); font-size: 12px; font-weight: 600; letter-spacing: 1px; }
.side-tab b { font-size: 14px; }
.type-head { display: flex; align-items: center; gap: 8px; margin: 2mm 0 2mm; }
.type-badge { font-family: var(--gothic); background: #4a4a4a; color: #fff; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px 0 0 4px; }
.type-title { font-family: var(--gothic); font-weight: 700; font-size: 15px; border-bottom: 1.5px solid #4a4a4a; flex: 1; padding-bottom: 2px; }
.type-note { background: #f1f1f1; border-radius: 4px; padding: 5px 10px; font-size: 11.5px; line-height: 1.7; margin-bottom: 3mm; }
.type-note span { color: var(--orange); font-weight: 600; font-family: var(--gothic); margin-right: 6px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; flex: 1; }
.col { display: flex; flex-direction: column; min-width: 0; padding: 2mm 5mm 0 0; }
.col + .col { border-left: 1px solid var(--rule); padding: 2mm 0 0 5mm; }
.q { flex: 1 1 0; min-height: min-content; display: flex; flex-direction: column; font-size: 13.6px; line-height: 1.85; word-break: keep-all; overflow-wrap: anywhere; padding-bottom: 3mm; }
.q-head { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.q-num { font-family: var(--gothic); font-weight: 700; font-size: 21px; color: var(--orange); line-height: 1; letter-spacing: -.5px; }
.diff { font-family: var(--gothic); font-size: 10.5px; font-weight: 600; color: var(--orange); border: 1px solid var(--orange); border-radius: 999px; padding: 0 7px; line-height: 1.6; }
.diff.killer { background: var(--orange); color: #fff; }
.q-code { margin-left: auto; font-family: var(--gothic); font-size: 10.5px; color: #666; }
.q-code::before { content: "▷ "; color: var(--orange); }
.q-body { text-align: justify; }
.q-body::after { content: ""; display: block; clear: both; }
.figure { float: right; width: 44%; margin: 2px 0 4px 8px; }
.figure svg { width: 100%; height: auto; display: block; }
.q .pts { font-weight: 600; white-space: nowrap; }
.box { border: 1px solid #555; border-radius: 3px; padding: 6px 10px; margin: 6px 0 7px; }
.choices { display: grid; grid-template-columns: repeat(3, 1fr); row-gap: 3px; margin-top: 8px; font-size: 13.6px; align-items: center; }
.choices.long { grid-template-columns: 1fr 1fr; }
.answer-line { margin-top: 10px; font-size: 12.5px; }
.answer-line .ab { display: inline-block; border: 1px solid #555; width: 28mm; height: 8mm; vertical-align: middle; margin-left: 6px; }
.work { flex: 1; }
.exam-foot { display: flex; justify-content: space-between; font-family: var(--gothic); font-size: 10.5px; color: #666; border-top: 1px solid #ccc; padding-top: 4px; }
.q mjx-container[jax="SVG"] { margin: 0 1px; }

/* 빠른 정답 */
.key { min-height: 297mm; padding: 14mm 16mm; font-family: var(--serif); }
.key-head { display: flex; align-items: baseline; gap: 10px; border-bottom: 2px solid var(--orange); padding-bottom: 4px; }
.key-head .no { font-family: var(--gothic); font-size: 26px; font-weight: 700; color: var(--orange); }
.key-head .t { font-family: var(--gothic); font-size: 18px; font-weight: 700; }
.key-head .r { margin-left: auto; font-size: 11px; color: #666; }
.key-concepts { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; padding: 8px 2px; border-bottom: 1px dashed #ccc; }
.key-concepts span::before { content: attr(data-n); display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--orange); color: #fff; font-size: 9.5px; font-family: var(--gothic); margin-right: 4px; vertical-align: 1px; }
.key-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px 8px; padding: 12px 2px; font-size: 14px; }
.key-grid b { font-family: var(--gothic); color: var(--orange); margin-right: 6px; }
.key-src { font-size: 12.5px; color: #444; padding: 6px 2px; }

/* ---------- 풀이 노트 ---------- */
.note {
  --line-h: 34px;
  background-color: var(--note-paper);
  background-image:
    linear-gradient(90deg, transparent 24mm, var(--note-margin) 24mm, var(--note-margin) calc(24mm + 1.5px), transparent calc(24mm + 1.5px)),
    repeating-linear-gradient(var(--note-paper) 0, var(--note-paper) calc(var(--line-h) - 1px), var(--note-rule) calc(var(--line-h) - 1px), var(--note-rule) var(--line-h));
  background-position: 0 0, 0 22mm;
  padding: 22mm 14mm 14mm 28mm;
  font-family: var(--hand); font-size: 25px; line-height: var(--line-h); color: var(--note-ink);
}
.note .hole { position: absolute; left: 8mm; width: 15px; height: 15px; border-radius: 50%; background: #e8e4d8; box-shadow: inset 1px 1px 2px rgba(0,0,0,.25); }
.note .note-title { position: absolute; top: 8mm; left: 28mm; right: 14mm; display: flex; justify-content: space-between; align-items: baseline; }
.note .note-title b { font-weight: 400; font-size: 34px; color: var(--paper-ink); }
.note .note-title span { font-size: 22px; color: var(--pencil); }
.note p { margin: 0; }
.note .qh { font-size: 30px; color: var(--paper-ink); }
.note .qh .tag { font-size: 21px; color: #fff; border-radius: 4px; padding: 0 7px; margin-left: 6px; vertical-align: 3px; }
.note .tag.p2 { background: var(--lv-easy); } .note .tag.p3 { background: var(--lv-mid); } .note .tag.p4 { background: #e0782f; } .note .tag.killer { background: var(--lv-hard); }
.note .s-h { color: var(--red-pen); }
.note .s-why { color: var(--pencil); font-size: 23px; }
.note .s-why::before { content: "↳ 근거: "; }
.note .s-tip { color: var(--blue-pen); }
.note .s-tip::before { content: "★ "; }
.note .ind1 { padding-left: 26px; } .note .ind2 { padding-left: 52px; }
.note mark { background: linear-gradient(transparent 55%, var(--marker) 55%, var(--marker) 92%, transparent 92%); color: inherit; }
.note mjx-container[jax="SVG"] { margin: 0 1px; }
.htable { border-collapse: collapse; margin: 1px 0 1px 26px; transform: rotate(-.4deg); }
.htable td { border: 1.6px solid var(--note-ink); padding: 0 10px; height: var(--line-h); line-height: calc(var(--line-h) - 2px); vertical-align: middle; }
.final { margin-top: 2px; }
.circ { display: inline-block; border: 2.5px solid var(--red-pen); border-radius: 50%; padding: 0 12px; transform: rotate(-4deg); color: var(--red-pen); line-height: 30px; margin-left: 6px; }
.sticky { margin: 18px 0 0 auto; width: 70mm; background: var(--sticky); padding: 6px 12px; transform: rotate(2deg); box-shadow: 2px 3px 6px rgba(0,0,0,.18); font-size: 23px; line-height: 30px; color: #333; }
.sticky b { font-weight: 400; color: var(--red-pen); display: block; }
.stamp { position: absolute; top: 30mm; right: 14mm; font-family: var(--serif); font-size: 12px; font-weight: 700; border: 2px solid currentColor; border-radius: 6px; padding: 3px 8px; transform: rotate(6deg); max-width: 70mm; line-height: 1.5; background: rgba(255,255,255,.75); }
.stamp.ok { color: #1a8d3e; }
.stamp.mismatch, .stamp.unknown { color: var(--red-pen); }
.stamp.pending { color: var(--pencil); border-style: dashed; }
.stamp small { display: block; font-weight: 400; }

/* ---------- 화면 축소 (JS가 --zoom을 정함) ---------- */
.pages .page { zoom: var(--zoom, 1); }

/* ---------- 인쇄 / PDF ---------- */
@page { size: A4; margin: 0; }
@media print {
  body { background: #fff !important; }
  .topbar, .panel, .toolbar, .source, .banner, .empty, .login { display: none !important; }
  .layout, .sheets { display: block !important; padding: 0 !important; margin: 0 !important; background: none !important; }
  #solution-pages[hidden], #exam-pages[hidden] { display: block !important; }
  .pages { display: block !important; }
  .pages .page { zoom: 1 !important; box-shadow: none; break-after: page; page-break-after: always; }
  .stamp.pending { display: none; }
}
