/* ===== 공인중개사 기출 학습기 ===== */
:root {
  color-scheme: light dark;
  --action: #1f6b5a;
  --on-action: #fbfbf7;
  --on-status: #fbfbf7;
  --surface-soft: #eceee7;
  --track: #e3e6dd;
  --control-border: #b9bfb4;
  --nav-bg: rgba(251,251,247,.86);
  --info: #2b6178;
  --info-soft: #dfeaee;
  --star: #7a5c14;
  --icon-filter: grayscale(1);
  --icon-active-filter: brightness(0) saturate(100%) invert(31%) sepia(19%) saturate(1500%) hue-rotate(115deg) brightness(95%) contrast(92%);
  --on-action-filter: brightness(0) invert(1);
  --bg: #f3f4ef;
  --card: #fbfbf7;
  --ink: #1f2622;
  --ink-2: #4c5650;
  --ink-3: #5f6962;
  --line: #dde0d7;
  --brand: #1f6b5a;
  --brand-2: #1f6b5a;
  --brand-soft: #dcebe3;
  --ok: #1f6b5a;
  --ok-soft: #dcebe3;
  --bad: #9c4a2f;
  --bad-soft: #f6e6dd;
  --warn: #7a5c14;
  --warn-soft: #f3ead0;
  --mark: #f1e0a6;
  --ring: rgba(31,38,34,.07);
  --shell: rgba(31,38,34,.045);
  --shadow: 0 1px 2px rgba(31,80,66,.05), 0 16px 40px -28px rgba(31,80,66,.28);
  --bezel: 0 0 0 1px var(--ring), 0 0 0 6px var(--shell), 0 24px 56px -36px rgba(31,80,66,.3);
  --qimg-filter: none;
  --qimg-phone-filter: contrast(1.2);
  --qimg-blend: multiply;
  --spring: cubic-bezier(.16,1,.3,1);
  --radius: 16px;
  --tab-h: 62px;
  --maxw: 720px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
@font-face {
  font-family: "Pretendard Variable";
  src: url("fonts/PretendardVariable.woff2") format("woff2");
  font-weight: 45 920;
  font-display: swap;
}
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", system-ui, sans-serif;
  line-height: 1.55;
  letter-spacing: -.012em;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}
select, input, textarea { accent-color: var(--brand); }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

.app {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 16px calc(var(--tab-h) + 24px);
  min-height: 100vh;
}
.loading { text-align: center; padding: 40vh 0; color: var(--ink-3); }

/* ===== 공통 헤더 ===== */
.app-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
  padding: 18px 2px 12px;
  display: flex; align-items: center; gap: 12px;
}
.app-header h1 { font-size: 20px; margin: 0; font-weight: 800; letter-spacing: -.02em; }
.app-header .sub { color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.h-back {
  width: 38px; height: 38px; border-radius: 12px; background: var(--card);
  box-shadow: var(--shadow); display: grid; place-items: center; font-size: 18px;
  flex: none;
}

/* ===== 카드 ===== */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px;
}
.card-h { font-size: 13px; font-weight: 700; color: var(--ink-3); letter-spacing: .02em;
  text-transform: none; margin: 6px 4px 10px; }

/* ===== 홈: 차수 카드 ===== */
.phase-card {
  display: flex; flex-direction: column; gap: 14px;
  cursor: pointer; position: relative; overflow: hidden;
  border: 1px solid transparent; transition: transform .12s ease;
}
.phase-card:active { transform: scale(.99); }
.phase-card .pc-top { display: flex; align-items: center; justify-content: space-between; }
.pc-title { font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.pc-badge { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); }
.pc-subjects { color: var(--ink-2); font-size: 13.5px; }
.pc-stats { display: flex; gap: 8px; }
.stat {
  flex: 1; background: var(--surface-soft); border-radius: 12px; padding: 10px 12px; text-align: center;
}
.stat b { display: block; font-size: 19px; font-weight: 800; }
.stat span { font-size: 11.5px; color: var(--ink-3); }
.progress-line { height: 8px; background: var(--track); border-radius: 999px; overflow: hidden; }
.progress-line > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }

/* ===== 버튼 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 18px; border-radius: 13px; font-weight: 700; font-size: 15.5px;
  background: var(--action); color: var(--on-action); width: 100%;
  box-shadow: none; transition: transform .5s var(--spring);
}
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--card); color: var(--brand); box-shadow: var(--shadow); }
.btn.ghost { background: var(--surface-soft); color: var(--ink-2); box-shadow: none; }
.btn.login-google { background: #fff; color: #3c4043; border: 1px solid #dadce0; box-shadow: 0 2px 5px rgba(60,64,67,.16); }
.btn.login-kakao { background: #fee500; color: #191919; box-shadow: none; }
.login-help { margin: 12px 4px 0; color: var(--ink-3); font-size: 12px; line-height: 1.6; text-align: center; }
.btn.sm { padding: 10px 14px; font-size: 14px; width: auto; }
.btn:disabled { opacity: .5; }

/* ===== 셋업 화면 ===== */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 14px; border-radius: 999px; background: var(--surface-soft); color: var(--ink-2);
  font-size: 14px; font-weight: 600; border: 1.5px solid transparent;
}
.chip.on { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }
.chip .n { opacity: .6; font-weight: 700; margin-left: 4px; }
.mode-list { display: flex; flex-direction: column; gap: 8px; }
.mode {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 13px;
  background: var(--surface-soft); border: 1.5px solid transparent;
}
.mode.on { border-color: var(--brand); background: var(--brand-soft); }
.mode .m-ico { font-size: 20px; }
.mode .m-t { font-weight: 700; font-size: 15px; }
.mode .m-d { font-size: 12.5px; color: var(--ink-3); }
.mode .radio { margin-left: auto; width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--ink-3); flex: none; }
.mode.on .radio { border-color: var(--brand); background:
  radial-gradient(circle at center, var(--brand) 0 5px, transparent 6px); }

/* ===== 퀴즈 화면 ===== */
.quiz-bar { position: sticky; top: 0; z-index: 20; background: var(--bg); padding: 12px 2px 8px; }
.qb-row { display: flex; align-items: center; gap: 10px; }
.qb-close { width: 34px; height: 34px; border-radius: 10px; background: var(--card);
  box-shadow: var(--shadow); font-size: 17px; flex: none; }
.qb-meta { flex: 1; min-width: 0; }
.qb-sub { font-size: 12px; color: var(--ink-3); }
.qb-title { font-weight: 800; font-size: 15px; }
.qb-count { font-size: 13px; color: var(--ink-2); font-weight: 700; }
.favorite-toggle { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex-shrink: 0; border: 0; border-radius: 12px; background: var(--bg); color: var(--ink-2); cursor: pointer; }
.favorite-toggle.on { color: var(--brand); }
.favorite-toggle.on svg { fill: currentColor; }
.favorite-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.favorite-filter { display: flex; align-items: center; gap: 8px; margin: 16px 0; color: var(--ink-2); font-size: 14px; }
.favorite-filter input { width: 18px; height: 18px; accent-color: var(--brand); }
.timer {
  display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums;
  font-weight: 800; font-size: 15px; padding: 6px 12px; border-radius: 999px;
  background: var(--ok-soft); color: var(--ok); flex: none;
}
.timer.warn { background: var(--warn-soft); color: var(--warn); }
.timer.danger { background: var(--bad-soft); color: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.timebar { height: 5px; background: var(--track); border-radius: 999px; margin-top: 9px; overflow: hidden; }
.timebar > i { display: block; height: 100%; width: 100%; background: var(--ok);
  border-radius: 999px; transition: width .3s linear, background .3s; }
.timebar > i.warn { background: var(--warn); }
.timebar > i.danger { background: var(--bad); }

.qimg-wrap {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; margin: 6px 0 14px; overflow-x: auto;
}
.qimg { background: #fff; display: block; width: 100%; height: auto; border-radius: 8px;
  filter: var(--qimg-filter); mix-blend-mode: var(--qimg-blend); }
.qimg-wrap { position: relative; }
.qimg-wrap:not([data-state="ready"]) { min-height: 180px; }
.qimg-status { display: none; }
.qimg-wrap[data-state="loading"] .qimg-status, .qimg-wrap[data-state="retrying"] .qimg-status,
.qimg-wrap[data-state="failed"] .qimg-status {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  position: absolute; inset: 0; padding: 16px; text-align: center; font-size: 14px; color: var(--ink-2);
  background: var(--card); border-radius: var(--radius);
}
.qimg-retry { display: none; }
.qimg-wrap[data-state="failed"] .qimg-retry { display: inline-flex; }
.qimg-wrap[data-state="failed"] .qimg-msg { color: var(--bad); font-weight: 700; }

.choices { display: flex; flex-direction: column; gap: 9px; }
.choice {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 13px;
  background: var(--card); box-shadow: var(--shadow); font-size: 16px; font-weight: 600;
  border: 2px solid transparent; text-align: left; width: 100%;
}
.choice .num {
  width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--surface-soft); color: var(--ink-2); font-weight: 800; font-size: 15px;
}
.choice.picked { border-color: var(--brand); background: var(--brand-soft); }
.choice.picked .num { background: var(--action); color: var(--on-action); }
.choice.correct { border-color: var(--ok); background: var(--ok-soft); }
.choice.correct .num { background: var(--ok); color: var(--on-status); }
.choice.wrong { border-color: var(--bad); background: var(--bad-soft); }
.choice.wrong .num { background: var(--bad); color: var(--on-status); }
.choice .mark { margin-left: auto; font-weight: 800; }
.choice:disabled { cursor: default; }

.feedback {
  margin-top: 14px; padding: 16px; border-radius: var(--radius); box-shadow: var(--shadow);
  background: var(--card); display: flex; flex-direction: column; gap: 12px;
}
.fb-head { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; }
.fb-head.ok { color: var(--ok); } .fb-head.bad { color: var(--bad); } .fb-head.warn { color: var(--warn); }
.fb-line { font-size: 14px; color: var(--ink-2); }
.fb-line b { color: var(--ink); }
.fb-topic { display: inline-block; font-size: 12px; font-weight: 700; color: var(--brand);
  background: var(--brand-soft); padding: 3px 10px; border-radius: 999px; }

.question-layout.quiz-stack { display: block; }
.question-layout.quiz-stack > .qimg-wrap { margin-bottom: 14px; }
.quiz-explanation { margin-top: 12px; }
.quiz-explanation > summary { cursor: pointer; padding: 12px 16px; border-radius: 12px; background: var(--card); color: var(--brand); font-size: 14px; font-weight: 700; }
.quiz-explanation .explanation-hide { display: none; }
.quiz-explanation[open] .explanation-show { display: none; }
#fb-slot { scroll-margin-top: 110px; }
.quiz-explanation[open] .explanation-hide { display: inline; }
.quiz-explanation > .analysis { margin-top: 10px; }

.sticky-next {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  max-width: var(--maxw); margin: 0 auto;
}

/* ===== 결과 ===== */
.result-hero { text-align: center; padding: 26px 0 10px; }
.result-hero .big { font-size: 46px; font-weight: 800; }
.result-hero .lbl { color: var(--ink-3); }
.res-stats { display: flex; gap: 8px; }

/* ===== 오답노트 / 리스트 ===== */
.seg { display: flex; gap: 6px; background: var(--track); padding: 4px; border-radius: 12px; margin-bottom: 14px; }
.seg button { flex: 1; padding: 9px; border-radius: 9px; font-weight: 700; font-size: 14px; color: var(--ink-2); }
.seg button.on { background: var(--card); color: var(--brand); box-shadow: var(--shadow); }

.group-h { display: flex; align-items: center; gap: 8px; margin: 18px 4px 8px; }
.group-h .g-sub { font-size: 12px; color: var(--ink-3); font-weight: 700; }
.group-h .g-topic { font-size: 15px; font-weight: 800; }
.group-h .g-count { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--bad);
  background: var(--bad-soft); padding: 3px 9px; border-radius: 999px; }

.q-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 15px; border-radius: 13px;
  background: var(--card); box-shadow: var(--shadow); margin-bottom: 8px; width: 100%; text-align: left;
}
.q-item .qi-num { font-weight: 800; color: var(--brand); font-size: 14px; flex: none; min-width: 60px; }
.q-item .qi-stem { flex: 1; font-size: 14px; color: var(--ink); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.q-item .qi-tag { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; flex: none; }
.qi-tag.wrong { background: var(--bad-soft); color: var(--bad); }
.qi-tag.timeout { background: var(--warn-soft); color: var(--warn); }
.qi-tag.mastered { background: var(--ok-soft); color: var(--ok); }
.qi-del { width: 28px; height: 28px; border-radius: 8px; flex: none; font-size: 13px;
  color: var(--ink-3); background: var(--surface-soft); }
.qi-del:active { background: var(--bad-soft); color: var(--bad); }
.chip .n.bad { color: var(--bad); opacity: 1; }

/* ===== AI 오답 분석 ===== */
.analysis { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-top: 14px; }
.ana-head { font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.ana-tag { font-size: 10.5px; font-weight: 700; color: var(--ink-3); background: var(--surface-soft);
  padding: 3px 8px; border-radius: 999px; }
.ana-empty { color: var(--ink-3); font-size: 14px; margin-top: 10px; }
.ana-sec { margin-top: 13px; }
.ana-t { font-size: 12px; font-weight: 800; color: var(--brand); margin-bottom: 4px; }
.ana-sec p { margin: 0; font-size: 14px; color: var(--ink); line-height: 1.8; white-space: pre-line; }
.ana-sec.pit .ana-t { color: var(--warn); }
.ana-sec.tip .ana-t { color: var(--ok); }
.ana-choices { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ana-choice { display: flex; gap: 9px; align-items: flex-start; }
.ana-cnum { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 800; }
.ana-cnum.ok { background: var(--ok-soft); color: var(--ok); }
.ana-cnum.bad { background: var(--bad-soft); color: var(--bad); }
.ana-ctext { font-size: 13.5px; line-height: 1.55; }
.ana-ctext b.ok { color: var(--ok); } .ana-ctext b.bad { color: var(--bad); }
.tip-pattern { font-size: 14px; line-height: 1.55; font-weight: 600; color: var(--ink);
  background: var(--ok-soft); border-left: 3px solid var(--ok); border-radius: 8px; padding: 10px 12px; }
.tip-tablewrap { margin-top: 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tip-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.tip-table th, .tip-table td { border: 1px solid var(--line); padding: 7px 9px; text-align: left;
  vertical-align: top; line-height: 1.45; }
.tip-table thead th { background: var(--brand-soft); color: var(--brand); font-weight: 800;
  white-space: nowrap; }
.tip-table td.tt-key { background: var(--surface-soft); font-weight: 700; color: var(--ink); white-space: nowrap; }

.empty { text-align: center; color: var(--ink-3); padding: 60px 20px; }
.empty .e-ico { font-size: 40px; }

/* ===== 통계 ===== */
.stat-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.stat-row .sr-name { width: 130px; font-size: 13px; font-weight: 600; flex: none; }
.sr-bar { flex: 1; height: 22px; background: var(--track); border-radius: 8px; overflow: hidden; position: relative; }
.sr-bar > i { display: block; height: 100%; border-radius: 8px; background: var(--ok); }
.sr-bar > i.low { background: var(--bad); }
.sr-bar > i.mid { background: var(--warn); }
.sr-val { font-size: 12px; font-weight: 800; width: 78px; text-align: right; flex: none;
  font-variant-numeric: tabular-nums; }

/* ===== 모달 ===== */
.modal-back { position: fixed; inset: 0; background: rgba(16,24,21,.5); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--bg); border-radius: 20px 20px 0 0; width: 100%; max-width: var(--maxw);
  max-height: 90vh; max-height: 90dvh; overflow-y: auto; overscroll-behavior: contain; padding: 8px 16px 24px; }
.modal-grab { width: 40px; height: 4px; background: var(--line); border-radius: 999px; margin: 8px auto 12px; }

/* ===== 탭바 ===== */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--nav-bg); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); display: flex;
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: 11px; font-weight: 700; color: var(--ink-3); position: relative; }
.tab.is-active { color: var(--brand); }
.tab-ico { font-size: 20px; filter: grayscale(1); opacity: .7; }
.tab.is-active .tab-ico { filter: none; opacity: 1; }
.tab .badge { position: absolute; top: 8px; left: 54%; background: var(--bad); color: var(--on-status);
  font-size: 10px; font-weight: 800; min-width: 17px; height: 17px; border-radius: 999px;
  display: grid; place-items: center; padding: 0 4px; }

/* ===== 인앱 확인 모달 ===== */
.confirm-modal { border-radius: 20px; max-width: 460px; margin: auto auto 0; padding: 8px 20px 20px; }
@media (min-width: 520px) { .modal-back { align-items: center; } .confirm-modal { border-radius: 20px; margin: auto; } }
.cf-title { font-size: 17px; font-weight: 800; margin: 4px 2px 12px; }
.cf-body { font-size: 14.5px; line-height: 1.65; color: var(--ink-2); }
.cf-body b { color: var(--ink); }
.cf-muted { color: var(--ink-3); font-size: 13px; }

.hidden { display: none !important; }
.spacer { height: 8px; }

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
    --bg: #161b19; --card: #1f2522; --ink: #dde2da; --ink-2: #aeb6ad; --ink-3: #a3aca3;
    --line: #363e39; --brand: #8ccbb6; --brand-2: #8ccbb6; --brand-soft: #263a33;
    --action: #8ccbb6; --on-action: #13201b;
    --surface-soft: #272e2a; --track: #323a35; --control-border: #6d776f; --nav-bg: rgba(31,37,34,.86);
    --ok: #8ccbb6; --bad: #e0a088; --warn: #cdb26a; --on-status: #13201b;
    --info: #8fbfd2; --info-soft: #20323a; --star: #cdb26a;
    --icon-filter: brightness(0) invert(.75);
    --icon-active-filter: brightness(0) saturate(100%) invert(80%) sepia(18%) saturate(640%) hue-rotate(110deg) brightness(96%);
    --on-action-filter: brightness(0);
    --ok-soft: #263a33; --bad-soft: #3a2b24;
    --warn-soft: #362f1c; --mark: #544a2b;
    --ring: rgba(255,255,255,.08); --shell: rgba(255,255,255,.04);
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 16px 40px -28px rgba(0,0,0,.6);
    --bezel: 0 0 0 1px var(--ring), 0 0 0 6px var(--shell), 0 24px 56px -36px rgba(0,0,0,.6);
    --qimg-filter: invert(.87) hue-rotate(180deg);
    --qimg-phone-filter: invert(.88) hue-rotate(180deg) contrast(1.15);
    --qimg-blend: normal;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161b19; --card: #1f2522; --ink: #dde2da; --ink-2: #aeb6ad; --ink-3: #a3aca3;
    --line: #363e39; --brand: #8ccbb6; --brand-2: #8ccbb6; --brand-soft: #263a33;
    --action: #8ccbb6; --on-action: #13201b;
    --surface-soft: #272e2a; --track: #323a35; --control-border: #6d776f; --nav-bg: rgba(31,37,34,.86);
    --ok: #8ccbb6; --bad: #e0a088; --warn: #cdb26a; --on-status: #13201b;
    --info: #8fbfd2; --info-soft: #20323a; --star: #cdb26a;
    --icon-filter: brightness(0) invert(.75);
    --icon-active-filter: brightness(0) saturate(100%) invert(80%) sepia(18%) saturate(640%) hue-rotate(110deg) brightness(96%);
    --on-action-filter: brightness(0);
    --ok-soft: #263a33; --bad-soft: #3a2b24;
    --warn-soft: #362f1c; --mark: #544a2b;
    --ring: rgba(255,255,255,.08); --shell: rgba(255,255,255,.04);
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 16px 40px -28px rgba(0,0,0,.6);
    --bezel: 0 0 0 1px var(--ring), 0 0 0 6px var(--shell), 0 24px 56px -36px rgba(0,0,0,.6);
    --qimg-filter: invert(.87) hue-rotate(180deg);
    --qimg-phone-filter: invert(.88) hue-rotate(180deg) contrast(1.15);
    --qimg-blend: normal;
  }
}

/* ===== 모의고사 ===== */
.mk-nav { display: flex; gap: 8px; }
.mk-nav .btn { padding: 13px 10px; font-size: 14.5px; }
.mk-nav #mk-prev, .mk-nav #mk-next, .mk-nav #mk-sheet { flex: 1; }
.mk-hint { font-size: 12px; color: var(--ink-3); text-align: center; margin-top: 10px; }
.mk-active { border: 1.5px solid var(--brand); }
.omr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.omr-cell { display: flex; flex-direction: column; align-items: center; padding: 6px 0; border-radius: 10px;
  background: var(--card); border: 1.5px solid var(--line); font-variant-numeric: tabular-nums; }
.omr-cell .o-n { font-size: 11px; color: var(--ink-3); font-weight: 700; }
.omr-cell .o-p { font-size: 16px; font-weight: 800; color: var(--ink-3); line-height: 1.2; }
.omr-cell.done { background: var(--brand-soft); border-color: var(--brand-soft); }
.omr-cell.done .o-p { color: var(--brand); }
.omr-cell.flag { border-color: var(--warn); }
.omr-cell.cur { outline: 2px solid var(--brand); outline-offset: 1px; }
.mk-note textarea { width: 100%; font: inherit; font-size: 14px; padding: 10px; border-radius: 10px;
  border: 1px solid var(--control-border); background: var(--bg); color: var(--ink); resize: vertical; }
.mk-done { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.mk-done input { width: 18px; height: 18px; accent-color: var(--brand); }
.modal .mk-nav .btn { flex: 1; }
#mk-secs .mode { text-align: left; width: 100%; }
.tab .badge[hidden] { display: none; }
.mk-score .sr-val { width: auto; min-width: 96px; white-space: nowrap; }
.fb-amend { font-size: 12.5px; color: var(--ink-3); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fb-amend .btn.sm { padding: 7px 12px; font-size: 13px; }

.review-header { position: static; align-items: flex-start; gap: 12px 24px; flex-wrap: wrap; }
.review-remark { margin-left: auto; max-width: 320px; color: var(--ink-3); font-size: 11px; line-height: 1.7; }
.review-legend-blue, .review-legend-yellow { display: inline-block; width: 12px; text-align: center; font-size: 13px; }
.review-legend-blue { color: var(--info); }
.review-legend-yellow { color: var(--star); }
.review-legend-outline { display: inline-block; width: 10px; height: 10px; border: 1.5px solid var(--info); border-radius: 2px; vertical-align: -1px; margin: 0 1px; }
.review-legend-detail summary { cursor: pointer; width: fit-content; text-decoration: underline; text-underline-offset: 2px; }
.review-legend-detail > div { margin-top: 4px; }
.review-star { color: var(--star); font-size: 12px; font-weight: 800; }
.review-item .qi-stem { white-space: normal; }
.review-star-blue { color: var(--info); }
.question-star { display: inline-block; font-size: 15px; margin-right: 4px; vertical-align: baseline; }
.review-star-yellow { color: var(--star); background: var(--warn-soft); border-radius: 5px; padding: 2px 5px; }
.review-group { border: 2px solid transparent; border-radius: 10px; padding: 8px; }
.review-last { border: 2px solid var(--info) !important; box-shadow: 0 0 0 2px var(--ring); }
.review-meta { display: block; color: var(--ink-3); font-size: 12px; margin-top: 4px; }
.review-resume { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; background: var(--info-soft); border-radius: 10px; font-size: 13px; margin-bottom: 12px; position: sticky; top: 8px; z-index: 15; box-shadow: var(--shadow); }
.resume-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.resume-row > span { margin-right: auto; }
.review-item { scroll-margin-block: 160px; }
.review-chapters > section { scroll-margin-top: calc(var(--resume-h, 0px) + 20px); }
.review-toc { display: none; flex-direction: column; gap: 2px; padding: 8px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.toc-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; align-items: center; padding: 8px 10px; border-radius: 8px; text-align: left; font-size: 13px; color: var(--ink-2); }
.toc-item small { grid-column: 1 / -1; font-size: 11px; color: var(--ink-3); }
.toc-item .toc-topic { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toc-item .toc-n { font-size: 11px; font-weight: 700; color: var(--bad); }
.toc-item:hover { background: var(--track); }
.toc-item.on { background: var(--brand-soft); color: var(--brand); font-weight: 800; }
.toc-item.toc-last { box-shadow: inset 2px 0 0 var(--info); }
.review-jump { display: block; width: 100%; margin-bottom: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); font: inherit; font-size: 14px; }
.review-item:focus-visible { outline: 3px solid var(--info); outline-offset: 3px; }
@media (max-width: 540px) { .review-remark { max-width: 100%; } .review-resume { position: static; } .review-item { flex-wrap: wrap; } .review-item .qi-stem { min-width: 50%; } }

/* Desktop changes stay above the existing phone/tablet layout. */
@media (min-width: 1024px) {
  :root { --maxw: 1280px; }
  .app {
    width: calc(100% - 200px);
    max-width: 1240px;
    margin-left: max(200px, calc((100vw - 1440px) / 2 + 200px));
    margin-right: 0;
    padding: 0 32px 40px;
  }
  .app[data-view="login"], .app[data-view="quiz"], .app[data-view="mockexam"] {
    width: 100%; max-width: var(--maxw); margin-inline: auto;
  }
  .app[data-view="quiz"], .app[data-view="mockexam"] { max-width: 960px; }
  .app-header { padding-top: 28px; padding-bottom: 24px; }
  .desktop-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
  .desktop-columns > * { min-width: 0; }
  .desktop-columns > .spacer { display: none; }
  .phase-columns { align-items: stretch; }
  /* Wrong notes: chapter TOC on the left, one continuous list on the right (no ragged columns). */
  .review-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
  .review-toc { display: flex; position: sticky; top: calc(var(--resume-h, 0px) + 20px); max-height: calc(100vh - var(--resume-h, 0px) - 40px); overflow-y: auto; overscroll-behavior: contain; }
  .review-jump { display: none; }
  .review-chapters > section:first-child .group-h { margin-top: 4px; }
  .home-actions { margin-top: 8px; }
  .stats-overview { grid-template-columns: minmax(240px, 1fr) minmax(0, 2fr); }
  .desktop-action { display: flex; max-width: 480px; margin-inline: auto; }
  .tabbar {
    inset: 28px auto auto max(24px, calc((100vw - 1440px) / 2 + 24px));
    width: 160px; height: auto; padding: 8px;
    flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius);
  }
  .tab { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 56px; padding: 12px; font-size: 14px; border-radius: 10px; }
  .tab.is-active { background: var(--brand-soft); }
  .tab .badge { top: 9px; left: 30px; }
  .question-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); gap: 24px; align-items: start; }
  .question-layout > * { min-width: 0; }
  .question-layout .qimg-wrap { margin: 0; }
  .answer-panel > .spacer { display: none; }
  .answer-panel .sticky-next { position: static; width: 100%; padding: 16px 0 0; background: none; }
  .answer-panel .feedback:first-child { margin-top: 0; }
  .modal { max-width: 720px; border-radius: 20px; padding: 12px 24px 24px; }
  .question-modal { max-width: 1200px; }
  .question-modal .question-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .confirm-modal { max-width: 460px; }
}

/* Account record import */
.import-profile, .import-file { display: block; width: 100%; margin: 8px 0 12px; font: inherit; }
.import-profile { min-height: 44px; padding: 10px; border: 1px solid var(--control-border); border-radius: 8px; background: var(--card); color: var(--ink); }
.import-file { min-height: 44px; }
.import-preview { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13px; }
.import-preview caption { text-align: left; margin-bottom: 8px; }
.import-preview th, .import-preview td { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: center; }
.import-preview th:first-child { text-align: left; }

/* Subject library: the same study engine, with a direct subject launcher. */
.nav-tabs { display: flex; width: 100%; }
.library-brand, .library-browser { display: none; }
.tab .tab-ico { filter: var(--icon-filter); width: 23px; height: 23px; opacity: .65; }
.tab.is-active .tab-ico { opacity: 1; filter: var(--icon-active-filter); }
button:focus-visible, select:focus-visible, summary:focus-visible, input:focus-visible { outline: 3px solid var(--brand); outline-offset: 4px; }
.library-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 24px; color: var(--ink-2); font-size: 13px; }
.library-breadcrumb { min-width: 0; }
.library-breadcrumb span { margin: 0 8px; color: var(--ink-3); }
.library-account { display: flex; align-items: center; gap: 8px; white-space: nowrap; min-height: 44px; padding: 0; }
.library-account img { width: 20px; height: 20px; opacity: .8; filter: var(--icon-filter); }
.library-heading { margin: 26px 0 30px; }
.library-heading h1 { font-size: 30px; letter-spacing: -.045em; line-height: 1.25; margin: 0 0 12px; overflow-wrap: anywhere; }
.library-heading p { font-size: 16px; color: var(--ink-2); margin: 0; }
.library-progress { margin-bottom: 30px; }
.exam-performance { padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.exam-performance h2 { margin: 0 0 14px; font-size: 16px; color: var(--ink); }
.exam-phase-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px 24px; }
.exam-phase-heading, .exam-phase-counts { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.exam-phase-heading { margin-bottom: 8px; font-size: 15px; }
.exam-phase-heading b { color: var(--brand); font-size: 22px; }
.exam-phase-counts { justify-content: flex-start; font-size: 13px; color: var(--ink-2); }
.exam-correct { color: var(--ok); font-weight: 700; }
.exam-wrong { color: var(--bad); font-weight: 700; }
.performance-help { font-size: 12px; line-height: 1.6; color: var(--ink-2); margin: 10px 0 24px; }
.exam-statistics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 450px), 1fr)); gap: 16px; }
.overall-statistics { margin: 0 0 24px; }
.overall-statistics > summary { padding: 16px 0; color: var(--brand); font-weight: 700; cursor: pointer; }
.library-progress > div { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; justify-content: space-between; font-size: 13px; color: var(--ink-2); }
.library-progress strong { font-weight: 600; color: var(--ink); }
.library-progress strong span { margin: 0 6px; color: var(--ink-3); }
.library-progress progress { display: block; width: 100%; height: 9px; margin-top: 15px; border: 0; border-radius: 6px; background: var(--track); overflow: hidden; }
.library-progress progress::-webkit-progress-bar { background: var(--track); border-radius: 6px; }
.library-progress progress::-webkit-progress-value { background: var(--brand); border-radius: 6px; }
.library-progress progress::-moz-progress-bar { background: var(--brand); border-radius: 6px; }
.library-modes { padding: 0; border: 0; margin: 0; min-width: 0; }
.library-modes legend { font-size: 21px; font-weight: 700; margin-bottom: 18px; padding: 0; }
.library-mode { display: flex; align-items: center; gap: 14px; min-height: 84px; padding: 16px; background: var(--card); border: 1px solid transparent; cursor: pointer; }
.library-mode:first-of-type { border-radius: 12px 12px 0 0; }
.library-mode:last-of-type { border-radius: 0 0 12px 12px; }
.library-mode + .library-mode { margin-top: -1px; }
.library-mode.selected { background: var(--brand-soft); border-color: transparent; border-radius: 12px; z-index: 1; position: relative; }
.library-mode input { accent-color: var(--brand); width: 20px; height: 20px; flex-shrink: 0; margin: 0; }
.library-mode > span { min-width: 0; }
.library-mode b { font-size: 16px; font-weight: 600; }
.library-mode small { word-break: keep-all; display: block; font-size: 12px; font-weight: 400; color: var(--ink-2); margin-top: 4px; }
.library-mode > strong { font-size: 23px; margin-left: auto; padding-left: 8px; white-space: nowrap; font-weight: 600; }
.library-mode > strong small { display: inline; font-size: 13px; margin-left: 5px; }
.library-mode.selected > strong, .library-mode.selected b { color: var(--brand); }
.library-start { box-shadow: none; display: flex; align-items: center; justify-content: center; gap: 20px; min-height: 60px; margin-top: 24px; border-radius: 10px; font-size: 19px; }
.library-start img { width: 24px; height: 24px; filter: var(--on-action-filter); }
.library-help { text-align: center; font-size: 13px; color: var(--ink-2); margin: 15px 0 4px; }
.library-advanced { display: block; min-height: 44px; margin: auto; font-size: 13px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 4px; }
.library-mock { border-top: 1px solid var(--line); margin-top: 22px; padding: 28px 0 12px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; }
.library-mock h2 { font-size: 17px; margin: 0 0 6px; font-weight: 600; }
.library-mock p { margin: 0; font-size: 13px; color: var(--ink-2); }
.library-mock button { color: var(--brand); padding: 0; min-height: 44px; display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 600; }
.library-mock img { width: 20px; height: 20px; filter: var(--icon-active-filter); }
.library-sync { color: var(--ink-2); font-size: 12px; }
.library-mobile-picker { margin-top: 16px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.library-mobile-picker summary { min-height: 44px; padding: 10px 0; cursor: pointer; font-size: 14px; }
.library-mobile-picker label { display: block; margin: 10px 0 6px; font-size: 13px; color: var(--ink-2); }
.library-mobile-picker select, .library-browser select { width: 100%; min-height: 44px; border: 1px solid var(--control-border); border-radius: 8px; background: var(--card); padding: 10px 12px; color: var(--ink); font: inherit; }
@media (max-width: 540px) {
  .library-breadcrumb { font-size: 11px; }
  .library-breadcrumb span { margin: 0 3px; }
  .library-account { font-size: 12px; }
  .library-top { gap: 8px; }
}
@media (min-width: 1024px) {
  :root { --library-rail: clamp(264px, 22.23vw, 320px); }
  .app { width: calc(100% - var(--library-rail)); max-width: 1400px; margin: 0 0 0 var(--library-rail); padding: 0 44px 40px; }
  .app[data-view="home"] { max-width: 1400px; }
  .tabbar { inset: 0 auto 0 0; width: var(--library-rail); height: 100dvh; overflow-y: auto; padding: 26px 24px; border: 0; border-right: 1px solid var(--line); border-radius: 0; background: var(--card); align-items: stretch; }
  .library-brand { display: flex; align-items: center; gap: 10px; font-size: 23px; font-weight: 750; min-height: 48px; padding: 0 4px; text-align: left; flex-shrink: 0; }
  .library-brand img.brand-logo { width: auto; height: 44px; }
  .nav-tabs { flex-direction: column; gap: 5px; margin-top: 31px; padding-bottom: 26px; border-bottom: 1px solid var(--line); }
  .tab { font-size: 18px; min-height: 54px; flex: none; padding: 12px 18px; gap: 16px; }
  .tab .badge { top: 8px; left: 31px; }
  .library-browser { display: block; padding: 26px 4px 0; }
  .library-browser > label { font-size: 14px; font-weight: 600; display: block; margin-bottom: 10px; }
  .library-browser select { font-size: 17px; }
  .library-subjects { margin-top: 28px; }
  .library-subjects h2 { margin: 0 0 9px; font-size: 15px; color: var(--ink-2); font-weight: 600; }
  .library-subjects button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; text-align: left; border-radius: 7px; font-size: 16px; padding: 10px 12px; overflow-wrap: anywhere; }
  .library-subjects button img { width: 20px; height: 20px; flex-shrink: 0; opacity: .8; filter: var(--icon-filter); }
  .library-subjects button[aria-current] img { opacity: 1; filter: var(--icon-active-filter); }
  .library-subjects button[aria-current] { color: var(--brand); background: var(--brand-soft); font-weight: 650; }
  .library-subjects button:hover { background: var(--brand-soft); }
  .library-mobile-picker { display: none; }
  .library-top { padding-top: 31px; font-size: 14px; }
  .library-heading { margin: 48px 0 48px; }
  .library-heading h1 { font-size: 56px; line-height: 1.1; margin-bottom: 8px; }
  .library-heading p { font-size: 21px; }
  .library-progress { margin-bottom: 39px; }
  .library-progress > div { font-size: 16px; }
  .library-progress strong { font-size: 18px; }
  .library-modes legend { font-size: 23px; margin-bottom: 20px; }
  .library-mode { min-height: 93px; padding: 17px 24px; gap: 19px; }
  .library-mode b { font-size: 20px; }
  .library-mode small { font-size: 16px; }
  .library-mode > strong { font-size: 23px; }
  .library-mode > strong small { font-size: 15px; }
  .library-mode input { width: 26px; height: 26px; }
  .library-start { min-height: 68px; font-size: 22px; }
  .library-help { font-size: 14px; }
  .library-mock { margin-top: 25px; padding-top: 30px; }
  .library-mock h2 { font-size: 19px; }
  .library-mock p { font-size: 14px; }
}

/* ===== 시험 D-day · 오늘 푼 문항 (상단 바, 내 계정 왼쪽) ===== */
.library-top-end { display: flex; align-items: center; gap: 14px; flex: none; }
.exam-day { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px;
  border-radius: 999px; background: var(--brand-soft); color: var(--ink-2); font-size: 12.5px; white-space: nowrap; }
.exam-day strong { color: var(--brand); font-size: 14px; font-weight: 800; letter-spacing: -.02em; }
.exam-day b { color: var(--ink); font-weight: 700; }
.exam-day-name strong { margin-left: 2px; }
.exam-day-short { display: none; }
.exam-day-today { padding-left: 8px; border-left: 1px solid var(--line); }
.exam-day.done { background: var(--card); border: 1px solid var(--line); }
/* 칩을 누르면 펼쳐지는 시험 일정 캘린더 */
.library-top-end { position: relative; }
.exam-day-wrap > summary { list-style: none; cursor: pointer; }
.exam-day-wrap > summary::-webkit-details-marker { display: none; }
.exam-day-wrap > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.exam-day-wrap[open] > summary { box-shadow: inset 0 0 0 1px var(--brand); }
.exam-cal { position: absolute; z-index: 30; top: calc(100% + 8px); right: 0;
  width: min(360px, calc(100vw - 32px)); padding: 16px 16px 14px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink); white-space: normal; }
.exam-cal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.exam-cal-head strong { font-size: 14.5px; font-weight: 800; }
.exam-cal-head span { font-size: 11.5px; color: var(--ink-3); }
.exam-cal-list { list-style: none; margin: 0; padding: 0; }
.exam-cal-item { position: relative; display: grid; grid-template-columns: 14px 1fr auto; align-items: start; gap: 10px; padding: 8px 0; }
.exam-cal-item:not(:last-child)::after { content: ''; position: absolute; left: 6px; top: 22px; bottom: -6px; width: 2px; background: var(--line); }
.exam-cal-dot { width: 14px; height: 14px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); box-sizing: border-box; }
.exam-cal-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.exam-cal-body b { font-size: 13.5px; font-weight: 700; }
.exam-cal-body small { font-size: 12px; color: var(--ink-3); line-height: 1.45; }
.exam-cal-badge { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-soft); color: var(--ink-2); white-space: nowrap; }
.exam-cal-item.is-done .exam-cal-dot { border-color: var(--brand); background: var(--brand); }
.exam-cal-item.is-done .exam-cal-body b { color: var(--ink-2); }
.exam-cal-item.is-now .exam-cal-dot, .exam-cal-item.is-upcoming .exam-cal-dot { border-color: var(--brand); }
.exam-cal-item.is-now .exam-cal-badge, .exam-cal-item.is-upcoming .exam-cal-badge { background: var(--brand-soft); color: var(--brand); }
.exam-cal-item.is-waiting .exam-cal-dot { border-color: var(--warn); }
.exam-cal-item.is-waiting .exam-cal-badge { background: var(--warn-soft); color: var(--warn); }
.exam-cal-foot { margin: 8px 0 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 11.5px; line-height: 1.55; color: var(--ink-3); }
@media (max-width: 540px) {
  .library-top-end { gap: 8px; }
  .exam-day { height: 28px; padding: 0 9px; gap: 6px; font-size: 11.5px; }
  .exam-day strong { font-size: 12.5px; }
  .exam-day-full { display: none; }
  .exam-day-short { display: inline; }
  .exam-day-today { padding-left: 6px; }
  /* 휴대폰: 캘린더를 상단 바 전체 폭에 맞춰 펼친다 */
  .library-top { position: relative; }
  .library-top-end { position: static; }
  .exam-cal { left: 0; right: 0; width: auto; }
}

/* 정답은 맞혔지만 애매함 */
.qi-tag.unsure { background: var(--warn-soft); color: var(--warn); }

/* 오답노트 문제 상세: 좌우 스와이프로 이전·다음 문제 */
.question-back { overflow: hidden; }
html.modal-open { overflow: hidden; }
.modal-back { overscroll-behavior: none; touch-action: pinch-zoom; }
.question-modal { touch-action: pan-y pinch-zoom; }
.question-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.question-nav .btn { flex: none; width: auto; }
.question-nav-pos { flex: 1; text-align: center; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.question-nav-pos small { display: none; font-size: 11px; color: var(--ink-3); }
@media (pointer: coarse) { .question-nav-pos small { display: block; } }

/* ===== 눈이 편한 학습 화면: 상용 앱 톤(이중 테두리 카드, 알약형 버튼, 떠 있는 메뉴) ===== */
.timer, .qb-count, .stat b, .sr-val { font-variant-numeric: tabular-nums; }
h1, h2, .library-heading h1, .pc-title, .result-hero .big { letter-spacing: -.025em; text-wrap: balance; }
.btn, .chip, .seg button, .choice, .q-item, .library-start, .mode, .library-mode { transition: transform .5s var(--spring), background-color .5s var(--spring); }
.btn { border-radius: 999px; min-height: 48px; }
.btn.sm { min-height: 40px; }
.btn.secondary { box-shadow: inset 0 0 0 1px var(--ring); }
@media (hover: hover) {
  .btn:not(:disabled):hover, .library-start:not(:disabled):hover { transform: scale(1.02); }
  .q-item:hover, .choice:not(:disabled):hover { transform: translateX(2px); }
}
.btn:not(:disabled):active, .library-start:not(:disabled):active { transform: scale(.98); }
.card, .exam-performance { border-radius: 24px; box-shadow: 0 0 0 1px var(--ring), var(--shadow); border: 0; }
.seg { border-radius: 999px; background: var(--surface-soft); }
.seg button { border-radius: 999px; }
.q-item, .mode { border-radius: 18px; }
.q-item { box-shadow: inset 0 0 0 1px var(--ring); }
.library-start { border-radius: 999px; }
.library-mode:first-of-type { border-radius: 18px 18px 0 0; }
.library-mode:last-of-type { border-radius: 0 0 18px 18px; }
.library-mode.selected { border-radius: 18px; }

.qb-close, .h-back { border-radius: 999px; box-shadow: inset 0 0 0 1px var(--ring); }
.qb-close { width: 44px; height: 44px; }
.timer { background: var(--surface-soft); color: var(--ink); }
.timer.warn { background: var(--warn-soft); color: var(--warn); }
.timer.danger { background: var(--bad-soft); color: var(--bad); animation: none; }
.timebar > i { background: var(--brand); }
.qimg-wrap { border-radius: 24px; box-shadow: var(--bezel); padding: 18px; margin: 12px 6px 22px; }
.choices { gap: 8px; }
.choice { border: 0; border-radius: 18px; box-shadow: inset 0 0 0 1px var(--ring); font-weight: 500; min-height: 56px; }
.choice .num { width: 28px; height: 28px; font-size: 14px; font-weight: 600; }
.choice.picked, .choice.correct, .choice.wrong { box-shadow: none; }
.choice .mark { display: inline-flex; align-items: center; gap: 4px; flex: none; padding: 3px 10px 3px 8px; border-radius: 999px;
  background: var(--card); font-size: 13px; font-weight: 600; white-space: nowrap; }
.choice .mark svg { width: 14px; height: 14px; }
.choice.correct .mark { color: var(--ok); }
.choice.wrong .mark { color: var(--bad); }
.feedback { border-radius: 24px; box-shadow: 0 0 0 1px var(--ring), var(--shadow); }
.quiz-explanation > summary { border-radius: 999px; box-shadow: inset 0 0 0 1px var(--ring); min-height: 48px; display: flex; align-items: center; justify-content: center; }
.fb-amend .btn { width: auto; white-space: normal; }

/* 해설: 한 줄 요약 → 근거 → 함정 → 함께 외우기. 강조는 세 단계만 쓴다. */
.analysis { background: none; box-shadow: none; padding: 0; margin-top: 14px; display: flex; flex-direction: column; gap: 20px; }
.ana-key { padding: 24px; margin: 6px; border-radius: 24px; background: var(--card); box-shadow: var(--bezel); }
.ana-eyebrow { display: inline-block; padding: 3px 11px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 13px; font-weight: 600; }
.ana-key-text { margin: 12px 0 0; font-size: 22px; line-height: 1.55; font-weight: 600; letter-spacing: -.025em; }
.ana-key-sub { margin: 10px 0 0; font-size: 14.5px; line-height: 1.7; color: var(--ink-2); }
.ana-mark { background: linear-gradient(transparent 56%, var(--mark) 56%); font-weight: 700; padding: 0 2px;
  -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.ana-trap { border-bottom: 2px dotted var(--warn); color: inherit; }
.ana-sec { margin: 0; padding: 0 12px; }
.ana-t { color: var(--ink); font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.ana-sec p { font-size: 15px; line-height: 1.75; color: var(--ink-2); }
.ana-sec.pit .ana-t, .ana-sec.tip .ana-t { color: var(--ink); }
.ana-ctext { font-size: 15px; line-height: 1.65; color: var(--ink-2); }
.ana-cnum { width: 26px; height: 26px; font-size: 13px; font-weight: 600; }
.ana-sec.tip { padding: 20px; border-radius: 24px; background: var(--surface-soft); }
.tip-pattern { background: none; border: 0; border-radius: 0; padding: 0; font-size: 15px; font-weight: 500; color: var(--ink-2); }
.tip-tablewrap { margin-top: 0; background: var(--card); border-radius: 16px; }
.tip-table { font-size: 14px; }
.tip-table th, .tip-table td { border: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; }
.tip-table tr:last-child td { border-bottom: 0; }
.tip-table thead th { background: none; color: var(--ink-2); font-weight: 600; }
.tip-table td.tt-key { background: none; font-weight: 600; }
.ana-tag { background: none; padding: 0 12px; font-size: 12px; font-weight: 500; color: var(--ink-3); }
/* 해설 하단: AI 작성 · 시험 당시 기준 · 최신 법령 확인 안내 */
.ana-notice { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.ana-notice .ana-tag { padding: 0; }
.ana-notice .ana-basis { font-weight: 700; color: var(--ink-2); }
.ana-notice p { margin: 4px 0 0; font-size: 12px; line-height: 1.6; color: var(--ink-3); }
.ana-notice a { color: var(--brand); text-underline-offset: 2px; }

/* 휴대폰 탭바: 화면 끝에 붙지 않고 떠 있는 알약 */
@media (max-width: 1023px) {
  .tabbar { left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); height: var(--tab-h); padding: 5px; border: 0;
    border-radius: 999px; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 0 0 1px var(--ring), 0 16px 40px -20px rgba(31,80,66,.35); }
  .nav-tabs { gap: 2px; }
  .tab { border-radius: 999px; min-width: 0; }
  .tab.is-active { background: var(--brand-soft); }
  .app { padding-bottom: calc(var(--tab-h) + 40px + env(safe-area-inset-bottom)); }
}
.tab { transition: background-color .5s var(--spring); }

.e-ico:empty, .m-ico:empty { display: none; }
@media (max-width: 540px) {
  .library-top { justify-content: flex-end; }
  .library-breadcrumb { display: none; }
}

/* 휴대폰: 번호와 보기 내용을 함께 보여 준다. 긴 보기는 줄바꿈해 전부 보인다. */
@media (max-width: 1023px) {
  .picks .choice.has-text { align-items: flex-start; min-height: 56px; padding: 12px 14px; font-size: 15px; line-height: 1.5; font-weight: 500; }
  .picks .choice .pick-label { flex: 1 1 auto; min-width: 0; align-self: center; overflow-wrap: anywhere; }
  .picks .choice .num { flex: none; }
  .picks .choice .mark { align-self: flex-start; }
}

/* 넓은 화면: 원본 이미지의 보기를 바로 누른다. 좌표가 없는 문항은 번호 줄로 고른다. */
.answer-dock { margin-top: 4px; }
@media (min-width: 1024px) {
  .qimg-frame { position: relative; }
  .qzone { position: absolute; display: block; padding: 0; border: 0; border-radius: 8px; background: none; cursor: pointer; }
  .qzone:disabled { cursor: default; }
  .qzone:not(:disabled):hover { background: color-mix(in srgb, var(--ok) 8%, transparent); }
  .qzone.right, .qzone.right:hover { background: color-mix(in srgb, var(--ok) 15%, transparent); outline: 2px solid var(--ok); outline-offset: -2px; }
  .qzone.bad, .qzone.bad:hover { background: color-mix(in srgb, var(--bad) 15%, transparent); outline: 2px solid var(--bad); outline-offset: -2px; }
  .qzone:focus-visible { outline: 3px solid var(--brand); outline-offset: -3px; }
  .answer-dock.image-pick .picks { display: none; }
  .choices.picks { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .picks .choice { flex-direction: column; justify-content: center; gap: 0; min-height: 58px; padding: 6px 2px; transition: transform .25s var(--spring); }
  .picks .pick-label { display: none; }
  .picks .choice .num { width: auto; height: auto; background: none; color: inherit; font-size: 20px; line-height: 1.2; }
  .picks .choice.correct { background: var(--ok-soft); color: var(--ok); }
  .picks .choice.wrong { background: var(--bad-soft); color: var(--bad); }
  .picks .choice.correct .num, .picks .choice.wrong .num { background: none; color: inherit; }
  .picks .choice .mark { margin: 0; padding: 0; gap: 2px; background: none; font-size: 12px; line-height: 1.3; }
  .picks .choice .mark svg { display: none; }
}

/* 낮·밤 전환 */
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: none; border-radius: 999px;
  background: var(--surface-soft); color: var(--ink); }
.theme-toggle svg { width: 20px; height: 20px; }

@media (prefers-reduced-motion: reduce) {
  .btn, .chip, .seg button, .choice, .q-item, .library-start, .mode, .library-mode, .tab { transition: none; }
  .btn:not(:disabled):hover, .btn:not(:disabled):active, .library-start:not(:disabled):hover, .library-start:not(:disabled):active,
  .q-item:hover, .choice:not(:disabled):hover { transform: none; }
}

/* 휴대폰: 문항 이미지를 화면 폭에 가깝게 키운다. 시험지는 글자가 작아, 테두리 장식보다 글자 크기가 먼저다.
   얇은 획이 흐려 보이지 않도록 대비를 조금 높인다. */
@media (max-width: 1023px) {
  .qimg-wrap { padding: 6px; margin: 8px 0 16px; border-radius: 14px; box-shadow: inset 0 0 0 1px var(--ring); }
  .qimg { border-radius: 8px; filter: var(--qimg-phone-filter); }
}
@media (max-width: 540px) {
  .qimg-wrap { margin-inline: calc(50% - 50vw); padding: 4px 2px; border-radius: 0; box-shadow: none; }
  .qimg { border-radius: 0; }
}

/* Mock review: single-column reading flow. */
.modal.mock-review-modal { max-width: 900px; padding-bottom: 0; scroll-padding-block: 80px; }
.mock-review-modal .question-layout { display: block; }
.mock-review-modal .question-layout > .qimg-wrap { margin: 0 0 16px; }
.mock-review-modal .mock-review-choices { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.mock-review-choices .choice { flex-wrap: wrap; justify-content: center; gap: 6px; padding: 10px 6px; font-size: 14px; }
.mock-review-choices .choice > span:nth-child(2) { display: none; }
.mock-review-choices .choice .mark { flex-basis: 100%; margin: 0; text-align: center; font-size: 12px; }
.mock-review-modal .mock-review-header { margin-top: 0; }
.mock-review-modal .mk-note { margin-bottom: 16px; }
.mock-review-modal .mock-review-nav { position: sticky; bottom: 0; z-index: 2; padding: 12px 0 max(12px, env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); }
.mock-review-nav .btn { min-width: 0; }
@media (max-width: 540px) {
  .mock-review-modal .mock-review-choices { gap: 5px; }
  .mock-review-choices .choice { padding: 8px 3px; }
  .mock-review-nav .btn { font-size: 13px; padding: 13px 6px; }
}

/* Mock exams share the study answer controls; selection never reveals grading. */
.qzone.selected, .qzone.selected:hover { background: color-mix(in srgb, var(--brand) 15%, transparent); outline: 2px solid var(--brand); outline-offset: -2px; }
.mock-home-layout.no-history { display: block; max-width: 960px; margin-inline: auto; }
.mock-first-guide { padding: 8px 24px 20px; color: var(--ink-2); font-size: 14px; line-height: 1.7; }
.mock-first-guide strong { color: var(--ink); }
.mock-first-guide p { margin: 4px 0 0; }
.mock-history { min-width: 0; }

/* 해설 하단 문제 출처: 흐리고 가장 작게, 휴대폰에서도 한 줄 */
.ana-notice p.ana-source { margin-top: 2px; font-size: 10px; line-height: 1.4; color: var(--ink-3); opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 홈 맨 아래 문제 출처(앱 전체 표시): 해설 하단과 같은 크기·색 */
.app-source { margin: 28px 0 0; font-size: 10px; line-height: 1.4; color: var(--ink-3); opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== 암기노트 ===== */
.notes-heading p { color: var(--ink-3); }
.notes-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.notes-hide { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--ink-2); cursor: pointer; }
.notes-hide input { width: 20px; height: 20px; }
.notes-progress { margin: 12px 0 0; font-size: 13px; color: var(--ink-3); }
.notes-progress b { color: var(--brand); }
.notes-status { margin-top: 24px; color: var(--ink-3); }
.note-chapter { margin-top: 28px; }
.note-chapter > h2 { margin: 0 0 12px; font-size: 15px; font-weight: 800; color: var(--ink-2); letter-spacing: -.01em; }
.note-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px; }
.note-card.is-done { opacity: .72; }
.note-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.note-card-head h3 { margin: 0; font-size: 17px; font-weight: 800; line-height: 1.4; }
.note-done { display: inline-flex; align-items: center; gap: 6px; flex: none; font-size: 12.5px; font-weight: 700; color: var(--ink-3); cursor: pointer; }
.note-done input { width: 18px; height: 18px; }
.note-core { margin: 8px 0 0; font-size: 14.5px; line-height: 1.7; color: var(--ink-2); }
.note-key { color: var(--brand); font-weight: 800; }
.note-tablewrap { margin-top: 12px; overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); }
.note-table { border-collapse: collapse; width: 100%; font-size: 13.5px; line-height: 1.55; }
.note-table th, .note-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.note-table tr:last-child th, .note-table tr:last-child td { border-bottom: 0; }
.note-table thead th { background: var(--surface-soft); color: var(--ink-2); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.note-table tbody th { font-weight: 700; color: var(--ink); min-width: 5.5em; }
.note-points { margin: 12px 0 0; padding-left: 18px; font-size: 14px; line-height: 1.75; color: var(--ink); }
.note-points li + li { margin-top: 4px; }
.note-caution { margin: 10px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 12.5px; line-height: 1.5; }
.note-card-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.note-related { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--brand); font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; }
.note-related img { width: 16px; height: 16px; filter: var(--icon-active-filter); }
.note-related.muted { color: var(--ink-3); font-weight: 600; font-size: 13px; cursor: default; }
/* 가리고 외우기: 칸을 누르면 핵심어가 보인다 */
.note-blank { display: inline; padding: 0 4px; margin: 0 1px; border: 0; border-radius: 6px; background: var(--brand-soft); font: inherit; font-weight: 800; color: transparent; cursor: pointer; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.note-blank span { color: transparent; }
.note-blank.is-open { background: none; padding: 0; }
.note-blank.is-open span { color: var(--brand); }
.note-blank:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.notes-notice { margin-top: 24px; }
@media (max-width: 540px) {
  .note-card { padding: 15px; }
  .note-card-head h3 { font-size: 16px; }
  .note-table { font-size: 13px; }
  .note-table th, .note-table td { padding: 8px 9px; }
}

/* ===== 기출딱 로고: 밝은 테마는 먹색, 어두운 테마는 흰색 워드마크 ===== */
.brand-logo { display: block; }
.brand-logo-dark { display: none; }
:root[data-theme="dark"] .brand-logo-light { display: none; }
:root[data-theme="dark"] .brand-logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-logo-light { display: none; }
  :root:not([data-theme="light"]) .brand-logo-dark { display: block; }
}
.login-brand { flex-direction: column; align-items: flex-start; gap: 6px; position: static; }
.login-brand h1 { margin: 0; line-height: 0; }
.login-brand .brand-logo { width: auto; height: 44px; }
