/* ============================================================
   KOREAN LEARNING APP — Complete Stylesheet
   Mobile-first, clean modern design
   ============================================================ */

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

:root {
  --primary:    #3B82F6;
  --primary-dk: #1D4ED8;
  --accent:     #EF4444;
  --green:      #10B981;
  --amber:      #F59E0B;
  --purple:     #8B5CF6;
  --bg:         #F0F4FF;
  --surface:    #FFFFFF;
  --border:     #E2E8F0;
  --text:       #1E293B;
  --text-muted: #64748B;
  --text-light: #94A3B8;
  --radius:     14px;
  --radius-sm:  8px;
  --shadow:     0 2px 12px rgba(0,0,0,.08);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.12);
  --nav-h:      64px;
  --bot-nav-h:  68px;
  --font:       'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Layout ──────────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top Nav */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  height: var(--nav-h);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  flex: 1;
}

.nav-logo .flag { font-size: 1.5rem; }
.nav-logo .brand-kr { color: var(--primary); font-size: 1rem; font-weight: 600; }

.nav-links {
  display: flex;
  gap: 4px;
}

.nav-links button {
  background: none;
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-links button:hover { background: var(--bg); color: var(--text); }
.nav-links button.active { background: var(--primary); color: #fff; font-weight: 600; }

/* Main content */
.main-content {
  flex: 1;
  padding: 24px 20px calc(var(--bot-nav-h) + 20px);
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

/* Bottom Nav (mobile) */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(0,0,0,.08);
  height: var(--bot-nav-h);
  padding: 8px 0 env(safe-area-inset-bottom, 0);
}

.bottom-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 100%;
}

.bnav-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.7rem;
  transition: all .2s;
  min-width: 56px;
}

.bnav-btn .bnav-icon { font-size: 1.4rem; }
.bnav-btn.active { color: var(--primary); }
.bnav-btn.active .bnav-icon { transform: scale(1.1); }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn .3s ease forwards; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.lesson-item { animation: slideUp .4s ease both; }

/* ── DASHBOARD ────────────────────────────────────────────── */
.dashboard { display: flex; flex-direction: column; gap: 20px; }

/* Hero */
.hero-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dk) 100%);
  border-radius: var(--radius);
  padding: 24px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 20px rgba(59,130,246,.35);
}

.hero-card h1 { font-size: 1.5rem; margin-bottom: 6px; }
.hero-card p  { font-size: 0.9rem; opacity: .9; line-height: 1.5; }
.hero-card p strong { color: #fff; }
.hero-flag { font-size: 3.5rem; flex-shrink: 0; }

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 10px;
  text-align: center;
  cursor: pointer;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card.stat-alert { border-color: var(--accent); background: #FFF1F2; }

.stat-icon  { font-size: 1.4rem; margin-bottom: 4px; }
.stat-value { font-size: 1.3rem; font-weight: 700; color: var(--text); }
.stat-label { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }

/* Progress */
.progress-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.progress-header { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 0.9rem; color: var(--text-muted); }
.progress-header strong { color: var(--text); }

.progress-bar-outer { height: 10px; background: var(--bg); border-radius: 99px; overflow: hidden; margin-bottom: 14px; }
.progress-bar-inner { height: 100%; background: linear-gradient(90deg, var(--primary), var(--purple)); border-radius: 99px; transition: width .5s ease; }

.week-dots { display: flex; gap: 8px; flex-wrap: wrap; }
.week-dot {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--bg);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1.1rem;
  transition: all .2s;
}
.week-dot.started { border-color: var(--amber); background: #FEF3C7; }
.week-dot.done    { border-color: var(--green); background: #D1FAE5; }
.week-dot:hover   { transform: scale(1.1); }

/* Continue card */
.continue-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  border: 2px solid var(--primary);
  box-shadow: 0 4px 16px rgba(59,130,246,.15);
  transition: all .2s;
  position: relative;
  overflow: hidden;
}
.continue-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: linear-gradient(180deg, var(--primary), var(--purple));
}
.continue-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(59,130,246,.2); }
.continue-card.completed-card { border-color: var(--green); }
.continue-card.completed-card::before { background: var(--green); }

.continue-label { font-size: 0.75rem; color: var(--primary); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.continue-week  { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 2px; }
.continue-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; }
.continue-meta  { font-size: 0.8rem; color: var(--text-muted); }
.continue-arrow { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); font-size: 1.5rem; color: var(--primary); }

/* Quick actions */
.quick-actions { background: var(--surface); border-radius: var(--radius); padding: 18px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.quick-actions h3 { font-size: 0.95rem; margin-bottom: 14px; color: var(--text-muted); font-weight: 600; }

.action-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }

.action-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 8px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 0.75rem; font-weight: 600; color: var(--text);
  transition: all .2s; position: relative;
}
.action-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); transform: translateY(-2px); }
.action-icon { font-size: 1.5rem; }
.badge { position: absolute; top: 6px; right: 6px; background: var(--accent); color: #fff; font-size: 0.6rem; font-weight: 700; border-radius: 99px; padding: 2px 5px; }

/* Vocab summary */
.vocab-summary { background: var(--surface); border-radius: var(--radius); padding: 18px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.vocab-summary h3 { font-size: 0.95rem; margin-bottom: 14px; color: var(--text-muted); font-weight: 600; }
.vocab-bars { display: flex; flex-direction: column; gap: 10px; }
.vocab-bar-row { display: flex; align-items: center; gap: 10px; }
.vb-icon { font-size: 1rem; width: 20px; }
.vb-label { font-size: 0.8rem; width: 70px; color: var(--text-muted); }
.vb-bar-outer { flex: 1; height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.vb-bar-inner { height: 100%; border-radius: 99px; transition: width .5s ease; }
.vb-count { font-size: 0.8rem; font-weight: 600; width: 30px; text-align: right; }

/* ── ROADMAP ──────────────────────────────────────────────── */
.roadmap-page { display: flex; flex-direction: column; gap: 16px; }
.page-title { font-size: 1.4rem; font-weight: 800; margin-bottom: 4px; }
.page-sub { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 4px; }

.weeks-list { display: flex; flex-direction: column; gap: 12px; }

.week-block {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.week-block.week-done { border-color: var(--green); }

.week-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; cursor: pointer; user-select: none;
  transition: background .15s;
}
.week-header:hover { background: var(--bg); }
.week-header-left { display: flex; align-items: center; gap: 14px; }
.week-emoji { font-size: 1.8rem; }
.week-num  { font-size: 0.7rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.week-title { font-size: 1rem; font-weight: 700; }
.week-header-right { display: flex; align-items: center; gap: 10px; }

.week-progress-pill { font-size: 0.75rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; }
.week-chevron { font-size: 1.2rem; transition: transform .25s; color: var(--text-muted); }
.week-chevron.open { transform: rotate(180deg); }

.week-overview { max-height: 0; overflow: hidden; transition: max-height .3s ease, padding .3s; }
.week-overview.open { max-height: 200px; padding: 0 18px 14px; }
.week-overview p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; }

.days-list { max-height: 0; overflow: hidden; transition: max-height .4s ease; }
.days-list.open { max-height: 1000px; }

.day-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
  position: relative;
}
.day-card:hover:not(.day-locked) { background: #F8FAFF; }
.day-card.day-current { background: #EFF6FF; }
.day-card.day-done { background: #F0FDF4; }
.day-card.day-locked { cursor: default; opacity: .6; }

.day-num {
  min-width: 60px; height: 36px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.7rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
}

.day-info { flex: 1; }
.day-title { font-size: 0.9rem; font-weight: 600; margin-bottom: 4px; }
.day-meta  { display: flex; gap: 10px; font-size: 0.75rem; color: var(--text-muted); }
.day-type  { background: var(--bg); padding: 1px 6px; border-radius: 4px; }
.day-arrow { color: var(--primary); font-size: 1.1rem; }
.day-lock  { font-size: 1rem; }

/* ── LESSON ───────────────────────────────────────────────── */
.lesson-page { display: flex; flex-direction: column; gap: 20px; }

.lesson-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: -8px;
}
.lesson-breadcrumb { font-size: 0.8rem; color: var(--text-muted); }

.lesson-header {
  border-radius: var(--radius);
  padding: 20px;
  background: var(--surface);
  border: 2px solid var(--primary);
  box-shadow: var(--shadow);
}
.lesson-type-badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 0.75rem; font-weight: 700; color: #fff; margin-bottom: 10px; }
.lesson-header h2 { font-size: 1.3rem; font-weight: 800; margin-bottom: 6px; }
.lesson-meta { font-size: 0.8rem; color: var(--text-muted); }

.lesson-intro {
  background: #EFF6FF;
  border-radius: var(--radius);
  padding: 16px;
  font-size: 0.9rem;
  line-height: 1.7;
  border-left: 4px solid var(--primary);
}

/* Lesson items */
.lesson-items { display: flex; flex-direction: column; gap: 12px; }

.lesson-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .15s;
}
.lesson-item:hover { transform: translateX(4px); }

/* Hangul item */
.hangul-item { border-left: 4px solid; }
.hangul-char { font-size: 2.8rem; font-weight: 700; margin-bottom: 4px; }
.hangul-label { font-size: 1rem; font-weight: 700; }
.hangul-pron  { font-size: 0.85rem; color: var(--text-muted); margin: 4px 0; }
.hangul-example { font-size: 0.85rem; background: var(--bg); padding: 4px 8px; border-radius: 4px; display: inline-block; }
.hangul-tip { font-size: 0.8rem; color: var(--purple); margin-top: 6px; }

/* Vocab item */
.vocab-korean { font-size: 1.6rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.vocab-rom    { font-size: 0.85rem; color: var(--text-muted); margin: 2px 0; }
.vocab-eng    { font-size: 0.95rem; font-weight: 600; }
.vocab-tip    { font-size: 0.8rem; color: var(--purple); margin-top: 6px; }

/* Grammar item */
.gram-main  { font-size: 1.2rem; font-weight: 700; display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.gram-label { font-size: 0.9rem; font-weight: 600; }
.gram-rom   { font-size: 0.82rem; color: var(--text-muted); margin: 2px 0; }
.gram-tip   { font-size: 0.8rem; color: var(--purple); margin-top: 6px; }

/* Conversation item */
.conversation-item { border-left: 4px solid var(--amber); }
.conv-korean { font-size: 1.2rem; font-weight: 700; display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.conv-label  { font-size: 0.92rem; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.conv-rom    { font-size: 0.82rem; color: var(--text-muted); }
.conv-tip    { font-size: 0.8rem; color: var(--purple); margin-top: 6px; }

.speak-icon { font-size: 1rem; opacity: .5; }

/* Key rules */
.key-rules {
  background: #FEF3C7;
  border-radius: var(--radius);
  padding: 16px;
  border-left: 4px solid var(--amber);
}
.key-rules h3 { font-size: 0.9rem; margin-bottom: 10px; font-weight: 700; }
.key-rules ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.key-rules li { font-size: 0.85rem; line-height: 1.6; }
.key-rules li::before { content: "→ "; color: var(--amber); font-weight: 700; }

/* Vocab preview */
.vocab-preview {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.vocab-preview h3 { font-size: 0.9rem; margin-bottom: 12px; }
.vocab-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.vocab-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 6px 12px;
  cursor: pointer;
  transition: all .2s;
  font-size: 0.85rem;
}
.vocab-chip:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip-kr { font-weight: 700; }
.chip-en { color: var(--text-muted); font-size: 0.78rem; }
.chip-speak { font-size: 0.8rem; }
.vocab-chip:hover .chip-en, .vocab-chip:hover .chip-speak { color: rgba(255,255,255,.8); }

/* Lesson actions */
.lesson-actions {
  display: flex; flex-wrap: wrap; gap: 12px;
  padding-top: 8px;
}
.completed-banner {
  width: 100%;
  background: #D1FAE5;
  color: #065F46;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}

/* ── QUIZ ─────────────────────────────────────────────────── */
.quiz-page { display: flex; flex-direction: column; gap: 20px; min-height: 60vh; }

.quiz-nav {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.85rem; color: var(--text-muted);
}
.quiz-progress { height: 6px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.quiz-progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--purple)); transition: width .4s ease; border-radius: 99px; }

.quiz-body { display: flex; flex-direction: column; gap: 18px; flex: 1; }
.quiz-week-badge { display: inline-block; padding: 3px 12px; border-radius: 99px; font-size: 0.75rem; font-weight: 700; color: #fff; align-self: flex-start; }
.quiz-question { font-size: 1.15rem; font-weight: 700; line-height: 1.5; }

.quiz-options { display: flex; flex-direction: column; gap: 10px; }

.quiz-option {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  font-size: 0.92rem;
  display: flex; align-items: center; gap: 12px;
  transition: all .15s;
}
.quiz-option:hover:not(:disabled) { border-color: var(--primary); background: #EFF6FF; }
.quiz-option.correct { border-color: var(--green); background: #D1FAE5; color: #065F46; font-weight: 600; }
.quiz-option.wrong   { border-color: var(--accent); background: #FEE2E2; color: #991B1B; }
.quiz-option:disabled { cursor: default; }

.opt-letter {
  min-width: 28px; height: 28px;
  background: var(--bg);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700;
  color: var(--text-muted);
}
.quiz-option.correct .opt-letter { background: var(--green); color: #fff; }
.quiz-option.wrong   .opt-letter { background: var(--accent); color: #fff; }

/* Quiz result */
.quiz-result {
  display: flex; flex-direction: column; align-items: center;
  gap: 14px; padding: 32px 20px; text-align: center;
}
.result-medal { font-size: 4rem; animation: bounceIn .5s ease; }
@keyframes bounceIn { 0% { transform: scale(0); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }
.result-score { font-size: 2.5rem; font-weight: 800; }
.result-pct   { font-size: 1.1rem; color: var(--text-muted); margin-top: -8px; }
.result-msg   { font-size: 1rem; font-weight: 600; color: var(--primary); }
.result-badge { background: #D1FAE5; color: #065F46; padding: 8px 16px; border-radius: 99px; font-size: 0.85rem; font-weight: 600; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; width: 100%; margin-top: 8px; }

/* ── FLASHCARDS ───────────────────────────────────────────── */
.flashcard-page { display: flex; flex-direction: column; gap: 16px; align-items: center; }

.fc-nav {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  font-size: 0.85rem; color: var(--text-muted);
}

.fc-progress-bar-outer { width: 100%; height: 6px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.fc-progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--purple)); transition: width .4s ease; border-radius: 99px; }

.fc-stats-row { display: flex; gap: 16px; font-size: 0.78rem; color: var(--text-muted); }

/* Flip card */
.fc-card {
  width: 100%; max-width: 380px;
  height: 240px;
  perspective: 1200px;
  cursor: pointer;
  position: relative;
}

.fc-front, .fc-back {
  position: absolute; inset: 0;
  border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px;
  backface-visibility: hidden;
  transition: transform .5s cubic-bezier(.4,0,.2,1);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.fc-front {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dk) 100%);
  color: #fff;
}
.fc-back  {
  background: var(--surface);
  transform: rotateY(180deg);
  border: 2px solid var(--primary);
}

.fc-card.flipped .fc-front { transform: rotateY(-180deg); }
.fc-card.flipped .fc-back  { transform: rotateY(0); }

.fc-emoji     { font-size: 2.5rem; margin-bottom: 8px; }
.fc-emoji-lg  { font-size: 1.8rem; margin-top: 8px; }
.fc-korean    { font-size: 2rem; font-weight: 800; margin-bottom: 6px; }
.fc-korean-sm { font-size: 1.5rem; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.fc-rom       { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 4px; }
.fc-english   { font-size: 1.2rem; font-weight: 600; }
.fc-hint      { font-size: 0.8rem; opacity: .7; margin-top: 6px; }

.fc-speak-btn {
  margin-top: 10px;
  background: rgba(255,255,255,.2);
  border: none; border-radius: 99px;
  padding: 5px 14px; color: #fff;
  cursor: pointer; font-size: 0.8rem;
  transition: background .15s;
}
.fc-back .fc-speak-btn { background: var(--bg); color: var(--text); }
.fc-speak-btn:hover { background: rgba(255,255,255,.35); }
.fc-back .fc-speak-btn:hover { background: var(--border); }

/* Rating */
.fc-rating {
  width: 100%; opacity: 0; pointer-events: none;
  transition: opacity .3s;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.fc-rating.visible { opacity: 1; pointer-events: all; }
.fc-rating-label { font-size: 0.85rem; color: var(--text-muted); }

.rating-btns { display: flex; gap: 10px; width: 100%; justify-content: center; }

.rating-btn {
  flex: 1; max-width: 90px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 4px;
  cursor: pointer;
  font-size: 0.78rem; font-weight: 600;
  text-align: center;
  background: var(--surface);
  transition: all .15s;
  line-height: 1.4;
}
.rating-btn small { font-weight: 400; color: var(--text-muted); }
.r-again:hover { background: #FEE2E2; border-color: var(--accent); color: var(--accent); }
.r-hard:hover  { background: #FEF3C7; border-color: var(--amber);  color: var(--amber); }
.r-good:hover  { background: #DBEAFE; border-color: var(--primary); color: var(--primary); }
.r-easy:hover  { background: #D1FAE5; border-color: var(--green);  color: var(--green); }

.fc-card-info { font-size: 0.75rem; color: var(--text-light); display: flex; gap: 12px; }

/* FC done */
.fc-done {
  display: flex; flex-direction: column; align-items: center;
  gap: 16px; padding: 40px 20px; text-align: center;
}
.fc-done-icon { font-size: 4rem; }
.fc-done h2   { font-size: 1.5rem; font-weight: 800; }
.fc-done p    { color: var(--text-muted); }
.fc-done-stats { display: flex; gap: 14px; margin: 8px 0; }
.fds-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 18px;
  font-size: 1.3rem; font-weight: 700; text-align: center;
}
.fds-card small { display: block; font-size: 0.72rem; color: var(--text-muted); font-weight: 400; margin-top: 2px; }

/* ── HANGUL REF ───────────────────────────────────────────── */
.hangul-ref { display: flex; flex-direction: column; gap: 18px; }

.hr-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.hr-tab {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 7px 16px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all .15s;
}
.hr-tab:hover { background: var(--border); }
.hr-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }

.hr-content { }
.hr-content.hidden { display: none; }
.hr-intro { font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 14px; background: #EFF6FF; padding: 10px 14px; border-radius: var(--radius-sm); }

.hangul-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.hg-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: all .2s;
  text-align: center;
}
.hg-card:hover { background: var(--primary); color: #fff; border-color: var(--primary); transform: translateY(-2px); }

.hg-char    { font-size: 2.2rem; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.hg-rom     { font-size: 0.9rem; font-weight: 700; }
.hg-sound   { font-size: 0.78rem; color: var(--text-muted); margin: 2px 0; }
.hg-example { font-size: 0.72rem; color: var(--text-light); }
.hg-card:hover .hg-char, .hg-card:hover .hg-sound, .hg-card:hover .hg-example { color: rgba(255,255,255,.85); }
.hg-card:hover .hg-rom { color: #fff; }

/* Blocks demo */
.blocks-demo { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
.block-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px; text-align: center;
}
.block-title { font-weight: 700; font-size: 0.9rem; margin-bottom: 4px; }
.block-desc  { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 10px; }

.bd {
  font-size: 2rem; font-weight: 700; color: var(--primary);
  display: inline-flex; align-items: center; border: 2px solid var(--primary);
  border-radius: 8px; padding: 6px 10px; gap: 2px; margin: 8px 0;
}
.bd span { color: var(--accent); }
.bd.col  { flex-direction: column; gap: 0; }
.bd.stacked { flex-direction: column; }
.bd sub   { font-size: 1.5rem; color: var(--green); }

.block-example { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }

/* Practice words */
.practice-words h3 { font-size: 0.95rem; margin-bottom: 10px; }
.pw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.pw-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  transition: all .15s;
  display: flex; flex-direction: column; gap: 2px;
}
.pw-card:hover { background: var(--primary); color: #fff; }
.pw-kr   { font-size: 1.1rem; font-weight: 700; color: var(--primary); }
.pw-rom  { font-size: 0.75rem; color: var(--text-muted); }
.pw-en   { font-size: 0.8rem; font-weight: 600; }
.pw-speak { font-size: 0.8rem; opacity: .4; }
.pw-card:hover .pw-kr, .pw-card:hover .pw-rom, .pw-card:hover .pw-speak { color: rgba(255,255,255,.85); }
.pw-card:hover .pw-en { color: #fff; }

.hangul-tip-box {
  background: #EFF6FF;
  border-radius: var(--radius);
  padding: 14px;
  font-size: 0.85rem;
  line-height: 1.6;
  border-left: 4px solid var(--primary);
}

/* ── MODAL / PHRASE BOOK ──────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.5);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn .2s ease;
}

.modal-box {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%; max-width: 600px;
  max-height: 80vh;
  display: flex; flex-direction: column;
  animation: slideUp .25s ease;
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-header button {
  background: var(--bg); border: none; cursor: pointer;
  font-size: 1.1rem; width: 32px; height: 32px;
  border-radius: 50%; transition: background .15s;
}
.modal-header button:hover { background: var(--border); }

.modal-tabs {
  display: flex; gap: 6px; padding: 12px 14px;
  overflow-x: auto; border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.modal-tabs::-webkit-scrollbar { display: none; }

.mtab {
  white-space: nowrap;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 99px; padding: 5px 12px;
  cursor: pointer; font-size: 0.8rem;
  transition: all .15s; flex-shrink: 0;
}
.mtab:hover  { background: var(--border); }
.mtab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.phrase-list { overflow-y: auto; flex: 1; padding: 8px 0; }

.phrase-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .1s;
}
.phrase-row:hover { background: var(--bg); }
.pr-left  { flex: 1; }
.pr-kr    { font-size: 1rem; font-weight: 700; margin-bottom: 2px; }
.pr-rom   { font-size: 0.75rem; color: var(--text-muted); }
.pr-right { display: flex; align-items: center; gap: 8px; }
.pr-en    { font-size: 0.85rem; font-weight: 500; text-align: right; }
.pr-speak { font-size: 1rem; opacity: .4; }

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 13px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  flex: 1;
}
.btn-primary:hover { background: var(--primary-dk); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(59,130,246,.35); }

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  flex: 1;
}
.btn-secondary:hover { background: var(--border); }

.btn-ghost {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--primary);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background .15s;
}
.btn-ghost:hover { background: #EFF6FF; }

.mt-2 { margin-top: 8px; }

/* ── TOAST ────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--bot-nav-h) + 16px);
  left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1E293B;
  color: #fff;
  padding: 10px 20px;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 300;
  opacity: 0;
  transition: all .3s;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.toast-warning { background: var(--amber); }
.toast.toast-success { background: var(--green); }
.toast.toast-error   { background: var(--accent); }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 640px) {
  .nav-links { display: none; }
  .bottom-nav { display: block; }

  .stats-grid    { grid-template-columns: repeat(2, 1fr); }
  .action-grid   { grid-template-columns: repeat(2, 1fr); }
  .blocks-demo   { grid-template-columns: 1fr; }
  .hangul-grid   { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }

  .continue-arrow { display: none; }

  .main-content { padding: 16px 14px calc(var(--bot-nav-h) + 16px); }

  .fc-card { height: 210px; }
  .fc-korean { font-size: 1.7rem; }
}

@media (max-width: 380px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .lesson-actions { flex-direction: column; }
  .result-actions { flex-direction: column; }
}

/* Utilities */
.hidden { display: none !important; }
