/* 내신 대비 화면 스타일 — Apple 웹사이트의 "디자인 언어"만 참고(UD4, docs/yuni/apple-design.md).
   로고·상표·이미지·사이트 코드·문구는 가져오지 않음. 시험지(아래 "모의고사 형식" 절)는 UD3 형식 그대로.
   서체(UD5 대체): 시스템 글꼴 우선(Apple 기기 = 기기 안의 SF·Apple SD 산돌고딕 Neo, 우리는 배포 안 함)
   + 그 밖의 기기는 자유 라이선스 Pretendard 로컬 파일(vendor/pretendard, SIL OFL 1.1). 외부 CDN 없음. */
@font-face {
  font-family: 'Pretendard'; font-style: normal; font-weight: 400; font-display: swap;
  src: local('Pretendard Regular'), url('../vendor/pretendard/Pretendard-Regular.subset.woff2') format('woff2');
}
@font-face {
  font-family: 'Pretendard'; font-style: normal; font-weight: 600; font-display: swap;
  src: local('Pretendard SemiBold'), url('../vendor/pretendard/Pretendard-SemiBold.subset.woff2') format('woff2');
}
@font-face {
  font-family: 'Pretendard'; font-style: normal; font-weight: 700; font-display: swap;
  src: local('Pretendard Bold'), url('../vendor/pretendard/Pretendard-Bold.subset.woff2') format('woff2');
}

:root {
  --bg: #ffffff;
  --bg-soft: #f5f5f7;
  --ink: #1d1d1f;
  --muted: #6e6e73;      /* 흰 바탕 5.07:1, #f5f5f7 바탕 4.66:1 */
  --line: #d2d2d7;       /* 나눔선(장식) */
  --field: #86868b;      /* 입력칸 테두리: 흰 바탕 3.62:1 (UI 요소 3:1 이상) */
  --accent: #0071e3;     /* 채운 버튼 바탕: 흰 글자 4.70:1 */
  --accent-hover: #0077ed;
  --link: #0066cc;       /* 글자 링크·글자 버튼: 흰 바탕 5.57:1 */
  --accent-soft: #e8f1fc;
  --good: #116b2c; --good-soft: #e6f4ea;
  --warn: #9a4400; --warn-soft: #fff1e0;
  --bad: #b42318; --bad-soft: #fdecec;
  --info: #4b49c9; --info-soft: #efeefe;
  --radius: 18px;
  --radius-s: 12px;
  --tap: 44px;
  --nav-h: 48px;
  --pt: 32px;            /* 본문 위 여백 */
  --gutter: 16px;        /* 좌우 여백 */
  --ease: cubic-bezier(0.4, 0, 0.6, 1);
  --ease-out: cubic-bezier(0.25, 0.1, 0.3, 1);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --font: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Pretendard', 'Malgun Gothic', 'Noto Sans KR',
    'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --fs-base: 17px;
}
html[data-size='s'] { --fs-base: 15px; }
html[data-size='l'] { --fs-base: 20px; }
@media (min-width: 768px) { :root { --pt: 56px; --gutter: 24px; } }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--nav-h) + 16px); scroll-padding-bottom: 96px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.5;
  letter-spacing: -0.01em;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }

/* 글자 위계: 큰 제목 → 부제(회색) → 본문 → 작은 글 */
h1, h2, h3 { color: var(--ink); margin: 0 0 0.5em; }
h1 { font-size: clamp(1.76em, 6.4vw, 2.35em); font-weight: 700; line-height: 1.12; letter-spacing: -0.025em; margin-bottom: 0.3em; }
h2 { font-size: 1.3em; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
h3 { font-size: 1.06em; font-weight: 600; line-height: 1.3; }
main > h1 + p:not(.small) { font-size: 1.12em; color: var(--muted); margin-bottom: 1.4em; }
p { margin: 0 0 0.75em; }
a { color: var(--link); text-underline-offset: 0.15em; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
[tabindex='-1']:focus { outline: none; } /* 화면 바뀔 때 제목으로 옮긴 포커스는 테두리 없이 */

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 10px 14px; z-index: 99; border-radius: 10px; }
.skip:focus { left: 8px; }

/* 얇은 위쪽 내비(반투명 + 흐림). 학생 메뉴 4개도 여기(아래 탭 없음) */
.topbar {
  position: sticky; top: 0; z-index: 10;
  height: var(--nav-h);
  background: rgba(255, 255, 255, 0.8);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar { background: rgba(255, 255, 255, 0.97); }
}
.topbar-in { max-width: 980px; height: 100%; margin: 0 auto; padding: 0 var(--gutter); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 700; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.tabbar { display: flex; gap: 2px; }
.tabbar a {
  display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); min-width: var(--tap); padding: 0 8px;
  font-size: 0.82em; color: rgba(0, 0, 0, 0.8); text-decoration: none; white-space: nowrap;
  border-bottom: 2px solid transparent; transition: color 0.32s var(--ease), border-color 0.32s var(--ease);
}
.tabbar a:hover { color: #000; text-decoration: none; }
.tabbar a[aria-current='page'] { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }
@media (min-width: 768px) { .tabbar { gap: 12px; } }
@media (max-width: 359px) { .tabbar a { padding: 0 5px; } }

/* 내비 아래 얇은 띠 */
.ribbon { background: var(--bg-soft); color: var(--ink); text-align: center; font-size: 0.82em; padding: 10px var(--gutter); }
.offline { background: var(--warn-soft); color: var(--warn); padding: 10px var(--gutter); font-weight: 600; text-align: center; }

main { max-width: 720px; margin: 0 auto; padding: var(--pt) var(--gutter) 120px; outline: none; }
main.wide { max-width: 980px; }
main.narrow { max-width: 480px; }
main.narrow > h1, main.narrow > h1 + p { text-align: center; }
.wrap { padding: var(--gutter); }

/* 화면이 바뀔 때 부드럽게 떠오르기 (움직임 줄이기 설정이면 끔: 맨 아래) */
main > :not(.navbar):not(dialog) { animation: rise 0.5s var(--ease-out) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* 버튼: 알약 모양, 강조색은 파랑 하나 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 0 22px; border-radius: 980px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  font: inherit; font-weight: 600; line-height: 1.2; cursor: pointer; text-decoration: none; text-align: center;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.1s var(--ease);
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn[disabled], .btn[aria-disabled='true'] { opacity: 0.42; cursor: not-allowed; transform: none; }
.btn.secondary { background: transparent; color: var(--link); border-color: var(--link); }
.btn.secondary:hover { background: var(--accent-soft); }
.btn.ghost { background: transparent; color: var(--link); border-color: transparent; padding: 0 10px; }
.btn.ghost:hover { background: transparent; text-decoration: underline; }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.block { display: flex; width: 100%; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 14px; }
.muted { color: var(--muted); }
.small { font-size: 0.88em; }

/* 카드: 둥근 모서리, 회색 바탕 또는 흰 바탕 + 옅은 그림자 */
.card { background: var(--bg-soft); border-radius: var(--radius); padding: 20px; }
.card.white { background: #fff; box-shadow: var(--shadow); }
.card + .card, .card + section, section + .card { margin-top: 20px; }
.card h2, .card h3 { margin-bottom: 0.4em; }
a.card { transition: box-shadow 0.3s var(--ease-out), transform 0.3s var(--ease-out); }
a.card:hover { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12); transform: translateY(-2px); text-decoration: none; }
@media (min-width: 768px) { .card { padding: 28px; } }

/* 숫자 타일(운영자 AI 상태 등) */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 12px 0; }
.stat { background: var(--bg-soft); border-radius: var(--radius-s); padding: 14px 16px; }
.stat .k { display: block; font-size: 0.82em; color: var(--muted); }
.stat .v { display: block; font-size: 1.5em; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* 배지: 항상 글자 + 기호 (색만으로 구분하지 않기). 글자색은 바탕 대비 4.5:1 이상 */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 980px; font-size: 0.8em; font-weight: 600; border: 1px solid transparent; white-space: nowrap; vertical-align: middle; }
.badge-good { color: var(--good); background: var(--good-soft); }
.badge-mid { color: var(--link); background: var(--accent-soft); }
.badge-warn { color: var(--warn); background: var(--warn-soft); }
.badge-bad { color: var(--bad); background: var(--bad-soft); }
.badge-info { color: var(--info); background: var(--info-soft); }
.badge-muted { color: var(--muted); background: #fff; border-color: var(--line); }

/* 폼 */
label.field { display: block; font-weight: 600; margin-bottom: 16px; }
label.field > span.hint { display: block; font-weight: 400; color: var(--muted); font-size: 0.88em; }
legend.field { font-weight: 600; margin-bottom: 8px; }
input[type='text'], input[type='password'], input[type='url'], input[type='number'], select, textarea {
  display: block; width: 100%; margin-top: 6px;
  min-height: 48px; padding: 11px 16px;
  font: inherit; font-size: max(16px, 1em); font-weight: 400; color: var(--ink);
  background: #fff; border: 1px solid var(--field); border-radius: var(--radius-s);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.18); }
[aria-invalid='true'] { border-color: var(--bad) !important; }
.check { display: flex; gap: 10px; align-items: flex-start; min-height: var(--tap); padding: 10px 0; cursor: pointer; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--accent); }
.error-text { color: var(--bad); font-weight: 600; }
.error-text::before { content: '⚠ '; }
.notice { padding: 14px 18px; border-radius: var(--radius-s); background: var(--accent-soft); color: var(--ink); }
.notice .muted { color: var(--ink); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice > :last-child { margin-bottom: 0; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; }

/* 칩(고르기 단추) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 18px; border-radius: 980px;
  border: 1px solid var(--field); background: #fff; transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.chip input:checked + span { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); color: var(--link); font-weight: 600; }
.chip input:checked + span::before { content: '✓ '; }
.chip input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* 운영자 바로 가기 */
.localnav { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 28px; }
.localnav button {
  min-height: var(--tap); padding: 0 16px; border-radius: 980px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font: inherit; font-size: 0.88em; cursor: pointer;
  transition: background-color 0.2s var(--ease);
}
.localnav button:hover { background: var(--bg-soft); }
.ops-sec { scroll-margin-top: calc(var(--nav-h) + 16px); }

/* 검토 대기 문항 */
.ritem { border-top: 1px solid var(--line); padding: 20px 0 4px; }
.ritem:first-child { border-top: 0; padding-top: 4px; }
.ritem h3 { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ro-choices { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.ro-choices .pp-mark { font-size: 1.05em; }
.kv { margin: 0 0 12px; }
.kv dt { font-weight: 600; font-size: 0.88em; color: var(--muted); margin-top: 10px; }
.kv dd { margin: 2px 0 0; }
.pre { white-space: pre-wrap; }

/* 진행 막대 */
.bar { height: 8px; border-radius: 980px; background: #e8e8ed; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 980px; transition: width 0.6s var(--ease-out); }

/* 목록 */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 16px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.task { display: flex; gap: 12px; align-items: center; }
.task .mark { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--field); display: grid; place-items: center; font-weight: 700; }
.task.done .mark { border-color: var(--good); color: var(--good); }
.task .grow { flex: 1; min-width: 0; }

/* 응시 화면 */
.testbar {
  position: sticky; top: var(--nav-h); z-index: 5;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
  margin: calc(-1 * var(--pt)) calc(-1 * var(--gutter)) 16px; padding: 10px var(--gutter);
}
.testbar .row { justify-content: space-between; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; }
.timer.low { color: var(--bad); }
.save-state { font-size: 0.85em; color: var(--muted); }
.save-state.err { color: var(--warn); font-weight: 600; }
.qhead { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; color: var(--muted); font-weight: 600; }
.stem { font-size: 1.05em; margin-bottom: 16px; white-space: pre-wrap; }
.navbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9;
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
}
.navbar .inner { max-width: 720px; margin: 0 auto; display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
.navbar .inner > :first-child { justify-self: start; }
.navbar .inner > :last-child { justify-self: end; }
.qnav { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.qnav button {
  min-height: 48px; border-radius: var(--radius-s); border: 1px solid var(--field); background: #fff; color: var(--ink); font: inherit; font-weight: 700; cursor: pointer;
}
.qnav button.answered { background: var(--accent-soft); border-color: var(--accent); color: var(--link); }
.qnav button.answered::after { content: ' ✓'; }
.qnav button.dk { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.qnav button.dk::after { content: ' ?'; }
.qnav button[aria-current='true'] { outline: 3px solid var(--ink); outline-offset: 1px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 0.85em; color: var(--muted); margin-top: 10px; }

/* 대화상자 */
dialog { border: 0; border-radius: 20px; padding: 24px; width: min(92vw, 440px); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22); }
dialog::backdrop { background: rgba(0, 0, 0, 0.32); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
dialog[open] { animation: pop 0.25s var(--ease-out); }
@keyframes pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }

/* 단원 표 */
.unit { padding: 16px 0; border-bottom: 1px solid var(--line); }
.unit:last-child { border-bottom: 0; }
.unit .row { justify-content: space-between; }
.unit .bar { margin: 8px 0; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.92em; }
table.data th, table.data td { text-align: left; padding: 10px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { color: var(--muted); font-weight: 600; }
table.data tr:last-child > * { border-bottom: 0; }

/* 로딩 */
.skeleton { background: linear-gradient(90deg, #ececf0 25%, #f5f5f7 50%, #ececf0 75%); background-size: 200% 100%; animation: sk 1.4s infinite; border-radius: var(--radius-s); height: 18px; margin: 10px 0; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.spinner { width: 28px; height: 28px; flex: none; border: 3px solid #e8e8ed; border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 20;
  background: rgba(29, 29, 31, 0.94); color: #fff; padding: 12px 20px; border-radius: 14px; max-width: min(90vw, 560px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}
.empty { text-align: center; padding: 36px 12px; color: var(--muted); }
.empty .big { font-size: 2em; }
.katex { font-size: 1.05em; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.math-raw { font-family: ui-monospace, Consolas, monospace; background: var(--bg-soft); padding: 0 4px; border-radius: 4px; }
.topic h3 { margin-bottom: 0.3em; }
.topic dl { margin: 0; }
.topic dt { font-weight: 700; margin-top: 10px; }
.topic dd { margin: 2px 0 0; }
details > summary { cursor: pointer; padding: 10px 0; color: var(--link); } /* 줄 높이 + 위아래 10px = 44px 이상 */

/* 움직임 줄이기: 모든 움직임 끔 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ================= 모의고사 형식 시험지 (UD3·D32) =================
   머리(시험명·수학 영역·교시 띠) → 2단 본문(가운데 세로선, 단마다 2문항) → 쪽 상자.
   넓은 화면(900px 이상)·인쇄는 2단, 휴대폰은 1단. 정답은 시험지 데이터에 없음. */
main.exam { max-width: 1120px; }
.pp-wrap, .pp-print { counter-reset: none; }
.pp-page {
  background: #fff; color: #111; font-family: var(--font); /* 시험지 안쪽도 같은 서체 정책. 번호·쪽 번호만 형식대로 Times 계열 */
  border: 1px solid var(--line); border-radius: 4px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.06);
  padding: 18px 16px 12px;
}
.pp-print .pp-page + .pp-page { margin-top: 24px; }
.pp-head { text-align: center; }
.pp-title { margin: 0; font-size: 0.92em; }
.pp-area { margin: 0 0 10px; font-size: 2em; font-weight: 700; letter-spacing: 0.18em; line-height: 1.2; }
.pp-band {
  display: flex; align-items: flex-end; flex-wrap: wrap; gap: 8px 14px;
  text-align: left; border-bottom: 2px solid #111; padding-bottom: 6px;
}
.pp-period { font-size: 1.45em; font-weight: 700; white-space: nowrap; }
.pp-box { display: inline-flex; align-items: stretch; height: 30px; border: 1px solid #111; }
.pp-box-label { display: flex; align-items: center; padding: 0 6px; border-right: 1px solid #111; font-size: 0.92em; white-space: nowrap; }
.pp-box-cell { width: 18px; border-right: 1px solid #111; }
.pp-box-cell:last-child { border-right: 0; }
.pp-box-cell.wide { width: 76px; }
.pp-pageno { margin-left: auto; font: italic 700 2.3em/1 'Times New Roman', Georgia, serif; }
.pp-body { display: grid; grid-template-columns: 1fr; }
.pp-col { padding: 4px 0; }
.pp-item { padding: 16px 0 8px; border-bottom: 1px dashed var(--line); }
.pp-col:last-child .pp-item:last-child { border-bottom: 0; }
.pp-stem { line-height: 1.75; margin: 0 0 10px; outline: none; }
.pp-num { font: italic 700 1.25em 'Times New Roman', Georgia, serif; margin-right: 2px; }
.pp-pts { white-space: nowrap; font-size: 0.93em; }
.pp-bogi { border: 1px solid #111; padding: 8px 10px; margin: 6px 0 10px; }
.pp-bogi-label { display: block; text-align: center; font-size: 0.9em; margin-bottom: 4px; }
.pp-fig img { max-width: 100%; height: auto; }
.pp-answer { margin-top: 4px; }
.pp-slot + .pp-slot { margin-top: 10px; }
.pp-choices { display: flex; flex-wrap: wrap; gap: 2px 14px; border: 0; padding: 0; margin: 4px 0; }
.pp-choice { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 8px 0 4px; border-radius: 10px; }
.pp-choice.pick { cursor: pointer; }
.pp-choice.pick:hover { background: var(--bg-soft); }
.pp-radio { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.pp-mark { display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; border-radius: 50%; font-size: 1.1em; }
.pp-choice:has(input:checked) { outline: 2px solid var(--accent); background: var(--accent-soft); }
.pp-choice:has(input:checked) .pp-mark { background: var(--accent); color: #fff; }
.pp-choice:has(input:checked)::after { content: '✓'; font-weight: 700; color: var(--link); }
.pp-choice:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: 2px; }
.pp-short { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.pp-ans-label { font-weight: 600; font-size: 0.93em; }
.pp-short-box { display: inline-block; width: 11em; height: 34px; border: 1.5px solid #111; vertical-align: middle; }
input.pp-short-input { display: inline-block; width: 11em; max-width: 100%; margin: 0; border: 1.5px solid #111; border-radius: 2px; }
.pp-essay { margin: 6px 0; }
.pp-essay .pp-ans-label { display: block; margin-bottom: 4px; }
.pp-essay-box {
  display: block; width: 100%; min-height: 220px; margin: 0;
  border: 1.5px solid #111; border-radius: 2px; padding: 0 10px;
  background: #fff repeating-linear-gradient(transparent 0 31px, #e3e3e8 31px 32px);
  line-height: 32px;
}
textarea.pp-essay-box { resize: vertical; }
.pp-dk {
  min-height: 40px; margin-top: 6px; padding: 0 14px;
  border: 1px dashed var(--muted); border-radius: 999px; background: #fff;
  font: inherit; font-size: 0.88em; color: var(--muted); cursor: pointer;
}
.pp-dk.on { border-style: solid; border-color: var(--warn); color: var(--warn); background: var(--warn-soft); font-weight: 700; }
.pp-sym { margin-top: 6px; }
.pp-work { min-height: 40px; }
.pp-foot { display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 10px; }
.pp-slash {
  position: relative; display: inline-block; width: 54px; height: 24px; border: 1px solid #111;
  /* 선은 왼쪽 아래 → 오른쪽 위 (현재쪽은 왼쪽 위, 전체쪽은 오른쪽 아래) */
  background: linear-gradient(to bottom right, transparent calc(50% - 0.6px), #111 calc(50% - 0.6px), #111 calc(50% + 0.6px), transparent calc(50% + 0.6px));
  font: 0.82em/1 'Times New Roman', Georgia, serif;
}
.pp-slash .a { position: absolute; left: 4px; top: 2px; }
.pp-slash .b { position: absolute; right: 4px; bottom: 2px; }
.pp-credit { font-size: 0.78em; color: #444; }

@media (min-width: 900px) {
  .pp-page { padding: 26px 30px 14px; }
  .pp-area { font-size: 2.4em; }
  .pp-body { grid-template-columns: 1fr 1fr; }
  .pp-col { display: flex; flex-direction: column; padding: 6px 22px 6px 0; }
  .pp-col + .pp-col { border-left: 1px solid #111; padding: 6px 0 6px 22px; }
  .pp-item { flex: 1; display: flex; flex-direction: column; min-height: 380px; border-bottom: 0; }
  .pp-work { flex: 1; min-height: 140px; }
  .pp-foot { flex-direction: row; justify-content: center; position: relative; }
  .pp-credit { position: absolute; right: 0; bottom: 2px; }
}
@media (max-width: 420px) {
  .pp-box-cell { width: 14px; }
  .pp-box-cell.wide { width: 56px; }
  .pp-area { font-size: 1.7em; }
}

/* ---------- 인쇄·PDF 저장 (A4 세로) ---------- */
@page { size: A4 portrait; margin: 10mm 12mm; }
@media print {
  .topbar, .tabbar, .ribbon, .navbar, .testbar, .no-print, .skip, .toast, .offline, .pp-dk, .pp-sym, .pp-essay .small, main > p { display: none !important; }
  html, body { background: #fff; font-size: 10.5pt; }
  main > * { animation: none !important; }
  main, main.exam { max-width: none; margin: 0 !important; padding: 0; }
  .pp-page {
    border: 0; border-radius: 0; box-shadow: none; padding: 0;
    height: 276mm; display: flex; flex-direction: column;
    break-after: page; page-break-after: always;
  }
  .pp-page:last-child { break-after: auto; page-break-after: auto; }
  .pp-print .pp-page + .pp-page { margin-top: 0; }
  .pp-area { font-size: 22pt; }
  .pp-body { grid-template-columns: 1fr 1fr; flex: 1; min-height: 0; }
  .pp-col { display: flex; flex-direction: column; padding: 3mm 5mm 3mm 0; }
  .pp-col + .pp-col { border-left: 1px solid #000; padding: 3mm 0 3mm 5mm; }
  .pp-item { flex: 1; display: flex; flex-direction: column; min-height: 0; border-bottom: 0; padding-top: 3mm; }
  .pp-work { flex: 1; min-height: 0; }
  .pp-essay-box { min-height: 55mm; background: #fff; }
  .pp-choice { min-height: 0; }
  .pp-choice:has(input:checked), .pp-choice:has(input:checked) .pp-mark { outline: 0; background: none; color: inherit; }
  .pp-choice:has(input:checked)::after { content: none; }
  .pp-foot { flex-direction: row; justify-content: center; position: relative; }
  .pp-credit { position: absolute; right: 0; bottom: 2px; }
}
