/* 초등 교과 영문법 158유닛 학습 화면 — K웹툰(만화 패널) 디자인 시스템.
   사이트 전역 kwebtoon.css(--kw-ink/--kw-green/--kw-gold 등)와 같은 팔레트·굵은 잉크선·
   하드 오프셋 그림자를 이 :root 토큰에 그대로 옮겨 쓴다. middle/high-school-grammar.css가
   이 파일을 @import 하고 --accent* 만 재정의하는 구조라, 여기 한 번만 고치면 3단계
   전부에 만화 패널 톤이 그대로 퍼진다(26.09.13 K웹툰 UI/UX 전면 개편). */

/* ── Design Tokens ── */
:root {
  color-scheme: light;

  /* Typography */
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", sans-serif;
  font-size: clamp(16px, 1.1vw, 18px);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  /* Color: Elementary (K웹툰 Green) */
  --accent:       #34c759;
  --accent-mid:   #28a745;
  --accent-deep:  #1a7a32;
  --accent-soft:  #f0fdf4;
  --accent-line:  rgba(52, 199, 89, 0.25);

  /* Neutral palette — kwebtoon.css --kw-* 와 같은 잉크/종이 톤 */
  --ink:          #17322f;   /* = --kw-ink */
  --ink-2:        #285d50;   /* = --kw-green */
  --ink-3:        #5c7a71;   /* = --kw-muted */
  --muted:        #5c7a71;
  --line:         #17322f;   /* 굵은 잉크선 — 테두리에 그대로 쓴다 */
  --line-2:       #285d50;
  --paper:        #f7f3e9;   /* = --kw-paper */
  --surface:      #fffdf7;
  --soft:         #f0ece0;
  --lift:         #f7f3e9;

  /* Semantic (정오답 피드백은 의미가 있어 색만 유지, 톤은 코랄/골드로 정렬) */
  --blue:         #2f6fed;
  --blue-soft:    #eaf2ff;
  --red:          #ec7c68;   /* = --kw-coral */
  --red-soft:     #fdeeea;
  --green-ok:     #1a7a32;
  --green-soft:   #f0fdf4;
  --amber:        #f0c869;   /* = --kw-gold */

  /* Shadows — 만화 패널의 하드 오프셋 그림자(블러 대신 딱 떨어지는 잉크색 그림자) */
  --sh-xs: 2px 2px 0 var(--ink);
  --sh-sm: 3px 3px 0 var(--ink);
  --sh-md: 5px 5px 0 var(--ink);
  --sh-lg: 7px 7px 0 var(--ink);

  /* Radii */
  --r-xs:   8px;
  --r-sm:   12px;
  --r-md:   16px;
  --r-lg:   20px;
  --r-pill: 999px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
}

button, select, input, textarea { font: inherit; }

/* ════════════════════════════════════════
   TOPBAR
════════════════════════════════════════ */
.esg-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 52px;
  padding: 0 clamp(16px, 4vw, 48px);
  border-bottom: 3px solid var(--ink);
  background: rgba(255, 253, 247, 0.92);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.esg-brand { display: flex; flex-direction: column; }
.esg-brand strong {
  font-size: clamp(15px, 1.1vw, 17px);
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--ink);
}
.esg-brand span,
.esg-muted,
.esg-stat span,
.esg-small { color: var(--muted); font-size: clamp(12px, 0.85vw, 14px); }

.esg-top-actions,
.esg-stage-row,
.esg-chip-row,
.esg-button-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* ════════════════════════════════════════
   BASE INTERACTIVE ELEMENTS
════════════════════════════════════════ */
.esg-link,
.esg-btn,
.esg-stage-btn,
.esg-unit-btn,
.esg-choice,
.esg-token,
.esg-mini-btn,
.esg-select {
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

/* 만화 패널 느낌의 눌림 그림자 — 주요 버튼류만(사이드바 유닛 리스트는 제외) */
.esg-btn,
.esg-choice,
.esg-mini-btn {
  box-shadow: var(--sh-xs);
}
.esg-btn:active,
.esg-choice:active,
.esg-mini-btn:active {
  box-shadow: none;
  transform: translate(2px, 2px);
}

.esg-link,
.esg-btn,
.esg-stage-btn,
.esg-choice,
.esg-token,
.esg-mini-btn {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 7px 16px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
  font-size: clamp(14px, 1vw, 16px);
}

.esg-link:hover,
.esg-btn:hover,
.esg-stage-btn:hover { background: var(--soft); border-color: var(--line-2); }

.esg-stage-btn:active { transform: scale(0.97); }

.esg-select {
  min-height: 40px;
  padding: 7px 12px;
  font-size: clamp(14px, 1vw, 16px);
  cursor: pointer;
}

/* ════════════════════════════════════════
   HERO SECTION
════════════════════════════════════════ */
.esg-hero {
  padding: 28px clamp(16px, 5vw, 56px) 20px;
}

.esg-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(240px, 0.65fr);
  gap: 16px;
  margin-bottom: 16px;
}

.esg-panel {
  border: 3px solid var(--ink);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-md);
}

.esg-title-panel {
  position: relative;
  padding: clamp(22px, 3.5vw, 36px);
  padding-right: clamp(22px, 3.5vw, 36px);
}

/* K웹툰 캐릭터(Navi) 배지 — 순수 CSS 장식이라 기존 JS 렌더링 구조를 건드리지 않는다.
   좁은 화면에서는 문법 카피와 겹쳐 가독성이 떨어져서 뺀다. */
.esg-title-panel::after {
  content: "";
  position: absolute;
  right: clamp(14px, 2.6vw, 30px);
  bottom: clamp(14px, 2.2vw, 26px);
  width: clamp(64px, 7vw, 104px);
  height: clamp(64px, 7vw, 104px);
  background: url("/assets/kwebtoon/sprites/navi/idle.webp") center/contain no-repeat;
  filter: drop-shadow(3px 3px 0 var(--ink));
  pointer-events: none;
}
@media (max-width: 720px) {
  .esg-title-panel::after { display: none; }
}

.esg-kicker {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--accent-deep);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.esg-title-panel h1 {
  font-size: clamp(26px, 4vw, 46px);
  font-weight: 800;
  line-height: 1.07;
  letter-spacing: -0.5px;
  color: var(--ink);
  margin-bottom: 14px;
}

.esg-title-panel p {
  color: var(--ink-2);
  font-size: clamp(15px, 1.1vw, 17px);
  line-height: 1.78;
  max-width: 660px;
}

.esg-stage-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.esg-stage-btn {
  flex: 1 1 150px;
  flex-direction: column;
  align-items: flex-start;
  min-height: 56px;
  padding: 10px 14px;
  gap: 2px;
}

.esg-stage-btn strong { font-size: clamp(14px, 1vw, 16px); font-weight: 700; }
.esg-stage-btn span   { font-size: clamp(11px, 0.8vw, 13px); color: var(--muted); margin-top: 2px; }

.esg-stage-btn.is-active {
  border-color: var(--accent-mid);
  background: var(--accent-soft);
  color: var(--accent-deep);
}
.esg-stage-btn.is-active span { color: var(--accent-mid); }

/* .esg-stage-btn span, .esg-stage-btn.is-active span 보다 명시성을 일부러 더 높게 잡았다 —
   안 그러면 추천 배지가 active 스테이지에서 배경·글자색이 카드와 같아져 안 보인다
   (Playwright 스크린샷으로 실측, 대비 2.99:1로 WCAG AA 미달이었다). */
.esg-stage-btn .esg-stage-recommend,
.esg-stage-btn.is-active .esg-stage-recommend {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-mid);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}

/* Stats panel */
.esg-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border-radius: var(--r-lg);
  border: 3px solid var(--ink);
  box-shadow: var(--sh-md);
  background: var(--surface);
}

.esg-stat {
  padding: 20px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
.esg-stat:nth-child(2n) { border-right: none; }
.esg-stat:nth-child(3),
.esg-stat:nth-child(4) { border-bottom: none; }

.esg-stat span { font-size: clamp(12px, 0.85vw, 14px); color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.4px; }
.esg-stat strong { display: block; margin-top: 6px; font-size: clamp(22px, 2vw, 28px); font-weight: 700; letter-spacing: -0.5px; }

/* Method cards */
.esg-method-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 0;
}

.esg-method {
  padding: 18px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--sh-sm);
  border: 2px solid var(--ink);
}
.esg-method strong {
  display: block;
  margin-bottom: 7px;
  font-size: clamp(13px, 0.95vw, 15px);
  font-weight: 700;
  color: var(--accent-deep);
}
.esg-method span {
  display: block;
  font-size: clamp(13px, 0.9vw, 15px);
  line-height: 1.65;
  color: var(--ink-2);
}

/* ════════════════════════════════════════
   MAIN STUDY LAYOUT
════════════════════════════════════════ */
.esg-wrap {
  padding: 0 clamp(16px, 5vw, 56px) 56px;
}

.esg-study {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  border-radius: var(--r-lg);
  border: 3px solid var(--ink);
  background: var(--surface);
  box-shadow: var(--sh-lg);
  overflow: hidden;
}

/* ── Sidebar — Table of Contents ── */
.esg-sidebar {
  position: sticky;
  top: 60px;
  max-height: calc(100vh - 72px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 10px 18px 14px;
  background: #fafafa;
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}

.esg-sidebar::-webkit-scrollbar { width: 4px; }
.esg-sidebar::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }

.esg-filter {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.esg-unit-list { display: grid; gap: 2px; }

.esg-unit-btn {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 8px 8px;
  cursor: pointer;
  text-align: left;
  border: none;
  border-radius: var(--r-xs);
  background: transparent;
  min-height: unset;
}

.esg-unit-btn:hover { background: var(--line); border-color: transparent; }
.esg-unit-btn.is-active { background: var(--accent-soft); border-color: transparent; }

.esg-unit-btn b {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--line);
  color: var(--muted);
  font-size: clamp(11px, 0.8vw, 13px);
  font-weight: 700;
  flex-shrink: 0;
}
.esg-unit-btn.is-active b { background: var(--accent); color: #fff; }

.esg-unit-btn span {
  display: block;
  font-size: clamp(14px, 1vw, 15px);
  font-weight: 600;
  overflow-wrap: anywhere;
  color: var(--ink);
}
.esg-unit-btn.is-active span { color: var(--accent-deep); }

.esg-unit-btn small {
  display: block;
  font-size: clamp(12px, 0.85vw, 13px);
  font-weight: 400;
  line-height: 1.3;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.esg-progress-mark { color: var(--accent-mid); font-weight: 700; }

/* ── Content page ── */
.esg-page {
  min-width: 0;
  padding: clamp(20px, 3.5vw, 36px);
  background: var(--lift);
}

.esg-page-card {
  padding: clamp(22px, 3.5vw, 38px);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--sh-sm);
  border: 2.5px solid var(--ink);
}

/* ── Lesson header ── */
.esg-lesson-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.esg-lesson-head h2 {
  font-size: clamp(24px, 3.5vw, 38px);
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1.15;
  margin-top: 8px;
}

/* ── Pills & Chips ── */
.esg-pill,
.esg-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 13px;
  border-radius: var(--r-pill);
  font-size: clamp(12px, 0.85vw, 13px);
  font-weight: 700;
  letter-spacing: 0.2px;
}
.esg-pill {
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-deep);
}
.esg-chip {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

/* ── Pattern block ── */
.esg-pattern {
  position: relative;
  margin: 24px 0;
  padding: 20px 24px 20px 78px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--accent-soft) 0%, #dcfce7 100%);
  border: 2px solid var(--accent-line);
}

/* 이중부호화(Paivio 1971) — 문법 패턴을 항상 같은 캐릭터(Navi)가 "말하는" 것처럼 옆에
   붙여, 언어 정보와 시각 정보 두 경로로 함께 부호화되게 한다(영문법 인지과학 혁신교수법
   하네스 principle:pair-scene-with-example, gap:no-scene-example-pairing 해소). 정답/오답에
   따라 포즈가 바뀌는 실제 <img>(.esg-pattern-avatar)라 JS(patternAvatarPose())가 src를
   제어한다 — 이전의 순수 CSS ::before 정적 버전에서 상호작용형으로 업그레이드했다. */
.esg-pattern-avatar {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #fffdf7;
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  object-fit: contain;
  object-position: center;
  padding: 6px;
  transition: transform .15s ease;
}
.esg-pattern-avatar.is-correct { animation: esg-avatar-pop .35s ease; }
@keyframes esg-avatar-pop { 0%{transform:translateY(-50%) scale(1)} 45%{transform:translateY(-50%) scale(1.18)} 100%{transform:translateY(-50%) scale(1)} }
@media (max-width: 520px) {
  .esg-pattern { padding-left: 24px; }
  .esg-pattern-avatar { display: none; }
}

.esg-pattern strong {
  display: block;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", "Courier New", monospace;
  font-size: clamp(20px, 3.2vw, 34px);
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
  color: var(--accent-deep);
  letter-spacing: -0.3px;
}

.esg-pattern span {
  display: block;
  margin-top: 8px;
  font-size: clamp(14px, 1vw, 16px);
  color: var(--ink-3);
}

/* ════════════════════════════════════════
   MODE TABS — Segmented Control (iOS style)
════════════════════════════════════════ */
.esg-mode-tabs {
  display: flex;
  align-items: center;
  gap: 3px;
  margin: 24px 0 20px;
  padding: 3px;
  border-radius: var(--r-sm);
  background: var(--paper);
  border: none;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.esg-mode-tabs::-webkit-scrollbar { display: none; }

.esg-mode-btn {
  flex: 1;
  min-width: 72px;
  min-height: 36px;
  padding: 6px 14px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: clamp(13px, 0.95vw, 15px);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.esg-mode-btn:hover {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  border-color: transparent;
}

.esg-mode-btn.is-active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0,0,0,0.10), 0 0 0 0.5px rgba(0,0,0,0.05);
  border-color: transparent;
}

/* ════════════════════════════════════════
   CONTENT GRIDS & CARDS
════════════════════════════════════════ */
.esg-content-grid,
.esg-drill-grid,
.esg-bank-grid {
  display: grid;
  gap: 14px;
}
.esg-content-grid { grid-template-columns: minmax(0, 1fr) minmax(260px, 0.82fr); }

.esg-card {
  padding: 20px 22px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--sh-sm);
  border: 2px solid var(--ink);
}
.esg-card h3 {
  font-size: clamp(16px, 1.2vw, 18px);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 12px;
  letter-spacing: -0.2px;
}
.esg-card p { font-size: clamp(15px, 1.1vw, 17px); line-height: 1.8; color: var(--ink-2); }

/* ── Example sentences ── */
.esg-examples {
  display: grid;
  gap: 8px;
  list-style: none;
}
.esg-examples li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-radius: var(--r-sm);
  background: var(--lift);
  font-size: clamp(15px, 1.15vw, 17px);
  font-weight: 500;
  color: var(--ink-2);
  border: 1px solid var(--line);
  line-height: 1.6;
}

/* ── Feedback blocks ── */
.esg-wrong,
.esg-right,
.esg-feedback,
.esg-answer-line {
  display: block;
  padding: 13px 18px;
  border-radius: var(--r-sm);
  overflow-wrap: anywhere;
  font-size: clamp(15px, 1.15vw, 17px);
}

.esg-wrong {
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid rgba(255, 59, 48, 0.15);
  font-weight: 500;
}
.esg-right {
  margin-top: 10px;
  color: var(--green-ok);
  background: var(--green-soft);
  border: 1px solid rgba(22, 101, 52, 0.15);
  font-weight: 600;
}
.esg-feedback {
  margin-top: 12px;
  color: var(--blue);
  background: var(--blue-soft);
  font-weight: 700;
  border: 1px solid rgba(0, 122, 255, 0.15);
}
.esg-feedback.is-wrong {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(255, 59, 48, 0.15);
}

/* ── Quiz sentence & answer line ── */
.esg-quiz-sentence,
.esg-answer-line {
  margin-bottom: 16px;
  background: var(--lift);
  border: 1.5px solid var(--line);
  font-size: clamp(19px, 2vw, 24px);
  font-weight: 500;
  line-height: 1.65;
  letter-spacing: -0.2px;
  color: var(--ink);
}

/* ── Choice grid ── */
.esg-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.esg-choice {
  text-align: left;
  font-weight: 600;
  font-size: clamp(15px, 1.1vw, 17px);
  padding: 13px 18px;
  border-radius: var(--r-sm);
  min-height: 48px;
  cursor: pointer;
  border: 1.5px solid var(--line);
}
.esg-choice:hover {
  border-color: var(--accent-mid);
  background: var(--accent-soft);
}
.esg-choice.is-correct {
  border-color: #16a34a;
  background: var(--green-soft);
  color: var(--green-ok);
}
.esg-choice.is-wrong {
  border-color: var(--red);
  background: var(--red-soft);
  color: var(--red);
}

/* ── Word tokens ── */
.esg-token-bank,
.esg-answer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.esg-token {
  padding: 9px 20px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1.5px solid var(--line-2);
  font-size: clamp(15px, 1.1vw, 17px);
  font-weight: 600;
  box-shadow: var(--sh-xs);
  cursor: pointer;
  min-height: unset;
}
.esg-token:hover {
  border-color: var(--accent-mid);
  background: var(--accent-soft);
  transform: translateY(-1px);
  box-shadow: var(--sh-sm);
}
.esg-token.is-used {
  opacity: 0.28;
  pointer-events: none;
  transform: none;
}

/* ════════════════════════════════════════
   QUESTION BANK
════════════════════════════════════════ */
.esg-bank-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.esg-bank-panel { display: grid; gap: 20px; }

.esg-bank-head { display: grid; gap: 12px; }

.esg-bank-menu { display: flex; flex-wrap: wrap; gap: 6px; }

.esg-bank-size {
  min-height: 32px;
  padding: 0 14px;
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: clamp(12px, 0.85vw, 14px);
  font-weight: 700;
  transition: all 0.15s ease;
}
.esg-bank-size:hover {
  border-color: var(--accent-mid);
  color: var(--accent-deep);
  background: var(--accent-soft);
}
.esg-bank-size.is-active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.esg-bank-item {
  padding: 16px 18px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--sh-sm);
  border: none;
  transition: box-shadow 0.15s ease, transform 0.1s ease;
}
.esg-bank-item:hover {
  box-shadow: var(--sh-md);
  transform: translateY(-1px);
}

.esg-bank-item strong {
  display: block;
  margin-bottom: 10px;
  font-size: clamp(12px, 0.85vw, 13px);
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.esg-bank-item span {
  display: block;
  font-size: clamp(14px, 1vw, 16px);
  line-height: 1.65;
  color: var(--ink-2);
}

.esg-bank-item small {
  display: block;
  margin-top: 8px;
  font-size: clamp(13px, 0.9vw, 14px);
  font-style: normal;
  line-height: 1.5;
  color: var(--muted);
}

.esg-bank-item em {
  display: block;
  margin-top: 6px;
  font-size: clamp(13px, 0.9vw, 14px);
  font-style: normal;
  font-weight: 700;
  color: var(--accent-deep);
}

.esg-bank-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.esg-bank-answer {
  width: 100%;
  min-height: 72px;
  margin-top: 12px;
  padding: 10px 14px;
  resize: vertical;
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 15px;
  line-height: 1.5;
}
.esg-bank-answer:focus {
  border-color: var(--blue);
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.12);
}

.esg-answer-toggle { margin-top: 10px; }

/* ── Color-coded grammar reading ── */
.esg-color-text {
  display: inline;
  line-height: 1.9;
}

.esg-word-tone {
  display: inline;
  padding: 0 2px;
  border-radius: 5px;
  border: 0;
  color: var(--ink);
  font-weight: 800;
  white-space: normal;
}

.tone-verb { background: #dbeafe; color: #1d4ed8; }
.tone-prep { background: #dcfce7; color: #166534; }
.tone-link { background: #fef3c7; color: #92400e; }
.tone-noun { background: #fce7f3; color: #9d174d; }
.tone-form { background: #ede9fe; color: #5b21b6; }
.tone-base { background: transparent; color: #334155; }

.esg-bank-item .esg-word-tone,
.esg-quiz-sentence .esg-word-tone,
.esg-answer-line .esg-word-tone,
.nlp-chunk-text .esg-word-tone {
  display: inline;
}

.esg-bank-item .esg-color-text,
.esg-quiz-sentence .esg-color-text,
.esg-answer-line .esg-color-text {
  display: inline;
}

/* ── NLP chunk questions ── */
.esg-nlp-bank {
  gap: 18px;
}

.esg-nlp-score {
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: #eef6ff;
  color: #075985;
  font-weight: 800;
}

.esg-nlp-bank-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.esg-nlp-q-card {
  padding: 16px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--sh-sm);
}

.esg-nlp-q-head,
.esg-nlp-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.esg-nlp-q-no {
  font-weight: 900;
  color: var(--accent-deep);
}

.esg-nlp-q-result {
  color: var(--muted);
  font-weight: 800;
}

.esg-nlp-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin: 12px 0;
}

.nlp-chunk {
  display: inline-grid;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid #e2e8f0;
  background: #fff;
}

.nlp-chunk-label {
  font-size: 11px;
  font-weight: 900;
  color: #475569;
}

.nlp-chunk-target {
  outline: 3px solid rgba(37, 99, 235, 0.18);
}

.nlp-q-mark {
  color: #dc2626;
}

.nlp-chunk-S { background: #ecfdf5; border-color: #86efac; }
.nlp-chunk-V { background: #eff6ff; border-color: #93c5fd; }
.nlp-chunk-O { background: #fff7ed; border-color: #fdba74; }
.nlp-chunk-SC { background: #f5f3ff; border-color: #c4b5fd; }
.nlp-chunk-OC { background: #fdf2f8; border-color: #f9a8d4; }
.nlp-chunk-M { background: #f0fdfa; border-color: #5eead4; }
.nlp-chunk-PP { background: #f0fdf4; border-color: #bbf7d0; }
.nlp-chunk-CONJ { background: #fefce8; border-color: #fde047; }
.nlp-chunk-plain { background: #f8fafc; }

.nlp-slash {
  color: #94a3b8;
  font-weight: 900;
}

.esg-nlp-q-prompt {
  margin: 0 0 10px;
  color: var(--ink-2);
  font-weight: 800;
}

.esg-nlp-opt {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}

.nlp-opt-correct,
.nlp-q-correct .esg-nlp-q-result {
  color: #047857;
}

.nlp-opt-wrong,
.nlp-q-wrong .esg-nlp-q-result {
  color: #b91c1c;
}

/* ── Fix card (inside render) ── */
.esg-mini-btn {
  min-height: 36px;
  padding: 6px 14px;
  font-size: clamp(13px, 0.95vw, 15px);
  font-weight: 600;
  border-radius: var(--r-sm);
}

/* ── XP stat badge ── */
.esg-progress-mark { color: var(--amber); font-weight: 900; }

/* ════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */
@media (max-width: 1100px) {
  .esg-hero-grid,
  .esg-content-grid { grid-template-columns: 1fr; }

  .esg-method-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .esg-study { grid-template-columns: 1fr; }

  .esg-sidebar {
    position: static;
    max-height: 280px;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 14px;
  }

  .esg-unit-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .esg-bank-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .esg-nlp-bank-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .esg-topbar { gap: 10px; }

  .esg-top-actions,
  .esg-lesson-head { flex-direction: column; align-items: stretch; }

  .esg-link,
  .esg-btn,
  .esg-stage-btn { width: 100%; justify-content: center; }

  .esg-stats,
  .esg-unit-list,
  .esg-choice-grid { grid-template-columns: 1fr; }

  .esg-bank-grid { grid-template-columns: 1fr; }

  .esg-method-grid { grid-template-columns: 1fr; }

  .esg-mode-btn { flex: 1 1 100px; }
}

/* 스테이지 완주 배지 오버레이 — 영문법 10년 365일 과정 설계 Phase 4 완주 배지(26.09.13) */
.esg-stage-complete-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(23, 50, 47, 0.55);
}
.esg-stage-complete-card {
  max-width: min(360px, 100%);
  padding: 28px 24px;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-md);
  text-align: center;
}
.esg-stage-complete-badge { width: 160px; height: 160px; object-fit: contain; margin-bottom: 8px; }
.esg-stage-complete-card h3 { margin: 4px 0; font-size: 20px; }
.esg-stage-complete-card p { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
