/* =========================================================================
   FD.Exams — Premium SaaS Dashboard
   Light slate + indigo accent · Inter + Instrument Serif · clean modern
   ========================================================================= */

:root {
  /* Surfaces */
  --bg: #F3F0FB;
  --bg-2: #E9E2F7;
  --surface: #FFFFFF;
  --surface-2: #FAF7FE;
  --hero: #0E1322;
  --hero-2: #131A2E;

  /* Borders */
  --border: #E8ECF1;
  --border-2: #DDE2E8;
  --border-dark: rgba(255, 255, 255, 0.08);
  --border-dark-2: rgba(255, 255, 255, 0.12);

  /* Text */
  --text: #0F172A;
  --text-2: #475569;
  --text-3: #64748B;
  --muted: #94A3B8;
  --text-inv: #F8FAFC;
  --text-inv-2: #CBD5E1;
  --text-inv-3: rgba(255, 255, 255, 0.55);

  /* Accent (violet — primary brand colour) */
  --primary: #7C3AED;
  --primary-hover: #6D28D9;
  --primary-soft: #F4EEFE;
  --primary-soft-2: #E9DCFD;
  --violet: #8B5CF6;
  --violet-soft: #F3EEFF;

  /* Status / utility */
  --green: #10B981;
  --green-soft: #DCFCE7;
  --blue: #2563EB;
  --blue-soft: #DBEAFE;
  --orange: #F97316;
  --orange-soft: #FFEDD5;
  --orange-2: #EA580C;
  --red: #EF4444;
  --red-soft: #FEE2E2;
  --gold: #F59E0B;
  --gold-soft: #FEF3C7;

  /* Sizing */
  --sidebar-w: 244px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 68px;
  --container: 1240px;

  /* Radius */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-2xl: 28px;
  --r-pill: 999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 1px rgba(15, 23, 42, 0.02);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.10);
  --shadow-hero: 0 30px 60px -20px rgba(15, 23, 42, 0.45);

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: 0.15s;
  --t-base: 0.22s;
}

/* =========================================================================
   Base
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }
input, textarea, select { font-family: inherit; color: inherit; }
::selection { background: var(--primary-soft-2); color: var(--text); }

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
p { margin: 0; }

.serif-italic { font-family: 'Instrument Serif', 'Georgia', serif; font-style: italic; font-weight: 400; letter-spacing: -0.01em; }

/* =========================================================================
   App layout
   ========================================================================= */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  transition: grid-template-columns var(--t-base) var(--ease);
}
.app.sidebar-collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* =========================================================================
   Sidebar
   ========================================================================= */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 22px 14px 14px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 30;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 999px; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 10px 22px;
  margin: 0 0 14px;
}
.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: linear-gradient(155deg, #34D399 0%, #10B981 100%);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(16, 185, 129, 0.3), inset 0 -2px 0 rgba(0,0,0,0.08);
}
.brand-logo i { width: 20px; height: 20px; stroke-width: 2.4; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.brand-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}
.brand-tag {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-top: 4px;
}

.nav { display: flex; flex-direction: column; gap: 22px; flex: 1; }
.nav-section { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--muted);
  padding: 0 12px 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-3);
  transition: background var(--t-fast), color var(--t-fast);
  position: relative;
}
.nav-item i { width: 17px; height: 17px; flex-shrink: 0; stroke-width: 2; color: var(--muted); transition: color var(--t-fast); }
.nav-item:hover { background: var(--bg-2); color: var(--text); }
.nav-item:hover i { color: var(--text-2); }
.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.nav-item.active i { color: var(--primary); }

.sidebar-footer {
  margin-top: auto;
  padding: 14px 0 4px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-user {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.sidebar-user-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sidebar-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
}
.sidebar-user-avatar i { width: 14px; height: 14px; }
.sidebar-user-name {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-logout-form { margin: 0; }
.sidebar-logout-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--text-3);
  display: grid;
  place-items: center;
  transition: all var(--t-fast);
}
.sidebar-logout-btn:hover { background: var(--red-soft); color: var(--red); }
.sidebar-logout-btn i { width: 14px; height: 14px; }

/* Collapsed */
.app.sidebar-collapsed .sidebar { padding: 22px 8px 14px; }
.app.sidebar-collapsed .brand-text,
.app.sidebar-collapsed .nav-label,
.app.sidebar-collapsed .nav-item span,
.app.sidebar-collapsed .sidebar-user-info,
.app.sidebar-collapsed .sidebar-user-name { display: none; }
.app.sidebar-collapsed .nav-item { justify-content: center; padding: 10px; }
.app.sidebar-collapsed .brand { justify-content: center; padding: 4px 0 22px; }
.app.sidebar-collapsed .sidebar-user { justify-content: center; padding: 8px; }

/* =========================================================================
   Topbar
   ========================================================================= */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.sidebar-toggle {
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: all var(--t-fast);
}
.sidebar-toggle:hover { background: var(--bg-2); color: var(--text); }
.sidebar-toggle i { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-toggle-text { font-size: 13px; font-weight: 600; letter-spacing: 0.2px; }
.brand-top { display: none; padding: 0; margin: 0; }

.topbar-search {
  flex: 1;
  max-width: 360px;
  position: relative;
  display: flex;
  align-items: center;
}
.topbar-search i,
.topbar-search svg {
  position: absolute;
  left: 14px;
  width: 16px; height: 16px;
  color: var(--muted);
  pointer-events: none;
}
.topbar-search input {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 38px;
  background: var(--bg-2);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 13px;
  color: var(--text);
  transition: all var(--t-fast);
}
.topbar-search input::placeholder { color: var(--muted); font-weight: 500; }
.topbar-search input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft-2);
}

.topbar-stats {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: all var(--t-fast);
}
.stat-chip i { width: 14px; height: 14px; }
.stat-chip.streak {
  color: #C2410C;
  border-color: #FED7AA;
  background: linear-gradient(180deg, #FFF7ED 0%, #FFEDD5 100%);
}
.stat-chip.streak i { color: var(--orange-2); fill: var(--orange-2); }
.stat-chip.xp {
  color: var(--primary);
  border-color: #C7D2FE;
  background: linear-gradient(180deg, #F5F3FF 0%, #EEF0FF 100%);
}
.stat-chip.xp i { color: var(--primary); fill: var(--primary); }

.topbar-divider { width: 1px; height: 24px; background: var(--border); }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--text-3);
  position: relative;
  transition: all var(--t-fast);
}
.icon-btn:hover { background: var(--bg-2); color: var(--text); }
.icon-btn i { width: 18px; height: 18px; }
.icon-btn .dot {
  position: absolute;
  top: 9px; right: 10px;
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

.topbar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border-2);
}
.topbar-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* =========================================================================
   Buttons
   ========================================================================= */
.btn,
.quiz-btn,
.qa-btn-primary,
.exam-start,
.writing-start-btn,
.vocab-search-btn,
.btn-mock,
.auth-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  height: 42px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: #fff;
  background: var(--primary);
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
  user-select: none;
}
.btn i, .quiz-btn i, .qa-btn-primary i, .vocab-search-btn i, .auth-submit i {
  width: 16px; height: 16px;
}
.btn:hover, .quiz-btn:hover, .qa-btn-primary:hover, .exam-start:hover,
.writing-start-btn:hover, .vocab-search-btn:hover, .btn-mock:hover, .auth-submit:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.28);
}
.btn:active, .quiz-btn:active, .qa-btn-primary:active, .exam-start:active,
.auth-submit:active { transform: translateY(0); box-shadow: none; }

.btn-primary, .qa-btn-primary, .exam-start, .writing-start-btn, .auth-submit, .vocab-search-btn, .btn-mock {
  background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
  color: #fff;
}
.btn-primary--dark { background: linear-gradient(180deg, #8B5CF6, #6D28D9); }

.btn-uppercase {
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-size: 11.5px;
  font-weight: 700;
}

.btn-ghost, .quiz-btn-ghost, .qa-btn-back, .writing-image-btn,
.btn-outline, .how-it-works {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  height: 42px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-2);
  transition: all var(--t-fast);
  cursor: pointer;
  white-space: nowrap;
}
.btn-ghost i, .quiz-btn-ghost i, .qa-btn-back i, .writing-image-btn i, .btn-outline i, .how-it-works i {
  width: 16px; height: 16px;
}
.btn-ghost:hover, .quiz-btn-ghost:hover, .qa-btn-back:hover, .writing-image-btn:hover,
.btn-outline:hover, .how-it-works:hover {
  background: var(--bg-2);
  border-color: var(--border-2);
  transform: translateY(-1px);
}

.btn-on-dark {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
}
.btn-on-dark:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
  box-shadow: none;
}

.btn-danger { background: var(--red); }
.btn-danger:hover { background: #DC2626; box-shadow: 0 6px 18px rgba(239, 68, 68, 0.28); }

.btn-sm { height: 34px; padding: 0 14px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 14px; border-radius: 12px; }
.btn-block { width: 100%; }

.btn[disabled], .btn.disabled, .quiz-btn[disabled] {
  opacity: 0.5;
  pointer-events: none;
}

/* =========================================================================
   Page wraps
   ========================================================================= */
.page {
  max-width: var(--container);
  margin: 0 auto;
  padding: 28px 28px 56px;
  width: 100%;
}
.books-wrap, .grammar-wrap, .vocab-wrap, .speaking-wrap, .pron-wrap,
.writing-wrap, .writing-setup-wrap, .writing-editor-wrap, .practice-wrap,
.speaking-qa-wrap, .gquiz-wrap, .reading-wrap, .quiz-wrap, .exam-grid-wrap {
  max-width: var(--container);
  margin: 0 auto;
  padding: 28px 28px 56px;
}

/* =========================================================================
   HOME — Hero, KPIs, Modules
   ========================================================================= */
.home-hero {
  position: relative;
  background: linear-gradient(135deg, #15101F 0%, #2A1E45 55%, #15101F 100%);
  border-radius: var(--r-2xl);
  padding: 44px 48px;
  color: #fff;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 40px;
  align-items: center;
  box-shadow: var(--shadow-hero);
}
.home-hero::before {
  content: '';
  position: absolute;
  inset: -60% -10% auto auto;
  width: 520px; height: 520px;
  background: radial-gradient(closest-side, rgba(139, 92, 246, 0.35), transparent 70%);
  pointer-events: none;
}
.home-hero::after {
  content: '';
  position: absolute;
  inset: auto auto -30% -10%;
  width: 380px; height: 380px;
  background: radial-gradient(closest-side, rgba(124, 58, 237, 0.22), transparent 70%);
  pointer-events: none;
}
.home-hero-body { position: relative; z-index: 1; }
.home-hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-inv-2);
  margin-bottom: 20px;
  backdrop-filter: blur(6px);
}
.home-hero-pill::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--violet);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--violet);
}
.home-hero-title {
  font-size: 50px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.035em;
  color: #fff;
  margin-bottom: 18px;
}
.home-hero-title em {
  font-family: 'Instrument Serif', 'Georgia', serif;
  font-style: italic;
  font-weight: 400;
  background: linear-gradient(120deg, #C7B7FF 0%, #A78BFA 45%, #7C3AED 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.02em;
  padding-right: 6px;
}
.home-hero-sub {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-inv-3);
  line-height: 1.6;
  max-width: 460px;
  margin-bottom: 28px;
}
.home-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.home-hero-media {
  position: relative;
  z-index: 1;
  aspect-ratio: 16/10;
  border-radius: var(--r-xl);
  background:
    linear-gradient(180deg, rgba(124, 58, 237, 0.18) 0%, rgba(139, 92, 246, 0.06) 100%),
    rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.10);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.home-hero-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
  background: #0b0f1c;
}
.home-hero-media .play {
  width: 78px; height: 78px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.40);
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
  transition: all var(--t-fast);
  cursor: pointer;
}
.home-hero-media .play:hover { background: rgba(255, 255, 255, 0.10); transform: scale(1.05); }
.home-hero-media .play i { width: 26px; height: 26px; margin-left: 3px; }
.home-hero-media .progress {
  position: absolute;
  left: 32px; right: 32px; bottom: 24px;
  height: 3px;
  background: rgba(255, 255, 255, 0.10);
  border-radius: 999px;
  overflow: hidden;
}
.home-hero-media .progress::after {
  content: '';
  display: block;
  width: 62%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--violet));
}

/* KPI cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 22px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 18px 18px;
  transition: all var(--t-fast);
}
.kpi-card:hover { transform: translateY(-2px); border-color: var(--border-2); box-shadow: var(--shadow-md); }
.kpi-card.--featured {
  background: linear-gradient(180deg, #FFFFFF 0%, #FAFBFF 100%);
  border-color: #DDE2F6;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.06);
}
.kpi-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: grid;
  place-items: center;
  color: var(--text-2);
  margin-bottom: 22px;
}
.kpi-icon i { width: 16px; height: 16px; }
.kpi-card.--featured .kpi-icon { background: var(--primary-soft); border-color: var(--primary-soft-2); color: var(--primary); }
.kpi-card.--gold .kpi-icon { background: var(--gold-soft); border-color: #FCD34D; color: #B45309; }
.kpi-card.--blue .kpi-icon { background: var(--blue-soft); border-color: #BFDBFE; color: var(--blue); }
.kpi-card.--violet .kpi-icon { background: var(--violet-soft); border-color: #DDD6FE; color: var(--violet); }

.kpi-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 4px;
}
.kpi-value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.05;
  margin-bottom: 8px;
}
.kpi-foot { font-size: 12px; font-weight: 500; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.kpi-foot .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }

/* Section header */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin: 36px 0 18px;
  flex-wrap: wrap;
}
.section-head h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.section-head h2 em {
  font-family: 'Instrument Serif', 'Georgia', serif;
  font-style: italic;
  font-weight: 400;
  color: var(--violet);
  letter-spacing: -0.01em;
}
.section-head p { font-size: 13.5px; color: var(--text-3); margin-top: 4px; }

/* Module cards */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.module-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 22px 18px;
  display: flex;
  flex-direction: column;
  min-height: 220px;
  transition: all var(--t-fast);
  color: var(--text);
}
.module-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-2);
  box-shadow: var(--shadow-md);
}
.module-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 38px; }
.module-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--primary-soft);
  border: 1px solid var(--primary-soft-2);
  color: var(--primary);
  display: grid;
  place-items: center;
}
.module-icon i { width: 18px; height: 18px; }
.module-card.--mic .module-icon { background: var(--primary-soft); border-color: var(--primary-soft-2); color: var(--primary); }
.module-card.--chat .module-icon { background: #ECFDF5; border-color: #A7F3D0; color: #047857; }
.module-card.--pen .module-icon { background: #FFF1F2; border-color: #FECDD3; color: #BE123C; }
.module-card.--head .module-icon { background: #ECFEFF; border-color: #A5F3FC; color: #0E7490; }
.module-card.--world .module-icon { background: #F0F9FF; border-color: #BAE6FD; color: #075985; }
.module-card.--cal .module-icon { background: var(--gold-soft); border-color: #FCD34D; color: #B45309; }

.module-badge {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--text-3);
  border: 1px solid var(--border);
}

.module-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 6px;
}
.module-desc {
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.5;
  flex: 1;
  margin-bottom: 18px;
}
.module-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}

.avatar-stack { display: flex; align-items: center; }
.avatar-stack > * + * { margin-left: -8px; }
.avatar-stack .avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  background: var(--bg-2);
  background-size: cover;
  background-position: center;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-3);
  display: grid;
  place-items: center;
}
.avatar-stack .avatar.count {
  background: var(--surface);
  border: 1px solid var(--border-2);
  color: var(--text-3);
}

.module-arrow {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--text-3);
  transition: all var(--t-fast);
}
.module-arrow i { width: 14px; height: 14px; }
.module-card:hover .module-arrow { background: var(--primary); border-color: var(--primary); color: #fff; }

/* =========================================================================
   Generic content / shared section intros (used by feature pages)
   ========================================================================= */
.pron-back, .reading-back, .speaking-back, .writing-back-left { margin-bottom: 18px; }
.pron-back a, .speaking-back a, .writing-back-left a, .reading-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-3);
  padding: 6px 10px;
  border-radius: 8px;
  transition: all var(--t-fast);
}
.pron-back a:hover, .speaking-back a:hover, .writing-back-left a:hover, .reading-back:hover {
  color: var(--text);
  background: var(--bg-2);
}
.pron-back i, .speaking-back i, .writing-back-left i, .reading-back i { width: 15px; height: 15px; }

.books-intro, .grammar-intro, .vocab-intro, .speaking-intro, .pron-intro,
.grammar-topic-intro, .speaking-intro-tight {
  text-align: center;
  margin-bottom: 32px;
}
.books-icon-box, .vocab-icon-box {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--primary-soft);
  border: 1px solid var(--primary-soft-2);
  color: var(--primary);
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
}
.books-icon-box i, .vocab-icon-box i { width: 24px; height: 24px; }

.speaking-tag {
  display: inline-flex;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 12px;
  border: 1px solid var(--primary-soft-2);
}

.speaking-title, .grammar-title, .vocab-title {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 8px;
}
.speaking-subtitle, .vocab-subtitle {
  color: var(--text-3);
  font-size: 14px;
  font-weight: 500;
  max-width: 580px;
  margin: 0 auto;
  line-height: 1.55;
}
.grammar-topic-emoji-big, .pron-title-icon { font-size: 48px; line-height: 1; margin-bottom: 12px; display: block; }

/* Empty state */
.topics-empty, .reading-empty, .exam-empty, .vocab-empty {
  text-align: center;
  color: var(--text-3);
  background: var(--surface);
  border: 1px dashed var(--border-2);
  border-radius: var(--r-lg);
  padding: 36px;
  font-weight: 500;
  font-size: 13.5px;
}

/* =========================================================================
   Card grids (feature pages reuse)
   ========================================================================= */
.exam-grid, .grammar-topics-grid, .book-tests-grid, .sections-grid,
.parts-grid, .topics-grid, .levels-grid, .writing-tasks {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.exam-card, .grammar-topic-card, .book-card, .book-test-card, .section-card,
.part-card, .topic-card, .level-card, .writing-task-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  transition: all var(--t-fast);
  color: var(--text);
}
.exam-card:hover, .grammar-topic-card:hover, .book-card:hover, .book-test-card:hover,
.section-card:hover, .part-card:hover, .topic-card:hover, .level-card:hover,
.writing-task-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-2);
  box-shadow: var(--shadow-md);
}
.section-card.disabled, .book-test-card.empty { opacity: 0.45; pointer-events: none; }

/* Exam card */
.exam-card-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.exam-card-title { font-size: 16px; font-weight: 700; line-height: 1.3; }
.exam-level {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid var(--primary-soft-2);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  height: fit-content;
}
.exam-meta { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.exam-meta-row { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 12.5px; font-weight: 500; }
.exam-meta-row i { width: 14px; height: 14px; }
.exam-start { margin-top: auto; height: 38px; font-size: 12.5px; }

/* Grammar topic card */
.grammar-topic-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.grammar-topic-head-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.grammar-topic-emoji {
  width: 42px; height: 42px;
  display: grid;
  place-items: center;
  font-size: 22px;
  background: var(--primary-soft);
  border: 1px solid var(--primary-soft-2);
  border-radius: 10px;
  flex-shrink: 0;
}
.grammar-topic-title { font-size: 15px; font-weight: 700; }
.grammar-topic-arrow {
  width: 28px; height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--text-3);
  transition: all var(--t-fast);
}
.grammar-topic-arrow i { width: 14px; height: 14px; }
.grammar-topic-card:hover .grammar-topic-arrow { background: var(--primary); border-color: var(--primary); color: #fff; }
.grammar-topic-footer { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.grammar-topic-meta { font-size: 11.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.6px; }
.grammar-topic-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 3px 10px;
  border-radius: 999px;
}
.grammar-topic-progress { height: 6px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.grammar-topic-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--violet));
  border-radius: 999px;
  transition: width 0.6s var(--ease);
}

/* Book card */
.book-card { align-items: center; text-align: center; padding: 18px 16px; }
.book-cover {
  width: 100%;
  aspect-ratio: 3/4;
  background: linear-gradient(155deg, #0E1322 0%, #1F2545 60%, #7C3AED 130%);
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.book-number { font-size: 48px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.book-name { font-size: 13.5px; font-weight: 600; color: var(--text-2); }

/* Book test number tile */
.book-test-card { text-align: center; padding: 22px 14px; }
.book-test-num { font-size: 24px; font-weight: 800; color: var(--text); margin-bottom: 4px; letter-spacing: -0.02em; }
.book-test-note { font-size: 10.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 1px; }

/* Section card */
.section-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--primary-soft);
  border: 1px solid var(--primary-soft-2);
  color: var(--primary);
  display: grid;
  place-items: center;
  margin-bottom: 14px;
}
.section-icon i { width: 20px; height: 20px; }
.section-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.section-meta { font-size: 12.5px; color: var(--text-3); margin-bottom: 12px; }
.section-badge {
  display: inline-flex;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  margin-top: auto;
  align-self: flex-start;
  border: 1px solid var(--primary-soft-2);
}

/* Speaking parts/topics, level cards */
.part-card, .topic-card, .level-card { padding: 22px 20px; }
.part-icon, .topic-icon, .level-icon {
  font-size: 30px;
  width: 52px; height: 52px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  border: 1px solid var(--primary-soft-2);
  border-radius: 12px;
  margin-bottom: 14px;
}
.part-title, .topic-title, .level-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; letter-spacing: -0.015em; }
.part-description, .level-subtitle { font-size: 12.5px; color: var(--text-3); line-height: 1.55; margin-bottom: 14px; }
.part-duration {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid var(--primary-soft-2);
  padding: 4px 10px;
  border-radius: 999px;
  align-self: flex-start;
  margin-top: auto;
}
.level-text { display: flex; flex-direction: column; gap: 4px; }
.level-arrow {
  position: absolute;
  top: 22px; right: 22px;
  width: 28px; height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--text-3);
  transition: all var(--t-fast);
}
.level-arrow i { width: 14px; height: 14px; }
.level-card:hover .level-arrow { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Writing task card */
.writing-task-card { flex-direction: row; align-items: center; gap: 16px; padding: 20px; }
.writing-task-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--gold-soft);
  border: 1px solid #FCD34D;
  color: #B45309;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.writing-task-icon i { width: 22px; height: 22px; }
.writing-task-body { flex: 1; min-width: 0; }
.writing-task-title { font-size: 15px; font-weight: 700; margin-bottom: 2px; letter-spacing: -0.015em; }
.writing-task-desc { font-size: 12.5px; color: var(--text-3); line-height: 1.5; }
.writing-task-arrow { color: var(--text-3); transition: all var(--t-fast); }
.writing-task-card:hover .writing-task-arrow { color: var(--primary); transform: translateX(3px); }

/* Number chips */
.tests-number-grid, .parts-number-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
}
.test-chip, .part-chip {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: center;
  padding: 18px 10px;
  transition: all var(--t-fast);
  color: var(--text);
}
.test-chip:hover, .part-chip:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.10);
}
.test-chip.completed { background: #ECFDF5; border-color: #A7F3D0; }
.test-chip-num { font-size: 20px; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.test-chip-check {
  position: absolute;
  top: 6px; right: 6px;
  width: 18px; height: 18px;
  background: var(--green);
  color: #fff;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
}
.tests-footnote { text-align: center; color: var(--text-3); font-size: 12.5px; margin-top: 16px; }

/* Past results */
.past-results, .past-results-wide { margin-top: 24px; text-align: center; }
.past-results a, .past-results-wide a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-2);
  transition: all var(--t-fast);
}
.past-results a:hover, .past-results-wide a:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}
.past-results i { width: 14px; height: 14px; }

/* =========================================================================
   Writing — "View Past Results" link + past results page
   ========================================================================= */
.wr-history-link {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 24px;
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.wr-history-link:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px -16px rgba(124, 58, 237, 0.35);
}
.wr-history-icon {
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  flex-shrink: 0;
}
.wr-history-icon i { width: 20px; height: 20px; }
.wr-history-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.wr-history-text strong { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.wr-history-text small { font-size: 12.5px; color: var(--muted); }
.wr-history-arrow { width: 20px; height: 20px; color: var(--muted); flex-shrink: 0; transition: transform 160ms ease, color 160ms ease; }
.wr-history-link:hover .wr-history-arrow { color: var(--primary); transform: translateX(3px); }

.wr-results-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  margin-bottom: 20px;
}
.wr-results-count {
  font-size: 12.5px; font-weight: 600; color: var(--muted);
  background: var(--bg); border: 1px solid var(--border);
  padding: 5px 12px; border-radius: 999px;
}

.wr-results-list { display: flex; flex-direction: column; gap: 12px; }
.wr-result-card {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: 16px;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.wr-result-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  border-left-color: var(--primary);
  box-shadow: 0 10px 28px -16px rgba(124, 58, 237, 0.3);
}
.wr-result-card[data-tier="high"] { border-left-color: #22C55E; }
.wr-result-card[data-tier="mid"]  { border-left-color: var(--primary); }
.wr-result-card[data-tier="low"]  { border-left-color: #F59E0B; }

.wr-result-main { flex: 1; min-width: 0; }
.wr-result-task { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 3px; letter-spacing: -0.01em; }
.wr-result-topic { font-size: 13.5px; color: var(--text-2); margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wr-result-meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.wr-result-meta span { display: inline-flex; align-items: center; gap: 5px; }
.wr-result-meta i { width: 13px; height: 13px; }

.wr-result-band {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center;
  min-width: 64px; flex-shrink: 0;
}
.wr-band-num { font-size: 30px; font-weight: 800; line-height: 1; color: var(--primary); letter-spacing: -0.02em; }
.wr-result-card[data-tier="high"] .wr-band-num { color: #15803D; }
.wr-result-card[data-tier="low"]  .wr-band-num { color: #B45309; }
.wr-band-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-top: 3px; }
.wr-band-pending {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700; color: #B45309;
  background: #FEF3C7; border-radius: 999px; padding: 5px 10px;
}
.wr-band-pending i { width: 13px; height: 13px; }
.wr-result-arrow { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }

@media (max-width: 560px) {
  .wr-result-topic { white-space: normal; }
  .wr-result-arrow { display: none; }
  .wr-result-band { min-width: 54px; }
  .wr-band-num { font-size: 26px; }
}

/* =========================================================================
   Writing — evaluation block (annotated essay + score + feedback)
   ========================================================================= */
.wr-eval {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 28px 28px 24px;
  margin-top: 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03), 0 12px 36px -18px rgba(15, 23, 42, 0.12);
  position: relative;
  overflow: hidden;
}
.wr-eval::before {
  content: '';
  position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--violet, #8B5CF6));
}
.wr-eval[data-tier="high"]::before { background: linear-gradient(90deg, #22C55E, #10B981); }
.wr-eval[data-tier="low"]::before  { background: linear-gradient(90deg, #F59E0B, #EF4444); }

.wr-eval-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 18px;
}
.wr-eval-title { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.wr-eval-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }

.wr-score-badge {
  display: flex; flex-direction: column; align-items: center;
  flex-shrink: 0; text-align: center;
  padding: 10px 18px; border-radius: 16px;
  background: var(--primary-soft); border: 1px solid var(--primary-soft);
  min-width: 92px;
}
.wr-eval[data-tier="high"] .wr-score-badge { background: #DCFCE7; border-color: #BBF7D0; }
.wr-eval[data-tier="low"]  .wr-score-badge { background: #FEF3C7; border-color: #FDE68A; }
.wr-score-top { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.wr-score-main { font-size: 34px; font-weight: 800; line-height: 1.05; color: var(--primary); letter-spacing: -0.02em; }
.wr-score-main small { font-size: 16px; font-weight: 700; color: var(--muted); }
.wr-eval[data-tier="high"] .wr-score-main { color: #15803D; }
.wr-eval[data-tier="low"]  .wr-score-main { color: #B45309; }

/* Annotated essay */
.wr-essay {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 24px;
  font-size: 15.5px; line-height: 2.05; color: var(--text);
  white-space: normal; word-wrap: break-word;
  margin-bottom: 14px;
}
.wr-an { position: relative; white-space: nowrap; }
.wr-an-bad { text-decoration: line-through; text-decoration-thickness: 2px; font-weight: 600; }
.wr-an-good { color: #16A34A; font-weight: 700; margin-left: 5px; }
.wr-an-good::before { content: '→\00a0'; color: #94A3B8; font-weight: 400; }
.wr-an--grammar     .wr-an-bad { color: #EF4444; text-decoration-color: #EF4444; }
.wr-an--vocabulary  .wr-an-bad { color: #3B82F6; text-decoration-color: #3B82F6; }
.wr-an--spelling    .wr-an-bad { color: #D97706; text-decoration-color: #D97706; }
.wr-an--punctuation .wr-an-bad { color: #8B5CF6; text-decoration-color: #8B5CF6; }
.wr-an-tip {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: #0F172A; color: #fff;
  font-size: 12px; line-height: 1.45; font-weight: 500; white-space: normal;
  padding: 8px 11px; border-radius: 10px; width: max-content; max-width: 260px;
  opacity: 0; visibility: hidden; transition: opacity 140ms ease, transform 140ms ease;
  z-index: 30; box-shadow: 0 8px 24px -8px rgba(15, 23, 42, 0.5);
  text-align: left;
}
.wr-an-tip b { text-transform: capitalize; color: #C4B5FD; }
.wr-an-tip::after {
  content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: #0F172A;
}
.wr-an:hover .wr-an-tip { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(-2px); }

/* Legend */
.wr-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 18px; }
.wr-leg { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.wr-leg-dot { width: 10px; height: 10px; border-radius: 3px; }
.wr-leg--grammar     .wr-leg-dot { background: #EF4444; }
.wr-leg--vocabulary  .wr-leg-dot { background: #3B82F6; }
.wr-leg--spelling    .wr-leg-dot { background: #D97706; }
.wr-leg--punctuation .wr-leg-dot { background: #8B5CF6; }

.wr-criteria { margin-bottom: 18px; }

/* Letter intro page */
.wr-intro {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 22px; padding: 36px 32px; text-align: center; margin-top: 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03), 0 12px 36px -18px rgba(15, 23, 42, 0.1);
}
.wr-intro-icon {
  display: grid; place-items: center; width: 60px; height: 60px; margin: 0 auto 16px;
  border-radius: 18px; background: var(--primary-soft); color: var(--primary);
}
.wr-intro-icon i { width: 30px; height: 30px; }
.wr-intro-heading { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 8px; }
.wr-intro-lead { font-size: 14.5px; color: var(--text-2); max-width: 560px; margin: 0 auto 26px; line-height: 1.6; }
.wr-intro-parts { display: flex; flex-direction: column; gap: 12px; max-width: 480px; margin: 0 auto 28px; text-align: left; }
.wr-intro-part { display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: var(--bg); border: 1px solid var(--border); border-radius: 14px; }
.wr-intro-key {
  display: grid; place-items: center; width: 42px; height: 42px; flex-shrink: 0;
  border-radius: 12px; background: var(--primary); color: #fff; font-weight: 800; font-size: 14px;
}
.wr-intro-title { font-size: 15px; font-weight: 700; color: var(--text); }
.wr-intro-meta { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.wr-intro-meta span { display: inline-flex; align-items: center; gap: 5px; }
.wr-intro-meta i { width: 13px; height: 13px; }
.wr-intro-start { display: inline-flex; align-items: center; gap: 8px; }
.wr-intro-start i { width: 18px; height: 18px; }

/* Letter stepper editor */
.wr-letter-wrap { max-width: 820px; margin: 0 auto; }
.wr-letter-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.wr-letter-steps { display: flex; gap: 10px; }
.wr-step { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); cursor: pointer; transition: all 150ms ease; }
.wr-step-num { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--border-2); color: var(--text-2); font-size: 11px; font-weight: 800; }
.wr-step-key { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.wr-step--active { border-color: var(--primary); background: var(--primary-soft); }
.wr-step--active .wr-step-num { background: var(--primary); color: #fff; }
.wr-step--active .wr-step-key { color: var(--primary); }
.wr-step--done .wr-step-num { background: #22C55E; color: #fff; }

.wr-part-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 24px 26px; }
.wr-part-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.wr-part-tag { font-size: 13px; font-weight: 800; color: var(--primary); background: var(--primary-soft); padding: 6px 13px; border-radius: 999px; }
.wr-part-guide { font-size: 12.5px; color: var(--muted); }
.wr-part-prompt {
  background: var(--bg); border: 1px solid var(--border); border-left: 4px solid var(--primary);
  border-radius: 12px; padding: 16px 18px; font-size: 14.5px; line-height: 1.6; color: var(--text); margin-bottom: 16px;
}
.wr-part-textarea { min-height: 240px; }
.wr-part-footer { display: flex; justify-content: flex-end; margin-top: 10px; }
.wr-wordcount { font-size: 13px; color: var(--text-2); font-weight: 600; }
.wr-wc-target { color: var(--muted); font-weight: 500; }

.wr-letter-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; }
.wr-letter-nav .quiz-btn { display: inline-flex; align-items: center; gap: 6px; }
.wr-letter-nav #backBtn { margin-right: auto; }
.wr-letter-nav #nextBtn, .wr-letter-nav #submitBtn { margin-left: auto; }
.wr-letter-nav i { width: 17px; height: 17px; }

.wr-letter-summary { margin-top: 16px; }

@media (max-width: 640px) {
  .wr-eval { padding: 22px 18px; }
  .wr-eval-head { flex-direction: column; }
  .wr-score-badge { align-self: flex-start; }
  .wr-essay { padding: 18px 16px; font-size: 15px; line-height: 1.95; }
  .wr-an, .wr-an-bad, .wr-an-good { white-space: normal; }
}

/* =========================================================================
   Vocabulary
   ========================================================================= */
.vocab-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: 999px;
  max-width: 420px;
  margin: 0 auto 22px;
}
.vocab-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-3);
  transition: all var(--t-fast);
}
.vocab-tab i { width: 15px; height: 15px; }
.vocab-tab:hover { color: var(--text); }
.vocab-tab.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25); }

.vocab-form { max-width: 720px; margin: 0 auto 24px; }
.vocab-search-row { display: flex; gap: 10px; }
.vocab-search-input {
  flex: 1;
  height: 50px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  transition: all var(--t-fast);
}
.vocab-search-input::placeholder { color: var(--muted); }
.vocab-search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft-2); }
.vocab-search-btn { height: 50px; width: 50px; padding: 0; border-radius: 12px; }

.vocab-results { max-width: 760px; margin: 0 auto; }
.vocab-word-card, .vocab-idiom-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px;
  margin-bottom: 14px;
}
.vocab-word-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.vocab-word { font-size: 28px; font-weight: 800; letter-spacing: -0.025em; }
.vocab-phonetic { font-size: 15px; color: var(--primary); font-weight: 600; }
.vocab-translations { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.vocab-tr-uz, .vocab-tr-ru {
  display: inline-flex;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.vocab-tr-uz { background: var(--green-soft); color: #047857; }
.vocab-tr-ru { background: var(--blue-soft); color: var(--blue); }

.vocab-meaning { padding-top: 16px; border-top: 1px solid var(--border); margin-top: 16px; }
.vocab-meaning:first-child { padding-top: 0; border-top: none; margin-top: 0; }
.vocab-pos {
  display: inline-flex;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--violet);
  background: var(--violet-soft);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.vocab-definitions { padding-left: 20px; margin: 0 0 12px; }
.vocab-definitions li { margin-bottom: 10px; }
.vocab-def-text { font-size: 14px; color: var(--text); line-height: 1.6; }
.vocab-def-example { font-size: 12.5px; color: var(--text-3); font-style: italic; margin-top: 4px; }
.vocab-synonyms { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.vocab-syn-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-3); margin-right: 4px; }
.vocab-syn-pill {
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--text-2);
}

.vocab-idioms { display: flex; flex-direction: column; gap: 12px; }
.vocab-idiom-phrase { font-size: 18px; font-weight: 700; margin-bottom: 6px; color: var(--primary); }
.vocab-idiom-meaning { font-size: 14px; color: var(--text); margin-bottom: 6px; line-height: 1.55; }
.vocab-idiom-example { font-size: 12.5px; color: var(--text-3); font-style: italic; margin-bottom: 4px; }
.vocab-idiom-uz { font-size: 12.5px; color: #047857; font-weight: 600; }

/* =========================================================================
   Auth
   ========================================================================= */
.auth-body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(900px 400px at 20% 0%, rgba(124, 58, 237, 0.12), transparent 60%),
    radial-gradient(700px 360px at 90% 110%, rgba(139, 92, 246, 0.10), transparent 60%),
    var(--bg);
  padding: 32px 16px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
.auth-page { width: 100%; max-width: 440px; }
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 38px 32px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
}
.auth-brand { text-align: center; margin-bottom: 26px; }
.auth-card .brand-logo {
  width: 56px; height: 56px;
  border-radius: 14px;
  margin: 0 auto 14px;
}
.auth-card .brand-logo i { width: 26px; height: 26px; }
.auth-title { font-size: 24px; font-weight: 700; margin-bottom: 4px; letter-spacing: -0.02em; }
.auth-subtitle { color: var(--text-3); font-size: 14px; }
.auth-error {
  background: var(--red-soft);
  border: 1px solid #FECACA;
  color: #B91C1C;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 500;
  margin-bottom: 16px;
  text-align: center;
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-label { display: flex; flex-direction: column; gap: 6px; }
.auth-label > span {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-3);
}
.auth-label input {
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  background: var(--surface);
  transition: all var(--t-fast);
}
.auth-label input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft-2);
}
.auth-submit { margin-top: 8px; width: 100%; height: 46px; }
.auth-switch {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
}
.auth-switch a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}
.auth-switch a:hover { text-decoration: underline; }

/* =========================================================================
   Quiz interface
   ========================================================================= */
.quiz-status-card, .gquiz-meta-row, .qa-progress {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 16px;
}
.quiz-status-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 10px; }
.quiz-progress-text, .qa-progress-label { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 1px; }
.qa-part-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px;
  background: var(--primary-soft); color: var(--primary);
  padding: 4px 10px; border-radius: 999px;
}
.quiz-timer {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 700; color: var(--orange-2);
  background: var(--orange-soft);
  padding: 5px 12px; border-radius: 999px;
}
.quiz-progress, .gquiz-progress, .qa-progress-bar {
  height: 8px; background: var(--bg-2); border-radius: 999px; overflow: hidden;
}
.quiz-progress-fill, .gquiz-progress-fill, .qa-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--violet));
  border-radius: 999px;
  transition: width 0.6s var(--ease);
}

.qa-progress-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }

.quiz-card, .gquiz-card, .qa-card, .word-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px;
  margin-bottom: 16px;
}
.quiz-question, .gquiz-question, .qa-question {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.45;
  margin-bottom: 20px;
  letter-spacing: -0.015em;
}
.gquiz-eyebrow {
  display: inline-flex;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.gquiz-type-pill {
  display: inline-flex;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--violet);
  background: var(--violet-soft);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.quiz-choices, .gquiz-choices { display: flex; flex-direction: column; gap: 8px; }
.quiz-choices label, .gquiz-choices label, .reading-q-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast);
  user-select: none;
}
.quiz-choices label:hover, .gquiz-choices label:hover, .reading-q-choice:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.quiz-choices input[type="radio"], .gquiz-choices input[type="radio"], .reading-q-radio {
  appearance: none;
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border: 1.5px solid var(--border-2);
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: var(--surface);
  transition: all var(--t-fast);
}
.quiz-choices input[type="radio"]:checked, .gquiz-choices input[type="radio"]:checked,
.reading-q-radio:checked {
  border-color: var(--primary);
  background: var(--primary);
}
.quiz-choices input[type="radio"]:checked::after,
.gquiz-choices input[type="radio"]:checked::after,
.reading-q-radio:checked::after {
  content: ''; width: 6px; height: 6px; background: #fff; border-radius: 50%;
}
.quiz-choices label:has(input:checked), .gquiz-choices label:has(input:checked),
.reading-q-choice:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.quiz-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: color 160ms ease, border-color 160ms ease,
              background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.quiz-back:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateX(-3px);
  box-shadow: 0 4px 12px -4px rgba(124, 58, 237, 0.25);
}
.quiz-back i { width: 16px; height: 16px; }

.quiz-choices { gap: 12px; }
.quiz-choice {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 16px 20px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease,
              transform 160ms ease, box-shadow 160ms ease;
  user-select: none;
  position: relative;
}
.quiz-choice:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px -6px rgba(124, 58, 237, 0.25);
}
.quiz-choice:active {
  transform: translateY(0);
}
.quiz-choice.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}
.quiz-choice-letter {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--border-2);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
  letter-spacing: 0;
}
.quiz-choice:hover .quiz-choice-letter {
  border-color: var(--primary);
  color: var(--primary);
  background: #fff;
}
.quiz-choice.selected .quiz-choice-letter {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px -2px rgba(124, 58, 237, 0.5);
}
.quiz-choice-text {
  flex: 1;
  line-height: 1.45;
  letter-spacing: -0.005em;
}
.quiz-choice.selected .quiz-choice-text {
  color: var(--primary);
  font-weight: 600;
}

@media (max-width: 640px) {
  .quiz-choice { padding: 14px 16px; gap: 12px; font-size: 14px; }
  .quiz-choice-letter { width: 30px; height: 30px; font-size: 12px; }
}

/* =========================================================================
   Quiz 2-column layout with question palette
   ========================================================================= */
.quiz-wrap:has(.quiz-layout) { max-width: 1200px; }

.quiz-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 28px;
  align-items: start;
  width: 100%;
}
.quiz-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.quiz-main .quiz-card {
  padding: 44px 48px;
  margin-bottom: 0;
  border-radius: 20px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03), 0 8px 28px -16px rgba(15, 23, 42, 0.08);
}
.quiz-main .quiz-question {
  font-size: 32px;
  margin-bottom: 32px;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text);
}
.quiz-main .quiz-choices { gap: 14px; }
.quiz-main .quiz-choice {
  padding: 18px 22px;
  font-size: 16px;
  border-radius: 16px;
  border-width: 2px;
}
.quiz-main .quiz-choice-letter {
  width: 38px;
  height: 38px;
  font-size: 14px;
  border-width: 2px;
}
.quiz-main .quiz-gap { margin-top: 4px; }
.quiz-main .quiz-gap-input {
  width: 100%;
  height: 56px;
  padding: 0 20px;
  font-family: inherit;
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 14px;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
.quiz-main .quiz-gap-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.12);
}
.quiz-main .gquiz-type-pill { margin-bottom: 16px; }
.quiz-main .quiz-nav { margin-top: 4px; }
.quiz-main .quiz-btn { height: 52px; padding: 0 26px; font-size: 14px; border-radius: 12px; }

.quiz-palette {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px;
  position: sticky;
  top: 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03), 0 8px 28px -16px rgba(15, 23, 42, 0.08);
}
.quiz-palette-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--muted);
  margin-bottom: 16px;
}
.quiz-palette-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 5px 12px;
  border-radius: 999px;
  letter-spacing: 0;
}
.quiz-palette-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.quiz-palette-btn {
  aspect-ratio: 1;
  min-height: 48px;
  display: grid;
  place-items: center;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease,
              border-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
  padding: 0;
}
.quiz-palette-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
  transform: scale(1.06);
}
.quiz-palette-btn.answered {
  background: #DCFCE7;
  border-color: #4ADE80;
  color: #15803D;
}
.quiz-palette-btn.answered:hover {
  border-color: #22C55E;
  background: #BBF7D0;
  color: #15803D;
}
.quiz-palette-btn.current {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 6px 18px -6px rgba(124, 58, 237, 0.6);
  transform: scale(1.08);
}
.quiz-palette-btn.current.answered {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.quiz-palette-finish {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--primary), var(--violet, #8B5CF6));
  color: #fff;
  border: none;
  border-radius: 14px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
  letter-spacing: -0.005em;
  margin-bottom: 16px;
  box-shadow: 0 4px 14px -4px rgba(124, 58, 237, 0.4);
}
.quiz-palette-finish:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -8px rgba(124, 58, 237, 0.55);
}
.quiz-palette-finish:disabled { opacity: 0.55; cursor: default; box-shadow: none; }
.quiz-palette-finish i { width: 18px; height: 18px; }
.quiz-palette-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}
.quiz-palette-legend > div {
  display: flex;
  align-items: center;
  gap: 10px;
}
.quiz-dot {
  display: inline-block;
  width: 14px; height: 14px;
  border-radius: 4px;
}
.quiz-dot-current { background: var(--primary); }
.quiz-dot-answered { background: #DCFCE7; border: 1.5px solid #4ADE80; }
.quiz-dot-empty { background: var(--bg); border: 1.5px solid var(--border); }

@media (max-width: 980px) {
  .quiz-layout { grid-template-columns: 1fr; gap: 18px; }
  .quiz-palette { position: static; }
  .quiz-palette-grid { grid-template-columns: repeat(10, 1fr); }
  .quiz-palette-legend { flex-direction: row; flex-wrap: wrap; gap: 16px; }
  .quiz-main .quiz-card { padding: 32px 28px; }
  .quiz-main .quiz-question { font-size: 26px; }
}
@media (max-width: 600px) {
  .quiz-palette-grid { grid-template-columns: repeat(5, 1fr); }
  .quiz-palette-btn { min-height: 44px; font-size: 14px; }
  .quiz-main .quiz-card { padding: 24px 20px; border-radius: 16px; }
  .quiz-main .quiz-question { font-size: 22px; margin-bottom: 22px; }
  .quiz-main .quiz-choice { padding: 14px 16px; font-size: 15px; }
  .quiz-main .quiz-choice-letter { width: 32px; height: 32px; font-size: 13px; }
  .quiz-main .quiz-btn { height: 46px; padding: 0 18px; }
}

.gquiz-gap, .reading-q-input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--t-fast);
}
.gquiz-gap:focus, .reading-q-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft-2);
}

.quiz-nav, .qa-nav, .practice-nav, .reading-submit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* Result */
.quiz-result, .qa-done, .writing-result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 44px 32px;
  text-align: center;
  margin-top: 16px;
}
.quiz-result-icon, .qa-done-icon {
  width: 76px; height: 76px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  color: #fff;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  box-shadow: 0 12px 30px rgba(124, 58, 237, 0.30);
}
.quiz-result-icon i, .qa-done-icon i { width: 36px; height: 36px; }
.quiz-result-title { font-size: 24px; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.02em; }
.quiz-result-score { font-size: 44px; font-weight: 800; color: var(--primary); margin-bottom: 10px; line-height: 1; letter-spacing: -0.03em; }
.quiz-result-note { font-size: 14px; color: var(--text-3); max-width: 460px; margin: 0 auto 20px; line-height: 1.6; }
.quiz-result-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

/* =========================================================================
   Grammar topic page — test cards grid
   ========================================================================= */
.gt-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 28px 56px;
}

.gt-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 28px;
  align-items: center;
  margin-top: 18px;
  margin-bottom: 26px;
  padding: 30px 34px;
  background: linear-gradient(135deg, var(--primary-soft) 0%, #fff 70%);
  border: 1px solid var(--primary-soft);
  border-radius: 24px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03), 0 12px 36px -18px rgba(15, 23, 42, 0.12);
  position: relative;
  overflow: hidden;
}
.gt-hero::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, var(--primary), var(--violet, #8B5CF6));
}
.gt-hero-icon {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  font-size: 52px;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 4px 14px -6px rgba(15, 23, 42, 0.12);
  flex-shrink: 0;
}
.gt-hero-body { min-width: 0; }
.gt-hero-title {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 8px;
}
.gt-hero-sub {
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 18px;
  max-width: 640px;
}
.gt-hero-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.gt-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  min-width: 130px;
}
.gt-stat-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.3px;
  color: var(--muted);
}
.gt-stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
  line-height: 1;
}
.gt-stat-mini {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0;
}
.gt-hero-progress {
  height: 8px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  max-width: 460px;
}
.gt-hero-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--violet, #8B5CF6));
  border-radius: 999px;
  transition: width 800ms cubic-bezier(.4, 0, .2, 1);
}

.gt-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}
.gt-test-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px 24px 20px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 18px;
  text-decoration: none;
  color: var(--text);
  transition: transform 180ms cubic-bezier(.4, 0, .2, 1),
              border-color 180ms ease, box-shadow 180ms ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.gt-test-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--violet, #8B5CF6));
  opacity: 0;
  transition: opacity 180ms ease;
}
.gt-test-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03), 0 14px 30px -12px rgba(124, 58, 237, 0.28);
}
.gt-test-card:hover::before { opacity: 1; }
.gt-test-card.is-completed {
  background: linear-gradient(160deg, #F0FDF4 0%, var(--surface) 60%);
  border-color: #BBF7D0;
}
.gt-test-card.is-completed::before {
  background: linear-gradient(90deg, #22C55E, #10B981);
  opacity: 1;
}
.gt-test-card.is-completed:hover {
  border-color: #4ADE80;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03), 0 14px 30px -12px rgba(34, 197, 94, 0.3);
}

.gt-test-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.gt-test-num {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.gt-test-card.is-completed .gt-test-num {
  background: #DCFCE7;
  color: #15803D;
}
.gt-test-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.gt-test-badge i { width: 13px; height: 13px; }
.gt-test-badge-new {
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
}
.gt-test-badge-done {
  color: #15803D;
  background: #DCFCE7;
  border: 1px solid #BBF7D0;
}

.gt-test-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin-top: 4px;
}
.gt-test-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}

.gt-test-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 0;
  border-top: 1px dashed var(--border);
}
.gt-test-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}
.gt-test-meta-row i {
  width: 15px;
  height: 15px;
  color: var(--muted);
}

.gt-test-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.005em;
  margin-top: auto;
}
.gt-test-cta i {
  width: 15px;
  height: 15px;
  transition: transform 180ms ease;
}
.gt-test-card:hover .gt-test-cta i { transform: translateX(3px); }
.gt-test-card.is-completed .gt-test-cta { color: #15803D; }

.gt-empty {
  grid-column: 1 / -1;
  padding: 40px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 16px;
}

.gt-footnote {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  max-width: fit-content;
  margin: 0 auto;
}
.gt-footnote i { width: 15px; height: 15px; color: var(--primary); }

@media (max-width: 1024px) {
  .gt-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .gt-wrap { padding: 22px 16px 48px; }
  .gt-hero {
    grid-template-columns: 1fr;
    text-align: left;
    padding: 24px;
    gap: 18px;
  }
  .gt-hero-icon { width: 72px; height: 72px; font-size: 40px; border-radius: 18px; }
  .gt-hero-title { font-size: 26px; }
  .gt-hero-stats { gap: 12px; }
  .gt-stat { padding: 8px 14px; min-width: 100px; }
  .gt-stat-value { font-size: 18px; }
  .gt-grid { grid-template-columns: 1fr; gap: 14px; }
  .gt-test-card { padding: 18px 20px; }
}

/* =========================================================================
   IELTS Speaking evaluation result (Gemini-powered)
   ========================================================================= */
.ielts-eval-loading {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 56px 32px;
  text-align: center;
  margin-top: 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03), 0 8px 28px -16px rgba(15, 23, 42, 0.08);
}
.ielts-eval-spinner {
  width: 56px;
  height: 56px;
  margin: 0 auto 22px;
  border: 5px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: ieltsSpin 0.9s linear infinite;
}
@keyframes ieltsSpin { to { transform: rotate(360deg); } }
.ielts-eval-loading-title {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.ielts-eval-loading-sub {
  font-size: 14px;
  color: var(--muted);
}

.ielts-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 36px 36px 32px;
  margin-top: 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03), 0 12px 36px -16px rgba(15, 23, 42, 0.12);
  position: relative;
  overflow: hidden;
}
.ielts-result::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, var(--primary), var(--violet, #8B5CF6));
}
.ielts-result[data-tier="high"]::before { background: linear-gradient(90deg, #22C55E, #10B981); }
.ielts-result[data-tier="low"]::before { background: linear-gradient(90deg, #F59E0B, #EF4444); }

.ielts-result-head { text-align: center; margin-bottom: 26px; }
.ielts-result-badge {
  display: inline-grid;
  place-items: center;
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  margin-bottom: 12px;
}
.ielts-result-badge i { width: 30px; height: 30px; }
.ielts-result[data-tier="high"] .ielts-result-badge { background: #DCFCE7; color: #15803D; }
.ielts-result[data-tier="low"] .ielts-result-badge { background: #FEF3C7; color: #B45309; }
.ielts-result-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; letter-spacing: -0.02em; }
.ielts-result-sub { font-size: 13.5px; color: var(--muted); }

.ielts-overall {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) 2fr;
  gap: 20px;
  padding: 22px;
  background: linear-gradient(135deg, var(--primary-soft), #fff);
  border: 1px solid var(--primary-soft);
  border-radius: 18px;
  margin-bottom: 22px;
}
.ielts-result[data-tier="high"] .ielts-overall { background: linear-gradient(135deg, #DCFCE7, #fff); border-color: #BBF7D0; }
.ielts-result[data-tier="low"] .ielts-overall { background: linear-gradient(135deg, #FEF3C7, #fff); border-color: #FDE68A; }

.ielts-overall-band {
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  text-align: center;
  padding: 8px 14px;
  border-right: 1px dashed rgba(124, 58, 237, 0.25);
}
.ielts-band-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.4px; color: var(--muted); margin-bottom: 6px;
}
.ielts-band-number {
  font-size: 60px; font-weight: 800; color: var(--primary);
  line-height: 1; letter-spacing: -0.03em;
}
.ielts-result[data-tier="high"] .ielts-band-number { color: #15803D; }
.ielts-result[data-tier="low"] .ielts-band-number { color: #B45309; }

.ielts-overall-percent {
  display: flex; flex-direction: column;
  justify-content: center; gap: 10px;
  padding: 8px 8px;
}
.ielts-percent-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.4px; color: var(--muted);
}
.ielts-percent-number {
  font-size: 30px; font-weight: 800; color: var(--text);
  letter-spacing: -0.02em; line-height: 1;
}
.ielts-percent-bar {
  height: 12px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.ielts-percent-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--primary), var(--violet, #8B5CF6));
  border-radius: 999px;
  transition: width 900ms cubic-bezier(.4, 0, .2, 1);
}
.ielts-result[data-tier="high"] .ielts-percent-fill { background: linear-gradient(90deg, #22C55E, #10B981); }
.ielts-result[data-tier="low"] .ielts-percent-fill { background: linear-gradient(90deg, #F59E0B, #EF4444); }

.ielts-criteria {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
.ielts-criterion {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 14px 18px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.ielts-criterion:hover:not(.ielts-criterion-na) {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -6px rgba(124, 58, 237, 0.25);
}
.ielts-criterion.ielts-criterion-na { opacity: 0.55; }
.ielts-criterion-head {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 600; color: var(--text);
}
.ielts-criterion-head i { width: 18px; height: 18px; color: var(--muted); }
.ielts-criterion-band {
  font-size: 24px; font-weight: 800;
  color: var(--primary); letter-spacing: -0.02em;
}
.ielts-criterion-na .ielts-criterion-band {
  color: var(--muted); font-size: 14px; font-weight: 700;
}

.ielts-feedback {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 22px;
  margin-bottom: 24px;
}
.ielts-feedback-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--muted);
  margin-bottom: 12px;
}
.ielts-feedback-head i { width: 16px; height: 16px; color: #F59E0B; }
.ielts-feedback-body {
  font-size: 14.5px; line-height: 1.65; color: var(--text);
}
.ielts-feedback-body p { margin: 0 0 10px; }
.ielts-feedback-body p:last-child { margin-bottom: 0; }
.ielts-feedback-body ul { padding-left: 22px; margin: 0 0 10px; }
.ielts-feedback-body li { margin-bottom: 6px; }
.ielts-feedback-body strong { color: var(--primary); }
.ielts-feedback-body code {
  background: var(--surface);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.ielts-powered {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 12px; color: var(--muted);
  margin: 0 0 18px;
}
.ielts-powered i { width: 14px; height: 14px; color: var(--primary); }

.ielts-result-actions {
  display: flex; justify-content: center; gap: 10px; flex-wrap: wrap;
}

@media (max-width: 700px) {
  .ielts-result { padding: 26px 22px 22px; border-radius: 18px; }
  .ielts-overall { grid-template-columns: 1fr; gap: 14px; padding: 18px; }
  .ielts-overall-band {
    border-right: none;
    border-bottom: 1px dashed rgba(124, 58, 237, 0.25);
    padding: 0 0 14px;
  }
  .ielts-band-number { font-size: 52px; }
  .ielts-criteria { grid-template-columns: 1fr; }
  .ielts-feedback { padding: 16px 18px; }
}

/* =========================================================================
   Reading test
   ========================================================================= */
.reading-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.reading-title-wrap { display: flex; flex-direction: column; }
.reading-title { font-size: 16px; font-weight: 700; letter-spacing: -0.015em; }
.reading-sub { font-size: 11.5px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; }
.reading-timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  background: var(--orange-soft);
  color: var(--orange-2);
  padding: 7px 14px;
  border-radius: 999px;
}

.reading-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  width: fit-content;
  margin-bottom: 16px;
}
.reading-tab {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-3);
  cursor: pointer;
  transition: all var(--t-fast);
  border: none;
  background: transparent;
}
.reading-tab:hover { color: var(--text); }
.reading-tab.active { background: var(--primary); color: #fff; }

.reading-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.reading-passage, .reading-questions {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
}
.reading-passage-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; letter-spacing: -0.02em; }
.reading-passage-subtitle { font-size: 11.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 14px; }
.reading-passage-body { font-size: 14px; color: var(--text-2); line-height: 1.75; white-space: pre-wrap; }

.reading-q { padding: 16px 0; border-top: 1px solid var(--border); }
.reading-q:first-child { padding-top: 0; border-top: none; }
.reading-q-head { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.reading-q-num {
  width: 24px; height: 24px;
  background: var(--primary); color: #fff;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 11.5px; font-weight: 700;
}
.reading-q-type {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  background: var(--violet-soft);
  color: var(--violet);
  padding: 3px 8px;
  border-radius: 999px;
}
.reading-q-text { font-size: 14px; font-weight: 600; line-height: 1.5; margin-bottom: 10px; }
.reading-q-options { display: flex; flex-direction: column; gap: 6px; }
.reading-q-options.tfng { flex-direction: row; flex-wrap: wrap; }
.reading-q-options.tfng .reading-q-choice { flex: 1; min-width: 100px; justify-content: center; padding: 9px; }
.reading-q-choice-text { flex: 1; }
.reading-q-tfng { font-size: 13px; font-weight: 600; }
.reading-answered { font-size: 12.5px; font-weight: 600; color: var(--text-3); }

/* =========================================================================
   Speaking Q&A
   ========================================================================= */
.qa-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-2);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 16px;
  width: fit-content;
}
.qa-tab {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-3);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all var(--t-fast);
}
.qa-tab.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-xs); }

.qa-panel-text textarea, .voice-body textarea {
  width: 100%;
  min-height: 150px;
  border: 1px solid var(--border-2);
  border-radius: 12px;
  padding: 14px;
  font-family: inherit;
  font-size: 14px;
  background: var(--surface);
  resize: vertical;
  transition: all var(--t-fast);
}
.qa-panel-text textarea:focus, .voice-body textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft-2);
}
.voice-body { display: flex; flex-direction: column; gap: 12px; align-items: center; padding: 18px; }
.voice-record {
  width: 76px; height: 76px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--red), #DC2626);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(239, 68, 68, 0.30);
  transition: all var(--t-fast);
  border: none;
}
.voice-record:hover { transform: scale(1.05); }
.voice-record:active { transform: scale(0.95); }
.voice-record i { width: 32px; height: 32px; }
.voice-status { font-size: 12.5px; font-weight: 600; color: var(--text-3); text-align: center; }

.mock-banner {
  background: linear-gradient(135deg, var(--primary-soft) 0%, var(--violet-soft) 100%);
  border: 1px solid var(--primary-soft-2);
  border-radius: 18px;
  padding: 20px 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.mock-banner-body { display: flex; gap: 14px; align-items: center; }
.mock-banner-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
}
.mock-banner-icon i { width: 22px; height: 22px; }
.mock-banner-text strong { display: block; font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.mock-banner-text span { font-size: 12.5px; color: var(--text-3); }

/* =========================================================================
   Pronunciation practice
   ========================================================================= */
.practice-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-3);
  margin-bottom: 8px;
}
.practice-progress {
  height: 8px;
  background: var(--bg-2);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 14px;
}
.practice-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--violet));
  border-radius: 999px;
  transition: width 0.6s var(--ease);
}
.practice-word-meta { font-size: 12.5px; font-weight: 600; color: var(--text-3); margin-bottom: 16px; }
.word-card { text-align: center; padding: 32px; }
.word-text { font-size: 38px; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 6px; }
.word-translation { font-size: 15px; color: var(--text-3); margin-bottom: 20px; }
.listen-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 12.5px;
  transition: all var(--t-fast);
  border: none;
}
.listen-btn:hover { background: var(--primary-hover); box-shadow: 0 6px 18px rgba(124, 58, 237, 0.28); }
.listen-btn i { width: 16px; height: 16px; }

.mic-bay { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 18px; }
.mic-btn {
  width: 76px; height: 76px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 12px 30px rgba(124, 58, 237, 0.30);
  transition: all var(--t-fast);
  border: none;
}
.mic-btn:hover { transform: scale(1.05); }
.mic-btn:active { transform: scale(0.95); }
.mic-btn i { width: 32px; height: 32px; }
.practice-hint { font-size: 12.5px; color: var(--text-3); text-align: center; }

/* =========================================================================
   Writing
   ========================================================================= */
.writing-setup-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 30px;
  max-width: 640px;
  margin: 0 auto;
}
.writing-setup-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.02em; }
.writing-setup-subtitle { color: var(--text-3); font-size: 13.5px; margin-bottom: 22px; }
.writing-field-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-3);
  margin-bottom: 6px;
}
.writing-setup-card textarea, .writing-setup-card input[type="text"], .writing-setup-card select {
  width: 100%;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  background: var(--surface);
  margin-bottom: 14px;
  transition: all var(--t-fast);
}
.writing-setup-card textarea { min-height: 110px; resize: vertical; }
.writing-setup-card textarea:focus, .writing-setup-card input:focus, .writing-setup-card select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft-2);
}
.writing-image-section { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.writing-image-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-3); }
.writing-image-name { font-size: 12.5px; color: var(--text-3); }
.writing-image-btn { height: 38px; padding: 0 14px; font-size: 12.5px; }
.writing-start-btn { width: 100%; height: 46px; }

.writing-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.writing-editor-title { font-size: 16px; font-weight: 700; letter-spacing: -0.015em; }
.writing-editor-timer {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--orange-soft); color: var(--orange-2);
  padding: 6px 12px; border-radius: 999px;
  font-weight: 700; font-size: 13px;
}
.writing-topic-box {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 16px;
}
.writing-topic-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px; color: var(--primary); margin-bottom: 6px; }
.writing-topic-text { font-size: 14px; color: var(--text); line-height: 1.6; }
.writing-topic-image { max-width: 100%; border-radius: 12px; margin-top: 10px; }
.writing-editor-textarea {
  width: 100%;
  min-height: 360px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.7;
  background: var(--surface);
  resize: vertical;
  transition: all var(--t-fast);
}
.writing-editor-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft-2);
}
.writing-editor-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.writing-wordcount {
  font-size: 12.5px; font-weight: 600; color: var(--text-3);
  background: var(--bg-2); padding: 7px 14px; border-radius: 999px;
}
.writing-feedback {
  background: var(--primary-soft);
  border: 1px solid var(--primary-soft-2);
  border-radius: 12px;
  padding: 12px 16px;
  text-align: left;
  margin: 16px 0;
  color: var(--text);
  font-size: 13.5px; line-height: 1.6;
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 1100px) {
  .home-hero { grid-template-columns: 1fr; padding: 36px; }
  .home-hero-media { aspect-ratio: 16/9; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .modules-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform var(--t-base) var(--ease);
    box-shadow: 0 0 40px rgba(15, 23, 42, 0.20);
  }
  .app.sidebar-open .sidebar { transform: translateX(0); }
  .app.sidebar-open .main::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 25;
  }
  .brand-top { display: flex; }
  .topbar { padding: 0 16px; gap: 10px; }
  .topbar-search { display: none; }
  .topbar-stats .stat-chip { padding: 7px 10px; }
  .topbar-stats .stat-chip span:not(.num) { display: none; }

  .home-hero { padding: 32px 24px; border-radius: 20px; }
  .home-hero-title { font-size: 36px; }

  .reading-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  body { font-size: 13.5px; }
  .page, .books-wrap, .grammar-wrap, .vocab-wrap, .speaking-wrap, .pron-wrap,
  .writing-wrap, .writing-setup-wrap, .writing-editor-wrap, .practice-wrap,
  .speaking-qa-wrap, .gquiz-wrap, .reading-wrap, .quiz-wrap, .exam-grid-wrap {
    padding: 22px 16px 48px;
  }

  .home-hero { padding: 28px 22px; }
  .home-hero-title { font-size: 30px; }
  .home-hero-actions .btn { flex: 1; }

  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .kpi-card { padding: 16px; }
  .kpi-value { font-size: 26px; }

  .modules-grid { grid-template-columns: 1fr; }

  .speaking-title, .grammar-title, .vocab-title { font-size: 24px; }
  .exam-grid, .grammar-topics-grid, .book-tests-grid, .sections-grid,
  .parts-grid, .topics-grid, .levels-grid, .writing-tasks, .books-grid {
    grid-template-columns: 1fr;
  }
  .quiz-card, .gquiz-card, .qa-card, .word-card { padding: 18px; }
  .quiz-question, .gquiz-question, .qa-question { font-size: 16px; }
  .word-text { font-size: 30px; }
  .auth-card { padding: 28px 20px; }
  .auth-title { font-size: 20px; }
  .vocab-search-row { flex-direction: column; }
  .vocab-search-btn { width: 100%; height: 46px; }
  .quiz-result { padding: 32px 20px; }
  .quiz-result-score { font-size: 32px; }
}

/* =========================================================================
   Speaking Community
   ========================================================================= */
.nav-badge {
  margin-left: auto;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.8px;
  padding: 2px 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, #FECACA, #FCA5A5);
  color: #991B1B;
  border: 1px solid #FCA5A5;
}
.nav-item.active .nav-badge { background: linear-gradient(180deg, var(--violet), #7C3AED); color: #fff; border-color: transparent; }

/* Profile setup */
.community-setup-wrap { max-width: 560px; }
.community-setup-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  padding: 38px 32px;
  text-align: center;
}
.community-setup-icon {
  width: 64px; height: 64px;
  border-radius: 18px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary-soft), var(--violet-soft));
  border: 1px solid var(--primary-soft-2);
  color: var(--primary);
}
.community-setup-icon i { width: 28px; height: 28px; }
.community-setup-title { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 6px; }
.community-setup-sub { color: var(--text-3); font-size: 14px; line-height: 1.55; max-width: 420px; margin: 0 auto 24px; }

.community-msg {
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 14px;
  text-align: left;
}
.community-msg--success { background: var(--green-soft); border: 1px solid #BBF7D0; color: #047857; }
.community-msg--error, .community-msg--danger { background: var(--red-soft); border: 1px solid #FECACA; color: #B91C1C; }

.community-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.community-label { display: flex; flex-direction: column; gap: 6px; }
.community-label > span {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-3);
}
.community-form input[type="text"],
.community-form textarea {
  width: 100%;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  background: var(--surface);
  transition: all var(--t-fast);
}
.community-form input[type="text"]:focus,
.community-form textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft-2);
}
.community-form textarea { resize: vertical; min-height: 80px; }

.community-radio-row {
  display: flex;
  gap: 10px;
  border: none;
  padding: 0;
  margin: 0;
}
.community-radio-row legend {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-3);
  margin-bottom: 8px;
  width: 100%;
}
.community-radio {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border-2);
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--t-fast);
  font-size: 14px;
  font-weight: 600;
}
.community-radio:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}
.community-radio input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border: 1.5px solid var(--border-2);
  border-radius: 50%;
  display: grid; place-items: center;
  cursor: pointer;
}
.community-radio input[type="radio"]:checked { border-color: var(--primary); background: var(--primary); }
.community-radio input[type="radio"]:checked::after {
  content: ''; width: 6px; height: 6px; background: #fff; border-radius: 50%;
}
.community-err { color: var(--red); font-size: 12px; font-style: normal; font-weight: 500; }

/* Community lobby */
.community-page { display: flex; flex-direction: column; gap: 20px; }

.community-hero {
  background: linear-gradient(135deg, #0E1322 0%, #1A1F35 100%);
  border-radius: var(--r-2xl);
  padding: 32px 36px;
  color: #fff;
  display: grid;
  grid-template-columns: 1.5fr auto;
  gap: 24px;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.community-hero::before {
  content: '';
  position: absolute;
  inset: -50% -10% auto auto;
  width: 480px; height: 480px;
  background: radial-gradient(closest-side, rgba(239, 68, 68, 0.32), transparent 70%);
  pointer-events: none;
}
.community-hero-text { position: relative; z-index: 1; }
.community-hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #FECACA;
  margin-bottom: 14px;
}
.community-hero-pill .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6);
  animation: cmt-pulse-dot 1.6s ease-out infinite;
}
@keyframes cmt-pulse-dot {
  0%   { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70%  { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
.community-hero h1 {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #fff;
  margin-bottom: 8px;
}
.community-hero h1 em {
  font-family: 'Instrument Serif', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  background: linear-gradient(120deg, #FCA5A5, #FBBF24);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.02em;
}
.community-hero p { color: rgba(255, 255, 255, 0.65); font-size: 14px; line-height: 1.6; max-width: 480px; }

.community-me-card {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 16px;
  padding: 12px 14px;
  backdrop-filter: blur(8px);
}
.me-avatar {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.me-avatar--male, .call-avatar.me-avatar--male { background: linear-gradient(135deg, #3B82F6, #6366F1); }
.me-avatar--female, .call-avatar.me-avatar--female { background: linear-gradient(135deg, #EC4899, #F472B6); }
.me-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.me-meta strong { color: #fff; font-size: 13px; font-weight: 700; }
.me-gender {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}
.me-gender--male { color: #93C5FD; }
.me-gender--female { color: #F9A8D4; }
.community-me-card .btn-outline {
  margin-left: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
}
.community-me-card .btn-outline:hover { background: rgba(255, 255, 255, 0.14); }

/* Stages */
.cmt-stage { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
#cmtSearching, #cmtCall, #cmtError { grid-template-columns: 1fr; }

.cmt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 28px;
}
.cmt-card--center { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding: 48px 28px; }
.cmt-card-title { font-size: 18px; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 4px; }
.cmt-card-sub { font-size: 13.5px; color: var(--text-3); margin-bottom: 22px; }

.pref-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.pref-option { cursor: pointer; }
.pref-option input { position: absolute; opacity: 0; pointer-events: none; }
.pref-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  transition: all var(--t-fast);
}
.pref-icon {
  width: 40px; height: 40px;
  border-radius: 11px;
  background: var(--bg-2);
  color: var(--text-3);
  display: grid;
  place-items: center;
  transition: all var(--t-fast);
}
.pref-icon i { width: 18px; height: 18px; }
.pref-label { font-size: 14px; font-weight: 700; }
.pref-desc { font-size: 11.5px; color: var(--text-3); font-weight: 500; }
.pref-option:hover .pref-card { border-color: var(--border-2); transform: translateY(-1px); }
.pref-option input:checked + .pref-card {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.12);
}
.pref-option input:checked + .pref-card .pref-icon {
  background: var(--primary);
  color: #fff;
}

.cmt-hint {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 6px;
}
.cmt-hint i { width: 14px; height: 14px; color: var(--orange); }

.cmt-tips {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 22px 24px;
}
.cmt-tips h3 { font-size: 14px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 12px; }
.cmt-tips ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.cmt-tips li { display: flex; gap: 8px; font-size: 13px; color: var(--text-2); line-height: 1.55; }
.cmt-tips i { width: 15px; height: 15px; color: var(--green); flex-shrink: 0; margin-top: 2px; }

/* Searching radar */
.search-radar {
  position: relative;
  width: 110px;
  height: 110px;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
}
.search-radar i {
  width: 36px;
  height: 36px;
  color: var(--primary);
  z-index: 2;
}
.search-radar .ring {
  position: absolute;
  border: 1.5px solid var(--primary);
  border-radius: 50%;
  opacity: 0;
  animation: cmt-radar 2.4s ease-out infinite;
}
.search-radar .r1 { width: 50%; height: 50%; animation-delay: 0s; }
.search-radar .r2 { width: 75%; height: 75%; animation-delay: 0.4s; }
.search-radar .r3 { width: 100%; height: 100%; animation-delay: 0.8s; }
@keyframes cmt-radar {
  0%   { transform: scale(0.4); opacity: 0.8; }
  100% { transform: scale(1.2); opacity: 0; }
}

/* Error */
.cmt-error-icon {
  width: 64px; height: 64px;
  border-radius: 18px;
  background: var(--red-soft);
  border: 1px solid #FECACA;
  color: var(--red);
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}
.cmt-error-icon i { width: 28px; height: 28px; }

/* Call */
.cmt-call-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  padding: 36px 32px;
  text-align: center;
}
.call-people {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 22px;
}
.call-person { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 96px; }
.call-person strong { font-size: 14px; font-weight: 700; }
.call-person span { font-size: 11.5px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.call-avatar {
  width: 72px; height: 72px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--violet));
}
#peerAvatar.me-avatar--male { background: linear-gradient(135deg, #3B82F6, #6366F1); }
#peerAvatar.me-avatar--female { background: linear-gradient(135deg, #EC4899, #F472B6); }

.call-link {
  display: flex; align-items: center; gap: 4px;
  flex: 1; max-width: 260px;
}
.call-link-line {
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--violet));
  border-radius: 999px;
  position: relative;
  overflow: hidden;
}
.call-link-line::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
  animation: cmt-line-shimmer 1.6s ease-in-out infinite;
}
@keyframes cmt-line-shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.call-link-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.30);
}
.call-link-icon i { width: 16px; height: 16px; }

.call-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-2);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 18px;
}
.call-status .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  animation: cmt-pulse-dot 1.6s ease-out infinite;
}
.call-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text);
  margin-left: 4px;
  padding-left: 8px;
  border-left: 1px solid var(--border-2);
}

.audio-viz {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 60px;
  margin-bottom: 22px;
}
.audio-viz .bar {
  display: block;
  width: 5px;
  height: 30px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--primary), var(--violet));
  transform-origin: center;
  transform: scaleY(0.15);
  transition: transform 80ms ease-out;
  opacity: 0.85;
}

.call-controls { display: flex; justify-content: center; gap: 14px; margin-bottom: 14px; }
.ctl-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--text);
  border: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all var(--t-fast);
}
.ctl-btn i { width: 22px; height: 22px; }
.ctl-btn:hover { background: var(--border); }
.ctl-btn.off { background: var(--red-soft); color: var(--red); }
.ctl-btn--end {
  background: var(--red);
  color: #fff;
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.35);
}
.ctl-btn--end:hover { background: #DC2626; transform: translateY(-2px); }

.call-hint { font-size: 12px; color: var(--text-3); }

/* Responsive */
@media (max-width: 900px) {
  .community-hero { grid-template-columns: 1fr; padding: 28px 24px; }
  .community-hero h1 { font-size: 32px; }
  .community-me-card { width: 100%; }
  .cmt-stage { grid-template-columns: 1fr; }
  .pref-row { grid-template-columns: 1fr; }
  .call-people { flex-direction: column; gap: 8px; }
  .call-link { display: none; }
  .nav-badge { display: none; }
}

/* =========================================================================
   AI Assistant — floating button + chat panel
   ========================================================================= */
.ai-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--violet) 100%);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 14px 30px rgba(124, 58, 237, 0.40);
  border: none;
  cursor: pointer;
  z-index: 80;
  transition: transform var(--t-base) var(--ease), opacity var(--t-fast), box-shadow var(--t-fast);
  animation: ai-fab-pulse 3s ease-in-out infinite;
}
.ai-fab i { width: 24px; height: 24px; }
.ai-fab:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 18px 38px rgba(124, 58, 237, 0.50); }
.ai-fab:active { transform: translateY(0) scale(0.96); }
.ai-fab.hidden { opacity: 0; transform: scale(0.6) translateY(20px); pointer-events: none; }

@keyframes ai-fab-pulse {
  0%, 100% { box-shadow: 0 14px 30px rgba(124, 58, 237, 0.40), 0 0 0 0 rgba(139, 92, 246, 0.45); }
  50%      { box-shadow: 0 14px 30px rgba(124, 58, 237, 0.40), 0 0 0 12px rgba(139, 92, 246, 0); }
}

.ai-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 620px;
  max-height: calc(100vh - 48px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 30px 60px -10px rgba(15, 23, 42, 0.30);
  display: flex;
  flex-direction: column;
  z-index: 90;
  overflow: hidden;
  transform: translateY(20px) scale(0.96);
  opacity: 0;
  transition: transform var(--t-base) var(--ease), opacity var(--t-base) var(--ease);
}
.ai-panel.open { transform: translateY(0) scale(1); opacity: 1; }

.ai-panel-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, #FAFBFF 0%, var(--surface) 100%);
}
.ai-panel-title { display: flex; align-items: center; gap: 11px; min-width: 0; }
.ai-panel-avatar {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.30);
}
.ai-panel-avatar i { width: 18px; height: 18px; }
.ai-panel-title strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.015em;
}
.ai-panel-sub {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  margin-top: 1px;
}
.ai-panel-tools { display: flex; gap: 4px; }
.ai-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--text-3);
  border: none;
  background: transparent;
  transition: all var(--t-fast);
  cursor: pointer;
}
.ai-icon-btn:hover { background: var(--bg-2); color: var(--text); }
.ai-icon-btn i { width: 15px; height: 15px; }

.ai-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.ai-msgs::-webkit-scrollbar { width: 6px; }
.ai-msgs::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 999px; }

.ai-empty {
  margin: auto 0;
  text-align: center;
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.ai-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary-soft), var(--violet-soft));
  border: 1px solid var(--primary-soft-2);
  color: var(--primary);
  display: grid;
  place-items: center;
}
.ai-empty-icon i { width: 24px; height: 24px; }
.ai-empty h4 { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.ai-empty p { font-size: 12.5px; color: var(--text-3); max-width: 280px; line-height: 1.55; }

.ai-msg { display: flex; max-width: 85%; }
.ai-msg--user { align-self: flex-end; }
.ai-msg--assistant { align-self: flex-start; }
.ai-msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.ai-msg--user .ai-msg-bubble {
  background: linear-gradient(135deg, var(--primary), var(--violet));
  color: #fff;
  border-bottom-right-radius: 6px;
}
.ai-msg--assistant .ai-msg-bubble {
  background: var(--bg-2);
  color: var(--text);
  border-bottom-left-radius: 6px;
}
.ai-msg--error .ai-msg-bubble { background: var(--red-soft); color: #991B1B; }
.ai-msg-bubble p { margin: 0 0 6px; }
.ai-msg-bubble p:last-child { margin-bottom: 0; }
.ai-msg-bubble code {
  background: rgba(15, 23, 42, 0.06);
  padding: 1px 5px;
  border-radius: 5px;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 12.5px;
}
.ai-msg--user .ai-msg-bubble code { background: rgba(255,255,255,0.16); }
.ai-msg-bubble ul { margin: 4px 0 4px 20px; padding: 0; }
.ai-msg-bubble li { margin-bottom: 3px; }
.ai-msg-bubble strong { font-weight: 700; }

.ai-thinking .ai-msg-bubble {
  display: inline-flex;
  gap: 4px;
  padding: 14px 16px;
}
.ai-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-3);
  display: inline-block;
  animation: ai-dot-bounce 1.2s infinite;
}
.ai-dot:nth-child(2) { animation-delay: 0.15s; }
.ai-dot:nth-child(3) { animation-delay: 0.30s; }
@keyframes ai-dot-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 8px;
}
.ai-suggestion {
  font-size: 11.5px;
  font-weight: 500;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--text-2);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--t-fast);
}
.ai-suggestion:hover { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-soft-2); }
.ai-msgs:not(:empty) ~ .ai-suggestions { display: none; }
.ai-msgs:has(.ai-msg) ~ .ai-suggestions { display: none; }

.ai-form {
  padding: 12px 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--surface);
}
.ai-textarea {
  flex: 1;
  min-height: 40px;
  max-height: 160px;
  padding: 10px 14px;
  border: 1px solid var(--border-2);
  border-radius: 12px;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.45;
  background: var(--bg-2);
  resize: none;
  transition: all var(--t-fast);
}
.ai-textarea:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft-2);
}
.ai-send {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  color: #fff;
  display: grid;
  place-items: center;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.30);
  transition: all var(--t-fast);
}
.ai-send:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(124, 58, 237, 0.40); }
.ai-send:active { transform: translateY(0); }
.ai-send i { width: 18px; height: 18px; }

@media (max-width: 600px) {
  .ai-fab { right: 16px; bottom: 16px; width: 52px; height: 52px; }
  .ai-panel {
    right: 8px; bottom: 8px; left: 8px;
    width: auto;
    height: calc(100vh - 16px);
    max-height: none;
    border-radius: 18px;
  }
}

/* =========================================================================
   Highlight popover
   ========================================================================= */
.hl-popover {
  position: absolute;
  transform: translate(-50%, 0) scale(0.92);
  display: flex;
  gap: 2px;
  padding: 4px;
  background: #0F172A;
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.30);
  z-index: 70;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-fast), transform var(--t-fast);
}
.hl-popover.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0) scale(1); }
.hl-popover::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: #0F172A;
}
.hl-pop-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background var(--t-fast);
  white-space: nowrap;
}
.hl-pop-btn:hover { background: rgba(255, 255, 255, 0.10); }
.hl-pop-btn i { width: 14px; height: 14px; }
.hl-pop-save i { color: #FCD34D; }
.hl-pop-ask i { color: #C4B5FD; }

/* In-text highlight color hint when user is selecting */
::selection { background: #FEF3C7; color: var(--text); }

/* Persistent highlight rendered on the source page after clicking "Open" */
mark.hl-mark {
  background: linear-gradient(180deg, #FEF3C7 0%, #FDE68A 100%);
  color: inherit;
  padding: 2px 4px;
  margin: 0 -2px;
  border-radius: 4px;
  box-shadow: 0 0 0 1px #F59E0B;
  scroll-margin-top: 96px;
  scroll-margin-bottom: 32px;
}
mark.hl-mark.flash {
  animation: hl-mark-flash 1.6s var(--ease) 1;
}
@keyframes hl-mark-flash {
  0%   { background: #FCD34D; box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.45); }
  60%  { background: #FCD34D; box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
  100% { background: linear-gradient(180deg, #FEF3C7 0%, #FDE68A 100%); box-shadow: 0 0 0 1px #F59E0B; }
}

/* =========================================================================
   Toast
   ========================================================================= */
.ai-toast-host {
  position: fixed;
  top: 86px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
}
.ai-toast {
  background: #0F172A;
  color: #fff;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  max-width: 320px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.30);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity var(--t-base) var(--ease), transform var(--t-base) var(--ease);
  pointer-events: auto;
}
.ai-toast.show { opacity: 1; transform: translateX(0); }
.ai-toast--err { background: #991B1B; }

/* =========================================================================
   Profile page
   ========================================================================= */
.profile-page { display: flex; flex-direction: column; }

.profile-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 26px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.profile-id { display: flex; align-items: center; gap: 16px; min-width: 0; }
.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 8px 20px rgba(124, 58, 237, 0.30);
}
.profile-name { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.profile-handle { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.profile-stats { display: flex; gap: 22px; }
.profile-stat { display: flex; flex-direction: column; align-items: flex-end; }
.profile-stat .num { font-size: 22px; font-weight: 800; letter-spacing: -0.025em; color: var(--text); line-height: 1; }
.profile-stat .label { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-3); margin-top: 4px; }

.hl-counter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--gold-soft);
  border: 1px solid #FDE68A;
  color: #B45309;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.hl-counter-pill i { width: 14px; height: 14px; }

.hl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.hl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all var(--t-fast);
  position: relative;
}
.hl-card:hover { border-color: var(--border-2); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.hl-card.removing { opacity: 0; transform: translateY(-12px); }

.hl-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.hl-source {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-3);
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hl-source i { width: 12px; height: 12px; flex-shrink: 0; }
.hl-delete {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--text-3);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--t-fast);
  opacity: 0;
}
.hl-card:hover .hl-delete { opacity: 1; }
.hl-delete:hover { background: var(--red-soft); color: var(--red); }
.hl-delete i { width: 13px; height: 13px; }

.hl-text {
  margin: 0;
  padding: 14px 16px;
  background: linear-gradient(180deg, #FFFBEB 0%, #FEF3C7 100%);
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.55;
  color: var(--text);
  font-family: 'Instrument Serif', Georgia, serif;
  font-style: italic;
}

.hl-context {
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.55;
  margin: 0;
  padding-top: 4px;
  border-top: 1px dashed var(--border);
}

.hl-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  gap: 10px;
}
.hl-date { font-size: 11.5px; color: var(--text-3); font-weight: 500; }
.hl-actions { display: flex; gap: 6px; }
.hl-mini-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  background: var(--bg-2);
  color: var(--text-2);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--t-fast);
}
.hl-mini-btn:hover { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-soft-2); }
.hl-mini-btn i { width: 12px; height: 12px; }
.hl-ask-ai:hover { background: var(--violet-soft); color: var(--violet); border-color: #DDD6FE; }

.hl-empty {
  background: var(--surface);
  border: 1px dashed var(--border-2);
  border-radius: var(--r-xl);
  padding: 60px 24px;
  text-align: center;
}
.hl-empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary-soft), var(--violet-soft));
  border: 1px solid var(--primary-soft-2);
  color: var(--primary);
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
}
.hl-empty-icon i { width: 30px; height: 30px; }
.hl-empty h3 { font-size: 18px; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 6px; }
.hl-empty p { font-size: 13.5px; color: var(--text-3); max-width: 480px; margin: 0 auto; line-height: 1.6; }
.hl-empty strong { color: var(--text-2); font-weight: 700; }

@media (max-width: 700px) {
  .profile-header { flex-direction: column; align-items: flex-start; }
  .profile-stats { width: 100%; justify-content: space-between; gap: 8px; }
  .profile-stat { align-items: flex-start; }
}

/* =========================================================================
   Activity — shared page wrapper
   ========================================================================= */
.content-area {
  padding: 28px 32px 64px;
  margin: 0 auto;
  width: 100%;
}
@media (max-width: 900px) {
  .content-area { padding: 22px 20px 56px; }
}
@media (max-width: 600px) {
  .content-area { padding: 18px 16px 48px; }
}

/* =========================================================================
   Daily Challenges
   ========================================================================= */
.dc-page { max-width: 680px; }

/* Streak banner */
.dc-streak-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, var(--primary) 0%, var(--violet) 100%);
  border-radius: var(--r-lg);
  padding: 20px 24px;
  color: #fff;
  margin-bottom: 28px;
}
.dc-streak-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.dc-streak-left > i { width: 32px; height: 32px; flex-shrink: 0; }
.dc-streak-count { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.dc-streak-sub { font-size: 13px; opacity: .75; margin-top: 2px; }
.dc-streak-right {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  opacity: .85;
  font-weight: 500;
}
.dc-streak-right i { width: 16px; height: 16px; }

/* Page header */
.dc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.dc-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.dc-title i { width: 20px; height: 20px; color: var(--primary); }

/* Progress bar */
.dc-progress-wrap { margin-bottom: 20px; }
.dc-progress-label {
  font-size: 13px;
  color: var(--text-3);
  font-weight: 500;
  margin-bottom: 8px;
}
.dc-progress-track {
  height: 7px;
  background: var(--bg-2);
  border-radius: 99px;
  overflow: hidden;
}
.dc-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--violet));
  border-radius: 99px;
  transition: width .5s cubic-bezier(.4,0,.2,1);
}

/* All done banner */
.dc-all-done {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--green-soft);
  border: 1px solid #A7F3D0;
  border-radius: var(--r-md);
  color: #065F46;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 24px;
}
.dc-all-done i { width: 18px; height: 18px; flex-shrink: 0; }

/* Card list */
.dc-list { display: flex; flex-direction: column; gap: 20px; }

.dc-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  transition: box-shadow .2s, border-color .2s;
}
.dc-card:hover { box-shadow: 0 4px 24px rgba(99,102,241,.08); }
.dc-card--done { opacity: .9; }

/* Card top row */
.dc-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.dc-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.dc-card-difficulty {
  display: flex;
  align-items: center;
  gap: 4px;
}
.dc-dot {
  width: 18px;
  height: 5px;
  border-radius: 99px;
  background: var(--bg-2);
}
.dc-dot--fill { background: var(--primary); }
.dc-difficulty-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  margin-left: 4px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* XP tag */
.dc-xp-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 99px;
  background: var(--primary-soft);
  color: var(--primary);
  white-space: nowrap;
  flex-shrink: 0;
}
.dc-xp-tag i { width: 13px; height: 13px; }
.dc-xp-tag--correct { background: var(--green-soft); color: #065F46; }
.dc-xp-tag--wrong { background: var(--red-soft); color: #991B1B; }

/* Question */
.dc-question {
  font-size: 15.5px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 18px;
}

/* Options */
.dc-options { display: flex; flex-direction: column; gap: 8px; }

.dc-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: default;
  transition: border-color .15s, background .15s;
}
.dc-option--selectable {
  cursor: pointer;
}
.dc-option--selectable input[type="radio"] { display: none; }
.dc-option--selectable:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}
.dc-option--selectable:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.dc-option--correct {
  border-color: var(--green) !important;
  background: var(--green-soft) !important;
  color: #065F46 !important;
}
.dc-option--wrong {
  border-color: var(--red) !important;
  background: var(--red-soft) !important;
  color: #991B1B !important;
}
.dc-option-text { flex: 1; }
.dc-option-icon { width: 16px; height: 16px; flex-shrink: 0; }

/* Explanation */
.dc-explanation {
  display: none;
  align-items: flex-start;
  gap: 8px;
  margin-top: 14px;
  padding: 12px 16px;
  background: var(--blue-soft);
  border-radius: var(--r-sm);
  font-size: 13.5px;
  color: #1E40AF;
  line-height: 1.6;
}
.dc-explanation--visible { display: flex; }
.dc-explanation i { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }

/* Submit button */
.dc-submit-btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 13px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.dc-submit-btn:hover:not(:disabled) { background: var(--primary-hover); }
.dc-submit-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-3);
}
.empty-state i { width: 48px; height: 48px; margin-bottom: 16px; }
.empty-state p { font-size: 15px; }

/* =========================================================================
   Speaking Results
   ========================================================================= */
.sr-total-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 99px;
  font-size: 13px;
  font-weight: 700;
}

.sr-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.sr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.sr-table thead th {
  background: var(--surface-2);
  padding: 12px 16px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
}
.sr-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.sr-table tbody tr:last-child { border-bottom: none; }
.sr-table tbody tr:hover { background: var(--surface-2); }
.sr-table td { padding: 13px 16px; vertical-align: middle; }

.sr-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sr-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.sr-username { font-weight: 600; color: var(--text); }

.sr-topic-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  transition: color .15s;
}
.sr-topic-link:hover { color: var(--primary); }

.sr-part-badge {
  display: inline-block;
  padding: 3px 10px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
}

.sr-answers { color: var(--text-2); font-weight: 500; }
.sr-date { color: var(--text-3); font-size: 13px; white-space: nowrap; }

/* =========================================================================
   XP Progress
   ========================================================================= */
.xp-page { max-width: 760px; }

.xp-level-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--violet) 100%);
  border-radius: var(--r-lg);
  padding: 24px 28px;
  color: #fff;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.xp-level-left { display: flex; align-items: center; gap: 18px; }
.xp-level-icon {
  width: 52px; height: 52px;
  background: rgba(255,255,255,.15);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.xp-level-icon i { width: 26px; height: 26px; }
.xp-level-name { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; opacity: .8; margin-bottom: 4px; }
.xp-total-xp { font-size: 28px; font-weight: 900; letter-spacing: -.02em; }
.xp-total-xp span { font-size: 14px; font-weight: 500; opacity: .75; }

.xp-level-right { flex: 1; min-width: 200px; }
.xp-next-label { font-size: 13px; opacity: .8; margin-bottom: 8px; }
.xp-lvl-track {
  height: 8px; background: rgba(255,255,255,.25); border-radius: 99px; overflow: hidden; margin-bottom: 6px;
}
.xp-lvl-fill { height: 100%; background: #fff; border-radius: 99px; transition: width .6s ease; }
.xp-to-next { font-size: 12px; opacity: .7; }

/* Stats row */
.xp-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
.xp-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px 16px;
  text-align: center;
}
.xp-stat-card i { width: 20px; height: 20px; color: var(--primary); margin-bottom: 8px; }
.xp-stat-num { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -.02em; }
.xp-stat-label { font-size: 12px; color: var(--text-3); font-weight: 500; margin-top: 2px; }

/* Sections */
.xp-section { margin-bottom: 32px; }
.xp-section-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  margin-bottom: 16px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* Roadmap */
.xp-roadmap {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  padding: 8px 4px;
}
.xp-road-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; flex-shrink: 0; opacity: .4;
}
.xp-road-item--done { opacity: 1; }
.xp-road-icon {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg-2);
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--border);
}
.xp-road-item--done .xp-road-icon {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}
.xp-road-icon i { width: 18px; height: 18px; }
.xp-road-label { font-size: 12px; font-weight: 700; color: var(--text-2); }
.xp-road-xp { font-size: 11px; color: var(--text-3); }
.xp-road-line {
  flex: 1; height: 2px; background: var(--border);
  min-width: 24px; max-width: 60px; margin-bottom: 24px;
}
.xp-road-line--done { background: var(--primary); }

/* Bar chart */
.xp-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 100px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 12px 0;
}
.xp-bar-wrap {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  height: 100%; justify-content: flex-end;
}
.xp-bar {
  width: 100%; border-radius: 3px 3px 0 0;
  background: var(--bg-2); min-height: 3px;
  transition: height .3s ease;
}
.xp-bar--active { background: linear-gradient(180deg, var(--primary), var(--violet)); }
.xp-bar-label { font-size: 9px; color: var(--text-3); margin-top: 3px; padding-bottom: 4px; }

.xp-chart-empty {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-3);
}
.xp-chart-empty i { width: 32px; height: 32px; color: var(--text-3); opacity: .55; }
.xp-chart-empty p { margin: 0; font-size: 13px; text-align: center; max-width: 420px; }

/* History list */
.xp-history { display: flex; flex-direction: column; gap: 8px; }
.xp-hist-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 12px 16px;
}
.xp-hist-icon {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.xp-hist-icon i { width: 14px; height: 14px; }
.xp-hist-icon--correct { background: var(--green-soft); color: #065F46; }
.xp-hist-icon--wrong { background: var(--red-soft); color: #991B1B; }
.xp-hist-info { flex: 1; min-width: 0; }
.xp-hist-title { font-size: 14px; font-weight: 600; color: var(--text); }
.xp-hist-date { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.xp-hist-xp { font-size: 13px; font-weight: 700; color: var(--text-3); white-space: nowrap; }
.xp-hist-xp--earned { color: var(--primary); }

@media (max-width: 640px) {
  .xp-stats-row { grid-template-columns: repeat(2, 1fr); }
  .xp-level-card { flex-direction: column; align-items: flex-start; }
}

/* =========================================================================
   Profile — Activity Timeline
   ========================================================================= */
.prof-section { margin-bottom: 48px; }
.profile-joined { font-size: 13px; color: var(--text-3); margin-top: 4px; }

.prof-timeline { display: flex; flex-direction: column; gap: 6px; }
.prof-timeline-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 12px 16px;
  transition: background .12s;
}
.prof-timeline-item:hover { background: var(--surface-2); }

.prof-tl-icon {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.prof-tl-icon i { width: 16px; height: 16px; }
.prof-tl-icon--blue    { background: var(--blue-soft);    color: var(--blue); }
.prof-tl-icon--violet  { background: var(--violet-soft);  color: var(--violet); }
.prof-tl-icon--orange  { background: var(--orange-soft);  color: var(--orange); }
.prof-tl-icon--green   { background: var(--green-soft);   color: var(--green); }
.prof-tl-icon--amber   { background: var(--gold-soft);    color: var(--gold); }
.prof-tl-icon--primary { background: var(--primary-soft); color: var(--primary); }

.prof-tl-body { flex: 1; min-width: 0; }
.prof-tl-title { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prof-tl-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.prof-tl-date { font-size: 12px; color: var(--text-3); white-space: nowrap; flex-shrink: 0; }

/* =========================================================================
   Leaderboard
   ========================================================================= */
.lb-page { max-width: 780px; }

.lb-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.lb-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-3);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
}
.lb-tab i { width: 16px; height: 16px; }
.lb-tab:hover { color: var(--primary); }
.lb-tab--active { color: var(--primary); border-bottom-color: var(--primary); }

/* Podium */
.lb-podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
  padding: 24px 16px 0;
}
.lb-podium-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  max-width: 160px;
}
.lb-pod-crown {
  color: var(--gold);
  margin-bottom: 4px;
}
.lb-pod-crown i { width: 24px; height: 24px; }
.lb-pod-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 8px;
  border: 3px solid var(--border);
}
.lb-pod-avatar--1 {
  width: 58px;
  height: 58px;
  font-size: 22px;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px var(--gold-soft);
}
.lb-pod-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  text-align: center;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-pod-score {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}
.lb-pod-block {
  width: 100%;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  color: #fff;
}
.lb-pod-block--1 { height: 80px; background: linear-gradient(135deg, #F59E0B, #D97706); }
.lb-pod-block--2 { height: 60px; background: linear-gradient(135deg, #94A3B8, #64748B); }
.lb-pod-block--3 { height: 44px; background: linear-gradient(135deg, #CD7F32, #A0522D); }

/* Table */
.lb-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.lb-table thead th {
  background: var(--surface-2);
  padding: 12px 16px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
}
.lb-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.lb-table tbody tr:last-child { border-bottom: none; }
.lb-table tbody tr:hover { background: var(--surface-2); }
.lb-table td { padding: 13px 16px; vertical-align: middle; }

.lb-row--me { background: var(--primary-soft) !important; }
.lb-row--me:hover { background: var(--primary-soft-2) !important; }

.lb-rank { font-size: 16px; }
.lb-rank--gold, .lb-rank--silver, .lb-rank--bronze { font-size: 20px; }
.lb-muted { color: var(--text-3); }

.lb-you-badge {
  display: inline-block;
  padding: 2px 7px;
  background: var(--primary);
  color: #fff;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  margin-left: 6px;
  vertical-align: middle;
}

.sr-avatar--me {
  background: linear-gradient(135deg, var(--orange), var(--orange-2));
}

/* Accuracy bar */
.lb-acc-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.lb-acc-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-2);
  border-radius: 99px;
  overflow: hidden;
  min-width: 60px;
}
.lb-acc-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), #34D399);
  border-radius: 99px;
}
.lb-acc-num { font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap; }

/* =========================================================================
   Premium page
   ========================================================================= */
.pm-page { max-width: 760px; }

/* Hero */
.pm-hero {
  text-align: center;
  padding: 40px 20px 36px;
}
.pm-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  background: var(--gold-soft);
  color: #92400E;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 18px;
}
.pm-hero-badge i { width: 13px; height: 13px; }
.pm-hero-title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 900;
  letter-spacing: -.03em;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 16px;
}
.pm-hero-sub {
  font-size: 15.5px;
  color: var(--text-3);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Plans */
.pm-plans {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 36px;
}

.pm-plan {
  position: relative;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: box-shadow .2s;
}
.pm-plan:hover { box-shadow: 0 6px 28px rgba(0,0,0,.07); }

.pm-plan--featured {
  border-color: var(--primary);
  background: linear-gradient(160deg, var(--primary-soft) 0%, #fff 60%);
  box-shadow: 0 4px 24px rgba(99,102,241,.12);
}

.pm-plan-badge {
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, var(--primary), var(--violet));
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 14px;
  border-radius: 99px;
  white-space: nowrap;
  letter-spacing: .04em;
}

.pm-plan-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
  margin-bottom: 16px;
}

.pm-plan-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 4px;
}
.pm-amount        { font-size: 44px; font-weight: 900; letter-spacing: -.03em; color: var(--text); line-height: 1; }
.pm-currency-right{ font-size: 17px; font-weight: 700; color: var(--text-2); align-self: flex-end; padding-bottom: 4px; }

.pm-period-label {
  font-size: 13px;
  color: var(--text-3);
  font-weight: 600;
  margin-bottom: 6px;
}

.pm-per-month {
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 20px;
  min-height: 20px;
}

.pm-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 13px 20px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: background .15s, box-shadow .15s, transform .1s;
  cursor: pointer;
}
.pm-cta--primary {
  background: linear-gradient(135deg, var(--primary), var(--violet));
  color: #fff;
  box-shadow: 0 4px 16px rgba(99,102,241,.3);
}
.pm-cta--primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(99,102,241,.4); }
.pm-cta--outline {
  border: 1.5px solid var(--border-2);
  color: var(--text);
  background: var(--surface);
}
.pm-cta--outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

.pm-note {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 10px;
}

/* Divider */
.pm-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.pm-divider::before,
.pm-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Features */
.pm-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 40px;
}

.pm-feature {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px 20px;
  transition: box-shadow .15s;
}
.pm-feature:hover { box-shadow: 0 2px 12px rgba(0,0,0,.05); }

.pm-feature-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--r-sm);
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--primary);
}
.pm-feature-icon i { width: 20px; height: 20px; }

.pm-feature-body { flex: 1; }
.pm-feature-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.pm-feature-desc {
  font-size: 13.5px;
  color: var(--text-3);
  line-height: 1.55;
}

.pm-feature-check {
  color: var(--green);
  flex-shrink: 0;
  margin-top: 2px;
}
.pm-feature-check i { width: 20px; height: 20px; }

/* Bottom CTA */
/* Human examiner checking service */
.pm-human {
  margin-bottom: 40px;
  padding: 32px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  position: relative;
  overflow: hidden;
}
.pm-human::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, var(--primary), var(--violet, #8B5CF6));
}
.pm-human-head { text-align: center; margin-bottom: 26px; }
.pm-human-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 6px 14px; border-radius: 999px;
  margin-bottom: 14px;
}
.pm-human-badge i { width: 15px; height: 15px; }
.pm-human-title {
  font-size: 23px; font-weight: 800; letter-spacing: -0.02em;
  color: var(--text); margin-bottom: 8px; line-height: 1.25;
}
.pm-human-sub { font-size: 14.5px; color: var(--text-2); max-width: 540px; margin: 0 auto 16px; }
.pm-human-cred {
  display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 10px;
}
.pm-human-cred span {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--text-2);
  background: var(--bg); border: 1px solid var(--border);
  padding: 6px 14px; border-radius: 999px;
}
.pm-human-cred i { width: 15px; height: 15px; color: var(--primary); }
.pm-human-cred b { color: var(--text); font-weight: 800; }

.pm-human-services {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 26px;
}
.pm-human-card {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 22px 18px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.pm-human-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 12px 30px -16px rgba(124, 58, 237, 0.35);
}
.pm-human-card--featured { border-color: var(--primary); background: linear-gradient(160deg, var(--primary-soft), var(--bg)); }
.pm-human-icon {
  display: grid; place-items: center;
  width: 48px; height: 48px; border-radius: 14px;
  background: var(--primary-soft); color: var(--primary);
  margin-bottom: 14px;
}
.pm-human-icon i { width: 24px; height: 24px; }
.pm-human-icon--write { background: #EDE9FE; color: #7C3AED; }
.pm-human-icon--speak { background: #FEF3C7; color: #D97706; }
.pm-human-icon--cefr  { background: #DBEAFE; color: #2563EB; }
.pm-human-card-title { font-size: 15.5px; font-weight: 700; color: var(--text); margin-bottom: 6px; letter-spacing: -0.01em; }
.pm-human-card-desc { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-bottom: 16px; flex: 1; }
.pm-human-price {
  font-size: 24px; font-weight: 800; color: var(--primary); letter-spacing: -0.02em;
}
.pm-human-price span { font-size: 13px; font-weight: 600; color: var(--muted); }

.pm-human-contact {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%;
  padding: 14px 24px;
  background: var(--primary); color: #fff;
  border-radius: 14px;
  font-size: 15px; font-weight: 700;
  transition: filter 160ms ease, transform 160ms ease;
}
.pm-human-contact:hover { filter: brightness(1.07); transform: translateY(-1px); color: #fff; }
.pm-human-contact i { width: 18px; height: 18px; }

@media (max-width: 700px) {
  .pm-human-services { grid-template-columns: 1fr; }
  .pm-human { padding: 26px 18px; }
  .pm-human-title { font-size: 20px; }
}

.pm-bottom-cta {
  text-align: center;
  padding: 32px 20px;
  background: linear-gradient(135deg, var(--primary-soft), var(--violet-soft));
  border-radius: var(--r-lg);
  border: 1px solid var(--primary-soft-2);
}
.pm-bottom-cta p {
  font-size: 15px;
  color: var(--text-2);
  margin-bottom: 18px;
}
.pm-bottom-cta strong { color: var(--text); }
.pm-bottom-cta .pm-cta { width: auto; padding: 13px 32px; }

@media (max-width: 580px) {
  .pm-plans { grid-template-columns: 1fr; }
}

/* =========================================================================
   Utilities
   ========================================================================= */
[hidden] { display: none !important; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }


/* =========================================================================
   ===  MOBILE-PRO REFINEMENTS  ============================================
   These rules sit at the end of the file so they reliably override the
   earlier definitions on small viewports. Four breakpoints:
     900px   — phones in landscape / small tablets
     600px   — typical phone portrait
     480px   — small phones
     360px   — very small phones (iPhone SE 1st-gen)
   ========================================================================= */

/* --- Global mobile baseline ---------------------------------------------- */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
@media (max-width: 900px) {
  body {
    -webkit-tap-highlight-color: rgba(124, 58, 237, 0.15);
  }
  /* iOS auto-zoom prevention: text inputs must be >= 16px on mobile */
  input[type="text"],
  input[type="search"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  input[type="url"],
  textarea,
  select { font-size: 16px !important; }
  /* allow horizontal scroll cleanup */
  body, html { overflow-x: hidden; }
}

/* --- Tablet / phone landscape (max 900px) -------------------------------- */
@media (max-width: 900px) {
  :root { --topbar-h: 58px; }

  /* Sidebar drawer — full polish */
  .sidebar {
    width: min(86vw, 320px);
    z-index: 60;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }
  .app.sidebar-open .main::before {
    z-index: 50;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }
  /* When drawer is open, prevent body scroll under it */
  .app.sidebar-open { overflow: hidden; }

  /* Topbar — compact */
  .topbar {
    padding: 0 12px;
    gap: 8px;
    /* iOS notch */
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .sidebar-toggle {
    height: 40px;
    padding: 0 12px;
    border-radius: 10px;
  }
  .sidebar-toggle i { width: 20px; height: 20px; }
  .brand-top .brand-logo { width: 34px; height: 34px; border-radius: 9px; }
  .brand-top .brand-logo i { width: 17px; height: 17px; }
  .brand-top .brand-name { font-size: 14px; }
  .brand-top .brand-tag { display: none; }

  .topbar-stats { gap: 6px; }
  .stat-chip { padding: 6px 9px; font-size: 12px; gap: 5px; }
  .stat-chip i { width: 13px; height: 13px; }
  .topbar-divider { display: none; }
  .icon-btn { width: 38px; height: 38px; }
  .icon-btn i { width: 18px; height: 18px; }
  .icon-btn .dot { top: 8px; right: 9px; }
  .topbar-avatar { width: 34px; height: 34px; font-size: 12.5px; }
}

/* --- Phone portrait (max 600px) ----------------------------------------- */
@media (max-width: 600px) {
  /* Slightly smaller body text & tighter container padding */
  body { font-size: 14px; line-height: 1.5; }

  .page, .books-wrap, .grammar-wrap, .vocab-wrap, .speaking-wrap, .pron-wrap,
  .writing-wrap, .writing-setup-wrap, .writing-editor-wrap, .practice-wrap,
  .speaking-qa-wrap, .gquiz-wrap, .reading-wrap, .quiz-wrap, .exam-grid-wrap,
  .gt-wrap {
    padding: 18px 14px 40px;
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }

  /* Topbar even tighter */
  .topbar { padding: 0 10px; gap: 6px; }
  .brand-top .brand-text { display: none; }   /* logo only on small phones */
  .stat-chip { padding: 5px 8px; }
  .stat-chip .num { font-size: 12.5px; }

  /* Buttons — keep tap targets >= 42px while staying compact */
  .btn, .quiz-btn, .qa-btn-primary, .exam-start,
  .writing-start-btn, .vocab-search-btn, .btn-mock, .auth-submit,
  .btn-ghost, .quiz-btn-ghost {
    height: 44px;
    padding: 0 16px;
    font-size: 13.5px;
  }

  /* === Vocab quiz / palette === */
  .quiz-back {
    padding: 8px 14px;
    font-size: 12.5px;
    margin-bottom: 14px;
  }
  .quiz-status-card { padding: 12px 14px; border-radius: 12px; margin-bottom: 12px; }
  .quiz-status-row { gap: 10px; flex-wrap: wrap; }
  .quiz-progress-text { font-size: 11px; }
  .quiz-timer { font-size: 12px; padding: 4px 10px; }
  .quiz-layout { gap: 14px; }
  .quiz-main .quiz-card {
    padding: 22px 18px;
    border-radius: 16px;
  }
  .quiz-main .quiz-question {
    font-size: 20px;
    margin-bottom: 18px;
    line-height: 1.35;
  }
  .quiz-main .quiz-choices { gap: 10px; }
  .quiz-main .quiz-choice {
    padding: 14px 14px;
    gap: 12px;
    font-size: 15px;
    border-radius: 12px;
    border-width: 1.5px;
    min-height: 56px;
  }
  .quiz-main .quiz-choice-letter {
    width: 32px; height: 32px;
    font-size: 13px;
    border-width: 1.5px;
  }
  .quiz-main .quiz-btn { height: 46px; padding: 0 18px; }
  .quiz-main .quiz-gap-input { height: 52px; font-size: 16px; padding: 0 16px; }
  .quiz-main .gquiz-type-pill { font-size: 10px; padding: 4px 9px; margin-bottom: 12px; }

  /* Palette — keep it compact + tap-friendly */
  .quiz-palette {
    padding: 16px;
    border-radius: 16px;
  }
  .quiz-palette-head { margin-bottom: 12px; }
  .quiz-palette-grid { grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 14px; }
  .quiz-palette-btn { min-height: 44px; font-size: 14px; border-radius: 10px; }
  .quiz-palette-finish {
    height: 50px; padding: 0 16px;
    font-size: 14px;
    border-radius: 12px;
  }
  .quiz-palette-legend { gap: 8px; padding-top: 12px; font-size: 12px; }
  .quiz-dot { width: 11px; height: 11px; }

  /* Quiz result card */
  .quiz-result {
    padding: 30px 20px;
    border-radius: 18px;
  }
  .quiz-result-score { font-size: 36px; }
  .quiz-result-title { font-size: 20px; }
  .quiz-result-actions { flex-direction: column; align-items: stretch; }
  .quiz-result-actions .quiz-btn { width: 100%; }

  /* === Grammar topic-tests page === */
  .gt-hero {
    grid-template-columns: 1fr;
    padding: 22px 20px;
    gap: 16px;
    margin-top: 8px;
    margin-bottom: 18px;
    border-radius: 18px;
  }
  .gt-hero-icon { width: 64px; height: 64px; font-size: 34px; border-radius: 16px; }
  .gt-hero-title { font-size: 24px; line-height: 1.15; }
  .gt-hero-sub { font-size: 13.5px; margin-bottom: 14px; }
  .gt-hero-stats { gap: 8px; margin-bottom: 12px; }
  .gt-stat { padding: 8px 12px; min-width: 90px; flex: 1; border-radius: 12px; }
  .gt-stat-label { font-size: 9.5px; letter-spacing: 1.1px; }
  .gt-stat-value { font-size: 17px; }
  .gt-stat-mini { font-size: 10px; }
  .gt-hero-progress { height: 6px; }
  .gt-grid { grid-template-columns: 1fr; gap: 12px; }
  .gt-test-card { padding: 18px 18px 16px; border-radius: 14px; gap: 10px; }
  .gt-test-num { width: 38px; height: 38px; font-size: 17px; border-radius: 11px; }
  .gt-test-title { font-size: 17px; }
  .gt-test-sub { font-size: 12.5px; }
  .gt-test-meta { padding: 10px 0; }
  .gt-test-meta-row { font-size: 12.5px; }
  .gt-test-badge { font-size: 10px; padding: 4px 8px; }
  .gt-test-cta { font-size: 12.5px; }
  .gt-footnote { font-size: 12px; padding: 10px 14px; text-align: center; }

  /* === Speaking topic_qa / IELTS result === */
  .speaking-back a { font-size: 13px; }
  .qa-card { padding: 22px 18px; }
  .qa-question { font-size: 18px; line-height: 1.4; }
  .qa-tabs { gap: 6px; }
  .qa-tab { padding: 9px 14px; font-size: 13px; }
  .qa-panel-text textarea { font-size: 16px; min-height: 140px; padding: 14px; }
  .voice-body { padding: 22px 14px; gap: 14px; }
  .voice-record { padding: 14px 22px; font-size: 14px; min-height: 56px; }
  .qa-nav { gap: 10px; }
  .qa-nav .quiz-btn { flex: 1; }

  .ielts-eval-loading { padding: 40px 22px; border-radius: 18px; }
  .ielts-eval-spinner { width: 48px; height: 48px; margin-bottom: 18px; }
  .ielts-eval-loading-title { font-size: 17px; }
  .ielts-eval-loading-sub { font-size: 13px; }

  .ielts-result { padding: 24px 18px 22px; border-radius: 18px; }
  .ielts-result-badge { width: 52px; height: 52px; margin-bottom: 10px; }
  .ielts-result-badge i { width: 26px; height: 26px; }
  .ielts-result-title { font-size: 19px; }
  .ielts-result-sub { font-size: 12.5px; }
  .ielts-overall {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px;
    border-radius: 16px;
  }
  .ielts-overall-band {
    border-right: none;
    border-bottom: 1px dashed rgba(124, 58, 237, 0.25);
    padding: 0 0 12px;
  }
  .ielts-band-label { font-size: 10px; }
  .ielts-band-number { font-size: 48px; }
  .ielts-percent-number { font-size: 26px; }
  .ielts-percent-bar { height: 10px; }
  .ielts-criteria { grid-template-columns: 1fr; gap: 10px; margin-bottom: 18px; }
  .ielts-criterion { padding: 12px 14px; border-radius: 12px; }
  .ielts-criterion-head { font-size: 13.5px; gap: 8px; }
  .ielts-criterion-head i { width: 16px; height: 16px; }
  .ielts-criterion-band { font-size: 20px; }
  .ielts-feedback { padding: 16px; border-radius: 14px; }
  .ielts-feedback-head { font-size: 11px; margin-bottom: 10px; }
  .ielts-feedback-body { font-size: 13.5px; line-height: 1.6; }
  .ielts-result-actions { flex-direction: column; align-items: stretch; }
  .ielts-result-actions .quiz-btn { width: 100%; }

  /* === Exam list (vocab) === */
  .exam-grid { grid-template-columns: 1fr; gap: 12px; }
  .exam-card { padding: 18px; border-radius: 14px; }
  .exam-card-title { font-size: 15.5px; }
  .exam-start { width: 100%; height: 46px; }

  /* Generic card padding tighten */
  .quiz-card, .gquiz-card, .qa-card, .word-card { padding: 20px 18px; border-radius: 14px; }

  /* Auth pages — input/button mobile size */
  .auth-card { padding: 26px 20px; border-radius: 18px; }
  .auth-title { font-size: 22px; }
  .auth-submit { width: 100%; height: 48px; }
}

/* --- Small phone (max 480px) -------------------------------------------- */
@media (max-width: 480px) {
  .gt-hero { padding: 20px 16px; }
  .gt-hero-title { font-size: 22px; }
  .gt-hero-stats { flex-direction: row; }
  .gt-stat { min-width: 0; flex: 1; padding: 7px 10px; }
  .gt-stat-value { font-size: 16px; }

  .quiz-main .quiz-question { font-size: 18px; }
  .quiz-main .quiz-choice { padding: 12px 12px; font-size: 14.5px; }
  .quiz-main .quiz-choice-letter { width: 30px; height: 30px; font-size: 12.5px; }
  .quiz-palette-grid { gap: 7px; }
  .quiz-palette-btn { min-height: 42px; font-size: 13.5px; }

  /* Hide stats text fully on tiny screens — XP/Streak just show number */
  .stat-chip span:not(.num) { display: none; }

  .ielts-band-number { font-size: 42px; }
  .ielts-percent-number { font-size: 22px; }

  .gt-test-card { padding: 16px 16px 14px; }
  .gt-test-num { width: 36px; height: 36px; font-size: 16px; }
  .gt-test-title { font-size: 16px; }
}

/* --- Very small (max 360px) --------------------------------------------- */
@media (max-width: 360px) {
  .topbar { padding: 0 8px; gap: 4px; }
  .brand-top { display: none; }   /* save space on micro phones */
  .stat-chip { padding: 5px 7px; gap: 4px; }
  .icon-btn { width: 36px; height: 36px; }
  .topbar-avatar { width: 32px; height: 32px; }

  .gt-hero-title { font-size: 20px; }
  .gt-hero-icon { width: 56px; height: 56px; font-size: 30px; border-radius: 14px; }
  .gt-hero-stats { gap: 6px; }
  .gt-stat-value { font-size: 15px; }
  .gt-stat-label { font-size: 9px; letter-spacing: 1px; }

  .quiz-main .quiz-card { padding: 18px 14px; }
  .quiz-main .quiz-question { font-size: 17px; }
  .quiz-palette { padding: 12px; }
  .quiz-palette-grid { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .quiz-palette-btn { min-height: 38px; font-size: 13px; border-radius: 8px; }

  .ielts-result { padding: 20px 14px; }
  .ielts-band-number { font-size: 38px; }
}

/* --- Reduce-motion respect (accessibility, also helps low-end phones) --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================================
   Notifications dropdown (topbar bell)
   ========================================================================= */
.notif { position: relative; display: inline-flex; }
.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 340px;
  max-width: calc(100vw - 32px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  z-index: 60;
  overflow: hidden;
  animation: notif-pop var(--t-fast) var(--ease);
}
@keyframes notif-pop {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.notif-count {
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: var(--primary);
  border-radius: 999px;
  padding: 1px 8px;
}
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item {
  display: flex;
  gap: 11px;
  padding: 12px 16px;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-2); }
.notif-item.unread { background: var(--primary-soft); }
.notif-item.unread:hover { background: var(--primary-soft-2); }
.notif-ic {
  flex: none;
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--primary);
}
.notif-ic i { width: 17px; height: 17px; }
.notif-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 700; color: var(--text); }
.notif-msg { font-size: 12px; color: var(--text-2); line-height: 1.45; }
.notif-time { font-size: 11px; color: var(--muted); margin-top: 2px; }
.notif-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 34px 16px;
  color: var(--muted);
  font-size: 12.5px;
}
.notif-empty i { width: 24px; height: 24px; }

/* Sidebar premium lock badge */
.nav-lock {
  margin-left: auto;
  width: 14px; height: 14px;
  color: var(--muted);
  flex: none;
}
.nav-item .nav-badge + .nav-lock { margin-left: 6px; }
.nav-item.active .nav-lock { color: var(--text-inv-3); }

/* =========================================================================
   Premium — request buttons + status banners
   ========================================================================= */
.pm-cta-form { width: 100%; margin: 0; }
.pm-cta {
  font-family: inherit;
  border: none;
  cursor: pointer;
}
.pm-cta--outline { /* keep the 1.5px border from the base rule for the button */
  border: 1.5px solid var(--border-2);
}

.pm-status {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--r-lg);
  margin-bottom: 26px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.pm-status > i { flex: none; width: 22px; height: 22px; margin-top: 1px; }
.pm-status-body { display: flex; flex-direction: column; gap: 3px; }
.pm-status-body strong { font-size: 14.5px; font-weight: 800; color: var(--text); }
.pm-status-body span { font-size: 13px; color: var(--text-2); line-height: 1.5; }
.pm-status--active {
  border-color: #C7D2FE;
  background: linear-gradient(180deg, #F5F3FF 0%, #EEF0FF 100%);
}
.pm-status--active > i { color: var(--primary); }
.pm-status--pending {
  border-color: #FED7AA;
  background: linear-gradient(180deg, #FFF7ED 0%, #FFEDD5 100%);
}
.pm-status--pending > i { color: var(--orange-2); }
.pm-status--locked {
  border-color: var(--border-2);
  background: var(--surface-2);
}
.pm-status--locked > i { color: var(--text-3); }
/* Telegram contact button (own line inside the pending banner) */
.pm-tg-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  margin-top: 12px;
  padding: 9px 16px;
  border-radius: var(--r-pill);
  background: #229ED9;            /* Telegram blue */
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(34, 158, 217, 0.3);
  transition: background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.pm-tg-btn:hover {
  background: #1B8FC5;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(34, 158, 217, 0.4);
}
.pm-tg-btn i { width: 16px; height: 16px; }
.pm-bottom-cta .pm-cta i { width: 16px; height: 16px; }
