/* ===========================
   기사문답 - 전체 디자인 시스템
   =========================== */

:root {
  /* 브랜드 컬러 */
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #e0e7ff;
  --secondary: #f59e0b;
  --secondary-light: #fef3c7;

  /* 상태 컬러 */
  --correct: #10b981;
  --correct-light: #d1fae5;
  --wrong: #ef4444;
  --wrong-light: #fee2e2;

  /* 배경 */
  --bg: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-elevated: #16213e;
  --bg-surface: #1e1e3a;

  /* 텍스트 */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* 보더 */
  --border: #2d2d4e;
  --border-light: #3d3d5e;

  /* 그라디언트 */
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
  --gradient-hero: linear-gradient(180deg, #1e1b4b 0%, #0f0f1a 100%);
  --gradient-correct: linear-gradient(135deg, #059669, #10b981);
  --gradient-wrong: linear-gradient(135deg, #dc2626, #ef4444);

  /* 그림자 */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.3);

  /* 반경 */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* 하단 네비 높이 */
  --nav-height: 72px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--text-primary);
  font-family: "Noto Sans KR", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
}

#root {
  height: 100%;
}

/* ===========================
   KaTeX 수식 스타일 오버라이드
   =========================== */
.math-inline {
  display: inline;
  vertical-align: middle;
}

/* KaTeX 다크모드 색상 강제 */
.katex {
  color: var(--text-primary) !important;
  font-size: 1em !important;
}

/* 조건 블록 내 수식 크기 */
.question-condition-item .katex {
  font-size: 0.95em !important;
}

/* 보기 내 수식 - 분수가 있으면 세로 여백 */
.choice-text .katex-display,
.modal-choice-text .katex-display {
  margin: 0 !important;
}

.choice-btn {
  align-items: flex-start;
}

/* 해설 내 p 태그 간격 */
.modal-explanation-text p {
  margin-bottom: 4px;
  line-height: 1.8;
}

.modal-explanation-text p:last-child {
  margin-bottom: 0;
}


/* ===========================
   앱 컨테이너
   =========================== */
.app-container {
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ===========================
   홈 화면
   =========================== */
.home-screen {
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-height) + 16px);
  overflow-y: auto;
}

.home-hero {
  background: var(--gradient-hero);
  padding: 60px 24px 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.home-hero::before {
  content: "";
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.3) 0%, transparent 70%);
  pointer-events: none;
}

.hero-icon {
  font-size: 52px;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 20px rgba(245, 158, 11, 0.6));
  animation: float 3s ease-in-out infinite;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

.hero-title {
  font-size: 32px;
  font-weight: 900;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.hero-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 400;
}

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

/* 오답노트 배너 */
.wrong-note-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.wrong-note-banner:hover {
  border-color: rgba(239, 68, 68, 0.6);
  transform: translateY(-1px);
}

.wrong-note-banner-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.wrong-note-banner-icon {
  font-size: 28px;
}

.wrong-note-banner-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.wrong-note-banner-sub {
  font-size: 12px;
  color: var(--wrong);
  margin-top: 2px;
}

.wrong-note-banner-arrow {
  font-size: 24px;
  color: var(--wrong);
  font-weight: 700;
}

/* 과목 그룹 */
.subject-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.subject-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.subject-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 3px 8px;
  border-radius: 100px;
  letter-spacing: 0.3px;
}

.subject-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.exam-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ===========================
   년도별 아코디언
   =========================== */
.year-accordion-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.year-accordion {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.year-accordion--open {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.1);
}

.year-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  font-family: inherit;
  transition: background 0.2s ease;
}

.year-accordion-header:hover {
  background: rgba(99, 102, 241, 0.06);
}

.year-accordion-header:active {
  background: rgba(99, 102, 241, 0.12);
}

.year-accordion-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.year-accordion-icon {
  font-size: 20px;
}

.year-accordion-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.year-accordion-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: 100px;
}

.year-accordion-chevron {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-muted);
  transform: rotate(-90deg);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-block;
}

.year-accordion-chevron--open {
  transform: rotate(90deg);
}

/* 아코디언 본문: max-height 트랜지션으로 부드러운 열기/닫기 */
.year-accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.year-accordion-body--open {
  max-height: 600px;
  /* 충분히 큰 값 */
}

.year-accordion-inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 12px 12px;
}

/* 내부 시험 카드 -- 약간 작은 스타일 */
.exam-card--nested {
  background: var(--bg-surface);
  border-color: var(--border);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
}

.exam-card--nested:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--primary);
}

.exam-card--nested .exam-card-round {
  font-size: 15px;
}

.exam-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  text-align: left;
}

.exam-card:hover {
  border-color: var(--primary);
  background: var(--bg-surface);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.exam-card:active {
  transform: translateY(0);
}

.exam-card-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.exam-card-year {
  font-size: 13px;
  color: var(--text-secondary);
}

.exam-card-round {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.exam-card-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.exam-card-count {
  font-size: 13px;
  color: var(--primary);
  background: var(--primary-light);
  padding: 4px 10px;
  border-radius: 100px;
  font-weight: 600;
}

.exam-card-arrow {
  font-size: 22px;
  color: var(--text-muted);
  font-weight: 700;
}

/* ===========================
   퀴즈 화면
   =========================== */
.quiz-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
  gap: 12px;
}

.quiz-back-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.quiz-back-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.quiz-header-info {
  flex: 1;
  text-align: center;
}

.quiz-subject {
  font-size: 12px;
  color: var(--text-secondary);
}

.quiz-round {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.quiz-progress-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  min-width: 40px;
  text-align: right;
}

.quiz-progress-bar {
  height: 4px;
  background: var(--border);
  position: sticky;
  top: 76px;
  z-index: 10;
}

.quiz-progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 0 4px 4px 0;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.quiz-content {
  flex: 1;
  padding: 24px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.question-number {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* 카테고리 배지: "2023년 2회 · 태양광발전 기획" */
.question-category-badge {
  display: inline-flex;
  align-items: center;
  gap: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 4px 12px;
  width: fit-content;
  letter-spacing: 0.2px;
}

.question-category-dot {
  color: var(--primary);
  font-weight: 700;
  margin: 0 2px;
}


.question-text {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.75;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.question-text p {
  margin-bottom: 4px;
}

.question-text p:last-child {
  margin-bottom: 0;
}

.question-condition-header {
  font-weight: 700;
  color: var(--secondary);
  margin-top: 8px !important;
}

.question-condition-item {
  font-size: 14px;
  color: var(--text-secondary);
  padding-left: 4px;
}

.choices-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.choice-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 18px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  color: var(--text-primary);
}

.choice-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
  transform: translateX(4px);
}

.choice-btn:active:not(:disabled) {
  transform: translateX(2px);
}

.choice-btn:disabled {
  cursor: not-allowed;
}

.choice-btn.choice-correct {
  border-color: var(--correct);
  background: rgba(16, 185, 129, 0.1);
  animation: pulse-correct 0.4s ease;
}

.choice-btn.choice-wrong {
  border-color: var(--wrong);
  background: rgba(239, 68, 68, 0.1);
}

@keyframes pulse-correct {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.02);
  }

  100% {
    transform: scale(1);
  }
}

.choice-symbol {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  min-width: 24px;
}

.choice-btn.choice-correct .choice-symbol {
  color: var(--correct);
}

.choice-btn.choice-wrong .choice-symbol {
  color: var(--wrong);
}

.choice-text {
  font-size: 15px;
  font-weight: 500;
  flex: 1;
}

/* ===========================
   문제 이미지 / 보기 이미지
   =========================== */

/* 문제 본문 도면 */
.question-image-wrap {
  margin: 4px 0 8px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  text-align: center;
  padding: 8px;
}

.question-image {
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  display: block;
  margin: 0 auto;
}

/* 보기에 이미지가 있는 경우 */
.choice-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.choice-image-content {
  align-items: center;
}

.choice-img {
  max-width: 120px;
  max-height: 100px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  padding: 4px;
  border: 1px solid var(--border);
}

/* 보기가 모두 이미지일 때 2x2 그리드 레이아웃 */
.choices-list.choices-image-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.choices-list.choices-image-grid .choice-btn {
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 8px;
}

.choices-list.choices-image-grid .choice-img {
  max-width: 100%;
  max-height: 120px;
}


/* 해설 본 후 하단 다음 문제 버튼 */
.quiz-bottom-next {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
  animation: fadeIn 0.3s ease;
}

.quiz-bottom-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

.quiz-next-fixed-btn {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--gradient-primary);
  color: white;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.quiz-next-fixed-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

/* ===========================
   해설 모달
   =========================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 88dvh;
  background: var(--bg-elevated);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 24px 20px 40px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-result-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-weight: 700;
}

.modal-result-badge.correct {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.modal-result-badge.wrong {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.modal-result-icon {
  font-size: 24px;
}

.modal-result-text {
  font-size: 17px;
  font-weight: 700;
}

.modal-result-badge.correct .modal-result-text {
  color: var(--correct);
}

.modal-result-badge.wrong .modal-result-text {
  color: var(--wrong);
}

.modal-answers {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

.modal-choice-correct {
  background: rgba(16, 185, 129, 0.12);
  border-color: var(--correct);
}

.modal-choice-wrong {
  background: rgba(239, 68, 68, 0.08);
  border-color: var(--wrong);
}

.modal-choice-num {
  font-weight: 700;
  font-size: 16px;
  min-width: 20px;
}

.modal-choice-correct .modal-choice-num {
  color: var(--correct);
}

.modal-choice-wrong .modal-choice-num {
  color: var(--wrong);
}

.modal-choice-text {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary);
}

.modal-choice-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
  flex-shrink: 0;
}

.correct-tag {
  background: var(--correct);
  color: white;
}

.wrong-tag {
  background: var(--wrong);
  color: white;
}

.modal-explanation-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px;
}

.modal-explanation-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 10px;
  letter-spacing: 0.3px;
}

.modal-explanation-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.8;
  white-space: pre-line;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.modal-btn-close {
  flex: 1;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.modal-btn-close:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
}

.modal-btn-next {
  flex: 2;
  padding: 14px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--gradient-primary);
  color: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.modal-btn-next:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

/* ===========================
   결과 화면
   =========================== */
.result-screen {
  min-height: 100dvh;
  overflow-y: auto;
  padding-bottom: 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.result-header {
  padding: 24px 20px 0;
  text-align: center;
}

.result-subject {
  font-size: 14px;
  color: var(--text-secondary);
}

.result-round {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.result-score-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.result-score-circle {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 4px solid;
  position: relative;
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from {
    transform: scale(0.5);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.grade-s {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
}

.grade-a {
  border-color: var(--correct);
  background: rgba(16, 185, 129, 0.1);
}

.grade-b {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

.grade-c {
  border-color: var(--secondary);
  background: rgba(245, 158, 11, 0.1);
}

.grade-f {
  border-color: var(--wrong);
  background: rgba(239, 68, 68, 0.1);
}

.result-score-emoji {
  font-size: 36px;
  margin-bottom: 4px;
}

.result-score-number {
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
  color: var(--text-primary);
}

.result-score-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.result-grade-badge {
  font-size: 22px;
  font-weight: 900;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.result-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin: 0 16px;
  padding: 20px 0;
}

.result-stat-item {
  flex: 1;
  text-align: center;
}

.result-stat-number {
  font-size: 28px;
  font-weight: 900;
}

.correct-stat .result-stat-number {
  color: var(--correct);
}

.wrong-stat .result-stat-number {
  color: var(--wrong);
}

.total-stat .result-stat-number {
  color: var(--primary);
}

.result-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.result-stat-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
}

.result-detail {
  margin: 0 16px;
}

.result-detail-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 12px;
  letter-spacing: 0.3px;
}

.result-detail-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-detail-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.item-correct {
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.2);
}

.item-wrong {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.2);
}

.result-detail-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 28px;
}

.result-detail-icon {
  font-size: 16px;
  font-weight: 700;
}

.item-correct .result-detail-icon {
  color: var(--correct);
}

.item-wrong .result-detail-icon {
  color: var(--wrong);
}

.result-detail-answer {
  font-size: 13px;
  color: var(--text-secondary);
}

.result-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 16px;
}

.btn-wrong-note,
.btn-retry,
.btn-home {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-md);
  border: none;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.btn-wrong-note {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: var(--wrong);
}

.btn-retry {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-home {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-retry:hover {
  transform: translateY(-2px);
}

.btn-home:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
}

.btn-wrong-note:hover {
  background: rgba(239, 68, 68, 0.25);
}

/* ===========================
   공통 화면 헤더
   =========================== */
.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
  border-bottom: 1px solid var(--border);
}

.screen-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.header-action-btn {
  font-size: 13px;
  color: var(--wrong);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: background 0.2s;
}

.header-action-btn:hover {
  background: rgba(239, 68, 68, 0.1);
}

.header-action-confirm {
  color: white !important;
  background: var(--wrong) !important;
  border-radius: var(--radius-sm);
}

.header-action-confirm:hover {
  background: #dc2626 !important;
}

/* 삭제 확인 배너 */
.clear-confirm-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.1);
  border-bottom: 1px solid rgba(239, 68, 68, 0.3);
  font-size: 13px;
  color: var(--wrong);
  font-weight: 500;
  animation: fadeIn 0.2s ease;
}

.clear-confirm-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.clear-cancel-btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.clear-cancel-btn:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
}

.clear-confirm-btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--wrong);
  color: white;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.clear-confirm-btn:hover {
  background: #dc2626;
}

/* ===========================
   오답노트 화면
   =========================== */
.wrong-screen {
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-height) + 16px);
  overflow-y: auto;
}

.wrong-summary-bar {
  padding: 12px 20px;
  font-size: 13px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.wrong-summary-bar strong {
  color: var(--wrong);
  font-weight: 700;
}

.wrong-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.wrong-group-header {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
  padding: 0 4px;
}

.wrong-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  margin-bottom: 8px;
  transition: all 0.2s;
}

.wrong-item-card:hover {
  border-color: var(--wrong);
  background: rgba(239, 68, 68, 0.05);
  transform: translateX(4px);
}

.wrong-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.wrong-item-num {
  font-size: 13px;
  font-weight: 800;
  color: var(--wrong);
  min-width: 28px;
}

.wrong-item-question {
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wrong-item-arrow {
  font-size: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.wrong-detail-question {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.7;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 14px;
  max-height: 120px;
  overflow-y: auto;
}

.wrong-detail-question p {
  margin-bottom: 4px;
}

/* ===========================
   My Records 화면
   =========================== */
.records-screen {
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-height) + 16px);
  overflow-y: auto;
}

.records-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 16px;
}

.records-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.records-stat-icon {
  font-size: 22px;
}

.records-stat-value {
  font-size: 22px;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
}

.records-stat-label {
  font-size: 11px;
  color: var(--text-muted);
}

.records-content {
  padding: 0 16px 0;
}

.records-list-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.records-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.record-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  overflow: hidden;
}

.record-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}

.record-card-subject {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.record-card-round {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.record-card-score {
  font-size: 24px;
  font-weight: 900;
}

.score-high {
  color: var(--correct);
}

.score-mid {
  color: var(--secondary);
}

.score-low {
  color: var(--wrong);
}

.record-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.record-card-detail {
  font-size: 12px;
  color: var(--text-secondary);
}

.record-card-date {
  font-size: 11px;
  color: var(--text-muted);
}

.record-bar-bg {
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.record-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.record-bar-fill.score-high {
  background: var(--gradient-correct);
}

.record-bar-fill.score-mid {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.record-bar-fill.score-low {
  background: var(--gradient-wrong);
}

/* ===========================
   빈 상태
   =========================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50dvh;
  gap: 12px;
  padding: 40px;
  text-align: center;
}

.empty-icon {
  font-size: 64px;
  animation: float 3s ease-in-out infinite;
}

.empty-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.empty-sub {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ===========================
   하단 네이게이션 바
   =========================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--nav-height);
  background: rgba(26, 26, 46, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  padding: 8px 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  position: relative;
  transition: all 0.2s;
}

.nav-icon {
  font-size: 22px;
  transition: transform 0.2s;
}

.nav-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  transition: color 0.2s;
}

.nav-item.nav-active .nav-label {
  color: var(--primary);
  font-weight: 700;
}

.nav-item.nav-active .nav-icon {
  transform: scale(1.15);
  filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.6));
}

.nav-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 20px);
  min-width: 18px;
  height: 18px;
  border-radius: 100px;
  background: var(--wrong);
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ===========================
   스크롤바 커스텀
   =========================== */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

/* ===========================
   설정 아이콘 버튼 (홈 히어로)
   =========================== */
.settings-icon-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 5;
}

.settings-icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  transform: rotate(30deg);
}

/* ===========================
   랜덤 모드 카드
   =========================== */
.random-mode-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.1));
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.2s ease;
}

.random-mode-card:hover {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(139, 92, 246, 0.15));
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.25);
}

.random-mode-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.random-mode-icon {
  font-size: 28px;
}

.random-mode-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.random-mode-sub {
  font-size: 12px;
  color: var(--primary);
  margin-top: 2px;
}

.random-mode-arrow {
  font-size: 24px;
  color: var(--primary);
  font-weight: 700;
}

/* 랜덤 문제 수 선택 그리드 */
.random-count-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.random-count-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 18px 12px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-primary);
  font-family: inherit;
}

.random-count-btn:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
  transform: scale(1.02);
}

.random-count-num {
  font-size: 28px;
  font-weight: 900;
  color: var(--primary);
}

.random-count-label {
  font-size: 13px;
  color: var(--text-secondary);
}

/* 랜덤 배지 */
.random-badge {
  display: inline-block;
  font-size: 13px;
  margin-left: 6px;
  vertical-align: middle;
}

/* 가져오기 버튼 */
.import-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  border: 1.5px dashed var(--border-light);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.import-btn:hover {
  border-color: var(--secondary);
  color: var(--secondary);
  background: rgba(245, 158, 11, 0.05);
}

/* ===========================
   타이머
   =========================== */
.timer-container {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.timer-bar-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.timer-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.9s linear, background 0.3s;
}

.timer-bar-fill.timer-green {
  background: var(--correct);
}

.timer-bar-fill.timer-yellow {
  background: var(--secondary);
}

.timer-bar-fill.timer-red {
  background: var(--wrong);
  animation: timer-pulse 0.5s ease-in-out infinite alternate;
}

@keyframes timer-pulse {
  from {
    opacity: 1;
  }

  to {
    opacity: 0.6;
  }
}

.timer-label {
  font-size: 13px;
  font-weight: 700;
  min-width: 48px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.timer-label.timer-green {
  color: var(--correct);
}

.timer-label.timer-yellow {
  color: var(--secondary);
}

.timer-label.timer-red {
  color: var(--wrong);
}

/* ===========================
   설정 모달 (시트)
   =========================== */
.settings-sheet {
  gap: 20px;
}

.settings-handle {
  width: 40px;
  height: 4px;
  background: var(--border-light);
  border-radius: 4px;
  margin: 0 auto -4px;
}

.settings-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
}

.settings-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-row-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.settings-row-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* 토글 스위치 */
.toggle-btn {
  width: 50px;
  height: 28px;
  border-radius: 100px;
  border: none;
  background: var(--border);
  cursor: pointer;
  position: relative;
  transition: background 0.3s;
  flex-shrink: 0;
}

.toggle-btn.toggle-on {
  background: var(--primary);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.toggle-btn.toggle-on .toggle-thumb {
  transform: translateX(22px);
}

/* 타이머 옵션 */
.timer-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.timer-opt-btn {
  padding: 10px 4px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.timer-opt-btn.timer-opt-selected {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary);
}

.timer-opt-btn:hover:not(.timer-opt-selected) {
  border-color: var(--border-light);
  color: var(--text-primary);
}

/* ===========================
   임포트 화면
   =========================== */
.import-screen {
  min-height: 100dvh;
  overflow-y: auto;
}

.import-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 40px;
}

.import-guide-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.import-guide-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.import-guide-code {
  font-family: "Courier New", "Consolas", monospace;
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 12px;
  overflow-x: auto;
  line-height: 1.6;
  white-space: pre;
  border: 1px solid var(--border);
}

.btn-download-template {
  width: 100%;
  padding: 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--secondary);
  background: rgba(245, 158, 11, 0.1);
  color: var(--secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.btn-download-template:hover {
  background: rgba(245, 158, 11, 0.2);
}

.btn-pick-file {
  width: 100%;
  padding: 18px;
  border-radius: var(--radius-md);
  border: 2px dashed var(--primary);
  background: rgba(99, 102, 241, 0.06);
  color: var(--primary);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.btn-pick-file:hover {
  background: rgba(99, 102, 241, 0.12);
  transform: scale(1.01);
}

.import-error-box {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--wrong);
  font-weight: 500;
}

.import-preview-card {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.import-preview-header {
  font-size: 15px;
  font-weight: 700;
  color: var(--correct);
}

.import-preview-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.import-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  color: var(--text-secondary);
}

.import-preview-row strong {
  color: var(--text-primary);
  font-weight: 600;
}

.btn-confirm-import {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--gradient-correct);
  color: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
}

.btn-confirm-import:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
}

/* ===========================
   시험 시작 옵션 모달
   =========================== */
.exam-start-modal {
  gap: 12px;
}

.exam-start-header {
  text-align: center;
  margin-bottom: 4px;
}

.exam-start-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* 옵션 버튼 목록 */
.exam-start-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.exam-start-option-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 18px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: all 0.25s ease;
  color: var(--text-primary);
  font-family: inherit;
}

.exam-start-option-btn:hover {
  transform: translateX(6px);
  box-shadow: var(--shadow-md);
}

.exam-start-option-btn:active {
  transform: translateX(3px);
}

.exam-start-option-btn.option-full:hover {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.08);
}

.exam-start-option-btn.option-subject:hover {
  border-color: #8b5cf6;
  background: rgba(139, 92, 246, 0.08);
}

.exam-start-option-btn.option-only:hover {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
}

.exam-start-option-btn.option-number:hover {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}

.option-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.option-icon-full {
  background: rgba(99, 102, 241, 0.15);
}

.option-icon-subject {
  background: rgba(139, 92, 246, 0.15);
}

.option-icon-only {
  background: rgba(245, 158, 11, 0.15);
}

.option-icon-number {
  background: rgba(16, 185, 129, 0.15);
}

.option-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.option-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.option-desc {
  font-size: 12px;
  color: var(--text-secondary);
}

.option-arrow {
  font-size: 22px;
  color: var(--text-muted);
  font-weight: 700;
  flex-shrink: 0;
}

/* 하위 화면 (과목 선택 / 번호 선택) */
.exam-start-sub-screen {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeSlideIn 0.25s ease;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.sub-screen-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sub-back-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.sub-back-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.sub-screen-title {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
}

.sub-screen-desc {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 4px;
}

/* 과목 선택 리스트 */
.category-select-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.category-select-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  color: var(--text-primary);
  font-family: inherit;
}

.category-select-btn:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.06);
}

.category-select-btn.category-selected {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.12);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.3);
}

.category-select-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.category-select-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.category-select-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.category-check {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  animation: popIn 0.2s ease;
}

@keyframes popIn {
  from {
    transform: scale(0);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* 문제 번호 선택 그리드 */
.number-select-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
}

.number-select-btn {
  aspect-ratio: 1;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  font-family: inherit;
}

.number-select-btn:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
  transform: scale(1.05);
}

.number-select-btn.number-selected {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
  transform: scale(1.08);
}

.number-select-info-box {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  animation: fadeIn 0.2s ease;
}

.number-info-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
}

.number-info-cat {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-surface);
  padding: 2px 8px;
  border-radius: 100px;
}

.number-info-remaining {
  font-size: 12px;
  color: var(--text-muted);
}

/* 확인 버튼 */
.exam-start-confirm-btn {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--gradient-primary);
  color: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.25s;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
  margin-top: 4px;
}

.exam-start-confirm-btn:hover:not(.btn-disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.exam-start-confirm-btn.btn-disabled {
  background: var(--bg-surface);
  color: var(--text-muted);
  box-shadow: none;
  cursor: not-allowed;
}

/* ===========================
   퀴즈 - 선택 상태 표시
   =========================== */
.choice-btn.choice-selected {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.12);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.3);
}

.choice-btn.choice-selected .choice-symbol {
  color: var(--primary);
}

/* ===========================
   퀴즈 - 하단 액션 버튼
   =========================== */
.quiz-action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.quiz-action-btn {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-md);
  border: none;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.quiz-action-btn:hover {
  transform: translateY(-2px);
}

.quiz-action-btn:active {
  transform: translateY(0);
}

/* 이전 문제 */
.btn-prev-question {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 14px;
  padding: 12px 16px;
}

.btn-prev-question:hover {
  border-color: var(--border-light);
  color: var(--text-secondary);
  background: var(--bg-card);
  transform: translateY(-1px);
}

/* 답안보기 */
.btn-view-answer {
  background: var(--bg-card);
  border: 1.5px solid var(--border-light);
  color: var(--text-secondary);
}

.btn-view-answer:hover {
  border-color: var(--primary);
  color: var(--text-primary);
  background: rgba(99, 102, 241, 0.08);
}

/* 다음 문제 */
.btn-next-question {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-next-question:hover {
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

/* 제출하기 */
.btn-submit-exam {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.btn-submit-exam:hover {
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
}

/* 과목 경계 버튼 그룹 */
.subject-boundary-actions {
  display: flex;
  gap: 10px;
}

/* 과목 제출 */
.btn-subject-submit {
  flex: 1;
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.btn-subject-submit:hover {
  box-shadow: 0 6px 16px rgba(139, 92, 246, 0.5);
}

/* 이어풀기 */
.btn-continue-next {
  flex: 1;
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-continue-next:hover {
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.5);
}

/* ===========================
   과목 채점 모달
   =========================== */
.subject-score-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.subject-score-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.subject-score-number {
  font-size: 52px;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1;
}

.subject-score-unit {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-left: 2px;
}

.subject-score-status {
  font-size: 16px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 100px;
}

.status-pass {
  background: rgba(16, 185, 129, 0.15);
  color: var(--correct);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-fail {
  background: rgba(239, 68, 68, 0.15);
  color: var(--wrong);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.subject-score-detail {
  display: flex;
  justify-content: space-around;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.score-detail-item {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.score-detail-label {
  font-size: 12px;
  color: var(--text-muted);
}

.score-detail-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.subject-score-warning {
  text-align: center;
  font-size: 13px;
  color: var(--wrong);
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  padding: 10px;
}

/* ===========================
   결과 화면 - 합격/불합격 판정
   =========================== */
.result-verdict {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  animation: popIn 0.5s ease 0.3s both;
}

.verdict-text {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 2px;
}

.verdict-pass .verdict-text {
  background: var(--gradient-correct);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.verdict-fail .verdict-text {
  background: var(--gradient-wrong);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.verdict-sub {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ===========================
   결과 화면 - 과목별 채점
   =========================== */
.result-subjects {
  margin: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.3px;
}

.result-subject-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-subject-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s;
}

.result-subject-card.subject-passed {
  border-left: 3px solid var(--correct);
}

.result-subject-card.subject-failed {
  border-left: 3px solid var(--wrong);
}

.result-subject-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.result-subject-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.result-subject-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 100px;
}

.badge-pass {
  background: rgba(16, 185, 129, 0.15);
  color: var(--correct);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-fail {
  background: rgba(239, 68, 68, 0.15);
  color: var(--wrong);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.result-subject-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.result-subject-score-wrap {
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.result-subject-score {
  font-size: 32px;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1;
}

.result-subject-score-unit {
  font-size: 14px;
  color: var(--text-secondary);
}

.result-subject-meta {
  display: flex;
  gap: 8px;
  font-size: 12px;
}

.meta-correct {
  color: var(--correct);
  font-weight: 600;
}

.meta-wrong {
  color: var(--wrong);
  font-weight: 600;
}

.meta-total {
  color: var(--text-muted);
}

/* 점수 바 */
.result-subject-bar-track {
  height: 6px;
  background: var(--bg-surface);
  border-radius: 3px;
  position: relative;
  overflow: visible;
}

.result-subject-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.bar-pass {
  background: var(--gradient-correct);
}

.bar-fail {
  background: var(--gradient-wrong);
}

/* 40점 과락 기준선 */
.result-subject-bar-threshold {
  position: absolute;
  left: 40%;
  top: -3px;
  width: 2px;
  height: 12px;
  background: var(--text-muted);
  border-radius: 1px;
  opacity: 0.5;
}

/* ===========================
   결과 화면 - 합격 기준 안내
   =========================== */
.result-criteria-box {
  margin: 0 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.criteria-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.criteria-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.criteria-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}

.criteria-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.criteria-met {
  background: rgba(16, 185, 129, 0.06);
  color: var(--text-primary);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.criteria-unmet {
  background: rgba(239, 68, 68, 0.06);
  color: var(--text-primary);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.criteria-value {
  margin-left: auto;
  font-weight: 700;
  flex-shrink: 0;
}

.criteria-met .criteria-value {
  color: var(--correct);
}

.criteria-unmet .criteria-value {
  color: var(--wrong);
}