:root {
  --bg: #fafaf8;
  --bg-elev: #ffffff;
  --bg-card: #ffffff;
  --bg-soft: #f3f3ef;
  --border: rgba(15, 15, 20, 0.08);
  --border-strong: rgba(15, 15, 20, 0.14);
  --text: #1a1a22;
  --text-soft: #3d3d48;
  --text-muted: #6f6f7a;
  --accent: #ea4b71;
  --accent-strong: #d62553;
  --accent-soft: rgba(234, 75, 113, 0.12);
  --accent-bg: #fdeef2;
  --pink: #ea4b71;
  --pink-soft: rgba(234, 75, 113, 0.12);
  --pink-bg: #fdeef2;
  --code-bg: #1e1e28;
  --code-text: #e6e6ec;
  --shadow-sm: 0 1px 2px rgba(15, 15, 20, 0.05);
  --shadow-md: 0 8px 28px rgba(15, 15, 20, 0.08);
  --shadow-lg: 0 24px 60px rgba(15, 15, 20, 0.1);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Pretendard Variable", Pretendard, -apple-system,
    BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", sans-serif;
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-soft); color: var(--accent-strong); }
a {
  color: var(--accent-strong);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
}
a:hover { border-bottom-color: var(--accent-strong); }

/* 학생용 2컬럼 레이아웃 */
.layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  max-width: 1380px;
  margin: 0 auto;
  min-height: 100vh;
}
.main {
  max-width: 820px;
  padding: 80px 56px 160px;
  margin: 0;
}

.chapter-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-bg);
  border: 1px solid rgba(234, 75, 113, 0.22);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 24px;
}

h1 {
  font-size: 38px;
  line-height: 1.2;
  font-weight: 800;
  margin: 0 0 20px;
  letter-spacing: -0.02em;
  color: var(--text);
}
h1 .accent { color: var(--accent-strong); }
.lead {
  font-size: 18px;
  line-height: 1.7;
  color: var(--text-soft);
  margin: 0 0 48px;
}
.lead b { color: var(--text); }

h2 {
  font-size: 30px;
  font-weight: 800;
  margin: 88px 0 20px;
  letter-spacing: -0.015em;
  line-height: 1.25;
  color: var(--text);
  scroll-margin-top: 24px;
}
h3 {
  font-size: 21px;
  font-weight: 700;
  margin: 44px 0 14px;
  line-height: 1.35;
  color: var(--text);
}
p {
  margin: 0 0 20px;
  color: var(--text-soft);
}
p b, p strong { color: var(--text); }
ul, ol { margin: 0 0 24px; padding-left: 24px; }
li { margin-bottom: 8px; color: var(--text-soft); }
li::marker { color: var(--text-muted); }
hr { border: none; height: 1px; background: var(--border); margin: 72px 0; }

/* clip-section — 한 챕터 페이지 안의 클립 블록 (앵커 스크롤 단위) */
.clip-section {
  scroll-margin-top: 24px;
}
.clip-section + .clip-section {
  margin-top: 96px;
  padding-top: 56px;
  border-top: 1px solid var(--border);
}
.clip-section h2 {
  font-size: 30px;
  font-weight: 800;
  margin: 0 0 28px;
  letter-spacing: -0.015em;
  line-height: 1.25;
  color: var(--text);
}
.clip-label {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--accent-strong);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  margin-bottom: 14px;
}
h4 {
  font-size: 17px;
  font-weight: 700;
  margin: 32px 0 12px;
  line-height: 1.4;
  color: var(--text);
}

/* section-label — 본문 흐름 안 작은 라벨 박스 (예: "1부. 이론") */
.section-label {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 72px 0 16px;
}

/* 코드 블록 */
pre {
  margin: 0 0 24px;
  padding: 16px 20px;
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: 10px;
  overflow-x: auto;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.6;
}
pre code { background: transparent; padding: 0; color: inherit; font-family: inherit; }
:not(pre) > code {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  color: var(--text);
}

blockquote {
  margin: 0 0 20px;
  padding: 14px 22px;
  border-left: 3px solid var(--border-strong);
  background: var(--bg-soft);
  color: var(--text-soft);
  border-radius: 0 8px 8px 0;
}
blockquote p { margin: 0; color: var(--text-soft); }

/* 인용 박스 3종 (build_web가 > 첫 글자로 분류) */
/* 프롬프트·인용 — 차분한 중립(기본). alert처럼 안 보이게 */
blockquote.cl-quote { font-style: italic; position: relative; padding-right: 48px; }
/* 프롬프트 박스 복사 버튼 (cl-quote 전용) */
blockquote.cl-quote .copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  border-radius: 7px;
  cursor: pointer;
  color: var(--text-muted);
  opacity: 0.5;
  transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
blockquote.cl-quote:hover .copy-btn,
blockquote.cl-quote .copy-btn:focus-visible { opacity: 1; }
blockquote.cl-quote .copy-btn:hover { color: var(--accent); border-color: var(--accent); }
blockquote.cl-quote .copy-btn.copied { color: #2e9e5b; border-color: #2e9e5b; opacity: 1; }
/* ★ 중요·안전 — 핑크 강조 (꼭 봐야 할 것만) */
blockquote.cl-important {
  border-left-color: var(--accent-strong);
  background: var(--accent-bg);
}
/* 💡 팁 — 옅은 앰버 */
blockquote.cl-tip {
  border-left-color: #e0a200;
  background: #fff7e0;
}

/* summary — 큰 콜아웃 박스 */
.summary {
  background: linear-gradient(135deg, rgba(234, 75, 113, 0.08), rgba(200, 50, 79, 0.06));
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 28px 32px;
  margin: 28px 0;
  box-shadow: var(--shadow-sm);
}
.summary p {
  font-size: 16.5px;
  line-height: 1.8;
  color: var(--text);
  margin: 0 0 12px;
}
.summary p:last-child { margin-bottom: 0; }
.summary b { color: var(--accent-strong); }

/* step-diagram — 순서 있는 짧은 리스트: 세로 행 + 원형 번호 */
.step-diagram {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 24px 0 36px;
}
.step-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}
.step-card .step-num {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-bg);
  color: var(--accent-strong);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 14px;
  font-weight: 800;
}
.step-card p {
  margin: 0;
  font-size: 15px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.55;
}
.step-card p strong { color: var(--accent-strong); }
.step-card p code { font-size: 0.9em; }

/* img-placeholder — 향후 스크린샷·영상이 들어갈 위치 표시 */
.img-placeholder {
  margin: 24px 0 28px;
  padding: 40px 24px;
  border: 2px dashed rgba(234, 75, 113, 0.35);
  border-radius: 14px;
  background: var(--accent-bg);
  text-align: center;
}
.img-placeholder .placeholder-icon {
  font-size: 32px;
  margin-bottom: 12px;
  filter: grayscale(20%);
}
.img-placeholder .placeholder-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-strong);
  margin-bottom: 8px;
}
.img-placeholder .placeholder-desc {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.55;
  max-width: 600px;
  margin: 0 auto;
}

/* compare-grid — vs 비교 두 컬럼 박스 */
.compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin: 24px 0 36px;
}

/* 사이드바 로고 → 홈 링크 */
a.brand { text-decoration: none; color: inherit; cursor: pointer; }
.compare-card {
  padding: 22px 26px;
  border-radius: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.compare-card.bad {
  background: var(--bg-soft);
}
.compare-card.good {
  background: var(--accent-bg);
  border-color: rgba(234, 75, 113, 0.22);
}
.compare-card .cmp-label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 800;
  margin-bottom: 10px;
}
.compare-card.bad .cmp-label { color: var(--text-muted); }
.compare-card.good .cmp-label { color: var(--accent-strong); }
.compare-card h4 {
  font-size: 17px;
  font-weight: 800;
  margin: 0 0 14px;
  color: var(--text);
}
.compare-card ul {
  margin: 0;
  padding-left: 20px;
}
.compare-card li {
  font-size: 14.5px;
  color: var(--text-soft);
  margin-bottom: 8px;
  line-height: 1.55;
}
.compare-card li:last-child { margin-bottom: 0; }
@media (max-width: 780px) {
  .compare-grid { grid-template-columns: 1fr; }
}

/* flow-diagram — 시스템 구조 흐름도 (박스 + 화살표) */
.flow-diagram {
  display: grid;
  gap: 14px;
  margin: 24px 0 36px;
  padding: 28px 24px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}
.flow-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}
.flow-node {
  flex: 1 1 0;
  min-width: 140px;
  padding: 18px 16px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  text-align: center;
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.flow-node small {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 6px;
}
.flow-node.primary {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent-strong);
}
.flow-arrow {
  font-weight: 800;
  font-size: 13px;
  color: var(--accent-strong);
  white-space: nowrap;
  padding: 0 4px;
}
.flow-arrow::before { content: "→"; margin-right: 4px; font-size: 18px; }
@media (max-width: 780px) {
  .flow-row { flex-direction: column; }
  .flow-arrow::before { content: "↓"; }
}

/* concept-card — 개념·전환 카드 (다이어그램 placeholder 대체) */
.concept-card {
  text-align: center;
  padding: 30px 24px;
  margin: 24px 0 36px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-soft);
}
.concept-card .cc-icon { font-size: 38px; line-height: 1; margin-bottom: 12px; }
.concept-card .cc-title { font-size: 19px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.concept-card .cc-sub { font-size: 15px; color: var(--text-soft); }

/* md-figure — 마크다운 이미지 ![alt](src) (스크린샷·캡처) */
.md-figure { margin: 24px 0 36px; text-align: center; }
.md-figure img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}
.md-figure figcaption { margin-top: 10px; font-size: 13px; color: var(--text-muted); }

/* key-callout — 핵심 강조 박스 */
.key-callout {
  margin: 28px 0;
  padding: 22px 26px 22px 64px;
  border-radius: 12px;
  background: var(--accent-bg);
  border: 1px solid rgba(234, 75, 113, 0.22);
  position: relative;
}
.key-callout::before {
  content: "★";
  position: absolute;
  top: 22px;
  left: 24px;
  font-size: 22px;
  color: var(--accent-strong);
  line-height: 1;
}
.key-callout .kc-label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--accent-strong);
  margin-bottom: 6px;
}
.key-callout p {
  margin: 0;
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.7;
}
.key-callout p strong { color: var(--accent-strong); }

/* feature-grid — "**키워드**: 설명" 패턴 리스트의 카드 그리드 변환 */
.feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0 32px;
}
.feature-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 22px;
  box-shadow: var(--shadow-sm);
}
.feature-card h4 {
  margin: 0 0 6px;
  font-size: 14.5px;
  font-weight: 800;
  color: var(--accent-strong);
  letter-spacing: -0.005em;
}
.feature-card p {
  margin: 0;
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.6;
}
@media (max-width: 780px) {
  .feature-grid { grid-template-columns: 1fr; }
}

/* routing-list — "A → B" 패턴 리스트의 라우팅 카드 */
.routing-list {
  display: grid;
  gap: 8px;
  margin: 16px 0 32px;
}
.routing-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  align-items: center;
  padding: 14px 22px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}
.routing-row .from {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
}
.routing-row .arrow {
  color: var(--accent-strong);
  font-weight: 800;
  font-size: 16px;
}
.routing-row .to {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--accent-strong);
}
@media (max-width: 780px) {
  .routing-row {
    grid-template-columns: 1fr;
    gap: 4px;
    text-align: left;
  }
  .routing-row .arrow { transform: rotate(90deg); justify-self: start; }
}

/* md-table — 마크다운 표 변환 */
.md-table-wrap {
  margin: 16px 0 32px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  background: var(--bg-elev);
}
.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.md-table th, .md-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.md-table th {
  font-weight: 800;
  color: var(--text);
  background: var(--bg-soft);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.md-table td {
  color: var(--text-soft);
  line-height: 1.6;
}
.md-table tbody tr:last-child td { border-bottom: none; }
.md-table tbody tr { transition: background-color 130ms ease; }
.md-table tbody tr:hover td { background-color: var(--accent-bg); color: var(--text); }

/* 다음 클립 CTA */
.next-cta {
  margin-top: 24px;
  padding: 22px 26px;
  border-radius: 12px;
  background: var(--accent-bg);
  border: 1px solid rgba(234, 75, 113, 0.24);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.next-cta .label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 4px;
}
.next-cta .title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.next-cta a {
  border-bottom: none;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 18px;
  background: var(--accent-strong);
  color: white;
  border-radius: 8px;
  white-space: nowrap;
}
.next-cta a:hover { background: var(--accent); }

@media (max-width: 1080px) {
  .layout { grid-template-columns: 260px 1fr; }
  .main { padding: 64px 40px 120px; }
}
@media (max-width: 780px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 48px 24px 96px; }
}

/* frontmatter 색상 강조 — description을 3분할(무엇을/트리거/우선순위)해 표와 색으로 연결 */
.fm-code .fm-what { color: #7dd3fc; font-weight: 600; }
.fm-code .fm-trigger { color: #86efac; font-weight: 600; }
.fm-code .fm-priority { color: #fcd34d; font-weight: 600; }

/* 표 안 영어 원문 하이라이트 — 코드블록 색(파랑/초록/노랑)과 짝 */
.md-table code.hl-what { background: #dbeafe; border-color: #bfdbfe; color: #1e3a8a; }
.md-table code.hl-trigger { background: #dcfce7; border-color: #bbf7d0; color: #14532d; }
.md-table code.hl-priority { background: #fef3c7; border-color: #fde68a; color: #78350f; }

/* ── 강사소개 페이지 (instructor.html) ── */
.instructor-head { display: flex; align-items: center; gap: 22px; margin: 8px 0 24px; flex-wrap: wrap; }
.instructor-photo { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); box-shadow: var(--shadow-sm); flex-shrink: 0; }
.instructor-id { flex: 1; min-width: 220px; }
.instructor-id h1 { margin: 0 0 6px; }
.instructor-role { margin: 0; font-size: 14.5px; font-weight: 700; color: var(--accent-strong); line-height: 1.5; }
.instructor-block { margin: 22px 0; }
.instructor-block ul { margin: 8px 0 0; padding-left: 18px; color: var(--text-soft); font-size: 15px; line-height: 1.7; }
.instructor-block ul li { margin: 3px 0; }
/* ── 공용 푸터 (외부 반출 금지) ── */
.page-footer { margin-top: 56px; padding-top: 18px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-muted); line-height: 1.6; }
.page-footer b { color: var(--text-soft); font-weight: 700; }

/* chapter explainer video (YouTube embed, added 2026-11) */
.chapter-video { margin: 22px 0 30px; }
.chapter-video .cv-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #111; border: 1px solid var(--border-strong); box-shadow: var(--shadow-md); }
.chapter-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.chapter-video figcaption { margin-top: 10px; font-size: 13px; color: var(--text-muted); display: flex; gap: 8px; align-items: center; }
.chapter-video figcaption .cv-badge { display: inline-flex; padding: 2px 8px; border-radius: 999px; background: var(--accent-bg); color: var(--accent-strong); font-weight: 700; font-size: 11px; letter-spacing: .02em; }
@media (max-width: 780px) { .chapter-video { margin: 16px 0 22px; max-width: calc(100vw - 48px); } .chapter-video .cv-frame { border-radius: 10px; } }
