:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f0f3fb;
  --text: #171923;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --primary-soft: #eef2ff;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(15, 23, 42, .08);
  --shadow-sm: 0 4px 14px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; }

/* 접근성: 키보드 포커스 표시 / 스크린리더 전용 텍스트 */
:focus-visible { outline: 3px solid rgba(37, 99, 235, .55); outline-offset: 2px; border-radius: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; }

/* ── 레이아웃 (모바일 우선, 480px 셸) ───────────────────────── */
.app-shell {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 16px 16px calc(92px + env(safe-area-inset-bottom));
  background: var(--bg);
}

h1 { margin: 0; font-size: 22px; line-height: 1.3; }
h2 { margin: 0; font-size: 17px; }
h3 { margin: 0; font-size: 15px; }
p { color: var(--muted); line-height: 1.6; margin: 0; }
.muted { color: var(--muted); }
.eyebrow {
  margin: 0 0 6px; font-size: 12px; font-weight: 800;
  color: var(--primary); letter-spacing: .04em; text-transform: uppercase;
}
code { background: var(--primary-soft); padding: 2px 5px; border-radius: 6px; font-size: 13px; }

/* ── 메시지(messages framework) ─────────────────────────────── */
.messages { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.messages .msg {
  border-radius: 12px; padding: 12px 14px; font-size: 14px; font-weight: 700;
  background: var(--primary-soft); color: var(--primary-strong); border: 1px solid var(--line);
}
.messages .msg.error { background: #fef2f2; color: #b91c1c; }
.messages .msg.success { background: #f0fdf4; color: #15803d; }
.messages .msg.warning { background: #fffbeb; color: #b45309; }

/* ── 상단바 ─────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 14px;
}
.topbar .brand { font-size: 22px; font-weight: 900; letter-spacing: -.02em; }
.topbar .brand span { color: var(--primary); }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

/* 설정 스위치 행 (내정보 화면 설정: 해외 시험 보기 등) */
.opt-switch {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  cursor: pointer; user-select: none;
}
.opt-switch input { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
.ec-flag {
  font-size: 11px; font-weight: 700; color: var(--primary);
  background: var(--primary-soft); padding: 1px 7px; border-radius: 999px; margin-right: 4px;
  white-space: nowrap;
}

/* 홈 브랜드 히어로: 로고 마크 + 그라데이션 워드마크 + 슬로건 */
.home-hero { align-items: flex-start; margin-bottom: 22px; }
.home-hero .brand-lockup { display: flex; align-items: center; gap: 12px; }
.home-hero .brand-mark {
  width: 46px; height: 46px; flex: none;
  filter: drop-shadow(0 6px 14px rgba(79, 70, 229, .28));
}
/* 로그인 버튼은 워드마크(Qevit) 줄에 맞춰 상단 정렬 (태그라인 높이에 안 휘둘리게) */
.home-hero .topbar-actions { align-self: flex-start; }
.home-hero .brand-block { display: flex; flex-direction: column; gap: 4px; }
.home-hero .brand {
  font-size: 32px; font-weight: 900; letter-spacing: -.045em; line-height: 1;
  color: var(--primary); /* 폴백 */
  background: linear-gradient(118deg, var(--primary) 0%, #4f46e5 52%, #6366f1 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  width: max-content;
}
.home-hero .brand span { color: inherit; }
/* 영문 고정 슬로건: 워드마크 다음의 핵심 태그라인(액센트 바 + 강조) */
.home-hero .brand-slogan {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 2px 0 0; font-size: 15px; font-weight: 800; color: var(--text); letter-spacing: -.01em;
}
.home-hero .brand-slogan::before {
  content: ""; flex: none; width: 18px; height: 2.5px; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), #6366f1);
}
[data-theme="dark"] .home-hero .brand {
  background: linear-gradient(118deg, #4f8cf7 0%, #6366f1 52%, #818cf8 100%);
  -webkit-background-clip: text; background-clip: text;
}
.icon-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  text-decoration: none; font-size: 13px; font-weight: 700; color: var(--text);
}
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none; color: var(--muted); font-weight: 700; font-size: 14px;
  margin-bottom: 10px;
}

/* ── 검색 ───────────────────────────────────────────────────── */
.search { display: flex; gap: 8px; margin-bottom: 16px; }
.search input[type="search"], .search input[type="text"] {
  flex: 1; min-width: 0; padding: 13px 14px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.search input:focus { outline: 2px solid var(--primary); border-color: transparent; }

/* ── 카드 공통 ───────────────────────────────────────────────── */
.card, .page-header, .placeholder-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}
.card.tight { padding: 14px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 18px 2px 10px;
}
.section-head h2 { font-size: 16px; }
.section-head a { font-size: 13px; font-weight: 700; color: var(--primary); text-decoration: none; }

/* ── 상태 배너 (회원/비회원) ────────────────────────────────── */
.status-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px;
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.status-banner.member { background: linear-gradient(135deg, #ecfdf5, #d1fae5); }
.status-banner.guest { background: linear-gradient(135deg, #eef2ff, #e0e7ff); }
.status-banner .b-title { font-weight: 800; font-size: 14px; color: var(--text); }
.status-banner .b-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.status-banner .b-link {
  flex: none; background: var(--primary); color: #fff; text-decoration: none;
  font-weight: 800; font-size: 12px; padding: 9px 12px; border-radius: 999px;
}
.count-pill {
  flex: none; font-weight: 900; font-size: 13px; color: var(--primary-strong);
  background: var(--surface); border: 1px solid var(--line); padding: 8px 12px; border-radius: 999px;
}

/* ── 기능 카드 (이어풀기 / 오늘의 10문제) ──────────────────── */
.feature-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 6px; }
.feature {
  display: block; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 16px;
}
.feature .f-ico { font-size: 22px; }
.feature .f-title { font-weight: 800; margin-top: 8px; font-size: 15px; }
.feature .f-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.feature.accent { background: linear-gradient(135deg, var(--primary), var(--primary-strong)); color: #fff; border: 0; }
.feature.accent .f-sub { color: rgba(255,255,255,.85); }

/* ── 시험 카드 ──────────────────────────────────────────────── */
.exam-card { display: block; text-decoration: none; color: var(--text); }
.exam-card + .exam-card { margin-top: 0; }
.exam-card .ec-title { font-size: 16px; font-weight: 800; margin-bottom: 8px; }
.exam-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; }
.exam-stats .stat-main { font-size: 14px; font-weight: 800; color: var(--primary-strong); }
.exam-stats .stat-sub { font-size: 13px; color: var(--muted); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  font-size: 12px; font-weight: 700; color: var(--primary-strong);
  background: var(--primary-soft); border-radius: 999px; padding: 5px 10px;
}
.chip.ghost { background: var(--surface-2); color: var(--muted); }
.free-note { margin-top: 10px; font-size: 12px; font-weight: 700; color: var(--success); }

/* ── 카테고리 탭 / 정렬 ─────────────────────────────────────── */
.tab-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; -webkit-overflow-scrolling: touch; }
.tab-scroll::-webkit-scrollbar { display: none; }
.tab {
  flex: none; text-decoration: none; font-size: 13px; font-weight: 700;
  color: var(--muted); background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 14px; white-space: nowrap;
}
.tab.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }
.sort-row { display: flex; gap: 8px; margin-bottom: 12px; }
.sort-row a {
  text-decoration: none; font-size: 12px; font-weight: 700; color: var(--muted);
  padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
}
.sort-row a.is-active { color: var(--primary-strong); background: var(--primary-soft); border-color: transparent; }

/* ── 상세: 큰 숫자 / 과목 목록 ─────────────────────────────── */
.stat-hero { text-align: center; padding: 22px 18px; }
.stat-hero .num { font-size: 40px; font-weight: 900; color: var(--primary-strong); line-height: 1; }
.stat-hero .unit { font-size: 15px; font-weight: 800; color: var(--text); margin-left: 4px; }
.stat-hero .label { margin-top: 8px; font-size: 13px; color: var(--muted); }
.subject-list { list-style: none; margin: 0; padding: 0; }
.subject-list li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
}
.subject-list li:last-child { border-bottom: 0; }
.subject-list .s-name { font-size: 14px; font-weight: 700; }
.subject-list .s-count { font-size: 13px; font-weight: 800; color: var(--primary-strong); }

/* ── 시험 정보 카드 (합격/과락/실전 문제수) ─────────────────── */
.exam-info { padding: 0; overflow: hidden; }
.score-badges { display: flex; border-bottom: 1px solid var(--line); }
.score-badge { flex: 1; text-align: center; padding: 14px 6px; }
.score-badge + .score-badge { border-left: 1px solid var(--line); }
.sb-val { display: block; font-size: 17px; font-weight: 900; line-height: 1.2; }
.sb-key { display: block; font-size: 11px; color: var(--muted); font-weight: 600; margin-top: 3px; }
.sb-total .sb-val { color: var(--primary-strong); }
.sb-pass .sb-val { color: var(--success); }
.sb-warn .sb-val { color: var(--danger); }
.set-head { display: grid; grid-template-columns: 1fr 1fr 1fr; padding: 7px 16px; background: var(--surface-2); font-size: 11px; font-weight: 700; color: var(--muted); border-bottom: 1px solid var(--line); }
.set-row { display: grid; grid-template-columns: 1fr 1fr 1fr; padding: 11px 16px; font-size: 13px; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-name { font-weight: 700; color: var(--text); }
.set-real { font-weight: 800; color: var(--primary-strong); }
.set-min { font-weight: 700; color: var(--danger); }

/* ── 일정 ───────────────────────────────────────────────────── */
.schedule-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.schedule-item:last-child { border-bottom: 0; }
.schedule-item .sc-label { font-weight: 800; font-size: 14px; margin-bottom: 6px; }
.date-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.date-row .d-key { color: var(--muted); }
.date-row .d-val { font-weight: 700; }

/* ── 목록(공지 등) ──────────────────────────────────────────── */
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.list-plain li:last-child { border-bottom: 0; }
.list-plain .li-tag { font-size: 11px; font-weight: 800; color: var(--primary); margin-right: 6px; }

/* ── 설정 화면 옵션 그룹 ────────────────────────────────────── */
.opt-group { margin-bottom: 16px; }
.opt-group > .opt-label { display: block; font-size: 13px; font-weight: 800; margin: 0 2px 8px; }
.opt-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.opt {
  flex: 1 1 auto; min-width: calc(33.33% - 8px); text-align: center;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  padding: 11px 8px; font-size: 13px; font-weight: 700; color: var(--text); cursor: pointer;
}
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-strong); }
.opt.full { min-width: 100%; }

/* ── 요약 박스 ──────────────────────────────────────────────── */
.summary { background: var(--surface-2); border: 1px dashed var(--line); }
.summary .sum-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.summary .sum-row .k { color: var(--muted); }
.summary .sum-row .v { font-weight: 800; }

/* ── 버튼 ───────────────────────────────────────────────────── */
.button-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
button, .btn, .btn-primary, .btn-secondary, .btn-ghost, .primary-button, .secondary-button {
  border: 0; border-radius: 14px; padding: 13px 16px; font-weight: 800;
  font-size: 15px; line-height: 1.2; cursor: pointer; text-decoration: none; text-align: center;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-primary, .primary-button { background: var(--primary); color: #fff; }
.btn-secondary, .secondary-button { background: var(--primary-soft); color: var(--primary-strong); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--line); }
.btn-block { display: flex; width: 100%; }
.btn-stack { display: flex; flex-direction: column; gap: 10px; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:disabled { opacity: .45; cursor: not-allowed; }

/* ── 다중 선택 삭제 (응시 기록 등) ───────────────────────────── */
.select-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.select-toolbar .sel-all { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; }
.select-toolbar .sel-all input { width: 18px; height: 18px; }
.select-toolbar .sel-count { font-size: 12px; color: var(--muted); margin-left: auto; }
.select-toolbar .btn-danger { padding: 9px 16px; font-size: 14px; }
.select-row { display: flex; align-items: flex-start; gap: 10px; }
.select-row .sel-check { padding-top: 16px; flex: none; cursor: pointer; }
.select-row .sel-check input { width: 20px; height: 20px; }
.select-row > .card { flex: 1 1 auto; min-width: 0; }
.infinite-sentinel { height: 1px; }

/* ── 빈 상태 ────────────────────────────────────────────────── */
.empty { text-align: center; padding: 30px 18px; }
.empty .e-ico { font-size: 34px; }
.empty .e-title { font-weight: 800; margin: 10px 0 4px; }

/* ── 하단 네비게이션 ────────────────────────────────────────── */
.bottom-nav {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(100%, 480px);
  height: calc(64px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 30px rgba(15,23,42,.08);
  z-index: 50;
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--muted); text-decoration: none;
}
.nav-item .nav-ico { font-size: 19px; line-height: 1; filter: grayscale(1); opacity: .7; }
.nav-item .nav-label { font-size: 11px; font-weight: 700; }
.nav-item.is-active { color: var(--primary); }
.nav-item.is-active .nav-ico { filter: none; opacity: 1; }

/* ── 문제풀이 화면 (하단 네비 숨김 + 고정 액션바) ───────────── */
.solve-shell { padding-bottom: calc(104px + env(safe-area-inset-bottom)); }
.solve-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.solve-top .back-link { margin-bottom: 0; flex: none; }
.progress-wrap { flex: 1; min-width: 0; }
.progress-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.progress-bar { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .2s; }

/* 풀이 상단 공통: 나가기 / 제출 / 타이머 (한 문제씩·OMR 통일) */
.exit-btn { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 8px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text); font-size: 13px; font-weight: 700;
  text-decoration: none; box-shadow: var(--shadow-sm); }
.solve-submit { flex: none; background: var(--primary); color: #fff; border-radius: 999px; padding: 9px 16px; font-size: 14px; font-weight: 800; }
.solve-timer { flex: none; font-variant-numeric: tabular-nums; font-weight: 900; font-size: 14px; color: var(--primary-strong);
  background: var(--primary-soft); border-radius: 999px; padding: 2px 8px; }
.solve-timer.danger { color: #fff; background: var(--danger); }
.sheet-x { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: 13px; padding: 0; }
.solve-top .navsheet-btn { flex: none; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; font-size: 12px; font-weight: 800; color: var(--primary-strong); }

/* 문제 번호 현황 그리드 (B1) */
.navgrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.navcell { display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--text); font-weight: 800; font-size: 14px; }
.navcell.done { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.navcell.current { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); color: var(--primary-strong); }

/* 과목별 점수 막대 */
.score-bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.score-bar span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.score-bar.risk span { background: var(--danger); }
.subj-score { padding: 10px 0; border-bottom: 1px solid var(--line); }
.subj-score:last-child { border-bottom: 0; }
.subj-score-top { display: flex; align-items: baseline; justify-content: space-between; font-size: 14px; }
.subj-score-top .s-name { font-weight: 700; }
.subj-score-top .s-count { font-weight: 800; color: var(--primary-strong); }

.mode-tag { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; border-radius: 12px; padding: 10px 12px; font-size: 13px; font-weight: 800; margin-bottom: 12px; text-align: center; }
.q-no { font-size: 13px; font-weight: 800; color: var(--primary); margin-bottom: 8px; }
.q-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.q-head .q-no { margin-bottom: 0; }
/* 지문/보기/해설 본문 텍스트는 진한 본문색(옅은 회색 금지) */
.blk-text { color: var(--text); }
.q-body .blk-text { color: var(--text); font-size: 16px; line-height: 1.6; margin: 0 0 8px; }
/* ㄱ/ㄴ/ㄷ 하위항목 목록 */
.blk-sub-items { list-style: none; margin: 2px 0 10px; padding: 10px 14px; background: var(--surface-2); border-left: 3px solid var(--primary); border-radius: 0 10px 10px 0; }
.blk-sub-items li { color: var(--text); font-size: 15px; line-height: 1.65; margin: 0; padding: 3px 0; }
.blk-sub-items li + li { border-top: 1px solid var(--line); }
.si-label { font-weight: 700; color: var(--primary); margin-right: 2px; }
/* 블록 콘텐츠 (text/math/image/table/code) */
.blk-math { overflow-x: auto; overflow-y: hidden; padding: 6px 2px; margin: 8px 0; }
.blk-math .katex-display { margin: 0; }
.blk-figure { margin: 10px 0; }
.blk-img { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); display: block; cursor: zoom-in; }
.img-fallback { display: block; font-size: 13px; color: var(--muted); background: var(--surface-2); border: 1px dashed var(--line); border-radius: 10px; padding: 16px; text-align: center; }
.blk-img-alt { font-size: 12px; color: var(--muted); margin-top: 4px; }
.blk-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 10px 0; }
.md-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.md-table th, .md-table td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; white-space: nowrap; }
.md-table th { background: var(--surface-2); font-weight: 800; }
.blk-code-wrap { margin: 10px 0; border-radius: 10px; overflow: hidden; border: 1px solid #1f2937; }
.code-head { background: #1f2937; color: #9ca3af; font-size: 11px; font-weight: 800; padding: 5px 12px; letter-spacing: .04em; text-transform: uppercase; }
.blk-code { background: #0f172a; color: #e2e8f0; padding: 12px; margin: 0; overflow-x: auto; font-size: 13px; line-height: 1.5; }
.blk-code code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; white-space: pre; }

/* 이미지 확대 오버레이 */
.img-zoom { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; }
.img-zoom[hidden] { display: none; }
.img-zoom img { max-width: 100%; max-height: 80vh; object-fit: contain; }
.img-zoom-close { position: absolute; top: 14px; right: 16px; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.15); color: #fff; font-size: 18px; }
.img-zoom-caption { color: #e5e7eb; font-size: 13px; margin-top: 12px; text-align: center; }

/* ── 신고 바텀시트 ──────────────────────────────────────────── */
.report-link { background: none; border: 0; color: var(--muted); font-size: 13px; font-weight: 700; padding: 6px 4px; cursor: pointer; }
.sheet-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 150; display: flex; align-items: flex-end; justify-content: center; }
.sheet-overlay[hidden] { display: none; }
.sheet-card { width: min(100%, 480px); background: var(--surface); border-radius: 20px 20px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 30px rgba(15,23,42,.18); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-close { background: var(--surface-2); border: 0; width: 32px; height: 32px; border-radius: 50%; font-size: 14px; color: var(--muted); }
.report-select, .report-textarea { width: 100%; padding: 12px 14px; font-size: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.report-textarea { resize: vertical; }

.choice-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.choice {
  display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; box-shadow: var(--shadow-sm);
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice .c-num {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  background: var(--surface-2); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
}
.choice .c-body { flex: 1; }
.choice .c-body .blk-text { margin: 0; font-size: 15px; }
.choice.is-selected { border-color: var(--primary); background: var(--primary-soft); }
.choice.is-selected .c-num { background: var(--primary); color: #fff; }
/* 보기 클릭 즉시 선택 효과(서버 reload 전에도) */
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.choice:has(input:checked) .c-num { background: var(--primary); color: #fff; }

.submit-all { margin-bottom: 12px; }
.single-bookmark { margin-top: 10px; }
.solve-actions {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(100%, 480px); display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line);
  box-shadow: 0 -8px 30px rgba(15,23,42,.08); z-index: 50;
}
.solve-actions button:disabled { opacity: .4; cursor: default; }
.solve-actions.three { grid-template-columns: 1fr 1.4fr 1fr; }
.solve-actions a { text-decoration: none; }

.grade-mode-tag { background: var(--primary-soft); color: var(--primary-strong); border-radius: 12px; padding: 9px 12px; font-size: 12px; font-weight: 800; margin-bottom: 12px; text-align: center; }
.last-q-notice { background: var(--primary-soft); color: var(--primary-strong); border-radius: 12px; padding: 10px 14px; font-size: 13px; font-weight: 700; margin-bottom: 12px; text-align: center; }
.reveal-card.ok { border-color: var(--success); }
.reveal-card.no { border-color: var(--danger); }
.reveal-badge { font-weight: 900; font-size: 16px; margin-bottom: 10px; }
.reveal-card.ok .reveal-badge { color: var(--success); }
.reveal-card.no .reveal-badge { color: var(--danger); }
.study-toggle { margin-bottom: 14px; }
.study-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.study-tools form { display: flex; }
.study-tools .btn-ghost { width: 100%; }

/* ── OMR 방식 ───────────────────────────────────────────────── */
.omr-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.omr-exam { flex: 1; font-weight: 800; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.omr-timer { flex: none; font-variant-numeric: tabular-nums; font-weight: 900; font-size: 16px; color: var(--primary-strong);
  background: var(--primary-soft); border-radius: 999px; padding: 5px 12px; }
.omr-timer.danger { color: #fff; background: var(--danger); }
.omr-submit { flex: none; background: var(--primary); color: #fff; border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 800; }
.omr-qmeta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.omr-subject { font-size: 12px; font-weight: 800; color: var(--muted); background: var(--surface-2); padding: 3px 10px; border-radius: 999px; }

.omr-sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.omr-sheet-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.omr-filter { font-size: 12px; font-weight: 700; color: var(--muted); display: inline-flex; gap: 5px; align-items: center; }
.omr-subject-divider { font-size: 12px; font-weight: 800; color: var(--primary); margin: 12px 0 6px; }
.omr-rows { display: flex; flex-direction: column; gap: 6px; }
.omr-row { display: flex; align-items: center; gap: 8px; padding: 4px; border-radius: 10px; }
.omr-row.current { background: var(--primary-soft); }
.omr-row.current .omr-rownum { color: var(--primary-strong); }
.omr-rownum { flex: none; width: 30px; text-align: center; font-weight: 800; font-size: 13px; text-decoration: none; color: var(--text); }
.omr-row[data-answered="0"] .omr-rownum { color: var(--danger); }
.omr-bubbles { display: flex; gap: 6px; flex-wrap: wrap; }
.omr-bubble { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  font-size: 12px; font-weight: 800; color: var(--muted); padding: 0; }
.omr-bubble.on { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── 모달 ───────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100; }
.modal-overlay[hidden] { display: none; }
.modal-card { width: min(100%, 360px); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.modal-card h2 { text-align: center; }

/* ── 결과 요약 ──────────────────────────────────────────────── */
.score-card { text-align: center; color: #fff; border: 0; }
.score-card.pass { background: linear-gradient(135deg, #16a34a, #15803d); }
.score-card.fail { background: linear-gradient(135deg, #f97316, #dc2626); }
.score-card .score-num { font-size: 46px; font-weight: 900; line-height: 1; }
.score-card .score-num span { font-size: 18px; font-weight: 800; margin-left: 4px; }
.score-card .score-badge {
  display: inline-block; margin-top: 10px; padding: 5px 14px; border-radius: 999px;
  background: rgba(255,255,255,.22); font-weight: 800; font-size: 13px;
}
.score-card .score-sub { margin-top: 10px; font-size: 13px; color: rgba(255,255,255,.9); }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.result-grid .rg-num { font-size: 28px; font-weight: 900; }
.result-grid .rg-num.ok { color: var(--success); }
.result-grid .rg-num.no { color: var(--danger); }
.result-grid .rg-label { font-size: 12px; color: var(--muted); margin-top: 4px; }
.result-time { text-align: center; margin-top: 12px; font-size: 13px; color: var(--muted); }
.signup-card { background: linear-gradient(135deg, #eef2ff, #e0e7ff); border: 0; }
.signup-card .signup-ico { font-size: 28px; text-align: center; }
.signup-card p { color: var(--text); margin: 8px 0 12px; }
.signup-card .signup-lead { font-weight: 800; color: var(--primary-strong); text-align: center; }
.signup-benefits { list-style: none; margin: 0 0 14px; padding: 0; }
.signup-benefits li { font-size: 13px; color: var(--text); padding: 4px 0 4px 22px; position: relative; }
.signup-benefits li::before { content: "✓"; position: absolute; left: 0; color: var(--success); font-weight: 900; }
.link-note { margin-top: 12px; font-size: 13px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }

/* ── 폼 ─────────────────────────────────────────────────────── */
.form-card .form-row { margin-bottom: 14px; }
.form-card label { display: block; font-size: 13px; font-weight: 800; margin: 0 2px 6px; }
.form-card input { width: 100%; padding: 12px 14px; font-size: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.form-card input:focus { outline: 2px solid var(--primary); border-color: transparent; }
.field-error { color: var(--danger); font-size: 12px; font-weight: 700; margin: 6px 2px 0; }
.profile-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.profile-row:last-child { border-bottom: 0; }
.profile-row .k { color: var(--muted); }
.profile-row .v { font-weight: 700; }
.list-plain a { text-decoration: none; color: var(--text); font-weight: 700; display: block; }
.policy-body { color: var(--text); line-height: 1.75; font-size: 14px; }
.policy-body p { color: var(--text); margin: 0 0 10px; }

/* 카드 액션 도구 */
.card-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.card-tools form { display: inline; }
.card-tools .btn-ghost, .card-tools .btn-primary { padding: 9px 14px; font-size: 14px; }

/* 학습 통계 점수 추이 막대 */
.stat-chart { display: flex; align-items: flex-end; gap: 8px; height: 130px; padding-top: 6px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar { width: 100%; max-width: 30px; background: var(--primary); border-radius: 6px 6px 0 0; min-height: 3px; }
.bar-label { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ── 문제별 해설 ────────────────────────────────────────────── */
.result-mini { text-align: center; font-weight: 700; font-size: 13px; color: var(--muted); }
.filter-row { margin-bottom: 14px; }
.exp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.badge { font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.badge.ok { background: #dcfce7; color: #15803d; }
.badge.no { background: #fee2e2; color: #b91c1c; }
.choice-list.review .choice { cursor: default; box-shadow: none; align-items: center; }
.choice.is-correct { border-color: var(--success); background: #f0fdf4; }
.choice.is-correct .c-num { background: var(--success); color: #fff; }
.choice.is-wrong { border-color: var(--danger); background: #fef2f2; }
.choice.is-wrong .c-num { background: var(--danger); color: #fff; }
.tag-ok, .tag-mine { flex: none; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; margin-left: 4px; }
.tag-ok { background: #dcfce7; color: #15803d; }
.tag-mine { background: var(--primary-soft); color: var(--primary-strong); }
.exp-basic { margin-top: 12px; padding: 12px; background: var(--surface-2); border-radius: 12px; }
.exp-basic .exp-label { font-size: 12px; font-weight: 800; color: var(--primary); margin-bottom: 6px; }
.exp-basic .blk-text { color: var(--text); margin: 0; }
.exp-more { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.exp-more summary { font-size: 13px; font-weight: 800; color: var(--primary); cursor: pointer; }
.exp-more .blk-text { color: var(--text); margin: 8px 0 0; }

/* ── 비회원 제한 모달(페이지) ───────────────────────────────── */
.limit-wrap { min-height: 70vh; display: flex; align-items: center; }
.limit-card { text-align: center; width: 100%; }
.limit-card .limit-ico { font-size: 40px; }
.limit-card h1 { font-size: 20px; margin: 12px 0 10px; }
.limit-card p { color: var(--text); }
.limit-benefits { list-style: none; padding: 0; margin: 14px 0; text-align: left; display: inline-block; }
.limit-benefits li { font-size: 14px; padding: 5px 0 5px 24px; position: relative; color: var(--text); }
.limit-benefits li::before { content: "✓"; position: absolute; left: 0; color: var(--success); font-weight: 900; }

/* ── 광고 (캐러셀 / 피드 / 단일) ─────────────────────────────── */
.ad-card {
  display: block; position: relative; margin: 14px 0;
  border-radius: var(--radius); overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.ad-link { display: block; position: relative; text-decoration: none; }
.ad-img { display: block; width: 100%; height: auto; }
.ad-badge {
  position: absolute; top: 8px; left: 8px;
  font-size: 11px; font-weight: 800; letter-spacing: .02em;
  color: #fff; background: rgba(15, 23, 42, .55);
  padding: 3px 8px; border-radius: 999px; backdrop-filter: blur(2px);
}

/* 캐러셀: 슬라이드를 같은 셀에 쌓고 opacity 로 전환(이미지 높이 가변 대응) */
.ad-carousel { position: relative; margin: 0 0 16px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.ad-track { display: grid; }
.ad-slide { grid-area: 1 / 1; opacity: 0; transition: opacity .4s ease; pointer-events: none; }
.ad-slide.is-active { opacity: 1; pointer-events: auto; }
.ad-dots {
  position: absolute; left: 0; right: 0; bottom: 8px;
  display: flex; justify-content: center; gap: 2px;
}
/* 시각은 작은 점이지만 탭 영역은 넉넉하게(버튼) */
.ad-dot { width: 22px; height: 18px; padding: 0; border: 0; background: transparent; cursor: pointer; position: relative; }
.ad-dot::before {
  content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 7px; height: 7px; border-radius: 999px; background: rgba(255, 255, 255, .55);
  transition: background .2s, width .2s;
}
.ad-dot.on::before { width: 18px; background: #fff; }

/* 공지 목록 항목을 클릭 가능한 링크로 */
.list-plain li a { display: flex; align-items: center; gap: 8px; text-decoration: none; color: inherit; }

/* 시험 설정: 하위 선택기 / 직접 입력 / 안내 */
.opt-select, .opt-input {
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); font-size: 15px; color: var(--text); box-shadow: var(--shadow-sm);
}
.opt-select { width: 100%; }
.opt-input { width: 90px; max-width: 40%; }
.time-custom, .count-custom { margin-top: 10px; }
.opt-hint { margin-top: 8px; font-size: 13px; color: var(--muted); line-height: 1.5; }

/* 선택 범위: 회차/과목/단원 드롭다운 행 + 오답 토글 */
.scope-filters { display: flex; flex-direction: column; gap: 10px; }
.scope-row { display: flex; align-items: center; gap: 10px; }
.scope-row .scope-k { flex: 0 0 44px; font-size: 14px; font-weight: 700; color: var(--muted); }
.scope-row .opt-select { flex: 1; }
.opt-check { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; font-weight: 700; }
.opt-check input { width: 18px; height: 18px; }
.scope-row--wrap { align-items: flex-start; }
.scope-row--wrap .scope-k { padding-top: 9px; }
.round-select-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.round-chip { display: inline-flex; align-items: center; cursor: pointer; font-size: 13px; font-weight: 700; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); user-select: none; line-height: 1.2; }
.round-chip input { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }
.round-chip.is-active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-strong); }

/* ── 학습 모드 탭 (집중 학습 / 회차 모의고사) ─────────────────── */
.mode-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.mode-tab {
  flex: 1; padding: 11px 8px; border: 2px solid var(--line); border-radius: 10px;
  background: var(--surface); cursor: pointer; font-size: 15px; font-weight: 700;
  color: var(--muted); transition: border-color .15s, background .15s, color .15s;
  line-height: 1.2;
}
.mode-tab.is-active {
  border-color: var(--primary); background: var(--primary-soft); color: var(--primary-strong);
}
.opt-hint-tag { font-size: 11px; font-weight: 400; color: var(--muted); font-style: normal; }

/* ── 다크 모드 ───────────────────────────────────────────────
   해석된 테마(light/dark)는 app.js가 <html data-theme>에 넣는다(시스템 설정 + 저장값).
   대부분 컴포넌트는 var()를 쓰므로 핵심 변수만 바꾸면 따라오고, 밝은색 하드코딩 부분만 개별 보정. */
[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #181b22;
  --surface-2: #232834;
  --text: #e7e9ee;
  --muted: #9aa1ad;
  --line: #2c323d;
  --primary: #4f8cf7;
  --primary-strong: #6fa1f9;
  --primary-soft: #1b2740;
  --shadow: 0 10px 30px rgba(0, 0, 0, .55);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, .4);
}
[data-theme="dark"] .messages .msg { background: var(--primary-soft); color: #cdd9f5; border-color: var(--line); }
[data-theme="dark"] .messages .msg.error { background: rgba(220, 38, 38, .16); color: #fca5a5; }
[data-theme="dark"] .messages .msg.success { background: rgba(22, 163, 74, .16); color: #86efac; }
[data-theme="dark"] .messages .msg.warning { background: rgba(217, 119, 6, .18); color: #fcd34d; }
[data-theme="dark"] .status-banner.member { background: linear-gradient(135deg, #103025, #0f3a2c); }
[data-theme="dark"] .status-banner.guest { background: linear-gradient(135deg, #1a2138, #20305a); }
[data-theme="dark"] .navcell.done { background: rgba(22, 163, 74, .18); border-color: rgba(22, 163, 74, .5); color: #86efac; }
[data-theme="dark"] .mode-tag { background: rgba(217, 119, 6, .16); color: #fcd34d; border-color: rgba(217, 119, 6, .4); }
[data-theme="dark"] .badge.ok, [data-theme="dark"] .tag-ok { background: rgba(22, 163, 74, .2); color: #86efac; }
[data-theme="dark"] .badge.no { background: rgba(220, 38, 38, .2); color: #fca5a5; }
[data-theme="dark"] .choice.is-correct { background: rgba(22, 163, 74, .12); }
[data-theme="dark"] .choice.is-wrong { background: rgba(220, 38, 38, .12); }
[data-theme="dark"] .img-fallback { color: var(--muted); }

/* 테마 선택 UI(내정보) */
.theme-row { display: flex; gap: 8px; }
.theme-opt {
  flex: 1; text-align: center; padding: 11px 8px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 700; cursor: pointer;
}
.theme-opt.is-active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-strong); }

/* JS 미실행/비활성 시: 시스템이 다크면 핵심 변수만 다크로(깜빡임 방지는 head 스크립트가 담당) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0f1115; --surface: #181b22; --surface-2: #232834; --text: #e7e9ee;
    --muted: #9aa1ad; --line: #2c323d; --primary: #4f8cf7; --primary-strong: #6fa1f9;
    --primary-soft: #1b2740; --shadow: 0 10px 30px rgba(0,0,0,.55); --shadow-sm: 0 4px 14px rgba(0,0,0,.4);
  }
}
