/* =========================================================================
   기사 기출 분석 · 예상문제 — 스타일시트
   토큰 → 리셋 → 레이아웃 → 컴포넌트 → 화면별 → 반응형 → 인쇄
   ========================================================================= */

/* ---------- 1. 디자인 토큰 ---------- */
:root {
  --bg:            #f6f7f9;
  --bg-elev:       #ffffff;
  --bg-sunken:     #eef0f4;
  --bg-hover:      #f0f2f6;
  --border:        #dfe3ea;
  --border-strong: #c6ccd8;
  --text:          #16191f;
  --text-muted:    #5b6472;
  --text-faint:    #868e9c;

  --accent:        #1f6feb;
  --accent-hover:  #175bc4;
  --accent-soft:   #e8f0fe;
  --accent-text:   #ffffff;

  --ok:            #197a4b;
  --ok-soft:       #e3f5ea;
  --warn:          #9a6400;
  --warn-soft:     #fdf3dd;
  --bad:           #c0392f;
  --bad-soft:      #fdeceb;

  --heat-0:  #eef1f6;
  --heat-1:  #dbe7fb;
  --heat-2:  #b9d2f7;
  --heat-3:  #8fb7f0;
  --heat-4:  #5f96e6;
  --heat-5:  #2f6fd0;

  --radius:    10px;
  --radius-sm: 7px;
  --radius-lg: 16px;
  --shadow:    0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .06);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .07);

  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px;

  --font: "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI",
          "Malgun Gothic", "Apple SD Gothic Neo", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;

  --header-h: 56px;
  --wrap: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] { color-scheme: dark; }
}
:root[data-theme="dark"] { color-scheme: dark; }

:root[data-theme="dark"],
:root[data-theme="auto"] {
  /* 라이트 값은 위에서 이미 정의됨 — 다크는 아래 미디어/속성 블록에서 덮어씀 */
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg:            #0f1216;
    --bg-elev:       #171b21;
    --bg-sunken:     #12161b;
    --bg-hover:      #1f242c;
    --border:        #2a3038;
    --border-strong: #3a424d;
    --text:          #e7eaef;
    --text-muted:    #a2acba;
    --text-faint:    #79838f;

    --accent:        #4d90f0;
    --accent-hover:  #689fef;
    --accent-soft:   #16283f;
    --accent-text:   #0b1017;

    --ok:            #4cc38a;
    --ok-soft:       #10261c;
    --warn:          #e0b252;
    --warn-soft:     #2a2213;
    --bad:           #f2726a;
    --bad-soft:      #2e1717;

    --heat-0:  #1a1f26;
    --heat-1:  #1c2c44;
    --heat-2:  #22406b;
    --heat-3:  #2b5793;
    --heat-4:  #3a72bd;
    --heat-5:  #5b95e0;

    --shadow:    0 1px 2px rgba(0, 0, 0, .5), 0 6px 20px rgba(0, 0, 0, .35);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .45);
  }
}

:root[data-theme="dark"] {
  --bg:            #0f1216;
  --bg-elev:       #171b21;
  --bg-sunken:     #12161b;
  --bg-hover:      #1f242c;
  --border:        #2a3038;
  --border-strong: #3a424d;
  --text:          #e7eaef;
  --text-muted:    #a2acba;
  --text-faint:    #79838f;

  --accent:        #4d90f0;
  --accent-hover:  #689fef;
  --accent-soft:   #16283f;
  --accent-text:   #0b1017;

  --ok:            #4cc38a;
  --ok-soft:       #10261c;
  --warn:          #e0b252;
  --warn-soft:     #2a2213;
  --bad:           #f2726a;
  --bad-soft:      #2e1717;

  --heat-0:  #1a1f26;
  --heat-1:  #1c2c44;
  --heat-2:  #22406b;
  --heat-3:  #2b5793;
  --heat-4:  #3a72bd;
  --heat-5:  #5b95e0;

  --shadow:    0 1px 2px rgba(0, 0, 0, .5), 0 6px 20px rgba(0, 0, 0, .35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .45);
}

/* ---------- 2. 리셋 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  word-break: keep-all;
  overflow-wrap: anywhere;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.35; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.18rem; }
h3 { font-size: 1.02rem; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { max-width: 100%; }
table { border-collapse: collapse; width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--accent-text);
  padding: var(--s2) var(--s4); border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* ---------- 3. 레이아웃 ---------- */
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--s4); }
.view { flex: 1 0 auto; padding-top: var(--s5); padding-bottom: var(--s7); }

.app-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
}
.brand { display: flex; align-items: center; gap: var(--s2); color: var(--text); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px; background: var(--accent);
  color: #fff; display: grid; place-items: center; font-size: 14px; flex: 0 0 auto;
}
.brand-text { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-actions { display: flex; align-items: center; gap: var(--s2); }

.exam-nav { border-top: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.exam-nav::-webkit-scrollbar { display: none; }
.exam-nav-inner { display: flex; gap: var(--s1); min-height: 44px; align-items: stretch; }
.exam-nav a {
  display: flex; align-items: center; padding: 0 var(--s3);
  color: var(--text-muted); font-size: 14px; font-weight: 500;
  white-space: nowrap; border-bottom: 2px solid transparent;
}
.exam-nav a:hover { color: var(--text); text-decoration: none; background: var(--bg-hover); }
.exam-nav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }

.app-footer {
  flex: 0 0 auto; border-top: 1px solid var(--border);
  background: var(--bg-elev); padding: var(--s5) 0; margin-top: auto;
}
.footnote { font-size: 12.5px; color: var(--text-faint); line-height: 1.7; }

/* ---------- 4. 공통 컴포넌트 ---------- */
.card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--s4); box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: var(--s3); }
.card-pad-lg { padding: var(--s5); }

.stack { display: flex; flex-direction: column; gap: var(--s4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--s2); }
.row { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.spacer { flex: 1 1 auto; }
.grid { display: grid; gap: var(--s3); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.page-head { margin-bottom: var(--s5); }
.page-head .eyebrow { font-size: 12.5px; color: var(--text-faint); font-weight: 500; letter-spacing: .02em; }
.page-head .lede { color: var(--text-muted); margin-top: var(--s2); font-size: 14px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); flex-wrap: wrap; }
.section-head .hint { font-size: 12.5px; color: var(--text-faint); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 15px; min-height: 40px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg-elev); color: var(--text);
  font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background .12s ease, border-color .12s ease, transform .06s ease;
  text-decoration: none;
}
.btn:hover { background: var(--bg-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 700; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--bg-hover); }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.btn-lg { min-height: 48px; padding: 12px 22px; font-size: 15.5px; }
.btn-block { width: 100%; }

.icon-btn {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-elev);
  display: grid; place-items: center; cursor: pointer; font-size: 16px;
}
.icon-btn:hover { background: var(--bg-hover); }
.icon-btn.is-on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  background: var(--bg-sunken); color: var(--text-muted); border: 1px solid var(--border);
  white-space: nowrap; line-height: 1.7;
}
.badge-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge-ok   { background: var(--ok-soft);   color: var(--ok);   border-color: transparent; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-bad  { background: var(--bad-soft);  color: var(--bad);  border-color: transparent; }

.tag {
  display: inline-flex; align-items: center; padding: 2px 9px;
  border-radius: 999px; font-size: 12px; background: var(--bg-sunken);
  color: var(--text-muted); border: 1px solid var(--border);
}
a.tag:hover { background: var(--accent-soft); color: var(--accent); border-color: transparent; text-decoration: none; }

.notice {
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  background: var(--bg-elev); border-radius: var(--radius-sm);
  padding: var(--s3) var(--s4); font-size: 13.5px; color: var(--text-muted);
}
.notice strong { color: var(--text); }
.notice.warn  { border-left-color: var(--warn); background: var(--warn-soft); color: var(--text); }
.notice.error { border-left-color: var(--bad);  background: var(--bad-soft);  color: var(--text); }

.empty {
  text-align: center; padding: var(--s7) var(--s4); color: var(--text-muted);
  border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--bg-elev);
}
.empty .empty-title { font-weight: 700; color: var(--text); margin-bottom: var(--s2); }
.empty .empty-icon { font-size: 26px; opacity: .5; display: block; margin-bottom: var(--s2); }

.stat {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--s3) var(--s4);
}
.stat .stat-label { font-size: 12px; color: var(--text-faint); font-weight: 500; }
.stat .stat-value { font-size: 1.55rem; font-weight: 700; line-height: 1.25; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .stat-sub { font-size: 12px; color: var(--text-muted); }
.stat.ok  .stat-value { color: var(--ok); }
.stat.bad .stat-value { color: var(--bad); }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 13px; font-weight: 500; color: var(--text-muted); }
select, input[type="text"], input[type="search"], input[type="number"], textarea {
  padding: 9px 11px; min-height: 40px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--bg-elev); color: var(--text); width: 100%;
}
textarea { min-height: 120px; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.5; }
.check { display: flex; align-items: center; gap: var(--s2); font-size: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); flex: 0 0 auto; margin: 0; }

.progress { height: 6px; border-radius: 999px; background: var(--bg-sunken); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .2s ease; }
.progress.ok  > span { background: var(--ok); }
.progress.bad > span { background: var(--bad); }

.data-table { font-size: 13.5px; }
.data-table th, .data-table td { padding: 9px var(--s3); text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { font-size: 12px; color: var(--text-faint); font-weight: 700; white-space: nowrap; }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tbody tr:hover { background: var(--bg-hover); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.toast-root {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 90; display: flex; flex-direction: column; gap: var(--s2); pointer-events: none;
  width: max-content; max-width: calc(100vw - 32px);
}
.toast {
  background: #1c2128; color: #fff; padding: 10px 16px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow); font-size: 13.5px; animation: toast-in .18s ease;
}
.toast.err { background: var(--bad); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.skeleton-page { display: flex; flex-direction: column; gap: var(--s3); }
.sk { background: var(--bg-sunken); border-radius: var(--radius-sm); animation: sk 1.3s ease-in-out infinite; }
.sk-title { height: 30px; width: 45%; }
.sk-line { height: 15px; width: 100%; }
.sk-line.short { width: 60%; }
@keyframes sk { 50% { opacity: .45; } }
.loading-inline { color: var(--text-muted); font-size: 13.5px; padding: var(--s5); text-align: center; }

.crumbs { font-size: 12.5px; color: var(--text-faint); margin-bottom: var(--s2); }
.crumbs a { color: var(--text-muted); }

/* ---------- 5. 문항 카드 ---------- */
.q-card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--s4); box-shadow: var(--shadow-sm);
}
.q-head { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s3); }
.q-no {
  font-weight: 700; font-size: 13px; color: var(--accent);
  background: var(--accent-soft); border-radius: var(--radius-sm); padding: 2px 9px;
}
.q-stem { font-size: 15.5px; line-height: 1.75; margin-bottom: var(--s3); }
.q-figure { margin: var(--s3) 0; }
.q-figure img {
  display: block; max-width: min(100%, 420px); border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: #fff; padding: var(--s2);
}
.choices { display: flex; flex-direction: column; gap: var(--s2); }
.choice {
  display: flex; align-items: flex-start; gap: var(--s3); width: 100%; text-align: left;
  padding: 11px var(--s3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-elev); cursor: pointer; line-height: 1.6;
  transition: background .1s ease, border-color .1s ease;
}
.choice:hover { background: var(--bg-hover); }
.choice .ch-num {
  flex: 0 0 auto; width: 23px; height: 23px; border-radius: 50%;
  border: 1.5px solid var(--border-strong); display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: var(--text-muted); margin-top: 1px;
}
.choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.choice[aria-pressed="true"] .ch-num { background: var(--accent); border-color: var(--accent); color: #fff; }
.choice.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.choice.is-correct .ch-num { background: var(--ok); border-color: var(--ok); color: #fff; }
.choice.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.choice.is-wrong .ch-num { background: var(--bad); border-color: var(--bad); color: #fff; }
.choice-mark { margin-left: auto; font-size: 12px; font-weight: 700; flex: 0 0 auto; }
.choice.is-correct .choice-mark { color: var(--ok); }
.choice.is-wrong .choice-mark { color: var(--bad); }

.q-meta {
  margin-top: var(--s3); padding-top: var(--s3); border-top: 1px dashed var(--border);
  font-size: 12.5px; color: var(--text-faint); display: flex; flex-wrap: wrap;
  gap: var(--s2) var(--s3); align-items: center;
}
.explain {
  margin-top: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--radius-sm);
  background: var(--bg-sunken); font-size: 14px; line-height: 1.75;
}
.explain h4 { font-size: 12.5px; color: var(--text-faint); margin-bottom: var(--s1); }
.dup-links { margin-top: var(--s2); font-size: 13px; color: var(--text-muted); }

/* ---------- 6. 응시 화면 ---------- */
.exam-layout { display: grid; grid-template-columns: minmax(0, 1fr) 264px; gap: var(--s4); align-items: start; }
.omr-panel { position: sticky; top: calc(var(--header-h) + var(--s3)); }
.omr-box {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--s3); box-shadow: var(--shadow-sm);
}
.omr-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-top: var(--s2); }
.omr-cell {
  aspect-ratio: 1; min-height: 30px; border-radius: 5px; border: 1px solid var(--border);
  background: var(--bg-elev); font-size: 11.5px; cursor: pointer;
  display: grid; place-items: center; font-variant-numeric: tabular-nums; padding: 0;
  color: var(--text-muted);
}
.omr-cell:hover { background: var(--bg-hover); }
.omr-cell.answered { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.omr-cell.flagged { box-shadow: inset 0 0 0 2px var(--warn); }
.omr-cell.current { outline: 2px solid var(--text); outline-offset: 1px; }
.omr-cell.correct { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); font-weight: 700; }
.omr-cell.wrong { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); font-weight: 700; }
.omr-subject-label {
  font-size: 11.5px; color: var(--text-faint); font-weight: 700;
  margin-top: var(--s3); padding-top: var(--s2); border-top: 1px solid var(--border);
}
.omr-subject-label:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.timer-bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--s3) var(--s4); margin-bottom: var(--s3); box-shadow: var(--shadow-sm);
}
.timer-clock { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.timer-clock.urgent { color: var(--bad); }
.timer-label { font-size: 11.5px; color: var(--text-faint); }
.exam-progress { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.exam-footer-nav {
  display: flex; gap: var(--s2); margin-top: var(--s4); align-items: center;
}
.mobile-omr-toggle { display: none; }

/* ---------- 7. 단원 트리 ---------- */
.tree-subject + .tree-subject { margin-top: var(--s3); }
.tree-major { border-top: 1px solid var(--border); }
.tree-major:first-child { border-top: 0; }
.tree-major > summary {
  cursor: pointer; padding: 10px var(--s2); display: flex; align-items: center;
  gap: var(--s3); list-style: none; font-weight: 500;
}
.tree-major > summary::-webkit-details-marker { display: none; }
.tree-major > summary::before {
  content: "▸"; color: var(--text-faint); font-size: 11px; transition: transform .15s ease; flex: 0 0 auto;
}
.tree-major[open] > summary::before { transform: rotate(90deg); }
.tree-major > summary:hover { background: var(--bg-hover); }
.leaf-list { padding: 0 0 var(--s2) var(--s5); display: flex; flex-direction: column; gap: 2px; }
.leaf-row {
  display: flex; align-items: center; gap: var(--s3); padding: 7px var(--s2);
  border-radius: var(--radius-sm); color: var(--text); font-size: 14px;
}
.leaf-row:hover { background: var(--bg-hover); text-decoration: none; }
.leaf-name { flex: 1 1 auto; min-width: 0; }
.leaf-metrics { display: flex; align-items: center; gap: var(--s2); flex: 0 0 auto; }
.mini-bar { width: 54px; height: 5px; border-radius: 999px; background: var(--bg-sunken); overflow: hidden; }
.mini-bar > span { display: block; height: 100%; background: var(--accent); }
.count-chip {
  font-size: 11.5px; color: var(--text-faint); font-variant-numeric: tabular-nums;
  min-width: 46px; text-align: right;
}

/* ---------- 8. 히트맵 / 차트 ---------- */
.heatmap { display: grid; gap: 3px; font-size: 11px; }
.hm-cell {
  min-height: 26px; border-radius: 4px; display: grid; place-items: center;
  font-variant-numeric: tabular-nums; color: var(--text); cursor: default;
}
.hm-cell[data-lv="0"] { background: var(--heat-0); color: var(--text-faint); }
.hm-cell[data-lv="1"] { background: var(--heat-1); }
.hm-cell[data-lv="2"] { background: var(--heat-2); }
.hm-cell[data-lv="3"] { background: var(--heat-3); }
.hm-cell[data-lv="4"] { background: var(--heat-4); color: #fff; }
.hm-cell[data-lv="5"] { background: var(--heat-5); color: #fff; }
.hm-rowlabel {
  font-size: 12px; color: var(--text-muted); display: flex; align-items: center;
  padding-right: var(--s2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hm-collabel { font-size: 11px; color: var(--text-faint); text-align: center; font-weight: 500; }
.hm-legend { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--text-faint); }
.hm-legend i { width: 16px; height: 12px; border-radius: 3px; display: inline-block; }
.chart-box { position: relative; height: 260px; }

/* ---------- 9. 화면별 ---------- */
.exam-card { display: block; color: inherit; }
.exam-card:hover { text-decoration: none; border-color: var(--accent); }
.tile-link {
  display: flex; flex-direction: column; gap: 4px; color: inherit;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--s4); box-shadow: var(--shadow-sm); transition: border-color .12s, transform .06s;
}
.tile-link:hover { text-decoration: none; border-color: var(--accent); }
.tile-link:active { transform: translateY(1px); }
.tile-title { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: var(--s2); }
.tile-desc { font-size: 13px; color: var(--text-muted); }

.round-row {
  display: flex; align-items: center; gap: var(--s3); padding: var(--s3);
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev);
  color: inherit;
}
.round-row:hover { text-decoration: none; border-color: var(--accent); }
.round-title { font-weight: 700; font-variant-numeric: tabular-nums; }

.result-hero { text-align: center; padding: var(--s6) var(--s4); }
.result-verdict { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; }
.result-verdict.pass { color: var(--ok); }
.result-verdict.fail { color: var(--bad); }
.result-score { font-size: 3.2rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }

.filter-bar { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: flex-end; }
.filter-bar .field { min-width: 150px; flex: 1 1 auto; }

.katex { font-size: 1.03em; }
.katex-display { margin: .6em 0; overflow-x: auto; overflow-y: hidden; }

/* ---------- 10. 반응형 ---------- */
@media (max-width: 900px) {
  .exam-layout { grid-template-columns: minmax(0, 1fr); }
  .omr-panel {
    position: fixed; inset: auto 0 0 0; z-index: 50; max-height: 62vh; overflow-y: auto;
    background: var(--bg-elev); border-top: 1px solid var(--border);
    box-shadow: 0 -6px 24px rgba(0,0,0,.16); padding: var(--s3);
    transform: translateY(100%); transition: transform .2s ease;
  }
  .omr-panel.open { transform: translateY(0); }
  .omr-box { border: 0; box-shadow: none; padding: 0; }
  .omr-grid { grid-template-columns: repeat(10, 1fr); }
  .mobile-omr-toggle { display: inline-flex; }
  .view { padding-bottom: 84px; }
}
@media (max-width: 620px) {
  body { font-size: 14.5px; }
  h1 { font-size: 1.3rem; }
  .wrap { padding: 0 var(--s3); }
  .card, .q-card { padding: var(--s3); }
  .result-score { font-size: 2.6rem; }
  .brand-text { display: none; }
  .omr-grid { grid-template-columns: repeat(8, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- 11. 인쇄 ---------- */
@media print {
  .app-header, .app-footer, .omr-panel, .btn, .toast-root { display: none !important; }
  body { background: #fff; }
  .card, .q-card { break-inside: avoid; box-shadow: none; }
}

/* --- 후속 보강 --- */
.choice .ch-body { flex: 1 1 auto; min-width: 0; }
.choice .ch-body img { display: block; margin-top: 8px; max-height: 140px; }
.choice[disabled] { cursor: default; opacity: 1; }
.q-head .spacer { flex: 1 1 auto; }
.exam-nav-link { white-space: nowrap; }

/* ---------- 12. 보강 2: 신규 화면 클래스 ---------- */

/* 보기 그림(이미지 전용 보기 포함) */
.ch-figure {
  display: block; max-width: 100%; max-height: 150px;
  margin: 2px 0; border-radius: var(--radius-sm); background: #fff;
}
.choice.is-figure .ch-body { display: flex; align-items: center; min-height: 40px; }
.muted { color: var(--text-faint); }

/* '분류 중' 등 흐린 태그 */
.tag-muted {
  background: transparent; color: var(--text-faint);
  border: 1px dashed var(--border-strong);
}
a.tag-muted:hover { background: var(--bg-hover); color: var(--text-muted); border-color: var(--border-strong); }

/* 검색어 하이라이트 */
mark { background: var(--warn-soft); color: var(--text); padding: 0 2px; border-radius: 3px; }

/* 접근성 전용 텍스트 */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* 목록에서 펼쳐보는 문항 슬롯 */
.peek-slot { margin: var(--s2) 0 var(--s3); }
.peek-slot:empty { display: none; }
.peek-slot > .q-card { margin: 0; }

/* 예상문제 해설 블록 */
.q-explain {
  margin-top: var(--s3); padding: var(--s3) var(--s4);
  background: var(--bg-sunken); border-radius: var(--radius);
  font-size: 14px; line-height: 1.75;
}
.q-explain h4 { font-size: 12.5px; color: var(--text-faint); margin: 0 0 var(--s1); }

/* 데이터 고지 블록 */
.notice-block { border-left: 3px solid var(--accent); }
.notice-block h2, .notice-block h3 { margin-top: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--s2) var(--s4); margin: 0 0 var(--s3); }
.kv dt { color: var(--text-faint); font-size: 12.5px; }
.kv dd { margin: 0; font-size: 13.5px; }

/* 단원 트리 보강 */
.tree-subject-head { padding: var(--s2) var(--s2) var(--s3); }
.tree-major-name { flex: 1 1 auto; min-width: 0; }
.leaf-row-self { font-weight: 500; }
.leaf-acc {
  font-size: 11.5px; color: var(--text-faint);
  font-variant-numeric: tabular-nums; min-width: 34px; text-align: right;
}

/* 히트맵이 길어질 때 */
.chart-tall { height: 420px; }

/* 모의고사: 연도별 회차 그룹 */
.year-group { border-top: 1px solid var(--border); }
.year-group:first-child { border-top: 0; }
.year-group > summary {
  cursor: pointer; list-style: none; padding: 10px var(--s2);
  display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap;
}
.year-group > summary::-webkit-details-marker { display: none; }
.year-group > summary::before {
  content: "▸"; color: var(--text-faint); font-size: 11px;
  transition: transform .15s ease; flex: 0 0 auto;
}
.year-group[open] > summary::before { transform: rotate(90deg); }
.year-group > summary:hover { background: var(--bg-hover); }
.year-name { font-weight: 600; font-variant-numeric: tabular-nums; }
.year-body { padding: 0 0 var(--s2) var(--s5); }

@media (max-width: 620px) {
  .kv { grid-template-columns: 1fr; gap: 2px var(--s3); }
  .kv dd { margin-bottom: var(--s2); }
  .year-body { padding-left: var(--s3); }
  .chart-tall { height: 320px; }
}

/* 원출처에 보기가 빠진 문항 안내 */
.q-broken {
  margin: var(--s3) 0 0;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.6;
}
.q-broken a { color: inherit; text-decoration: underline; }

/* 세세항목 나열(태깅 단계 아래) */
.leaf-row-tagged { flex-wrap: wrap; }
.leaf-row-tagged .leaf-sub { flex-basis: 100%; margin: 4px 0 0; opacity: .8; }
