/* ═══════════════════════════════════════════
   KreyoMind — Professional Design v2
═══════════════════════════════════════════ */

/* ── VARIABLES ── */
:root {
  /* Brand */
  --brand:         #6366F1;
  --brand-dark:    #4F46E5;
  --brand-lt:      #EEF2FF;
  --brand-grad:    linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);

  /* Semantic */
  --success:       #10B981;
  --success-lt:    #ECFDF5;
  --danger:        #F43F5E;
  --danger-lt:     #FFF1F2;
  --gold:          #F59E0B;
  --gold-lt:       #FFFBEB;
  --purple:        #8B5CF6;

  /* Neutrals */
  --bg:            #F5F7FF;
  --card:          #FFFFFF;
  --border:        #E8EAFF;
  --border-2:      #F0F2FF;
  --text:          #0F172A;
  --text-2:        #334155;
  --muted:         #64748B;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(99,102,241,0.06);
  --shadow-sm: 0 2px 8px rgba(99,102,241,0.08), 0 1px 3px rgba(0,0,0,0.04);
  --shadow:    0 4px 20px rgba(99,102,241,0.12), 0 2px 6px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 40px rgba(99,102,241,0.18), 0 4px 12px rgba(0,0,0,0.08);

  /* Radius */
  --r-sm:  8px;
  --r:     14px;
  --r-lg:  18px;
  --r-xl:  22px;

  /* Level colors */
  --c-a1: #6366F1;
  --c-a2: #059669;
  --c-b1: #8B5CF6;
  --c-b2: #D97706;
  --c-c1: #E11D48;
}

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

html, body {
  height: 100%;
  font-family: 'Poppins', sans-serif;
  color: var(--text);
  background: var(--bg);
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

/* Subtle dot-grid bg */
body {
  background-image: radial-gradient(circle, rgba(99,102,241,0.07) 1px, transparent 1px);
  background-size: 28px 28px;
  background-color: var(--bg);
}

#app {
  max-width: 480px;
  margin: 0 auto;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg);
}

/* ── HEADER ── */
.hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-xs);
}

.hdr-logo { display: flex; align-items: center; gap: 8px; }

.logo-mark {
  width: 34px;
  height: 34px;
  background: var(--brand-grad);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 17px;
  font-weight: 900;
  box-shadow: 0 4px 12px rgba(99,102,241,0.4);
  flex-shrink: 0;
}

.logo-text {
  font-size: 19px;
  font-weight: 800;
  background: var(--brand-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}

.hdr-stats { display: flex; gap: 6px; align-items: center; }

.chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1px;
}
.chip-fire  { background: #FFF3E0; color: #E65100; border: 1px solid #FFCC80; }
.chip-xp    { background: #FFFDE7; color: #F57F17; border: 1px solid #FFF176; }
.chip-coin  { background: var(--brand-lt); color: var(--brand-dark); border: 1px solid #C7D2FE; }

/* ── MAIN ── */
#main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 80px;
  scroll-behavior: smooth;
}
#main::-webkit-scrollbar { width: 3px; }
#main::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

/* ── PAGES ── */
.page { display: none; padding: 16px; }
.page.show { display: block; animation: fadeIn 0.2s ease; }

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

.section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin: 20px 0 10px;
}

/* ── PAGE TOP ── */
.page-top { margin-bottom: 16px; }
.page-top h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
  letter-spacing: -0.4px;
}

/* ═══════════════════════════════════
   HOME PAGE
═══════════════════════════════════ */

/* Hero */
.hero {
  background: var(--brand-grad);
  border-radius: var(--r-xl);
  padding: 22px 20px;
  color: white;
  position: relative;
  overflow: hidden;
  margin-bottom: 14px;
  box-shadow: 0 8px 32px rgba(99,102,241,0.35);
}
.hero::before {
  content: '';
  position: absolute;
  top: -50px; right: -50px;
  width: 180px; height: 180px;
  background: rgba(255,255,255,0.07);
  border-radius: 50%;
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -70px; right: 20px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
  pointer-events: none;
}

.hero-text { position: relative; z-index: 1; }
.hero-text h2 {
  font-size: 21px;
  font-weight: 800;
  margin-bottom: 3px;
  letter-spacing: -0.3px;
}
.hero-text p { font-size: 13px; opacity: 0.85; font-weight: 500; }

.streak-circle {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 74px;
  height: 74px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  backdrop-filter: blur(4px);
  flex-shrink: 0;
}
.sc-emoji { font-size: 22px; line-height: 1; }
.sc-num   { font-size: 20px; font-weight: 900; line-height: 1.1; }
.sc-lbl   { font-size: 10px; opacity: 0.8; font-weight: 600; }

/* Daily Goal */
.daily-box {
  background: var(--card);
  border-radius: var(--r);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-2);
  margin-bottom: 4px;
}
.db-top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}
.db-pct { color: var(--brand); font-weight: 700; }

.pbar {
  height: 8px;
  background: var(--brand-lt);
  border-radius: 999px;
  overflow: hidden;
}
.pbar-fill {
  height: 100%;
  background: var(--brand-grad);
  border-radius: 999px;
  transition: width 1s cubic-bezier(.4,0,.2,1);
}

/* Continue Card */
.continue-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-2);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.continue-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--brand-grad);
  border-radius: 4px 0 0 4px;
}
.continue-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.cc-icon {
  font-size: 34px;
  width: 52px;
  height: 52px;
  background: var(--brand-lt);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cc-body  { flex: 1; min-width: 0; }
.cc-tag   { font-size: 10px; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 2px; }
.cc-title { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-sub   { font-size: 11px; color: var(--muted); font-weight: 500; margin-bottom: 7px; }
.cc-bar   { height: 5px; background: var(--border); border-radius: 999px; overflow: hidden; }
.ccb-fill { height: 100%; background: linear-gradient(90deg, var(--success), #34D399); border-radius: 999px; }

.play-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--brand-grad);
  color: white;
  border: none;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(99,102,241,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, box-shadow 0.15s;
}
.play-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(99,102,241,0.5);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.sg-card {
  background: var(--card);
  border-radius: var(--r);
  padding: 14px 8px;
  text-align: center;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border-2);
  transition: transform 0.15s;
}
.sg-card:hover { transform: translateY(-2px); }
.sg-icon { font-size: 20px; margin-bottom: 5px; }
.sg-val  { font-size: 17px; font-weight: 800; color: var(--text); letter-spacing: -0.3px; }
.sg-lbl  { font-size: 10px; color: var(--muted); font-weight: 600; margin-top: 1px; }

/* Quick Buttons */
.quick-row { display: flex; gap: 10px; margin-top: 4px; }

.qbtn {
  flex: 1;
  padding: 13px 10px;
  border-radius: var(--r);
  border: none;
  background: var(--brand-grad);
  color: white;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 14px rgba(99,102,241,0.3);
}
.qbtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99,102,241,0.4);
}
.qbtn-outline {
  background: var(--card);
  color: var(--brand);
  border: 2px solid #C7D2FE;
  box-shadow: var(--shadow-xs);
}
.qbtn-outline:hover {
  background: var(--brand-lt);
  box-shadow: var(--shadow-sm);
}

/* Proverb */
.proverb-box {
  background: linear-gradient(135deg, #1E1B4B 0%, #312E81 100%);
  border-radius: var(--r-lg);
  padding: 18px 16px;
  color: white;
  margin-top: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(30,27,75,0.3);
}
.proverb-box::after {
  content: '"';
  position: absolute;
  right: 12px; top: -10px;
  font-size: 80px;
  opacity: 0.06;
  font-family: Georgia, serif;
  line-height: 1;
  pointer-events: none;
}
.proverb-label { font-size: 10px; font-weight: 700; opacity: 0.6; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.proverb-text  { font-size: 14px; font-weight: 600; font-style: italic; line-height: 1.5; margin-bottom: 4px; }
.proverb-trans { font-size: 11px; opacity: 0.65; font-weight: 500; }

/* ═══════════════════════════════════
   LESSONS PAGE
═══════════════════════════════════ */

.level-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.level-tabs::-webkit-scrollbar { display: none; }

.lt {
  padding: 7px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s;
}
.lt.active {
  background: var(--brand-grad);
  color: white;
  border-color: transparent;
  box-shadow: 0 3px 10px rgba(99,102,241,0.3);
}
.lt-lock { opacity: 0.45; cursor: not-allowed; }

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

.lesson-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 16px 16px 16px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-2);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.lesson-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--lc-color, var(--brand));
  border-radius: 4px 0 0 4px;
}
.lesson-card:hover:not(.lc-locked) {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.lc-locked { opacity: 0.5; cursor: not-allowed; }

.lc-icon {
  font-size: 28px;
  width: 50px;
  height: 50px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--lc-color, var(--brand)) 10%, white);
}
.lc-body  { flex: 1; min-width: 0; }
.lc-level { font-size: 10px; font-weight: 700; color: var(--lc-color, var(--brand)); text-transform: uppercase; letter-spacing: 0.6px; }
.lc-title { font-size: 15px; font-weight: 700; letter-spacing: -0.2px; }
.lc-sub   { font-size: 11px; color: var(--muted); font-weight: 500; }

.lc-xp {
  font-size: 11px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--lc-color, var(--brand)) 10%, white);
  color: var(--lc-color, var(--brand));
  flex-shrink: 0;
  border: 1px solid color-mix(in srgb, var(--lc-color, var(--brand)) 20%, white);
}

.lc-done-badge {
  position: absolute;
  top: -6px; right: -6px;
  width: 22px; height: 22px;
  background: var(--success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: white;
  border: 2px solid white;
  font-weight: 900;
}

/* ═══════════════════════════════════
   DICTIONARY
═══════════════════════════════════ */

.dict-top { margin-bottom: 14px; }

.lang-pills { display: flex; gap: 8px; margin-bottom: 12px; }

.lp {
  padding: 7px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.lp.active {
  background: var(--brand-grad);
  color: white;
  border-color: transparent;
  box-shadow: 0 3px 10px rgba(99,102,241,0.3);
}

.dict-input-wrap {
  position: relative;
}
.dict-input {
  width: 100%;
  padding: 13px 16px 13px 44px;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  background: var(--card);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-xs);
}
.dict-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.dict-input::placeholder { color: #94A3B8; }

.dict-results { display: flex; flex-direction: column; gap: 9px; }

.dict-empty {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 48px 0;
  font-weight: 500;
}

.dict-card {
  background: var(--card);
  border-radius: var(--r);
  padding: 13px 15px;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border-2);
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}
.dict-card:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}
.dict-kr   { font-size: 16px; font-weight: 800; color: var(--brand); min-width: 80px; letter-spacing: -0.2px; }
.dict-pipe { width: 1px; height: 32px; background: var(--border); flex-shrink: 0; }
.dict-rest { flex: 1; min-width: 0; }
.dict-fr   { font-size: 13px; font-weight: 700; color: var(--text); }
.dict-en   { font-size: 11px; color: var(--muted); font-weight: 500; }
.dict-cat  {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--brand-lt);
  color: var(--brand);
  flex-shrink: 0;
  border: 1px solid #C7D2FE;
}
.dict-speak {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.5;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.15s;
  padding: 4px;
}
.dict-speak:hover { opacity: 1; transform: scale(1.15); }

/* ═══════════════════════════════════
   PROFILE
═══════════════════════════════════ */

.profile-hero {
  background: var(--brand-grad);
  border-radius: var(--r-xl);
  padding: 30px 20px 24px;
  text-align: center;
  color: white;
  margin-bottom: 14px;
  box-shadow: 0 8px 32px rgba(99,102,241,0.35);
  position: relative;
  overflow: hidden;
}
.profile-hero::before {
  content: '';
  position: absolute;
  top: -60px; left: -60px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
  pointer-events: none;
}
.profile-avatar {
  font-size: 52px;
  margin-bottom: 10px;
  position: relative;
  display: inline-block;
}
.profile-avatar-ring {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 76px; height: 76px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  margin-bottom: 10px;
  font-size: 40px;
}
.profile-name { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; }
.profile-sub  { font-size: 13px; opacity: 0.8; font-weight: 500; margin-top: 2px; }

.xp-container {
  background: var(--card);
  border-radius: var(--r);
  padding: 15px 16px;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border-2);
  margin-bottom: 4px;
}
.xp-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}
.xpbar {
  height: 10px;
  background: var(--brand-lt);
  border-radius: 999px;
  overflow: hidden;
}
.xpbar-fill {
  height: 100%;
  background: var(--brand-grad);
  border-radius: 999px;
  transition: width 1.2s cubic-bezier(.4,0,.2,1);
}

.badges {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
  margin-bottom: 4px;
}
.badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: var(--card);
  border-radius: var(--r);
  padding: 12px 6px;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border-2);
  text-align: center;
  position: relative;
  transition: transform 0.15s;
}
.badge-item:not(.locked):hover { transform: translateY(-2px); }
.badge-item.locked { opacity: 0.35; filter: grayscale(1); }
.badge-emoji { font-size: 26px; }
.badge-name  { font-size: 9px; font-weight: 700; color: var(--muted); line-height: 1.2; }
.badge-earned-star { position: absolute; top: -4px; right: -4px; font-size: 11px; }

.lvl-item {
  background: var(--card);
  border-radius: var(--r);
  padding: 13px 15px;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border-2);
  margin-bottom: 8px;
}
.lvl-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.lvl-name { font-size: 13px; font-weight: 700; }
.lvl-pct  { font-size: 12px; font-weight: 700; color: var(--brand); }
.lvl-bar  { height: 7px; background: var(--border); border-radius: 999px; overflow: hidden; }
.lvl-fill { height: 100%; border-radius: 999px; transition: width 1.2s cubic-bezier(.4,0,.2,1); }

/* ═══════════════════════════════════
   BOTTOM NAV (Frosted Glass)
═══════════════════════════════════ */

.bnav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid rgba(230,232,255,0.8);
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
  z-index: 200;
  box-shadow: 0 -4px 20px rgba(99,102,241,0.07);
}

.nb {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  color: #94A3B8;
  padding: 4px 0;
  transition: color 0.15s;
  position: relative;
}
.nb span:first-child { font-size: 19px; transition: transform 0.2s; }
.nb.active { color: var(--brand); }
.nb.active span:first-child { transform: scale(1.15); }
.nb.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  width: 20px;
  height: 2.5px;
  background: var(--brand-grad);
  border-radius: 999px;
}

/* ═══════════════════════════════════
   MODAL
═══════════════════════════════════ */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal.hidden { display: none; }

.modal-box {
  width: 100%;
  max-width: 480px;
  background: var(--card);
  border-radius: 24px 24px 0 0;
  max-height: 92dvh;
  overflow-y: auto;
  animation: slideUp 0.32s cubic-bezier(.32,0,.67,0) forwards;
}
.modal-box::-webkit-scrollbar { display: none; }

.result-box {
  border-radius: var(--r-xl);
  max-height: 85dvh;
  margin: 24px 16px;
  border-bottom: none;
  animation: popIn 0.36s cubic-bezier(.34,1.56,.64,1) forwards;
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes popIn {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.modal-hdr {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border-2);
  position: sticky;
  top: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  z-index: 10;
}
.close-x {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  color: var(--muted);
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.close-x:hover { background: var(--danger-lt); color: var(--danger); border-color: #FECDD3; }

.modal-progress-wrap { flex: 1; }
.mp-bar {
  height: 9px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.mp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--success), #34D399);
  border-radius: 999px;
  transition: width 0.5s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 0 8px rgba(16,185,129,0.3);
}
.modal-lives {
  font-size: 14px;
  flex-shrink: 0;
  letter-spacing: 2px;
}
.modal-body { padding: 20px 16px 32px; }

/* ═══════════════════════════════════
   EXERCISE — VOCAB FLIP
═══════════════════════════════════ */

.vocab-phase-title {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 18px;
}

.flip-card-wrap {
  perspective: 1200px;
  cursor: pointer;
  margin: 0 auto 22px;
  width: 100%;
  max-width: 320px;
  height: 210px;
}
.flip-card {
  width: 100%; height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(.4,0,.2,1);
}
.flip-card.flipped { transform: rotateY(180deg); }

.flip-front, .flip-back {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: var(--shadow-lg);
}
.flip-front {
  background: var(--brand-grad);
  color: white;
}
.flip-back {
  background: linear-gradient(135deg, var(--success), #34D399);
  color: white;
  transform: rotateY(180deg);
}
.flip-emoji { font-size: 44px; margin-bottom: 8px; }
.flip-kr    { font-size: 26px; font-weight: 800; letter-spacing: -0.3px; }
.flip-hint  { font-size: 11px; opacity: 0.7; margin-top: 8px; font-weight: 500; }
.flip-fr    { font-size: 22px; font-weight: 800; letter-spacing: -0.2px; }
.flip-en    { font-size: 12px; opacity: 0.8; margin-top: 4px; font-weight: 500; }
.flip-speak {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  font-size: 16px;
  border-radius: 50%;
  width: 34px; height: 34px;
  cursor: pointer;
  margin-top: 10px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.15s;
}
.flip-speak:hover { background: rgba(255,255,255,0.35); transform: scale(1.1); }

.flip-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.flip-counter { font-size: 13px; font-weight: 600; color: var(--muted); }
.flip-btn {
  padding: 10px 22px;
  border-radius: var(--r);
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}
.flip-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.flip-btn-prev { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.flip-btn-next { background: var(--brand-grad); color: white; box-shadow: 0 4px 14px rgba(99,102,241,0.3); }
.flip-btn:not(:disabled):hover { transform: scale(1.04); }

/* ═══════════════════════════════════
   EXERCISE — MCQ
═══════════════════════════════════ */

.mcq-question {
  text-align: center;
  margin-bottom: 22px;
}
.mcq-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
}
.mcq-emoji { font-size: 52px; display: block; margin-bottom: 6px; }
.mcq-word  { font-size: 28px; font-weight: 800; color: var(--text); letter-spacing: -0.4px; margin-bottom: 4px; }
.mcq-hint  { font-size: 12px; color: var(--muted); font-weight: 500; }

.mcq-options {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.mcq-opt {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 16px;
  border-radius: var(--r);
  border: 1.5px solid var(--border);
  background: var(--card);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: var(--text);
  transition: all 0.15s;
  box-shadow: var(--shadow-xs);
}
.mcq-opt:hover:not(:disabled) {
  border-color: var(--brand);
  background: var(--brand-lt);
  transform: translateX(3px);
}
.opt-letter {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--brand-lt);
  color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
  border: 1px solid #C7D2FE;
  transition: background 0.15s, color 0.15s;
}
.mcq-opt:hover:not(:disabled) .opt-letter { background: var(--brand); color: white; border-color: transparent; }

.mcq-opt.correct {
  border-color: var(--success);
  background: var(--success-lt);
  color: #065F46;
}
.mcq-opt.correct .opt-letter { background: var(--success); color: white; border-color: transparent; }
.mcq-opt.wrong {
  border-color: var(--danger);
  background: var(--danger-lt);
  color: #9F1239;
}
.mcq-opt.wrong .opt-letter { background: var(--danger); color: white; border-color: transparent; }
.mcq-opt:disabled { cursor: not-allowed; }

/* ═══════════════════════════════════
   EXERCISE — MATCH
═══════════════════════════════════ */

.match-title {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 18px;
}
.match-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.match-col { display: flex; flex-direction: column; gap: 9px; }
.match-btn {
  padding: 13px 10px;
  border-radius: var(--r);
  border: 1.5px solid var(--border);
  background: var(--card);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  min-height: 54px;
  color: var(--text);
  transition: all 0.15s;
  box-shadow: var(--shadow-xs);
}
.match-btn:hover:not(:disabled):not(.matched) {
  border-color: var(--brand);
  background: var(--brand-lt);
}
.match-btn.selected {
  border-color: var(--gold);
  background: var(--gold-lt);
  color: #92400E;
  box-shadow: 0 0 0 3px rgba(245,158,11,0.15);
  transform: scale(1.03);
}
.match-btn.matched {
  border-color: var(--success);
  background: var(--success-lt);
  color: #065F46;
  cursor: default;
}
.match-btn.wrong-shake {
  animation: shake 0.4s;
  border-color: var(--danger) !important;
  background: var(--danger-lt) !important;
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-8px); }
  75%      { transform: translateX(8px); }
}

/* ═══════════════════════════════════
   LESSON START SCREEN
═══════════════════════════════════ */

.lesson-start { text-align: center; padding: 10px 0; }
.ls-emoji-wrap {
  width: 80px; height: 80px;
  background: var(--brand-lt);
  border-radius: 24px;
  display: flex; align-items: center; justify-content: center;
  font-size: 44px;
  margin: 0 auto 14px;
  box-shadow: 0 6px 20px rgba(99,102,241,0.18);
}
.ls-title { font-size: 24px; font-weight: 800; letter-spacing: -0.4px; margin-bottom: 4px; }
.ls-sub   { font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 20px; }
.ls-words {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center;
  margin-bottom: 26px;
}
.ls-word {
  padding: 6px 14px;
  background: var(--brand-lt);
  color: var(--brand);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #C7D2FE;
}
.ls-start-btn {
  width: 100%;
  padding: 15px;
  border-radius: var(--r);
  border: none;
  background: var(--brand-grad);
  color: white;
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 6px 20px rgba(99,102,241,0.35);
  letter-spacing: -0.2px;
}
.ls-start-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(99,102,241,0.45); }

/* ═══════════════════════════════════
   RESULTS
═══════════════════════════════════ */

#resultBody { text-align: center; padding: 28px 20px 20px; }
.result-icon  { font-size: 60px; margin-bottom: 10px; }
.result-title { font-size: 24px; font-weight: 900; letter-spacing: -0.4px; margin-bottom: 4px; }
.result-stars { font-size: 26px; margin: 6px 0; }
.result-sub   { font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 18px; }

.result-xp {
  display: inline-block;
  padding: 9px 22px;
  background: var(--gold-lt);
  color: #92400E;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 18px;
  border: 1px solid #FDE68A;
}
.result-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--r);
}
.rs-item { text-align: center; }
.rs-val  { font-size: 26px; font-weight: 900; letter-spacing: -0.4px; }
.rs-lbl  { font-size: 11px; color: var(--muted); font-weight: 600; margin-top: 2px; }

.result-btn {
  width: 100%;
  padding: 14px;
  border-radius: var(--r);
  border: none;
  background: var(--brand-grad);
  color: white;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  margin-bottom: 9px;
  box-shadow: 0 5px 16px rgba(99,102,241,0.3);
  letter-spacing: -0.1px;
}
.result-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(99,102,241,0.4); }
.result-btn-outline {
  background: var(--card);
  color: var(--brand);
  border: 1.5px solid #C7D2FE;
  box-shadow: var(--shadow-xs);
}
.result-btn-outline:hover { background: var(--brand-lt); }

/* ═══════════════════════════════════
   TOAST & XP FLOAT
═══════════════════════════════════ */

.toast {
  position: fixed;
  bottom: 94px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15,23,42,0.9);
  color: white;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  z-index: 1000;
  white-space: nowrap;
  animation: toastIn 0.3s ease;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
}
.toast.hidden { display: none; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.xp-float {
  position: fixed;
  bottom: 100px;
  right: 18px;
  background: linear-gradient(135deg, #F59E0B, #FBBF24);
  color: white;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(245,158,11,0.4);
  animation: floatUp 1.6s ease-out forwards;
}
.xp-float.hidden { display: none; }

@keyframes floatUp {
  0%   { opacity: 1; transform: translateY(0)    scale(1); }
  60%  { opacity: 1; transform: translateY(-40px) scale(1.08); }
  100% { opacity: 0; transform: translateY(-80px) scale(0.9); }
}

/* ═══════════════════════════════════
   RESPONSIVE
═══════════════════════════════════ */

@media (max-width: 360px) {
  .hdr-stats { gap: 4px; }
  .chip { padding: 4px 7px; font-size: 11px; }
  .stats-grid { gap: 6px; }
  .mcq-opt { font-size: 13px; }
  .flip-kr  { font-size: 22px; }
}
