/* ============================================================
   R.E.A.D. 탐구 플랫폼 — Global Stylesheet
   ============================================================ */

/* ── Google Fonts (fallback to system fonts if offline) ── */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Custom Properties ── */
:root {
  /* Stage Colors */
  --stage-DIAG: #0EA5E9;
  --stage-DIAG-bg: #F0F9FF;
  --stage-DIAG-light: #BAE6FD;
  --stage-PRE: #0284C7;
  --stage-PRE-bg: #E0F2FE;
  --stage-PRE-light: #BAE6FD;
  --stage-R: #EF4444;
  --stage-R-bg: #FEF2F2;
  --stage-R-light: #FECACA;
  --stage-E: #F59E0B;
  --stage-E-bg: #FFFBEB;
  --stage-E-light: #FDE68A;
  --stage-A: #22C55E;
  --stage-A-bg: #F0FDF4;
  --stage-A-light: #BBF7D0;
  --stage-D: #A855F7;
  --stage-D-bg: #FAF5FF;
  --stage-D-light: #E9D5FF;

  /* Level Colors */
  --level-1-color: #7DD3FC;
  --level-1-bg:    #EFF6FF;
  --level-2-color: #60A5FA;
  --level-2-bg:    #DBEAFE;
  --level-3-color: #3B82F6;
  --level-3-bg:    #BFDBFE;
  --level-4-color: #2563EB;
  --level-4-bg:    #93C5FD;
  --level-5-color: #1D4ED8;
  --level-5-bg:    #60A5FA;

  /* Neutral Palette */
  --gray-50:  #F8FAFC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-300: #CBD5E1;
  --gray-400: #94A3B8;
  --gray-500: #64748B;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1E293B;
  --gray-900: #0F172A;

  /* Primary (Indigo) */
  --primary:       #4F46E5;
  --primary-light: #818CF8;
  --primary-dark:  #3730A3;
  --primary-bg:    #EEF2FF;

  /* Layout */
  --sidebar-w:  260px;
  --header-h:   68px;
  --radius-sm:  6px;
  --radius:     12px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow:    0 4px 12px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.14), 0 4px 10px rgba(0,0,0,.08);
  --shadow-xl: 0 20px 50px rgba(0,0,0,.18);

  /* Transitions */
  --transition: all .18s ease;
  --transition-slow: all .35s ease;

  /* Font */
  --font: 'Noto Sans KR', 'Apple SD Gothic Neo', '맑은 고딕', -apple-system, sans-serif;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-size: 0.9375rem;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

button { cursor: pointer; font-family: var(--font); }
input, textarea, select { font-family: var(--font); }

h1, h2, h3, h4 { line-height: 1.3; font-weight: 700; }
p { line-height: 1.7; }

/* ── Utility Classes ── */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.text-sm { font-size: 0.8125rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.0625rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-muted { color: var(--gray-500); }
.text-center { text-align: center; }
.w-full { width: 100%; }
.rounded { border-radius: var(--radius); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Card ── */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}

.card--elevated {
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.card--elevated:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body { padding: 1.5rem; }
.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
}

.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:active { transform: translateY(0); filter: brightness(0.96); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-secondary:hover { background: var(--gray-200); }

.btn-success { background: #22C55E; color: #fff; }
.btn-success:hover { background: #16A34A; }

.btn-warning { background: var(--stage-E); color: #fff; }
.btn-danger { background: var(--stage-R); color: #fff; }
.btn-purple { background: var(--stage-D); color: #fff; }

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover { background: var(--primary-bg); }

.btn-sm { padding: 0.35rem 0.85rem; font-size: 0.8125rem; }
.btn-lg { padding: 0.75rem 1.75rem; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── Stage Pill / Badge ── */
.stage-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: .03em;
}
.stage-pill[data-stage="PRE"] { background: var(--stage-PRE-bg); color: var(--stage-PRE); border: 1.5px solid var(--stage-PRE-light); }
.stage-pill[data-stage="R"] { background: var(--stage-R-bg); color: var(--stage-R); border: 1.5px solid var(--stage-R-light); }
.stage-pill[data-stage="E"] { background: var(--stage-E-bg); color: var(--stage-E); border: 1.5px solid var(--stage-E-light); }
.stage-pill[data-stage="A"] { background: var(--stage-A-bg); color: var(--stage-A); border: 1.5px solid var(--stage-A-light); }
.stage-pill[data-stage="D"] { background: var(--stage-D-bg); color: var(--stage-D); border: 1.5px solid var(--stage-D-light); }

/* ── Level Badge ── */
.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
}
.level-badge[data-level="1"] { background: var(--level-1-color); }
.level-badge[data-level="2"] { background: var(--level-2-color); }
.level-badge[data-level="3"] { background: var(--level-3-color); }
.level-badge[data-level="4"] { background: var(--level-4-color); }
.level-badge[data-level="5"] { background: var(--level-5-color); }

/* ── Forms ── */
.form-group { margin-bottom: 1.1rem; }
.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  padding: 0.6rem 0.9rem;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: var(--font);
  color: var(--gray-800);
  background: #fff;
  transition: var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

textarea.form-control { resize: vertical; min-height: 100px; }
.bg-text-input {
  width: 100%;
  min-height: 120px;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font);
  color: var(--gray-800);
  background: #fff;
  resize: vertical;
  box-sizing: border-box;
  transition: var(--transition);
  line-height: 1.7;
}
.bg-text-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.bg-text-input:disabled { background: var(--gray-50); color: var(--gray-500); }

.form-hint { font-size: 0.75rem; color: var(--gray-400); margin-top: 0.25rem; }
.form-error { font-size: 0.75rem; color: var(--stage-R); margin-top: 0.25rem; font-weight: 500; }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748B' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.55);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(2px);
  animation: fadeIn .15s ease;
}

.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp .2s ease;
}

.modal--md { max-width: 520px; }
.modal--lg { max-width: 780px; }
.modal--xl { max-width: 1000px; }

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.modal-close {
  background: var(--gray-100);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--gray-500);
  transition: var(--transition);
}
.modal-close:hover { background: var(--gray-200); color: var(--gray-800); }
.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ── Toast Notifications ── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 260px;
  max-width: 380px;
  animation: slideRight .25s ease;
  font-size: 0.875rem;
  font-weight: 500;
}
.toast--success { background: #F0FDF4; color: #166534; border: 1.5px solid #BBF7D0; }
.toast--error   { background: #FEF2F2; color: #991B1B; border: 1.5px solid #FECACA; }
.toast--info    { background: #EFF6FF; color: #1E40AF; border: 1.5px solid #BFDBFE; }
.toast--warning { background: #FFFBEB; color: #92400E; border: 1.5px solid #FDE68A; }
.toast-icon { font-size: 1rem; }

@keyframes slideRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ── Tables ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--gray-200); }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--gray-50); }
th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-500);
  white-space: nowrap;
}
td {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  border-top: 1px solid var(--gray-100);
  vertical-align: middle;
}
tr:hover td { background: var(--gray-50); }

/* ── Chips ── */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.chip-book-wonder      { background: #FEF3C7; color: #92400E; }
.chip-book-invisible   { background: #F0FDF4; color: #166534; }
.chip-status-draft     { background: var(--gray-100); color: var(--gray-600); }
.chip-status-submitted { background: #EFF6FF; color: #1E40AF; }
.chip-status-reviewed  { background: #F0FDF4; color: #166534; }

/* ── Progress Bar (R.E.A.D.) ── */
.read-progress {
  display: flex;
  align-items: center;
  gap: 0;
}

.read-step {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 0;
  border: 1.5px solid var(--gray-200);
  margin-left: -1px;
  background: #fff;
  color: var(--gray-400);
  transition: var(--transition);
  cursor: default;
  position: relative;
}

.read-step:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.read-step:last-child  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.read-step.completed[data-stage="PRE"] { background: var(--stage-PRE-bg); color: var(--stage-PRE); border-color: var(--stage-PRE); }
.read-step.active[data-stage="PRE"]    { background: var(--stage-PRE); color: #fff; border-color: var(--stage-PRE); }
.read-step.completed[data-stage="R"] { background: var(--stage-R-bg); color: var(--stage-R); border-color: var(--stage-R); }
.read-step.active[data-stage="R"]    { background: var(--stage-R); color: #fff; border-color: var(--stage-R); }
.read-step.completed[data-stage="E"] { background: var(--stage-E-bg); color: var(--stage-E); border-color: var(--stage-E); }
.read-step.active[data-stage="E"]    { background: var(--stage-E); color: #fff; border-color: var(--stage-E); }
.read-step.completed[data-stage="A"] { background: var(--stage-A-bg); color: var(--stage-A); border-color: var(--stage-A); }
.read-step.active[data-stage="A"]    { background: var(--stage-A); color: #fff; border-color: var(--stage-A); }
.read-step.completed[data-stage="D"] { background: var(--stage-D-bg); color: var(--stage-D); border-color: var(--stage-D); }
.read-step.active[data-stage="D"]    { background: var(--stage-D); color: #fff; border-color: var(--stage-D); }

.read-step .lock-icon { font-size: 0.7rem; }

/* ── Activity Components ── */

/* T-Chart */
.activity-tchart {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1rem 0;
}
.tchart-col { border: 2px solid var(--gray-200); border-radius: var(--radius); overflow: hidden; }
.tchart-col-header {
  padding: 0.6rem 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  background: var(--gray-100);
  border-bottom: 2px solid var(--gray-200);
}
.tchart-col-body {
  padding: 0.75rem;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.tchart-item {
  padding: 0.4rem 0.7rem;
  background: var(--primary-bg);
  border-radius: var(--radius-sm);
  font-size: 0.825rem;
  border: 1.5px solid transparent;
  cursor: grab;
  user-select: none;
  transition: var(--transition);
}
.tchart-item:hover { border-color: var(--primary-light); }
.tchart-item.dragging { opacity: 0.5; }
.tchart-drop-zone {
  min-height: 80px;
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  transition: var(--transition);
}
.tchart-drop-zone.drag-over { border-color: var(--primary); background: var(--primary-bg); }

.word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.word-chip {
  padding: 0.3rem 0.75rem;
  background: #fff;
  border: 1.5px solid var(--primary-light);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary-dark);
  cursor: grab;
  user-select: none;
  transition: var(--transition);
}
.word-chip:hover { background: var(--primary-bg); }
.word-chip.used { opacity: 0.35; cursor: default; }

/* Cloze / Fill-in-the-blank */
.cloze-sentence {
  line-height: 2.4;
  font-size: 0.9375rem;
  margin-bottom: 0.5rem;
}
.cloze-blank {
  display: inline-block;
  min-width: 90px;
  border-bottom: 2px solid var(--primary);
  margin: 0 0.2rem;
  padding: 0.1rem 0.3rem;
  background: var(--primary-bg);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: 0.875rem;
  outline: none;
  transition: var(--transition);
}
.cloze-blank:focus { border-color: var(--stage-D); box-shadow: 0 2px 0 var(--stage-D); }

/* Perspective Circle */
.perspective-circle {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1rem 0;
}
.perspective-card {
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}
.perspective-card-header {
  padding: 0.6rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.825rem;
  background: var(--gray-50);
  border-bottom: 2px solid var(--gray-200);
}
.perspective-card-body {
  padding: 0.75rem;
}
.perspective-card-body textarea {
  width: 100%;
  min-height: 90px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  font-size: 0.8rem;
  font-family: var(--font);
  resize: vertical;
}
.perspective-card-body textarea:focus {
  outline: none;
  border-color: var(--primary);
}

/* Free Write */
.freewrite-area {
  position: relative;
}
.freewrite-area textarea {
  width: 100%;
  min-height: 150px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 1rem;
  font-size: 0.9rem;
  font-family: var(--font);
  resize: vertical;
  transition: var(--transition);
  line-height: 1.8;
}
.freewrite-area textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.word-count {
  text-align: right;
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 0.3rem;
}
.word-count.warn { color: var(--stage-E); }
.word-count.good { color: var(--stage-A); }

/* 3-2-1 Journal */
.journal-321 { display: flex; flex-direction: column; gap: 0.75rem; }
.journal-section {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1.5px solid var(--gray-200);
}
.journal-section-header {
  padding: 0.55rem 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.journal-section:nth-child(1) .journal-section-header { background: #FEF2F2; color: var(--stage-R); }
.journal-section:nth-child(2) .journal-section-header { background: var(--stage-E-bg); color: var(--stage-E); }
.journal-section:nth-child(3) .journal-section-header { background: var(--stage-A-bg); color: #166534; }
.journal-section textarea {
  width: 100%;
  border: none;
  padding: 0.75rem 1rem;
  font-family: var(--font);
  font-size: 0.875rem;
  resize: vertical;
  min-height: 72px;
}
.journal-section textarea:focus { outline: none; background: #FAFAFA; }

/* Sentence Starters Box */
.starters-box {
  background: var(--stage-E-bg);
  border: 1.5px solid var(--stage-E-light);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.starters-box h5 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--stage-E);
  margin-bottom: 0.5rem;
}
.starters-box ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.starters-box li {
  font-size: 0.8125rem;
  color: var(--gray-700);
  padding: 0.25rem 0.5rem;
  background: rgba(255,255,255,.7);
  border-radius: var(--radius-sm);
  font-style: italic;
}

/* Passage Box */
.passage-box {
  background: linear-gradient(135deg, #FAFAFA 0%, #F8FAFF 100%);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  position: relative;
}
.passage-box::before {
  content: '"';
  position: absolute;
  top: -0.5rem;
  left: 1rem;
  font-size: 3rem;
  color: var(--primary-light);
  line-height: 1;
  font-family: Georgia, serif;
}
.passage-box p {
  font-size: 0.9rem;
  line-height: 1.85;
  color: var(--gray-700);
}
.passage-box .passage-ko {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--gray-300);
  font-size: 0.85rem;
  color: var(--gray-500);
}

/* Instruction Box */
.instruction-box {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.instruction-box.level-1 { background: #EFF6FF; border-left: 4px solid var(--level-1-color); }
.instruction-box.level-2 { background: #EFF6FF; border-left: 4px solid var(--level-2-color); }
.instruction-box.level-3 { background: var(--primary-bg); border-left: 4px solid var(--level-3-color); }
.instruction-box.level-4 { background: var(--primary-bg); border-left: 4px solid var(--level-4-color); }
.instruction-box.level-5 { background: #EDE9FE; border-left: 4px solid var(--stage-D); }
.instruction-icon { font-size: 1.1rem; margin-top: 0.1rem; }
.instruction-text h5 { font-size: 0.8rem; font-weight: 700; margin-bottom: 0.2rem; color: var(--gray-600); }
.instruction-text p { font-size: 0.875rem; color: var(--gray-700); margin: 0; }
.instruction-text .ko { font-size: 0.8rem; color: var(--gray-400); margin-top: 0.15rem; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #EEF2FF 0%, #F0FDF4 50%, #FEF9C3 100%);
  padding: 2rem 1rem;
}

/* ── Login Split Layout ─────────────────────────────────────────── */
body.login-body { height: 100vh; overflow: hidden; }
.login-page { height: 100vh; overflow: hidden; display: flex; }

.login-split {
  flex: 1;
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Left panel */
.login-left {
  width: 400px;
  flex-shrink: 0;
  background: linear-gradient(160deg, #1E1B4B 0%, #312E81 55%, #4C1D95 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2.5rem 2.25rem;
  overflow-y: auto;
}
.login-left-inner {
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  height: 100%;
}
.login-brand-title {
  font-size: 1.6rem;
  font-weight: 900;
  color: #fff;
  margin-bottom: 0.3rem;
  line-height: 1.2;
}
.login-brand-sub {
  font-size: 0.78rem;
  color: #A5B4FC;
  line-height: 1.6;
}
.login-divider {
  width: 36px;
  height: 3px;
  background: #818CF8;
  border-radius: 2px;
  margin: 1.4rem 0;
}
.login-message { margin-bottom: 1.5rem; }
.lm-icons { font-size: 1.4rem; letter-spacing: 0.15em; margin-bottom: 0.75rem; }
.lm-quote {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.55;
  margin-bottom: 0.6rem;
}
.lm-sub {
  font-size: 0.76rem;
  color: #C7D2FE;
  line-height: 1.65;
  margin-bottom: 0.6rem;
}
.lm-cheer {
  font-size: 0.8rem;
  color: #A5B4FC;
  line-height: 1.65;
}

/* R.E.A.D. 범례 */
.login-legend {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem 0.75rem;
}
.login-legend-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.login-legend-letter {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
  margin-top: 1px;
}
.login-legend-text { display: flex; flex-direction: column; }
.login-legend-en { font-size: 0.72rem; font-weight: 700; color: #E0E7FF; }
.login-legend-ko { font-size: 0.62rem; color: #A5B4FC; }

/* Right panel */
.login-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 2rem;
  background: var(--gray-50);
  overflow-y: auto;
}

/* Logo */
.login-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 0.5rem;
}
.login-logo-letter {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 900;
  color: #fff;
  box-shadow: var(--shadow);
  margin: 0 2px;
}
.login-logo-letter.r { background: var(--stage-R); }
.login-logo-letter.e { background: var(--stage-E); }
.login-logo-letter.a { background: var(--stage-A); }
.login-logo-letter.d { background: var(--stage-D); }

/* Cards */
.login-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  width: 100%;
  max-width: 700px;
}
.login-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: stretch;
  width: 100%;
  max-width: 340px;
}
.login-card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 0.1rem;
}
.login-card-icon.student { background: var(--primary-bg); color: var(--primary); }
.login-card-icon.teacher { background: #ECFDF5; color: #059669; }
.login-card h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-800);
}
.login-card p.subtitle {
  font-size: 0.8125rem;
  color: var(--gray-500);
  margin: -0.5rem 0 0.25rem;
}

/* Legend (shared) */
.login-footer { margin-top: 2rem; text-align: center; }
.read-legend { display: flex; gap: 1.5rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0.75rem 1.5rem;
  background: rgba(255,255,255,.8);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-600);
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* ============================================================
   TEACHER DASHBOARD
   ============================================================ */

.teacher-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--gray-900);
  color: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-brand {
  padding: 1.5rem 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-brand .brand-logo {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-bottom: 0.75rem;
}
.brand-letter {
  flex: 1;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 900;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.brand-letter.r { background: var(--stage-R); }
.brand-letter.e { background: var(--stage-E); }
.brand-letter.a { background: var(--stage-A); }
.brand-letter.d { background: var(--stage-D); }

.sidebar-brand h2 { font-size: 1rem; font-weight: 800; color: rgba(255,255,255,.95); margin-bottom: 0.15rem; }
.sidebar-brand p  { font-size: 0.72rem; color: rgba(255,255,255,.4); }

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.3);
  padding: 0.75rem 0.5rem 0.4rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255,255,255,.65);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: rgba(255,255,255,.9); }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item .nav-icon { font-size: 0.9rem; width: 16px; text-align: center; }
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--stage-R);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
}

.sidebar-footer {
  padding: 1rem 0.75rem;
  border-top: 1px solid rgba(255,255,255,.1);
}

.sidebar-read-legend {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.75rem 0.5rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 0.75rem;
}
.srl-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.srl-letter {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
}
.srl-en {
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(255,255,255,.75);
  margin-right: 0.3rem;
}
.srl-ko {
  font-size: 0.65rem;
  color: rgba(255,255,255,.35);
}

/* Main content area */
.teacher-main {
  flex: 1;
  overflow-y: auto;
  background: var(--gray-50);
}

.teacher-topbar {
  position: sticky;
  top: 0;
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.teacher-topbar h1 { font-size: 1.4rem; font-weight: 800; color: #1E293B; }

.teacher-content {
  padding: 2rem;
}

/* Stats Cards */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.stat-info h3 { font-size: 1.5rem; font-weight: 800; color: var(--gray-900); line-height: 1; }
.stat-info p  { font-size: 0.75rem; color: var(--gray-500); margin-top: 0.15rem; }

/* Student Grid */
.student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}

.student-card-mini {
  background: #fff;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.student-card-mini:hover { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.08); }
.student-card-mini .snum { font-size: 0.7rem; color: var(--gray-400); margin-bottom: 0.2rem; }
.student-card-mini .sname { font-size: 0.875rem; font-weight: 600; margin-bottom: 0.5rem; truncate: true; }
.student-card-mini .sinfo { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.student-card-mini .status-dot {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gray-300);
}
.student-card-mini .status-dot.active { background: var(--stage-A); }
.student-card-mini .feedback-indicator {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  font-size: 0.65rem;
  background: var(--stage-R);
  color: #fff;
  border-radius: 999px;
  padding: 0.1rem 0.35rem;
  font-weight: 700;
}

/* ============================================================
   STUDENT INTERFACE
   ============================================================ */

.student-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.student-header {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 2rem;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.student-header .header-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.student-header .header-identity {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-width: 0;
}
.student-header .header-identity .num { font-size: 0.7rem; color: var(--gray-400); line-height: 1; }
.student-header .header-identity .name { font-size: 0.9rem; font-weight: 700; line-height: 1.3; }

.student-header .header-divider { width: 1px; height: 28px; background: var(--gray-200); flex-shrink: 0; }

.student-header .header-book { flex-shrink: 0; }
.student-header .book-title { font-size: 0.875rem; font-weight: 600; color: var(--gray-700); }
.student-header .book-sub   { font-size: 0.7rem; color: var(--gray-400); }

.student-header .header-progress { flex: 1; display: flex; justify-content: center; }

.student-header .header-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

.feedback-btn {
  position: relative;
  background: var(--gray-100);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.7rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
  color: var(--gray-600);
}
.feedback-btn:hover { background: var(--gray-200); }
.feedback-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--stage-R);
  color: #fff;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Student main area */
.student-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  height: calc(100vh - var(--header-h));
}

.student-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.75rem 2rem;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

/* Stage Tabs */
.stage-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.stage-tab-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius);
  border: 2px solid var(--gray-200);
  background: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  color: var(--gray-500);
}

.stage-tab-btn .stage-letter {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  background: var(--gray-200);
  color: var(--gray-500);
}

.stage-tab-btn.active[data-stage="PRE"] { border-color: var(--stage-PRE); color: #0369A1; background: var(--stage-PRE-bg); }
.stage-tab-btn.active[data-stage="PRE"] .stage-letter { background: var(--stage-PRE); color: #fff; }
.stage-tab-btn.active[data-stage="R"] { border-color: var(--stage-R); color: var(--stage-R); background: var(--stage-R-bg); }
.stage-tab-btn.active[data-stage="R"] .stage-letter { background: var(--stage-R); color: #fff; }
.stage-tab-btn.active[data-stage="E"] { border-color: var(--stage-E); color: #92400E; background: var(--stage-E-bg); }
.stage-tab-btn.active[data-stage="E"] .stage-letter { background: var(--stage-E); color: #fff; }
.stage-tab-btn.active[data-stage="A"] { border-color: var(--stage-A); color: #166534; background: var(--stage-A-bg); }
.stage-tab-btn.active[data-stage="A"] .stage-letter { background: var(--stage-A); color: #fff; }
.stage-tab-btn.active[data-stage="D"] { border-color: var(--stage-D); color: #6B21A8; background: var(--stage-D-bg); }
.stage-tab-btn.active[data-stage="D"] .stage-letter { background: var(--stage-D); color: #fff; }

.stage-tab-btn.completed[data-stage="PRE"] .stage-letter { background: var(--stage-PRE); color: #fff; }
.stage-tab-btn.completed[data-stage="R"] .stage-letter { background: var(--stage-R); color: #fff; }
.stage-tab-btn.completed[data-stage="E"] .stage-letter { background: var(--stage-E); color: #fff; }
.stage-tab-btn.completed[data-stage="A"] .stage-letter { background: var(--stage-A); color: #fff; }
.stage-tab-btn.completed[data-stage="D"] .stage-letter { background: var(--stage-D); color: #fff; }

.stage-tab-btn.locked { cursor: not-allowed; opacity: 0.55; }
.stage-tab-btn .checkmark { color: #22C55E; font-size: 0.8rem; }

/* Stage Content Panel */
.stage-panel { animation: fadeIn .2s ease; }

.stage-panel-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--gray-200);
}

.stage-panel-header .stage-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
}
[data-stage="PRE"] .stage-icon { background: var(--stage-PRE); }
[data-stage="R"] .stage-icon { background: var(--stage-R); }
[data-stage="E"] .stage-icon { background: var(--stage-E); }
[data-stage="A"] .stage-icon { background: var(--stage-A); }
[data-stage="D"] .stage-icon { background: var(--stage-D); }

/* ── PRE (Pre-Reading) Stage ── */
.pre-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--stage-PRE);
  margin: 1.25rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--stage-PRE-light);
}

.vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.vocab-card {
  background: #fff;
  border: 1.5px solid var(--stage-PRE-light);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  transition: var(--transition);
}
.vocab-card:hover { box-shadow: var(--shadow); border-color: var(--stage-PRE); }

.vocab-word {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--stage-PRE);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.vocab-pronunciation {
  font-size: 0.75rem;
  color: var(--gray-500);
  font-family: monospace;
  margin: 0.2rem 0;
}
.vocab-meaning-en {
  font-size: 0.8rem;
  color: var(--gray-700);
  margin: 0.25rem 0;
}
.vocab-translation {
  font-size: 0.8rem;
  color: #0369A1;
  font-weight: 600;
  background: var(--stage-PRE-bg);
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  margin: 0.25rem 0;
  display: inline-block;
}
.vocab-example {
  font-size: 0.75rem;
  color: var(--gray-500);
  font-style: italic;
  margin-top: 0.35rem;
  border-top: 1px solid var(--gray-100);
  padding-top: 0.35rem;
}
.vocab-translation-toggle {
  margin-top: 0.35rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  background: var(--stage-PRE-bg);
  border: 1px solid var(--stage-PRE-light);
  border-radius: 4px;
  color: var(--stage-PRE);
  cursor: pointer;
}
.vocab-translation-toggle:hover { background: var(--stage-PRE-light); }

.grammar-card {
  background: #FAFAFA;
  border: 1.5px solid var(--gray-200);
  border-left: 4px solid var(--stage-PRE);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
}
.grammar-pattern {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--gray-800);
  font-family: monospace;
  background: var(--stage-PRE-bg);
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.35rem;
}
.grammar-example {
  font-size: 0.85rem;
  color: var(--stage-PRE);
  font-style: italic;
  margin: 0.25rem 0;
}
.grammar-explanation-ko {
  font-size: 0.8rem;
  color: var(--gray-600);
  margin: 0.25rem 0;
}
.grammar-more { font-size: 0.775rem; color: var(--gray-500); }

/* ── Vocabulary Inference ── */
.inference-list { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.25rem; }
.inference-item {
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-radius: 10px;
  padding: 0.9rem 1rem;
}
.inference-clue { font-size: 0.875rem; color: var(--gray-600); margin-bottom: 0.4rem; }
.inference-question { font-size: 0.9rem; font-weight: 600; color: var(--gray-800); margin-bottom: 0.5rem; }
.inference-input-row { display: flex; gap: 0.5rem; align-items: center; }
.inference-input {
  flex: 1;
  border: 1.5px solid #fcd34d;
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-size: 0.875rem;
  outline: none;
}
.inference-input:focus { border-color: #f59e0b; box-shadow: 0 0 0 3px #fde68a55; }
.btn-reveal {
  background: #f59e0b;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-reveal:hover { background: #d97706; }
.inference-answer {
  margin-top: 0.5rem;
  background: #d1fae5;
  border: 1px solid #6ee7b7;
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #065f46;
}

/* ── Page Section Tabs ── */
.page-section-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 0;
  margin-bottom: 0.75rem;
  border-bottom: 2px solid var(--gray-100);
  flex-wrap: wrap;
}
.page-sec-tab {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45rem 0.9rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 20px;
  background: #fff;
  color: var(--gray-500);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.page-sec-tab:hover { border-color: var(--primary-400); color: var(--primary-600); }
.page-sec-tab.active {
  background: var(--primary-600);
  border-color: var(--primary-600);
  color: #fff;
  box-shadow: 0 2px 6px rgba(37,99,235,0.25);
}
.page-section-body { min-height: 200px; }

/* ── TTS Controls ── */
.tts-controls { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.tts-play-btn {
  background: var(--primary-600);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.tts-play-btn:hover { background: var(--primary-700); }
.tts-play-btn:disabled { background: var(--gray-300); cursor: not-allowed; }
.tts-slow-btn { background: #059669; }
.tts-slow-btn:hover { background: #047857; }
.tts-stop-btn {
  background: #DC2626;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}
.tts-word-active {
  background: #FEF08A;
  border-radius: 3px;
  padding: 0 2px;
}
.listen-passage {
  background: #F8FAFC;
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  font-size: 1rem;
  line-height: 1.8;
  color: var(--gray-800);
  margin-bottom: 1rem;
}
.listen-header { margin-bottom: 0.75rem; }
.listen-guess-box { background: #FFF7ED; border: 1.5px dashed #FCD34D; border-radius: 8px; padding: 0.75rem; }
.sec-title { font-size: 1rem; font-weight: 700; color: var(--gray-800); margin: 0 0 0.3rem 0; }
.sec-desc { font-size: 0.83rem; color: var(--gray-500); margin: 0 0 0.75rem 0; }

/* ── Grammar Discovery ── */
.grammar-discover-q { margin-bottom: 0.5rem; }
.grammar-example-box {
  display: inline-block;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: 6px;
  padding: 0.3rem 0.65rem;
  font-family: Georgia, serif;
  font-size: 0.9rem;
  color: #1E40AF;
  margin: 0.2rem 0.2rem 0 0;
}
.grammar-reveal-details summary { user-select: none; }

/* ── Summary Prompt ── */
.summary-prompt-box {
  background: #F5F3FF;
  border: 1.5px solid #DDD6FE;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  color: #4C1D95;
  font-weight: 500;
  margin-bottom: 0.75rem;
}

/* ── Passage Ko Details ── */
.passage-ko-details {
  margin-top: 0.75rem;
  border: 1.5px solid #BBF7D0;
  border-radius: 8px;
  overflow: hidden;
}
.passage-ko-details summary {
  padding: 0.5rem 0.85rem;
  background: #F0FDF4;
  cursor: pointer;
  font-size: 0.83rem;
  font-weight: 600;
  color: #15803D;
  user-select: none;
}
.passage-ko-details .passage-ko {
  padding: 0.75rem 1rem;
  margin: 0;
  font-size: 0.88rem;
  color: var(--gray-600);
  border-top: 1px solid #BBF7D0;
}

.quiz-item {
  background: #fff;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin-bottom: 0.65rem;
}
.quiz-item.correct { border-color: #22C55E; background: #F0FDF4; }
.quiz-item.wrong   { border-color: #EF4444; background: #FEF2F2; }

.quiz-question {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 0.15rem;
}
.quiz-question-ko {
  font-size: 0.775rem;
  color: var(--gray-500);
  margin-bottom: 0.5rem;
}
.quiz-options { display: flex; flex-direction: column; gap: 0.35rem; }
.quiz-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8375rem;
  cursor: pointer;
  padding: 0.25rem 0;
}
.quiz-feedback {
  margin-top: 0.5rem;
  font-size: 0.775rem;
  display: none;
  gap: 0.35rem;
  align-items: flex-start;
}
.quiz-feedback.show { display: flex; }
.quiz-feedback.good { color: #15803D; }
.quiz-feedback.bad  { color: #DC2626; }

.stage-panel-header .stage-meta h2 { font-size: 1rem; font-weight: 700; }
.stage-panel-header .stage-meta p  { font-size: 0.8rem; color: var(--gray-500); }

/* Action Bar */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
}
.action-bar .left { display: flex; align-items: center; gap: 0.5rem; }
.action-bar .right { display: flex; align-items: center; gap: 0.5rem; }

/* Feedback Drawer */
.feedback-drawer {
  width: 340px;
  flex-shrink: 0;
  background: #fff;
  border-left: 1px solid var(--gray-200);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform .3s ease;
  position: fixed;
  right: 0;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  z-index: 200;
  box-shadow: var(--shadow-lg);
}
.feedback-drawer.open { transform: translateX(0); }

.drawer-header {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.drawer-header h3 { font-size: 0.95rem; font-weight: 700; }

.feedback-item {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
}
.feedback-item .fb-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.feedback-item .fb-stage { font-size: 0.7rem; font-weight: 700; }
.feedback-item .fb-time  { font-size: 0.7rem; color: var(--gray-400); }
.feedback-item .fb-text  { font-size: 0.85rem; line-height: 1.6; color: var(--gray-700); }
.feedback-item.unread { background: #F8FAFF; }
.feedback-item .fb-new-badge {
  background: var(--stage-R);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
}

/* Self-reflection toggle section */
.reflection-toggle-btn {
  width: 100%;
  padding: 0.75rem 1.25rem;
  background: var(--stage-D-bg);
  border: 1.5px solid var(--stage-D-light);
  border-radius: var(--radius);
  color: #6B21A8;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  transition: var(--transition);
}
.reflection-toggle-btn:hover { background: #F3E8FF; }

/* Submitted state overlay */
.submitted-notice {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--stage-A-bg);
  border: 1.5px solid var(--stage-A-light);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.submitted-notice .icon { font-size: 1.2rem; }
.submitted-notice .text h4 { font-size: 0.875rem; font-weight: 700; color: #166534; }
.submitted-notice .text p  { font-size: 0.8rem; color: #15803D; }

/* Book switcher */
.book-switcher {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.book-switch-btn {
  flex: 1;
  padding: 0.75rem;
  border-radius: var(--radius);
  border: 2px solid var(--gray-200);
  background: #fff;
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}
.book-switch-btn .bsb-title { font-size: 0.875rem; font-weight: 700; }
.book-switch-btn .bsb-type  { font-size: 0.7rem; color: var(--gray-400); }
.book-switch-btn.active { border-color: var(--primary); background: var(--primary-bg); }
.book-switch-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   MATCHING / SORTING ACTIVITY SPECIFICS
   ============================================================ */
.matching-container { display: flex; flex-direction: column; gap: 1.25rem; }
.matching-prompt { font-size: 0.8125rem; color: var(--gray-500); font-style: italic; margin-bottom: 0.25rem; }

.sort-container { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.sort-col { border: 2px dashed var(--gray-300); border-radius: var(--radius); padding: 0.75rem; min-height: 120px; }
.sort-col.drag-over { border-color: var(--primary); background: var(--primary-bg); }
.sort-col-header { font-size: 0.8rem; font-weight: 700; color: var(--gray-600); text-align: center; margin-bottom: 0.5rem; padding-bottom: 0.5rem; border-bottom: 1.5px solid var(--gray-200); }
.sort-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* ============================================================
   EMPTY STATES & LOADING
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--gray-400);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 0.75rem; display: block; }
.empty-state h4 { font-size: 0.95rem; font-weight: 600; color: var(--gray-500); margin-bottom: 0.3rem; }
.empty-state p  { font-size: 0.825rem; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .student-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .perspective-circle { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .login-split { flex-direction: column; }
  .login-left { width: 100%; min-height: auto; padding: 2.5rem 1.5rem; }
  .login-left-inner { align-items: center; text-align: center; }
  .login-divider { margin: 1.25rem auto; }
  .login-right { padding: 2rem 1rem; }
}
@media (max-width: 768px) {
  .login-cards { grid-template-columns: 1fr; max-width: 380px; }
  .teacher-layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; flex-direction: row; overflow-x: auto; }
  .sidebar-nav { display: flex; flex-direction: row; padding: 0.5rem; }
  .activity-tchart { grid-template-columns: 1fr; }
  .perspective-circle { grid-template-columns: 1fr; }
  .student-header { padding: 0 1rem; }
  .student-content { padding: 1rem; }
}

/* ============================================================
   PDF 분할 레이아웃
   ============================================================ */
.split-wrapper {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* PDF 패널 */
.pdf-panel {
  flex-direction: column;
  width: 48%;
  min-width: 320px;
  max-width: 680px;
  border-right: 2px solid var(--gray-200);
  background: var(--gray-50);
  flex-shrink: 0;
  resize: horizontal;
  overflow: auto;
}
.pdf-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background: var(--gray-800);
  color: #fff;
  font-size: 0.825rem;
  font-weight: 600;
  flex-shrink: 0;
}
.pdf-frame {
  flex: 1;
  width: 100%;
  height: calc(100vh - var(--header-h) - 42px);
  border: none;
  display: block;
}

/* 분할 열렸을 때 콘텐츠 영역 */
.split-open .student-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  height: calc(100vh - var(--header-h));
}
.split-open #bookSwitcher {
  /* 분할 시 카드 1열로 */
  grid-template-columns: 1fr;
}

/* PDF 토글 버튼 */
.pdf-toggle-btn {
  background: var(--gray-700);
  color: #fff;
  border: none;
  font-size: 0.8rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.pdf-toggle-btn:hover { background: var(--gray-800); }
.pdf-toggle-btn.active {
  background: #0284C7;
}

/* ============================================================
   BOOK PANELS (교재별 독립 단계 탭)
   ============================================================ */
#booksPanel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.book-panel {
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  background: #fff;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.book-panel--active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px #4F46E512;
}
.book-panel--locked {
  opacity: 0.55;
  background: var(--gray-50);
}

/* Header row */
.bp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem;
  gap: 1rem;
}
.book-panel--active .bp-header {
  background: var(--primary-bg);
  border-bottom: 1.5px solid var(--primary-light);
}
.bp-header--switchable {
  cursor: pointer;
}
.bp-header--switchable:hover {
  background: var(--gray-50);
}

.bp-book-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.bp-emoji { font-size: 2rem; line-height: 1; }
.bp-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gray-800);
}
.bp-title-ko {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--gray-500);
  margin-left: 0.35rem;
}
.bp-sub {
  font-size: 0.72rem;
  color: var(--gray-400);
  margin-top: 0.1rem;
}

.bp-header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}
.bp-progress-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.bp-progress-bar {
  width: 80px;
  height: 5px;
  background: var(--gray-100);
  border-radius: 999px;
  overflow: hidden;
}
.bp-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 999px;
  transition: width 0.4s ease;
}
.bp-progress-text {
  font-size: 0.7rem;
  color: var(--gray-400);
  white-space: nowrap;
}
.bp-locked-msg {
  font-size: 0.75rem;
  color: var(--gray-400);
}

/* PDF button inside panel */
.bp-pdf-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.775rem;
  font-weight: 600;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid #0284C7;
  background: #F0F9FF;
  color: #0284C7;
  cursor: pointer;
  transition: var(--transition);
}
.bp-pdf-btn:hover {
  background: #0284C7;
  color: #fff;
}

/* Stage tabs row */
.bp-stages {
  display: flex;
  gap: 0;
  border-top: 1px solid var(--gray-100);
  overflow-x: auto;
}

.bp-stage-btn {
  flex: 1;
  min-width: 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.65rem 0.5rem;
  border: none;
  border-right: 1px solid var(--gray-100);
  background: transparent;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  font-family: var(--font);
}
.bp-stage-btn:last-child { border-right: none; }
.bp-stage-btn:hover:not([disabled]):not(.bp-stage-btn--active) {
  background: var(--gray-50);
}
.bp-stage-btn--active {
  background: var(--primary);
  color: #fff;
}
.bp-stage-btn--done {
  background: #F0FDF4;
  color: #15803D;
}
.bp-stage-btn--locked {
  opacity: 0.4;
  cursor: not-allowed;
}
.bp-stage-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.bp-stage-name {
  font-size: 0.62rem;
  opacity: 0.8;
  text-align: center;
  line-height: 1.2;
}
.bp-check {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 0.6rem;
  color: #16A34A;
}
.bp-stage-btn--active .bp-check { color: #BBF7D0; }
.bp-lock {
  font-size: 0.6rem;
}

/* ============================================================
   PAGE READING (페이지별 학습 네비게이터)
   ============================================================ */
.page-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--stage-PRE-bg);
  border: 2px solid var(--stage-PRE);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}
.page-nav-info {
  text-align: center;
}
.page-num {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--stage-PRE);
}
.page-title {
  display: block;
  font-size: 0.75rem;
  color: var(--gray-500);
}

.page-dots {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.page-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gray-200);
  border: 2px solid var(--gray-300);
  transition: var(--transition);
}
.page-dot--active {
  background: var(--stage-PRE);
  border-color: var(--stage-PRE);
  transform: scale(1.4);
}
.page-dot--done {
  background: #22C55E;
  border-color: #16A34A;
}

/* 구문독해 */
.analysis-item {
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.analysis-sentence {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
  font-style: italic;
  margin-bottom: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #fff;
  border-left: 4px solid var(--stage-PRE);
  border-radius: 0 6px 6px 0;
}
.analysis-task {
  font-size: 0.85rem;
  color: var(--gray-600);
  margin-bottom: 0.5rem;
}
.analysis-hint {
  font-size: 0.8rem;
  color: #0369A1;
  background: var(--stage-DIAG-bg);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  margin-bottom: 0.5rem;
}
.analysis-input {
  margin-top: 0.25rem;
  font-size: 0.875rem;
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  .sidebar, .student-header, .stage-tabs, .action-bar, .feedback-drawer { display: none; }
  .teacher-main, .student-main { padding: 0; overflow: visible; height: auto; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  body { font-size: 12pt; }
}

/* ============================================================
   HOME SCREEN
   ============================================================ */

.home-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Growth Hero ── */
.home-hero {
  background: linear-gradient(135deg, #1E3A5F 0%, #2E5FA3 100%);
  border-radius: 20px;
  padding: 1.75rem 2rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  box-shadow: 0 8px 32px rgba(30,58,95,0.25);
}
.home-hero-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex: 1;
}
.home-growth-emoji {
  font-size: 4rem;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
.home-growth-name {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.home-growth-name-en {
  font-size: 0.9rem;
  font-weight: 400;
  opacity: 0.75;
  margin-left: 0.4rem;
}
.home-growth-desc {
  font-size: 0.92rem;
  opacity: 0.85;
  margin: 0.2rem 0 0.4rem;
}
.home-growth-next {
  font-size: 0.82rem;
  background: rgba(255,255,255,0.15);
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
}
.home-hero-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
  min-width: 160px;
}
.home-tier-bar-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.home-tier-bar {
  flex: 1;
  height: 10px;
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
  overflow: hidden;
}
.home-tier-fill {
  height: 100%;
  background: linear-gradient(90deg, #FFD60A, #FFB700);
  border-radius: 10px;
  transition: width 0.8s cubic-bezier(.4,0,.2,1);
}
.home-tier-pct {
  font-size: 0.82rem;
  font-weight: 700;
  min-width: 36px;
  text-align: right;
  opacity: 0.9;
}
.home-stats {
  display: flex;
  gap: 1.25rem;
}
.home-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.home-stat-num {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1;
}
.home-stat-label {
  font-size: 0.7rem;
  opacity: 0.7;
  margin-top: 0.1rem;
}

/* ── Journey Strip ── */
.home-journey {
  background: #F8FAFC;
  border: 1.5px solid #E2E8F0;
  border-radius: 16px;
  padding: 1.1rem 1.5rem;
}
.home-journey-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.85rem;
}
.home-journey-strip {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: nowrap;
  overflow-x: auto;
}
.journey-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.4rem 0.6rem;
  border-radius: 12px;
  transition: background 0.2s;
  position: relative;
  min-width: 64px;
}
.journey-step.reached {
  background: #EFF6FF;
}
.journey-step.current {
  background: linear-gradient(135deg,#DBEAFE,#EDE9FE);
  box-shadow: 0 2px 8px rgba(99,102,241,0.2);
}
.journey-emoji {
  font-size: 1.8rem;
  line-height: 1;
}
.journey-step:not(.reached) .journey-emoji {
  filter: grayscale(0.7);
  opacity: 0.45;
}
.journey-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: #475569;
}
.journey-step:not(.reached) .journey-name {
  opacity: 0.4;
}
.journey-current-dot {
  position: absolute;
  bottom: -6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6366F1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.25);
}
.journey-arrow {
  color: #CBD5E1;
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ── Section title ── */
.home-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1E293B;
  margin-bottom: -0.5rem;
}

/* ── Book Cards ── */
.home-books-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
.home-book-card {
  background: #fff;
  border: 2px solid #E2E8F0;
  border-radius: 16px;
  padding: 1.25rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.home-book-card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,0.09);
  border-color: #6366F1;
}
.home-book-card--locked {
  background: #F8FAFC;
  opacity: 0.65;
}
.home-book-card-top {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.home-book-emoji { font-size: 2rem; line-height: 1; }
.home-book-title { font-size: 1rem; font-weight: 700; color: #1E293B; }
.home-book-title-ko { font-size: 0.78rem; color: #64748B; margin-top: 0.1rem; }
.home-book-pct { font-size: 1.2rem; font-weight: 800; color: #6366F1; margin-left: auto; }
.home-book-progress-bar {
  height: 7px;
  background: #E2E8F0;
  border-radius: 10px;
  overflow: hidden;
}
.home-book-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366F1, #818CF8);
  border-radius: 10px;
  transition: width 0.7s ease;
}
.home-book-locked-msg {
  font-size: 0.83rem;
  color: #94A3B8;
  margin-top: 0.25rem;
}
.home-book-status {
  font-size: 0.82rem;
  color: #64748B;
}
.home-go-btn {
  align-self: flex-start;
  margin-top: 0.1rem;
}

/* ── Stage pips ── */
.home-stage-pips {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.home-stage-pip {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  border: 2px solid #E2E8F0;
  background: #F8FAFC;
  color: #94A3B8;
}
.home-stage-pip.done {
  background: #DCFCE7;
  border-color: #86EFAC;
  color: #166534;
}
.home-stage-pip.active {
  background: #EFF6FF;
  border-color: #6366F1;
  color: #4338CA;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
  animation: pulse-pip 1.5s ease-in-out infinite;
}
.home-stage-pip.locked {
  opacity: 0.4;
}
@keyframes pulse-pip {
  0%,100% { box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
  50%      { box-shadow: 0 0 0 6px rgba(99,102,241,0.08); }
}

/* ── PDF badge in page nav ── */
.page-pdf-badge {
  font-size: 0.72rem;
  background: #EFF6FF;
  color: #1D4ED8;
  border-radius: 6px;
  padding: 0.15rem 0.45rem;
  font-weight: 600;
  border: 1px solid #BFDBFE;
}

/* ── Passage panel (always-visible above activity tabs) ── */
.pre-passage-panel {
  background: #FAFAFA;
  border: 2px solid #E2E8F0;
  border-radius: 14px;
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
}
.pre-passage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.pre-passage-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pre-passage-text {
  font-size: 1.05rem;
  line-height: 1.8;
  color: #1E293B;
  font-family: Georgia, serif;
  white-space: pre-line;
}

/* ── Dialogue format ── */
.dialogue-line {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.dialogue-name {
  flex-shrink: 0;
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: var(--font);
  margin-top: 0.15rem;
  min-width: 3rem;
  text-align: center;
}
.dialogue-bubble {
  display: inline-block;
  padding: 0.4rem 0.75rem;
  border-radius: 12px;
  border: 1.5px solid;
  font-size: 0.95rem;
  line-height: 1.6;
  flex: 1;
}
.dialogue-narration {
  font-size: 0.88rem;
  color: #64748B;
  font-style: italic;
  padding: 0.3rem 0;
  margin-bottom: 0.3rem;
}
.pre-passage-text.has-dialogue {
  white-space: normal;
}

/* ── Activity tabs (below passage) ── */
.page-activity-tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.page-act-tab {
  background: #F1F5F9;
  border: 1.5px solid #E2E8F0;
  border-radius: 10px;
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
}
.page-act-tab:hover {
  background: #EEF2FF;
  border-color: #6366F1;
  color: #4338CA;
}
.page-act-tab.active {
  background: #6366F1;
  border-color: #6366F1;
  color: #fff;
  box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}
.page-activity-body {
  min-height: 200px;
}

/* ── Home btn in header ── */
#homeBtn {
  background: #F1F5F9;
  color: #1E293B;
  font-weight: 600;
}
#homeBtn:hover {
  background: #6366F1;
  color: #fff;
  border-color: #6366F1;
}

/* ── 학생 공지사항 배너 ─────────────────────────────────── */
.student-announcements {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.student-announcement-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: linear-gradient(135deg, #EEF2FF, #F5F3FF);
  border: 1.5px solid #C7D2FE;
  border-left: 4px solid #6366F1;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  animation: slideInDown 0.3s ease;
}
@keyframes slideInDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.sa-emoji { font-size: 1.3rem; flex-shrink: 0; }
.sa-text  { font-size: 0.88rem; font-weight: 600; color: #3730A3; line-height: 1.5; }

/* ============================================================
   PROFILE SCREEN
   ============================================================ */
.profile-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}
.profile-header {
  margin-bottom: 2rem;
}
.profile-title {
  font-size: 1.6rem;
  font-weight: 900;
  color: #1E293B;
  margin-bottom: 0.25rem;
}
.profile-subtitle {
  font-size: 0.9rem;
  color: #64748B;
}
.profile-section {
  background: #fff;
  border: 1.5px solid #E2E8F0;
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.profile-section-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #1E293B;
  margin-bottom: 0.25rem;
}
.profile-section-desc {
  font-size: 0.82rem;
  color: #64748B;
  margin-bottom: 1.25rem;
}
.profile-char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.75rem;
}
.profile-char-card {
  background: var(--char-light, #F8FAFC);
  border: 2px solid #E2E8F0;
  border-radius: 12px;
  padding: 0.85rem 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  position: relative;
}
.profile-char-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  border-color: var(--char-color, #6366F1);
}
.profile-char-card--active {
  border: 2.5px solid var(--char-color, #6366F1);
  background: var(--char-light, #EEF2FF);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.profile-char-emoji { font-size: 2rem; line-height: 1; }
.profile-char-name  { font-size: 0.8rem; font-weight: 700; color: var(--char-color, #1E293B); text-align: center; }
.profile-char-en    { font-size: 0.65rem; color: #94A3B8; text-align: center; }
.profile-char-badge {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--char-color, #6366F1);
  color: #fff;
  font-size: 0.58rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 20px;
  white-space: nowrap;
}

/* ============================================================
   CHARACTER SELECTION SCREEN
   ============================================================ */
.char-select-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  text-align: center;
}
.char-select-title {
  font-size: 2rem;
  font-weight: 900;
  color: #1E293B;
  margin-bottom: 0.5rem;
}
.char-select-subtitle {
  font-size: 1rem;
  color: #64748B;
  line-height: 1.7;
  margin-bottom: 2rem;
}
.char-select-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
}
@media (max-width: 640px) {
  .char-select-cards { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
}
.char-card {
  background: var(--char-light, #F8FAFC);
  border: 2.5px solid var(--char-color, #E2E8F0);
  border-radius: 16px;
  padding: 1.25rem 1rem 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}
.char-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 36px rgba(0,0,0,0.12);
}
.char-card-emoji { font-size: 2.8rem; line-height: 1; margin-bottom: 0.15rem; }
.char-card-name  { font-size: 1.15rem; font-weight: 800; color: var(--char-color, #1E293B); }
.char-card-en    { font-size: 0.78rem; color: #94A3B8; font-weight: 500; letter-spacing: 0.05em; }
.char-card-desc  { font-size: 0.76rem; color: #475569; line-height: 1.5; text-align: center; flex: 1; }
.char-select-btn {
  margin-top: 0.75rem;
  background: var(--char-color, #6366F1);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.char-select-btn:hover { opacity: 0.88; transform: scale(1.02); }

/* ============================================================
   GAME HOME SCREEN
   ============================================================ */
.home-wrap--game {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Game Hero */
.game-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  background: linear-gradient(135deg, #1E293B, #334155);
  border-radius: 20px;
  padding: 1.5rem 2rem;
  margin-bottom: 1.25rem;
  color: #fff;
}
.game-hero-left   { display: flex; align-items: center; gap: 1.25rem; }
.game-hero-right  { flex: 1; max-width: 320px; }
.game-char-avatar {
  width: 72px; height: 72px;
  border-radius: 50%; border: 3px solid;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.game-char-emoji  { font-size: 2.2rem; line-height: 1; }
.game-char-name   { font-size: 1.3rem; font-weight: 800; color: #fff; margin-bottom: 0.3rem; }
.game-char-en     { font-size: 0.78rem; font-weight: 400; color: #94A3B8; margin-left: 0.4rem; }
.game-growth-badge{ font-size: 0.9rem; font-weight: 600; color: #FCD34D; margin-bottom: 0.2rem; }
.game-level-badge {
  display: inline-block; font-size: 0.78rem; font-weight: 600;
  background: rgba(255,255,255,0.12); border-radius: 20px;
  padding: 0.2rem 0.75rem; color: #CBD5E1;
}
.game-progress-row {
  display: flex; justify-content: space-between;
  font-size: 0.8rem; color: #94A3B8; margin-bottom: 0.4rem;
}
.game-progress-pct  { font-weight: 700; color: #FCD34D; }
.game-progress-bar  { height: 10px; background: rgba(255,255,255,0.15); border-radius: 999px; overflow: hidden; margin-bottom: 0.75rem; }
.game-progress-fill { height: 100%; background: linear-gradient(90deg,#6366F1,#A855F7); border-radius: 999px; transition: width 0.6s ease; }
.game-stats-row     { display: flex; gap: 1rem; }
.game-stat {
  display: flex; flex-direction: column; align-items: center;
  background: rgba(255,255,255,0.08); border-radius: 10px;
  padding: 0.4rem 0.75rem; flex: 1;
}
.game-stat-num { font-size: 1.2rem; font-weight: 800; color: #fff; }
.game-stat-lbl { font-size: 0.68rem; color: #94A3B8; }

/* Book Header */
.game-book-header {
  display: flex; align-items: center; gap: 1rem;
  background: #fff; border: 1.5px solid #E2E8F0;
  border-radius: 16px; padding: 1rem 1.5rem; margin-bottom: 1.25rem;
}
.game-book-emoji  { font-size: 2.5rem; flex-shrink: 0; }
.game-book-info   { flex: 1; }
.game-book-title  { font-size: 1.15rem; font-weight: 800; color: #1E293B; }
.game-book-sub    { font-size: 0.8rem; color: #64748B; margin-bottom: 0.2rem; }
.game-book-theme  { font-size: 0.78rem; color: #6366F1; font-weight: 500; }
.game-continue-btn{ white-space: nowrap; flex-shrink: 0; font-size: 0.85rem !important; padding: 0.6rem 1.25rem !important; }

/* Game Map */
.game-map { display: flex; flex-direction: column; gap: 0; }

.game-zone {
  background: #fff;
  border: 2px solid var(--zone-color, #E2E8F0);
  border-radius: 18px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}
.game-zone--bg   { border-color: #DDD6FE; }
.game-zone--page { border-color: #BAE6FD; }
.game-zone--read { border-color: #C7D2FE; background: linear-gradient(135deg,#F5F3FF,#EFF6FF); }

.game-zone-header {
  display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1rem;
}
.game-zone-icon { font-size: 1.25rem; }
.game-zone-name { font-size: 1rem; font-weight: 800; color: #1E293B; flex: 1; }
.game-zone-count {
  font-size: 0.78rem; font-weight: 600; color: #475569;
  background: rgba(0,0,0,0.06); border-radius: 20px; padding: 0.2rem 0.65rem;
}

.game-zone-arrow { text-align: center; font-size: 1.5rem; color: #CBD5E1; padding: 0.4rem 0; line-height: 1; }

/* Node grids */
.game-zone-nodes {
  display: flex; align-items: center; gap: 0.4rem;
  flex-wrap: nowrap; overflow-x: auto; padding-bottom: 0.25rem;
}
.game-zone-nodes--wrap { flex-wrap: wrap; gap: 0.5rem; overflow-x: visible; }

/* Individual Node */
.game-node {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.25rem;
  padding: 0.5rem 0.4rem 0.4rem; border-radius: 12px; border: 2px solid transparent;
  cursor: default; min-width: 58px; position: relative;
  transition: transform 0.15s ease; flex-shrink: 0;
}
.game-node-icon  { font-size: 1.5rem; line-height: 1; }
.game-node-label { font-size: 0.62rem; font-weight: 700; text-align: center; white-space: nowrap; line-height: 1.2; }

.game-node--locked { background: #F1F5F9; border-color: #E2E8F0; opacity: 0.55; }
.game-node--locked .game-node-icon  { filter: grayscale(1); }
.game-node--locked .game-node-label { color: #94A3B8; }

.game-node--active {
  background: #EEF2FF; /* fallback */
  background: color-mix(in srgb, var(--node-color,#6366F1) 12%, white);
  border-color: var(--node-color, #6366F1);
  cursor: pointer;
  animation: nodeGlow 2s ease-in-out infinite;
}
.game-node--active .game-node-label { color: var(--node-color,#6366F1); font-weight: 800; }
.game-node--active:hover             { transform: scale(1.12); }

.game-node--done { background: #F0FDF4; border-color: #86EFAC; cursor: pointer; }
.game-node--done .game-node-label { color: #16A34A; }
.game-node--done:hover             { transform: scale(1.06); }

.game-node-pulse {
  position: absolute; inset: -4px; border-radius: 14px;
  border: 2px solid var(--node-color,#6366F1);
  animation: pulseFade 1.8s ease-out infinite;
  pointer-events: none;
}

@keyframes nodeGlow {
  0%,100% { box-shadow: 0 0 0 0 rgba(99,102,241,0.3); }
  50%     { box-shadow: 0 0 0 6px rgba(99,102,241,0); }
}
@keyframes pulseFade {
  0%   { transform: scale(1);    opacity: 0.8; }
  100% { transform: scale(1.25); opacity: 0;   }
}

.game-connector { color: #CBD5E1; font-size: 0.9rem; font-weight: 700; flex-shrink: 0; padding: 0 0.1rem; margin-bottom: 1rem; }

.game-zone--read .game-node       { min-width: 72px; padding: 0.75rem 0.6rem 0.5rem; }
.game-zone--read .game-node-icon  { font-size: 1.9rem; }
.game-zone--read .game-node-label { font-size: 0.72rem; }

/* ── Game hero char info (rank-based) ── */
.game-char-class {
  font-size: 0.75rem;
  color: #94A3B8;
  margin: 0.15rem 0;
}
.game-rank-next {
  font-size: 0.75rem;
  color: #FCD34D;
  font-weight: 600;
}
.game-rank-next--max { color: #FBBF24; }

/* ── Rank Progression Strip ── */
.rank-strip-wrap {
  background: #fff;
  border: 1.5px solid #E2E8F0;
  border-radius: 14px;
  padding: 1rem 1.5rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;
}
.rank-strip-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #64748B;
  margin-bottom: 0.75rem;
  letter-spacing: 0.03em;
}
.rank-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
}
.rank-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.6rem 1rem;
  border-radius: 12px;
  position: relative;
  opacity: 0.35;
  transition: opacity 0.2s;
}
.rank-step.reached  { opacity: 0.7; }
.rank-step.current  { opacity: 1; background: #F1F5F9; }
.rank-step-emoji    { font-size: 2.2rem; line-height: 1; }
.rank-step-name     { font-size: 0.75rem; font-weight: 700; color: #334155; white-space: nowrap; }
.rank-step.current .rank-step-name { color: #4F46E5; }
.rank-step-dot {
  width: 6px; height: 6px;
  background: #6366F1;
  border-radius: 50%;
  margin-top: 0.2rem;
  animation: pulseDot 1.4s ease-in-out infinite;
}
@keyframes pulseDot {
  0%,100% { transform: scale(1); opacity: 1; }
  50%     { transform: scale(1.5); opacity: 0.6; }
}
.rank-step-arrow {
  color: #CBD5E1;
  font-size: 1.1rem;
  padding: 0 0.2rem;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

/* ── Fix scrollbars + alignment in game zones ── */
.game-zone-nodes         { overflow-x: visible; flex-wrap: wrap; justify-content: center; }
.game-zone-nodes--wrap   { overflow-x: visible; justify-content: center; }
.game-zone--page .game-zone-nodes { justify-content: flex-start; } /* page nodes: left-align so they wrap naturally */
.rank-strip-wrap         { overflow-x: visible; }
.rank-strip              { flex-wrap: wrap; gap: 0.25rem; justify-content: center; }
.rank-step               { flex-shrink: 0; }
.home-wrap--game         { max-width: 1100px; }

/* ── Slim Stage Bar (replaces booksPanel in learning view) ── */
.stage-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #fff;
  border-bottom: 1.5px solid #E2E8F0;
  padding: 0.6rem 1.25rem;
  flex-wrap: wrap;
}
.stage-bar-back {
  background: #F1F5F9;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  color: #334155;
  white-space: nowrap;
  flex-shrink: 0;
}
.stage-bar-back:hover { background: #6366F1; color: #fff; border-color: #6366F1; }
.stage-bar-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}
.stage-bar-icon  { font-size: 1.4rem; flex-shrink: 0; }
.stage-bar-title { font-size: 0.95rem; font-weight: 800; color: #1E293B; }
.stage-bar-sub   { font-size: 0.72rem; color: #94A3B8; }
.stage-bar-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.stage-bar-nav-btn {
  background: #F8FAFC;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  color: #475569;
  white-space: nowrap;
}
.stage-bar-nav-btn:hover { background: #EEF2FF; border-color: #A5B4FC; color: #4F46E5; }
.stage-bar-progress {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: #6366F1;
  font-weight: 700;
}
.stage-bar-pg-bar {
  width: 60px; height: 6px;
  background: #E2E8F0;
  border-radius: 999px;
  overflow: hidden;
}
.stage-bar-pdf-btns {
  display: flex; gap: 0.4rem; flex-shrink: 0; align-items: center;
}
.stage-pdf-btn {
  background: #F0FDF4; border-color: #86EFAC; color: #16A34A;
}
.stage-pdf-btn:hover { background: #DCFCE7; border-color: #4ADE80; }

/* Stage PDF card in teacher content panel */
.stage-pdf-card { border-left: 3px solid #6366F1; }

/* ─── Content Editor ─── */
.ced-section {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px dashed #E2E8F0;
}
.ced-section:last-child { border-bottom: none; margin-bottom: 0; }
.ced-label {
  font-size: 0.82rem; font-weight: 700; color: #4F46E5;
  margin-bottom: 0.6rem;
}
.ced-sub {
  display: block;
  font-size: 0.72rem; font-weight: 600; color: #64748B;
  margin-bottom: 0.25rem; margin-top: 0.5rem;
}
.ced-input {
  display: block; width: 100%; box-sizing: border-box;
  padding: 0.45rem 0.65rem;
  font-size: 0.82rem; color: #1E293B;
  border: 1.5px solid #E2E8F0; border-radius: 8px;
  background: #fff; margin-bottom: 0.35rem;
  font-family: inherit;
  resize: vertical;
}
.ced-input:focus { outline: none; border-color: #6366F1; box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.ced-mini-input {
  display: block; width: 100%; box-sizing: border-box;
  padding: 0.3rem 0.5rem; font-size: 0.75rem; color: #1E293B;
  border: 1px solid #E2E8F0; border-radius: 6px;
  background: #fff; margin-bottom: 0.25rem; font-family: inherit;
}
.ced-mini-input:focus { outline: none; border-color: #6366F1; }
.ced-select {
  padding: 0.25rem 0.5rem; font-size: 0.75rem;
  border: 1.5px solid #E2E8F0; border-radius: 6px;
  background: #fff; font-family: inherit; cursor: pointer;
}
.ced-pc-item {
  background: #F8FAFC; border: 1.5px solid #E2E8F0;
  border-radius: 10px; padding: 0.65rem; margin-bottom: 0.5rem;
}

/* ─── Student Modal Book Cards ─── */
.modal-book-card {
  border: 1.5px solid #E2E8F0;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}
.modal-book-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: linear-gradient(135deg, #F8FAFC, #EEF2FF);
  border-bottom: 1.5px solid #E2E8F0;
}
.modal-book-cover {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  background: #fff;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  flex-shrink: 0;
}
.modal-book-info { flex: 1; min-width: 0; }
.modal-book-title { font-size: 0.82rem; font-weight: 800; color: #1E293B; }
.modal-book-ko { font-size: 0.7rem; color: #94A3B8; font-weight: 400; }
.modal-book-body { padding: 0.65rem 1rem 0.75rem; }

/* ─── Teacher Content Matrix (game-map style) ─── */
.tcm-zone {
  background: #F8FAFC;
  border: 1.5px solid #E2E8F0;
  border-radius: 14px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
}
.tcm-zone-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #E2E8F0;
}
.tcm-zone-count {
  font-size: 0.72rem;
  color: #94A3B8;
  font-weight: 600;
  background: #F1F5F9;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
}
.tcm-nodes {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 0;
  padding-bottom: 0.25rem;
}
.tcm-nodes--wrap {
  flex-wrap: wrap;
  gap: 0.4rem;
  overflow-x: visible;
}
.tcm-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.15rem;
  padding: 0.6rem 0.5rem 0.5rem;
  border-radius: 12px;
  border: 2px solid #E2E8F0;
  background: #F8FAFC;
  min-width: 72px;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}
.tcm-node:hover { transform: scale(1.07); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.tcm-node--sel  { box-shadow: 0 4px 16px rgba(99,102,241,0.35); }
.tcm-node--done { border-color: #86EFAC !important; }
.tcm-node-icon  { font-size: 1.4rem; line-height: 1; }
.tcm-node-label { font-size: 0.6rem; font-weight: 700; text-align: center; white-space: nowrap; }
.tcm-unlock-btn {
  margin-top: 0.35rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  background: #EEF2FF;
  color: #4F46E5;
  border: 1.5px solid #C7D2FE;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.tcm-unlock-btn:hover { background: #6366F1; color: #fff; border-color: #6366F1; }
.tcm-dist-badge {
  margin-top: 0.35rem;
  padding: 0.25rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  background: #F0FDF4;
  color: #16A34A;
  border: 1.5px solid #86EFAC;
  border-radius: 6px;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s;
}
.tcm-recall-btn:hover { background: #FFF1F2; border-color: #FCA5A5; }
.tcm-node--dist { border-color: #A5B4FC !important; }
.tcm-connector {
  color: #CBD5E1;
  font-size: 0.9rem;
  font-weight: 700;
  flex-shrink: 0;
  padding: 0 0.1rem;
  margin-bottom: 0.9rem;
}
.tcm-arrow {
  text-align: center;
  color: #CBD5E1;
  font-size: 1.2rem;
  margin: 0.35rem 0;
  line-height: 1;
}

/* ── Unit Tabs ── */
.unit-tabs-wrap {
  margin-bottom: 1.5rem;
}
.unit-tab-headers {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0;
  border-bottom: 2px solid #E2E8F0;
  padding-bottom: 0;
}
.unit-tab-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  padding: 0.6rem 1.1rem 0.55rem;
  background: #F8FAFC;
  border: 1.5px solid #E2E8F0;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
  bottom: -2px;
}
.unit-tab-btn:hover { background: #EEF2FF; border-color: #A5B4FC; }
.unit-tab-btn--active {
  background: #fff;
  border-color: #6366F1;
  border-bottom: 2px solid #fff;
  z-index: 1;
}
.unit-tab-num {
  font-size: 0.72rem;
  font-weight: 800;
  color: #1E293B;
  background: #E2E8F0;
  border-radius: 5px;
  padding: 0.1rem 0.45rem;
}
.unit-tab-btn--active .unit-tab-num {
  background: #6366F1;
  color: #fff;
}
.unit-tab-theme {
  font-size: 0.68rem;
  color: #64748B;
  font-weight: 500;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.unit-tab-btn--active .unit-tab-theme { color: #4F46E5; font-weight: 600; }

.unit-tab-panels { padding-top: 0; }
.unit-tab-panel  { display: none; padding-top: 1rem; }
.unit-tab-panel--active { display: block; }

.unit-panel-subheader {
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px dashed #E2E8F0;
}
.unit-panel-theme {
  font-size: 0.8rem;
  color: #64748B;
  font-style: italic;
}

/* ── Legacy Unit Sections (kept for compat) ── */
.unit-section        { margin-bottom: 1.5rem; }
.unit-section-theme    { font-size: 0.85rem; font-weight: 700; color: #1E293B; }
.unit-section-theme-ko { font-size: 0.75rem; color: #64748B; }

.unit-book-card {
  background: #fff;
  border: 1.5px solid #E2E8F0;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}
.unit-book-card--locked { background: #F8FAFC; }

/* Book header — individual prominent header per book */
.unit-book-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: linear-gradient(135deg, #F8FAFC 0%, #EEF2FF 100%);
  border-bottom: 1.5px solid #E2E8F0;
}
.unit-book-card--locked .unit-book-header {
  background: linear-gradient(135deg, #F1F5F9 0%, #E2E8F0 100%);
}
.unit-book-header[data-book]:hover {
  background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
}
.unit-book-cover-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  font-size: 2rem;
  background: #fff;
  border: 1.5px solid #E2E8F0;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.unit-book-card--locked .unit-book-cover-icon { filter: grayscale(0.5); }
.unit-book-header-info { flex: 1; min-width: 0; }
.unit-book-title { font-size: 0.95rem; font-weight: 800; color: #1E293B; }
.unit-book-card--locked .unit-book-title { color: #64748B; }
.unit-book-title-ko { font-size: 0.75rem; color: #94A3B8; font-weight: 400; }
.unit-book-sub   { font-size: 0.75rem; color: #94A3B8; }
.unit-book-lock-badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-size: 0.75rem; color: #94A3B8; background: #F1F5F9;
  border: 1px solid #E2E8F0; border-radius: 8px; padding: 0.3rem 0.65rem;
  flex-shrink: 0; white-space: nowrap;
}
.unit-book-body { padding: 0.85rem 1.25rem 1rem; }

/* Legacy top row (kept for compatibility) */
.unit-book-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}


/* ── Emoji Picker ── */
.emoji-picker-popup {
  display: none;
  position: absolute;
  z-index: 9999;
  background: #fff;
  border: 1.5px solid #E2E8F0;
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.14);
  padding: 0.75rem;
  width: 258px;
  max-height: 300px;
  overflow-y: auto;
}
.emoji-pk-btn {
  background: none;
  border: none;
  font-size: 1.15rem;
  cursor: pointer;
  padding: 3px 4px;
  border-radius: 5px;
  line-height: 1;
  transition: background 0.1s;
}
.emoji-pk-btn:hover { background: #F1F5F9; }
