/* ============================================================
   AI English Tutor — Mobile-First CSS
   ============================================================ */

:root {
  --primary: #667eea;
  --primary-dark: #5a6fd6;
  --secondary: #764ba2;
  --accent: #f093fb;
  --success: #38d9a9;
  --warning: #fcc419;
  --danger: #ff6b6b;
  --info: #4facfe;
  --bg: #f0f2ff;
  --bg-card: #ffffff;
  --text: #2d3748;
  --text-muted: #718096;
  --border: #e2e8f0;
  --clay-shadow: 3px 3px 0 rgba(0,0,0,0.10), 0 2px 8px rgba(102,126,234,0.12);
  --clay-shadow-hover: 5px 5px 0 rgba(0,0,0,0.13), 0 4px 16px rgba(102,126,234,0.22);
  --sidebar-w: 240px;
  --topbar-h: 56px;
  --bottom-nav-h: 62px;
  --radius: 16px;
  --radius-sm: 10px;
  --font-main: 'Plus Jakarta Sans', sans-serif;
  --font-alt: 'Space Grotesk', sans-serif;
}

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

html { scroll-behavior: smooth; }

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

/* ── Clay Card ── */
.clay-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--clay-shadow);
  border: 1.5px solid rgba(255,255,255,0.85);
  padding: 1rem;
  transition: box-shadow .2s, transform .15s;
}
.clay-card:hover { box-shadow: var(--clay-shadow-hover); }
.clay-card-inner { background: #f7f9ff; border-radius: var(--radius-sm); padding: .65rem .9rem; }

/* ── Buttons ── */
.clay-btn {
  border-radius: var(--radius-sm) !important;
  box-shadow: 2px 3px 0 rgba(0,0,0,0.13) !important;
  font-weight: 700;
  transition: transform .1s, box-shadow .1s !important;
  touch-action: manipulation;
}
.clay-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,0.13) !important; }
.clay-btn-sm { border-radius: 8px !important; box-shadow: 2px 2px 0 rgba(0,0,0,0.10) !important; font-weight: 700; font-size: .83rem; padding: .32rem .8rem; }
.clay-btn-sm:active { transform: translateY(1px); }

/* ── Input ── */
.clay-input {
  border-radius: var(--radius-sm) !important;
  border: 2px solid var(--border) !important;
  background: #fafbff !important;
  box-shadow: inset 1px 1px 3px rgba(0,0,0,0.05) !important;
  font-family: var(--font-main);
  font-size: 16px !important; /* prevent iOS zoom */
}
.clay-input:focus { border-color: var(--primary) !important; box-shadow: inset 1px 1px 3px rgba(0,0,0,0.05), 0 0 0 3px rgba(102,126,234,0.15) !important; outline: none; }

/* ============================================================
   LAYOUT — SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: linear-gradient(160deg, #667eea 0%, #764ba2 100%);
  display: flex;
  flex-direction: column;
  z-index: 200;
  padding: 1rem;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}

/* Mobile: sidebar hidden by default */
@media (max-width: 767px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,.25); }
}

/* Desktop: always visible */
@media (min-width: 768px) {
  .sidebar { transform: translateX(0) !important; }
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 199;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

.sidebar-brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.brand-icon { font-size: 1.4rem; }
.brand-text { font-family: var(--font-alt); font-weight: 800; font-size: 1.15rem; color: #fff; }

.sidebar-user {
  display: flex; align-items: center; gap: .65rem;
  background: rgba(255,255,255,.15); border-radius: var(--radius-sm);
  padding: .55rem .7rem; margin-bottom: 1rem;
}
.sidebar-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,.5); }
.sidebar-user-name { color: #fff; font-weight: 700; font-size: .88rem; line-height: 1; }
.sidebar-user-level { display: flex; align-items: center; gap: .3rem; margin-top: 2px; }
.level-badge { background: rgba(255,255,255,.9); color: var(--primary); font-size: .68rem; font-weight: 800; padding: 1px 6px; border-radius: 4px; }
.xp-text { color: rgba(255,255,255,.75); font-size: .7rem; }

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.nav-item { display: flex; align-items: center; gap: .6rem; padding: .52rem .7rem; border-radius: var(--radius-sm); color: rgba(255,255,255,.8); text-decoration: none; font-weight: 500; font-size: .88rem; transition: background .18s; }
.nav-item:hover { background: rgba(255,255,255,.18); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.25); color: #fff; font-weight: 700; }
.nav-item-danger { color: rgba(255,160,160,.9); }
.nav-item-danger:hover { background: rgba(255,100,100,.2); color: #ffb3b3; }
.nav-divider { height: 1px; background: rgba(255,255,255,.2); margin: .4rem 0; }

.sidebar-streak { display: flex; align-items: center; gap: .4rem; background: rgba(255,255,255,.15); border-radius: var(--radius-sm); padding: .45rem .7rem; margin-top: .75rem; }
.streak-fire { font-size: 1.1rem; }
.streak-count { color: #fff; font-weight: 800; font-size: 1.05rem; }
.streak-label { color: rgba(255,255,255,.7); font-size: .72rem; }

/* ── Main Wrapper ── */
@media (min-width: 768px) { .main-wrapper { margin-left: var(--sidebar-w); } }
@media (max-width: 767px)  { .main-wrapper { margin-left: 0; padding-bottom: var(--bottom-nav-h); } }

/* ── Topbar ── */
.topbar {
  position: sticky; top: 0;
  height: var(--topbar-h);
  background: rgba(240,242,255,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 1rem;
  z-index: 100; gap: .75rem;
}

.sidebar-toggle {
  background: #fff; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 1.2rem;
  color: var(--text); cursor: pointer;
  padding: .2rem .45rem; line-height: 1;
  box-shadow: 1px 2px 0 rgba(0,0,0,.08);
  touch-action: manipulation;
}
@media (min-width: 768px) { .sidebar-toggle { display: none; } }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .55rem; }
.topbar-xp { display: flex; align-items: center; gap: .22rem; font-weight: 700; font-size: .88rem; background: #fff; border-radius: 20px; padding: .22rem .65rem; box-shadow: 2px 2px 0 rgba(0,0,0,.08); }
.topbar-streak { display: flex; align-items: center; gap: .18rem; font-weight: 700; font-size: .88rem; background: #fff; border-radius: 20px; padding: .22rem .55rem; box-shadow: 2px 2px 0 rgba(0,0,0,.08); }
.topbar-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 2px solid var(--primary); }

/* ── Page Content ── */
.page-content { padding: 1rem; max-width: 960px; }
@media (min-width: 768px) { .page-content { padding: 1.5rem; } }

/* ── Bottom Nav (mobile) ── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-h);
  background: #fff;
  border-top: 1.5px solid var(--border);
  display: flex; align-items: center;
  z-index: 150;
  box-shadow: 0 -2px 12px rgba(102,126,234,.12);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; text-decoration: none;
  color: var(--text-muted); font-size: .68rem; font-weight: 600;
  padding: .4rem .2rem;
  transition: color .15s;
  touch-action: manipulation;
}
.bottom-nav-item i { font-size: 1.25rem; }
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-item.active i { transform: scale(1.12); }

/* ============================================================
   AUTH
   ============================================================ */
.auth-body {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.auth-container { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1.5rem; width: 100%; }
.auth-card { width: 100%; max-width: 420px; z-index: 10; position: relative; }
.auth-logo { text-align: center; margin-bottom: 1.25rem; }
.logo-icon { font-size: 2.75rem; margin-bottom: .4rem; }
.auth-title { font-size: 1.85rem; font-weight: 800; color: var(--text); margin-bottom: .2rem; }
.auth-subtitle { color: var(--text-muted); font-size: .9rem; }
.auth-features { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1.25rem; }
.auth-feature { display: flex; align-items: center; gap: .65rem; padding: .55rem .7rem; background: #f7f9ff; border-radius: var(--radius-sm); font-size: .88rem; font-weight: 500; }
.feature-icon { font-size: 1.1rem; }
.btn-google-login {
  display: flex; align-items: center; justify-content: center; gap: .7rem;
  width: 100%; padding: .8rem 1.25rem;
  background: #fff; border: 2px solid #e0e0e0;
  border-radius: var(--radius-sm); color: #333;
  font-weight: 700; font-size: .95rem; font-family: var(--font-main);
  cursor: pointer; text-decoration: none;
  box-shadow: 3px 3px 0 rgba(0,0,0,.1);
  transition: box-shadow .2s, transform .1s;
  touch-action: manipulation;
}
.btn-google-login:hover { color: #222; text-decoration: none; box-shadow: 4px 4px 0 rgba(0,0,0,.14); }
.btn-google-login:active { transform: translateY(2px); }
.google-icon { width: 18px; height: 18px; }
.auth-terms { text-align: center; font-size: .75rem; color: var(--text-muted); margin-top: .9rem; }
.auth-terms a { color: var(--primary); }
.blob { position: fixed; border-radius: 50%; filter: blur(55px); opacity: .35; animation: blobMove 8s ease-in-out infinite alternate; }
.blob-1 { width: 350px; height: 350px; background: #f093fb; top: -80px; right: -80px; }
.blob-2 { width: 280px; height: 280px; background: #4facfe; bottom: -60px; left: -60px; animation-delay: 2s; }
.blob-3 { width: 220px; height: 220px; background: #43e97b; bottom: 30%; right: 8%; animation-delay: 4s; }
@keyframes blobMove { 0% { transform: scale(1) translate(0,0); } 100% { transform: scale(1.1) translate(18px,-18px); } }

/* ============================================================
   PLACEMENT
   ============================================================ */
.placement-container { max-width: 560px; margin: 0 auto; padding: 1.5rem .5rem; }
.placement-header { margin-bottom: 1.5rem; text-align: center; }
.placement-icon { font-size: 2.75rem; margin-bottom: .75rem; }
.placement-progress { height: 7px; border-radius: 4px; background: #e2e8f0; margin-top: .75rem; }
.question-card { margin-bottom: 1.25rem; animation: fadeIn .3s ease; }
.question-meta { display: flex; justify-content: space-between; margin-bottom: .75rem; }
.question-num { font-weight: 600; color: var(--text-muted); font-size: .85rem; }
.question-text { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; line-height: 1.55; }
.options-grid { display: grid; grid-template-columns: 1fr; gap: .55rem; }
@media (min-width: 480px) { .options-grid { grid-template-columns: 1fr 1fr; } }
.option-label { display: flex; align-items: center; gap: .55rem; background: #f7f9ff; border: 2px solid var(--border); border-radius: var(--radius-sm); padding: .6rem .8rem; cursor: pointer; transition: border-color .18s, background .18s; font-size: .88rem; }
.option-label:hover { border-color: var(--primary); background: #edf0ff; }
.option-radio { width: 16px; height: 16px; accent-color: var(--primary); }
.question-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; }
.slide-in-right { animation: slideInRight .32s ease; }
.slide-out-left  { animation: slideOutLeft .28s ease forwards; }
@keyframes slideInRight { from { opacity:0; transform:translateX(28px); } to { opacity:1; transform:translateX(0); } }
@keyframes slideOutLeft  { from { opacity:1; transform:translateX(0); } to { opacity:0; transform:translateX(-28px); } }
.shake { animation: shake .4s ease; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }
.result-container { padding: 1.5rem .5rem; max-width: 560px; margin: 0 auto; }
.result-animation { position: relative; width: 90px; height: 90px; margin: 0 auto; }
.result-ring { position: absolute; inset: 0; border: 4px solid var(--primary); border-radius: 50%; animation: pulse 2s ease infinite; }
.result-level { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1.75rem; font-weight: 800; color: var(--primary); font-family: var(--font-alt); }
@keyframes pulse { 0%,100%{transform:scale(1);opacity:1} 50%{transform:scale(1.1);opacity:.7} }
.result-strength { border-left: 4px solid var(--success); }
.result-weakness { border-left: 4px solid var(--warning); }
.target-badge { background: var(--primary); color: #fff; padding: .3rem .7rem; border-radius: 20px; font-size: .82rem; }

/* ============================================================
   DASHBOARD
   ============================================================ */
.dashboard-greeting {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 1.25rem; padding: 1.1rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius); color: white;
  box-shadow: var(--clay-shadow);
}
.dashboard-greeting h2 { color: #fff; font-size: 1.15rem; }
.dashboard-greeting .text-muted { color: rgba(255,255,255,.8) !important; font-size: .85rem; }
.level-circle { width: 52px; height: 52px; background: rgba(255,255,255,.25); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1rem; font-weight: 800; color: #fff; border: 2.5px solid rgba(255,255,255,.5); font-family: var(--font-alt); flex-shrink: 0; }

.stat-card { text-align: center; padding: .9rem .75rem; cursor: default; }
.stat-icon  { font-size: 1.5rem; margin-bottom: .35rem; }
.stat-value { font-size: 1.35rem; font-weight: 800; font-family: var(--font-alt); line-height: 1; }
.stat-label { font-size: .72rem; color: var(--text-muted); margin-top: .2rem; font-weight: 500; }

.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .65rem; }
.mission-date { color: var(--text-muted); font-size: .8rem; }
.mission-message { display: flex; align-items: flex-start; gap: .65rem; background: linear-gradient(135deg,#f0f2ff,#fff); border-left: 4px solid var(--primary); font-style: italic; font-size: .88rem; }
.mission-ai-icon { font-size: 1.15rem; }

.mission-card { display: block; text-decoration: none; color: var(--text); padding: .85rem; position: relative; overflow: hidden; cursor: pointer; }
.mission-card:hover { color: var(--text); text-decoration: none; transform: translateY(-2px); }
.mission-module-icon { font-size: 1.5rem; margin-bottom: .3rem; }
.mission-module-name { font-weight: 700; font-size: .82rem; line-height: 1.2; }
.mission-module-meta { display: flex; justify-content: space-between; margin-top: .4rem; }
.mission-xp   { font-size: .72rem; font-weight: 700; color: var(--primary); }
.mission-time { font-size: .72rem; color: var(--text-muted); }
.module-blue   { background: linear-gradient(135deg,#dbeafe,#eff6ff); }
.module-purple { background: linear-gradient(135deg,#f3e8ff,#faf5ff); }
.module-orange { background: linear-gradient(135deg,#fef3c7,#fffbeb); }
.module-green  { background: linear-gradient(135deg,#dcfce7,#f0fdf4); }
.module-teal   { background: linear-gradient(135deg,#ccfbf1,#f0fdfa); }
.module-pink   { background: linear-gradient(135deg,#fce7f3,#fdf2f8); }
.module-red    { background: linear-gradient(135deg,#fee2e2,#fff5f5); }
.module-yellow { background: linear-gradient(135deg,#fef9c3,#fefce8); }
.module-gray   { background: linear-gradient(135deg,#f3f4f6,#f9fafb); }
.mission-done  { opacity: .6; }
.mission-check { position: absolute; top: 7px; right: 7px; color: var(--success); font-size: .9rem; }

.xp-progress { height: 9px; border-radius: 5px; background: #e2e8f0; }
.xp-bar { background: linear-gradient(90deg, var(--primary), var(--secondary)); border-radius: 5px; transition: width 1s ease; }
.skills-grid { display: flex; flex-direction: column; gap: .65rem; }
.skill-item { display: flex; align-items: center; gap: .65rem; }
.skill-icon { font-size: 1.1rem; width: 26px; text-align: center; }
.skill-info { flex: 1; }
.skill-name { font-size: .82rem; font-weight: 600; margin-bottom: 3px; }
.skill-bar-wrap { height: 7px; background: #e2e8f0; border-radius: 4px; overflow: hidden; }
.skill-bar { height: 100%; border-radius: 4px; transition: width 1s ease; }
.skill-score { font-size: .78rem; font-weight: 700; color: var(--text-muted); white-space: nowrap; }

/* ============================================================
   LESSON VIEWS
   ============================================================ */
.lesson-header { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }

/* Vocab */
.vocab-tabs { gap: 6px; margin-bottom: 1rem; }
.vocab-tabs .nav-link { background: #fff; border: 2px solid var(--border); border-radius: 10px !important; color: var(--text); font-weight: 600; box-shadow: 2px 2px 0 rgba(0,0,0,.08); font-size: .85rem; padding: .35rem .85rem; }
.vocab-tabs .nav-link.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.word-card { padding: 1.25rem; text-align: center; }
.word-main { font-size: 1.75rem; font-weight: 800; color: var(--text); font-family: var(--font-alt); margin-bottom: .2rem; }
.word-phonetic { color: var(--text-muted); font-size: .88rem; margin-bottom: .85rem; }
.btn-speak { background: #edf0ff; border: 1.5px solid #c7d2fe; border-radius: 8px; padding: .35rem .9rem; font-size: .82rem; font-weight: 600; color: var(--primary); cursor: pointer; display: inline-flex; align-items: center; gap: .3rem; }
.word-meaning { font-size: 1.25rem; font-weight: 700; color: var(--primary); margin-bottom: .6rem; }
.word-example { color: var(--text); margin-bottom: .35rem; line-height: 1.55; font-size: .9rem; }
.word-tip { background: #fefce8; border: 1px solid #fef08a; border-radius: 8px; padding: .45rem .7rem; font-size: .82rem; margin-bottom: .65rem; text-align: left; }
.word-actions { display: flex; gap: .4rem; justify-content: center; flex-wrap: wrap; }
.srs-rating-btns { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }
.complete-icon { font-size: 2.75rem; }
.empty-icon { font-size: 2.75rem; margin-bottom: .5rem; }

/* Writing */
.prompt-card { display: flex; align-items: center; gap: .85rem; cursor: pointer; padding: 1rem; transition: border-color .18s; }
.prompt-card:hover { border-color: var(--primary); }
.prompt-card.selected { border-color: var(--primary); background: #edf0ff; }
.prompt-icon { font-size: 1.4rem; }
.prompt-text { flex: 1; font-weight: 500; font-size: .9rem; }
.prompt-select-indicator { color: var(--primary); }
.writing-prompt-display { font-size: .95rem; font-weight: 600; color: var(--primary); line-height: 1.5; }
.writing-textarea { min-height: 160px; resize: vertical; font-size: 1rem !important; line-height: 1.7; }
.word-counter { font-size: .78rem; color: var(--text-muted); font-weight: 500; }
.writing-actions { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.feedback-ai-icon { font-size: 1.4rem; }
.score-badge { background: var(--primary); color: #fff; font-weight: 800; font-size: .95rem; padding: .22rem .7rem; border-radius: 20px; }
.score-good { background: var(--success); }
.score-ok   { background: var(--warning); color: #333; }
.score-bad  { background: var(--danger); }
.error-item { background: #fff5f5; border-radius: 8px; padding: .55rem; margin-bottom: .45rem; }
.error-wrong   { display: block; color: var(--danger); font-size: .83rem; }
.error-correct { display: block; color: var(--success); font-size: .83rem; }
.natural-version { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: .7rem; font-size: .88rem; line-height: 1.6; }
.vocab-chip { display: inline-block; background: #edf0ff; color: var(--primary); border-radius: 6px; padding: .18rem .55rem; font-size: .82rem; margin: 2px; font-weight: 600; }
.feedback-positive { background: #f0fdf4; border-radius: 8px; padding: .55rem; font-size: .88rem; }

/* Chat mini */
.ai-chat-mini { max-height: 190px; overflow-y: auto; display: flex; flex-direction: column; gap: .45rem; padding: .4rem 0; }
.chat-msg { padding: .45rem .7rem; border-radius: 12px; font-size: .85rem; max-width: 85%; word-break: break-word; }
.user-msg { background: var(--primary); color: #fff; align-self: flex-end; }
.ai-msg   { background: #f7f9ff; color: var(--text); align-self: flex-start; }
.ai-icon  { margin-right: .3rem; }

/* Conversation */
.role-card { cursor: pointer; padding: 1rem; text-align: center; transition: transform .18s; }
.role-card:hover { transform: translateY(-2px); }
.role-card.selected { border-color: var(--primary); background: #edf0ff; }
.role-icon { font-size: 1.75rem; margin-bottom: .4rem; }
.role-name { font-size: .85rem; margin-bottom: .2rem; }
.role-desc { font-size: .75rem; }
.chat-header { display: flex; justify-content: space-between; align-items: center; padding: .7rem .9rem; }
.chat-role-info { display: flex; align-items: center; gap: .65rem; }
.chat-role-icon { font-size: 1.4rem; }
.chat-messages { height: 320px; overflow-y: auto; padding: .85rem; display: flex; flex-direction: column; gap: .65rem; }
@media (min-width: 768px) { .chat-messages { height: 380px; } }
.chat-welcome { display: flex; align-items: flex-start; gap: .65rem; }
.chat-ai-avatar { font-size: 1.35rem; }
.chat-msg-row { display: flex; align-items: flex-start; gap: .45rem; }
.user-row { flex-direction: row-reverse; }
.chat-bubble { max-width: 78%; padding: .55rem .8rem; border-radius: 14px; font-size: .88rem; line-height: 1.5; word-break: break-word; }
.ai-bubble   { background: #f7f9ff; border: 1.5px solid var(--border); }
.user-bubble { background: var(--primary); color: #fff; }
.ai-avatar { font-size: 1.2rem; }
.typing-bubble { display: flex; align-items: center; gap: 4px; padding: .65rem .9rem; }
.typing-bubble span { width: 6px; height: 6px; background: var(--text-muted); border-radius: 50%; animation: typing 1s ease infinite; }
.typing-bubble span:nth-child(2) { animation-delay: .15s; }
.typing-bubble span:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-5px)} }
.chat-input-area { display: flex; gap: .45rem; align-items: center; padding: .65rem; }
.btn-mic { width: 40px; height: 40px; border-radius: 50% !important; padding: 0; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.btn-mic.listening { background: var(--danger); border-color: var(--danger); color: #fff; animation: micPulse 1s ease infinite; }
@keyframes micPulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.1)} }
.quick-phrases { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; padding: 0 .65rem .55rem; }
.quick-label { font-size: .75rem; color: var(--text-muted); }
.quick-btn { background: #fff; border: 1.5px solid var(--border); border-radius: 20px; padding: .22rem .6rem; font-size: .75rem; font-weight: 500; cursor: pointer; transition: border-color .18s; touch-action: manipulation; }
.quick-btn:hover { border-color: var(--primary); color: var(--primary); }
.chat-stats { display: flex; gap: .85rem; padding: .55rem .9rem; }
.stat-mini { display: flex; align-items: center; gap: .3rem; font-size: .8rem; color: var(--text-muted); font-weight: 500; }

/* Speaking */
.exercise-card { padding: 1.25rem; }
.exercise-prompt { display: flex; gap: .65rem; align-items: flex-start; margin-bottom: .85rem; }
.exercise-hint { display: flex; gap: .45rem; align-items: flex-start; margin-bottom: .85rem; }
.record-area { padding: 1.25rem 0; text-align: center; }
.record-visualizer { display: flex; align-items: center; justify-content: center; gap: 4px; height: 44px; margin-bottom: .85rem; }
.wave-bar { width: 5px; background: linear-gradient(var(--primary), var(--secondary)); border-radius: 3px; }
@keyframes wave { from{height:8px} to{height:32px} }
.record-status { color: var(--text-muted); font-size: .83rem; margin-bottom: .85rem; }
.transcript-box { background: #f7f9ff; border-radius: 8px; padding: .65rem; min-height: 44px; font-size: .88rem; margin-bottom: .85rem; text-align: left; }
.btn-record { width: 60px; height: 60px; border-radius: 50%; background: linear-gradient(135deg, var(--danger), #ff8e53); border: none; color: #fff; font-size: 1.35rem; cursor: pointer; box-shadow: 0 4px 12px rgba(255,107,107,.4); transition: transform .2s; display: flex; align-items: center; justify-content: center; margin: 0 auto; touch-action: manipulation; }
.btn-record:hover { transform: scale(1.05); }
.btn-record.recording { background: #333; animation: recordPulse 1.5s ease infinite; }
@keyframes recordPulse { 0%,100%{box-shadow:0 0 0 0 rgba(50,50,50,.4)} 50%{box-shadow:0 0 0 10px rgba(50,50,50,0)} }
.speaking-feedback { background: #f7f9ff; border-radius: var(--radius-sm); padding: .85rem; margin-top: .85rem; }
.feedback-header { font-weight: 700; margin-bottom: .65rem; }
.feedback-score { font-size: 1.05rem; font-weight: 700; margin-bottom: .45rem; }
.feedback-row { display: flex; align-items: flex-start; gap: .45rem; margin-bottom: .35rem; font-size: .85rem; }
.feedback-encouragement { color: var(--success); font-weight: 600; margin-top: .45rem; }
.exercise-nav { display: flex; justify-content: space-between; margin-top: .85rem; }

/* Shadowing */
.shadowing-intro { border-left: 4px solid #f7971e; }
.shadowing-tips { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: .85rem; }
.tip-chip { background: #fefce8; border: 1px solid #fef08a; border-radius: 20px; padding: .22rem .6rem; font-size: .78rem; }
.shadowing-text { font-size: .95rem; line-height: 1.85; margin-bottom: 1rem; padding: .85rem; background: #f7f9ff; border-radius: var(--radius-sm); }
.shadow-sentence { cursor: pointer; border-radius: 4px; padding: 1px 3px; transition: background .18s; }
.shadow-sentence:hover  { background: #dbeafe; }
.shadow-sentence.active { background: #bfdbfe; font-weight: 600; }
.shadowing-controls { display: flex; flex-direction: column; gap: .65rem; }
@media (min-width: 480px) { .shadowing-controls { flex-direction: row; justify-content: space-between; align-items: center; flex-wrap: wrap; } }
.speed-control { display: flex; align-items: center; gap: .35rem; }
.main-controls { display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; }
.attempts-tracker { display: flex; align-items: center; gap: .45rem; margin-top: .65rem; }
.attempt-dot { font-size: .95rem; color: var(--primary); }
.shadow-compare { display: grid; grid-template-columns: 1fr; gap: .65rem; margin-bottom: .85rem; }
@media (min-width: 480px) { .shadow-compare { grid-template-columns: 1fr 1fr; } }
.shadow-original { background: #f7f9ff; border-radius: 8px; padding: .65rem; font-size: .85rem; }
.shadow-yours    { background: #f0fdf4; border-radius: 8px; padding: .65rem; font-size: .85rem; }

/* Grammar */
.weak-areas-banner { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; border-left: 4px solid var(--warning); font-size: .85rem; }
.grammar-rule { display: flex; align-items: flex-start; gap: .45rem; font-size: .88rem; }
.option-btn { display: block; width: 100%; text-align: left; background: #f7f9ff; border: 2px solid var(--border); border-radius: var(--radius-sm); padding: .58rem .8rem; font-family: var(--font-main); font-size: .88rem; font-weight: 500; cursor: pointer; transition: border-color .18s, background .18s; margin-bottom: .35rem; touch-action: manipulation; }
.option-btn:hover:not(:disabled) { border-color: var(--primary); background: #edf0ff; }
.option-correct { border-color: var(--success) !important; background: #f0fdf4 !important; color: #166534; }
.option-wrong   { border-color: var(--danger)  !important; background: #fff5f5 !important; color: #991b1b; }
.grammar-feedback { background: #f7f9ff; border-radius: var(--radius-sm); padding: .85rem; margin-top: .85rem; }
.result-correct { background: #f0fdf4; border-radius: 6px; padding: .45rem .7rem; color: #166534; font-weight: 600; font-size: .88rem; }
.result-wrong   { background: #fff5f5; border-radius: 6px; padding: .45rem .7rem; color: #991b1b; font-weight: 600; font-size: .88rem; }
.explanation-box { background: #edf0ff; border-radius: 6px; padding: .45rem .7rem; margin-top: .45rem; font-size: .85rem; }
.grammar-complete { padding: 1.75rem 1.25rem; text-align: center; }

/* Reading */
.reading-passage-box { max-height: 50vh; overflow-y: auto; }
@media (min-width: 768px) { .reading-passage-box { max-height: 65vh; position: sticky; top: 70px; } }
.article-title { font-size: 1.3rem; line-height: 1.4; margin-bottom: .65rem; }
.article-body  { font-size: .93rem; line-height: 1.85; }
.vocab-highlights { display: flex; flex-direction: column; gap: .65rem; }
.vocab-highlight-item { padding: .55rem .7rem; background: #f7f9ff; border-radius: 8px; border-left: 3px solid var(--primary); }
.vh-word { font-size: .95rem; font-weight: 700; }
.vh-meaning { font-size: .85rem; color: var(--primary); }
.comprehension-q { padding-bottom: .65rem; border-bottom: 1px solid var(--border); margin-bottom: .65rem; }
.discussion-prompts { display: flex; flex-direction: column; gap: .45rem; }
.discussion-prompt-btn { background: #f7f9ff; border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: .55rem .8rem; text-align: left; font-family: var(--font-main); font-size: .85rem; cursor: pointer; transition: border-color .18s; touch-action: manipulation; }
.discussion-prompt-btn:hover { border-color: var(--primary); }

/* ============================================================
   XP TOAST
   ============================================================ */
.xp-toast {
  position: fixed; bottom: 80px; right: 16px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff; padding: .6rem 1.1rem;
  border-radius: 24px; font-weight: 700; font-size: .95rem;
  display: flex; align-items: center; gap: .35rem;
  box-shadow: 0 4px 18px rgba(102,126,234,.45);
  z-index: 9999;
  transform: translateY(100px); opacity: 0;
  transition: transform .38s cubic-bezier(.34,1.56,.64,1), opacity .38s;
}
@media (min-width: 768px) { .xp-toast { bottom: 24px; right: 24px; } }
.xp-toast.show { transform: translateY(0); opacity: 1; }

/* ============================================================
   IELTS
   ============================================================ */
.ielts-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: .65rem; }
.ielts-overall-badge { text-align: center; background: linear-gradient(135deg,var(--primary),var(--secondary)); border-radius: var(--radius); padding: .65rem 1rem; color: #fff; box-shadow: var(--clay-shadow); }
.overall-band  { font-size: 1.85rem; font-weight: 900; font-family: var(--font-alt); line-height: 1; }
.overall-label { font-size: .68rem; opacity: .8; }
.ielts-module-card { padding: .85rem; }
.module-icon  { font-size: 1.5rem; margin-bottom: .3rem; }
.band-display { font-size: 1.6rem; font-weight: 900; font-family: var(--font-alt); line-height: 1.1; }
.ielts-practice-card { padding: 1.1rem; }
.practice-header { display: flex; align-items: center; gap: .65rem; }
.practice-icon { font-size: 1.5rem; }
.band-chip { margin-left: auto; background: var(--primary); color: #fff; font-weight: 800; font-size: .9rem; padding: .22rem .6rem; border-radius: 20px; font-family: var(--font-alt); flex-shrink: 0; }
.section-btns { display: flex; flex-wrap: wrap; gap: .35rem; }
.section-btn { background: #edf0ff; border: 1.5px solid #c7d2fe; border-radius: 8px; padding: .28rem .65rem; font-size: .8rem; font-weight: 700; color: var(--primary); text-decoration: none; touch-action: manipulation; }
.section-btn:hover { background: var(--primary); color: #fff; text-decoration: none; }
.section-btn-alt { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.section-btn-alt:hover { background: #166534; color: #fff; }
.ielts-action-card { padding: 1.1rem; cursor: pointer; text-decoration: none; color: var(--text); transition: transform .18s; }
.ielts-action-card:hover { color: var(--text); text-decoration: none; transform: translateY(-2px); }
.action-icon { font-size: 1.85rem; margin-bottom: .4rem; }
.history-list { display: flex; flex-direction: column; }
.history-item { display: flex; justify-content: space-between; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--border); gap: .5rem; }
.history-item:last-child { border-bottom: none; }
.band-pill  { background: #dbeafe; color: #1e40af; font-weight: 700; font-size: .8rem; padding: .18rem .55rem; border-radius: 12px; white-space: nowrap; }
.score-pill { background: #f3f4f6; color: #374151; font-weight: 600; font-size: .8rem; padding: .18rem .55rem; border-radius: 12px; white-space: nowrap; }
.criteria-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }
.criterion { background: #f7f9ff; border-radius: 8px; padding: .55rem .7rem; font-size: .83rem; }
.criterion-chip { background: #edf0ff; color: var(--primary); border-radius: 20px; padding: .22rem .6rem; font-size: .75rem; font-weight: 600; }
.writing-prompt-card { cursor: pointer; padding: 1.1rem; transition: border-color .18s; }
.writing-prompt-card:hover { border-color: var(--primary); }
.writing-prompt-card.selected { border-color: var(--primary); background: #edf0ff; }
.prompt-badge { display: inline-block; background: var(--primary); color: #fff; font-size: .72rem; font-weight: 700; padding: .18rem .6rem; border-radius: 20px; }
.image-desc-box { background: #f0f2ff; border: 1px dashed #c7d2fe; border-radius: 8px; padding: .65rem; font-size: .83rem; color: #4338ca; margin-top: .45rem; }
.writing-question-display { background: #f7f9ff; border-left: 4px solid var(--primary); border-radius: var(--radius-sm); padding: .85rem; font-size: .92rem; }
.ielts-timer { padding: .65rem .9rem; }
.timer-display { font-size: 1.15rem; font-weight: 800; font-family: var(--font-alt); color: var(--primary); }
.band-result-card { padding: 1.75rem 1rem; }
.band-result-label { font-size: .83rem; color: var(--text-muted); margin-bottom: .2rem; }
.band-result-score { font-size: 3.5rem; font-weight: 900; font-family: var(--font-alt); line-height: 1; margin-bottom: .2rem; }
.band-result-desc  { font-size: .95rem; color: var(--text-muted); }
.band-mini { font-size: .95rem; font-weight: 800; font-family: var(--font-alt); }
.model-answer-box { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: .7rem; font-size: .88rem; line-height: 1.7; white-space: pre-wrap; }
.examiner-note { background: #edf0ff; border-left: 4px solid var(--primary); border-radius: var(--radius-sm); padding: .7rem .9rem; font-size: .85rem; }
.reading-passage-box { max-height: 50vh; overflow-y: auto; }
@media (min-width: 992px) { .reading-passage-box { max-height: 68vh; position: sticky; top: 70px; } }
.passage-text { font-size: .92rem; line-height: 1.85; }
.reading-q { padding: .65rem 0; border-bottom: 1px solid var(--border); }
.reading-q:last-child { border-bottom: none; }
.q-num-label { font-weight: 700; color: var(--primary); margin-bottom: .3rem; font-size: .88rem; }
.q-text { font-size: .88rem; font-weight: 500; margin-bottom: .4rem; }
.tfng-btns { display: flex; gap: .35rem; flex-wrap: wrap; }
.tfng-btn { background: #f7f9ff; border: 1.5px solid var(--border); border-radius: 8px; padding: .28rem .6rem; font-size: .78rem; font-weight: 700; cursor: pointer; transition: background .18s; touch-action: manipulation; }
.tfng-btn:hover { border-color: var(--primary); }
.tfng-btn.selected { background: var(--primary); border-color: var(--primary); color: #fff; }
.mc-options { display: flex; flex-direction: column; gap: .28rem; }
.mc-btn { background: #f7f9ff; border: 1.5px solid var(--border); border-radius: 8px; padding: .38rem .7rem; text-align: left; font-family: var(--font-main); font-size: .83rem; cursor: pointer; transition: background .18s; touch-action: manipulation; }
.mc-btn:hover { border-color: var(--primary); }
.mc-btn.selected { background: var(--primary); color: #fff; border-color: var(--primary); }
.fb-correct { color: #166534; } .fb-wrong { color: #991b1b; }
.audio-controls { display: flex; gap: .45rem; justify-content: center; flex-wrap: wrap; }
.audio-progress { max-width: 360px; margin: 0 auto; }
.script-box { background: #f7f9ff; border-radius: var(--radius-sm); padding: .65rem; }
.script-text { font-size: .85rem; line-height: 1.7; }
.listening-q { padding: .45rem 0; border-bottom: 1px solid var(--border); }
.topic-header { border-left: 4px solid var(--primary); }
.topic-label { font-size: .72rem; color: var(--text-muted); font-weight: 600; }
.q-number { font-size: .75rem; color: var(--text-muted); }
.cue-card { cursor: pointer; padding: 1.1rem; transition: border-color .18s; }
.cue-card:hover { border-color: var(--primary); }
.cue-card.selected { border-color: var(--primary); background: #edf0ff; }
.prep-timer { padding: 1.1rem; text-align: center; }
.timer-big { font-size: 2.75rem; font-weight: 900; font-family: var(--font-alt); color: var(--primary); line-height: 1; margin: .45rem 0; }
.band-mini-result { display: flex; justify-content: space-between; align-items: center; background: #f7f9ff; border-radius: 8px; padding: .45rem .7rem; font-size: .85rem; }
.criteria-mini-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: .35rem; }
@media (min-width: 480px) { .criteria-mini-grid { grid-template-columns: repeat(4,1fr); } }
.criteria-mini-item { background: #f7f9ff; border-radius: 6px; padding: .32rem; text-align: center; }
.band-scale { display: flex; flex-direction: column; gap: .35rem; }
.band-scale-item { display: flex; align-items: center; gap: .65rem; }
.band-scale-num { width: 55px; text-align: center; font-weight: 800; font-size: .82rem; padding: .22rem; border-radius: 6px; font-family: var(--font-alt); }
.band-scale-label { font-size: .85rem; font-weight: 500; }

/* ============================================================
   UTILITIES & ANIMATIONS
   ============================================================ */
@keyframes fadeIn { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }
.fade-in { animation: fadeIn .32s ease; }
.bg-pink   { background-color: #fce7f3 !important; }
.bg-teal   { background-color: #ccfbf1 !important; }
.bg-orange { background-color: #fed7aa !important; }
.bg-yellow { background-color: #fef08a !important; }

/* Tap highlight fix for mobile */
a, button { -webkit-tap-highlight-color: transparent; }

/* Prevent text size adjust on mobile */
html { -webkit-text-size-adjust: 100%; }

/* Voice Bar */
.voice-bar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: .5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: .85rem;
}

/* Voice button — selalu tampil di semua ukuran layar */
.btn-voice {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  padding: .2rem .45rem;
  cursor: pointer;
  line-height: 1;
  box-shadow: 1px 2px 0 rgba(0,0,0,.08);
  touch-action: manipulation;
  display: flex;
  align-items: center;
}
.btn-voice:hover { background: #f0f2ff; border-color: var(--primary); }
