/* ── 기본 리셋 & 변수 ─────────────────────────────────────────────────────── */
:root {
  --blue:    #2563eb;
  --blue-h:  #1d4ed8;
  --green:   #16a34a;
  --red:     #dc2626;
  --yellow:  #ca8a04;
  --gray-50: #f8fafc;
  --gray-100:#f1f5f9;
  --gray-200:#e2e8f0;
  --gray-400:#94a3b8;
  --gray-600:#475569;
  --gray-800:#1e293b;
  --radius:  10px;
  --shadow:  0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.05);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Pretendard', 'Apple SD Gothic Neo', -apple-system, BlinkMacSystemFont,
               'Malgun Gothic', sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── 공통 레이아웃 ─────────────────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

.container { max-width: 860px; margin: 0 auto; padding: 0 20px; }

/* ── 네비게이션 ──────────────────────────────────────────────────────────────── */
nav {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 20px;
  position: sticky; top: 0; z-index: 100;
}
.nav-inner {
  max-width: 860px; margin: 0 auto;
  display: flex; align-items: center; gap: 8px;
  height: 56px;
}
.nav-logo {
  font-weight: 700; font-size: 18px; color: var(--blue);
  text-decoration: none; margin-right: 16px;
}
.nav-btn {
  padding: 6px 14px; border-radius: 6px;
  background: transparent; border: none; cursor: pointer;
  font-size: 14px; color: var(--gray-600);
  transition: background .15s, color .15s;
}
.nav-btn:hover, .nav-btn.active { background: var(--gray-100); color: var(--blue); }
#wrongBadge {
  background: var(--red); color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 1px 6px; border-radius: 99px;
  margin-left: 4px; display: none;
}

/* ── 카드 ─────────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

/* ── 버튼 ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: 8px; border: none; cursor: pointer;
  font-size: 14px; font-weight: 600; transition: all .15s; text-decoration: none;
}
.btn-primary   { background: var(--blue);  color: #fff; }
.btn-primary:hover { background: var(--blue-h); }
.btn-outline   { background: transparent; color: var(--blue); border: 1.5px solid var(--blue); }
.btn-outline:hover { background: #eff6ff; }
.btn-ghost     { background: var(--gray-100); color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-200); }
.btn-danger    { background: var(--red); color: #fff; }
.btn:disabled  { opacity: .4; cursor: not-allowed; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

/* ── 홈 ────────────────────────────────────────────────────────────────────── */
.home-header {
  padding: 48px 0 32px;
}
.home-header h1 { font-size: 28px; font-weight: 800; margin-bottom: 6px; }
.home-header p  { color: var(--gray-600); font-size: 15px; }

.mode-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px; margin-bottom: 32px;
}
.mode-card {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 24px;
  cursor: pointer; transition: all .15s; text-align: left;
}
.mode-card:hover { border-color: var(--blue); box-shadow: 0 0 0 3px #dbeafe; }
.mode-icon { font-size: 28px; margin-bottom: 10px; }
.mode-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.mode-card p  { font-size: 13px; color: var(--gray-600); line-height: 1.5; }

/* ── 시험 선택 ──────────────────────────────────────────────────────────────── */
.year-tabs {
  display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap;
}
.year-tab {
  padding: 7px 18px; border-radius: 99px;
  border: 1.5px solid var(--gray-200); background: #fff;
  cursor: pointer; font-size: 14px; font-weight: 600;
  transition: all .15s;
}
.year-tab.active, .year-tab:hover {
  border-color: var(--blue); background: var(--blue); color: #fff;
}

.test-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.test-item {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 16px 18px;
  cursor: pointer; transition: all .15s;
}
.test-item:hover { border-color: var(--blue); box-shadow: 0 0 0 3px #dbeafe; }
.test-item .test-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.test-item .test-date  { font-size: 12px; color: var(--gray-400); }
.test-item .test-count { font-size: 12px; color: var(--gray-600); margin-top: 8px; }

/* ── 유형 선택 ──────────────────────────────────────────────────────────────── */
.type-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.type-item {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 16px;
  cursor: pointer; transition: all .15s; text-align: center;
}
.type-item:hover { border-color: var(--blue); box-shadow: 0 0 0 3px #dbeafe; }
.type-item .type-name  { font-weight: 700; font-size: 15px; }
.type-item .type-count { font-size: 12px; color: var(--gray-400); margin-top: 4px; }

/* ── 시험 풀기 UI ────────────────────────────────────────────────────────────── */
.exam-header {
  background: #fff; border-bottom: 1px solid var(--gray-200);
  padding: 14px 20px; position: sticky; top: 56px; z-index: 90;
}
.exam-header-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.exam-title  { font-weight: 700; font-size: 15px; }
.exam-progress-wrap { flex: 1; max-width: 200px; }
.progress-bar {
  height: 6px; background: var(--gray-200); border-radius: 99px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: var(--blue); border-radius: 99px;
  transition: width .3s;
}
.progress-text { font-size: 12px; color: var(--gray-400); margin-top: 4px; text-align: right; }

/* 2컬럼 레이아웃 */
.exam-layout {
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
  display: block; /* 기본: 단일 컬럼 (비시험 모드) */
}
.exam-layout.has-omr {
  display: flex; align-items: flex-start; gap: 24px;
}
.exam-main {
  flex: 1; min-width: 0;
}
.question-area { padding: 28px 0; }
.question-card { padding: 28px 32px; }

.q-meta {
  display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap;
}
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 600;
}
.badge-part5     { background: #dbeafe; color: var(--blue); }
.badge-part6     { background: #fce7f3; color: #be185d; }
.badge-type      { background: #f0fdf4; color: var(--green); }
.badge-generated { background: #fef3c7; color: #92400e; }

.q-num { font-size: 13px; color: var(--gray-400); font-weight: 600; }

/* ── 소스 필터 토글 ────────────────────────────────────────────────────────── */
.source-filter {
  display: flex; gap: 8px; margin-bottom: 20px;
}
.src-btn {
  padding: 7px 18px; border-radius: 99px; border: 1.5px solid var(--gray-200);
  background: #fff; color: var(--gray-600); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.src-btn.active {
  background: var(--blue); color: #fff; border-color: var(--blue);
}
.src-btn:hover:not(.active) { background: var(--gray-100); }

.type-sub { color: var(--gray-400); font-size: 11px; }
.type-gen-bar { margin-top: 6px; }

/* ── Part6 지문 박스 ──────────────────────────────────────────────────────── */
.passage-box {
  background: #f8fafc; border: 1px solid var(--gray-200); border-radius: 8px;
  padding: 16px 18px; margin-bottom: 16px;
  font-size: 14px; line-height: 1.8; color: var(--gray-800);
  white-space: pre-wrap;
}
.blank-marker {
  color: var(--blue); font-weight: 700;
}

.q-text {
  font-size: 17px; line-height: 1.8; margin: 12px 0 24px;
  word-break: keep-all;
}
.q-text strong {
  background: #fef3c7; padding: 1px 3px; border-radius: 3px;
  font-style: italic; color: #92400e;
}

.options { display: flex; flex-direction: column; gap: 10px; }
.option-label {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 18px; border-radius: 8px;
  border: 1.5px solid var(--gray-200); background: #fff;
  cursor: pointer; transition: all .15s; font-size: 15px;
}
.option-label:hover { border-color: var(--blue); background: #eff6ff; }
.option-label input[type="radio"] { display: none; }
.option-letter {
  flex-shrink: 0; width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--gray-100);
  font-weight: 700; font-size: 13px; color: var(--gray-600);
  transition: all .15s;
}
.option-label.selected .option-letter {
  background: var(--blue); color: #fff;
}
.option-label.selected { border-color: var(--blue); background: #eff6ff; }

/* 채점 피드백 */
.option-label.correct  {
  border-color: var(--green); background: #f0fdf4;
}
.option-label.correct .option-letter  { background: var(--green); color: #fff; }
.option-label.wrong    {
  border-color: var(--red); background: #fef2f2;
}
.option-label.wrong .option-letter    { background: var(--red); color: #fff; }

.feedback-box {
  margin-top: 20px; padding: 14px 18px;
  border-radius: 8px; font-size: 14px; font-weight: 600;
  display: none;
}
.feedback-box.correct { background: #f0fdf4; color: var(--green); border: 1px solid #bbf7d0; }
.feedback-box.wrong   { background: #fef2f2; color: var(--red);   border: 1px solid #fecaca; }

.exam-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 0; gap: 12px;
}

/* ── 결과 페이지 ────────────────────────────────────────────────────────────── */
.result-hero {
  text-align: center; padding: 40px 0 28px;
}
.score-ring {
  width: 120px; height: 120px;
  border-radius: 50%;
  background: conic-gradient(var(--blue) var(--pct, 0%), var(--gray-200) 0);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  position: relative;
}
.score-ring::before {
  content: ''; position: absolute;
  width: 90px; height: 90px;
  background: #fff; border-radius: 50%;
}
.score-num { position: relative; z-index: 1; font-size: 24px; font-weight: 800; color: var(--blue); }

.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 20px; }

.type-bar-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.type-bar-item { display: flex; flex-direction: column; gap: 4px; }
.type-bar-label { display: flex; justify-content: space-between; font-size: 13px; }
.type-bar-track { height: 8px; background: var(--gray-200); border-radius: 99px; overflow: hidden; }
.type-bar-fill  { height: 100%; border-radius: 99px; background: var(--blue); transition: width .5s; }

/* ── 오답 노트 ──────────────────────────────────────────────────────────────── */
.filter-row {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px;
}
.filter-chip {
  padding: 5px 14px; border-radius: 99px;
  border: 1.5px solid var(--gray-200); background: #fff;
  cursor: pointer; font-size: 13px; transition: all .15s;
}
.filter-chip.active { border-color: var(--blue); background: #eff6ff; color: var(--blue); }

/* ── 오답 탭 ────────────────────────────────────────────────────────────────── */
.wrong-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 2px solid var(--gray-200); }
.wrong-tab-btn {
  padding: 10px 20px; font-size: 14px; font-weight: 600;
  border: none; background: none; cursor: pointer;
  color: var(--gray-600); border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all .15s;
}
.wrong-tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }
.wrong-tab-btn:hover:not(.active) { color: var(--gray-900); }

.wrong-list { display: flex; flex-direction: column; gap: 14px; }
.wrong-card { padding: 20px 24px; }
.wc-header { display: flex; justify-content: space-between; align-items: flex-start; }
.wc-actions { display: flex; gap: 6px; flex-shrink: 0; }
.wc-bookmark {
  width: 32px; height: 32px; border: 1px solid var(--gray-200);
  border-radius: 6px; background: none; cursor: pointer;
  font-size: 16px; color: var(--gray-400); transition: all .15s;
}
.wc-bookmark:hover, .wc-bookmark.active {
  border-color: #f59e0b; color: #f59e0b; background: #fffbeb;
}
.wc-exclude {
  width: 32px; height: 32px; border: 1px solid var(--gray-200);
  border-radius: 6px; background: none; cursor: pointer;
  font-size: 13px; color: var(--gray-400); transition: all .15s;
}
.wc-exclude:hover { border-color: var(--red); color: var(--red); background: #fef2f2; }

.wrong-q-text { font-size: 15px; line-height: 1.7; margin: 10px 0 14px; }
.wrong-opts { display: flex; flex-direction: column; gap: 6px; }
.wrong-opt {
  padding: 8px 14px; border-radius: 6px;
  font-size: 14px; border: 1px solid var(--gray-200);
}
.wrong-opt.correct { border-color: var(--green); background: #f0fdf4; color: var(--green); font-weight: 600; }
.wrong-opt.yours   { border-color: var(--red); background: #fef2f2; color: var(--red); }

/* ── 통계 ──────────────────────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-box { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 18px; text-align: center; }
.stat-val { font-size: 28px; font-weight: 800; color: var(--blue); }
.stat-label { font-size: 13px; color: var(--gray-600); margin-top: 4px; }

.session-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.session-table th { text-align: left; padding: 10px 12px; background: var(--gray-100); border-bottom: 1px solid var(--gray-200); font-size: 13px; }
.session-table td { padding: 10px 12px; border-bottom: 1px solid var(--gray-100); }
.session-table tr:last-child td { border: none; }

/* ── 분석 탭 ──────────────────────────────────────────────────────────────── */
.freq-chart { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.freq-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.freq-label { width: 90px; text-align: right; color: var(--gray-600); flex-shrink: 0; }
.freq-bar-wrap { flex: 1; height: 20px; background: var(--gray-100); border-radius: 4px; overflow: hidden; }
.freq-bar { height: 100%; background: var(--blue); border-radius: 4px; transition: width .5s; display: flex; align-items: center; padding-left: 8px; }
.freq-bar span { font-size: 11px; color: #fff; font-weight: 700; white-space: nowrap; }

/* ── 섹션 헤더 ─────────────────────────────────────────────────────────────── */
.section-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.section-sub   { font-size: 14px; color: var(--gray-600); margin-bottom: 20px; }

/* ── 유틸 ─────────────────────────────────────────────────────────────────── */
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.text-sm  { font-size: 13px; }
.text-muted { color: var(--gray-400); }
.empty-state { text-align: center; padding: 60px 0; color: var(--gray-400); }
.empty-state p { margin-top: 8px; font-size: 15px; }
.loading { text-align: center; padding: 40px; color: var(--gray-400); font-size: 15px; }

@media (max-width: 600px) {
  .result-grid { grid-template-columns: 1fr; }
  .question-card { padding: 20px; }
  .q-text { font-size: 15px; }
}

/* ── 단어 뜻 팝업 ─────────────────────────────────────────────────────────── */
.dict-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 200;
}
.dict-popup {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  z-index: 201; width: min(420px, 92vw);
  background: #fff; border-radius: 16px; box-shadow: 0 8px 40px rgba(0,0,0,.2);
  display: flex; flex-direction: column;
  animation: popIn .15s ease;
}
@keyframes popIn {
  from { opacity:0; transform: translate(-50%,-50%) scale(.94); }
  to   { opacity:1; transform: translate(-50%,-50%) scale(1); }
}
.dict-popup-inner { padding: 24px; }
.dict-popup-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.dict-word  { font-size: 22px; font-weight: 800; color: var(--blue); }
.dict-close {
  background: none; border: none; font-size: 18px; color: var(--gray-400);
  cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.dict-close:hover { background: var(--gray-100); }
.dict-pos     { font-size: 12px; color: var(--gray-400); margin-bottom: 10px; font-style: italic; }
.dict-ko      { font-size: 20px; font-weight: 700; color: var(--gray-800); margin-bottom: 8px; }
.dict-en      { font-size: 13px; color: var(--gray-600); line-height: 1.6; margin-bottom: 6px; }
.dict-example { font-size: 12px; color: var(--gray-400); font-style: italic; margin-bottom: 6px; }
.dict-syn     { font-size: 12px; color: var(--blue); }

/* ── 단어장 페이지 ────────────────────────────────────────────────────────── */
.vocab-list  { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 32px; }
.vocab-card  {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 16px 20px;
  box-shadow: var(--shadow);
}
.vocab-card-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.vocab-word  { font-size: 18px; font-weight: 700; color: var(--blue); flex: 1; }
.vocab-ko    { font-size: 16px; font-weight: 600; color: var(--gray-800); margin-bottom: 4px; }
.vocab-def   { font-size: 13px; line-height: 1.6; color: var(--gray-400); }
.vocab-del   {
  background: none; border: none; color: var(--gray-400);
  cursor: pointer; font-size: 15px; padding: 2px 6px; border-radius: 4px;
  margin-left: auto;
}
.vocab-del:hover { background: #fee2e2; color: var(--red); }

/* ── 시험 타이머 ─────────────────────────────────────────────────────────────── */
.exam-timer {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
  min-width: 80px;
}
.timer-display {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: .5px;
  transition: color .4s;
  color: var(--green);
}
.timer-zone {
  font-size: 11px;
  font-weight: 500;
  opacity: .75;
  margin-top: 1px;
}
.zone-perfect { color: #16a34a; }
.zone-high    { color: #2563eb; }
.zone-good    { color: #d97706; }
.zone-ok      { color: #ea580c; }
.zone-slow    { color: #dc2626; }

/* ── 시험 중 점수 예측 바 ───────────────────────────────────────────────────── */
#scorePrediction {
  background: #f8fafc;
  border-bottom: 1px solid var(--gray-200);
}
.score-pred-inner {
  max-width: 860px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 7px 20px;
  font-size: 13px;
}
.score-pred-lbl {
  font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 99px;
  border: 1.5px solid currentColor;
  white-space: nowrap;
}
.score-pred-range { font-size: 14px; white-space: nowrap; }
.score-pred-range strong { font-size: 15px; }
.score-pred-sub  { color: var(--gray-600); font-size: 12px; }
.score-pred-note { color: var(--gray-400); font-size: 11px; margin-left: auto; }

/* 결과 화면 RC 예측 카드 */
.result-score-pred {
  background: var(--gray-100);
  border-radius: var(--radius);
  padding: 16px 24px;
  text-align: center;
  display: inline-block;
  min-width: 220px;
}
.rsp-title {
  font-size: 12px; color: var(--gray-600); font-weight: 600;
  margin-bottom: 6px; letter-spacing: .3px;
}
.rsp-note { font-weight: 400; color: var(--gray-400); margin-left: 4px; }
.rsp-range {
  font-size: 30px; font-weight: 800;
  line-height: 1.1; letter-spacing: -.5px;
}
.rsp-unit { font-size: 16px; font-weight: 600; margin-left: 2px; }
.rsp-label {
  font-size: 13px; font-weight: 700;
  margin-top: 4px;
}

/* 결과 화면 타이머 배지 */
.result-timer-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-radius: 24px;
  background: #f1f5f9;
  border: 2px solid currentColor;
  margin: 0 auto;
}
.rtb-time {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.rtb-label {
  font-size: 13px;
  font-weight: 600;
}
#resultTimerBadge { text-align: center; }

/* ── OMR 답안지 패널 ──────────────────────────────────────────────────────────── */
.omr-panel {
  width: 240px;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: sticky;
  top: calc(56px + 57px + 8px); /* nav + exam-header + gap */
  max-height: calc(100vh - 160px);
  overflow-y: auto;
  padding-bottom: 8px;
}

/* 점수 예측 */
.omr-pred {
  display: flex; flex-direction: column; align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-200);
  background: #f8fafc;
  border-radius: var(--radius) var(--radius) 0 0;
}
.omr-pred-range {
  font-size: 17px; font-weight: 800; line-height: 1.1;
}
.omr-pred-range small { font-size: 11px; font-weight: 500; margin-left: 2px; opacity: .75; }
.omr-pred-lbl { font-size: 11px; font-weight: 700; margin-top: 2px; }

/* 헤더 */
.omr-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px 6px;
  border-bottom: 1px solid var(--gray-200);
}
.omr-title { font-size: 12px; font-weight: 700; color: var(--gray-600); letter-spacing: .5px; }
.omr-count { font-size: 12px; color: var(--gray-400); }

/* 섹션 구분 */
.omr-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  color: var(--gray-400);
  padding: 8px 14px 3px;
  text-transform: uppercase;
}
.omr-group-label {
  font-size: 10px; color: var(--gray-400);
  padding: 5px 14px 1px;
  border-top: 1px dashed var(--gray-200);
  margin-top: 3px;
}

/* 문제 행 */
.omr-rows { padding: 0 8px; }
.omr-row {
  display: flex; align-items: center; gap: 3px;
  padding: 3px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .1s;
}
.omr-row:hover  { background: var(--gray-100); }
.omr-row.active { background: #eff6ff; }

/* 문제 번호 */
.omr-num {
  font-size: 11px; font-weight: 600; color: var(--gray-400);
  width: 22px; text-align: right; flex-shrink: 0;
  transition: color .15s;
}
.omr-num.done { color: var(--gray-800); }

/* 버블 */
.omr-bubble {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--gray-200);
  background: #fff;
  font-size: 10px; font-weight: 700; color: var(--gray-400);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .12s;
  padding: 0;
}
.omr-bubble:hover   { border-color: var(--blue); color: var(--blue); }
.omr-bubble.omr-chosen  {
  background: var(--blue); border-color: var(--blue); color: #fff;
}
.omr-bubble.omr-correct {
  background: #16a34a; border-color: #16a34a; color: #fff;
}
.omr-bubble.omr-wrong   {
  background: #dc2626; border-color: #dc2626; color: #fff;
  text-decoration: line-through;
}

/* 정답보기 버튼 */
.omr-submit-btn {
  display: block; width: calc(100% - 16px);
  margin: 10px 8px 6px;
  padding: 10px;
  border: none; border-radius: 8px;
  background: var(--gray-200); color: var(--gray-600);
  font-size: 13px; font-weight: 700;
  cursor: pointer; transition: all .2s;
}
.omr-submit-btn.ready {
  background: var(--blue); color: #fff;
}
.omr-submit-btn.ready:hover { background: var(--blue-h); }
.omr-submit-btn:not(.ready):hover { background: var(--gray-200); }

/* ── 모바일 FAB + 드로어 ──────────────────────────────────────────────────────── */
.omr-fab {
  position: fixed; bottom: 20px; right: 16px;
  z-index: 130;
  display: none; /* 데스크톱에서는 항상 숨김 */
  align-items: center; gap: 6px;
  padding: 10px 16px;
  background: var(--blue); color: #fff;
  border: none; border-radius: 24px;
  font-size: 13px; font-weight: 700;
  box-shadow: 0 4px 16px rgba(37,99,235,.4);
  cursor: pointer;
}
.omr-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 140;
}
.omr-overlay.show { display: block; }

/* ── 토스트 알림 ──────────────────────────────────────────────────────────────── */
.app-toast {
  position: fixed; bottom: 72px; left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #1e293b; color: #fff;
  padding: 10px 20px; border-radius: 8px;
  font-size: 13px; line-height: 1.4;
  opacity: 0; transition: opacity .25s, transform .25s;
  z-index: 300; pointer-events: none;
  white-space: nowrap; max-width: 90vw; text-align: center;
}
.app-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── 네비게이션 인증 영역 ─────────────────────────────────────────────────────── */
.nav-auth { margin-left: auto; display: flex; align-items: center; }

.nav-user { position: relative; }
.nav-user-btn {
  display: flex; align-items: center; gap: 8px;
  background: none; border: none; cursor: pointer; padding: 4px 8px;
  border-radius: 8px; transition: background .15s;
}
.nav-user-btn:hover { background: var(--gray-100); }
.nav-avatar {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover;
}
.nav-username { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.nav-plan-badge {
  font-size: 10px; font-weight: 700; color: #fff;
  padding: 2px 7px; border-radius: 99px;
}
.nav-user-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: 10px; box-shadow: var(--shadow);
  min-width: 160px; z-index: 200; overflow: hidden;
}
.num-item {
  display: block; padding: 10px 16px;
  font-size: 13px; color: var(--gray-800);
  text-decoration: none; border: none; background: none;
  cursor: pointer; width: 100%; text-align: left;
  transition: background .1s;
}
.num-item:hover { background: var(--gray-100); }
.num-plan { color: var(--gray-400); font-size: 12px; cursor: default; }
.num-plan:hover { background: none; }
.num-logout { color: var(--red); }

/* ── 로그인 모달 ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: #fff; border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  position: relative;
}
.modal-close-btn {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; font-size: 18px;
  color: var(--gray-400); cursor: pointer;
}
.login-box { padding: 40px 36px; width: min(400px, 92vw); text-align: center; }
.login-logo { font-size: 20px; font-weight: 800; color: var(--blue); margin-bottom: 16px; }
.login-title { font-size: 18px; font-weight: 700; line-height: 1.5; margin-bottom: 28px; }
.login-btns  { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.login-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 13px 20px; border-radius: 10px;
  font-size: 15px; font-weight: 600;
  text-decoration: none; transition: opacity .15s;
}
.login-btn:hover { opacity: .88; }
.login-kakao { background: #FEE500; color: #3C1E1E; }
.login-google { background: #fff; color: #3c4043; border: 1px solid var(--gray-200); }
.login-note   { font-size: 11px; color: var(--gray-400); line-height: 1.6; }
.login-note a { color: var(--blue); }

/* ── 요금제 페이지 ────────────────────────────────────────────────────────────── */
.pricing-header { text-align: center; padding: 48px 0 32px; }
.pricing-header h1 { font-size: 28px; font-weight: 800; }
.pricing-header p  { color: var(--gray-600); margin-top: 8px; }
.pricing-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 20px; padding-bottom: 60px;
}
.pricing-grid-2col {
  grid-template-columns: repeat(2, 1fr);
  max-width: 680px; margin: 0 auto;
}
.plan-price-sub {
  font-size: 12px; color: var(--gray-400); margin-top: -14px; margin-bottom: 16px;
}
.pricing-note {
  text-align: center; font-size: 12px; color: var(--gray-400); padding-bottom: 40px;
}
.pricing-card {
  background: #fff; border: 1.5px solid var(--gray-200);
  border-radius: 16px; padding: 28px 24px;
  position: relative; transition: box-shadow .2s;
}
.pricing-card.featured {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.plan-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--blue); color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 3px 14px; border-radius: 99px;
}
.plan-name  { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.plan-price { font-size: 28px; font-weight: 800; margin-bottom: 20px; }
.plan-price span { font-size: 14px; font-weight: 500; color: var(--gray-400); }
.plan-features { list-style: none; font-size: 14px; line-height: 2; margin-bottom: 24px; }
.plan-features li.dim { color: var(--gray-400); }
.plan-btn {
  width: 100%; padding: 12px; border-radius: 10px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  border: 1.5px solid var(--gray-200); background: #fff;
  transition: all .15s;
}
.plan-btn:hover { background: var(--gray-100); }
.plan-btn-premium {
  background: #f5f3ff; border-color: #7c3aed; color: #7c3aed;
}

@media (max-width: 700px) {
  .pricing-grid { grid-template-columns: 1fr; }
  .pricing-grid-2col { grid-template-columns: 1fr; }
}

/* ── 약점 유형 업셀 카드 ──────────────────────────────────────────────────────── */
.upsell-card {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%);
  border: 1.5px solid #bfdbfe;
  border-radius: 14px; padding: 18px 20px;
  text-align: left;
}
.upsell-icon { font-size: 28px; flex-shrink: 0; }
.upsell-body { flex: 1; min-width: 180px; }
.upsell-title { font-size: 14px; font-weight: 700; margin-bottom: 6px; color: var(--gray-800); }
.upsell-types { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.upsell-type-chip {
  font-size: 12px; font-weight: 600;
  background: #dbeafe; color: #1d4ed8;
  padding: 2px 10px; border-radius: 99px;
}
.upsell-desc { font-size: 12px; color: var(--gray-600); }
.upsell-btn  { white-space: nowrap; flex-shrink: 0; }

/* ── 모바일 반응형 ────────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .exam-layout.has-omr { display: block; }
  .omr-panel {
    position: fixed;
    bottom: 0; left: 0; right: 0; width: 100%;
    max-height: 65vh;
    border-radius: 16px 16px 0 0;
    border: none;
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(.32,.72,0,1);
    z-index: 150;
    top: auto;
  }
  .omr-panel.drawer-open { transform: translateY(0); }
  .omr-fab.omr-active { display: flex; }
}
