:root { --ink: #141414; --paper: #fff; --bg: #d9d8d2; --muted: #666; --pen: #1c3f94; --red: #d8262b; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'Nanum Myeongjo', serif; -webkit-font-smoothing: antialiased; }
.loading { text-align: center; padding: 120px 16px; font-size: 18px; color: #555; }
.paper { background: var(--paper); max-width: 1060px; margin: 28px auto 40px; padding: 34px 52px 44px; box-shadow: 0 1px 0 #bbb, 0 10px 30px rgba(0,0,0,.16); position: relative; }
.paper.narrow { max-width: 720px; }

.paper-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 12px; padding-bottom: 8px; }
.ph-left { justify-self: start; }
.ph-right { justify-self: end; }
.period { display: inline-block; border: 2px solid var(--ink); border-radius: 18px; padding: 5px 16px; font-weight: 800; font-size: 17px; }
.ptype { display: inline-block; border: 2px solid var(--ink); padding: 4px 12px; font-weight: 800; font-size: 17px; }
.ph-center { text-align: center; }
.ph-title { font-size: 16px; font-weight: 700; letter-spacing: .03em; margin-bottom: 4px; }
.ph-subject { font-size: 46px; font-weight: 800; letter-spacing: .2em; line-height: 1.15; padding-left: .2em; }
.rule { border-top: 4px solid var(--ink); border-bottom: 1px solid var(--ink); height: 5px; }

.info-row { display: flex; gap: 22px; justify-content: flex-end; align-items: baseline; font-size: 14px; margin: 8px 0 22px; flex-wrap: wrap; }
.info-row .val { border-bottom: 1px solid var(--ink); padding: 0 12px; min-width: 90px; display: inline-block; }
.pen { font-family: 'Nanum Pen Script', cursive; color: var(--pen); }
.info-row .pen { font-size: 24px; line-height: 1; }

.cols { column-count: 2; column-gap: 56px; column-rule: 1px solid #333; font-size: 16.5px; line-height: 1.75; }
.q { break-inside: avoid; margin: 0 0 32px; }
.q-text { margin: 0 0 6px; }
.qno { font-weight: 800; margin-right: 3px; }
.pts { font-weight: 700; white-space: nowrap; }
.passage { border: 1px solid var(--ink); padding: 10px 16px; margin: 10px 0; font-size: 15px; line-height: 1.8; }
.passage .box-title { display: block; text-align: center; margin-bottom: 2px; }
.q.unanswered-flash { animation: flash 1.2s ease; }
@keyframes flash { 0%,100% { background: transparent; } 30% { background: #fff1a8; } }

.choices { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 2px 10px; }
.choices li { flex: 1 1 45%; min-width: 0; }
.choice { all: unset; cursor: pointer; display: flex; gap: 8px; align-items: flex-start; padding: 3px 6px; border-radius: 4px; width: 100%; box-sizing: border-box; font: inherit; line-height: 1.6; }
.choice:hover { background: #f1f1ec; }
.choice:focus-visible { outline: 2px solid var(--pen); }
.cn { flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; margin-top: 3px; border: 1.5px solid var(--ink); border-radius: 50%; font-size: 12.5px; font-family: 'Noto Sans KR', sans-serif; }
.choice.on .cn { background: var(--ink); color: #fff; }

.short { display: flex; align-items: baseline; gap: 10px; margin-top: 8px; }
.short input { flex: 1; min-width: 0; border: 0; border-bottom: 1.5px solid var(--ink); background: transparent; font-family: 'Nanum Pen Script', cursive; font-size: 28px; color: var(--pen); padding: 0 6px; outline: none; }
.short input:focus { border-bottom-color: var(--pen); background: #f7f8fd; }
.essay { display: block; width: 100%; margin-top: 8px; border: 1px solid #888; resize: vertical; min-height: 160px; outline: none;
  background-color: #fff; background-image: linear-gradient(transparent 31px, #cfcfcf 32px); background-size: 100% 32px; background-attachment: local;
  line-height: 32px; padding: 0 10px; font-family: 'Nanum Pen Script', cursive; font-size: 25px; color: var(--pen); }
.essay:focus { border-color: var(--pen); }
.counter { text-align: right; font-size: 12px; color: var(--muted); font-family: 'Noto Sans KR', sans-serif; }

.paper-foot { margin-top: 18px; text-align: center; }
.pageno { display: inline-block; border: 1.5px solid var(--ink); padding: 1px 14px; font-weight: 800; }
.foot-note { font-size: 12px; color: var(--muted); margin-top: 10px; }
.end-mark { text-align: center; font-weight: 800; font-size: 15px; margin: 6px 0 0; letter-spacing: .1em; }

.btn { font: inherit; font-weight: 800; font-size: 17px; padding: 13px 38px; border: 2px solid var(--ink); background: #fff; color: var(--ink); cursor: pointer; }
.btn:hover { background: var(--ink); color: #fff; }
.btn.small { font-size: 15px; padding: 9px 22px; }
.btn.ghost { border-color: #999; color: #555; }
.btn.ghost:hover { background: #eee; color: var(--ink); }
.btn[disabled] { opacity: .5; cursor: wait; }
.center { text-align: center; }
.mt { margin-top: 30px; }

/* cover */
.notice-box { border: 2px solid var(--ink); padding: 16px 24px; margin: 26px 0; line-height: 2; }
.notice-title { font-weight: 800; font-size: 17px; margin-bottom: 4px; }
.idtable { width: 100%; border-collapse: collapse; margin: 22px 0; font-size: 16px; }
.idtable th, .idtable td { border: 1.5px solid var(--ink); padding: 10px 14px; }
.idtable th { width: 160px; background: #f3f3ef; font-weight: 800; letter-spacing: .3em; }
.idtable input { width: 100%; border: 0; outline: none; font-family: 'Nanum Pen Script', cursive; font-size: 30px; color: var(--pen); background: transparent; }
.err { color: var(--red); font-family: 'Noto Sans KR', sans-serif; font-size: 14px; min-height: 20px; margin-top: 6px; }
.big-msg { font-size: 30px; font-weight: 800; margin: 40px 0 16px; }
.sub-msg { color: #444; line-height: 1.9; }

/* timer */
.timer { position: fixed; top: 12px; right: 12px; z-index: 20; background: var(--ink); color: #fff; padding: 8px 14px; font-family: 'Noto Sans KR', sans-serif; font-size: 15px; font-variant-numeric: tabular-nums; border-radius: 4px; }
.timer.warn { background: var(--red); }

/* OMR modal */
.modal-back { position: fixed; inset: 0; background: rgba(20,20,20,.55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.omr { background: #fff; width: min(720px, 100%); max-height: calc(100vh - 32px); overflow: auto; border: 2px solid var(--red); }
.omr-head { background: var(--red); color: #fff; padding: 12px 18px; font-weight: 800; font-size: 18px; letter-spacing: .1em; display: flex; justify-content: space-between; align-items: center; }
.omr-body { padding: 16px 18px; }
.omr-id { display: flex; gap: 10px; align-items: center; border: 1.5px solid var(--red); padding: 8px 12px; margin-bottom: 14px; }
.omr-id label { color: var(--red); font-weight: 800; white-space: nowrap; }
.omr-id input { flex: 1; min-width: 0; border: 0; outline: none; font-family: 'Nanum Pen Script', cursive; font-size: 28px; color: var(--pen); }
.omr-row { display: grid; grid-template-columns: 52px 1fr; border: 1px solid #f0b4b4; border-top: 0; }
.omr-row:first-of-type { border-top: 1px solid #f0b4b4; }
.omr-no { background: #fdeaea; color: var(--red); font-weight: 800; display: grid; place-items: center; font-family: 'Noto Sans KR', sans-serif; }
.omr-ans { padding: 6px 12px; display: flex; gap: 10px; align-items: center; min-height: 44px; overflow: hidden; }
.omr-ans .pen { font-size: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bub { width: 22px; height: 30px; border: 1.5px solid var(--red); border-radius: 50%; display: grid; place-items: center; font-size: 11px; color: var(--red); font-family: 'Noto Sans KR', sans-serif; }
.bub.on { background: var(--ink); border-color: var(--ink); color: var(--ink); }
.omr-ans .none { color: var(--red); font-family: 'Noto Sans KR', sans-serif; font-size: 13px; }
.omr-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid #eee; flex-wrap: wrap; }
.omr-warn { color: var(--red); font-family: 'Noto Sans KR', sans-serif; font-size: 14px; margin: 10px 0 0; }

#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 99; display: grid; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 6px; font-family: 'Noto Sans KR', sans-serif; font-size: 14px; transition: opacity .3s; }
.toast.err { background: var(--red); }
.toast.out { opacity: 0; }

@media (max-width: 760px) {
  .paper { margin: 0; padding: 20px 16px 32px; box-shadow: none; }
  .paper-head { grid-template-columns: auto 1fr auto; gap: 6px; }
  .period, .ptype { font-size: 12px; padding: 3px 8px; }
  .ph-title { font-size: 11.5px; }
  .ph-subject { font-size: 28px; letter-spacing: .1em; }
  .cols { column-count: 1; font-size: 16px; }
  .choices li { flex-basis: 100%; }
  .idtable th { width: 96px; letter-spacing: .05em; }
  .info-row { justify-content: flex-start; }
}
