/* 초중고 TEPS 전자북 공통 스타일 */

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

:root {
  --fs-xs:   clamp(13px, 1.8vw, 14px);
  --fs-sm:   clamp(14px, 2vw,   15px);
  --fs-md:   clamp(15px, 2.2vw, 16px);
  --fs-lg:   clamp(16px, 2.5vw, 18px);
  --fs-xl:   clamp(18px, 2.8vw, 20px);
  --fs-2xl:  clamp(20px, 3vw,   24px);
}

body {
  font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  background: #f0f4f8;
  color: #1e293b;
  font-size: var(--fs-md);
  line-height: 1.65;
  min-height: 100vh;
}

/* ── 헤더 ── */
.teps-header {
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
  color: #fff;
  padding: 16px 20px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
}
.teps-header-back {
  background: rgba(255,255,255,.18);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 18px;
  width: 36px; height: 36px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.teps-header-back:hover { background: rgba(255,255,255,.3); }
.teps-header-home {
  background: rgba(255,255,255,.18);
  border-radius: 8px;
  color: #fff;
  font-size: 18px;
  width: 36px; height: 36px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  text-decoration: none;
}
.teps-header-home:hover { background: rgba(255,255,255,.3); }
.teps-header-title { flex: 1; }
.teps-header-title h1 { font-size: var(--fs-xl); font-weight: 800; line-height: 1.2; }
.teps-header-title p { font-size: var(--fs-xs); opacity: .8; margin-top: 2px; }
.teps-header-badge {
  background: rgba(255,255,255,.2);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: var(--fs-xs);
  font-weight: 700;
  white-space: nowrap;
}

/* ── 탭 네비게이션 ── */
.teps-tabs {
  background: #fff;
  display: flex;
  overflow-x: auto;
  gap: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  position: sticky;
  top: 70px;
  z-index: 90;
  scrollbar-width: none;
}
.teps-tabs::-webkit-scrollbar { display: none; }
.teps-tab {
  flex: 1;
  min-width: 80px;
  padding: 12px 8px 10px;
  border: none;
  background: transparent;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.teps-tab .tab-emoji { font-size: var(--fs-xl); }
.teps-tab.is-active { color: #2563eb; border-bottom-color: #2563eb; }
.teps-tab:hover:not(.is-active) { color: #1e3a5f; background: #f8fafc; }

/* ── 컨텐츠 영역 ── */
.teps-body { padding: 16px; max-width: 900px; margin: 0 auto; }

/* ── 섹션 제목 ── */
.teps-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.teps-section-head h2 { font-size: var(--fs-xl); font-weight: 800; }
.teps-section-head p { font-size: var(--fs-sm); color: #64748b; margin-top: 2px; }

/* ── 단원 선택 ── */
.teps-unit-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.teps-unit-pill {
  padding: 7px 16px;
  border-radius: 20px;
  border: 2px solid #e2e8f0;
  background: #fff;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all .15s;
}
.teps-unit-pill.is-active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.teps-unit-pill:hover:not(.is-active) { border-color: #2563eb; color: #2563eb; }

/* ── 단어 카드 ── */
.vocab-card-wrap { perspective: 1200px; margin-bottom: 20px; }
.vocab-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 4px 24px rgba(0,0,0,.1);
  padding: 36px 24px 28px;
  text-align: center;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
}
.vocab-card-emoji { font-size: 56px; line-height: 1; }
.vocab-card-word { font-size: 32px; font-weight: 900; color: #1e3a5f; }
.vocab-card-pron { font-size: var(--fs-md); color: #64748b; font-style: italic; }
.vocab-card-meaning { font-size: var(--fs-xl); font-weight: 700; color: #2563eb; }
.vocab-card-example { font-size: var(--fs-sm); color: #475569; line-height: 1.7; max-width: 360px; }
.vocab-card-example em { color: #2563eb; font-style: normal; font-weight: 700; }
.vocab-tts-btn {
  background: #eff6ff;
  border: none;
  border-radius: 50%;
  width: 44px; height: 44px;
  font-size: 20px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.vocab-tts-btn:hover { background: #dbeafe; }
.vocab-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 12px;
}
.vocab-nav-btn {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px; height: 40px;
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.vocab-nav-btn:hover { background: #1d4ed8; }
.vocab-nav-btn:disabled { background: #cbd5e1; cursor: not-allowed; }
.vocab-counter { font-size: var(--fs-sm); font-weight: 700; color: #475569; min-width: 60px; text-align: center; }
.vocab-mode-btns {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}
.vocab-mode-btn {
  padding: 8px 20px;
  border-radius: 8px;
  border: 2px solid #e2e8f0;
  background: #fff;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  transition: all .15s;
}
.vocab-mode-btn.is-active { background: #2563eb; border-color: #2563eb; color: #fff; }

/* ── 퀴즈 카드 ── */
.quiz-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
  padding: 22px 20px;
  margin-bottom: 14px;
}
.quiz-q-num { font-size: var(--fs-xs); font-weight: 700; color: #94a3b8; margin-bottom: 6px; }
.quiz-q-text { font-size: var(--fs-lg); font-weight: 700; margin-bottom: 16px; line-height: 1.6; }
.quiz-q-passage {
  background: #f8fafc;
  border-left: 4px solid #2563eb;
  border-radius: 0 8px 8px 0;
  padding: 14px 16px;
  font-size: var(--fs-md);
  line-height: 1.9;
  margin-bottom: 16px;
  color: #374151;
}
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.quiz-option {
  padding: 12px 18px;
  border-radius: 10px;
  border: 2px solid #e2e8f0;
  background: #fff;
  font-size: var(--fs-md);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all .15s;
  color: #374151;
}
.quiz-option:hover:not(:disabled) { border-color: #2563eb; background: #eff6ff; }
.quiz-option.correct { border-color: #10b981; background: #d1fae5; color: #065f46; }
.quiz-option.wrong { border-color: #ef4444; background: #fee2e2; color: #991b1b; }
.quiz-option:disabled { cursor: not-allowed; }
.quiz-explain {
  margin-top: 12px;
  padding: 12px 16px;
  background: #f0fdf4;
  border-radius: 8px;
  font-size: var(--fs-sm);
  color: #065f46;
  line-height: 1.7;
}
.quiz-explain.wrong-explain { background: #fef2f2; color: #991b1b; }

/* ── 문법 설명 ── */
.grammar-rule-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
  padding: 20px;
  margin-bottom: 16px;
}
.grammar-rule-title {
  font-size: var(--fs-lg);
  font-weight: 800;
  color: #1e3a5f;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.grammar-rule-desc {
  font-size: var(--fs-md);
  color: #475569;
  line-height: 1.8;
  margin-bottom: 14px;
}
.grammar-rule-examples {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.grammar-example {
  padding: 10px 16px;
  background: #eff6ff;
  border-radius: 8px;
  font-size: var(--fs-md);
  color: #1e40af;
  font-weight: 600;
}
.grammar-example .kr { font-weight: 400; color: #64748b; margin-left: 8px; font-size: var(--fs-sm); }

/* ── 독해 지문 ── */
.reading-passage-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
  padding: 22px 20px;
  margin-bottom: 16px;
}
.reading-passage-title {
  font-size: var(--fs-lg);
  font-weight: 800;
  color: #1e3a5f;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.reading-passage-text {
  font-size: var(--fs-md);
  line-height: 2.1;
  color: #334155;
  margin-bottom: 16px;
  border-left: 4px solid #2563eb;
  padding-left: 16px;
}
.reading-passage-text strong { color: #1e3a5f; }

/* ── 활동/게임 ── */
.activity-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
  padding: 22px 20px;
  margin-bottom: 16px;
}
.activity-title {
  font-size: var(--fs-lg);
  font-weight: 800;
  margin-bottom: 8px;
  color: #1e3a5f;
}
.activity-desc { font-size: var(--fs-sm); color: #64748b; margin-bottom: 14px; }
.sentence-arrange {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  min-height: 44px;
  padding: 10px;
  background: #f8fafc;
  border-radius: 10px;
  border: 2px dashed #e2e8f0;
  align-items: center;
}
.word-chip {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: var(--fs-sm);
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all .15s;
  user-select: none;
}
.word-chip.available { background: #dbeafe; color: #1e40af; }
.word-chip.available:hover { background: #bfdbfe; }
.word-chip.selected { background: #2563eb; color: #fff; }
.word-chip.selected:hover { background: #1d4ed8; }
.word-chip.correct-chip { background: #d1fae5; color: #065f46; cursor: default; }
.word-chip.wrong-chip { background: #fee2e2; color: #991b1b; cursor: default; }

/* ── 점수 / 결과 ── */
.teps-score-bar {
  background: #f1f5f9;
  border-radius: 8px;
  height: 10px;
  overflow: hidden;
  margin-bottom: 4px;
}
.teps-score-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #7c3aed);
  border-radius: 8px;
  transition: width .4s ease;
}
.teps-score-label { font-size: var(--fs-sm); font-weight: 700; color: #475569; text-align: right; }
.teps-result-box {
  background: linear-gradient(135deg, #1e3a5f, #2563eb);
  color: #fff;
  border-radius: 14px;
  padding: 24px 20px;
  text-align: center;
  margin-bottom: 16px;
}
.teps-result-score { font-size: clamp(40px, 8vw, 56px); font-weight: 900; margin: 8px 0; }
.teps-result-label { font-size: var(--fs-md); opacity: .85; }

/* ── 실전 타이머 ── */
.teps-timer {
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 18px;
  font-size: 20px;
  font-weight: 900;
  color: #ef4444;
  font-variant-numeric: tabular-nums;
  display: inline-block;
  margin-bottom: 12px;
}
.teps-timer.warning { border-color: #ef4444; background: #fef2f2; }

/* ── 수준별 레벨 배지 ── */
.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: var(--fs-xs);
  font-weight: 700;
}
.level-badge.easy { background: #d1fae5; color: #065f46; }
.level-badge.medium { background: #fef3c7; color: #92400e; }
.level-badge.hard { background: #fee2e2; color: #991b1b; }

/* ── 안내 배너 ── */
.teps-banner {
  background: linear-gradient(135deg, #eff6ff, #e0e7ff);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.teps-banner-icon { font-size: 24px; flex-shrink: 0; }
.teps-banner-text h3 { font-size: var(--fs-lg); font-weight: 800; color: #1e3a5f; margin-bottom: 4px; }
.teps-banner-text p { font-size: var(--fs-sm); color: #475569; line-height: 1.7; }

/* ── 수능 비교표 (고등) ── */
.compare-table { width: 100%; font-size: var(--fs-sm); border-radius: 10px; overflow: hidden; border: 1px solid #e2e8f0; }
.compare-row { display: flex; }
.compare-row.compare-header .compare-cell { background: #1e3a5f; color: #fff; font-weight: 700; }
.compare-row:not(.compare-header):nth-child(even) .compare-cell { background: #f8fafc; }
.compare-cell { flex: 1; padding: 10px 12px; border-bottom: 1px solid #e2e8f0; line-height: 1.5; word-break: keep-all; }
.compare-cell:not(:last-child) { border-right: 1px solid #e2e8f0; }

/* ── 모바일 반응형 ── */
@media (max-width: 600px) {
  :root {
    --fs-xs:  13px;
    --fs-sm:  14px;
    --fs-md:  15px;
    --fs-lg:  16px;
    --fs-xl:  17px;
    --fs-2xl: 19px;
  }
  .teps-body { padding: 12px; }
  .vocab-card { padding: 24px 16px 20px; min-height: 180px; }
  .vocab-card-emoji { font-size: 42px; }
  .vocab-card-word { font-size: 28px; }
  .teps-tab { min-width: 64px; padding: 10px 6px 8px; }
  .teps-header-title h1 { font-size: 16px; }
}

/* ── 태블릿/데스크탑 ── */
@media (min-width: 768px) {
  :root {
    --fs-xs:  14px;
    --fs-sm:  15px;
    --fs-md:  16px;
    --fs-lg:  18px;
    --fs-xl:  20px;
    --fs-2xl: 24px;
  }
  .teps-body { padding: 20px; }
  .quiz-card { padding: 28px 26px; }
  .grammar-rule-card { padding: 24px 26px; }
  .reading-passage-card { padding: 28px 26px; }
}
