/* ===== 기본 리셋 및 폰트 ===== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;600;700&family=JetBrains+Mono:ital,wght@0,400;0,500;0,700;1,400&display=swap');

:root {
  --sidebar-width: 272px;
  --accent: #f97316;
  --accent-dim: rgba(249, 115, 22, 0.15);
  --bg-main: #0b1120;
  --bg-sidebar: #111827;
  --bg-card: #141d2e;
  --bg-card-hover: #1a2540;
  --bg-code: #0d1117;
  --border: rgba(51, 65, 85, 0.8);
  --border-subtle: rgba(51, 65, 85, 0.4);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #4b5875;
  --radius-card: 14px;
  --radius-code: 10px;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.2);
  --shadow-card-hover: 0 4px 24px rgba(0,0,0,0.4), 0 0 0 1px rgba(249,115,22,0.15);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans KR', -apple-system, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

/* ===== 사이드바 ===== */
#sidebar {
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 40;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  scrollbar-width: thin;
  scrollbar-color: rgba(51,65,85,0.6) transparent;
}

#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(51,65,85,0.6); border-radius: 2px; }

.sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(249,115,22,0.04) 0%, transparent 100%);
  cursor: pointer;
  transition: background 0.15s;
}
.sidebar-logo:hover {
  background: linear-gradient(180deg, rgba(249,115,22,0.08) 0%, transparent 100%);
}

.sidebar-logo .logo-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--accent) 0%, #dc2626 100%);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(249,115,22,0.35);
}

.nav-section-title {
  padding: 18px 18px 5px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.nav-section-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 14px;
  opacity: 0.6;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 18px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  border-left: 2px solid transparent;
  position: relative;
}

.nav-item:hover {
  background: rgba(249,115,22,0.07);
  color: var(--text-primary);
  border-left-color: rgba(249,115,22,0.35);
}

.nav-item.active {
  background: rgba(249,115,22,0.1);
  color: #fb923c;
  border-left-color: var(--accent);
  font-weight: 600;
}

.nav-item .chapter-num {
  font-size: 10.5px;
  color: var(--text-muted);
  min-width: 22px;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}

.nav-item.active .chapter-num { color: #fb923c; }

/* ===== 메인 콘텐츠 ===== */
#main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

/* ===== 히어로 섹션 ===== */
.hero-section {
  min-height: 100vh;
  display: flex; flex-direction: column; justify-content: center;
  position: relative; overflow: hidden;
  padding: 80px 64px;
}

.hero-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 15% 50%, rgba(249,115,22,0.1) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 85% 20%, rgba(139,92,246,0.08) 0%, transparent 70%);
}

.hero-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(51,65,85,0.25) 1px, transparent 1px),
    linear-gradient(90deg, rgba(51,65,85,0.25) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 70% at 30% 50%, black 20%, transparent 80%);
}

/* ===== 섹션 배너 — 페이지 뷰에서 숨김 ===== */
.content-section {
  display: none;
}

.content-section::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent) 0%, transparent 100%);
}

.section-number {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 2.5px;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 10px;
  background: var(--accent-dim);
  padding: 3px 10px;
  border-radius: 4px;
}

/* ===== 챕터 섹션 (페이지 단위) ===== */
@keyframes chapterFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chapter-section {
  display: none;
  padding: 56px 64px;
  position: relative;
  min-height: calc(100vh - 80px);
}

.chapter-section.active {
  display: block;
  animation: chapterFadeIn 0.22s ease;
}

.chapter-header {
  display: flex; align-items: flex-start; gap: 18px;
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border-subtle);
}

.chapter-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
  background: linear-gradient(135deg, rgba(249,115,22,0.18), rgba(249,115,22,0.04));
  border: 1px solid rgba(249,115,22,0.2);
  box-shadow: 0 2px 8px rgba(249,115,22,0.1);
}

.difficulty-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px;
  border-radius: 100px;
  font-size: 11px; font-weight: 600;
}

.difficulty-badge.green  { background: rgba(34,197,94,0.1);  color: #4ade80; border: 1px solid rgba(34,197,94,0.2); }
.difficulty-badge.yellow { background: rgba(234,179,8,0.1);  color: #facc15; border: 1px solid rgba(234,179,8,0.2); }
.difficulty-badge.red    { background: rgba(239,68,68,0.1);  color: #f87171; border: 1px solid rgba(239,68,68,0.2); }

/* ===== 카드 ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(249,115,22,0.25);
  box-shadow: var(--shadow-card-hover);
}

/* 카드 변형 */
.card-error {
  background: rgba(239,68,68,0.04);
  border-color: rgba(239,68,68,0.2);
  border-left: 3px solid rgba(239,68,68,0.5);
}

.card-error:hover { border-color: rgba(239,68,68,0.35); }

.card-warn {
  background: rgba(234,179,8,0.04);
  border-color: rgba(234,179,8,0.2);
  border-left: 3px solid rgba(234,179,8,0.4);
}

.card-tip {
  background: rgba(34,197,94,0.04);
  border-color: rgba(34,197,94,0.2);
  border-left: 3px solid rgba(34,197,94,0.4);
}

/* ===== 코드 블록 ===== */
.code-block {
  background: var(--bg-code);
  border: 1px solid rgba(51,65,85,0.7);
  border-radius: var(--radius-code);
  overflow: hidden;
  margin: 16px 0;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.code-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 14px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(51,65,85,0.6);
  gap: 10px;
}

.code-dots {
  display: flex; gap: 5px; flex-shrink: 0;
}

.code-dots span {
  width: 9px; height: 9px; border-radius: 50%;
}

.code-dots span:nth-child(1) { background: #ff5f57; }
.code-dots span:nth-child(2) { background: #ffbd2e; }
.code-dots span:nth-child(3) { background: #28c840; }

.code-lang {
  flex: 1;
  font-size: 10.5px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px;
  font-family: 'JetBrains Mono', monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.copy-btn {
  font-size: 10.5px; color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(51,65,85,0.6);
  padding: 2px 9px; border-radius: 5px;
  cursor: pointer; transition: all 0.15s;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}

.copy-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.08); border-color: rgba(51,65,85,1); }
.copy-btn.copied { color: #4ade80; border-color: rgba(74,222,128,0.4); background: rgba(74,222,128,0.06); }

pre {
  padding: 18px 20px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px; line-height: 1.7;
  color: #c9d1d9;
  white-space: pre; word-break: normal; overflow-wrap: normal;
}

code {
  font-family: 'JetBrains Mono', monospace;
  background: rgba(249,115,22,0.1);
  color: #fdba74;
  padding: 1px 6px; border-radius: 4px;
  font-size: 12.5px;
  border: 1px solid rgba(249,115,22,0.15);
}

/* ===== 테이블 (자동 스타일) ===== */
.chapter-section table,
.content-section table {
  width: 100%; border-collapse: collapse;
  font-size: 13.5px; margin: 16px 0;
}

.chapter-section table th,
.content-section table th {
  padding: 10px 16px; text-align: left;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}

.chapter-section table td,
.content-section table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: top; line-height: 1.6;
}

.chapter-section table tr:last-child td,
.content-section table tr:last-child td {
  border-bottom: none;
}

.chapter-section table tr:hover td,
.content-section table tr:hover td {
  background: rgba(255,255,255,0.015);
}

.chapter-section table td:first-child { color: var(--text-primary); }

/* ===== 오버뷰 카드 그리드 ===== */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px; margin: 28px 0;
}

.overview-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none; color: inherit; display: block;
  box-shadow: var(--shadow-card);
}

.overview-card:hover {
  border-color: rgba(249,115,22,0.35);
  background: var(--bg-card-hover);
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.3), 0 0 0 1px rgba(249,115,22,0.15);
}

/* ===== 서브섹션 ===== */
.subsection {
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid var(--border-subtle);
}

.subsection-title {
  font-size: 14px; font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}

.subsection-title::before {
  content: '';
  display: inline-block;
  width: 3px; height: 16px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

/* ===== PLAYBOOK 카드 ===== */
.best-card {
  position: relative;
  background: rgba(11, 17, 32, 0.55);
  border: 1px solid rgba(139,92,246,0.22);
  border-radius: 14px;
  padding: 0;
  margin-top: 44px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(139,92,246,0.06),
    0 12px 48px rgba(0,0,0,0.4),
    0 4px 12px rgba(0,0,0,0.2),
    inset 0 1px 0 rgba(255,255,255,0.04);
}

/* 상단 그라데이션 라인 */
.best-card::before {
  content: '';
  display: block;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    #6d28d9 15%,
    #a78bfa 40%,
    #f97316 70%,
    transparent 100%
  );
}

.best-card-title {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px 13px;
  border-bottom: 1px solid rgba(139,92,246,0.12);
  background: linear-gradient(135deg, rgba(139,92,246,0.07) 0%, transparent 80%);
  font-size: 14px;
  font-weight: 700;
  color: #e2e8f0;
  letter-spacing: -0.01em;
  margin-bottom: 0;
}

/* PLAYBOOK 뱃지 */
.best-card-title::before {
  content: 'PLAYBOOK';
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #a78bfa;
  background: rgba(139,92,246,0.15);
  border: 1px solid rgba(139,92,246,0.32);
  border-radius: 4px;
  padding: 3px 9px;
  flex-shrink: 0;
  text-transform: uppercase;
}

/* RECAP 뱃지 (핵심 요약 카드) */
.best-card--recap .best-card-title::before {
  content: 'RECAP';
  color: #f97316;
  background: rgba(249,115,22,0.12);
  border-color: rgba(249,115,22,0.3);
}
.best-card--recap::before {
  background: linear-gradient(90deg,
    transparent 0%,
    #b45309 15%,
    #f97316 50%,
    #fbbf24 80%,
    transparent 100%
  );
}

/* ===== 팁 목록 ===== */
.tip-list {
  counter-reset: tip-counter;
  list-style: none;
  padding: 6px 22px 22px;
  margin: 0;
}

.tip-list li {
  counter-increment: tip-counter;
  display: flex;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.68;
  align-items: flex-start;
}

.tip-list li:last-child { border-bottom: none; padding-bottom: 4px; }

.tip-list li::before {
  content: counter(tip-counter, decimal-leading-zero);
  color: #7c3aed;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  min-width: 22px;
  margin-top: 4px;
  flex-shrink: 0;
  opacity: 0.65;
}

.tip-list li strong {
  color: #c4b5fd;
  font-weight: 600;
}

/* ===== 코드 그룹 (탭 뷰) ===== */
.code-group { margin-bottom: 16px; }

.code-group-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 1px;
}
.code-group-tabs::-webkit-scrollbar { display: none; }

.code-group-tab {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 5px 13px;
  border-radius: 6px;
  border: 1px solid rgba(51,65,85,0.5);
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.code-group-tab:hover {
  color: var(--text-secondary);
  background: rgba(255,255,255,0.05);
  border-color: rgba(139,92,246,0.3);
}
.code-group-tab.active {
  color: #c4b5fd;
  background: rgba(139,92,246,0.12);
  border-color: rgba(139,92,246,0.45);
}

.code-group-panel { display: none; }
.code-group-panel.active { display: block; }

/* 수동 패널 (code-tab-panel) — JS가 code-group-panel 클래스 추가 전 기본 숨김 */
.code-tab-panel { display: none; }
.code-tab-panel.active { display: block; }

/* ===== 코드 블록 확장 버튼 ===== */
.code-expand-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.code-expand-btn:hover {
  color: var(--text-secondary);
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.1);
}

/* ===== 코드 전체화면 모달 ===== */
.code-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.code-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.code-modal-box {
  width: 100%;
  max-width: 880px;
  max-height: 88vh;
  background: #0c1424;
  border: 1px solid rgba(139,92,246,0.28);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(139,92,246,0.07),
    0 32px 100px rgba(0,0,0,0.65),
    0 8px 32px rgba(0,0,0,0.4);
  transform: scale(0.95) translateY(12px);
  transition: transform 0.22s cubic-bezier(0.34,1.56,0.64,1);
}
.code-modal-overlay.open .code-modal-box {
  transform: scale(1) translateY(0);
}

.code-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  background: rgba(255,255,255,0.025);
  border-bottom: 1px solid rgba(51,65,85,0.5);
  flex-shrink: 0;
}

.code-modal-dots {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}
.code-modal-dots span {
  width: 9px; height: 9px; border-radius: 50%;
}
.code-modal-dots span:nth-child(1) { background: #ff5f57; }
.code-modal-dots span:nth-child(2) { background: #ffbd2e; }
.code-modal-dots span:nth-child(3) { background: #28c840; }

.code-modal-lang {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-modal-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.code-modal-copy {
  font-size: 11.5px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
  padding: 4px 11px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s;
}
.code-modal-copy:hover {
  color: var(--text-secondary);
  background: rgba(255,255,255,0.08);
}
.code-modal-copy.copied {
  color: #4ade80;
  border-color: rgba(74,222,128,0.3);
}

.code-modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.code-modal-close:hover {
  color: #f87171;
  background: rgba(239,68,68,0.1);
  border-color: rgba(239,68,68,0.2);
}

.code-modal-body {
  flex: 1;
  overflow: auto;
  padding: 0;
  background: #080e1c;
}
.code-modal-body pre {
  margin: 0;
  padding: 24px 28px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13.5px;
  line-height: 1.78;
  color: #94a3b8;
  white-space: pre;
  word-break: normal;
  min-height: 100%;
}

/* ===== 프롬프트 예시 ===== */
.prompt-example {
  background: rgba(34,197,94,0.05);
  border: 1px dashed rgba(34,197,94,0.2);
  border-radius: 8px;
  padding: 11px 15px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px; color: #86efac;
  margin: 8px 0; line-height: 1.65;
}

/* ===== 정보 박스 ===== */
.info-box {
  background: rgba(249,115,22,0.06);
  border: 1px solid rgba(249,115,22,0.18);
  border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 14px 18px; margin: 16px 0;
}

.warning-box {
  background: rgba(239,68,68,0.05);
  border: 1px solid rgba(239,68,68,0.18);
  border-left: 3px solid #ef4444;
  border-radius: 8px; padding: 14px 18px; margin: 16px 0;
}

/* ===== 진행 표시줄 ===== */
#progress-bar {
  position: fixed; top: 0; left: var(--sidebar-width); right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, #dc2626 50%, #9333ea 100%);
  z-index: 50; transform-origin: left; transform: scaleX(0);
  transition: transform 0.1s linear;
}

/* ===== 스크롤 탑 버튼 ===== */
#scroll-top {
  position: fixed; bottom: 28px; right: 28px;
  width: 42px; height: 42px;
  background: var(--accent);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s;
  opacity: 0; pointer-events: none; z-index: 20;
  border: none; color: white;
  box-shadow: 0 4px 16px rgba(249,115,22,0.35), 0 0 0 1px rgba(249,115,22,0.2);
}

#scroll-top.visible { opacity: 1; pointer-events: all; }
#scroll-top:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(249,115,22,0.45); }

/* ===== 모바일 헤더 ===== */
#mobile-header {
  display: none;
  position: fixed; top: 0; left: 0; right: 0;
  height: 54px;
  background: rgba(17,24,39,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 50; align-items: center; justify-content: space-between;
  padding: 0 18px;
}

#sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.55); z-index: 30;
  backdrop-filter: blur(3px);
}

/* ===== 챕터 하단 네비게이션 ===== */
.chapter-nav-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 32px 64px 56px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 16px;
}

.chapter-nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  min-width: 120px;
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chapter-nav-btn--prev { justify-content: flex-start; }
.chapter-nav-btn--next { justify-content: flex-end; text-align: right; }
.chapter-nav-btn:hover:not(:disabled) {
  border-color: rgba(139,92,246,0.4);
  background: rgba(139,92,246,0.06);
  color: #e2e8f0;
}
.chapter-nav-btn:disabled {
  opacity: 0;
  pointer-events: none;
}

.chapter-nav-counter {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  flex-shrink: 0;
}

/* ===== 반응형 ===== */
@media (max-width: 1024px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); box-shadow: 8px 0 24px rgba(0,0,0,0.4); }
  #mobile-header { display: flex; }
  #sidebar-overlay.show { display: block; }
  #main-content { margin-left: 0; padding-top: 54px; }
  #progress-bar { left: 0; }
  .hero-section { padding: 56px 24px; }
  .chapter-section { padding: 40px 24px; }
  .chapter-nav-bottom { padding: 24px 24px 40px; }
  .chapter-nav-btn { min-width: 80px; font-size: 12px; padding: 8px 12px; }
}

@media (max-width: 640px) {
  .overview-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .overview-grid { grid-template-columns: 1fr; }
}

/* ===== 커스텀 스크롤바 ===== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb { background: rgba(51,65,85,0.7); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(71,85,105,0.9); }

/* ===== 선택 ===== */
::selection { background: rgba(249,115,22,0.25); color: white; }

/* ===== 애니메이션 ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== 체크리스트 ===== */
.checklist { list-style: none; }

.checklist li {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 5px 0; color: var(--text-secondary); font-size: 13.5px;
}

.checklist li::before {
  content: '□';
  color: var(--accent); font-size: 15px; flex-shrink: 0; margin-top: -1px;
}
