/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-bg: #f4f6f9;
  --color-surface: #ffffff;
  --color-border: #e0e4ea;
  --color-text: #1a1d23;
  --color-text-muted: #6b7280;
  --color-primary: #ff3621;       /* Databricks 레드 */
  --color-primary-dark: #cc2b1a;
  --color-secondary: #1b3a6b;     /* Databricks 네이비 */
  --color-accent: #00a2e4;        /* 하늘색 */
  --color-correct: #16a34a;
  --color-wrong: #dc2626;
  --color-selected: #dbeafe;
  --color-correct-bg: #dcfce7;
  --color-wrong-bg: #fee2e2;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --header-h: 88px;
}

body {
  font-family: 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  padding-top: var(--header-h);
}

/* ============================================================
   Header
   ============================================================ */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--color-secondary);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.header-left { flex: 0 0 auto; }
.logo { font-weight: 700; font-size: 1rem; letter-spacing: -0.3px; white-space: nowrap; }

.header-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

#progress-text { font-size: 0.75rem; color: #cbd5e1; }

.progress-bar {
  width: 100%;
  max-width: 320px;
  height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.header-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  color: #e2e8f0;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
}

.stat-chip strong {
  color: #fff;
  font-size: 0.8rem;
}

.header-right { flex: 0 0 auto; }

.btn-icon {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  line-height: 1;
  transition: background 0.15s;
}
.btn-icon:hover { background: rgba(255,255,255,0.15); }

/* ============================================================
   Side Panel (문제 목록)
   ============================================================ */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
}
.overlay.active { display: block; }

.side-panel {
  position: fixed;
  top: 0; right: -340px;
  width: 320px;
  height: 100vh;
  background: var(--color-surface);
  z-index: 300;
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
  box-shadow: -4px 0 24px rgba(0,0,0,0.15);
}
.side-panel.open { right: 0; }

.side-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--color-secondary);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
}

.side-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.q-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 0.85rem;
}
.q-list-item:hover { background: var(--color-bg); }
.q-list-item.active { background: #dbeafe; font-weight: 600; }
.q-list-item.answered { color: var(--color-text-muted); }
.q-list-item.correct { border-left: 3px solid var(--color-correct); }
.q-list-item.wrong { border-left: 3px solid var(--color-wrong); }
.q-list-item .q-list-no { font-weight: 700; color: var(--color-primary); min-width: 44px; }
.q-list-item .q-list-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-list-item .q-list-status {
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: transparent;
}
.q-list-item.correct .q-list-status {
  background: var(--color-correct-bg);
  color: var(--color-correct);
}
.q-list-item.wrong .q-list-status {
  background: var(--color-wrong-bg);
  color: var(--color-wrong);
}
.q-list-item .q-list-err { color: var(--color-wrong); font-size: 0.75rem; }

/* ============================================================
   Main Content
   ============================================================ */
.main-content {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 16px 140px; /* 하단 nav 높이(~60px) + 여유 80px */
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ============================================================
   Question Meta
   ============================================================ */
.question-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-section { background: var(--color-secondary); color: #fff; }
.badge-subsection { background: #e0e7ff; color: #3730a3; }

.badge-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.badge-link::after {
  content: '↗';
  font-size: 0.7em;
  opacity: 0.7;
}
.badge-link:hover { text-decoration: underline; opacity: 0.85; }

.question-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
  flex: 1;
}

.err-badge {
  display: none;
  background: var(--color-wrong-bg);
  color: var(--color-wrong);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.err-badge.visible { display: inline-block; }

/* ============================================================
   Card
   ============================================================ */
.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
  padding: 24px;
}

.card-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.q-no {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--color-primary);
  background: #fff0ee;
  border: 1.5px solid var(--color-primary);
  border-radius: 6px;
  padding: 2px 10px;
}

.label-text {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============================================================
   Question Text
   ============================================================ */
.question-text {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--color-text);
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--color-border);
}

/* ============================================================
   Options (체크박스)
   ============================================================ */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border: 2px solid var(--color-border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}
.option-item:hover { border-color: var(--color-accent); background: #f0f9ff; }

.option-item input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-border);
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s, background 0.15s;
}
.option-item input[type="checkbox"]:checked {
  background: var(--color-secondary);
  border-color: var(--color-secondary);
}
.option-item input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: -2px; left: 2px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.option-key {
  font-weight: 700;
  color: var(--color-secondary);
  font-size: 0.9rem;
  min-width: 20px;
  flex-shrink: 0;
  line-height: 1.6;
}

.option-text {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--color-text);
  flex: 1;
  white-space: pre-wrap;
  word-break: break-word;
}

/* 정답 확인 후 스타일 */
.option-item.correct {
  border-color: var(--color-correct);
  background: var(--color-correct-bg);
}
.option-item.wrong {
  border-color: var(--color-wrong);
  background: var(--color-wrong-bg);
}
.option-item.correct .option-key { color: var(--color-correct); }
.option-item.wrong .option-key { color: var(--color-wrong); }

.option-badge {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}
.option-badge.correct { background: var(--color-correct); color: #fff; }
.option-badge.wrong { background: var(--color-wrong); color: #fff; }

/* ============================================================
   Action Buttons
   ============================================================ */
.action-row {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.btn {
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }

.btn-submit {
  background: var(--color-primary);
  color: #fff;
}
.btn-submit:hover { background: var(--color-primary-dark); }
.btn-submit:disabled { background: #d1d5db; cursor: not-allowed; }

.btn-retry {
  background: #fff;
  color: var(--color-secondary);
  border: 1px solid var(--color-border);
}
.btn-retry:hover { background: #f8fafc; }
.btn-retry:disabled {
  background: #f8fafc;
  color: #94a3b8;
  border-color: #e5e7eb;
  cursor: not-allowed;
}

.btn-prev-inline {
  background: #f1f5f9;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-prev-inline:hover { background: #e2e8f0; }

.btn-next {
  background: var(--color-secondary);
  color: #fff;
}
.btn-next:hover { background: #14306a; }

/* ============================================================
   Answer Card
   ============================================================ */
.answer-card { border-left: 4px solid var(--color-correct); }

.answer-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.answer-block {}

.answer-block-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.answer-desc {
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--color-text);
  white-space: pre-wrap;
  word-break: break-word;
}

.answer-adb {
  font-size: 0.85rem;
  color: var(--color-accent);
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  padding: 10px 14px;
  word-break: break-word;
}
.answer-adb a {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 600;
}
.answer-adb a:hover { text-decoration: underline; }

.answer-notebook {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.answer-notebook a {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 600;
}
.answer-notebook a:hover { text-decoration: underline; }

.hidden { display: none !important; }

/* ============================================================
   Bottom Navigation (모바일용)
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  gap: 12px;
  z-index: 50;
}

.nav-indicator {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.btn-prev {
  background: #f1f5f9;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  flex: 1;
  max-width: 120px;
}
.btn-prev:hover { background: #e2e8f0; }

.btn-next-bottom {
  background: var(--color-secondary);
  color: #fff;
  flex: 1;
  max-width: 120px;
}
.btn-next-bottom:hover { background: #14306a; }

/* ============================================================
   PC 레이아웃 — 2컬럼 뷰포트 채우기
   ============================================================ */
@media (min-width: 768px) {
  body { padding-top: var(--header-h); }

  .main-content {
    max-width: 1400px;
    padding: 20px 32px 32px;
    gap: 16px;
  }

  /* 문제카드: 2컬럼 그리드, 뷰포트 높이 채우기 */
  .question-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr auto;
    column-gap: 0;
    padding: 0;
    min-height: calc(100vh - var(--header-h) - 160px);
  }

  /* 상단 레이블 행: 전체 너비 */
  .question-card .card-label {
    grid-column: 1 / -1;
    padding: 20px 28px 16px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 0;
  }

  /* 왼쪽: 문제 텍스트 — 길면 스크롤 */
  .question-text {
    grid-column: 1;
    grid-row: 2;
    font-size: 0.95rem;
    margin-bottom: 0;
    padding: 24px 28px;
    border-bottom: none;
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
  }

  /* 오른쪽: 선택지 */
  .options-list {
    grid-column: 2;
    grid-row: 2;
    margin-bottom: 0;
    padding: 20px 28px;
    overflow-y: auto;
  }

  /* 오른쪽 하단: 버튼 */
  .action-row {
    grid-column: 2;
    grid-row: 3;
    padding: 16px 28px;
    border-top: 1px solid var(--color-border);
    justify-content: flex-end;
  }

  /* 버튼 크기 */
  .btn { padding: 10px 28px; }

  /* 정답 카드: 2컬럼 (해설 | ADB+노트북) */
  .answer-card { padding: 0; }
  .answer-card .card-label {
    padding: 16px 28px 14px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 0;
  }
  .answer-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
  }
  .answer-section .answer-block:first-child {
    padding: 20px 28px;
    border-right: 1px solid var(--color-border);
  }
  .answer-section .answer-block:not(:first-child) {
    padding: 20px 28px;
  }

  /* PC에서 하단 네비게이션 숨김 — 카드 내 버튼으로 대체 */
  .bottom-nav { display: none; }
}

/* ============================================================
   모바일 최적화 (768px 미만)
   ============================================================ */
@media (max-width: 767px) {
  :root { --header-h: 96px; }
  .logo { font-size: 0.85rem; }
  .question-title { font-size: 0.95rem; }
  .card { padding: 16px; }
  .question-text { font-size: 0.9rem; }
  .option-text { font-size: 0.88rem; }
  .option-item { padding: 10px 12px; }
  .answer-desc { font-size: 0.88rem; }
  .header-stats { gap: 4px; }
  .stat-chip { padding: 3px 8px; font-size: 0.68rem; }
  .exam-select { max-width: 132px; }

  /* 모바일: 카드 내 이전/다음 버튼 숨김 (하단 nav로 대체) */
  .btn-prev-inline,
  .btn-next { display: none; }

  /* 다시풀기 + 제출 버튼 */
  .action-row { justify-content: stretch; }
  .btn-retry,
  .btn-submit {
    flex: 1;
    width: auto;
    padding: 14px;
    font-size: 1rem;
  }
}

/* ============================================================
   시험 선택기
   ============================================================ */
.exam-select {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.82rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  max-width: 200px;
  outline: none;
}
.exam-select option { background: var(--color-secondary); color: #fff; }
.exam-select:hover { background: rgba(255,255,255,0.25); }

/* ============================================================
   관리자 모달
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: var(--color-surface);
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
}
.modal-wide { max-width: 680px; }
.modal-admin { max-width: 900px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--color-secondary);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
}

.modal-body { padding: 24px 20px; display: flex; flex-direction: column; gap: 16px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.8rem; font-weight: 700; color: var(--color-text-muted); }
.form-group small { font-weight: 400; color: #9ca3af; }
.form-group input {
  border: 1.5px solid var(--color-border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.form-group input:focus { border-color: var(--color-accent); }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-full { grid-column: 1 / -1; }

.form-error {
  color: var(--color-wrong);
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--color-wrong-bg);
  border-radius: 6px;
  padding: 8px 12px;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* 관리자 섹션 */
.admin-section { display: flex; flex-direction: column; gap: 12px; }
.admin-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.admin-section-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

/* 시험 카드 (관리자 목록) */
.exam-admin-card {
  border: 1.5px solid var(--color-border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.exam-admin-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.exam-admin-name { font-weight: 700; font-size: 0.95rem; }
.exam-admin-meta {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.exam-admin-meta span { display: flex; align-items: center; gap: 3px; }
.exam-admin-actions { display: flex; gap: 8px; }

/* 관리자 패널 2컬럼 레이아웃 */
.admin-layout {
  display: flex;
  min-height: 480px;
  max-height: 78vh;
  overflow: hidden;
}

.admin-nav {
  width: 150px;
  flex-shrink: 0;
  border-right: 1px solid var(--color-border);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #f8fafc;
}

.admin-nav-item {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.admin-nav-item:hover { background: #e5e7eb; color: var(--color-text); }
.admin-nav-item.active { background: var(--color-secondary); color: #fff; }

.admin-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.admin-tab { display: flex; flex-direction: column; gap: 16px; }
.admin-tab.hidden { display: none; }

/* 동기화 로그 */
.sync-log {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
}
.sync-log pre {
  margin: 0;
  padding: 12px;
  font-size: 0.78rem;
  line-height: 1.6;
  background: #1e293b;
  color: #94a3b8;
  max-height: 160px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* 샘플 시트 배너 */
.sample-sheet-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
  border-radius: 10px;
  padding: 14px 16px;
  flex-wrap: wrap;
}
.sample-sheet-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sample-sheet-icon { font-size: 1.6rem; line-height: 1; }
.sample-sheet-title { font-weight: 700; font-size: 0.9rem; color: var(--color-secondary); }
.sample-sheet-desc { font-size: 0.78rem; color: var(--color-text-muted); margin-top: 2px; }
.sample-sheet-btns { display: flex; gap: 8px; flex-wrap: wrap; }

.btn-guide {
  background: var(--color-secondary);
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-guide:hover { background: #14306a; }

.btn-sample {
  background: var(--color-accent);
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-sample:hover { background: #0284c7; }

/* 소형 버튼 */
.btn-small { padding: 6px 14px; font-size: 0.8rem; }
.btn-secondary {
  background: #f1f5f9;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger { background: var(--color-wrong); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sync { background: var(--color-accent); color: #fff; }
.btn-sync:hover { background: #0284c7; }
.btn-sync:disabled { background: #93c5fd; cursor: not-allowed; }

/* 회전 애니메이션 (동기화 중) */
@keyframes spin { to { transform: rotate(360deg); } }
.spinning { display: inline-block; animation: spin 1s linear infinite; }

/* ============================================================
   모바일 모드 토글 버튼
   ============================================================ */
.btn-mode-toggle {
  font-size: 1.1rem;
  margin-right: 4px;
}

/* PC에서는 모드 토글 버튼 표시, 실제 모바일에서는 숨김 */
@media (max-width: 767px) {
  .btn-mode-toggle { display: none; }
}

/* ============================================================
   body.mobile-mode — PC에서 모바일 레이아웃 강제 적용
   ============================================================ */
body.mobile-mode .main-content {
  max-width: 430px;
  padding: 20px 16px 140px;
}

/* 2컬럼 그리드 해제 */
body.mobile-mode .question-card {
  display: flex;
  flex-direction: column;
  min-height: unset;
  padding: 16px;
}
body.mobile-mode .question-card .card-label {
  padding: 0;
  border-bottom: none;
  margin-bottom: 16px;
}
body.mobile-mode .question-text {
  grid-column: unset;
  grid-row: unset;
  font-size: 0.9rem;
  border-right: none;
  border-bottom: 1px solid var(--color-border);
  padding: 0 0 20px;
  margin-bottom: 20px;
  overflow-y: unset;
}
body.mobile-mode .options-list {
  grid-column: unset;
  grid-row: unset;
  padding: 0;
  overflow-y: unset;
  margin-bottom: 20px;
}
body.mobile-mode .action-row {
  grid-column: unset;
  grid-row: unset;
  border-top: none;
  padding: 0;
  justify-content: stretch;
}
body.mobile-mode .btn-prev-inline,
body.mobile-mode .btn-next { display: none; }
body.mobile-mode .btn-retry,
body.mobile-mode .btn-submit {
  flex: 1;
  width: auto;
  padding: 14px;
  font-size: 1rem;
}

/* 정답 카드: 단일 컬럼 */
body.mobile-mode .answer-card { padding: 16px; }
body.mobile-mode .answer-card .card-label {
  padding: 0;
  border-bottom: none;
  margin-bottom: 16px;
}
body.mobile-mode .answer-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
body.mobile-mode .answer-section .answer-block:first-child,
body.mobile-mode .answer-section .answer-block:not(:first-child) {
  padding: 0;
  border-right: none;
}

/* 하단 nav 표시 */
body.mobile-mode .bottom-nav {
  display: flex !important;
  max-width: 430px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 12px 12px 0 0;
  border-left: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
}

/* ============================================================
   Scroll smooth
   ============================================================ */
html { scroll-behavior: smooth; }

/* ============================================================
   Animation
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.answer-card:not(.hidden) { animation: fadeIn 0.3s ease; }
