/* ============================================================
   LearnUnic — Minimal Black & White Design System
   Inspired by: Uber / Uber Eats clean typography-first design
   ============================================================ */

/* ── Variables ──────────────────────────────────────────────────── */
:root {
  --black:        #000000;
  --white:        #ffffff;
  --gray-50:      #fafafa;
  --gray-100:     #f5f5f5;
  --gray-200:     #e5e5e5;
  --gray-300:     #d4d4d4;
  --gray-400:     #a3a3a3;
  --gray-500:     #737373;
  --gray-600:     #525252;
  --gray-700:     #404040;
  --gray-800:     #262626;
  --gray-900:     #171717;

  --bg:           var(--white);
  --bg-card:      var(--white);
  --bg-muted:     var(--gray-50);
  --bg-subtle:    var(--gray-100);
  --border:       var(--gray-200);
  --border-dark:  var(--gray-300);

  --text:         var(--gray-900);
  --text-muted:   var(--gray-500);
  --text-light:   var(--gray-400);

  --accent:       var(--black);
  --accent-hover: var(--gray-800);

  --success:      #16a34a;
  --warning:      #d97706;
  --danger:       #dc2626;
  --info:         #2563eb;

  --radius:       12px;
  --radius-sm:    8px;
  --radius-xs:    4px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:       0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-md:    0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.05);
  --shadow-lg:    0 20px 25px -5px rgba(0,0,0,.08);

  --font:         'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --font-mono:    'SF Mono', 'Fira Code', monospace;
  --header-h:     60px;
  --sidebar-w:    240px;
  --mob-topbar-h: 54px;
  --transition:   150ms cubic-bezier(.4,0,.2,1);
}

[data-theme="dark"] {
  --bg:        #0a0a0a;
  --bg-card:   #111111;
  --bg-muted:  #1a1a1a;
  --bg-subtle: #222222;
  --border:    #2a2a2a;
  --border-dark: #333333;
  --text:      #fafafa;
  --text-muted:#a3a3a3;
  --text-light:#525252;
  --accent:    var(--white);
  --accent-hover: var(--gray-200);
}

/* ── Tamil font override ─────────────────────────────────────────── */
/* When interface language is Tamil, switch to Baloo Thambi 2.
   Inter stays active for French/Latin text inside Tamil UI because
   Baloo Thambi 2 contains the full Latin-Extended block too. */
[data-lang="ta"] {
  --font: 'Baloo Thambi 2', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
/* Ensure weight mapping works — Baloo Thambi 2 supports 400–800 */
[data-lang="ta"] body,
[data-lang="ta"] input,
[data-lang="ta"] textarea,
[data-lang="ta"] select,
[data-lang="ta"] button {
  font-family: var(--font);
  /* Baloo Thambi 2 renders best with slightly more line height for Tamil script */
  line-height: 1.7;
}
/* Keep monospace elements (code/pre) using the mono font regardless */
[data-lang="ta"] code,
[data-lang="ta"] pre,
[data-lang="ta"] .font-mono {
  font-family: var(--font-mono);
  line-height: 1.55;
}

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
input, textarea, select, button { font-family: inherit; font-size: inherit; }
.hidden { display: none !important; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ── Typography ─────────────────────────────────────────────────── */
h1 { font-size: clamp(1.75rem, 3.5vw, 2.75rem); font-weight: 800; letter-spacing: -.04em; line-height: 1.1; }
h2 { font-size: 1.4rem; font-weight: 700; letter-spacing: -.02em; }
h3 { font-size: 1.05rem; font-weight: 600; letter-spacing: -.01em; }
p  { color: var(--text-muted); line-height: 1.65; }
strong { color: var(--text); }

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
  border: 1.5px solid transparent; transition: var(--transition);
  white-space: nowrap; text-decoration: none !important; line-height: 1;
}
.btn-primary {
  background: var(--black); color: var(--white); border-color: var(--black);
}
.btn-primary:hover { background: var(--gray-800); border-color: var(--gray-800); }
[data-theme="dark"] .btn-primary { background: var(--white); color: var(--black); border-color: var(--white); }
[data-theme="dark"] .btn-primary:hover { background: var(--gray-200); border-color: var(--gray-200); }

.btn-outline {
  background: transparent; color: var(--text); border-color: var(--border-dark);
}
.btn-outline:hover { border-color: var(--black); background: var(--bg-subtle); }

.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-subtle); color: var(--text); }

.btn-danger { color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }

.btn-full { width: 100%; justify-content: center; }
.btn-sm   { padding: 6px 12px; font-size: 13px; }
.btn-lg   { padding: 13px 24px; font-size: 15px; }
.btn:disabled { opacity: .45; pointer-events: none; }

.btn-icon {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border); background: var(--bg-card);
  cursor: pointer; transition: var(--transition); color: var(--text-muted); font-size: 15px;
}
.btn-icon:hover { border-color: var(--black); color: var(--black); }

/* ── Guest header (only shown when logged out) ───────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.header-inner { height: 100%; display: flex; align-items: center; gap: 0; }
.logo {
  display: flex; align-items: center; gap: 8px;
  font-size: 1.1rem; font-weight: 800; color: var(--text);
  letter-spacing: -.03em; text-decoration: none !important; flex-shrink: 0;
  margin-right: 32px;
}
.logo-icon { font-size: 1.2rem; }
.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* ── Left Sidebar ────────────────────────────────────────────────── */
.site-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  z-index: 300;
  display: flex; flex-direction: column;
  transition: transform 280ms cubic-bezier(.4,0,.2,1);
}
.sidebar-inner {
  display: flex; flex-direction: column;
  height: 100%; padding: 0;
  overflow-y: auto; overflow-x: hidden;
}

/* Logo */
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.05rem; font-weight: 800; color: var(--text);
  letter-spacing: -.03em; text-decoration: none !important;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-logo-icon { font-size: 1.25rem; }
.sidebar-logo-text {}

/* Nav */
.sidebar-nav {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 10px;
  flex: 1;
}
.sidebar-link {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 500; font-size: 14px;
  transition: var(--transition); text-decoration: none !important;
  letter-spacing: -.01em;
}
.sidebar-link i { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-link:hover { color: var(--text); background: var(--bg-subtle); }
.sidebar-link--active {
  color: var(--text); font-weight: 700; background: var(--bg-subtle);
}
[data-theme="dark"] .sidebar-link--active { background: var(--bg-subtle); }

.sidebar-spacer { flex: 1; min-height: 12px; }
.sidebar-divider { height: 1px; background: var(--border); margin: 6px 12px; }

/* Theme toggle in sidebar */
.sidebar-theme-btn {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 22px; background: none; border: none;
  cursor: pointer; color: var(--text-muted); font-size: 14px;
  font-family: var(--font); font-weight: 500;
  transition: var(--transition);
  border-top: 1px solid var(--border);
}
.sidebar-theme-btn:hover { color: var(--text); }
.sidebar-theme-btn i { width: 18px; text-align: center; font-size: 14px; }

/* User section */
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px; border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-user-avatar {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
.sidebar-user-initials {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--black); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; flex-shrink: 0;
}
[data-theme="dark"] .sidebar-user-initials { background: var(--white); color: var(--black); }
.sidebar-user-info {
  display: flex; flex-direction: column; flex: 1; min-width: 0;
}
.sidebar-user-name {
  font-size: 13.5px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role { font-size: 11.5px; color: var(--text-muted); }
/* Clickable profile area (avatar + name) in desktop sidebar */
.sidebar-user-profile-link {
  display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0;
  text-decoration: none !important; border-radius: var(--radius-sm);
  padding: 4px 2px; transition: var(--transition);
}
.sidebar-user-profile-link:hover .sidebar-user-name { color: var(--accent); }
.sidebar-user-profile-link:hover .sidebar-user-initials,
.sidebar-user-profile-link:hover .sidebar-user-avatar { opacity: .85; }

.sidebar-logout {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--danger); font-size: 14px; flex-shrink: 0;
  transition: var(--transition); background: transparent;
  text-decoration: none !important;
}
.sidebar-logout:hover { background: #fee2e2; }

/* Sidebar overlay (mobile drawer backdrop) */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 299;
  transition: opacity 280ms;
}
.sidebar-overlay.overlay--visible { display: block; }

/* ── Mobile Floating Top Bar ─────────────────────────────────────── */
.mob-topbar {
  display: none; /* hidden on desktop */
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--mob-topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  align-items: center; justify-content: space-between;
  padding: 0 14px;
  z-index: 200;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.mob-topbar-btn {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--bg-card);
  cursor: pointer; color: var(--text-muted); font-size: 15px;
  transition: var(--transition); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.mob-topbar-btn:hover { border-color: var(--black); color: var(--text); }
.mob-topbar-logo {
  display: flex; align-items: center; gap: 7px;
  font-size: 1rem; font-weight: 800; color: var(--text);
  letter-spacing: -.03em; text-decoration: none !important;
  position: absolute; left: 50%; transform: translateX(-50%);
}
.mob-topbar-logo i { font-size: 1.1rem; }
.mob-topbar-right { display: flex; align-items: center; gap: 8px; }
.mob-topbar-avatar-wrap { display: flex; align-items: center; }
.mob-topbar-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.mob-topbar-initials {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--black); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12px;
}
[data-theme="dark"] .mob-topbar-initials { background: var(--white); color: var(--black); }

/* ── Theme toggle (keep generic class for script) ────────────────── */
.theme-toggle {
  cursor: pointer; transition: var(--transition);
}

/* ── Keep legacy selectors used by old views ─────────────────────── */
.user-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.user-avatar-initials {
  width: 28px; height: 28px; border-radius: 50%; background: var(--black); color: var(--white);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px;
}
.nav-link {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 500; font-size: 13.5px;
  transition: var(--transition); text-decoration: none !important; letter-spacing: -.01em;
}
.nav-link:hover  { color: var(--text); background: var(--bg-subtle); }
.nav-link.active { color: var(--text); font-weight: 700; background: var(--bg-subtle); }
.mobile-menu-btn { display: none; }

/* ── Footer ─────────────────────────────────────────────────────── */
.site-footer {
  background: var(--bg-card); border-top: 1px solid var(--border);
  padding: 28px 0; margin-top: auto;
}
.footer-inner { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; justify-content: space-between; }
.footer-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--text); letter-spacing: -.03em; }
.footer-copy  { color: var(--text-muted); font-size: 13px; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--text-muted); font-size: 13px; }
.footer-links a:hover { color: var(--text); }

/* ── Page structure ─────────────────────────────────────────────── */
.main-content { flex: 1; }
.page-body { padding: 36px 0; }

/* Sidebar layout — push content right on desktop */
@media (min-width: 769px) {
  body { padding-left: var(--sidebar-w); }
  .site-sidebar { transform: none !important; }
  .mob-topbar { display: none !important; }
}

/* Mobile layout — sidebar becomes drawer, top bar appears */
@media (max-width: 768px) {
  body { padding-left: 0; padding-top: var(--mob-topbar-h); }
  .mob-topbar { display: flex; }
  .site-sidebar {
    transform: translateX(-100%);
    width: min(var(--sidebar-w), 82vw);
  }
  .site-sidebar.sidebar--open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0,0,0,.18);
  }
}

.page-hero {
  border-bottom: 1px solid var(--border);
  background: var(--bg-card); padding: 36px 0;
}
.page-hero h1 { color: var(--text); }
.page-hero p  { color: var(--text-muted); margin-top: 6px; }
.page-hero--dashboard { background: var(--black); }
.page-hero--dashboard h1,
.page-hero--dashboard p { color: var(--white); }
.page-hero--dashboard p { opacity: .7; }
.hero-greeting { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }

/* ── Cards ──────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.card--full { grid-column: 1 / -1; }
.card--danger { border-color: #fecaca; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.card-header h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 1rem; }
.card-link { color: var(--text-muted); font-size: 13px; font-weight: 500; }
.card-link:hover { color: var(--text); }

/* ── Stats ──────────────────────────────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px;
  display: flex; align-items: center; gap: 16px;
}
.stat-icon {
  width: 42px; height: 42px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0; background: var(--bg-subtle); color: var(--text);
}
.stat-card--featured .stat-icon { background: var(--black); color: var(--white); }
[data-theme="dark"] .stat-card--featured .stat-icon { background: var(--white); color: var(--black); }
.stat-value { display: block; font-size: 1.55rem; font-weight: 800; color: var(--text); letter-spacing: -.04em; }
.stat-label { color: var(--text-muted); font-size: 12.5px; font-weight: 500; }

/* ── Dashboard grid ─────────────────────────────────────────────── */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }

/* ── Quick actions ──────────────────────────────────────────────── */
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick-action {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 8px; border-radius: var(--radius-sm);
  background: var(--bg-subtle); color: var(--text-muted);
  text-decoration: none !important; transition: var(--transition);
  font-size: 12px; font-weight: 500; border: 1px solid transparent;
}
.quick-action:hover { background: var(--bg-card); border-color: var(--border-dark); color: var(--text); }
.quick-action:hover .qa-icon { background: var(--black); color: var(--white); }
[data-theme="dark"] .quick-action:hover .qa-icon { background: var(--white); color: var(--black); }
.qa-icon {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; background: var(--bg-card); color: var(--text);
  transition: var(--transition); border: 1px solid var(--border);
}

/* ── Streak ─────────────────────────────────────────────────────── */
.streak-row { display: flex; gap: 10px; justify-content: center; padding: 6px 0; }
.streak-day { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); font-weight: 500; }
.streak-dot { width: 30px; height: 30px; border-radius: 50%; background: var(--bg-subtle); border: 1.5px solid var(--border); transition: var(--transition); }
.streak-day--active .streak-dot { background: var(--black); border-color: var(--black); }
.streak-day--active span { color: var(--text); font-weight: 700; }
[data-theme="dark"] .streak-day--active .streak-dot { background: var(--white); }

/* ── Tables ─────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  background: var(--bg-subtle); padding: 10px 14px; text-align: left;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.data-table td { padding: 13px 14px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover td { background: var(--bg-subtle); }

/* ── Badges ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: var(--radius-xs);
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
}
.badge--black  { background: var(--black); color: var(--white); }
.badge--green  { background: #dcfce7; color: #14532d; }
.badge--red    { background: #fee2e2; color: #7f1d1d; }
.badge--orange { background: #fef3c7; color: #78350f; }
.badge--blue   { background: #dbeafe; color: #1e3a8a; }
.badge--gray   { background: var(--bg-subtle); color: var(--text-muted); border: 1px solid var(--border); }
.badge--level  { background: var(--bg-subtle); color: var(--text); border: 1.5px solid var(--border-dark); font-weight: 800; }

/* ── Alerts ─────────────────────────────────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 16px; border-radius: var(--radius-sm);
  margin-bottom: 20px; font-size: 14px; border: 1px solid;
}
.alert-success { background: #f0fdf4; color: #14532d; border-color: #bbf7d0; }
.alert-error   { background: #fef2f2; color: #7f1d1d; border-color: #fecaca; }
.alert-warning { background: #fffbeb; color: #78350f; border-color: #fde68a; }
.alert-info    { background: #eff6ff; color: #1e3a8a; border-color: #bfdbfe; }

/* ── Forms ──────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px;
}
.label-link { font-weight: 400; color: var(--text-muted); font-size: 12px; }
.label-link:hover { color: var(--text); }

.input-icon-wrap { position: relative; }
.input-icon-wrap > i:first-child {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-light); font-size: 14px; pointer-events: none;
}
.input-icon-wrap input { padding-left: 38px !important; }

input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%; padding: 11px 14px;
  border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  background: var(--bg-card); color: var(--text); font-size: 14px;
  transition: var(--transition); outline: none; line-height: 1.4;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--black); box-shadow: 0 0 0 3px rgba(0,0,0,.06);
}
[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus { box-shadow: 0 0 0 3px rgba(255,255,255,.08); }
.form-select { cursor: pointer; }
.toggle-pw {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  border: none; background: none; cursor: pointer; color: var(--text-light); font-size: 14px; padding: 4px;
}
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; color: var(--text-muted); }
.checkbox-label input { width: auto; cursor: pointer; accent-color: var(--black); }
.form-row-space { margin-bottom: 18px; }
.section-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-light); margin-bottom: 10px; }

/* ── Empty state ────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 20px; }
.empty-state i { font-size: 2rem; margin-bottom: 12px; color: var(--text-light); display: block; }
.empty-state p { margin-bottom: 16px; }
.empty-state h3 { margin-bottom: 8px; color: var(--text); }
.empty-state--large { padding: 80px 20px; }

/* ── Courses ─────────────────────────────────────────────────────── */
.courses-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.courses-grid--full { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.course-card {
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border);
  background: var(--bg-card); transition: var(--transition); text-decoration: none !important; display: block;
}
.course-card:hover { border-color: var(--black); box-shadow: var(--shadow-md); }
.course-thumb { width: 100%; height: 120px; object-fit: cover; }
.course-thumb--placeholder {
  height: 120px; background: var(--bg-subtle);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-light); font-size: 2rem;
}
.course-info { padding: 14px; }
.course-info h3 { font-size: 13.5px; color: var(--text); margin-bottom: 4px; font-weight: 600; }
.course-level { font-size: 11px; color: var(--text-muted); font-weight: 500; }

.course-card-full {
  display: flex; gap: 0; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: var(--transition);
}
.course-card-full:hover { border-color: var(--black); box-shadow: var(--shadow); }
.course-card-full--enrolled { border-left: 3px solid var(--black); }
.course-card-full .course-thumb { width: 160px; height: auto; flex-shrink: 0; }
.course-card-full .course-thumb--placeholder { width: 160px; min-height: 120px; }
.course-details { padding: 20px 24px; flex: 1; }
.course-meta { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.course-details h3 { margin-bottom: 6px; font-size: 1.05rem; }
.course-details p { font-size: 13.5px; }
.course-footer { margin-top: 16px; display: flex; gap: 10px; align-items: center; }

/* ── Auth pages ─────────────────────────────────────────────────── */
.auth-split { display: flex; min-height: 100vh; }
.auth-form-side {
  flex: 0 0 480px; display: flex; align-items: center; justify-content: center;
  padding: 48px 24px; background: var(--bg);
}
.auth-box { width: 100%; max-width: 380px; }
.auth-logo {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 1.15rem; font-weight: 800; color: var(--text);
  text-decoration: none !important; margin-bottom: 32px;
  letter-spacing: -.04em;
}
.auth-title { font-size: 1.9rem; font-weight: 800; margin-bottom: 6px; color: var(--text); letter-spacing: -.05em; }
.auth-sub   { color: var(--text-muted); margin-bottom: 28px; font-size: 14px; }
.google-btn-wrap { margin-bottom: 4px; }
.google-btn-wrap > div { width: 100% !important; }
.btn-google-native {
  width: 100%; padding: 11px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-card); cursor: pointer;
  font-weight: 600; font-size: 14px; display: flex; align-items: center;
  justify-content: center; gap: 10px; transition: var(--transition); color: var(--text);
}
.btn-google-native:hover { border-color: var(--black); box-shadow: var(--shadow-sm); }
.btn-google-native img { width: 18px; height: 18px; }
.auth-divider {
  text-align: center; position: relative; margin: 20px 0;
  color: var(--text-light); font-size: 12px; font-weight: 500; letter-spacing: .05em; text-transform: uppercase;
}
.auth-divider::before, .auth-divider::after {
  content: ''; position: absolute; top: 50%;
  width: calc(50% - 28px); height: 1px; background: var(--border);
}
.auth-divider::before { left: 0; } .auth-divider::after { right: 0; }
.auth-divider span { background: var(--bg); padding: 0 10px; }
.auth-switch { text-align: center; margin-top: 24px; font-size: 13.5px; color: var(--text-muted); }
.auth-switch a { color: var(--text); font-weight: 600; }

.auth-hero-side {
  flex: 1; background: var(--black); display: flex; align-items: center;
  justify-content: center; padding: 60px 48px;
}
.auth-hero-content { max-width: 420px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.12); padding: 5px 14px;
  border-radius: var(--radius-xs); font-size: 12px; font-weight: 600;
  margin-bottom: 24px; color: rgba(255,255,255,.85); letter-spacing: .02em;
}
.auth-hero-content h2 { font-size: clamp(1.8rem,3.5vw,2.8rem); font-weight: 800; line-height: 1.1; margin-bottom: 16px; color: var(--white); letter-spacing: -.05em; }
.auth-hero-content p { font-size: 15px; color: rgba(255,255,255,.6); margin-bottom: 32px; }
.hero-stats { display: flex; gap: 32px; }
.hero-stats .stat { text-align: left; }
.hero-stats span { display: block; font-size: 1.8rem; font-weight: 800; color: var(--white); letter-spacing: -.04em; }
.hero-stats small { font-size: 12px; color: rgba(255,255,255,.5); font-weight: 500; }
.hero-features { list-style: none; padding: 0; }
.hero-features li { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; font-size: 14.5px; color: rgba(255,255,255,.8); }
.hero-features i  { color: var(--white); font-size: 14px; }

/* ── AI Tutor ────────────────────────────────────────────────────── */
.ai-layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
.ai-sidebar .card { padding: 16px; }
.ai-credits-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-subtle); border-radius: var(--radius-sm);
  padding: 12px 14px; margin-bottom: 14px; border: 1px solid var(--border);
}
.ai-credit-val { display: block; font-size: 1.3rem; font-weight: 800; color: var(--text); letter-spacing: -.04em; }
.ai-credits-box small { color: var(--text-muted); font-size: 11.5px; }
.ai-credits-box .btn { margin-left: auto; flex-shrink: 0; }
.ai-mode-select { margin-bottom: 14px; }
.ai-mode-btn {
  width: 100%; text-align: left; padding: 11px 12px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--bg-card); cursor: pointer;
  margin-bottom: 6px; transition: var(--transition); display: flex; gap: 10px; align-items: flex-start;
}
.ai-mode-btn:hover { border-color: var(--black); }
.ai-mode-btn.active { border-color: var(--black); background: var(--bg-subtle); }
.ai-mode-btn span { display: block; font-weight: 600; font-size: 13px; color: var(--text); }
.ai-mode-btn small { display: block; color: var(--text-muted); font-size: 11.5px; margin-top: 1px; }
.ai-mode-btn i { color: var(--text); margin-top: 2px; flex-shrink: 0; }
.ai-history { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
.history-item {
  width: 100%; text-align: left; display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius-sm); border: none;
  background: none; cursor: pointer; font-size: 12.5px; color: var(--text-muted); transition: var(--transition);
}
.history-item:hover { background: var(--bg-subtle); color: var(--text); }
.history-item span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item small { flex-shrink: 0; }

.ai-chat-card { padding: 0; overflow: hidden; }
.ai-panel { display: none; } .ai-panel.active { display: block; }
.ai-situation-picker { padding: 14px 18px; border-bottom: 1px solid var(--border); }
.situation-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  padding: 5px 12px; border-radius: var(--radius-xs); border: 1.5px solid var(--border);
  background: var(--bg-card); font-size: 12.5px; cursor: pointer; transition: var(--transition); font-weight: 500;
}
.chip:hover  { border-color: var(--black); }
.chip.active { border-color: var(--black); background: var(--black); color: var(--white); }
[data-theme="dark"] .chip.active { background: var(--white); color: var(--black); border-color: var(--white); }

.chat-messages { height: 360px; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.chat-welcome { display: flex; align-items: flex-start; gap: 12px; background: var(--bg-subtle); border-radius: var(--radius-sm); padding: 14px; font-size: 13.5px; }
.ai-avatar { width: 32px; height: 32px; background: var(--black); color: var(--white); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 14px; }
[data-theme="dark"] .ai-avatar { background: var(--white); color: var(--black); }
.chat-msg { display: flex; }
.chat-msg--user { justify-content: flex-end; }
.chat-msg--ai   { justify-content: flex-start; }
.chat-msg--correction, .chat-msg--error { justify-content: center; }
.msg-bubble { max-width: 72%; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13.5px; line-height: 1.5; }
.chat-msg--user .msg-bubble { background: var(--black); color: var(--white); border-radius: 14px 14px 4px 14px; }
[data-theme="dark"] .chat-msg--user .msg-bubble { background: var(--white); color: var(--black); }
.chat-msg--ai .msg-bubble   { background: var(--bg-subtle); color: var(--text); border: 1px solid var(--border); border-radius: 4px 14px 14px 14px; }
.msg-correction { background: #fefce8; color: #713f12; border: 1px solid #fde68a; padding: 6px 14px; border-radius: var(--radius-xs); font-size: 12.5px; }
.msg-error { background: #fef2f2; color: #7f1d1d; border: 1px solid #fecaca; padding: 8px 14px; border-radius: var(--radius-xs); font-size: 13px; }
.chat-input-area { border-top: 1px solid var(--border); padding: 14px 18px; }
.chat-input-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-input-row textarea { flex: 1; resize: none; border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; }
.chat-btns { display: flex; gap: 6px; }
.btn-send { min-width: 42px; height: 42px; padding: 0 14px; border-radius: var(--radius-sm); }
.btn-mic--active { background: #fee2e2 !important; color: var(--danger) !important; border-color: #fecaca !important; }
.chat-hint { font-size: 11px; color: var(--text-light); margin-top: 6px; }
.correction-area, .lesson-area { padding: 24px; }
.correction-area h3, .lesson-area h3 { margin-bottom: 8px; }
.correction-area p, .lesson-area p { margin-bottom: 16px; font-size: 14px; }
.correction-area textarea { margin-bottom: 12px; height: 110px; }
.correction-result { margin-top: 16px; }
.correction-box { background: var(--bg-subtle); border-radius: var(--radius-sm); padding: 16px; font-size: 13.5px; border: 1px solid var(--border); }
.correction-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: flex-start; }
.correction-row .label { font-weight: 600; min-width: 80px; flex-shrink: 0; }
.corrected { color: var(--success); font-weight: 500; }
.original  { color: var(--text-muted); text-decoration: line-through; }
.lesson-controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.lesson-controls .form-select { flex: 1; min-width: 180px; }
.lesson-content { margin-top: 16px; background: var(--bg-subtle); border-radius: var(--radius-sm); padding: 20px; font-size: 14px; border: 1px solid var(--border); }
.lesson-content h3 { margin-bottom: 8px; }
.lesson-content ul { padding-left: 20px; margin: 8px 0; }
.lesson-content li { margin-bottom: 4px; color: var(--text-muted); }
.lesson-loading { text-align: center; padding: 40px; color: var(--text-muted); }
.text-error { color: var(--danger); }

/* ── Payment ─────────────────────────────────────────────────────── */
.topup-grid { display: grid; grid-template-columns: 1fr 340px; gap: 28px; align-items: start; }
.section-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 16px; letter-spacing: -.02em; }
.tier-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 12px; }
.tier-card {
  position: relative; background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 24px 18px; cursor: pointer;
  text-align: center; transition: var(--transition); width: 100%; font-family: inherit;
}
.tier-card:hover { border-color: var(--black); }
.tier-card--featured { border-color: var(--black); border-width: 2px; }
.tier-badge {
  position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
  background: var(--black); color: var(--white);
  font-size: 10px; font-weight: 700; padding: 3px 12px; border-radius: var(--radius-xs); white-space: nowrap;
}
[data-theme="dark"] .tier-badge { background: var(--white); color: var(--black); }
.tier-icon { font-size: 1.6rem; margin-bottom: 8px; color: var(--text); }
.tier-credits { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 4px; letter-spacing: -.02em; }
.tier-price { font-size: 2rem; font-weight: 800; color: var(--text); margin-bottom: 6px; letter-spacing: -.05em; }
.tier-rate { font-size: 11.5px; color: var(--text-muted); margin-bottom: 16px; }
.tier-btn { width: 100%; justify-content: center; pointer-events: none; font-size: 13px; }
.payment-note { color: var(--text-muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.credits-info { margin-top: 24px; }
.credits-info h3 { margin-bottom: 14px; }
.credits-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.credits-info-grid div { display: flex; align-items: center; gap: 10px; font-size: 13.5px; background: var(--bg-subtle); padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); color: var(--text-muted); }
.credits-info-grid i { color: var(--text); font-size: 15px; }

/* ── Profile ─────────────────────────────────────────────────────── */
.profile-grid { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
.profile-summary { text-align: center; }
.profile-avatar { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; margin: 0 auto 14px; border: 2px solid var(--border); }
.profile-avatar-initials {
  width: 80px; height: 80px; border-radius: 50%; background: var(--black); color: var(--white);
  font-size: 1.8rem; font-weight: 800; display: flex; align-items: center; justify-content: center; margin: 0 auto 14px;
}
[data-theme="dark"] .profile-avatar-initials { background: var(--white); color: var(--black); }
.profile-summary h2 { margin-bottom: 4px; font-size: 1.1rem; }
.profile-summary p { font-size: 13px; }
.profile-badges { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin: 10px 0; }
.profile-joined { font-size: 12px; color: var(--text-light); margin-top: 8px; }

/* ── Tests ───────────────────────────────────────────────────────── */
.test-cards { display: grid; grid-template-columns: repeat(auto-fill,minmax(300px,1fr)); gap: 16px; }
.test-card {
  background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 22px; transition: var(--transition);
  display: flex; flex-direction: column; gap: 12px;
}
.test-card:hover { border-color: var(--black); }
.test-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.test-card h3 { font-size: 1rem; font-weight: 700; color: var(--text); flex: 1; }
.test-meta { display: flex; gap: 12px; font-size: 12.5px; color: var(--text-muted); flex-wrap: wrap; }
.test-meta span { display: flex; align-items: center; gap: 5px; }
.test-status-active  { color: var(--success); font-weight: 600; }
.test-status-waiting { color: var(--warning); font-weight: 600; }
.test-status-closed  { color: var(--text-muted); font-weight: 600; }

/* Result breakdown */
.result-breakdown { display: flex; flex-direction: column; gap: 4px; }
.result-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); align-items: center; font-size: 13.5px; }
.result-row:last-child { border-bottom: none; }
.result-q { color: var(--text); }
.result-correct   { color: var(--success); font-weight: 600; }
.result-incorrect { color: var(--danger);  font-weight: 600; }

/* Score circle */
.score-ring-wrap { text-align: center; padding: 24px 0; }
.score-ring {
  width: 110px; height: 110px; border-radius: 50%; margin: 0 auto 12px;
  border: 6px solid var(--black);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.score-ring--pass { border-color: var(--success); }
.score-ring--fail { border-color: var(--danger); }
.score-ring .pct   { font-size: 1.6rem; font-weight: 800; color: var(--text); letter-spacing: -.04em; }
.score-ring .grade { font-size: 11px; color: var(--text-muted); font-weight: 600; }

/* Redeem */
.redeem-layout { display: grid; grid-template-columns: 1fr 360px; gap: 20px; align-items: start; }
.redeem-balance { display: flex; align-items: center; gap: 12px; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 20px; }
.redeem-balance-val { display: block; font-size: 1.35rem; font-weight: 800; color: var(--text); letter-spacing: -.04em; }
.redeem-balance small { color: var(--text-muted); font-size: 12px; }
.redeem-balance .btn { margin-left: auto; }
.redeem-input-wrap { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.redeem-code-input { flex:1; font-family: var(--font-mono); font-size: 1rem; letter-spacing: 2px; text-transform: uppercase; padding: 13px 14px !important; }
.redeem-how { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }
.redeem-how h3 { margin-bottom: 12px; font-size: .95rem; }
.redeem-sources { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.redeem-source { display: flex; align-items: center; gap: 10px; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 12px; font-size: 13px; color: var(--text-muted); }
.redeem-source i { color: var(--text); font-size: 14px; }

/* Oral exam */
.oral-how { display:flex; align-items:center; gap:16px; border:1px solid var(--border); border-radius:var(--radius); padding:22px; flex-wrap:wrap; margin-bottom:8px; }
.oral-step { display:flex; align-items:center; gap:12px; }
.step-num { width:34px; height:34px; background:var(--black); color:var(--white); border-radius:50%; display:flex; align-items:center; justify-content:center; font-weight:800; font-size:15px; flex-shrink:0; }
[data-theme="dark"] .step-num { background:var(--white); color:var(--black); }
.oral-arrow { color:var(--text-light); font-size:18px; }
.level-cards { display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:14px; }
.level-card { position:relative; background:var(--bg-card); border:1.5px solid var(--border); border-radius:var(--radius); padding:22px; text-align:center; transition:var(--transition); }
.level-card:hover { border-color:var(--black); }
.level-card--current { border-color:var(--black); border-width:2px; }
.level-card--locked  { opacity:.55; pointer-events:none; }
.level-ribbon { position:absolute; top:-11px; left:50%; transform:translateX(-50%); background:var(--black); color:var(--white); font-size:10px; font-weight:700; padding:3px 12px; border-radius:var(--radius-xs); white-space:nowrap; }
[data-theme="dark"] .level-ribbon { background:var(--white); color:var(--black); }
.level-badge { width:52px; height:52px; border-radius:var(--radius-sm); margin:0 auto 12px; display:flex; align-items:center; justify-content:center; font-size:1.2rem; font-weight:900; color:var(--white); }
.level-badge--a1{background:#16a34a;} .level-badge--a2{background:#65a30d;} .level-badge--b1{background:#2563eb;} .level-badge--b2{background:#7c3aed;} .level-badge--c1{background:#d97706;} .level-badge--c2{background:#dc2626;}
.level-meta { display:flex; flex-direction:column; gap:3px; margin:10px 0 14px; font-size:12.5px; color:var(--text-muted); }
.level-meta span { display:flex; align-items:center; justify-content:center; gap:5px; }
.level-locked-msg { color:var(--text-muted); font-size:13px; }

.exam-wrapper { max-width:740px; margin:0 auto; }
.exam-screen { display:none; } .exam-screen.active { display:block; }
.exam-start-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:40px; text-align:center; max-width:500px; margin:0 auto; }
.exam-level-badge { display:inline-block; background:var(--black); color:var(--white); font-size:1.8rem; font-weight:900; width:68px; height:68px; border-radius:var(--radius-sm); line-height:68px; margin-bottom:20px; letter-spacing:-.03em; }
[data-theme="dark"] .exam-level-badge { background:var(--white); color:var(--black); }
.exam-tips-list { list-style:none; text-align:left; background:var(--bg-subtle); border:1px solid var(--border); border-radius:var(--radius-sm); padding:16px 18px; margin:20px 0 28px; }
.exam-tips-list li { display:flex; align-items:center; gap:10px; margin-bottom:9px; font-size:13.5px; color:var(--text-muted); }
.exam-tips-list i { color:var(--text); }
.exam-loading { text-align:center; padding:60px 20px; }
.loading-spinner { width:44px; height:44px; border:3px solid var(--border); border-top-color:var(--black); border-radius:50%; animation:spin .7s linear infinite; margin:0 auto 20px; }
[data-theme="dark"] .loading-spinner { border-top-color:var(--white); }
@keyframes spin{to{transform:rotate(360deg);}}
.exam-progress-bar { height:3px; background:var(--border); border-radius:2px; margin-bottom:22px; }
.exam-progress-fill { height:100%; background:var(--black); border-radius:2px; transition:.4s; }
[data-theme="dark"] .exam-progress-fill { background:var(--white); }
.exam-q-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; }
.q-counter { font-weight:600; color:var(--text-muted); font-size:13px; }
.q-timer { font-size:13.5px; font-weight:700; color:var(--text); }
.exam-question-card { background:var(--bg-subtle); border:1.5px solid var(--border); border-radius:var(--radius); padding:28px; text-align:center; margin-bottom:20px; }
.q-icon { font-size:1.8rem; color:var(--text); margin-bottom:12px; }
.exam-question-text { font-size:1.2rem; font-weight:600; color:var(--text); margin:0; line-height:1.5; }
.exam-answer-area { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; }
.answer-mode-tabs { display:flex; border-bottom:1px solid var(--border); }
.tab-btn { flex:1; padding:11px; border:none; background:none; cursor:pointer; font-size:13.5px; font-weight:600; color:var(--text-muted); transition:var(--transition); display:flex; align-items:center; justify-content:center; gap:7px; }
.tab-btn:hover { background:var(--bg-subtle); }
.tab-btn.active { color:var(--text); border-bottom:2px solid var(--black); }
[data-theme="dark"] .tab-btn.active { border-bottom-color:var(--white); }
.answer-mode { padding:24px; }
.voice-record-area { text-align:center; }
.record-btn { width:72px; height:72px; border-radius:50%; border:none; background:var(--black); color:var(--white); font-size:1.6rem; cursor:pointer; transition:var(--transition); margin-bottom:12px; }
[data-theme="dark"] .record-btn { background:var(--white); color:var(--black); }
.record-btn:hover { transform:scale(1.04); }
.record-btn.recording { background:#dc2626; }
@keyframes pulse{0%,100%{box-shadow:0 0 0 0 rgba(220,38,38,.3)}50%{box-shadow:0 0 0 14px rgba(220,38,38,0)}}
#recordStatus { color:var(--text-muted); font-size:13.5px; margin:8px 0; }
.transcript-preview { font-size:13.5px; margin-top:8px; min-height:20px; color:var(--text); font-style:italic; }
.voice-waves { display:flex; align-items:center; justify-content:center; gap:4px; height:28px; margin:8px 0; }
.voice-waves span { width:3px; background:var(--black); border-radius:2px; height:6px; opacity:.2; }
[data-theme="dark"] .voice-waves span { background:var(--white); }
.voice-waves.active span { opacity:1; animation:wave .8s ease-in-out infinite; }
.voice-waves.active span:nth-child(2){animation-delay:.12s;} .voice-waves.active span:nth-child(3){animation-delay:.24s;} .voice-waves.active span:nth-child(4){animation-delay:.36s;} .voice-waves.active span:nth-child(5){animation-delay:.48s;}
@keyframes wave{0%,100%{height:6px}50%{height:26px}}
.answer-actions { display:flex; justify-content:space-between; padding:14px 20px; border-top:1px solid var(--border); }
.result-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:32px; text-align:center; }
.result-score-circle { width:110px; height:110px; border-radius:50%; margin:0 auto; border:5px solid var(--black); display:flex; flex-direction:column; align-items:center; justify-content:center; }
.score-pct { font-size:1.5rem; font-weight:900; color:var(--text); letter-spacing:-.04em; }
.score-grade { font-size:11.5px; color:var(--text-muted); font-weight:600; }
.result-stat-row { display:flex; justify-content:center; gap:32px; margin:18px 0; }
.result-stat span { display:block; font-size:1.5rem; font-weight:800; color:var(--text); letter-spacing:-.04em; }
.result-stat small { color:var(--text-muted); font-size:12px; }
.result-answers { text-align:left; margin:22px 0; display:flex; flex-direction:column; gap:10px; }
.result-answer-card { background:var(--bg-subtle); border-radius:var(--radius-sm); padding:16px; border:1px solid var(--border); }
.ra-header { display:flex; justify-content:space-between; margin-bottom:6px; }
.ra-q { font-weight:700; font-size:13px; color:var(--text); }
.ra-score { font-weight:700; font-size:13px; }
.ra-question { font-weight:600; color:var(--text); margin-bottom:8px; font-size:13.5px; }
.ra-answers { font-size:12.5px; display:flex; flex-direction:column; gap:4px; }
.ra-row { display:flex; gap:8px; }
.ra-label { font-weight:600; min-width:86px; flex-shrink:0; color:var(--text-muted); }
.ra-errors { color:#92400e; } .ra-corrected { color:#166534; }
.result-tips { background:var(--bg-subtle); border:1px solid var(--border); border-radius:var(--radius-sm); padding:16px; text-align:left; margin:16px 0; }
.result-tips h3 { margin-bottom:10px; font-size:.95rem; }
.result-tips ul { list-style:none; display:flex; flex-direction:column; gap:6px; }
.result-tips li { display:flex; align-items:flex-start; gap:8px; font-size:13.5px; color:var(--text-muted); }
.result-tips i { color:var(--text); margin-top:2px; }
.result-actions { display:flex; gap:10px; justify-content:center; flex-wrap:wrap; margin-top:24px; }
.result-overview-grid { display:grid; grid-template-columns:260px 1fr; gap:20px; align-items:start; }
.result-score-card { display:flex; flex-direction:column; align-items:center; text-align:center; }
.tips-list { list-style:none; display:flex; flex-direction:column; gap:10px; }
.tips-list li { display:flex; gap:10px; font-size:13.5px; align-items:flex-start; color:var(--text-muted); }
.tips-list i { color:var(--text); margin-top:2px; flex-shrink:0; }
.answers-breakdown { display:flex; flex-direction:column; gap:14px; }
.answer-breakdown-card { background:var(--bg-subtle); border-radius:var(--radius-sm); padding:16px; border:1px solid var(--border); }
.ab-header { display:flex; justify-content:space-between; margin-bottom:10px; align-items:center; }
.ab-num { background:var(--black); color:var(--white); width:26px; height:26px; border-radius:var(--radius-xs); display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; }
[data-theme="dark"] .ab-num { background:var(--white); color:var(--black); }
.ab-score { font-weight:700; font-size:14px; }
.ab-question { font-size:13.5px; color:var(--text); margin-bottom:10px; }
.ab-grid { display:flex; flex-direction:column; gap:5px; }
.ab-row { display:flex; gap:10px; font-size:13px; }
.ab-label { font-weight:600; min-width:96px; flex-shrink:0; color:var(--text-muted); }
.ab-error .ab-label,.ab-error span{color:#92400e;} .ab-corrected .ab-label{color:#166534;} .ab-corrected span{color:#166534;font-weight:500;}
.mini-bar { width:56px; height:6px; background:var(--border); border-radius:3px; overflow:hidden; flex-shrink:0; }
.mini-bar-fill { height:100%; border-radius:3px; transition:.3s; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .topup-grid { grid-template-columns: 1fr; }
  .ai-layout   { grid-template-columns: 220px 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  .profile-summary { grid-row: auto; }
  .result-overview-grid { grid-template-columns:1fr; }
}
@media (max-width: 768px) {
  .auth-form-side { flex: 0 0 100%; }
  .auth-hero-side { display: none; }
  .main-nav { display: none; position: fixed; top: var(--header-h); left: 0; right: 0;
              background: var(--bg-card); border-bottom: 1px solid var(--border);
              flex-direction: column; padding: 10px; z-index: 99; }
  .main-nav.open { display: flex; }
  .mobile-menu-btn { display: flex; }
  .ai-layout { grid-template-columns: 1fr; }
  .tier-cards { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-actions { grid-template-columns: repeat(4, 1fr); }
  .course-card-full { flex-direction: column; }
  .course-card-full .course-thumb { width: 100%; height: 140px; }
  .redeem-layout { grid-template-columns: 1fr; }
  .level-cards { grid-template-columns: repeat(2, 1fr); }
  .oral-how { flex-direction: column; }
  .oral-arrow { transform: rotate(90deg); }
}
@media (max-width: 540px) {
  h1 { letter-spacing: -.03em; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .quick-actions { grid-template-columns: repeat(4, 1fr); }
  .hero-greeting { flex-direction: column; align-items: flex-start; }
  .tier-cards { grid-template-columns: 1fr; }
  .redeem-input-wrap { flex-direction: column; }
  .redeem-input-wrap .btn { width: 100%; justify-content: center; }
}

/* ============================================================
   Mobile Bottom Navigation — shown on ≤768px (WebView/App)
   ============================================================ */
.mob-nav {
  display: none;
}

@media (max-width: 768px) {
  /* Show bottom nav */
  .mob-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 66px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    z-index: 150;
    align-items: stretch;
    box-shadow: 0 -4px 20px rgba(0,0,0,.08);
    /* Safe area for iPhone notch */
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  /* Push page content above the bottom nav */
  .main-content,
  .page-body,
  .container.section { padding-bottom: 80px; }

  /* Hide top main-nav on mobile (replaced by bottom nav) */
  .main-nav { display: none !important; }
  .mobile-menu-btn { display: none !important; }

  /* Hide site footer on mobile (redundant with bottom nav) */
  .site-footer { display: none; }

  .mob-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none !important;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .02em;
    padding: 8px 4px 4px;
    transition: color .15s;
    -webkit-tap-highlight-color: transparent;
  }
  .mob-nav-item i { font-size: 20px; transition: transform .15s; }
  .mob-nav-item span { display: block; line-height: 1; }
  .mob-nav-item:hover,
  .mob-nav-active { color: var(--text) !important; }
  .mob-nav-active i { transform: scale(1.1); }

  /* Center "Speak" button — raised circle */
  .mob-nav-center {
    position: relative;
    top: -14px;
    flex-shrink: 0;
    width: 68px;
  }
  .mob-nav-center-btn {
    width: 54px; height: 54px;
    border-radius: 50%;
    background: var(--black);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 14px rgba(0,0,0,.25);
    margin-bottom: 4px;
    transition: transform .15s, opacity .15s;
  }
  .mob-nav-center:hover .mob-nav-center-btn,
  .mob-nav-active .mob-nav-center-btn { transform: scale(1.06); opacity: .9; }
  [data-theme="dark"] .mob-nav-center-btn { background: var(--white); color: var(--black); }

  /* Exam body: never show bottom nav or topbar during a test */
  .exam-body .mob-nav    { display: none !important; }
  .exam-body .mob-topbar { display: none !important; }
  .exam-body { padding-top: 0 !important; }
}

/* ============================================================
   Gradient hero variants for new feature pages
   ============================================================ */
.page-hero--gradient-dark {
  background: linear-gradient(135deg, #0f0f0f 0%, #1a1a2e 60%, #16213e 100%);
  color: var(--white);
  border-bottom: none;
}
.page-hero--gradient-green {
  background: linear-gradient(135deg, #0d1b2a 0%, #1b4332 100%);
  color: var(--white);
  border-bottom: none;
}
.page-hero--gradient-dark h1,
.page-hero--gradient-green h1 { color: var(--white); }
.page-hero--gradient-dark p,
.page-hero--gradient-green p  { color: rgba(255,255,255,.65); }

/* ============================================================
   Accent color tokens (secondary — purple / indigo tones)
   Used in badge chips, highlights, etc. without breaking the
   existing black/white design language.
   ============================================================ */
:root {
  --purple:        #7c3aed;
  --purple-light:  #ede9fe;
  --indigo:        #4f46e5;
  --indigo-light:  #e0e7ff;
  --teal:          #0d9488;
  --teal-light:    #ccfbf1;
  --amber:         #d97706;
  --amber-light:   #fef3c7;
}

.badge--purple { background: var(--purple-light); color: var(--purple); }
.badge--indigo { background: var(--indigo-light); color: var(--indigo); }
.badge--teal   { background: var(--teal-light);   color: var(--teal); }
.badge--amber  { background: var(--amber-light);   color: var(--amber); }

/* Feature card with gradient accent border */
.card--accent-purple { border-left: 4px solid var(--purple); }
.card--accent-teal   { border-left: 4px solid var(--teal); }
.card--accent-amber  { border-left: 4px solid var(--amber); }

/* ============================================================
   WebView / hybrid app refinements
   ============================================================ */
/* Prevent text selection on UI elements (feels more native) */
button, .nav-link, .mob-nav-item, .btn, .lang-tab, .mode-tab {
  -webkit-user-select: none;
  user-select: none;
}
/* Smooth momentum scrolling on iOS */
.table-wrap,
.passage-body,
.passage-ref-body {
  -webkit-overflow-scrolling: touch;
}
/* Tap highlight removed for cleaner tap feedback */
a, button { -webkit-tap-highlight-color: transparent; }
/* Remove 300ms tap delay on mobile */
html { touch-action: manipulation; }
/* Safe area padding for bottom elements on iPhone notch models */
.exam-feedback { padding-bottom: calc(20px + env(safe-area-inset-bottom, 0)); }
.mob-nav { padding-bottom: env(safe-area-inset-bottom, 0); }
