/* ══════════════════════════════════════════
   AI English Pro — App CSS
   Mobile-first, fully responsive
══════════════════════════════════════════ */

/* ── RESET & ROOT ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --brand: #2563EB; --brand-light: #EFF6FF; --brand-dark: #1D4ED8;
  --accent: #0EA5E9; --accent2: #8B5CF6; --accent3: #EC4899;
  --success: #10B981; --danger: #EF4444; --warn: #F59E0B;
  --bg: #F8FAFC; --surface: #FFFFFF; --surface2: #F1F5F9; --surface3: #E8EDF5;
  --border: #E2E8F0; --border2: #CBD5E1;
  --text: #0F172A; --text2: #475569; --text3: #94A3B8;
  --r: 12px; --r-sm: 8px; --r-lg: 16px; --r-xl: 20px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.05);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06);
  --nav-h: 56px;
}
html { scroll-behavior: smooth; }
body { font-family: 'Google Sans', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; -webkit-font-smoothing: antialiased; }
h1,h2,h3 { font-family: 'Google Sans Display', sans-serif; }
img { max-width: 100%; }

/* ── NAV ── */
.nav {
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--nav-h);
  gap: 0;
}
.nav-logo {
  font-family: 'Google Sans Display', sans-serif;
  font-weight: 800;
  font-size: 17px;
  color: var(--brand);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 24px;
  cursor: pointer;
  flex-shrink: 0;
  text-decoration: none;
  letter-spacing: -.3px;
}
.nav-logo-icon {
  background: linear-gradient(135deg, var(--brand), var(--accent2));
  color: #fff;
  width: 32px; height: 32px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800;
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
}
.nav-tabs { display: flex; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tab {
  padding: 0 14px;
  height: var(--nav-h);
  font-size: 13px;
  font-weight: 600;
  color: var(--text3);
  cursor: pointer;
  border: none;
  border-bottom: 2.5px solid transparent;
  background: none;
  font-family: inherit;
  transition: all .15s;
  white-space: nowrap;
  display: flex; align-items: center; gap: 5px;
}
.nav-tab:hover { color: var(--brand); }
.nav-tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.nav-right { display: flex; gap: 8px; align-items: center; flex-shrink: 0; margin-left: 8px; }
.nav-user {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 10px; border-radius: 10px;
  cursor: pointer; transition: background .15s; text-decoration: none;
}
.nav-user:hover { background: var(--surface2); }
.nav-avatar {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--brand), var(--accent2));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 800; flex-shrink: 0;
}
.nav-username { font-size: 13px; font-weight: 700; color: var(--text); }
.nav-admin-btn {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700;
  color: #DC2626; background: #FEF2F2;
  border: 1px solid #FECACA;
  padding: 5px 10px; border-radius: 8px;
  text-decoration: none; transition: all .15s;
}
.nav-admin-btn:hover { background: #FEE2E2; }
.nav-logout {
  font-size: 12px; color: var(--text3); cursor: pointer;
  border: 1px solid var(--border); background: none;
  text-decoration: none; padding: 5px 11px; border-radius: 8px;
  font-family: inherit; font-weight: 600; transition: all .15s;
  white-space: nowrap;
}
.nav-logout:hover { color: #DC2626; border-color: #FECACA; background: #FEF2F2; }
.streak-badge {
  background: linear-gradient(135deg, #F59E0B, #EF4444);
  color: #fff; font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 20px; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(239,68,68,.2);
}
.nav-auth-btn {
  padding: 7px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 700;
  text-decoration: none; transition: all .15s; white-space: nowrap;
}
.nav-auth-login { color: var(--text2); border: 1.5px solid var(--border); background: #fff; }
.nav-auth-login:hover { background: var(--surface2); border-color: var(--border2); }
.nav-auth-register { background: linear-gradient(135deg, var(--brand), #4F46E5); color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,.3); }
.nav-auth-register:hover { box-shadow: 0 4px 14px rgba(37,99,235,.4); transform: translateY(-1px); }

/* ── PAGES (SPA) ── */
.page { display: none; flex-direction: column; gap: 16px; padding: 20px; max-width: 960px; margin: 0 auto; width: 100%; animation: fadeIn .2s ease; }
.page.active { display: flex; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ── PAGE HEADER ── */
.page-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.page-header h2 { font-size: 20px; font-weight: 700; letter-spacing: -.3px; }
.page-header p { font-size: 13px; color: var(--text3); margin-top: 2px; }

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card-title { font-size: 14px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; letter-spacing: -.1px; }
.cicon { width: 26px; height: 26px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }

/* ── STATS GRID ── */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .val { font-family: 'Google Sans Display', sans-serif; font-size: 28px; font-weight: 800; color: var(--brand); margin-bottom: 4px; letter-spacing: -1px; }
.stat-card .lbl { font-size: 11px; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

/* ── DAILY LIST ── */
.daily-list { display: flex; flex-direction: column; gap: 8px; }
.daily-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer; transition: all .15s;
}
.daily-item:hover { border-color: #93C5FD; background: var(--brand-light); transform: translateX(2px); }
.di-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
.di-info { flex: 1; min-width: 0; }
.di-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.di-sub { font-size: 11px; color: var(--text3); margin-top: 2px; }
.di-badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 6px; white-space: nowrap; }
.di-badge.pend { background: #FEF3C7; color: #92400E; }
.di-badge.done { background: #D1FAE5; color: #065F46; }
.di-badge.todo { background: var(--surface2); color: var(--text3); }

/* ── TOPIC GRID ── */
.topic-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.topic-card {
  padding: 14px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  cursor: pointer; transition: all .2s;
  background: var(--surface); text-align: center;
}
.topic-card:hover, .topic-card.active { border-color: var(--brand); background: var(--brand-light); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(37,99,235,.1); }
.tc-em { font-size: 24px; margin-bottom: 5px; }
.tc-n { font-size: 12px; font-weight: 700; color: var(--text2); }

/* ── BUTTONS ── */
.btn {
  padding: 9px 16px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: all .15s; border: none; font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none; white-space: nowrap; line-height: 1.4;
}
.btn-primary { background: linear-gradient(135deg, var(--brand), #4F46E5); color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,.25); }
.btn-primary:hover { box-shadow: 0 4px 16px rgba(37,99,235,.35); transform: translateY(-1px); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--surface2); border-color: var(--border2); }
.btn-danger { background: #FEF2F2; color: #DC2626; border: 1.5px solid #FECACA; }
.btn-danger:hover { background: #FEE2E2; }
.btn-success { background: #F0FDF4; color: #16A34A; border: 1.5px solid #BBF7D0; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 9px; font-size: 11px; }

/* ── FORMS ── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 700; color: var(--text2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .05em; }
.form-input {
  width: 100%; padding: 10px 13px;
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  font-size: 14px; font-family: inherit; outline: none;
  background: var(--surface); transition: all .15s; color: var(--text);
}
.form-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-input.sm { padding: 6px 10px; font-size: 13px; width: auto; }

/* ── LEVEL BUTTONS ── */
.level-row { display: flex; gap: 8px; }
.level-btn {
  flex: 1; padding: 10px 6px; border-radius: var(--r-sm);
  border: 1.5px solid var(--border); background: var(--surface);
  font-size: 12px; font-weight: 700; cursor: pointer;
  transition: all .15s; color: var(--text2); font-family: inherit;
  text-align: center;
}
.level-btn:hover, .level-btn.active { border-color: var(--brand); background: var(--brand-light); color: var(--brand); }

/* ── PROGRESS BAR ── */
.progress-bar-wrap { background: var(--surface2); border-radius: 20px; height: 6px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--brand), var(--accent)); transition: width .4s ease; }

/* ── CHAT ── */
.chat-wrap { display: flex; flex-direction: column; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow-md); }
.chat-top { background: var(--surface); padding: 14px 18px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); }
.ai-av {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--brand), var(--accent2));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 14px;
  font-family: 'Google Sans Display', sans-serif; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
}
.chat-info-block { flex: 1; }
.chat-info-block h3 { font-size: 14px; font-weight: 700; }
.chat-info-block p { font-size: 12px; color: var(--text3); margin-top: 2px; }
.online-dot { width: 7px; height: 7px; background: var(--success); border-radius: 50%; display: inline-block; margin-right: 4px; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }
.chat-msgs {
  background: var(--surface); padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  min-height: 280px; max-height: 380px; overflow-y: auto;
}
.chat-msgs::-webkit-scrollbar { width: 4px; }
.chat-msgs::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
.msg { display: flex; gap: 8px; align-items: flex-start; }
.msg.user { flex-direction: row-reverse; }
.msg-av { width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.msg-av.ai-sm { background: linear-gradient(135deg, var(--brand), var(--accent2)); color: #fff; }
.msg-av.usr { background: var(--surface2); color: var(--text2); border: 1.5px solid var(--border); }
.msg-body { max-width: 78%; }
.bubble { padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.6; }
.msg.ai-msg .bubble { background: var(--surface2); border-radius: 4px 14px 14px 14px; }
.msg.user .bubble { background: linear-gradient(135deg, var(--brand), #4F46E5); color: #fff; border-radius: 14px 4px 14px 14px; }
.msg-fb { margin-top: 6px; display: flex; flex-direction: column; gap: 5px; }
.fb-row { display: flex; gap: 6px; flex-wrap: wrap; }
.score-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; background: var(--brand-light); color: var(--brand); }
.fb-tag { font-size: 11px; padding: 3px 7px; border-radius: 5px; font-weight: 600; }
.fb-tag.ok { background: #D1FAE5; color: #065F46; }
.fb-tag.fix { background: #FEF3C7; color: #92400E; }
.rewrite { font-size: 12px; background: #EFF6FF; border-radius: 6px; padding: 6px 10px; color: #1E40AF; border-left: 3px solid var(--brand); }
.chat-foot { background: var(--surface); border-top: 1px solid var(--border); padding: 12px; }
.chat-input-row { display: flex; gap: 8px; }
.chat-input {
  flex: 1; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 14px; font-family: inherit; outline: none;
  background: var(--surface2); transition: all .15s; color: var(--text);
}
.chat-input:focus { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.sug {
  padding: 5px 12px; border-radius: 20px;
  border: 1.5px solid #BFDBFE; background: var(--brand-light);
  color: var(--brand); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.sug:hover { background: #DBEAFE; border-color: #93C5FD; }

/* ── QUIZ ── */
.quiz-q { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow); }
.q-num { font-size: 11px; color: var(--text3); font-weight: 700; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .06em; }
.q-type { font-size: 11px; padding: 3px 9px; border-radius: 5px; background: var(--brand-light); color: var(--brand); font-weight: 700; display: inline-block; margin-bottom: 12px; }
.q-text { font-size: 16px; font-weight: 600; line-height: 1.6; margin-bottom: 16px; color: var(--text); }
.options { display: flex; flex-direction: column; gap: 8px; }
.opt {
  padding: 12px 16px; border-radius: 10px;
  border: 1.5px solid var(--border); cursor: pointer;
  font-size: 14px; display: flex; align-items: center; gap: 10px;
  transition: all .15s; background: var(--surface); font-weight: 500;
}
.opt:hover { border-color: #93C5FD; background: var(--brand-light); }
.opt.sel { border-color: var(--brand); background: var(--brand-light); color: var(--brand); font-weight: 700; }
.opt.correct { border-color: var(--success); background: #D1FAE5; color: #065F46; font-weight: 700; }
.opt.wrong { border-color: var(--danger); background: #FEE2E2; color: #991B1B; }
.opt-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border); flex-shrink: 0; transition: all .15s; }
.opt.sel .opt-dot { border-color: var(--brand); background: var(--brand); }

/* ── SCORE CIRCLE ── */
.score-circle {
  width: 96px; height: 96px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--accent2));
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  margin: 0 auto; color: #fff;
  box-shadow: 0 8px 24px rgba(37,99,235,.3);
}
.sc-big { font-family: 'Google Sans Display', sans-serif; font-size: 28px; font-weight: 800; line-height: 1; }
.sc-sm { font-size: 11px; opacity: .8; font-weight: 600; }

/* ── ANSWER CARDS ── */
.an-card { padding: 14px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; font-size: 13px; background: var(--surface); }
.an-q { font-weight: 700; margin-bottom: 6px; color: var(--text); line-height: 1.5; }
.an-w { color: #DC2626; margin-bottom: 3px; font-weight: 500; }
.an-r { color: #16A34A; font-weight: 600; }
.an-e { color: var(--text2); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); line-height: 1.6; }

/* ── BADGE TAGS ── */
.badge-tag { font-size: 12px; padding: 4px 10px; border-radius: 6px; font-weight: 700; }
.badge-tag.blue { background: #DBEAFE; color: #1E40AF; }
.badge-tag.purple { background: #EDE9FE; color: #5B21B6; }
.badge-tag.green { background: #D1FAE5; color: #065F46; }

/* ── LOADING ── */
.loading-overlay { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px; gap: 14px; }
.spinner { width: 38px; height: 38px; border: 3px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 13px; color: var(--text3); font-weight: 600; }

/* ── TOAST ── */
#toast {
  display: none; position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1E293B; color: #fff;
  padding: 11px 22px; border-radius: 12px;
  font-size: 13px; font-weight: 700; z-index: 9999;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
  max-width: calc(100vw - 40px); text-align: center;
  animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity:0; transform:translateX(-50%) translateY(8px); } to { opacity:1; transform:translateX(-50%) translateY(0); } }

/* ════════════════════════════════════════
   GUEST / AUTH PAGES
════════════════════════════════════════ */

/* ── AUTH ── */
.auth-bg {
  min-height: calc(100vh - var(--nav-h));
  display: flex; align-items: center; justify-content: center;
  padding: 32px 16px;
  background: radial-gradient(ellipse at 20% 50%, rgba(37,99,235,.08) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(139,92,246,.08) 0%, transparent 60%),
              var(--bg);
}
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 20px; border: 1px solid var(--border); box-shadow: var(--shadow-lg); overflow: hidden; }
.auth-header { padding: 32px 28px 24px; text-align: center; }
.auth-logo {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--brand), var(--accent2));
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  font-family: 'Google Sans Display', sans-serif; font-size: 22px; font-weight: 800; color: #fff;
  box-shadow: 0 4px 16px rgba(37,99,235,.3);
}
.auth-header h2 { font-size: 22px; font-weight: 800; margin-bottom: 6px; letter-spacing: -.4px; }
.auth-header p { font-size: 13px; color: var(--text3); }
.auth-divider { height: 1px; background: var(--border); margin: 0 28px; }
.auth-body { padding: 24px 28px 28px; }
.auth-field { margin-bottom: 16px; }
.auth-label { display: block; font-size: 11px; font-weight: 800; color: var(--text2); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 7px; }
.auth-input {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 14px; font-family: inherit; outline: none;
  background: var(--surface2); transition: all .15s; color: var(--text);
}
.auth-input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.auth-submit {
  width: 100%; padding: 13px;
  background: linear-gradient(135deg, var(--brand), #4F46E5);
  color: #fff; border: none; border-radius: 10px;
  font-size: 15px; font-weight: 800; cursor: pointer; font-family: inherit;
  transition: all .15s; margin-top: 4px;
  box-shadow: 0 4px 14px rgba(37,99,235,.3);
}
.auth-submit:hover { box-shadow: 0 6px 20px rgba(37,99,235,.4); transform: translateY(-1px); }
.auth-footer { text-align: center; margin-top: 18px; font-size: 13px; color: var(--text3); }
.auth-footer a { color: var(--brand); text-decoration: none; font-weight: 700; }

/* ── LANDING PAGE ── */
.landing { }

/* Hero */
.hero {
  background: radial-gradient(ellipse at 30% 40%, rgba(37,99,235,.12) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 60%, rgba(139,92,246,.1) 0%, transparent 60%),
              linear-gradient(180deg, #EEF2FF 0%, var(--bg) 100%);
  padding: 64px 20px 56px;
  text-align: center;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: white; border: 1px solid #C7D2FE;
  color: var(--brand); font-size: 12px; font-weight: 700;
  padding: 5px 14px; border-radius: 20px; margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(37,99,235,.1);
}
.hero h1 {
  font-size: clamp(28px, 6vw, 52px);
  font-weight: 900; line-height: 1.15; letter-spacing: -1.5px;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #1E40AF 0%, #7C3AED 60%, #EC4899 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub { font-size: clamp(14px, 2.5vw, 17px); color: var(--text2); max-width: 540px; margin: 0 auto 32px; line-height: 1.75; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn-hero-primary {
  padding: 14px 28px; border-radius: 12px;
  font-size: 15px; font-weight: 800; text-decoration: none; cursor: pointer;
  background: linear-gradient(135deg, var(--brand), #4F46E5);
  color: #fff; border: none; font-family: inherit;
  box-shadow: 0 4px 20px rgba(37,99,235,.35);
  transition: all .2s; display: inline-flex; align-items: center; gap: 8px;
}
.btn-hero-primary:hover { box-shadow: 0 8px 28px rgba(37,99,235,.45); transform: translateY(-2px); }
.btn-hero-secondary {
  padding: 14px 28px; border-radius: 12px;
  font-size: 15px; font-weight: 700; text-decoration: none;
  background: white; color: var(--text); border: 1.5px solid var(--border);
  transition: all .2s; display: inline-flex; align-items: center; gap: 8px;
}
.btn-hero-secondary:hover { background: var(--surface2); border-color: var(--border2); transform: translateY(-1px); }
.hero-trust {
  display: flex; align-items: center; justify-content: center; gap: 20px;
  margin-top: 36px; flex-wrap: wrap;
}
.hero-trust-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text3); font-weight: 600; }

/* Stats banner */
.stats-banner {
  display: grid; grid-template-columns: repeat(3, 1fr);
  max-width: 720px; margin: 0 auto;
  background: white; border-radius: 16px; border: 1px solid var(--border);
  box-shadow: var(--shadow-md); overflow: hidden;
}
.stat-banner-item { padding: 20px 16px; text-align: center; position: relative; }
.stat-banner-item:not(:last-child)::after { content:''; position:absolute; right:0; top:20%; height:60%; width:1px; background:var(--border); }
.stat-banner-num { font-family:'Google Sans Display',sans-serif; font-size: 28px; font-weight: 900; letter-spacing: -1px; margin-bottom: 4px; }
.stat-banner-lbl { font-size: 12px; color: var(--text3); font-weight: 600; }

/* Features section */
.section { padding: 56px 20px; max-width: 960px; margin: 0 auto; }
.section-title { font-size: clamp(22px, 4vw, 32px); font-weight: 800; text-align: center; letter-spacing: -.5px; margin-bottom: 8px; }
.section-sub { font-size: 15px; color: var(--text3); text-align: center; margin-bottom: 40px; }

.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feature-card {
  background: white; border: 1px solid var(--border);
  border-radius: var(--r-xl); padding: 24px;
  transition: all .2s; position: relative; overflow: hidden;
}
.feature-card::before { content:''; position:absolute; top:0; left:0; right:0; height:3px; background: linear-gradient(90deg, var(--c1,var(--brand)), var(--c2,var(--accent2))); }
.feature-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); border-color: #C7D2FE; }
.feature-icon { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 14px; }
.feature-title { font-size: 15px; font-weight: 800; margin-bottom: 8px; letter-spacing: -.2px; }
.feature-desc { font-size: 13px; color: var(--text3); line-height: 1.7; }
.feature-tag { display: inline-block; margin-top: 12px; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 6px; }

/* How it works */
.steps-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 24px; position: relative; }
.steps-grid::before { content:''; position:absolute; top: 28px; left: calc(16.66% + 10px); right: calc(16.66% + 10px); height: 2px; background: linear-gradient(90deg, var(--brand), var(--accent2)); z-index: 0; }
.step-card { text-align: center; position: relative; z-index: 1; }
.step-num { width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--accent2)); color: #fff; font-family:'Google Sans Display',sans-serif; font-size: 20px; font-weight: 900; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; box-shadow: 0 4px 16px rgba(37,99,235,.25); }
.step-title { font-size: 15px; font-weight: 800; margin-bottom: 8px; }
.step-desc { font-size: 13px; color: var(--text3); line-height: 1.7; }

/* Topics showcase */
.topics-showcase { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.topic-pill {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: 30px;
  background: white; border: 1.5px solid var(--border);
  font-size: 13px; font-weight: 700; color: var(--text2);
  transition: all .2s; cursor: pointer;
}
.topic-pill:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-light); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(37,99,235,.1); }

/* Testimonials */
.testimonials-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.testimonial-card { background: white; border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; }
.testi-stars { color: #F59E0B; font-size: 13px; margin-bottom: 10px; }
.testi-text { font-size: 13px; color: var(--text2); line-height: 1.7; margin-bottom: 14px; font-style: italic; }
.testi-author { display: flex; align-items: center; gap: 9px; }
.testi-av { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 800; color: #fff; flex-shrink: 0; }
.testi-name { font-size: 13px; font-weight: 700; }
.testi-role { font-size: 11px; color: var(--text3); }

/* CTA Section */
.cta-section {
  margin: 0 20px 56px;
  background: linear-gradient(135deg, var(--brand) 0%, #4F46E5 50%, var(--accent2) 100%);
  border-radius: 24px; padding: 48px 32px; text-align: center; color: #fff;
  position: relative; overflow: hidden;
}
.cta-section::before { content:''; position:absolute; top:-50%; left:-20%; width:200px; height:200px; background:rgba(255,255,255,.06); border-radius:50%; }
.cta-section::after  { content:''; position:absolute; bottom:-30%; right:-10%; width:160px; height:160px; background:rgba(255,255,255,.06); border-radius:50%; }
.cta-section h2 { font-size: clamp(22px, 4vw, 32px); font-weight: 900; margin-bottom: 12px; letter-spacing: -.5px; position: relative; z-index: 1; }
.cta-section p { font-size: 15px; opacity: .85; margin-bottom: 28px; position: relative; z-index: 1; }
.cta-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; position: relative; z-index: 1; }
.btn-cta-white { padding: 13px 28px; border-radius: 12px; font-size: 15px; font-weight: 800; text-decoration: none; background: #fff; color: var(--brand); transition: all .2s; display: inline-flex; align-items: center; gap: 8px; }
.btn-cta-white:hover { box-shadow: 0 6px 20px rgba(0,0,0,.15); transform: translateY(-2px); }
.btn-cta-outline { padding: 13px 28px; border-radius: 12px; font-size: 15px; font-weight: 700; text-decoration: none; background: transparent; color: #fff; border: 2px solid rgba(255,255,255,.5); transition: all .2s; display: inline-flex; align-items: center; gap: 8px; }
.btn-cta-outline:hover { border-color: #fff; background: rgba(255,255,255,.1); }

/* Footer */
.landing-footer { border-top: 1px solid var(--border); padding: 24px 20px; text-align: center; font-size: 12px; color: var(--text3); }

/* ── PROFILE ── */
.profile-wrap { max-width: 540px; margin: 40px auto; padding: 0 20px; }
.profile-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow-md); }
.profile-header { background: linear-gradient(135deg, var(--brand) 0%, var(--accent2) 100%); padding: 32px 24px; text-align: center; color: #fff; }
.profile-avatar { width: 72px; height: 72px; background: rgba(255,255,255,.2); border: 3px solid rgba(255,255,255,.4); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 800; margin: 0 auto 14px; font-family:'Google Sans Display',sans-serif; }
.profile-name { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.profile-email { font-size: 13px; opacity: .8; }
.profile-body { padding: 20px 24px; }
.profile-row { display: flex; justify-content: space-between; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--surface2); font-size: 14px; }
.profile-row:last-child { border-bottom: none; }
.profile-row-label { color: var(--text3); font-size: 13px; font-weight: 600; }
.profile-row-value { font-weight: 700; color: var(--text); }
.profile-pkg-badge { display: inline-flex; align-items: center; gap: 5px; background: var(--brand-light); color: var(--brand); font-size: 13px; font-weight: 800; padding: 4px 12px; border-radius: 20px; }
.profile-upgrade-btn { display: block; margin: 16px 24px 24px; padding: 13px; background: linear-gradient(135deg, var(--brand), var(--accent2)); color: #fff; border-radius: 10px; text-align: center; text-decoration: none; font-weight: 800; font-size: 14px; transition: all .2s; box-shadow: 0 4px 14px rgba(37,99,235,.25); }
.profile-upgrade-btn:hover { box-shadow: 0 6px 20px rgba(37,99,235,.35); transform: translateY(-1px); }

/* ════════════════════════════════════════
   RESPONSIVE — MOBILE FIRST
════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Nav */
  .nav { padding: 0 12px; gap: 0; }
  .nav-logo { font-size: 15px; margin-right: 10px; }
  .nav-logo-icon { width: 28px; height: 28px; font-size: 12px; }
  .nav-tabs .nav-tab { padding: 0 10px; font-size: 12px; gap: 3px; }
  .nav-username { display: none; }
  .streak-badge { font-size: 11px; padding: 3px 8px; }

  /* Pages */
  .page { padding: 14px; gap: 12px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card .val { font-size: 22px; }

  /* Dashboard grid */
  #page-dashboard > div:last-child { grid-template-columns: 1fr !important; }
  .topic-grid { grid-template-columns: repeat(3,1fr); gap: 6px; }
  .tc-em { font-size: 20px; }
  .tc-n { font-size: 11px; }

  /* Chat */
  .chat-msgs { min-height: 220px; max-height: 300px; }
  .msg-body { max-width: 88%; }
  .bubble { font-size: 13px; padding: 9px 12px; }

  /* Quiz */
  .q-text { font-size: 14px; }
  .opt { font-size: 13px; padding: 10px 12px; }
  .level-row { gap: 6px; }
  .level-btn { font-size: 11px; padding: 8px 4px; }

  /* Streak bar */
  .streak-bar { flex-wrap: wrap; gap: 10px; padding: 12px 14px; }
  .streak-weeks { margin-left: 0; width: 100%; justify-content: space-between; }
  .streak-dot { width: 28px; height: 28px; font-size: 12px; }

  /* Quiz tabs */
  .quiz-tabs .quiz-tab { padding: 9px 14px; font-size: 12px; }
  .hist-grid { grid-template-columns: 1fr !important; }

  /* Landing */
  .hero { padding: 40px 16px 36px; }
  .hero-cta { flex-direction: column; align-items: center; }
  .btn-hero-primary, .btn-hero-secondary { width: 100%; max-width: 320px; justify-content: center; }
  .hero-trust { gap: 12px; }
  .stats-banner { grid-template-columns: repeat(3,1fr); }
  .stat-banner-num { font-size: 22px; }
  .section { padding: 36px 16px; }
  .features-grid { grid-template-columns: 1fr; gap: 14px; }
  .feature-card { padding: 18px; }
  .steps-grid { grid-template-columns: 1fr; gap: 20px; }
  .steps-grid::before { display: none; }
  .testimonials-grid { grid-template-columns: 1fr; gap: 12px; }
  .cta-section { margin: 0 12px 40px; padding: 36px 20px; border-radius: 18px; }
  .cta-btns { flex-direction: column; align-items: center; }
  .btn-cta-white, .btn-cta-outline { width: 100%; max-width: 300px; justify-content: center; }

  /* Auth */
  .auth-bg { padding: 20px 12px; }
  .auth-card { border-radius: 16px; }
  .auth-header { padding: 24px 20px 18px; }
  .auth-body { padding: 20px 20px 24px; }

  /* Profile */
  .profile-wrap { margin: 20px auto; padding: 0 12px; }

  /* Pricing modal */
  #upgradeModal { padding: 12px; }
}

@media (max-width: 480px) {
  .nav-tab span { display: none; }  /* chỉ show emoji trên mobile nhỏ */
  .nav-auth-login { display: none; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .topic-grid { grid-template-columns: repeat(2,1fr); }
}

@keyframes xpInRight { 0%{opacity:0;transform:translateY(-10px)} 20%{opacity:1;transform:translateY(0)} 80%{opacity:1} 100%{opacity:0;transform:translateY(-6px)} }