/* ============================================================
   VibeCoder Lab — v2 Design System
   방향: Clean Modern + League Atmosphere
   ============================================================ */

/* Pretendard 웹폰트는 index.html의 <link>로 불러온다(@import는 styles.css를 받은 뒤에야
   요청이 시작돼 표시가 늦다). 학교망에서 CDN이 막히면 아래 --font-sans의 시스템 한글 폰트로
   자동 대체되므로, 폰트를 못 받아도 화면이 깨지지 않는다. */

/* ---- 디자인 토큰 ---- */
:root {
  /* Pretendard를 못 받는 환경(학교망 차단, 오프라인)에서도 한글이 제대로 보이도록
     OS별 기본 한글 폰트를 모두 넣는다. Windows는 맑은 고딕, macOS·iOS는 Apple SD Gothic Neo,
     Android·ChromeOS는 Noto Sans KR로 대체된다. */
  --font-sans: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui,
    'Apple SD Gothic Neo', 'Malgun Gothic', '맑은 고딕', 'Noto Sans KR', 'Noto Sans CJK KR', sans-serif;
  --font-mono: 'Menlo', 'Consolas', 'D2Coding', 'Fira Mono', monospace;
  --bg: #f4f3ee;
  --panel: #ffffff;
  --surface-soft: #faf9f6;
  --surface-card: #f0efe9;
  --ink: #1c1917;
  --body: #44403c;
  --muted: #78716c;
  --line: #e4e0d8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.05);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 2px 8px rgba(0,0,0,.07), 0 8px 24px rgba(0,0,0,.06);

  /* 리그 액센트 (app.js가 덮어씀) */
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #eff6ff;

  /* 섹션별 고정 색 */
  --sum-bg: #fffbeb; --sum-border: #fde68a; --sum-ink: #92400e;
  --read-bg: #f0f7ff; --read-border: #bfdbfe; --read-ink: #1e40af;
  --term-bg: #f0fdf4; --term-border: #bbf7d0; --term-ink: #166534;
  --talk-bg: #fff7ed; --talk-border: #fed7aa; --talk-ink: #9a3412;
  --step-bg: #faf5ff; --step-border: #e9d5ff; --step-ink: #5b21b6;

  --danger: #dc2626;
}

/* ---- 기본 ---- */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17.5px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  /* anywhere는 break-word와 달리 요소의 '최소 폭' 계산까지 줄여 준다.
     break-word만으로는 "Claude Code·Antigravity·Codex" 같은 긴 토큰이 컨테이너를
     밀어내 좁은 화면에서 가로 스크롤이 생긴다. keep-all이 함께 걸려 있어
     한글 단어는 그대로 유지되고, 정말 안 들어갈 때만 끊어진다. */
  overflow-wrap: anywhere;
}
button, input, textarea, select { font: inherit; }
h1, h2, h3, p { margin-top: 0; }

/* ---- 버튼 ---- */
button {
  min-height: 42px;
  padding: 9px 18px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
button:hover, button:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: .38; cursor: not-allowed; }
.primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.ghost { background: transparent; }
/* 라벨이 긴 보조 버튼은 button 기본 nowrap을 풀어야 좁은 화면에서 넘치지 않는다. */
#discussAiPrompt, #selfCheckPrompt { white-space: normal; text-align: left; }
.danger { color: var(--danger); }
.danger:hover { border-color: var(--danger); }

/* ---- 상단바 ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 28px;
  min-height: 68px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.brand-mark {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .3s;
}
.brand-mark svg { display: block; }
.brand-text { display: flex; flex-direction: column; justify-content: center; }
.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  line-height: 1;
}
.brand h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.2;
  color: var(--ink);
  white-space: nowrap;
}

.course-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  max-width: 360px;
}
.progress-label { color: var(--muted); font-size: 13px; font-weight: 700; white-space: nowrap; }
.progress-track { flex: 1; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .5s cubic-bezier(.4,0,.2,1); }
.progress-pct { color: var(--accent-strong); font-size: 14px; font-weight: 700; min-width: 42px; text-align: right; }
.developer-meta {
  display: grid;
  gap: 4px;
  min-width: 460px;
  max-width: 620px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}
.developer-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.developer-line > span:not(:last-child)::after,
.developer-line > strong::after {
  content: "·";
  margin-left: 10px;
  color: var(--muted);
  font-weight: 700;
}
.developer-meta strong {
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.2;
  white-space: nowrap;
}
.developer-meta span {
  white-space: nowrap;
}
.developer-kicker {
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.top-actions { display: flex; gap: 8px; margin-left: auto; }
#presentBtn { font-size: 14.5px; font-weight: 700; gap: 5px; }

/* ---- 레이아웃 ---- */
.layout {
  display: grid;
  grid-template-columns: minmax(300px, 340px) minmax(0, 1fr);
  gap: 32px;
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px;
  align-items: start;
}
.sidebar { position: sticky; top: 88px; display: grid; gap: 14px; min-width: 0; width: 100%; max-width: 340px; }
.content { min-width: 0; display: grid; gap: 16px; }

/* ---- 패널 ---- */
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 16px;
}
.panel h2 {
  font-size: 13px;
  margin-bottom: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 700;
}
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.panel-title h2 { margin: 0; }
#pageCounter { color: var(--muted); font-size: 13px; font-weight: 700; white-space: nowrap; }

/* ---- 리그 버튼 ---- */
.level-list, .page-list { display: grid; gap: 6px; }
.level-btn {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 2px;
  padding: 14px 15px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  border-color: transparent;
  white-space: normal;
  overflow: hidden;
}
.level-btn strong { min-width: 0; font-size: 16px; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.level-btn-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.level-icon { display: flex; align-items: center; color: var(--muted); flex-shrink: 0; }
.level-sublabel { min-width: 0; font-size: 13px; color: var(--muted); line-height: 1.45; display: block; overflow-wrap: anywhere; }
.level-pct-badge { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--muted); background: var(--surface-card); padding: 2px 8px; border-radius: 999px; flex-shrink: 0; white-space: nowrap; }
.level-mini-track { height: 4px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 5px; }
.level-mini-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width .5s cubic-bezier(.4,0,.2,1); }
.level-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent);
}
.level-btn.active .level-icon { color: var(--accent); }
.level-btn.active strong { color: var(--accent-strong); }
.level-btn.active .level-pct-badge { background: var(--accent-soft); color: var(--accent-strong); }
.level-intro { margin: 10px 2px 0; color: var(--muted); font-size: 13.5px; line-height: 1.7; }

/* ---- 강의 목록 ---- */
.page-group {
  margin: 14px 4px 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.page-group:first-child { margin-top: 4px; }
.page-btn {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  border-color: transparent;
  min-height: unset;
  width: 100%;
  text-align: left;
  white-space: normal;
  overflow: hidden;
}
.page-btn:hover { background: var(--surface-soft); border-color: transparent; }
.page-btn.active { border-color: var(--accent); background: var(--accent-soft); }
.page-btn strong { display: block; font-size: 15px; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.page-btn > span:nth-child(2) { min-width: 0; }
.page-btn > span:nth-child(2) > span { display: block; color: var(--muted); font-size: 13px; line-height: 1.4; margin-top: 2px; overflow-wrap: anywhere; }
.num {
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface-card);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 800;
  flex-shrink: 0;
}
.page-btn.active .num { background: var(--accent); color: #fff; }
.done { color: var(--accent-strong); font-size: 15px; font-weight: 700; }

/* ============================================================
   강의 본문
   ============================================================ */
.lesson {
  width: 100%;
  max-width: 980px;
  padding: 40px 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

/* 브레드크럼 */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
}
.crumb-sep { color: var(--line); }

/* 강의 메타 */
.lesson-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.lesson-counter {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
}
.lesson-progress { flex: 1; min-width: 120px; max-width: 240px; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.lesson-progress-text { color: var(--muted); font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.lesson-top-nav {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.icon-nav {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 999px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  color: var(--accent-strong);
  background: #fff;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
}
.icon-nav:hover:not(:disabled) { background: var(--accent); color: #fff; }

/* 제목 & 목표 */
#pageTitle {
  font-size: 34px;
  line-height: 1.25;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -.03em;
  color: var(--ink);
}
.goal {
  margin-bottom: 28px;
  color: var(--body);
  font-size: 18px;
  line-height: 1.65;
}

/* 섹션 레이블 공통 */
.lesson h3 {
  display: inline-block;
  width: max-content;
  white-space: nowrap;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  padding: 3px 9px;
  border-radius: 999px;
}

/* ============================================================
   섹션 카드 — 각각 다른 시각 언어
   ============================================================ */

/* 한 줄 핵심 — 앰버 강조 */
.summary-card {
  padding: 22px 24px;
  margin-bottom: 12px;
  border-radius: var(--radius);
  background: var(--sum-bg);
  border: 1.5px solid var(--sum-border);
  position: relative;
}
.summary-card h3 {
  background: #fef3c7;
  color: var(--sum-ink);
  white-space: nowrap;
  margin-bottom: 12px;
}
.summary-card p {
  margin: 0;
  font-size: 18px;
  line-height: 1.65;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -.01em;
}

/* 읽고 이해하기 — 블루 톤 */
.reading-card {
  padding: 22px 24px;
  margin-bottom: 12px;
  border-radius: var(--radius);
  background: var(--read-bg);
  border: 1.5px solid var(--read-border);
}
.reading-card h3 { background: #dbeafe; color: var(--read-ink); margin-bottom: 14px; white-space: nowrap; }
.reading-card p { margin: 0; color: var(--body); font-size: 18px; line-height: 1.9; }
.reading-card p + p {
  margin-top: 13px;
  padding-top: 13px;
  border-top: 1px solid color-mix(in srgb, var(--read-border) 55%, transparent);
}

/* 용어 사전 — 그린 톤 */
.terms-card {
  padding: 22px 24px;
  margin-bottom: 12px;
  border-radius: var(--radius);
  background: var(--term-bg);
  border: 1.5px solid var(--term-border);
}
.terms-card h3 { background: #dcfce7; color: var(--term-ink); margin-bottom: 14px; white-space: nowrap; }
.terms-card dl { margin: 0; display: grid; gap: 14px; }
.terms-card dt {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 6px;
  background: #bbf7d0;
  color: var(--term-ink);
  font-weight: 800;
  font-size: 13.5px;
  margin-bottom: 3px;
}
.terms-card dd { margin: 0; color: var(--body); font-size: 17px; line-height: 1.7; }

/* 시각화 (visual) */
.visual {
  margin: 0 0 12px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  /* 도식은 단계 상자에 최소 폭이 있어 아주 좁은 화면에서는 더 줄지 않는다.
     contain: inline-size로 내용이 바깥 폭을 결정하지 못하게 막고,
     넘치는 만큼은 도식 안에서만 가로로 넘기게 한다(페이지는 밀리지 않는다). */
  min-width: 0;
  contain: inline-size;
  overflow-x: auto;
}
.visual.hidden { display: none; }
.visual-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  white-space: nowrap;
}

/* 생각해보기 — 오렌지 톤 */
.talk-card {
  padding: 22px 24px;
  margin-bottom: 12px;
  border-radius: var(--radius);
  background: var(--talk-bg);
  border: 1.5px solid var(--talk-border);
}
.talk-card h3 { background: #fed7aa; color: var(--talk-ink); margin-bottom: 14px; white-space: nowrap; }
.talk-card ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.talk-card li {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  color: var(--body);
  font-size: 15px;
  padding: 12px 14px;
  background: rgba(255,255,255,.65);
  border-radius: var(--radius-sm);
  border: 1px solid var(--talk-border);
  word-break: break-word;
  overflow-wrap: break-word;
}
.q-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--talk-ink);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  flex-shrink: 0;
  margin-top: 1px;
  font-style: italic;
}
.q-dot::after { content: "Q"; }

/* 따라하기 — 퍼플 톤 */
.steps-card {
  padding: 22px 24px;
  margin-bottom: 12px;
  border-radius: var(--radius);
  background: var(--step-bg);
  border: 1.5px solid var(--step-border);
}
.steps-card h3 { background: #ede9fe; color: var(--step-ink); margin-bottom: 14px; white-space: nowrap; }
.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}
.steps li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-width: 0;
  padding: 12px 14px;
  background: rgba(255,255,255,.7);
  border-radius: var(--radius-sm);
  border: 1px solid var(--step-border);
  word-break: break-word;
  overflow-wrap: break-word;
  transition: background .15s;
}
.steps li:hover { background: rgba(255,255,255,.95); }
.step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--step-ink);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 1px;
}
.step-body {
  min-width: 0; flex: 1; color: var(--body); font-size: 17.5px; line-height: 1.7; }

/* 외부 가이드 */
.external-guide {
  padding: 20px 22px;
  margin-bottom: 12px;
  border-radius: var(--radius);
  background: #fff8f0;
  border: 1.5px solid #fed7aa;
}
.external-guide:empty { display: none; }
.external-guide strong { display: block; margin-bottom: 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.external-guide p { margin: 0; color: var(--body); font-size: 17.5px; line-height: 1.75; }
.guide-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.guide-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 16px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border: 1.5px solid var(--accent);
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.guide-link-btn:hover { background: var(--accent); color: #fff; }
.tool-manuals {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}
.tool-manual-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .04em;
}
.tool-manual {
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
  border-radius: var(--radius-sm);
  background: #fff;
  overflow: hidden;
}
.tool-manual > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
}
.tool-manual > summary::-webkit-details-marker { display: none; }
.tool-manual > summary::before {
  content: "▸";
  color: var(--accent-strong);
  font-size: 12px;
}
.tool-manual[open] > summary::before { content: "▾"; }
.tool-manual > summary small {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.tool-manual-body {
  display: grid;
  gap: 10px;
  padding: 0 14px 14px 32px;
}
.tool-manual-body p {
  margin: 0;
  color: var(--body);
  font-size: 15.5px;
  line-height: 1.7;
}
.tool-manual-body ol {
  margin: 0;
  padding-left: 20px;
  color: var(--body);
  font-size: 15.5px;
  line-height: 1.7;
}
.tool-manual-body li + li { margin-top: 4px; }

/* ---- 인라인 코드 ---- */
code.inline-code {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: .83em;
  background: #1e1e2e;
  color: #cdd6f4;
  border-radius: 5px;
  padding: 2px 7px;
  cursor: pointer;
  user-select: none;
  /* 긴 명령이 좁은 화면에서 컨테이너를 밀어내지 않도록 줄바꿈을 허용한다 */
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  transition: background .13s, transform .1s;
}
code.inline-code::after { content: "⎘"; font-size: .7em; margin-left: 5px; opacity: .5; }
code.inline-code:hover { background: #313244; transform: translateY(-1px); }

/* ---- 칩 가이드 ---- */
.chip-guide { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.guide-chip {
  display: inline-flex;
  align-items: center;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: .77rem;
  font-weight: 500;
  /* 긴 예시 칩이 가로로 삐져나가지 않도록 줄바꿈을 허용한다 */
  max-width: 100%;
  white-space: normal;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: background .13s, color .13s, transform .1s;
}
.guide-chip:hover { background: var(--accent); color: #fff; transform: translateY(-1px); }

/* ============================================================
   시각화 컴포넌트
   ============================================================ */
.mindmap { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.mm-center { background: var(--accent); color: #fff; font-weight: 800; font-size: 15px; padding: 12px 28px; border-radius: 999px; white-space: nowrap; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent); letter-spacing: -.02em; }
.mm-branches { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.mm-branch { background: var(--panel); border: 2px solid var(--accent); border-radius: 10px; padding: 13px 15px; min-width: 130px; max-width: 200px; box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 12%, transparent); }
.mm-branch-label { font-weight: 800; font-size: 13px; color: var(--accent-strong); margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1.5px solid var(--accent-soft); }
.mm-leaf { font-size: 12px; color: var(--body); padding: 3px 0 3px 10px; border-left: 2px solid var(--accent-soft); margin-bottom: 3px; line-height: 1.4; }

.flow { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; padding: 4px 0; }
.flow-step { display: flex; align-items: center; gap: 6px; }
.flow-box { background: var(--panel); border: 2px solid var(--accent); color: var(--accent-strong); border-radius: var(--radius-sm); padding: 10px 16px; text-align: center; min-width: 80px; box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 12%, transparent); transition: transform .15s; }
.flow-box:hover { transform: translateY(-2px); }
.flow-box strong { display: block; font-size: 13px; font-weight: 700; }
.flow-box span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.flow-arrow { color: var(--accent); font-size: 20px; font-weight: 700; }

.tree { padding: 4px 0; }
.tree-node { margin-bottom: 4px; }
.tree-label { display: inline-block; padding: 5px 12px; border-radius: 6px; font-size: 13px; font-weight: 600; }
.depth-0 > .tree-label { background: var(--accent); color: #fff; font-size: 14px; }
.depth-1 > .tree-label { background: var(--accent-soft); color: var(--accent-strong); border: 1.5px solid var(--accent); }
.depth-2 > .tree-label { background: var(--surface-card); color: var(--body); border: 1px solid var(--line); font-weight: 500; }
.tree-children { margin-left: 16px; border-left: 2px dashed var(--line); padding-left: 14px; padding-top: 6px; margin-top: 4px; }

.compare { display: flex; gap: 12px; flex-wrap: wrap; }
.compare-col { flex: 1; min-width: 140px; border: 2px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.compare-head { background: var(--accent); color: #fff; font-weight: 800; font-size: 13px; padding: 11px 14px; text-align: center; }
.compare-item { padding: 9px 14px; font-size: 13px; color: var(--body); border-bottom: 1px solid var(--line); line-height: 1.5; }
.compare-item:last-child { border-bottom: 0; }
.compare-item:nth-child(even) { background: var(--surface-soft); }

.layers { display: flex; flex-direction: column; gap: 5px; }
.layer-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-radius: var(--radius-sm); }
.layer-item strong { font-size: 13.5px; }
.layer-item span { font-size: 12px; opacity: .8; text-align: right; max-width: 55%; }
.layer-0 { background: var(--accent-soft); border: 1.5px solid var(--accent); color: var(--accent-strong); }
.layer-1 { background: var(--accent); color: #fff; }
.layer-2 { background: var(--accent-strong); color: #fff; }
.layer-3 { background: #1c1917; color: #fff; }

.concept { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.concept-card { padding: 16px; border: 1px solid rgba(0,0,0,.06); border-radius: var(--radius-sm); transition: transform .15s, box-shadow .15s; }
.concept-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.concept-card strong { display: block; margin-bottom: 6px; color: var(--ink); font-size: 14px; font-weight: 700; }
.concept-card span { color: var(--body); font-size: 13px; line-height: 1.55; }
.concept-card:nth-child(4n+1) { background: #f3eeff; }
.concept-card:nth-child(4n+2) { background: #fde8ef; }
.concept-card:nth-child(4n+3) { background: #fffbe6; }
.concept-card:nth-child(4n+4) { background: #e8f5e9; }

/* ============================================================
   실습하기
   ============================================================ */
.practice-card {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}
.practice-card > .section-head {
  padding: 14px 20px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  border-top: 3px solid var(--accent);
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  white-space: nowrap;
}
.section-head button { min-height: 34px; padding: 6px 14px; font-size: 14.5px; }
#practiceArea { padding: 20px; }

label { display: grid; gap: 5px; color: var(--muted); font-size: 14.5px; font-weight: 700; letter-spacing: .02em; }
input, textarea, select {
  width: 100%;
  /* 폼 컨트롤은 기본 고유 폭(약 20자)이 있어 그리드 트랙을 밀어낸다.
     min-width: 0을 줘야 좁은 화면에서 컨테이너 폭까지 줄어든다. */
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-size: 17px;
  transition: border-color .15s, box-shadow .15s;
}
input, select { min-height: 42px; padding: 9px 12px; }
textarea { min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.65; }
input::placeholder, textarea::placeholder { color: #b0b8c4; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fields { display: grid; gap: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.result { padding: 14px 16px; border: 1.5px dashed var(--line); border-radius: var(--radius-sm); background: #fff; color: var(--body); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16px; line-height: 1.7; }
.mini-preview { width: 100%; min-height: 240px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.build-preview { min-height: 420px; }
.choice-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
/* 선택지 버튼은 설명이 두 줄 이상이므로 버튼 기본 nowrap을 풀어 준다 */
.choice { min-height: 76px; min-width: 0; text-align: left; background: var(--panel); border-radius: var(--radius-sm); font-weight: 600; font-size: 13.5px; white-space: normal; }
.choice strong { font-weight: 800; }
.choice.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }

/* 확인하기 */
.checks { margin-top: 0; padding: 18px 20px; border-top: 1px solid var(--line); background: var(--surface-soft); }
.checks h3 {
  display: inline-block;
  white-space: nowrap;
  margin-bottom: 12px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  padding: 3px 9px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
}
.check-item {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: start;
  padding: 11px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  font-size: 16.5px;
}
.check-item:last-child { margin-bottom: 0; }
.check-item span { min-width: 0; overflow-wrap: anywhere; }
.check-item input { width: 18px; min-height: 18px; margin-top: 2px; accent-color: var(--accent); }

/* 섹션 카드 호버 */
.summary-card, .reading-card, .terms-card, .talk-card, .steps-card {
  transition: box-shadow .2s;
}
.summary-card:hover { box-shadow: 0 4px 20px color-mix(in srgb, var(--sum-border) 60%, transparent); }
.reading-card:hover { box-shadow: 0 4px 20px color-mix(in srgb, var(--read-border) 60%, transparent); }
.terms-card:hover  { box-shadow: 0 4px 20px color-mix(in srgb, var(--term-border) 60%, transparent); }
.talk-card:hover   { box-shadow: 0 4px 20px color-mix(in srgb, var(--talk-border) 60%, transparent); }
.steps-card:hover  { box-shadow: 0 4px 20px color-mix(in srgb, var(--step-border) 60%, transparent); }

/* 강의 이동 */
.lesson-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.lesson-nav .primary { margin-left: auto; padding: 12px 26px; font-size: 16px; }
.lesson-nav .ghost { font-size: 15.5px; }

/* 저장 버튼 */
#savePage { min-height: 34px; padding: 6px 14px; font-size: 14.5px; }

/* ============================================================
   리소스 (접기)
   ============================================================ */
.resource {
  width: 100%;
  max-width: 900px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.resource > summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  user-select: none;
}
.resource > summary::-webkit-details-marker { display: none; }
.resource > summary::before { content: "▸"; color: var(--muted); font-size: 11px; }
.resource[open] > summary::before { content: "▾"; }
.resource-body { padding: 0 20px 20px; display: grid; gap: 12px; }
.resource-hint { margin: 0; color: var(--muted); font-size: 15px; }
#notebook { width: 100%; min-height: 300px; padding: 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: 15px; line-height: 1.65; resize: vertical; }
.help-panel { display: grid; gap: 12px; }
#helpPrompt { min-height: 180px; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-soft); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.7; overflow: auto; }
/* 완료율 코드는 줄바꿈 없는 긴 base64 문자열이라 그대로 두면 페이지를 통째로 밀어낸다. */
#submitCodeText { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ============================================================
   토스트
   ============================================================ */
#toast {
  position: fixed;
  right: 20px;
  bottom: 24px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(8px);
  transition: .2s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
  z-index: 50;
  box-shadow: var(--shadow-md);
}
#toast.show { opacity: 1; transform: translateY(0); }

/* ============================================================
   발표 모드
   ============================================================ */
.pres-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  background: #faf9f6;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.pres-overlay.active { opacity: 1; pointer-events: all; }

.pres-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  height: 58px;
  background: #1c1917;
  color: #fff;
  flex-shrink: 0;
}
.pres-lesson-info { display: flex; align-items: center; gap: 10px; flex: 1; overflow: hidden; }
.pres-league {
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 3px 10px;
  border-radius: 5px;
  white-space: nowrap;
  flex-shrink: 0;
}
.pres-lesson-name { font-size: 13.5px; font-weight: 700; color: rgba(255,255,255,.75); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pres-controls { display: flex; align-items: center; gap: 10px; }
.pres-nav-btn { min-height: 34px; padding: 5px 14px; background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #fff; font-size: 17px; border-radius: 6px; }
.pres-nav-btn:hover { background: rgba(255,255,255,.2); }
.pres-nav-btn:disabled { opacity: .3; }
.pres-counter { color: rgba(255,255,255,.6); font-size: 12.5px; font-weight: 700; min-width: 48px; text-align: center; }
.pres-close-btn { min-height: 34px; padding: 5px 14px; background: transparent; border-color: rgba(255,255,255,.25); color: rgba(255,255,255,.75); font-size: 13px; border-radius: 6px; }
.pres-close-btn:hover { background: rgba(255,255,255,.1); }

.pres-stage { flex: 1; overflow-y: auto; display: flex; align-items: flex-start; justify-content: center; padding: 64px 40px; }
.pres-slide { width: 100%; max-width: 820px; }

.pres-footer { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 14px; border-top: 1px solid var(--line); flex-shrink: 0; }
.pres-dots { display: flex; gap: 7px; align-items: center; }
.pres-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--line);
  cursor: pointer;
  border: none;
  padding: 0;
  min-height: unset;
  transition: background .15s, transform .15s;
}
.pres-dot.active { background: var(--accent); transform: scale(1.5); }
.pres-dot:hover { background: var(--muted); }

/* 슬라이드 타입 */
.pres-title-slide { text-align: center; padding: 40px 20px 60px; }
.pres-league-chip {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--accent);
  margin-bottom: 30px;
}
.pres-main-title { font-size: 46px; font-weight: 800; color: var(--ink); line-height: 1.18; letter-spacing: -.04em; margin-bottom: 20px; }
.pres-slide-goal { font-size: 20px; color: var(--body); line-height: 1.65; max-width: 600px; margin: 0 auto; }

.pres-section-slide { padding: 0; }
.pres-section-label {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent-strong);
  margin-bottom: 26px;
  padding: 4px 12px;
  background: var(--accent-soft);
  border-radius: 5px;
}
.pres-summary-text { font-size: 30px; font-weight: 600; line-height: 1.5; color: var(--ink); margin: 0; }
.pres-body-text { font-size: 22px; line-height: 1.8; color: var(--body); margin: 0; }

.pres-terms { margin: 0; display: grid; gap: 16px; }
.pres-term-row { display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: start; padding: 18px 20px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.pres-term-row dt { font-size: 18px; font-weight: 800; color: var(--accent-strong); }
.pres-term-row dd { margin: 0; font-size: 17px; color: var(--body); line-height: 1.65; }

.pres-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.pres-list li { font-size: 20px; color: var(--body); line-height: 1.65; padding: 16px 20px; background: var(--surface-soft); border-radius: 10px; }
ol.pres-list li { padding-left: 0; }

.pres-visual-wrap { width: 100%; padding: 8px 0; }
.pres-visual-wrap .mm-center { font-size: 17px; padding: 13px 32px; }
.pres-visual-wrap .mm-branch { min-width: 160px; max-width: 240px; padding: 14px 16px; }
.pres-visual-wrap .mm-branch-label { font-size: 15px; }
.pres-visual-wrap .mm-leaf { font-size: 13.5px; }
.pres-visual-wrap .flow-box { padding: 11px 18px; min-width: 88px; }
.pres-visual-wrap .flow-box strong { font-size: 14.5px; }
.pres-visual-wrap .flow-arrow { font-size: 22px; }
.pres-visual-wrap .tree-label { font-size: 15px; padding: 7px 15px; }
.pres-visual-wrap .compare-head { font-size: 14.5px; }
.pres-visual-wrap .compare-item { font-size: 13.5px; }
.pres-visual-wrap .layer-item strong { font-size: 15.5px; }
.pres-visual-wrap .layer-item span { font-size: 13.5px; }

.pres-concept-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.pres-concept-card { padding: 20px 22px; border-radius: 10px; border: 1px solid rgba(0,0,0,.06); }
.pres-concept-card:nth-child(4n+1) { background: #f3eeff; }
.pres-concept-card:nth-child(4n+2) { background: #fde8ef; }
.pres-concept-card:nth-child(4n+3) { background: #fffbe6; }
.pres-concept-card:nth-child(4n+4) { background: #e8f5e9; }
.pres-concept-card strong { display: block; font-size: 17px; font-weight: 800; color: var(--ink); margin-bottom: 8px; }
.pres-concept-card span { font-size: 14.5px; color: var(--body); line-height: 1.55; }

/* ============================================================
   반응형
   ============================================================ */
@media (max-width: 1040px) {
  .topbar { gap: 14px; }
  .developer-meta { min-width: 320px; max-width: 460px; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-width: none; }
  .lesson, .resource { max-width: none; }
}
/* 헤더 한 줄에 필요한 최소 폭이 약 1100px이라(브랜드 + 진행률 + 개발자 정보 460px + 버튼 4개),
   1280px 미만에서는 한 줄에 들어가지 않는다. 그 아래는 줄바꿈을 허용해 진행률과 개발자 정보를
   다음 줄로 내린다. 이 규칙이 없으면 761~1279px 구간(태블릿·소형 노트북)에서 가로 스크롤이 생긴다. */
@media (max-width: 1279px) {
  .topbar { flex-wrap: wrap; row-gap: 10px; min-height: 0; padding-top: 10px; padding-bottom: 10px; }
  .top-actions { order: 2; }
  .course-progress { order: 3; max-width: none; flex-basis: 100%; }
  .developer-meta { order: 4; min-width: 0; max-width: none; flex-basis: 100%; }
}
@media (max-width: 760px) {
  .topbar { gap: 10px; padding: 10px 16px; }
  .developer-line { gap: 6px 8px; }
  .developer-line > span:not(:last-child)::after,
  .developer-line > strong::after { margin-left: 8px; }
  .top-actions { gap: 6px; }
  #presentBtn { display: none; }
  .layout { padding: 12px; gap: 12px; }
  .lesson { padding: 24px 18px; }
  #pageTitle { font-size: 28px; }
  .two, .choice-row { grid-template-columns: 1fr; }
  .lesson-nav { flex-direction: column-reverse; }
  .lesson-nav button { width: 100%; }
  .pres-stage { padding: 30px 20px; }
  .pres-main-title { font-size: 28px; }
  .pres-summary-text { font-size: 21px; }
  .pres-body-text { font-size: 16.5px; }
  .pres-term-row { grid-template-columns: 1fr; gap: 6px; }
  .pres-list li { font-size: 15.5px; }
  ol.pres-list li { grid-template-columns: 28px 1fr; }
}

/* ============================================================
   고도화 — 발표자 노트 · 실습/확인 슬라이드 · 온보딩 (증분 1)
   ============================================================ */
/* 발표자 노트 토글 버튼 (헤더, 어두운 배경) */
.pres-notes-btn { min-height: 34px; padding: 5px 14px; background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.2); color: #fff; font-size: 13px; border-radius: 6px; }
.pres-notes-btn:hover { background: rgba(255,255,255,.2); }

/* 발표자 노트 패널 (푸터 위, 교사용 멘트) */
.pres-notes {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 12px 16px;
  background: #fff8e6;
  border: 1px solid #f1d27a;
  border-radius: var(--radius-sm);
  font-size: 15.5px;
  line-height: 1.65;
  color: #5b4a16;
}
.pres-notes-label { display: inline-block; font-weight: 800; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #a16207; margin-right: 8px; }

/* 실습 슬라이드의 필드 힌트, 확인 슬라이드 체크 항목 */
.pres-field-hint { color: var(--muted); font-weight: 500; }
.pres-check-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.pres-check-list li { font-size: 19px; color: var(--body); line-height: 1.65; padding: 16px 20px 16px 48px; background: var(--surface-soft); border-radius: 10px; position: relative; }
.pres-check-list li::before { content: "✓"; position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--accent); font-weight: 800; }

/* 첫 방문 온보딩 오버레이 */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(28,25,23,.55);
}
.onboarding-overlay[hidden] { display: none; }
.onboarding-card {
  width: 100%;
  max-width: 480px;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 28px 28px 24px;
}
.onboarding-eyebrow { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-strong); margin: 0 0 6px; }
.onboarding-card h2 { font-size: 24px; font-weight: 800; color: var(--ink); margin: 0 0 18px; letter-spacing: -.02em; }
.onboarding-steps { margin: 0 0 22px; padding: 0; list-style: none; display: grid; gap: 12px; }
.onboarding-steps li { font-size: 15.5px; line-height: 1.6; color: var(--body); padding-left: 22px; position: relative; }
.onboarding-steps li::before { content: ""; position: absolute; left: 4px; top: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.onboarding-card .primary { width: 100%; padding: 12px; font-size: 16px; }

/* 모바일: 늘어난 상단 버튼이 깔끔히 줄바꿈되도록 */
@media (max-width: 760px) {
  .top-actions { flex-wrap: wrap; }
  .pres-notes { font-size: 14px; }
  .pres-check-list li { font-size: 15.5px; padding-left: 40px; }
}

/* ============================================================
   고도화 — 미리보기 보안 · 백업 · 포트폴리오 (Phase 1·2·3)
   ============================================================ */
/* 코드 미리보기 보안 경고 / 제어 바 */
.preview-warn { margin: 8px 0; padding: 10px 14px; border-radius: var(--radius-sm); background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; font-size: 13.5px; line-height: 1.55; }
.preview-bar { display: flex; align-items: center; gap: 10px; margin: 8px 0; flex-wrap: wrap; }
.preview-bar #stopPreview { padding: 6px 12px; font-size: 13px; }
.preview-note { font-size: 12.5px; color: var(--muted); }

/* 결과물 저장소 — 백업·포트폴리오 도구 */
.resource-tools { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; }
.resource-tool-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-soft); }
.resource-tool-label { font-size: 12px; font-weight: 800; color: var(--accent-strong); margin-right: 2px; }
.resource-tools button { padding: 7px 12px; font-size: 13px; }

/* 숨겨진 인쇄용 iframe (화면에 보이지 않음) */
#printFrame { position: absolute; width: 0; height: 0; border: 0; visibility: hidden; }

@media (max-width: 760px) {
  .resource-tools { flex-direction: column; gap: 10px; }
  .resource-tool-group { width: 100%; }
}

/* ============================================================
   고도화 — 강의 메타데이터 · 리그 수료 기준 (Phase 4)
   ============================================================ */
.lesson-meta2 { margin: -6px 0 18px; }
.meta-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.meta-badge { display: inline-flex; align-items: center; font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--surface-soft); border: 1px solid var(--line); color: var(--body); }
.meta-badge.muted { color: var(--muted); font-weight: 600; }
.meta-badge.diff-beginner { background: #ecfdf5; border-color: #6ee7b7; color: #047857; }
.meta-badge.diff-intermediate { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
.meta-badge.diff-advanced { background: #fef3c7; border-color: #fcd34d; color: #b45309; }
.completion-req { margin-top: 10px; font-size: 13.5px; }
.completion-req summary { cursor: pointer; font-weight: 700; color: var(--accent-strong); }
.completion-req ul { margin: 8px 0 0; padding-left: 20px; color: var(--body); line-height: 1.6; }

.level-graduation { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-soft); font-size: 13px; }
.grad-dl { margin: 0; display: grid; gap: 8px; }
.grad-dl > div { display: grid; grid-template-columns: 72px 1fr; gap: 8px; }
.grad-dl dt { font-weight: 800; color: var(--accent-strong); font-size: 12px; }
.grad-dl dd { margin: 0; color: var(--body); line-height: 1.5; }
.grad-req { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.grad-req strong { font-size: 12px; color: var(--accent-strong); }
.grad-req ul { margin: 6px 0 0; padding-left: 18px; color: var(--body); line-height: 1.55; }
.grad-req p { margin: 6px 0 0; color: var(--body); line-height: 1.55; }

#teacherModeToggle.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.facilitator-card { margin: 14px 0; padding: 14px 16px; border: 1px solid var(--accent); border-radius: var(--radius-sm); background: var(--surface-soft); font-size: 13.5px; }
.facilitator-card-title { font-weight: 800; color: var(--accent-strong); font-size: 12px; text-transform: uppercase; letter-spacing: .02em; margin-bottom: 6px; }
.facilitator-card p { margin: 4px 0; color: var(--body); line-height: 1.55; }
.facilitator-time { font-weight: 600; }
.facilitator-card details { margin-top: 8px; }
.facilitator-card summary { cursor: pointer; font-weight: 700; color: var(--accent-strong); }
.facilitator-card ul { margin: 6px 0 0; padding-left: 18px; color: var(--body); line-height: 1.6; }
.facilitator-card dl { margin: 6px 0 0; }
.facilitator-card dt { font-weight: 700; margin-top: 6px; }
.facilitator-card dd { margin: 2px 0 0; color: var(--body); line-height: 1.5; }
.facilitator-runplan { padding-left: 0; list-style: none; }
.facilitator-runplan > li { margin-top: 8px; }
.facilitator-runplan ul { padding-left: 16px; font-size: 12.5px; color: var(--muted); }
@media print { .facilitator-card { break-inside: avoid; } }

.submit-qr { display: block; margin-top: 10px; width: 140px; height: 140px; border-radius: var(--radius-sm); border: 1px solid var(--border); }

/* 진행 코드 수합 모드(?mode=collect) */
.collect-view { max-width: 880px; margin: 32px auto; padding: 24px; }
.collect-header h1 { margin: 0 0 6px; font-size: 22px; }
.collect-header p { margin: 0 0 20px; color: var(--muted); font-size: 13.5px; }
.collect-input-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.collect-input-row textarea { flex: 1; min-height: 80px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-family: inherit; font-size: 13.5px; resize: vertical; }
.collect-table-actions { display: flex; gap: 8px; margin-bottom: 14px; }
.collect-table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); overflow: hidden; }
.collect-table th, .collect-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; font-size: 13.5px; }
.collect-table th { background: var(--surface-soft); font-weight: 700; color: var(--muted); }
.collect-empty { color: var(--muted); font-size: 13.5px; padding: 16px 0; text-align: center; }
@media (max-width: 760px) {
  .collect-view { padding: 16px; margin: 12px auto; }
  .collect-input-row { flex-direction: column; }
}

/* 자동 점검 루브릭(build 실습) */
.audit-card { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-soft); }
.audit-card[hidden] { display: none; }
.audit-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.audit-h { font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); }
.audit-grade { font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.audit-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.audit-item { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; line-height: 1.55; color: var(--body); }
.audit-badge { flex: none; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; margin-top: 1px; }
.audit-pass .audit-badge, .audit-grade.audit-pass { background: #dcfce7; color: #166534; }
.audit-caution .audit-badge, .audit-grade.audit-caution { background: #fef9c3; color: #854d0e; }
.audit-danger .audit-badge, .audit-grade.audit-danger { background: #fee2e2; color: #991b1b; }
.audit-foot { margin: 10px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }

/* 현장·일상 프로젝트 아이디어(Phase 5) */
.project-tracks { display: grid; gap: 16px; }
.track-name { margin: 0 0 2px; font-size: 15px; color: var(--accent-strong); }
.track-intro { margin: 0 0 8px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.track-ideas { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.track-idea { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-soft); padding: 10px 12px; }
.track-idea-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.track-idea-head strong { font-size: 14px; }
.track-idea-sum { margin: 4px 0 0; font-size: 13px; color: var(--body); line-height: 1.5; }
.track-idea-use { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.track-league { flex: none; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.track-rookie { background: #dcfce7; color: #166534; }
.track-pro { background: #dbeafe; color: #1d4ed8; }
.track-master { background: #f3e8ff; color: #6b21a8; }

/* 집중 모드 — 접이식 보조 섹션(읽고 이해하기·용어 사전·생각해보기) */
.lesson-collapse[hidden] { display: none; }
.lesson-collapse > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.lesson-collapse > summary::-webkit-details-marker { display: none; }
.lesson-collapse > summary > h3 { margin-bottom: 0; }
.lesson-collapse > summary::after {
  content: ""; margin-left: auto; flex: none;
  width: 8px; height: 8px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .2s;
}
.lesson-collapse[open] > summary::after { transform: rotate(-135deg); }
.lesson-collapse[open] > summary { margin-bottom: 14px; }
.lesson-collapse > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

/* 동작 줄임 선호 — 전환·애니메이션을 최소화한다 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
