/* ============================================================
   KOREANPATH — Modern Redesign
   Clean, premium, dark-accented web app feel
   ============================================================ */

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

:root {
  --primary:    #5B6EF5;
  --primary-dk: #3D52E0;
  --primary-lt: #7C8FF7;
  --accent:     #F0544F;
  --green:      #22C55E;
  --amber:      #F59E0B;
  --purple:     #9B6EFF;
  --pink:       #F472B6;

  --bg:         #F7F8FF;
  --bg2:        #EEF0FD;
  --surface:    #FFFFFF;
  --surface2:   #FAFBFF;
  --border:     rgba(91,110,245,.12);
  --border-md:  rgba(91,110,245,.2);

  --text:       #11142D;
  --text-muted: #6B7280;
  --text-light: #A0A8BC;

  --radius:     18px;
  --radius-sm:  10px;
  --radius-xs:  6px;
  --radius-xl:  24px;

  --shadow-xs:  0 1px 4px rgba(17,20,45,.06);
  --shadow:     0 4px 20px rgba(17,20,45,.08), 0 1px 4px rgba(17,20,45,.04);
  --shadow-md:  0 8px 32px rgba(17,20,45,.12), 0 2px 8px rgba(17,20,45,.06);
  --shadow-lg:  0 16px 48px rgba(17,20,45,.16), 0 4px 16px rgba(17,20,45,.08);
  --shadow-clr: 0 8px 24px rgba(91,110,245,.3);

  --nav-h:      66px;
  --bot-nav-h:  72px;
  --font: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', 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;
  -webkit-font-smoothing: antialiased;
}

/* ── LAYOUT ─────────────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

/* ── TOP NAV ─────────────────────────────────────────────────── */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
}

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

.nav-logo .flag { font-size: 1.5rem; }
.nav-logo .brand-kr {
  background: linear-gradient(135deg, var(--primary), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 0.95rem;
  font-weight: 700;
}

.nav-links {
  display: flex;
  gap: 2px;
  background: var(--bg2);
  padding: 4px;
  border-radius: var(--radius-sm);
}

.nav-links button {
  background: none;
  border: none;
  padding: 7px 14px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all .2s;
}
.nav-links button:hover { color: var(--text); background: var(--surface); }
.nav-links button.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-xs);
}

/* ── MAIN CONTENT ─────────────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: 28px 24px calc(var(--bot-nav-h) + 24px);
  max-width: 740px;
  margin: 0 auto;
  width: 100%;
}

/* ── BOTTOM NAV ─────────────────────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 32px rgba(17,20,45,.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: 3px;
  padding: 4px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-light);
  font-size: 0.68rem;
  font-weight: 600;
  transition: all .2s;
  min-width: 60px;
}

.bnav-btn .bnav-icon { font-size: 1.45rem; transition: transform .2s; }
.bnav-btn.active { color: var(--primary); }
.bnav-btn.active .bnav-icon { transform: scale(1.15); }

/* ── ANIMATIONS ─────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes bounceIn { 0% { transform: scale(0.5); opacity:0; } 70% { transform: scale(1.15); } 100% { transform: scale(1); opacity:1; } }
@keyframes shimmer { 0%,100% { opacity:.5; } 50% { opacity:1; } }

.fade-in { animation: fadeIn .35s cubic-bezier(.22,.61,.36,1) forwards; }
.lesson-item { animation: slideUp .4s cubic-bezier(.22,.61,.36,1) both; }

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

/* Hero */
.hero-card {
  background: linear-gradient(135deg, #4F5FE8 0%, #7C3AED 60%, #9B6EFF 100%);
  border-radius: var(--radius-xl);
  padding: 28px 28px 26px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 12px 40px rgba(79,95,232,.4);
  position: relative;
  overflow: hidden;
}
.hero-card::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  background: rgba(255,255,255,.08);
  border-radius: 50%;
}
.hero-card::after {
  content: '';
  position: absolute;
  bottom: -20px; left: 40%;
  width: 100px; height: 100px;
  background: rgba(255,255,255,.06);
  border-radius: 50%;
}

.hero-card h1 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: -.4px;
  line-height: 1.2;
}
.hero-card p  { font-size: 0.9rem; opacity: .85; line-height: 1.55; }
.hero-card p strong { color: #fff; font-weight: 700; }
.hero-flag {
  font-size: 3.8rem;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.2));
  animation: shimmer 3s ease-in-out infinite;
}

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

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 10px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--purple));
  opacity: 0;
  transition: opacity .2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card:hover::after { opacity: 1; }
.stat-card.stat-alert {
  background: linear-gradient(135deg, #FFF1F2, #FFF5F5);
  box-shadow: 0 4px 20px rgba(240,84,79,.12);
}
.stat-card.stat-alert::after { background: var(--accent); opacity: 1; }

.stat-icon  { font-size: 1.5rem; margin-bottom: 6px; }
.stat-value { font-size: 1.4rem; font-weight: 800; color: var(--text); letter-spacing: -.5px; }
.stat-label { font-size: 0.68rem; color: var(--text-muted); margin-top: 3px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }

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

.progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  align-items: center;
}
.progress-header strong { font-size: 0.95rem; font-weight: 700; color: var(--text); }
.progress-header span {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
  background: rgba(91,110,245,.1);
  padding: 2px 10px;
  border-radius: 99px;
}

.progress-bar-outer {
  height: 8px;
  background: var(--bg2);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 16px;
}
.progress-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--purple));
  border-radius: 99px;
  transition: width .6s cubic-bezier(.22,.61,.36,1);
}

.week-dots { display: flex; gap: 8px; flex-wrap: wrap; }
.week-dot {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: var(--bg2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1.1rem;
  transition: all .2s;
  box-shadow: var(--shadow-xs);
}
.week-dot.started { background: #FEF3C7; box-shadow: 0 2px 8px rgba(245,158,11,.2); }
.week-dot.done    { background: linear-gradient(135deg, #D1FAE5, #A7F3D0); box-shadow: 0 2px 8px rgba(34,197,94,.2); }
.week-dot:hover   { transform: scale(1.12) rotate(5deg); box-shadow: var(--shadow-md); }

/* Continue card */
.continue-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 24px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all .25s cubic-bezier(.22,.61,.36,1);
  position: relative;
  overflow: hidden;
  border-left: 4px solid var(--primary);
}
.continue-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(91,110,245,.03), transparent);
  pointer-events: none;
}
.continue-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(91,110,245,.15);
}
.continue-card.completed-card { border-left-color: var(--green); }
.continue-card.completed-card::before { background: linear-gradient(135deg, rgba(34,197,94,.04), transparent); }

.continue-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--primary);
  margin-bottom: 4px;
  display: flex; align-items: center; gap: 5px;
}
.continue-week  { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 3px; }
.continue-title { font-size: 1.1rem; font-weight: 800; margin-bottom: 5px; letter-spacing: -.2px; }
.continue-meta  { font-size: 0.78rem; color: var(--text-muted); }
.continue-arrow {
  position: absolute;
  right: 20px; top: 50%;
  transform: translateY(-50%);
  font-size: 1.3rem;
  color: var(--primary);
  background: rgba(91,110,245,.1);
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* Quick actions */
.quick-actions {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.quick-actions h3 {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

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

.action-btn {
  background: var(--bg2);
  border: none;
  border-radius: var(--radius-sm);
  padding: 16px 8px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  font-size: 0.73rem; font-weight: 700; color: var(--text-muted);
  transition: all .2s;
  position: relative;
}
.action-btn:hover {
  background: linear-gradient(135deg, var(--primary), var(--primary-dk));
  color: #fff;
  transform: translateY(-3px);
  box-shadow: var(--shadow-clr);
}
.action-icon { font-size: 1.6rem; }
.badge {
  position: absolute;
  top: 8px; right: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.6rem; font-weight: 800;
  border-radius: 99px;
  padding: 2px 6px;
  box-shadow: 0 2px 6px rgba(240,84,79,.4);
}

/* Vocab summary */
.vocab-summary { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.vocab-summary h3 {
  font-size: 0.78rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .8px;
  color: var(--text-muted); margin-bottom: 16px;
}
.vocab-bars { display: flex; flex-direction: column; gap: 12px; }
.vocab-bar-row { display: flex; align-items: center; gap: 10px; }
.vb-icon { font-size: 1rem; width: 20px; }
.vb-label { font-size: 0.8rem; font-weight: 600; width: 70px; color: var(--text-muted); }
.vb-bar-outer { flex: 1; height: 7px; background: var(--bg2); border-radius: 99px; overflow: hidden; }
.vb-bar-inner { height: 100%; border-radius: 99px; transition: width .6s cubic-bezier(.22,.61,.36,1); }
.vb-count { font-size: 0.82rem; font-weight: 700; width: 30px; text-align: right; color: var(--text); }

/* ── ROADMAP ─────────────────────────────────────────────────── */
.roadmap-page { display: flex; flex-direction: column; gap: 18px; }
.page-title { font-size: 1.6rem; font-weight: 900; letter-spacing: -.5px; margin-bottom: 2px; }
.page-sub { font-size: 0.88rem; color: var(--text-muted); line-height: 1.5; }

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

.week-block {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow .2s;
}
.week-block:hover { box-shadow: var(--shadow-md); }
.week-block.week-done { box-shadow: 0 4px 20px rgba(34,197,94,.1); }

.week-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; 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.9rem; }
.week-num  { font-size: 0.68rem; color: var(--text-light); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.week-title { font-size: 1rem; font-weight: 800; letter-spacing: -.2px; }
.week-header-right { display: flex; align-items: center; gap: 10px; }

.week-progress-pill {
  font-size: 0.72rem; font-weight: 800;
  padding: 3px 10px;
  border-radius: 99px;
  letter-spacing: .2px;
}
.week-chevron { font-size: 1.1rem; transition: transform .25s; color: var(--text-light); }
.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 20px 14px; }
.week-overview p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.65; }

.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 20px;
  border-top: 1px solid rgba(17,20,45,.05);
  cursor: pointer;
  transition: background .15s;
  position: relative;
}
.day-card:hover:not(.day-locked) { background: var(--bg); }
.day-card.day-current { background: rgba(91,110,245,.04); }
.day-card.day-done    { background: rgba(34,197,94,.04); }
.day-card.day-locked  { cursor: default; opacity: .5; }

.day-num {
  min-width: 58px; height: 36px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.7rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  letter-spacing: .2px;
}
.day-info { flex: 1; }
.day-title { font-size: 0.9rem; font-weight: 700; margin-bottom: 4px; }
.day-meta  { display: flex; gap: 8px; font-size: 0.73rem; color: var(--text-muted); }
.day-type  { background: var(--bg2); padding: 1px 7px; border-radius: 4px; font-weight: 600; }
.day-arrow { color: var(--primary); font-size: 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: -6px;
}
.lesson-breadcrumb { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }

.lesson-header {
  border-radius: var(--radius);
  padding: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
  border-top: 4px solid var(--primary);
}
.lesson-type-badge {
  display: inline-flex; align-items: center;
  padding: 4px 12px; border-radius: 99px;
  font-size: 0.72rem; font-weight: 800; color: #fff;
  margin-bottom: 12px; letter-spacing: .4px; text-transform: uppercase;
}
.lesson-header h2 { font-size: 1.4rem; font-weight: 900; margin-bottom: 6px; letter-spacing: -.4px; }
.lesson-meta { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }

.lesson-intro {
  background: linear-gradient(135deg, rgba(91,110,245,.06), rgba(155,110,255,.06));
  border-radius: var(--radius);
  padding: 18px 20px;
  font-size: 0.9rem;
  line-height: 1.7;
  border-left: 4px solid var(--primary);
  color: var(--text-muted);
}

.lesson-items { display: flex; flex-direction: column; gap: 10px; }

.lesson-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: all .2s;
  border: 1px solid transparent;
}
.lesson-item:hover {
  transform: translateX(5px);
  box-shadow: var(--shadow-md);
  border-color: rgba(91,110,245,.15);
}

.hangul-item { border-left: 4px solid; }
.hangul-char { font-size: 2.9rem; font-weight: 900; margin-bottom: 4px; }
.hangul-label { font-size: 1rem; font-weight: 800; }
.hangul-pron  { font-size: 0.85rem; color: var(--text-muted); margin: 4px 0; }
.hangul-example { font-size: 0.85rem; background: var(--bg2); padding: 4px 10px; border-radius: 6px; display: inline-block; }
.hangul-tip { font-size: 0.8rem; color: var(--purple); margin-top: 6px; font-style: italic; }

.vocab-korean { font-size: 1.6rem; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.vocab-rom    { font-size: 0.85rem; color: var(--text-muted); margin: 3px 0; }
.vocab-eng    { font-size: 0.95rem; font-weight: 700; }
.vocab-tip    { font-size: 0.8rem; color: var(--purple); margin-top: 6px; font-style: italic; }

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

.conversation-item { border-left: 4px solid var(--amber); }
.conv-korean { font-size: 1.2rem; font-weight: 800; display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.conv-label  { font-size: 0.92rem; font-weight: 700; 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; font-style: italic; }

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

.key-rules {
  background: linear-gradient(135deg, #FFFBEB, #FEF3C7);
  border-radius: var(--radius);
  padding: 18px 20px;
  border-left: 4px solid var(--amber);
}
.key-rules h3 { font-size: 0.9rem; margin-bottom: 10px; font-weight: 800; }
.key-rules ul { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.key-rules li { font-size: 0.85rem; line-height: 1.65; }
.key-rules li::before { content: "→ "; color: var(--amber); font-weight: 800; }

.vocab-preview { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-xs); }
.vocab-preview h3 { font-size: 0.85rem; font-weight: 700; margin-bottom: 12px; }
.vocab-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.vocab-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg2);
  border: 1px solid transparent;
  border-radius: 99px;
  padding: 7px 14px;
  cursor: pointer;
  transition: all .2s;
  font-size: 0.85rem;
}
.vocab-chip:hover {
  background: linear-gradient(135deg, var(--primary), var(--primary-dk));
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-clr);
}
.chip-kr { font-weight: 800; }
.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 { display: flex; flex-wrap: wrap; gap: 12px; padding-top: 8px; }

.completed-banner {
  width: 100%;
  background: linear-gradient(135deg, #D1FAE5, #A7F3D0);
  color: #065F46;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.9rem; font-weight: 700;
  text-align: center;
}

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

.quiz-nav {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.85rem; color: var(--text-muted); font-weight: 500;
}
.quiz-progress { height: 6px; background: var(--bg2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.quiz-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--purple));
  transition: width .4s cubic-bezier(.22,.61,.36,1);
  border-radius: 99px;
}

.quiz-body { display: flex; flex-direction: column; gap: 18px; flex: 1; }
.quiz-week-badge {
  display: inline-flex; align-items: center;
  padding: 4px 14px; border-radius: 99px;
  font-size: 0.72rem; font-weight: 800; color: #fff;
  align-self: flex-start; text-transform: uppercase; letter-spacing: .4px;
}
.quiz-question { font-size: 1.2rem; font-weight: 800; line-height: 1.5; letter-spacing: -.3px; }

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

.quiz-option {
  background: var(--surface);
  border: 2px solid rgba(17,20,45,.08);
  border-radius: var(--radius);
  padding: 15px 18px;
  text-align: left;
  cursor: pointer;
  font-size: 0.92rem; font-weight: 500;
  display: flex; align-items: center; gap: 12px;
  transition: all .18s;
  box-shadow: var(--shadow-xs);
}
.quiz-option:hover:not(:disabled) {
  border-color: var(--primary);
  background: rgba(91,110,245,.04);
  transform: translateX(4px);
}
.quiz-option.correct { border-color: var(--green); background: rgba(34,197,94,.06); color: #065F46; font-weight: 700; }
.quiz-option.wrong   { border-color: var(--accent); background: rgba(240,84,79,.06); color: #991B1B; }
.quiz-option:disabled { cursor: default; }

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

.quiz-result {
  display: flex; flex-direction: column; align-items: center;
  gap: 16px; padding: 36px 20px; text-align: center;
}
.result-medal { font-size: 4.5rem; animation: bounceIn .6s cubic-bezier(.22,.61,.36,1); }
.result-score { font-size: 2.8rem; font-weight: 900; letter-spacing: -1px; }
.result-pct   { font-size: 1.1rem; color: var(--text-muted); margin-top: -10px; }
.result-msg   {
  font-size: 1rem; font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.result-badge { background: linear-gradient(135deg, #D1FAE5, #A7F3D0); color: #065F46; padding: 8px 18px; border-radius: 99px; font-size: 0.85rem; font-weight: 700; }
.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: 18px; align-items: center; }

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

.fc-progress-bar-outer { width: 100%; height: 5px; background: var(--bg2); 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: 18px; font-size: 0.78rem; color: var(--text-muted); font-weight: 600; }

/* Flip card */
.fc-card {
  width: 100%; max-width: 400px;
  height: 250px;
  perspective: 1400px;
  cursor: pointer;
  position: relative;
}

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

.fc-front {
  background: linear-gradient(135deg, #4F5FE8 0%, #7C3AED 100%);
  color: #fff;
  box-shadow: 0 16px 48px rgba(79,95,232,.35);
}
.fc-back  {
  background: var(--surface);
  transform: rotateY(180deg);
  box-shadow: var(--shadow-lg);
}

.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: 2.2rem; font-weight: 900; margin-bottom: 6px; letter-spacing: -1px; }
.fc-korean-sm { font-size: 1.6rem; font-weight: 800; color: var(--primary); margin-bottom: 4px; }
.fc-rom       { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 4px; }
.fc-english   { font-size: 1.25rem; font-weight: 700; }
.fc-hint      { font-size: 0.8rem; opacity: .6; margin-top: 6px; }

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

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

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

.rating-btn {
  flex: 1; max-width: 88px;
  border: 2px solid rgba(17,20,45,.08);
  border-radius: var(--radius);
  padding: 11px 4px;
  cursor: pointer;
  font-size: 0.78rem; font-weight: 700;
  text-align: center;
  background: var(--surface);
  transition: all .18s;
  line-height: 1.4;
  box-shadow: var(--shadow-xs);
}
.rating-btn small { font-weight: 400; color: var(--text-muted); }
.r-again:hover { background: linear-gradient(135deg, #FEE2E2, #FECACA); border-color: var(--accent); color: var(--accent); box-shadow: 0 4px 12px rgba(240,84,79,.2); }
.r-hard:hover  { background: linear-gradient(135deg, #FEF3C7, #FDE68A); border-color: var(--amber);  color: #92400E; box-shadow: 0 4px 12px rgba(245,158,11,.2); }
.r-good:hover  { background: linear-gradient(135deg, #DBEAFE, #BFDBFE); border-color: var(--primary); color: var(--primary-dk); box-shadow: 0 4px 12px rgba(91,110,245,.2); }
.r-easy:hover  { background: linear-gradient(135deg, #D1FAE5, #A7F3D0); border-color: var(--green);  color: #065F46; box-shadow: 0 4px 12px rgba(34,197,94,.2); }

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

/* FC done */
.fc-done {
  display: flex; flex-direction: column; align-items: center;
  gap: 16px; padding: 44px 20px; text-align: center;
}
.fc-done-icon { font-size: 4.5rem; }
.fc-done h2   { font-size: 1.6rem; font-weight: 900; letter-spacing: -.5px; }
.fc-done p    { color: var(--text-muted); font-size: 0.95rem; }
.fc-done-stats { display: flex; gap: 14px; margin: 8px 0; }
.fds-card {
  background: var(--surface);
  box-shadow: var(--shadow);
  border-radius: var(--radius); padding: 16px 20px;
  font-size: 1.4rem; font-weight: 900; text-align: center; letter-spacing: -.5px;
}
.fds-card small { display: block; font-size: 0.72rem; color: var(--text-muted); font-weight: 600; margin-top: 3px; text-transform: uppercase; letter-spacing: .4px; }

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

.hr-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.hr-tab {
  background: var(--bg2);
  border: none;
  border-radius: 99px;
  padding: 8px 18px;
  cursor: pointer;
  font-size: 0.85rem; font-weight: 700;
  color: var(--text-muted);
  transition: all .18s;
}
.hr-tab:hover { background: var(--border-md); color: var(--text); }
.hr-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dk));
  color: #fff;
  box-shadow: var(--shadow-clr);
}

.hr-content.hidden { display: none; }
.hr-intro {
  font-size: 0.85rem; color: var(--text-muted); line-height: 1.65;
  margin-bottom: 16px;
  background: linear-gradient(135deg, rgba(91,110,245,.06), rgba(155,110,255,.06));
  padding: 12px 16px; border-radius: var(--radius-sm);
  border-left: 4px solid var(--primary);
}

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

.hg-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all .2s;
  text-align: center;
  box-shadow: var(--shadow-xs);
}
.hg-card:hover {
  background: linear-gradient(135deg, var(--primary), var(--primary-dk));
  color: #fff;
  transform: translateY(-3px);
  box-shadow: var(--shadow-clr);
}

.hg-char    { font-size: 2.4rem; font-weight: 900; color: var(--primary); margin-bottom: 4px; }
.hg-rom     { font-size: 0.92rem; font-weight: 800; }
.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,.8); }
.hg-card:hover .hg-rom { color: #fff; }

.blocks-demo { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
.block-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 18px; text-align: center; box-shadow: var(--shadow-xs);
}
.block-title { font-weight: 800; 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: 800; color: var(--primary);
  display: inline-flex; align-items: center; border: 2px solid rgba(91,110,245,.3);
  border-radius: 10px; padding: 6px 10px; gap: 2px; margin: 8px 0;
  background: rgba(91,110,245,.04);
}
.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 h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 12px; }
.pw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.pw-card {
  background: var(--surface); box-shadow: var(--shadow-xs);
  border-radius: var(--radius-sm); padding: 12px;
  cursor: pointer; transition: all .18s;
  display: flex; flex-direction: column; gap: 2px;
}
.pw-card:hover {
  background: linear-gradient(135deg, var(--primary), var(--primary-dk));
  color: #fff; transform: translateY(-2px);
  box-shadow: var(--shadow-clr);
}
.pw-kr   { font-size: 1.1rem; font-weight: 800; color: var(--primary); }
.pw-rom  { font-size: 0.75rem; color: var(--text-muted); }
.pw-en   { font-size: 0.8rem; font-weight: 700; }
.pw-speak { font-size: 0.8rem; opacity: .35; }
.pw-card:hover .pw-kr, .pw-card:hover .pw-rom, .pw-card:hover .pw-speak { color: rgba(255,255,255,.8); }
.pw-card:hover .pw-en { color: #fff; }

.hangul-tip-box {
  background: linear-gradient(135deg, rgba(91,110,245,.06), rgba(155,110,255,.06));
  border-radius: var(--radius);
  padding: 16px 18px;
  font-size: 0.85rem; line-height: 1.65;
  border-left: 4px solid var(--primary);
}

/* ── MODAL / PHRASE BOOK ─────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(11,14,45,.55);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn .2s ease;
}

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%; max-width: 620px;
  max-height: 82vh;
  display: flex; flex-direction: column;
  animation: slideUp .28s cubic-bezier(.22,.61,.36,1);
  box-shadow: 0 -12px 48px rgba(17,20,45,.2);
}

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

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

.mtab {
  white-space: nowrap;
  background: var(--bg2); border: none;
  border-radius: 99px; padding: 6px 14px;
  cursor: pointer; font-size: 0.8rem; font-weight: 700;
  color: var(--text-muted);
  transition: all .15s; flex-shrink: 0;
}
.mtab:hover  { background: var(--border-md); color: var(--text); }
.mtab.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dk));
  color: #fff;
  box-shadow: 0 2px 8px rgba(91,110,245,.3);
}

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

.phrase-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 22px;
  border-bottom: 1px solid rgba(17,20,45,.04);
  cursor: pointer; transition: background .1s;
}
.phrase-row:hover { background: var(--bg); }
.pr-left  { flex: 1; }
.pr-kr    { font-size: 1rem; font-weight: 800; 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: 600; text-align: right; }
.pr-speak { font-size: 1rem; opacity: .35; }

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dk));
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 14px 26px;
  font-size: 0.95rem; font-weight: 700;
  cursor: pointer;
  transition: all .22s;
  flex: 1;
  box-shadow: 0 4px 14px rgba(91,110,245,.3);
  letter-spacing: -.1px;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(91,110,245,.4);
  background: linear-gradient(135deg, var(--primary-lt), var(--primary));
}

.btn-secondary {
  background: var(--bg2);
  color: var(--text);
  border: none;
  border-radius: var(--radius);
  padding: 14px 26px;
  font-size: 0.95rem; font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  flex: 1;
}
.btn-secondary:hover { background: var(--bg); transform: translateY(-1px); box-shadow: var(--shadow); }

.btn-ghost {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem; font-weight: 700;
  color: var(--primary);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background .15s;
}
.btn-ghost:hover { background: rgba(91,110,245,.08); }

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

/* ── TOAST ───────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--bot-nav-h) + 18px);
  left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: #fff;
  padding: 11px 22px;
  border-radius: 99px;
  font-size: 0.85rem; font-weight: 600;
  z-index: 300;
  opacity: 0;
  transition: all .3s cubic-bezier(.22,.61,.36,1);
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
  letter-spacing: -.1px;
}
.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 16px calc(var(--bot-nav-h) + 16px); }
  .fc-card { height: 220px; }
  .fc-korean { font-size: 1.8rem; }
  .hero-card h1 { font-size: 1.35rem; }
  .hero-flag { font-size: 3rem; }
}

@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; }
