/* ═══════════════════════════════════════════════════════
   AmeriSpeak — Premium Design System
   Inspired by Linear, Vercel, Stripe
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,500;0,600;0,700;1,500&family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

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

/* ── DARK (default) ──────────────────────────────── */
:root {
  --bg:       #07080c;
  --bg2:      #0d0f18;
  --bg3:      #131626;
  --bg4:      #1b1f33;
  --bg5:      #242840;

  --border:   rgba(255,255,255,0.055);
  --border2:  rgba(255,255,255,0.10);
  --border3:  rgba(255,255,255,0.18);

  --text:     #eef0f8;
  --text2:    #8892b0;
  --text3:    #4a5272;
  --text4:    #282d47;

  --accent:   #5b8dee;
  --accentD:  rgba(91,141,238,0.10);
  --accentB:  rgba(91,141,238,0.20);
  --accent2:  #8b6cf7;
  --gold:     #c9a96e;
  --goldD:    rgba(201,169,110,0.10);
  --green:    #4ade9a;
  --greenD:   rgba(74,222,154,0.10);
  --red:      #f06b6b;
  --redD:     rgba(240,107,107,0.10);
  --amber:    #e8b84b;
  --amberD:   rgba(232,184,75,0.10);

  --r-xs: 4px;
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 18px;
  --r-xl: 24px;

  --shadow-sm: 0 1px 4px rgba(0,0,0,0.5);
  --shadow:    0 4px 20px rgba(0,0,0,0.55), 0 1px 4px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.65), 0 4px 16px rgba(0,0,0,0.4);
  --glow:      0 0 0 1px rgba(91,141,238,0.3), 0 4px 24px rgba(91,141,238,0.15);
  --glow-gold: 0 0 0 1px rgba(201,169,110,0.3), 0 4px 24px rgba(201,169,110,0.12);

  --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font:       'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:  'DM Mono', 'Fira Code', 'Courier New', monospace;

  --nav-h: 62px;
  --sidebar-w: 300px;
}

/* ── LIGHT ───────────────────────────────────────── */
body.light {
  --bg:      #f8f9fc;
  --bg2:     #ffffff;
  --bg3:     #f0f2f8;
  --bg4:     #e4e7f2;
  --bg5:     #d8dcee;
  --border:  rgba(0,0,0,0.06);
  --border2: rgba(0,0,0,0.10);
  --border3: rgba(0,0,0,0.18);
  --text:    #0e1024;
  --text2:   #404568;
  --text3:   #8890b4;
  --text4:   #c4c9df;
  --accent:  #2563eb;
  --accentD: rgba(37,99,235,0.07);
  --accentB: rgba(37,99,235,0.14);
  --accent2: #6d28d9;
  --gold:    #92620a;
  --goldD:   rgba(146,98,10,0.07);
  --green:   #15803d;
  --greenD:  rgba(21,128,61,0.08);
  --red:     #dc2626;
  --redD:    rgba(220,38,38,0.07);
  --amber:   #b45309;
  --amberD:  rgba(180,83,9,0.08);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
  --shadow:    0 4px 20px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.12), 0 4px 16px rgba(0,0,0,0.06);
  --glow:      0 0 0 1px rgba(37,99,235,0.2), 0 4px 24px rgba(37,99,235,0.10);
}

/* ── Base ────────────────────────────────────────── */
html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 400;
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.3s, color 0.3s;
}

/* Ambient background glow */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 45% at 15% -5%, rgba(91,141,238,0.055) 0%, transparent 65%),
    radial-gradient(ellipse 55% 40% at 85% 105%, rgba(139,108,247,0.045) 0%, transparent 65%);
}
body > * { position: relative; z-index: 1; }

/* ── Navigation ──────────────────────────────────── */
nav {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--nav-h);
  background: rgba(7,8,12,0.88);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 2.5rem;
  gap: 0;
}
body.light nav { background: rgba(248,249,252,0.92); }

.nav-logo {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  margin-right: 2.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  letter-spacing: 0.01em;
}
.logo-mark {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif);
  font-size: 15px; font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(91,141,238,0.4);
}
.logo-text em { font-style: normal; color: var(--accent); }

.nav-links { display: flex; gap: 2px; flex: 1; }
.nav-links a {
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text2);
  padding: 6px 13px;
  border-radius: 7px;
  transition: color 0.14s, background 0.14s;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.nav-links a svg { width: 14px; height: 14px; fill: currentColor; opacity: 0.6; flex-shrink: 0; }
.nav-links a:hover { color: var(--text); background: var(--bg3); }
.nav-links a:hover svg { opacity: 1; }
.nav-links a.active { color: var(--text); background: var(--bg3); }
.nav-links a.active svg { opacity: 1; fill: var(--accent); color: var(--accent); }

.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.nav-stat {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--text2);
}
.nav-stat svg { width: 11px; height: 11px; fill: currentColor; flex-shrink: 0; }
.nav-stat.streak { color: var(--amber); border-color: var(--amberD); background: var(--amberD); }
.nav-stat.xp     { color: var(--accent); border-color: var(--accentD); background: var(--accentD); }

.theme-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--text2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.18s;
  flex-shrink: 0;
}
.theme-btn:hover { background: var(--bg4); color: var(--text); border-color: var(--border3); }
.theme-btn svg { width: 15px; height: 15px; fill: currentColor; }

/* User menu */
.nav-user-menu { position: relative; }
.nav-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-size: 13px; font-weight: 700;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font);
  transition: box-shadow 0.15s;
}
.nav-avatar:hover { box-shadow: var(--glow); }
.user-dd {
  display: none;
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  min-width: 180px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 300;
}
.user-dd.open { display: block; }
.dd-name {
  padding: 12px 16px 8px;
  font-size: 13px; font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.user-dd a {
  display: block;
  padding: 9px 16px;
  font-size: 13px;
  color: var(--text2);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.user-dd a:hover { background: var(--bg3); color: var(--text); }
.dd-logout { color: var(--red) !important; border-top: 1px solid var(--border); }

/* ── Layout ──────────────────────────────────────── */
.page-with-ads {
  max-width: 1260px;
  margin: 0 auto;
  padding: 3rem 2.5rem 5rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  align-items: start;
}
@media (min-width: 815px) {
  .page-with-ads:has(.ads-col) {
    grid-template-columns: 1fr var(--sidebar-w);
  }
}
.content-col { min-width: 0; }
.ads-col {
  position: sticky;
  top: calc(var(--nav-h) + 20px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.page    { max-width: 1140px; margin: 0 auto; padding: 3rem 2.5rem 5rem; }
.page-sm { max-width: 840px;  margin: 0 auto; padding: 3rem 2.5rem 5rem; }
.page-xs { max-width: 520px;  margin: 0 auto; padding: 3rem 2rem 5rem; }

/* ── Typography ──────────────────────────────────── */
.page-title {
  font-family: var(--font-serif);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 10px;
}
.page-subtitle {
  font-size: 15.5px;
  font-weight: 400;
  color: var(--text2);
  line-height: 1.65;
  margin-bottom: 2.5rem;
  max-width: 580px;
}
.section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text3);
  margin-bottom: 8px;
}
.section-title {
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

/* ── Cards ───────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}
/* Top shimmer line */
.card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.07) 50%, transparent 100%);
  pointer-events: none;
}
body.light .card::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,0.9), transparent); }

.card-sm { padding: 1.1rem 1.25rem; }

.card-lift {
  transition: transform 0.22s cubic-bezier(.2,.8,.3,1), box-shadow 0.22s, border-color 0.22s;
  cursor: pointer;
  text-decoration: none;
  display: block;
}
.card-lift:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--border2);
}

.card-accent {
  border-color: rgba(91,141,238,0.22);
  background: linear-gradient(145deg, var(--bg2), rgba(91,141,238,0.03));
}
.card-gold {
  border-color: rgba(201,169,110,0.2);
  background: linear-gradient(145deg, var(--bg2), rgba(201,169,110,0.025));
}

/* Card icon wrapper */
.card-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
  flex-shrink: 0;
}
.card-icon.blue   { background: var(--accentD); border: 1px solid var(--accentB); }
.card-icon.purple { background: rgba(139,108,247,0.1); border: 1px solid rgba(139,108,247,0.2); }
.card-icon.gold   { background: var(--goldD); border: 1px solid rgba(201,169,110,0.2); }
.card-icon.green  { background: var(--greenD); border: 1px solid rgba(74,222,154,0.18); }
.card-icon svg    { width: 20px; height: 20px; fill: currentColor; }

/* ── Word cards ──────────────────────────────────── */
.word-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.word-card:hover { border-color: var(--border2); box-shadow: var(--shadow-sm); }
/* Color bar on top */
.word-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  opacity: 0;
  transition: opacity 0.2s;
}
.word-card:hover::before { opacity: 1; }

.wc-cat   { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text3); margin-bottom: 10px; }
.wc-word  { font-family: var(--font-serif); font-size: 30px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; line-height: 1.15; margin-bottom: 5px; }
.wc-ph    { font-family: var(--font-mono); font-size: 12px; color: var(--text3); margin-bottom: 10px; }
.wc-pos   { font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 9px; border-radius: var(--r-xs); display: inline-block; margin-bottom: 14px; }
.wc-def   { font-size: 14.5px; color: var(--text2); line-height: 1.65; margin-bottom: 14px; }
.wc-sent  {
  font-size: 13.5px; color: var(--text);
  background: var(--bg3);
  padding: 12px 16px;
  border-radius: var(--r-sm);
  border-left: 2px solid var(--accent);
  line-height: 1.6;
  margin-bottom: 14px;
  font-style: italic;
}
.wc-tip-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text3); margin-bottom: 4px; }
.wc-tip   { font-size: 13px; color: var(--text2); line-height: 1.6; }

/* ── Badges ──────────────────────────────────────── */
.badge {
  font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.06em;
  padding: 2px 9px;
  border-radius: var(--r-xs);
  text-transform: uppercase;
  display: inline-block;
  line-height: 1.6;
}
.badge-blue   { background: var(--accentD); color: var(--accent); }
.badge-green  { background: var(--greenD);  color: var(--green); }
.badge-amber  { background: var(--amberD);  color: var(--amber); }
.badge-purple { background: rgba(139,108,247,0.12); color: var(--accent2); }
.badge-red    { background: var(--redD);    color: var(--red); }
.badge-gold   { background: var(--goldD);   color: var(--gold); }

/* ── Buttons ─────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 20px;
  border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 500;
  font-family: var(--font);
  letter-spacing: 0.01em;
  cursor: pointer; border: none;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.18s cubic-bezier(.2,.8,.3,1);
}
.btn svg { width: 14px; height: 14px; fill: currentColor; flex-shrink: 0; }
.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 1px 4px rgba(91,141,238,0.35), inset 0 1px 0 rgba(255,255,255,0.12);
}
.btn-primary:hover { background: #4a7fe0; box-shadow: var(--glow); transform: translateY(-1px); }
.btn-ghost {
  background: var(--bg3); color: var(--text2);
  border: 1px solid var(--border2);
}
.btn-ghost:hover { background: var(--bg4); color: var(--text); border-color: var(--border3); }
.btn-gold {
  background: var(--goldD); color: var(--gold);
  border: 1px solid rgba(201,169,110,0.22);
}
.btn-gold:hover { background: rgba(201,169,110,0.18); box-shadow: var(--glow-gold); }
.btn-danger { background: var(--redD); color: var(--red); border: 1px solid rgba(240,107,107,0.22); }
.btn-danger:hover { background: rgba(240,107,107,0.18); }
.btn-full { width: 100%; justify-content: center; padding: 12px 20px; font-size: 14px; }
.btn-sm { padding: 5px 13px; font-size: 12.5px; }

/* ── Speak button ────────────────────────────────── */
.speak-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border2);
  background: var(--bg3); color: var(--text2);
  font-size: 12px; font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.speak-btn svg { width: 12px; height: 12px; fill: currentColor; flex-shrink: 0; }
.speak-btn:hover { background: var(--accentD); color: var(--accent); border-color: var(--accentB); }
.speak-btn.speaking { background: var(--accentD); color: var(--accent); border-color: var(--accentB); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.65} }

/* ── Progress ────────────────────────────────────── */
.progress-track { height: 4px; background: var(--bg4); border-radius: 2px; overflow: hidden; }
.progress-fill  { height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width 0.5s cubic-bezier(.4,0,.2,1); }

/* ── Stats row ───────────────────────────────────── */
.stats-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 2.5rem; }
.stat-box {
  flex: 1; min-width: 100px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.25rem 1.5rem;
  position: relative; overflow: hidden;
}
.stat-box::before {
  content: '';
  position: absolute; bottom: 0; left: 0; width: 100%; height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0.35;
}
.stat-n { font-family: var(--font-serif); font-size: 30px; font-weight: 600; color: var(--text); line-height: 1; margin-bottom: 5px; }
.stat-l { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.09em; }

/* ── Category tabs ───────────────────────────────── */
.cat-tabs { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 1.5rem; }
.cat-tab {
  padding: 5px 14px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--border2);
  color: var(--text2); cursor: pointer;
  background: var(--bg2);
  transition: all 0.14s;
  font-family: var(--font);
}
.cat-tab:hover { color: var(--text); background: var(--bg3); border-color: var(--border3); }
.cat-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 2px 10px rgba(91,141,238,0.3); }

/* ── Voice bar ───────────────────────────────────── */
.voice-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 1.5rem;
  font-size: 12.5px; color: var(--text2);
}
.voice-bar svg { width: 14px; height: 14px; fill: var(--accent); flex-shrink: 0; }
.voice-bar select, .voice-bar input[type=range] {
  background: var(--bg3); border: 1px solid var(--border2);
  color: var(--text); border-radius: var(--r-sm);
  padding: 4px 8px; font-size: 12.5px;
  font-family: var(--font);
}
.voice-bar input[type=range] { width: 80px; padding: 0; accent-color: var(--accent); }

/* ── Forms ───────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--text2); }
.req { color: var(--red); }
.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  padding: 10px 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91,141,238,0.12);
}
.form-group textarea { resize: vertical; min-height: 80px; line-height: 1.55; }
.form-group select option { background: var(--bg2); }

/* Auth pages */
.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
}
.auth-card {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--r-xl);
  padding: 2.5rem;
  width: 100%; max-width: 440px;
  box-shadow: var(--shadow-lg);
}
.auth-logo { margin-bottom: 2rem; }
.auth-logo a { text-decoration: none; display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-serif); font-size: 18px; font-weight: 600; color: var(--text); }
.auth-logo .logo-text em { color: var(--accent); font-style: normal; }
.auth-title { font-family: var(--font-serif); font-size: 26px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.auth-sub   { font-size: 14px; color: var(--text2); margin-bottom: 1.75rem; }
.auth-form  { display: flex; flex-direction: column; gap: 1rem; }
.auth-switch { font-size: 13px; color: var(--text2); text-align: center; margin-top: 1.25rem; }
.auth-switch a { color: var(--accent); text-decoration: none; font-weight: 500; }
.auth-switch a:hover { text-decoration: underline; }

/* ── Flash messages ──────────────────────────────── */
.flash {
  padding: 12px 16px;
  border-radius: var(--r-sm);
  font-size: 14px;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}
.flash-success { background: var(--greenD); color: var(--green); border: 1px solid rgba(74,222,154,0.2); }
.flash-error   { background: var(--redD);   color: var(--red);   border: 1px solid rgba(240,107,107,0.2); }
.flash-info    { background: var(--accentD);color: var(--accent); border: 1px solid var(--accentB); }

/* ── Quiz ────────────────────────────────────────── */
.quiz-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 1rem 0; }
.quiz-opt {
  padding: 14px 16px;
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--r); cursor: pointer;
  font-size: 13.5px; color: var(--text2);
  text-align: left; transition: all 0.14s;
  font-family: var(--font); line-height: 1.45;
}
.quiz-opt:hover { border-color: var(--accent); color: var(--text); background: var(--accentD); }
.quiz-opt.correct { background: var(--greenD); border-color: rgba(74,222,154,0.35); color: var(--green); }
.quiz-opt.wrong   { background: var(--redD);   border-color: rgba(240,107,107,0.35); color: var(--red); }

/* ── Reading passage ─────────────────────────────── */
.reading-passage {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 2.5rem;
  margin-bottom: 1.5rem;
}
.passage-title { font-family: var(--font-serif); font-size: 24px; font-weight: 600; color: var(--text); margin-bottom: 8px; line-height: 1.3; }
.passage-meta  { font-size: 12px; color: var(--text3); margin-bottom: 1.5rem; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.passage-body  { font-size: 16px; line-height: 2.15; color: var(--text); }
.passage-body p { margin-bottom: 1.25rem; }
.kw {
  color: var(--accent);
  border-bottom: 1px solid rgba(91,141,238,0.4);
  cursor: pointer; transition: all 0.12s; padding: 0 1px; border-radius: 2px;
}
.kw:hover { background: var(--accentD); border-bottom-color: var(--accent); }
.kw.playing { background: var(--accentD); }

/* Word tooltip */
.word-tooltip {
  position: fixed; z-index: 9999;
  background: var(--bg3); border: 1px solid var(--border3);
  border-radius: var(--r); padding: 12px 16px;
  max-width: 300px; box-shadow: var(--shadow-lg);
  pointer-events: none; display: none;
}
.word-tooltip.show { display: block; }
.wt-word { font-family: var(--font-serif); font-size: 17px; font-weight: 600; color: var(--text); }
.wt-ph   { font-family: var(--font-mono); font-size: 12px; color: var(--text3); margin-top: 1px; }
.wt-pos  { display: inline-block; margin: 5px 0; }
.wt-def  { font-size: 13px; color: var(--text2); margin-top: 4px; line-height: 1.5; }

/* ── Admin table ─────────────────────────────────── */
.admin-table {
  width: 100%; border-collapse: collapse;
  font-size: 13.5px;
}
.admin-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
}
.admin-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--bg3); }

/* ── Ad units ────────────────────────────────────── */
.ad-unit {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden; text-align: center;
}
.ad-unit-label {
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text4); padding: 6px 0 5px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font);
}
.ad-inline {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden;
  text-align: center; margin: 2rem 0;
}
.ad-placeholder {
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  color: var(--text4); font-size: 11px; font-style: italic;
  font-family: var(--font);
}

/* ── Progress page ───────────────────────────────── */
.progress-ring-wrap {
  display: flex; flex-direction: column;
  align-items: center; padding: 2rem;
}
.progress-ring-num {
  font-family: var(--font-serif);
  font-size: 52px; font-weight: 700;
  color: var(--text); line-height: 1;
  margin-bottom: 4px;
}
.progress-ring-label { font-size: 13px; color: var(--text3); }

/* Heatmap */
.heatmap { display: flex; flex-wrap: wrap; gap: 3px; }
.hm-cell {
  width: 13px; height: 13px; border-radius: 2px;
  background: var(--bg4);
  transition: background 0.2s;
}
.hm-cell.done-1 { background: rgba(91,141,238,0.3); }
.hm-cell.done-2 { background: rgba(91,141,238,0.55); }
.hm-cell.done-3 { background: rgba(91,141,238,0.8); }
.hm-cell.done-4 { background: var(--accent); }

/* ── Grids ───────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px,1fr)); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px,1fr)); gap: 10px; }

/* ── Divider ─────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 2rem 0; }

/* ── Utilities ───────────────────────────────────── */
.flex   { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-6  { gap: 6px; }  .gap-8 { gap: 8px; }
.gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8  { margin-top:  8px; } .mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.text-sm  { font-size: 13px; }  .text-xs { font-size: 11.5px; }
.text-muted { color: var(--text2); } .text-dim { color: var(--text3); }
.text-accent { color: var(--accent); } .text-gold { color: var(--gold); }
.text-green { color: var(--green); }   .text-red { color: var(--red); }
.font-mono  { font-family: var(--font-mono); }
.font-serif { font-family: var(--font-serif); }
.fw-600 { font-weight: 600; }
.hidden { display: none !important; }

/* ── Scrollbar ───────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg5); border-radius: 3px; }

/* ── Animations ──────────────────────────────────── */
@keyframes fadeUp { from{opacity:0;transform:translateY(12px)} to{opacity:1;transform:translateY(0)} }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.anim-up { animation: fadeUp 0.35s ease both; }

/* ── SEO / hero section ──────────────────────────── */
.hero-section {
  padding: 5rem 0 4rem;
  text-align: center;
}
.hero-eyebrow {
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--accent); margin-bottom: 1.25rem;
  display: inline-flex; align-items: center; gap: 8px;
}
.hero-eyebrow::before, .hero-eyebrow::after {
  content: ''; flex: 1; height: 1px;
  background: var(--accentB); min-width: 32px;
}
.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(36px, 5vw, 60px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.12;
  margin-bottom: 1.5rem;
  max-width: 700px;
  margin-left: auto; margin-right: auto;
}
.hero-title span { color: var(--accent); font-style: italic; }
.hero-sub {
  font-size: 18px; color: var(--text2);
  line-height: 1.65; max-width: 540px;
  margin: 0 auto 2.5rem;
}
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-stats {
  display: flex; justify-content: center; gap: 3rem;
  margin-top: 4rem; flex-wrap: wrap;
}
.hero-stat-n { font-family: var(--font-serif); font-size: 32px; font-weight: 700; color: var(--text); }
.hero-stat-l { font-size: 12px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 3px; }

/* Feature grid on landing */
.feature-card {
  padding: 1.75rem;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: border-color 0.2s, transform 0.2s;
}
.feature-card:hover { border-color: var(--border2); transform: translateY(-2px); }
.feature-icon { width: 44px; height: 44px; border-radius: var(--r-sm); margin-bottom: 1rem; display: flex; align-items: center; justify-content: center; }
.feature-icon svg { width: 22px; height: 22px; fill: currentColor; }
.feature-title { font-family: var(--font-serif); font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.feature-body  { font-size: 14px; color: var(--text2); line-height: 1.65; }

/* ── Passage nav ─────────────────────────────────── */
.pnav-btn {
  padding: 7px 16px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--border2);
  background: var(--bg2); color: var(--text2);
  cursor: pointer; transition: all 0.14s;
  font-family: var(--font);
}
.pnav-btn:hover  { color: var(--text); background: var(--bg3); }
.pnav-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Responsive ──────────────────────────────────── */
@media(max-width: 960px) {
  .page-with-ads {
    grid-template-columns: 1fr;
    padding: 2rem 1.5rem 4rem;
  }
  .ads-col { position: static; flex-direction: row; flex-wrap: wrap; }
  .ads-col .ad-unit { flex: 1; min-width: 260px; }
}
@media(max-width: 640px) {
  nav { padding: 0 1.25rem; }
  .page, .page-sm, .page-xs { padding: 1.75rem 1.25rem 3rem; }
  .nav-links a span { display: none; }
  .page-title { font-size: 26px; }
  .hero-title { font-size: 30px; }
  .hero-sub   { font-size: 15px; }
  .nav-stat.streak, .nav-stat.xp { display: none; }
  .quiz-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 1.75rem; }
}

/* ── Google Sign-In button + divider ─────────────── */
.auth-divider {
  display: flex; align-items: center;
  gap: 12px; margin: 1.25rem 0;
  color: var(--text3);
  font-size: 12px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border2);
}
.btn-google {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; width: 100%;
  padding: 12px 20px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border3);
  background: var(--bg2);
  color: var(--text);
  font-size: 14px; font-weight: 500;
  font-family: var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.btn-google:hover {
  background: var(--bg3);
  border-color: var(--text3);
  transform: translateY(-1px);
}
.btn-google svg { flex-shrink: 0; }

/* ── Breadcrumb ───────────────────────────────────── */
.breadcrumb { margin-bottom: 1.5rem; }
.breadcrumb ol {
  list-style: none; display: flex; flex-wrap: wrap;
  align-items: center; gap: 8px; padding: 0; margin: 0;
}
.breadcrumb li {
  font-size: 13px; color: var(--text3);
  display: flex; align-items: center; gap: 8px;
}
.breadcrumb li:not(:last-child)::after {
  content: '/'; color: var(--text3); opacity: 0.5;
}
.breadcrumb a {
  color: var(--text2); text-decoration: none;
  transition: color 0.15s;
}
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb li[aria-current="page"] { color: var(--text); font-weight: 500; }

/* ── Word detail page ─────────────────────────────── */
.word-detail {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 1.5rem;
}
.word-detail-title {
  font-family: 'Sora', sans-serif;
  font-size: 40px; font-weight: 700;
  color: var(--text); line-height: 1.15;
  margin: 6px 0 4px;
  letter-spacing: -0.02em;
}
.word-detail-ph {
  font-size: 15px; color: var(--text3);
  font-style: italic; margin-bottom: 10px;
}
.word-section { margin-top: 2rem; }
.word-section h2 {
  font-family: 'Sora', sans-serif;
  font-size: 18px; font-weight: 600;
  color: var(--text); margin-bottom: 10px;
}
.word-def-lg {
  font-size: 16px; line-height: 1.7;
  color: var(--text2);
}
.word-tip-lg {
  font-size: 15px; line-height: 1.7;
  color: var(--text2);
  background: rgba(251,191,36,0.07);
  border-left: 3px solid var(--amber);
  padding: 12px 16px; border-radius: 0 8px 8px 0;
}
@media(max-width: 640px) {
  .word-detail { padding: 1.5rem; }
  .word-detail-title { font-size: 30px; }
}

/* ── Clickable word cards (learn page) ───────────── */
.clickable-card { cursor: pointer; transition: transform .12s ease, border-color .12s ease; }
.clickable-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.clickable-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* buttons and the word link stay above the card click layer */
.clickable-card button, .clickable-card a { position: relative; z-index: 2; }

/* ── Reading passages ─────────────────────────────── */
.reading-article .passage { font-size:16px; line-height:1.85; color:var(--text2); }
.reading-article .passage p { margin-bottom:1.25rem; }
.vocab-link {
  color:var(--accent); text-decoration:none;
  border-bottom:1px dashed var(--accent);
  font-weight:500; transition:background .15s;
}
.vocab-link:hover { background:rgba(96,165,250,0.12); border-radius:3px; }

/* ── Reading passages ─────────────────────────────── */
.reading-article .passage { font-size:16px; line-height:1.85; color:var(--text2); }
.reading-article .passage p { margin-bottom:1.25rem; }
.vocab-link {
  color:var(--accent); text-decoration:none;
  border-bottom:1px dashed var(--accent);
  font-weight:500; transition:background .15s;
}
.vocab-link:hover { background:rgba(96,165,250,0.12); border-radius:3px; }

/* ── Listen bar + paragraph audio ─────────────────── */
.listen-bar {
  display:flex; align-items:center; gap:12px; flex-wrap:wrap;
  margin-bottom:1.75rem; padding:10px 14px;
  background:var(--bg2); border:1px solid var(--border); border-radius:10px;
}
.listen-btn {
  display:inline-flex; align-items:center; gap:8px;
  background:var(--accent); color:#fff; border:none;
  padding:9px 16px; border-radius:8px; font-size:14px; font-weight:600;
  cursor:pointer; font-family:inherit;
}
.listen-btn:hover { opacity:.92; }
.listen-btn.playing { background:var(--red, #ef4444); }
.listen-btn svg { fill:currentColor; }
.listen-hint { font-size:12.5px; color:var(--text3); }

.passage-para { position:relative; }
.passage-para .para-speak {
  position:absolute; left:-34px; top:2px;
  background:transparent; border:none; cursor:pointer;
  color:var(--text3); padding:4px; border-radius:6px;
  opacity:0; transition:opacity .15s, color .15s;
}
.passage-para:hover .para-speak { opacity:1; }
.passage-para .para-speak:hover { color:var(--accent); background:var(--bg3); }
.passage-para .para-speak.playing { color:var(--accent); opacity:1; }
.passage-para .para-speak svg { fill:currentColor; }
/* on small screens there's no room in the margin — put the icon inline */
@media (max-width: 820px){
  .passage-para .para-speak { position:static; opacity:1; margin-bottom:4px; display:inline-flex; }
}

/* ── Fix landing grids: force fixed column counts ──── */
/* auto-fill was leaving empty phantom columns, pushing content left.
   Force exact column counts so cards center properly. */
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

/* Equal card heights within a row */
.grid-2, .grid-3, .grid-4 { align-items: stretch; }
.grid-2 > *, .grid-3 > *, .grid-4 > * { height: 100%; }

/* Responsive: collapse gracefully on smaller screens */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}