/* ==========================================================
   exam.css: 1차 CBT, 결과, 오답노트, 2차 답안, 알림, 사용자, 인쇄
   ========================================================== */

/* 머리말: 메뉴 6개 + 알림·사용자 */
.gnb a { padding: 0 12px; font-size: 1rem; }
.gnb a[aria-current="page"]::after { left: 12px; right: 12px; }
.hdr-tools { display: flex; align-items: center; gap: 8px; margin-left: 8px; }
.icon-btn { position: relative; appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--text); width: 42px; height: 42px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }
.bell-count { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .6875rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.profile-chip { appearance: none; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: 999px; padding: 0 14px; height: 42px; font: 700 .9375rem var(--font); cursor: pointer; white-space: nowrap; }
.profile-chip:hover { border-color: var(--primary); color: var(--primary); }
.tabbar-in { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 1180px) and (min-width: 761px) {
  .header-in { gap: 14px; }
  .gnb a { padding: 0 8px; font-size: .9375rem; }
  .gnb a[aria-current="page"]::after { left: 8px; right: 8px; }
  .logo small { display: none; }
}
@media (max-width: 760px) {
  .hdr-tools { margin-left: auto; }
  .profile-chip { height: 38px; padding: 0 12px; font-size: .875rem; }
  .icon-btn { width: 38px; height: 38px; }
}

/* 공통 조각 */
.row-2, .row-3 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 560px) { .row-2, .row-3 { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; margin-top: 26px; }
.check input { width: auto; margin: 0; }
.actions.col { flex-direction: column; align-items: stretch; }
.badge { display: inline-block; font-size: .6875rem; font-weight: 800; padding: 2px 7px; border-radius: 5px; background: var(--primary-soft); color: var(--primary); vertical-align: 1px; white-space: nowrap; }
.badge.bad { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.badge.past { background: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--accent-ink); }
.pos { color: var(--ok); }
.neg { color: var(--danger); }
.fine { font-size: .8125rem; color: var(--text-3); margin: 8px 0 0; }
.prose { color: var(--text-2); line-height: 1.7; }
.section-gap { margin-top: 24px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar select { width: auto; margin: 0; }
.segbtn { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.segbtn button { appearance: none; border: 0; background: none; padding: 7px 12px; border-radius: 8px; font: 600 .875rem var(--font); color: var(--text-2); cursor: pointer; }
.segbtn button.on { background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px rgba(16, 32, 80, .12); }
.segbtn.big { margin-bottom: 20px; }
.segbtn.big button { padding: 10px 20px; font-size: 1rem; }
.kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 16px 0 0; }
.kv div { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.kv dt { font-size: .75rem; color: var(--text-3); }
.kv dd { margin: 2px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; } }
.grid-subj { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.subj-card { border-top: 5px solid var(--c); }
.sc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sc-head h3 { font-size: 1.125rem; margin: 0; }
.score { font-size: .8125rem; font-weight: 800; }
.score.ok { color: var(--ok); } .score.warn { color: var(--warn); } .score.bad { color: var(--danger); }
.sc-facts { margin: 12px 0 16px; display: grid; gap: 6px; }
.sc-facts div { display: flex; justify-content: space-between; gap: 8px; font-size: .875rem; }
.sc-facts dt { color: var(--text-3); }
.sc-facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.law-notes { margin-top: 14px; font-size: .875rem; color: var(--text-2); }
.law-notes summary { cursor: pointer; font-weight: 700; color: var(--text); }
.law-notes li { margin: 6px 0; line-height: 1.6; }
.radios { border: 0; padding: 0; margin: 14px 0 0; display: flex; gap: 6px 18px; flex-wrap: wrap; }
.radios legend { font-size: .875rem; color: var(--text-2); font-weight: 600; margin-bottom: 6px; padding: 0; }
.radios label { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--text); }
.radios input { width: auto; margin: 0; }

/* 가로 막대 */
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hbars li { display: grid; grid-template-columns: minmax(90px, 32%) 1fr auto; gap: 10px; align-items: center; font-size: .875rem; }
.hb-l { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-b { position: relative; height: 10px; background: var(--line-2); border-radius: 5px; overflow: hidden; }
.hb-b i { display: block; height: 100%; background: var(--primary); border-radius: 5px; }
.hb-b i.mid { background: var(--warn); }
.hb-b i.low { background: var(--danger); }
.hb-b.marks { overflow: visible; background: linear-gradient(90deg, transparent calc(40% - 1px), var(--text-3) calc(40% - 1px), var(--text-3) 40%, transparent 40%, transparent calc(60% - 1px), var(--text-3) calc(60% - 1px), var(--text-3) 60%, transparent 60%), var(--line-2); }
.hb-v { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hb-v small { color: var(--text-3); font-weight: 500; }

/* 공부 방법 제안 */
.recs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rec { padding: 10px 12px 10px 14px; border-radius: 8px; background: var(--surface-2); border-left: 4px solid var(--primary); line-height: 1.6; font-size: .9375rem; }
.rec.bad { border-left-color: var(--danger); }
.rec.warn { border-left-color: var(--warn); }
.rec.ok { border-left-color: var(--ok); }
.chips-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips-list li { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 5px 10px; font-size: .875rem; }

/* CBT */
body.focus-mode .tabbar { display: none !important; }
body.focus-mode main { padding-bottom: 0; }
.cbt-bar { position: sticky; top: 0; z-index: 30; background: var(--navy); color: #fff; }
.cbt-bar-in { display: flex; align-items: center; gap: 16px; min-height: 64px; padding-top: 8px; padding-bottom: 8px; flex-wrap: wrap; }
.cbt-title { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; }
.cbt-title strong { font-size: 1.0625rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cbt-title span { font-size: .8125rem; opacity: .75; }
.cbt-time { display: flex; flex-direction: column; align-items: center; padding: 4px 14px; border-radius: 8px; background: rgba(255, 255, 255, .08); }
.cbt-time span { font-size: .6875rem; opacity: .75; }
.cbt-time b { font-size: 1.375rem; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.cbt-time.low b { color: var(--accent); }
.cbt-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; padding-top: 24px; padding-bottom: 40px; align-items: start; }
.cbt-q { min-height: 420px; }
.cbt-no { margin: 0 0 10px; font-size: 1rem; }
.cbt-text { font-size: 1.125rem; line-height: 1.85; font-weight: 500; margin-bottom: 18px; }
.cbt-choices { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.choice { width: 100%; appearance: none; display: flex; gap: 10px; align-items: flex-start; text-align: left; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 10px; padding: 12px 14px; font: 500 1rem/1.7 var(--font); cursor: pointer; }
.choice:hover { border-color: var(--primary); }
.choice.on { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.choice .cn { flex: none; font-weight: 800; color: var(--primary); }
.cbt-nav { display: flex; justify-content: space-between; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.cbt-keys { text-align: center; }
@media (hover: none) { .cbt-keys { display: none; } }
.omr { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; padding: 18px; }
.omr-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.omr-cell { appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); border-radius: 8px; padding: 5px 0; display: flex; flex-direction: column; align-items: center; gap: 1px; cursor: pointer; font: 600 .75rem var(--font); min-height: 44px; }
.omr-cell b { font-size: .9375rem; color: var(--primary); min-height: 1.2em; }
.omr-cell.done { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 40%, transparent); }
.omr-cell.mark { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.omr-cell.cur { outline: 2px solid var(--text); outline-offset: 1px; }
.omr-legend { display: flex; gap: 10px; align-items: center; font-size: .75rem; color: var(--text-3); margin: 12px 0 0; }
.omr-legend .lg { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line); margin-right: -6px; }
.omr-legend .lg.done { background: var(--primary-soft); }
.omr-legend .lg.mark { box-shadow: inset 0 0 0 2px var(--accent); }
.omr-legend .lg.cur { outline: 2px solid var(--text); }
@media (max-width: 960px) {
  .cbt-body { grid-template-columns: 1fr; }
  .omr { position: static; max-height: none; }
  .omr-grid { grid-template-columns: repeat(8, 1fr); }
}
@media (max-width: 560px) {
  .cbt-bar-in { gap: 10px; }
  .cbt-bar .actions { width: 100%; }
  .cbt-bar .actions .btn { flex: 1; }
  .omr-grid { grid-template-columns: repeat(6, 1fr); }
  .cbt-text { font-size: 1.0625rem; }
}

/* 결과 */
.result-sum p { color: var(--text-2); line-height: 1.6; }
.big-score { display: flex; align-items: baseline; gap: 4px; }
.big-score b { font-size: 3.5rem; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.big-score span { font-size: 1.25rem; font-weight: 700; color: var(--text-2); }
.review-list, .wrong-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rv, .wn { border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: 10px; background: var(--surface); }
.rv.bad, .wn { border-left-color: var(--danger); }
.wn.done { border-left-color: var(--ok); opacity: .85; }
.rv summary, .wn summary { cursor: pointer; padding: 12px 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .9375rem; }
.wn summary .tt { flex: 1 1 200px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.wn summary .dt { color: var(--text-3); font-size: .8125rem; }
.wn-topic { font-size: .8125rem; color: var(--text-2); font-weight: 600; }
.rv details > *:not(summary), .wn details > *:not(summary) { margin-left: 14px; margin-right: 14px; }
.rv-q { line-height: 1.8; font-weight: 500; }
.rv-c { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 4px; }
.rv-c li { padding: 6px 10px; border-radius: 6px; line-height: 1.65; font-size: .9375rem; }
.rv-c li.ans { background: color-mix(in srgb, var(--ok) 12%, transparent); }
.rv-c li.mine { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.rv-c .cn { font-weight: 800; margin-right: 6px; }
.rv-exp { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; line-height: 1.7; font-size: .9375rem; }
.wn-edit { margin-top: 4px; }
.wn .actions { margin-bottom: 14px; margin-top: 8px; }
.wn2 { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.wn2 li { border-bottom: 1px solid var(--line-2); padding-bottom: 10px; line-height: 1.6; }
.wn2 p { margin: 4px 0; color: var(--text-2); font-size: .9375rem; }

/* 2차 */
.past-grid th, .past-grid td { text-align: center; }
.past-grid tbody th { text-align: left; white-space: nowrap; }
.cellbtn { appearance: none; border: 1px dashed var(--line); background: none; color: var(--text-3); border-radius: 6px; padding: 6px 8px; font: 600 .8125rem var(--font); cursor: pointer; width: 100%; min-height: 36px; }
.cellbtn.has { border-style: solid; color: var(--ok); background: color-mix(in srgb, var(--ok) 8%, transparent); }
.cellbtn:hover { border-color: var(--primary); color: var(--primary); }
.q2list { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--text); }
.q2row { border-bottom: 1px solid var(--line-2); padding: 16px 2px; }
.q2-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .8125rem; }
.q2-title { font-weight: 700; font-size: 1.0625rem; margin: 8px 0 4px; }
.q2-prev { color: var(--text-2); font-size: .9375rem; margin: 0 0 10px; line-height: 1.6; }
.write-body { display: grid; gap: 16px; padding-bottom: 40px; }
.qbox summary { cursor: pointer; font-weight: 700; }
.qtext { margin-top: 12px; line-height: 1.85; font-size: 1.0625rem; white-space: normal; }
.write textarea { font-size: 1rem; line-height: 1.8; }
.photos { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.photos li { position: relative; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface-2); aspect-ratio: 3 / 4; }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos span { position: absolute; left: 6px; bottom: 6px; background: rgba(14, 27, 61, .75); color: #fff; font-size: .75rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.ph-del { position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border-radius: 999px; border: 0; background: rgba(14, 27, 61, .8); color: #fff; font-size: 1.125rem; cursor: pointer; }
.answer-text { line-height: 1.85; }
pre.outline { white-space: pre-wrap; font: inherit; background: var(--surface-2); border-radius: 8px; padding: 12px 14px; line-height: 1.75; margin: 0; }
.issues { margin: 0 0 12px; padding-left: 1.2em; line-height: 1.7; color: var(--text-2); }
.checklist { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.checklist label { display: flex; gap: 8px; align-items: flex-start; margin: 0; color: var(--text); font-weight: 500; }
.checklist input { width: auto; margin: 4px 0 0; }
.fb-score { font-size: 1.125rem; margin: 0 0 8px; }
.fb-score b { font-size: 1.75rem; color: var(--primary); }
.fb-list { margin: 0; padding-left: 1.2em; line-height: 1.7; }
.fb-list li { margin: 4px 0; }
.fb-list.ok li::marker { color: var(--ok); }
.fb-list.bad li::marker, .fb-list.warn li::marker { color: var(--danger); }
.busy { display: flex; gap: 12px; align-items: center; background: var(--surface-2); border-radius: 10px; padding: 14px; }
.busy p { margin: 0; color: var(--text-2); }
.spin { flex: none; width: 24px; height: 24px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } }

/* 문제 목록, 알림, 사용자 */
.qlist, .notes { list-style: none; margin: 0 0 16px; padding: 0; border-top: 1px solid var(--line); max-height: 60vh; overflow: auto; }
.qlist li, .notes li { border-bottom: 1px solid var(--line-2); }
.qlist button { display: flex; gap: 8px; align-items: center; width: 100%; background: none; border: 0; padding: 11px 2px; text-align: left; cursor: pointer; color: var(--text); }
.qlist .tt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qlist .dt { font-size: .75rem; color: var(--text-3); }
.notes button { display: grid; gap: 2px; width: 100%; background: none; border: 0; padding: 12px 4px; text-align: left; cursor: pointer; color: var(--text-2); }
.notes li.unread button { color: var(--text); }
.notes li.unread b::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); margin-right: 6px; vertical-align: 2px; }
.notes span { font-size: .875rem; }
.notes time { font-size: .75rem; color: var(--text-3); }
.profiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.profile-card { appearance: none; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer; color: var(--text); font: 700 1.125rem var(--font); }
.profile-card:hover, .profile-card.on { border-color: var(--primary); }
.profile-card small { font-size: .75rem; color: var(--primary); font-weight: 600; }
.avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 1.25rem; font-weight: 800; }
.choice-in { display: grid; grid-template-columns: auto auto 1fr; gap: 8px; align-items: center; margin-top: 8px; }
.choice-in input[type="radio"] { width: 20px; height: 20px; margin: 0; }
.choice-in input:not([type]) { margin: 0; }
.choice-in span { font-weight: 800; color: var(--primary); }

/* ---------------- 인쇄 ---------------- */
#print-root { display: none; }
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  body { background: #fff !important; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block; color: #000; font-size: 10.5pt; }
  .pp { font-family: var(--font); }
  .pp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 12px; }
  .pp-head h1 { font-size: 16pt; margin: 2px 0; }
  .pp-head p { margin: 0; font-size: 9pt; }
  .pp-kicker { font-weight: 700; }
  .pp-box { border-collapse: collapse; font-size: 9pt; }
  .pp-box th, .pp-box td { border: 1px solid #000; padding: 3px 8px; text-align: left; }
  .pp-qs { list-style: none; margin: 0; padding: 0; column-count: 2; column-gap: 9mm; column-rule: 1px solid #999; }
  .pq { break-inside: avoid; margin: 0 0 10pt; line-height: 1.55; }
  .pq p { margin: 0 0 4pt; }
  .pq-c { list-style: none; margin: 0; padding: 0 0 0 4pt; }
  .pq-c li { margin: 1pt 0; }
  .pp-omr { break-before: page; }
  .pp-omr table, .pp-key { width: 100%; border-collapse: collapse; font-size: 10pt; }
  .pp-omr td, .pp-key td { border: 1px solid #000; padding: 5px 6px; white-space: nowrap; }
  .pp-exp { padding-left: 0; list-style: none; margin-top: 12pt; }
  .pp-exp li { break-inside: avoid; border-bottom: 1px solid #ccc; padding: 6pt 0; line-height: 1.55; }
  .pp-exp p { margin: 0 0 2pt; }
  .pp-question { border: 1px solid #000; padding: 10pt; line-height: 1.7; white-space: normal; }
  .pp-h { font-size: 12pt; margin: 14pt 0 6pt; }
  .pp-pre { white-space: pre-wrap; font-family: inherit; margin: 0; line-height: 1.6; }
  .pp-answer { line-height: 1.8; }
  .pp-sheet { break-before: page; }
  .pp-sheet:first-of-type { break-before: auto; }
  .pp-lines .ln { height: 9.6mm; border-bottom: 1px solid #888; }
  .fine { color: #333; }
}
