@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.css');

/* ========================================
   Vibe Coding 시리즈 — 공통 스타일시트
   디자인 기준: samples/디자인_샘플_챗봇포함.html
   ======================================== */

/* === 기본 === */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  font-family: 'Pretendard', 'Nanum Gothic', 'Malgun Gothic', sans-serif;
  font-size: 13pt;
  line-height: 1.85;
  color: #2C3E50;
  background: #FAFAFA;
  -webkit-text-size-adjust: 100%;
}

/* === 모바일 헤더 (768px 이하만 보임) === */
.mobile-header {
  display: none;
  position: sticky;
  top: 0;
  background: #1F3A68;
  color: white;
  padding: 14px 18px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  align-items: center;
  gap: 14px;
}

.menu-toggle {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 6px;
  line-height: 1;
}

.mobile-title {
  font-size: 14pt;
  font-weight: 700;
  flex: 1;
}

/* === 레이아웃 === */
.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  max-width: 1400px;
  margin: 0 auto;
}

/* === 사이드바 오버레이 === */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
  opacity: 0;
  transition: opacity 0.3s;
}

.sidebar-backdrop.show {
  display: block;
  opacity: 1;
}

/* === 사이드바 === */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: #1F3A68;
  color: white;
  padding: 30px 0;
  scrollbar-width: thin;
  scrollbar-color: #2E5C8A #1F3A68;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: #1F3A68; }
.sidebar::-webkit-scrollbar-thumb { background: #2E5C8A; border-radius: 3px; }

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  position: absolute;
  top: 12px;
  right: 12px;
  cursor: pointer;
  padding: 6px 12px;
  line-height: 1;
}

.sidebar-header {
  padding: 0 24px 20px;
  border-bottom: 1px solid #2E5C8A;
  margin-bottom: 16px;
}

.sidebar-logo {
  display: block;
  text-decoration: none;
  color: inherit;
}

.sidebar-title {
  font-size: 15pt;
  font-weight: 800;
  margin-bottom: 6px;
  color: white;
}

.sidebar-subtitle {
  font-size: 11pt;
  color: #C7DBF0;
}

.sidebar-nav {
  list-style: none;
  padding: 0;
}

.sidebar-nav > li > a {
  display: block;
  padding: 12px 24px;
  color: #C7DBF0;
  text-decoration: none;
  font-size: 11.5pt;
  font-weight: 600;
  border-left: 3px solid transparent;
  transition: all 0.2s;
}

.sidebar-nav > li > a:hover,
.sidebar-nav > li > a.active {
  background: #2E5C8A;
  color: white;
  border-left-color: #F4A847;
}

.sidebar-nav .sub {
  list-style: none;
  padding: 0;
  background: rgba(0,0,0,0.15);
  display: none;
}

.sidebar-nav > li.open .sub {
  display: block;
}

.sidebar-nav .sub a {
  display: block;
  padding: 9px 24px 9px 40px;
  color: #A8C3DD;
  text-decoration: none;
  font-size: 10.5pt;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}

.sidebar-nav .sub a:hover,
.sidebar-nav .sub a.active {
  color: white;
  border-left-color: #F4A847;
  background: rgba(255,255,255,0.05);
}

.sidebar-nav .sub-toggle {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-nav .sub-toggle::after {
  content: '▼';
  font-size: 9pt;
  color: #7A9DBF;
  transition: transform 0.2s;
  flex-shrink: 0;
  margin-right: 4px;
}

.sidebar-nav > li.open > a.sub-toggle::after {
  transform: rotate(-180deg);
}

.sidebar-section-label {
  padding: 18px 24px 8px;
  font-size: 9.5pt;
  font-weight: 700;
  color: #7A9DBF;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.sidebar-footer {
  padding: 20px 24px;
  margin-top: 30px;
  border-top: 1px solid #2E5C8A;
  font-size: 10pt;
  color: #88A0B8;
}

/* === 메인 === */
.main {
  padding: 40px 60px;
  min-width: 0;
}

.page-content {
  background: white;
  padding: 50px 60px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  border-radius: 12px;
  margin-bottom: 30px;
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
}

/* === 챕터 헤더 === */
.chapter-header {
  background: linear-gradient(135deg, #2E5C8A 0%, #1F3A68 100%);
  color: white;
  padding: 45px 50px;
  border-radius: 14px;
  text-align: center;
  margin-bottom: 38px;
  box-shadow: 0 4px 16px rgba(46, 92, 138, 0.3);
}

.chapter-label {
  font-size: 13pt;
  letter-spacing: 5px;
  color: #C7DBF0;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.chapter-title {
  font-size: 34pt;
  font-weight: 800;
  margin-bottom: 14px;
  letter-spacing: -1px;
  line-height: 1.2;
}

.chapter-subtitle {
  font-size: 15pt;
  color: #C7DBF0;
  line-height: 1.5;
}

/* === 챕터 안 목차 === */
.toc {
  background: #F4F8FB;
  border-radius: 12px;
  padding: 24px 30px;
  margin-bottom: 32px;
  border-left: 7px solid #1F3A68;
}

.toc-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15pt;
  font-weight: 800;
  color: #1F3A68;
}

.toc-summary::-webkit-details-marker { display: none; }

.toc-summary::before {
  content: '▼';
  font-size: 12pt;
  transition: transform 0.2s;
}

.toc:not([open]) .toc-summary::before {
  transform: rotate(-90deg);
}

.toc[open] .toc-list {
  margin-top: 14px;
}

.toc ul { list-style: none; padding: 0; }
.toc li { margin-bottom: 8px; }

.toc a {
  color: #2E5C8A;
  text-decoration: none;
  font-size: 12.5pt;
  font-weight: 600;
  display: inline-block;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}

.toc a:hover {
  color: #C8444F;
  border-bottom-color: #F4A847;
}

/* === 절 헤더 === */
.section-header {
  margin: 50px 0 22px;
  padding-left: 22px;
  border-left: 7px solid #1F3A68;
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  scroll-margin-top: 80px;
}

.section-num {
  font-size: 22pt;
  font-weight: 800;
  color: #C83E4D;
}

.section-title {
  font-size: 22pt;
  font-weight: 800;
  color: #1F3A68;
  line-height: 1.3;
  flex: 1;
  min-width: 200px;
}

.section-anchor {
  font-size: 13pt;
  color: #C0C0C0;
  text-decoration: none;
  margin-left: 10px;
  opacity: 0;
  transition: opacity 0.2s;
}

.section-header:hover .section-anchor,
.section-header:focus-within .section-anchor {
  opacity: 1;
}

.section-anchor:hover { color: #1F3A68; }

/* === 소절 === */
h3 {
  font-size: 16pt;
  font-weight: 700;
  color: #1F3A68;
  margin: 32px 0 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid #E5E9EE;
}

/* === 본문 === */
p {
  margin-bottom: 18px;
  line-height: 1.85;
}

.intro-text {
  font-size: 14pt;
  margin-bottom: 24px;
}

a.external {
  color: #2E5C8A;
  text-decoration: none;
  border-bottom: 1.5px solid #C7DBF0;
  font-weight: 600;
  transition: all 0.15s;
  word-break: break-word;
}

a.external:hover {
  color: #C8444F;
  border-bottom-color: #F4A847;
}

a.external::after {
  content: ' ↗';
  font-size: 0.85em;
  color: #888;
}

.highlight-orange { color: #E8731C; font-weight: 700; }
.highlight-blue   { color: #1F3A68; font-weight: 700; }
.highlight-red    { color: #C8444F; font-weight: 700; }
.highlight-green  { color: #4A8C5F; font-weight: 700; }

ul, ol {
  padding-left: 24px;
  margin-bottom: 18px;
}

li {
  margin-bottom: 6px;
  line-height: 1.75;
}

li:last-child { margin-bottom: 0; }

/* === 컬러 박스 === */
.box {
  margin: 26px 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.box-header {
  padding: 16px 24px;
  color: white;
  font-weight: 700;
  font-size: 15pt;
  display: flex;
  align-items: center;
  gap: 12px;
}

.box-body {
  padding: 22px 28px;
  background: var(--box-bg);
  font-size: 13pt;
  line-height: 1.85;
}

.box-body p { margin-bottom: 12px; }
.box-body p:last-child { margin-bottom: 0; }
.box-body ul, .box-body ol { margin-bottom: 12px; }

.box-body a.external {
  color: inherit;
  border-bottom-color: rgba(0,0,0,0.2);
}

.box-tip  { --box-bg: #FEF6E4; }
.box-tip  .box-header { background: #F4A847; }

.box-warn { --box-bg: #FBEEEF; }
.box-warn .box-header { background: #C8444F; }

.box-note { --box-bg: #F4F8FB; }
.box-note .box-header { background: #1F3A68; }

.box-success { --box-bg: #E8F4EC; }
.box-success .box-header { background: #4A8C5F; }

.box-code { --box-bg: #ECF0F1; }
.box-code .box-header { background: #2C3E50; }

.box-code pre {
  font-family: 'Consolas', 'Monaco', 'D2Coding', monospace;
  font-size: 12pt;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-x: auto;
  color: #2C3E50;
}

/* === 표 === */
.table-wrap {
  overflow-x: auto;
  margin: 22px 0;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5pt;
  background: white;
}

thead th {
  background: #1F3A68;
  color: white;
  padding: 16px 18px;
  font-weight: 700;
  font-size: 13pt;
  text-align: left;
  white-space: nowrap;
}

tbody td {
  padding: 16px 18px;
  border-bottom: 1px solid #E5E9EE;
  font-size: 12.5pt;
  line-height: 1.6;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr.highlight { background: #FEF6E4; }

tbody tr.highlight td {
  font-weight: 700;
  color: #E8731C;
}

/* === 단계 카드 === */
.step {
  display: flex;
  align-items: stretch;
  margin-bottom: 14px;
  border: 1px solid #E0E0E0;
  border-radius: 12px;
  overflow: hidden;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.step-num {
  background: #1F3A68;
  color: white;
  font-size: 28pt;
  font-weight: 800;
  width: 80px;
  min-width: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 0;
}

.step-content {
  padding: 16px 22px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.step-title {
  font-size: 15pt;
  font-weight: 700;
  color: #1F3A68;
  margin-bottom: 4px;
}

.step-desc {
  font-size: 12.5pt;
  color: #555;
  line-height: 1.6;
}

.step-desc a.external { color: #2E5C8A; }

/* === 정리 박스 === */
.summary {
  background: linear-gradient(135deg, #E8F4EC 0%, #D7EAE0 100%);
  border-radius: 14px;
  padding: 28px 32px;
  margin: 32px 0;
  border-left: 7px solid #4A8C5F;
}

.summary-title {
  font-size: 17pt;
  font-weight: 800;
  color: #2D5F3F;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.summary ul { list-style: none; padding: 0; }

.summary li {
  padding: 8px 0;
  font-size: 13pt;
  color: #2C3E50;
  line-height: 1.7;
  border-bottom: 1px solid rgba(74,140,95,0.15);
}

.summary li:last-child { border-bottom: none; }

/* === 챕터 네비게이션 === */
.chapter-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 40px;
  padding-top: 30px;
  border-top: 2px solid #E5E9EE;
}

.nav-card {
  display: block;
  padding: 22px 26px;
  border: 2px solid #E5E9EE;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}

.nav-card:hover {
  border-color: #1F3A68;
  box-shadow: 0 4px 12px rgba(31, 58, 104, 0.15);
  transform: translateY(-2px);
}

.nav-card.next { text-align: right; }

.nav-card-label {
  font-size: 11pt;
  color: #888;
  font-weight: 600;
  letter-spacing: 1px;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.nav-card-title {
  font-size: 13.5pt;
  font-weight: 700;
  color: #1F3A68;
}

.nav-card.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* === 위로 가기 버튼 === */
.scroll-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 50px;
  height: 50px;
  background: #1F3A68;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.scroll-top.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-top:hover { background: #2E5C8A; }

/* 챗봇 버튼이 있을 때 위로 가기 버튼은 한 칸 위로 */
body:has(.chatbot-button:not(.hidden)) .scroll-top {
  bottom: 100px;
}

/* ============================================ */
/* === 인덱스 페이지 전용 스타일              === */
/* ============================================ */

/* 히어로 배너 */
.hero-banner {
  background: linear-gradient(135deg, #2E5C8A 0%, #1F3A68 100%);
  color: white;
  padding: 50px;
  border-radius: 16px;
  text-align: center;
  margin-bottom: 36px;
  box-shadow: 0 6px 24px rgba(46, 92, 138, 0.35);
  position: relative;
  overflow: hidden;
}

.hero-banner::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 220px; height: 220px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}

.hero-banner::after {
  content: '';
  position: absolute;
  bottom: -80px; left: -40px;
  width: 280px; height: 280px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
}

.hero-eyebrow {
  font-size: 11pt;
  letter-spacing: 4px;
  color: #C7DBF0;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.hero-title {
  font-size: 38pt;
  font-weight: 800;
  margin-bottom: 14px;
  letter-spacing: -1px;
  line-height: 1.15;
}

.hero-sub {
  font-size: 14pt;
  color: #C7DBF0;
  margin-bottom: 24px;
  line-height: 1.6;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
}

.hero-stat {
  text-align: center;
}

.hero-stat-num {
  font-size: 26pt;
  font-weight: 800;
  color: #F4A847;
  display: block;
}

.hero-stat-label {
  font-size: 10pt;
  color: #C7DBF0;
  letter-spacing: 0.5px;
}

/* 시리즈 섹션 */
.series-section {
  margin-bottom: 48px;
}

.series-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 3px solid #E5E9EE;
}

.series-icon {
  font-size: 28pt;
}

.series-info {}

.series-name {
  font-size: 20pt;
  font-weight: 800;
  color: #1F3A68;
  margin-bottom: 2px;
}

.series-desc {
  font-size: 11.5pt;
  color: #7A90A4;
}

.series-badge {
  margin-left: auto;
  background: #1F3A68;
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 10.5pt;
  font-weight: 700;
  white-space: nowrap;
}

/* 챕터 그리드 */
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

/* 권 그룹 */
.vol-group {
  margin-bottom: 24px;
}

.vol-label {
  font-size: 12pt;
  font-weight: 700;
  color: #2E5C8A;
  padding: 10px 16px;
  background: #F4F8FB;
  border-radius: 8px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.vol-label::before {
  content: '▸';
  color: #F4A847;
}

/* 챕터 카드 */
.chapter-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: white;
  border: 1.5px solid #E5E9EE;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: all 0.18s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.chapter-card:hover {
  border-color: #2E5C8A;
  box-shadow: 0 3px 10px rgba(31, 58, 104, 0.12);
  transform: translateY(-2px);
}

.chapter-card.coming-soon {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  border-style: dashed;
}

.chapter-num {
  font-size: 11pt;
  font-weight: 700;
  color: #C83E4D;
  min-width: 32px;
  padding-top: 2px;
}

.chapter-text {}

.chapter-title-text {
  font-size: 12.5pt;
  font-weight: 700;
  color: #1F3A68;
  margin-bottom: 3px;
  line-height: 1.4;
}

.chapter-subtitle-text {
  font-size: 10.5pt;
  color: #7A90A4;
  line-height: 1.3;
}

/* 사용법 안내 */
.how-to-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin: 20px 0 32px;
}

.how-to-card {
  background: #F4F8FB;
  border-radius: 12px;
  padding: 20px 18px;
  text-align: center;
}

.how-to-icon {
  font-size: 26pt;
  margin-bottom: 10px;
  display: block;
}

.how-to-title {
  font-size: 12.5pt;
  font-weight: 700;
  color: #1F3A68;
  margin-bottom: 6px;
}

.how-to-desc {
  font-size: 11pt;
  color: #666;
  line-height: 1.5;
  margin: 0;
}

/* =============================== */
/* === 태블릿 (1024px 이하)    === */
/* =============================== */
@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px;
    height: 100vh;
    z-index: 100;
    transition: left 0.3s ease;
    box-shadow: 2px 0 12px rgba(0,0,0,0.2);
  }

  .sidebar.open {
    left: 0;
  }

  .sidebar-close {
    display: block;
  }

  .mobile-header {
    display: flex;
  }

  .main {
    padding: 24px;
  }

  .page-content {
    padding: 36px 32px;
  }
}

/* ============================= */
/* === 모바일 (768px 이하)   === */
/* ============================= */
@media (max-width: 768px) {
  body { font-size: 12.5pt; }

  .main {
    padding: 16px;
  }

  .page-content {
    padding: 24px 20px;
    border-radius: 8px;
  }

  .chapter-header {
    padding: 28px 22px;
    margin-bottom: 26px;
  }

  .chapter-label {
    font-size: 11pt;
    letter-spacing: 3px;
    margin-bottom: 8px;
  }

  .chapter-title {
    font-size: 22pt;
    margin-bottom: 10px;
  }

  .chapter-subtitle {
    font-size: 12pt;
  }

  .toc {
    padding: 18px 20px;
    margin-bottom: 24px;
  }

  .toc-summary { font-size: 13pt; }

  .section-header {
    margin: 36px 0 18px;
    padding-left: 16px;
    border-left-width: 5px;
    gap: 10px;
  }

  .section-num { font-size: 17pt; }
  .section-title { font-size: 17pt; }

  p {
    margin-bottom: 14px;
    line-height: 1.8;
  }

  .intro-text { font-size: 13pt; }

  .box-header {
    padding: 13px 18px;
    font-size: 13pt;
  }

  .box-body {
    padding: 18px 20px;
    font-size: 12.5pt;
  }

  thead th, tbody td {
    padding: 12px 14px;
    font-size: 11.5pt;
  }

  .step-num {
    font-size: 22pt;
    width: 60px;
    min-width: 60px;
  }

  .step-title { font-size: 13pt; }
  .step-desc  { font-size: 11.5pt; }

  .summary { padding: 20px 22px; }
  .summary-title { font-size: 14pt; }
  .summary li { font-size: 12pt; }

  .chapter-nav {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .nav-card { padding: 18px 20px; }
  .nav-card.next { text-align: left; }

  .scroll-top {
    width: 44px;
    height: 44px;
    font-size: 18px;
    bottom: 18px;
    right: 18px;
  }

  /* 인덱스 */
  .hero-banner { padding: 32px 24px; }
  .hero-title { font-size: 26pt; }
  .hero-sub { font-size: 12.5pt; }
  .hero-stats { gap: 20px; }
  .hero-stat-num { font-size: 20pt; }

  .chapter-grid {
    grid-template-columns: 1fr;
  }

  .how-to-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .series-badge { display: none; }
}

/* ================================= */
/* === 작은 모바일 (480px 이하)  === */
/* ================================= */
@media (max-width: 480px) {
  .page-content { padding: 20px 16px; }
  .chapter-title { font-size: 19pt; }
  .section-num { font-size: 15pt; }
  .section-title { font-size: 15pt; }
  .hero-title { font-size: 21pt; }

  .step-num {
    font-size: 18pt;
    width: 48px;
    min-width: 48px;
  }

  .how-to-grid {
    grid-template-columns: 1fr;
  }
}

/* === 인쇄 === */
@media print {
  .sidebar, .scroll-top, .mobile-header,
  .sidebar-backdrop, .chatbot-button, .chatbot-window { display: none !important; }
  .layout { grid-template-columns: 1fr; }
  body { background: white; font-size: 11pt; }
  .page-content { box-shadow: none; padding: 20px; max-width: none; }
  .chapter-header { box-shadow: none; }
  a.external { color: black; }
  a.external::after { content: ' (' attr(href) ')'; font-size: 0.8em; color: #666; }
}

/* === 챗봇 === */
.chatbot-button {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #2E5C8A 0%, #1F3A68 100%);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(31, 58, 104, 0.35);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.chatbot-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(31, 58, 104, 0.45);
}

.chatbot-button.hidden { display: none; }

.chatbot-window {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 420px;
  height: 580px;
  min-width: 300px;
  min-height: 260px;
  max-height: calc(100vh - 48px);
  max-width: calc(100vw - 32px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  z-index: 70;
  display: none;
  flex-direction: column;
  overflow: hidden;
  resize: both;
}

.chatbot-window.open {
  display: flex;
}

/* 확장 모드 */
.chatbot-window.expanded {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
  border-radius: 14px;
  resize: both;
}

.chatbot-window .chatbot-header {
  cursor: move;
  user-select: none;
}
.chatbot-window.expanded .chatbot-header {
  cursor: move;
  user-select: none;
}

.chatbot-header {
  background: linear-gradient(135deg, #2E5C8A 0%, #1F3A68 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot-avatar {
  width: 40px;
  height: 40px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.chatbot-info { flex: 1; }

.chatbot-name {
  font-size: 13.5pt;
  font-weight: 700;
  margin-bottom: 2px;
}

.chatbot-status {
  font-size: 10pt;
  color: #C7DBF0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chatbot-status::before {
  content: '';
  width: 8px;
  height: 8px;
  background: #4ADE80;
  border-radius: 50%;
}

.chatbot-close {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 6px;
  transition: background 0.15s;
}

.chatbot-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* 창 확장 버튼 */
.chatbot-expand {
  background: none;
  border: none;
  color: white;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 6px;
  transition: background 0.15s;
  opacity: 0.8;
}
.chatbot-expand:hover {
  background: rgba(255, 255, 255, 0.15);
  opacity: 1;
}

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #F8F9FB;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chat-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 11.5pt;
  line-height: 1.65;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.chat-msg.bot {
  background: white;
  color: #2C3E50;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.chat-msg.user {
  background: #1F3A68;
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-msg.bot a {
  color: #2E5C8A;
  font-weight: 600;
}

.chat-msg.error {
  background: #FBEEEF;
  color: #C8444F;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  font-size: 11pt;
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 20px;
  background: #F8F9FB;
  border-top: 1px solid #E5E9EE;
}

.suggestion-chip {
  background: white;
  border: 1px solid #C7DBF0;
  color: #1F3A68;
  padding: 8px 14px;
  border-radius: 18px;
  font-size: 10.5pt;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: all 0.15s;
}

.suggestion-chip:hover {
  background: #1F3A68;
  color: white;
  border-color: #1F3A68;
}

.chatbot-input-area {
  padding: 16px 20px;
  background: white;
  border-top: 1px solid #E5E9EE;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chatbot-input {
  flex: 1;
  border: 1.5px solid #E5E9EE;
  border-radius: 14px;
  padding: 11px 16px;
  font-size: 11.5pt;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 200px;
  line-height: 1.5;
  transition: border-color 0.15s;
}

.chatbot-input:focus {
  border-color: #1F3A68;
}

.chatbot-send {
  background: #1F3A68;
  color: white;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.chatbot-send:hover { background: #2E5C8A; }

.chatbot-send:disabled {
  background: #C0C0C0;
  cursor: not-allowed;
}

.typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: white;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.typing span {
  width: 8px;
  height: 8px;
  background: #C0C0C0;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

@media (max-width: 768px) {
  .chatbot-window {
    width: calc(100vw - 16px);
    height: calc(100vh - 80px);
    bottom: 8px;
    right: 8px;
    max-height: none;
    border-radius: 12px;
  }

  .chatbot-button {
    width: 56px;
    height: 56px;
    font-size: 24px;
    bottom: 18px;
    right: 18px;
  }
}

/* ================================================ */
/* === 비밀번호 토글 버튼                        === */
/* ================================================ */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 17px;
  color: #8a96a8;
  padding: 4px;
  line-height: 1;
  transition: color 0.15s;
  user-select: none;
}
.pw-toggle:hover { color: #1F3A68; }

/* ================================================ */
/* === 공지 배너                                 === */
/* ================================================ */
.announcement-banner {
  position: sticky;
  top: 0;
  z-index: 200;
  background: linear-gradient(90deg, #1F3A68, #2E5C8A);
  color: #fff;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(31,58,104,0.3);
}
.announcement-content { flex: 1; line-height: 1.5; }
.announcement-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.announcement-close:hover { background: rgba(255,255,255,0.28); }

/* ================================================ */
/* === 읽기 진척 (사이드바 ✓ 표시)             === */
/* ================================================ */
.sidebar-nav a.read::before {
  content: '✓ ';
  color: #4ADE80;
  font-weight: 700;
  font-size: 10pt;
}
.sidebar-nav .sub a.read::before {
  content: '✓ ';
  color: #4ADE80;
  font-weight: 700;
}

/* ================================================ */
/* === 사이드바 유저 섹션                        === */
/* ================================================ */
.sidebar-user-section {
  padding: 14px 24px 0;
  border-top: 1px solid #2E5C8A;
  margin-top: 10px;
}
.sidebar-user-name {
  font-size: 11pt;
  color: #C7DBF0;
  font-weight: 600;
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.sidebar-account-link {
  font-size: 10pt;
  color: #A8C3DD;
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid #2E5C8A;
  border-radius: 6px;
  transition: all 0.15s;
  white-space: nowrap;
}
.sidebar-account-link:hover { background: #2E5C8A; color: #fff; }
.sidebar-logout-btn {
  font-size: 10pt;
  color: #A8C3DD;
  background: none;
  border: 1px solid #2E5C8A;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  white-space: nowrap;
}
.sidebar-logout-btn:hover { background: rgba(200,68,79,0.3); border-color: #C8444F; color: #fff; }

/* ================================================ */
/* === 학습 진행률 프로그레스바                  === */
/* ================================================ */
.sidebar-progress {
  padding: 12px 24px 10px;
  border-top: 1px solid #2E5C8A;
}
.sidebar-progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9.5pt;
  color: #A8C3DD;
  margin-bottom: 6px;
}
.sidebar-progress-count {
  font-weight: 600;
  color: #F4A847;
}
.sidebar-progress-track {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  height: 7px;
  overflow: hidden;
}
.sidebar-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4A8C5F, #F4A847);
  border-radius: 4px;
  transition: width 0.4s ease;
  min-width: 0;
}

/* ================================================ */
/* === 오디오 플레이어 (챕터 페이지 하단 고정)  === */
/* ================================================ */
#audioPlayer {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  cursor: grab;
  background: #1F3A68;
  color: #fff;
  border-radius: 40px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(31,58,104,0.4);
  z-index: 500;
  min-width: 280px;
  max-width: 460px;
  width: calc(100% - 48px);
  font-family: 'Pretendard', 'Malgun Gothic', sans-serif;
}
#apPlayBtn {
  background: rgba(255,255,255,0.18);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
#apPlayBtn:hover { background: rgba(255,255,255,0.3); }
.ap-info { flex: 1; min-width: 0; }
.ap-title { font-size: 10px; color: rgba(255,255,255,0.7); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-progress-wrap { display: flex; align-items: center; gap: 6px; }
.ap-progress-track {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
}
.ap-progress-fill {
  height: 100%;
  background: #F4A847;
  border-radius: 4px;
  width: 0;
  transition: width 0.5s linear;
}
.ap-time { font-size: 9.5px; color: rgba(255,255,255,0.6); white-space: nowrap; flex-shrink: 0; }
#apSpeed {
  background: #162d54;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  font-size: 11px;
  padding: 3px 4px;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
}
#apSpeed option {
  background: #162d54;
  color: #fff;
}
#apClose {
  background: none;
  color: rgba(255,255,255,0.5);
  border: none;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
  padding: 2px;
}
#apClose:hover { color: #fff; }
#audioPlayer:active { cursor: grabbing; }
#apRestoreBtn {
  position: fixed;
  bottom: 80px;
  left: 24px;
  background: #1F3A68;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(31,58,104,0.4);
  z-index: 500;
  display: none;
  align-items: center;
  gap: 6px;
  font-family: 'Pretendard', 'Malgun Gothic', sans-serif;
  transition: background 0.15s;
}
#apRestoreBtn:hover { background: #2E5C8A; }
@media (max-width: 600px) {
  #audioPlayer { bottom: 70px; border-radius: 16px; padding: 10px 12px; }
  #apRestoreBtn { bottom: 70px; left: 16px; }
}

/* ================================================ */
/* === 다크 모드 토글 (사이드바 + 모바일)       === */
/* ================================================ */
.dark-mode-header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  padding: 5px 14px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.22);
  color: #fff;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  width: auto;
}
.dark-mode-header-btn:hover { background: rgba(255,255,255,0.25); }

.dark-mode-sidebar-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  cursor: pointer;
  color: #A8C3DD;
  font-size: 10.5pt;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: color 0.15s;
  margin-top: 6px;
}
.dark-mode-sidebar-btn:hover { color: white; }
.dm-track {
  width: 34px;
  height: 18px;
  background: #2E5C8A;
  border-radius: 9px;
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s;
}
.dm-thumb {
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: left 0.2s;
}
[data-theme="dark"] .dm-track { background: #F4A847; }
[data-theme="dark"] .dm-thumb { left: 18px; }

.dark-mode-float-btn {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 44px;
  height: 44px;
  background: #1F3A68;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.dark-mode-float-btn:hover { background: #2E5C8A; transform: scale(1.05); }

.dark-mode-mobile-btn {
  background: rgba(255,255,255,0.12);
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  margin-left: auto;
  flex-shrink: 0;
}
.dark-mode-mobile-btn:hover { background: rgba(255,255,255,0.24); }

/* ================================================ */
/* === 다크 모드 색상                            === */
/* ================================================ */
[data-theme="dark"] {
  color-scheme: dark;
}
[data-theme="dark"] body {
  background: #0d1720;
  color: #c0d0e8;
}
[data-theme="dark"] .page-content {
  background: #162030;
  box-shadow: 0 2px 12px rgba(0,0,0,0.35);
}
[data-theme="dark"] .mobile-header { background: #0d1720; }
[data-theme="dark"] h3 { color: #7aacd8; border-bottom-color: #253650; }
[data-theme="dark"] .section-header { border-left-color: #3a6fc0; }
[data-theme="dark"] .section-title { color: #7aacd8; }
[data-theme="dark"] .toc { background: #192840; border-left-color: #3a6fc0; }
[data-theme="dark"] .toc-summary { color: #7aacd8; }
[data-theme="dark"] .toc a { color: #5a9fd4; }
[data-theme="dark"] .toc a:hover { color: #E8731C; }
[data-theme="dark"] a.external { color: #5a9fd4; border-bottom-color: #1e3a5f; }
[data-theme="dark"] .box-note   { --box-bg: #192840; }
[data-theme="dark"] .box-tip    { --box-bg: #251f10; }
[data-theme="dark"] .box-warn   { --box-bg: #28161a; }
[data-theme="dark"] .box-success{ --box-bg: #162518; }
[data-theme="dark"] .box-code   { --box-bg: #18222e; }
[data-theme="dark"] .box-code pre { color: #c0d0e8; }
[data-theme="dark"] table { background: #162030; }
[data-theme="dark"] tbody td { border-bottom-color: #253650; color: #c0d0e8; }
[data-theme="dark"] tbody tr.highlight { background: #251f10; }
[data-theme="dark"] .step { background: #162030; border-color: #253650; }
[data-theme="dark"] .step-desc { color: #7a90a8; }
[data-theme="dark"] .summary {
  background: linear-gradient(135deg, #162518 0%, #152215 100%);
  border-left-color: #4A8C5F;
}
[data-theme="dark"] .summary li { color: #c0d0e8; border-bottom-color: rgba(74,140,95,0.2); }
[data-theme="dark"] .chapter-nav { border-top-color: #253650; }
[data-theme="dark"] .nav-card { border-color: #253650; color: #c0d0e8; }
[data-theme="dark"] .nav-card:hover { border-color: #3a6fc0; box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
[data-theme="dark"] .nav-card-title { color: #7aacd8; }
[data-theme="dark"] .chatbot-window { background: #162030; }
[data-theme="dark"] .chatbot-messages { background: #0f1928; }
[data-theme="dark"] .chat-msg.bot { background: #1e3050; color: #c0d0e8; }
[data-theme="dark"] .chat-suggestions { background: #0f1928; border-top-color: #253650; }
[data-theme="dark"] .suggestion-chip {
  background: #1e3050;
  border-color: #253650;
  color: #7aacd8;
}
[data-theme="dark"] .chatbot-input-area { background: #162030; border-top-color: #253650; }
[data-theme="dark"] .chatbot-input { background: #0f1928; color: #c0d0e8; border-color: #253650; }
/* 인덱스 */
[data-theme="dark"] .series-name { color: #7aacd8; }
[data-theme="dark"] .series-header { border-bottom-color: #253650; }
[data-theme="dark"] .series-desc { color: #5a7a9a; }
[data-theme="dark"] .vol-label { background: #192840; color: #5a9fd4; }
[data-theme="dark"] .chapter-card { background: #162030; border-color: #253650; color: #c0d0e8; }
[data-theme="dark"] .chapter-card:hover { border-color: #3a6fc0; box-shadow: 0 3px 10px rgba(0,0,0,0.4); }
[data-theme="dark"] .chapter-title-text { color: #7aacd8; }
[data-theme="dark"] .how-to-card { background: #192840; }
[data-theme="dark"] .how-to-title { color: #7aacd8; }
[data-theme="dark"] .how-to-desc { color: #5a7a9a; }
/* 인증 페이지 */
[data-theme="dark"] .auth-wrap { background: #0d1720; }
[data-theme="dark"] .auth-card {
  background: #162030;
  box-shadow: 0 4px 32px rgba(0,0,0,0.5);
}
[data-theme="dark"] .auth-logo-title { color: #7aacd8; }
[data-theme="dark"] .form-group label { color: #7aacd8; }
[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group textarea {
  background: #0f1928;
  border-color: #253650;
  color: #c0d0e8;
}
[data-theme="dark"] .form-group input:focus { border-color: #3a6fc0; background: #0f1928; }
[data-theme="dark"] .auth-note { background: #192840; border-left-color: #3a6fc0; color: #7aacd8; }
[data-theme="dark"] .auth-links { color: #7a90a8; }
[data-theme="dark"] .auth-links a { color: #5a9fd4; }
/* 계정·관리자 페이지 */
[data-theme="dark"] .acc-card,
[data-theme="dark"] .admin-content,
[data-theme="dark"] .tab-content-pane { background: #162030; }
[data-theme="dark"] .info-label { color: #5a7a9a; }
[data-theme="dark"] .info-value { color: #7aacd8; }
[data-theme="dark"] .form-input { background: #0f1928; border-color: #253650; color: #c0d0e8; }
[data-theme="dark"] .form-input:focus { border-color: #3a6fc0; }
[data-theme="dark"] .session-table th { background: #192840; color: #5a7a9a; border-bottom-color: #253650; }
[data-theme="dark"] .session-table td { border-bottom-color: #253650; color: #c0d0e8; }
[data-theme="dark"] .session-table tr:hover td { background: #192840; }
[data-theme="dark"] .acc-card-header { background: linear-gradient(90deg, #192840, #253650); }
[data-theme="dark"] .admin-header { background: linear-gradient(135deg, #0d1720, #162030); }
[data-theme="dark"] .admin-sidebar { background: #0d1720; border-right-color: #253650; }
[data-theme="dark"] .tab-btn { color: #7a90a8; }
[data-theme="dark"] .tab-btn:hover { color: #c0d0e8; background: #192840; }
[data-theme="dark"] .tab-btn.active { color: #5a9fd4; border-bottom-color: #5a9fd4; background: transparent; }
[data-theme="dark"] .table-wrap, [data-theme="dark"] .request-table td { border-color: #253650; color: #c0d0e8; }
[data-theme="dark"] .request-table th { background: #192840; color: #5a7a9a; }
[data-theme="dark"] .input-field { background: #0f1928; border-color: #253650; color: #c0d0e8; }
