/* ===================================================
   소방안전관리자 1급 마스터 - 모던 반응형 스타일시트
   =================================================== */

:root {
  /* 다크 테마 (기본) */
  --bg-primary: #0b1120;
  --bg-card: #1e293b;
  --bg-card-subtle: #162032;
  --bg-hover: #27354a;
  --border-color: #334155;
  --border-light: #475569;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --fire-red: #ef4444;
  --fire-orange: #f97316;
  --accent-cyan: #38bdf8;
  --correct-green: #10b981;
  --correct-bg: rgba(16, 185, 129, 0.15);
  --wrong-bg: rgba(239, 68, 68, 0.15);

  --font-base: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --shadow-pop: 0 4px 14px rgba(249, 115, 22, 0.35);

  --font-scale: 16px;
}

/* 라이트 테마 */
body.light-theme {
  --bg-primary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-subtle: #f8fafc;
  --bg-hover: #e2e8f0;
  --border-color: #cbd5e1;
  --border-light: #94a3b8;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;

  --correct-bg: #dcfce7;
  --wrong-bg: #fee2e2;
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

/* 폰트 크기 모드 */
body.font-small { --font-scale: 14px; }
body.font-large { --font-scale: 18px; }

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

body {
  font-family: var(--font-base);
  font-size: var(--font-scale);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
}

#app-container {
  width: 100%;
  max-width: 820px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 12px 14px 80px 14px;
}

/* ===================================================
   1. 헤더 & 진도율
   =================================================== */
.app-header {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-card);
  margin-bottom: 12px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

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

.brand-icon {
  font-size: 32px;
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.sub-title {
  font-size: 0.78rem;
  color: var(--fire-orange);
  font-weight: 600;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 16px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: var(--bg-hover);
  border-color: var(--fire-orange);
}

.progress-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.stats-badge strong,
.progress-labels strong {
  color: var(--fire-orange);
  font-weight: 700;
}

.progress-bar-track {
  width: 100%;
  height: 9px;
  background: var(--bg-card-subtle);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f97316, #ef4444);
  border-radius: 6px;
  transition: width 0.3s ease;
}

/* ===================================================
   2. 상단 탭 네비게이션
   =================================================== */
.nav-tabs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.nav-tab {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  text-decoration: none;
}

.nav-tab-link {
  border-color: rgba(168, 85, 247, 0.4);
}

.nav-tab-link:hover {
  background: rgba(168, 85, 247, 0.15);
  border-color: #a855f7;
  color: #c084fc;
}

.nav-tab-link .link-badge {
  background: #a855f7;
  color: #ffffff;
}

.nav-tab:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.nav-tab.active {
  background: linear-gradient(145deg, var(--bg-hover), var(--bg-card));
  border-color: var(--fire-orange);
  color: var(--fire-orange);
  box-shadow: var(--shadow-pop);
}

.tab-icon {
  font-size: 16px;
  line-height: 1;
}

.tab-name {
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: -0.3px;
}

.tab-badge {
  font-size: 0.65rem;
  background: var(--border-color);
  color: var(--text-main);
  padding: 1px 6px;
  border-radius: 10px;
}

.nav-tab.active .tab-badge {
  background: var(--fire-orange);
  color: #ffffff;
}

/* ===================================================
   3. 필터 및 툴바
   =================================================== */
.filter-toolbar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-controls {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 8px;
}

.filter-select {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  outline: none;
}

.filter-select:focus {
  border-color: var(--fire-orange);
}

.filter-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toggle-filter-btn {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.toggle-filter-btn.active {
  background: var(--fire-orange);
  border-color: var(--fire-orange);
  color: #ffffff;
}

.switch-label {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.switch-label input {
  display: none;
}

.switch-slider {
  width: 36px;
  height: 20px;
  background: var(--border-color);
  border-radius: 20px;
  position: relative;
  transition: 0.3s;
}

.switch-slider::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  background: #ffffff;
  border-radius: 50%;
  transition: 0.3s;
}

.switch-label input:checked + .switch-slider {
  background: var(--fire-orange);
}

.switch-label input:checked + .switch-slider::before {
  transform: translateX(16px);
}

.switch-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ===================================================
   4. 메인 콘텐츠 (문제 카드 & 설명란)
   =================================================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.loading-state,
.empty-state {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-color);
  border-top-color: var(--fire-orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 10px;
}

.empty-state h3 {
  font-size: 1.1rem;
  color: var(--text-main);
  margin-bottom: 6px;
}

.primary-btn {
  margin-top: 14px;
  background: var(--fire-orange);
  color: #ffffff;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 700;
}

/* 퀴즈 카드 */
.quiz-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.meta-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
}

.tag-chapter {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.tag-diff {
  background: rgba(249, 115, 22, 0.15);
  color: var(--fire-orange);
  border: 1px solid rgba(249, 115, 22, 0.3);
}

.tag-page {
  background: var(--bg-card-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.bookmark-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-dim);
  transition: transform 0.2s, color 0.2s;
  padding: 0 4px;
}

.bookmark-btn.bookmarked {
  color: #eab308;
  transform: scale(1.15);
}

/* 문제 지문 */
.question-header {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.q-number {
  font-weight: 900;
  color: var(--fire-orange);
  font-size: 1.15rem;
  line-height: 1.4;
}

.q-text {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.5;
  word-break: keep-all;
}

/* 그림·도면 문제 이미지 영역 */
.quiz-image-box {
  width: 100%;
  max-width: 680px;
  margin: 12px auto 16px auto;
  text-align: center;
  position: relative;
  cursor: zoom-in;
  background: var(--bg-card-subtle, #1e293b);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  border-radius: 10px;
  padding: 10px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.quiz-image-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.quiz-image-box img {
  max-width: 100%;
  max-height: 380px;
  height: auto;
  border-radius: 6px;
  display: block;
  margin: 0 auto;
  object-fit: contain;
  background: #ffffff;
}

.image-zoom-hint {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--text-muted, #94a3b8);
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* 이미지 원본 확대 모달 */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
}

.image-modal-content {
  position: relative;
  max-width: 92vw;
  max-height: 90vh;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.image-modal-content img {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  background: #ffffff;
}

.image-modal-close {
  position: absolute;
  top: -44px;
  right: 0;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border: none;
  font-size: 28px;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.image-modal-close:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* 보기(가, 나, 다) 박스 스타일 */
.quiz-box-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--fire-orange);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 10px 0 16px 0;
  font-size: 0.95rem;
  line-height: 1.65;
}

.quiz-box-card .box-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  color: var(--fire-orange);
  font-size: 0.9rem;
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.quiz-box-card .box-item {
  margin-bottom: 8px;
  color: var(--text-main);
  word-break: keep-all;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.quiz-box-card .box-item:last-child {
  margin-bottom: 0;
}

.quiz-box-card .box-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 24px;
  padding: 0 4px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--accent-blue, #38bdf8);
  flex-shrink: 0;
}

.quiz-box-card .box-text {
  flex: 1;
}

/* 4지선다 옵션 리스트 */
.options-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  background: var(--bg-card-subtle);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  text-align: left;
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: all 0.2s ease;
  line-height: 1.45;
}

.option-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border-light);
}

.option-idx {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--border-color);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.option-text {
  flex: 1;
  word-break: keep-all;
}

/* 정답/오답 상태 스타일 */
.option-btn.selected-correct {
  background: var(--correct-bg) !important;
  border-color: var(--correct-green) !important;
  color: #10b981;
}

.option-btn.selected-correct .option-idx {
  background: var(--correct-green);
  color: #ffffff;
}

.option-btn.selected-wrong {
  background: var(--wrong-bg) !important;
  border-color: var(--fire-red) !important;
  color: #ef4444;
}

.option-btn.selected-wrong .option-idx {
  background: var(--fire-red);
  color: #ffffff;
}

.option-btn.highlight-correct {
  border-color: var(--correct-green) !important;
  background: rgba(16, 185, 129, 0.08) !important;
}

/* 스피드 OX 대형 버튼 */
.ox-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 6px;
}

.ox-btn {
  background: var(--bg-card-subtle);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px 10px;
  font-size: 2rem;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  color: var(--text-main);
}

.ox-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--fire-orange);
}

.ox-btn-sub {
  font-size: 0.9rem;
  font-weight: 700;
}

.ox-btn-o { color: #38bdf8; }
.ox-btn-x { color: #ef4444; }

.ox-btn.selected-correct {
  background: var(--correct-bg) !important;
  border-color: var(--correct-green) !important;
  color: var(--correct-green) !important;
}

.ox-btn.selected-wrong {
  background: var(--wrong-bg) !important;
  border-color: var(--fire-red) !important;
  color: var(--fire-red) !important;
}

/* 3D 플립 카드 (핵심 75선) */
.flashcard-wrapper {
  perspective: 1000px;
  margin: 10px 0;
}

.flashcard {
  width: 100%;
  min-height: 240px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.flashcard.flipped {
  transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-md);
  padding: 24px;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1.5px solid var(--border-color);
}

.flashcard-front {
  background: linear-gradient(145deg, var(--bg-card-subtle), var(--bg-card));
  text-align: center;
}

.flashcard-hint {
  font-size: 0.8rem;
  color: var(--fire-orange);
  margin-bottom: 12px;
  font-weight: 600;
}

.flashcard-front h3 {
  font-size: 1.2rem;
  color: var(--text-main);
  margin-bottom: 10px;
}

.flashcard-front p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.flashcard-back {
  background: linear-gradient(145deg, #1e293b, #0f172a);
  transform: rotateY(180deg);
  border-color: var(--fire-orange);
}

.flashcard-back-badge {
  display: inline-block;
  background: var(--fire-orange);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 800;
  margin-bottom: 10px;
  align-self: flex-start;
}

.flashcard-memo {
  font-size: 1.05rem;
  font-weight: 800;
  color: #facc15;
  margin-bottom: 12px;
  line-height: 1.5;
}

.flashcard-exp-divider {
  height: 1px;
  background: var(--border-color);
  margin-bottom: 12px;
}

.flashcard-exp {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ===================================================
   5. 정답 확인 및 상세 설명란
   =================================================== */
.explanation-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-banner {
  padding: 12px 16px;
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-banner.correct {
  background: var(--correct-bg);
  color: #10b981;
  border-bottom: 1px solid rgba(16, 185, 129, 0.2);
}

.result-banner.wrong {
  background: var(--wrong-bg);
  color: #ef4444;
  border-bottom: 1px solid rgba(239, 68, 68, 0.2);
}

.result-banner.neutral {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  border-bottom: 1px solid rgba(56, 189, 248, 0.2);
}

.explanation-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.exp-heading,
.trap-heading,
.memo-heading {
  font-size: 0.88rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.exp-heading { color: var(--accent-cyan); }
.exp-body {
  font-size: 0.92rem;
  color: var(--text-main);
  line-height: 1.6;
  word-break: keep-all;
  white-space: pre-line;
}

.trap-box {
  background: rgba(249, 115, 22, 0.1);
  border-left: 3px solid var(--fire-orange);
  padding: 10px 14px;
  border-radius: 4px;
}

.trap-heading { color: var(--fire-orange); }
.trap-body {
  font-size: 0.88rem;
  color: var(--text-main);
  line-height: 1.5;
  white-space: pre-line;
}

.memo-box {
  background: rgba(250, 204, 21, 0.1);
  border-left: 3px solid #facc15;
  padding: 10px 14px;
  border-radius: 4px;
}

.memo-heading { color: #facc15; }
.memo-body {
  font-size: 0.88rem;
  color: var(--text-main);
  line-height: 1.5;
  font-weight: 600;
  white-space: pre-line;
}

.ref-footer {
  font-size: 0.78rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border-color);
  padding-top: 8px;
}

/* 상단 메타 바 요약노트 링크 */
.tag-study-link {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.4);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
}

.tag-study-link:hover {
  background: rgba(168, 85, 247, 0.35);
  color: #ffffff;
  border-color: #c084fc;
  transform: translateY(-1px);
}

/* 해설 하단 요약노트 배너 */
.study-link-box {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-color);
}

.btn-study-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.12), rgba(163, 113, 247, 0.16));
  border: 1px solid rgba(163, 113, 247, 0.38);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: #e6edf3;
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-study-link:hover {
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.22), rgba(163, 113, 247, 0.28));
  border-color: #a371f7;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(163, 113, 247, 0.25);
}

.study-link-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.study-link-icon {
  font-size: 1.45rem;
  flex-shrink: 0;
}

.study-link-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.study-link-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #f0f6fc;
}

.study-link-badge {
  font-size: 0.8rem;
  font-weight: 600;
  color: #a5d6ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.study-link-arrow {
  flex-shrink: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: #d2a8ff;
  background: rgba(163, 113, 247, 0.22);
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(163, 113, 247, 0.45);
  transition: all 0.2s ease;
}

.btn-study-link:hover .study-link-arrow {
  background: #8957e5;
  color: #ffffff;
  border-color: #8957e5;
}

@media (max-width: 600px) {
  .btn-study-link {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
  }
  .study-link-arrow {
    align-self: flex-end;
    font-size: 0.75rem;
    padding: 4px 8px;
  }
}

/* ===================================================
   6. 하단 네비게이션
   =================================================== */
.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 10px 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  z-index: 100;
  backdrop-filter: blur(10px);
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.3);
}

.nav-control-btn {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.92rem;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-control-btn:hover:not(:disabled) {
  background: var(--fire-orange);
  border-color: var(--fire-orange);
  color: #ffffff;
}

.nav-control-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pager-indicator {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 80px;
  gap: 4px;
}

.pager-slash {
  color: var(--text-dim);
}

/* ===================================================
   7. 모달
   =================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.1rem;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
}

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

.setting-item label {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 8px;
  display: block;
}

.font-size-btns {
  display: flex;
  gap: 8px;
}

.font-btn {
  flex: 1;
  padding: 8px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
}

.font-btn.active {
  background: var(--fire-orange);
  border-color: var(--fire-orange);
  color: #ffffff;
}

.setting-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.danger-btn {
  width: 100%;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--fire-red);
  color: var(--fire-red);
  padding: 10px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.danger-btn:hover {
  background: var(--fire-red);
  color: #ffffff;
}

/* ===================================================
   8. 미디어 쿼리 (모바일 최적화)
   =================================================== */
@media (max-width: 600px) {
  #app-container {
    padding: 8px 10px 76px 10px;
  }
  .brand-text h1 {
    font-size: 1.1rem;
  }
  .nav-tabs {
    grid-template-columns: repeat(6, 1fr);
    gap: 3px;
  }
  .nav-tab {
    padding: 6px 1px;
    gap: 2px;
  }
  .tab-icon {
    font-size: 16px;
  }
  .tab-name {
    font-size: 0.65rem;
    letter-spacing: -0.5px;
  }
  .tab-badge {
    font-size: 0.60rem;
    padding: 1px 3px;
  }
  .quiz-box-card {
    padding: 10px 12px;
    font-size: 0.88rem;
    margin: 8px 0 12px 0;
  }
  .filter-controls {
    grid-template-columns: 1fr;
  }
  .switch-label {
    margin-left: 0;
    width: 100%;
    justify-content: flex-end;
  }
  .q-text {
    font-size: 1rem;
  }
  .option-btn {
    padding: 10px 12px;
    font-size: 0.9rem;
  }
}

/* 라운드 집중 훈련 알림 배너 */
.round-filter-banner {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.16), rgba(168, 85, 247, 0.2));
  border: 1px solid rgba(168, 85, 247, 0.45);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  animation: fadeIn 0.3s ease;
}

.round-filter-banner-text {
  font-size: 0.9rem;
  font-weight: 700;
  color: #f0f6fc;
  display: flex;
  align-items: center;
  gap: 8px;
}

.round-filter-banner-badge {
  color: #7ee787;
  font-weight: 800;
}

.btn-clear-round-filter {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #c9d1d9;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-clear-round-filter:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #ff7b72;
}
