/* ── Variables ─────────────────────────────────────── */
:root {
  --bg:           #fafaf9;
  --white:        #ffffff;
  --text:         #111111;
  --muted:        #6b7280;
  --faint:        #d1d5db;
  --border:       #e5e7eb;
  --border-focus: #9ca3af;
  --stone:        #f5f5f4;
  --primary:      #1060a8;
  --primary-dark: #0a52a0;
  --amber:        #c96a2a;
  --red:          #b91c1c;
  --red-bg:       #fef2f2;
  --radius:       12px;
  --radius-lg:    16px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.06);
  --shadow-md:    0 4px 12px rgba(0,0,0,0.08);
}

/* ── Dark mode ──────────────────────────────────────── */
[data-theme="dark"] {
  --bg:           #0f1117;
  --white:        #1a1d27;
  --text:         #f0f0ef;
  --muted:        #8b95a1;
  --faint:        #3a3f4b;
  --border:       #2a2d3a;
  --border-focus: #4a5060;
  --stone:        #1e2130;
  --primary:      #4a9eff;
  --primary-dark: #3a8eef;
  --red-bg:       #2a1515;
}
[data-theme="dark"] .response-card { background: var(--white); }
[data-theme="dark"] .auth-page     { background: #0f1117; }
[data-theme="dark"] .auth-card     { background: #1a1d27; border-color: #2a2d3a; }

/* Appearance setting buttons */
.appearance-options {
  display: flex;
  gap: 0.75rem;
}
.appearance-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  padding: 0.875rem 1.25rem;
  background: var(--stone);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
  min-width: 72px;
}
.appearance-btn:hover { border-color: var(--primary); }
.appearance-btn-active { border-color: var(--primary); background: var(--stone); }
.appearance-icon { font-size: 1.375rem; }
.appearance-label { font-size: 0.8125rem; font-weight: 600; color: var(--text); }
.appearance-btn-active .appearance-label { color: var(--primary); }
[data-theme="dark"] .appearance-btn-active { background: rgba(74,158,255,0.15); }

/* ── Reset ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
a { color: inherit; }

/* ── Brand ──────────────────────────────────────────── */
.brand-italic {
  font-family: 'Lora', Georgia, serif;
  font-style: italic;
  color: var(--amber);
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  transition: opacity 0.15s, background 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-full { width: 100%; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); color: #fff; }
.btn-primary:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.btn-ghost:focus-visible { outline: 3px solid var(--border-focus); outline-offset: 3px; }

.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
}
.btn-ghost:hover:not(:disabled) { background: var(--stone); }

/* ── Inputs ─────────────────────────────────────────── */
.label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.375rem;
}

.input {
  width: 100%;
  background: var(--stone);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 16px;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.input::placeholder { color: var(--faint); }
.input:focus { border-color: var(--border-focus); background: var(--white); }

textarea.input { resize: none; min-height: 120px; line-height: 1.6; }

/* ── Tabs ─────────────────────────────────────────── */
.tabs {
  display: flex;
  background: var(--stone);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 1.75rem;
}
.tab {
  flex: 1;
  padding: 0.5rem;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  transition: all 0.15s;
}
.tab.active {
  background: var(--white);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ── Error ─────────────────────────────────────────── */
.error {
  font-size: 0.875rem;
  color: var(--red);
  background: var(--red-bg);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
  display: none;
}

/* ══ AUTH PAGE ══════════════════════════════════════════ */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1rem;
}

.auth-brand { text-align: center; margin-bottom: 2.5rem; }

.auth-dot {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--primary);
  margin: 0 auto 1.25rem;
}

.auth-headline {
  font-size: 1.875rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text);
}

.auth-sub {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.auth-card {
  width: 100%;
  max-width: 24rem;
  background: var(--white);
  border: 1px solid #f3f4f6;
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  padding: 2rem;
}

.form-group { margin-bottom: 1rem; }

.auth-footer {
  margin-top: 2rem;
  font-size: 0.75rem;
  color: var(--faint);
  text-align: center;
}

/* ══ ONBOARDING PAGE ════════════════════════════════════ */
.onboarding-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
}

.progress-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  width: 100%;
  max-width: 28rem;
}
.progress-seg {
  height: 4px;
  flex: 1;
  border-radius: 9999px;
  background: var(--border);
  transition: background 0.3s;
}
.progress-seg.done { background: var(--text); }

.step-wrap { width: 100%; max-width: 28rem; }
.step { display: none; }
.step.active { display: block; }

.step-title { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.25rem; }
.step-sub { font-size: 0.875rem; color: var(--muted); margin-bottom: 1.5rem; }

.lang-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.opt-btn {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.625rem 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  text-align: center;
  transition: all 0.15s;
}
.opt-btn:hover { border-color: var(--border-focus); }
.opt-btn.selected { border-color: var(--text); background: var(--text); color: var(--white); }

.level-list, .goal-list { display: flex; flex-direction: column; gap: 0.625rem; margin-bottom: 1.5rem; }

.level-btn, .goal-btn {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  color: #374151;
  text-align: left;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.level-btn:hover, .goal-btn:hover { border-color: var(--border-focus); }
.level-btn.selected, .goal-btn.selected {
  border-color: var(--text);
  background: var(--text);
  color: var(--white);
}

.check-icon { display: none; }
.goal-btn.selected .check-icon { display: block; }

.step-nav { display: flex; gap: 0.75rem; }
.step-nav .btn-ghost { padding: 0.75rem 1.25rem; }
.step-nav .btn-primary { flex: 1; }

/* ══ TUTOR PAGE ════════════════════════════════════════ */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
}
.header-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}
.header-brand:hover { opacity: 0.8; }
.header-logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.header-logo-svg {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: block;
}
.header-title { font-size: 1rem; font-weight: 600; color: var(--text); }
.header-link {
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}
.header-link:hover { color: var(--text); }
.header-link-admin { color: var(--primary); font-weight: 600; }
.header-link-admin:hover { color: var(--primary-dark); }
.header-link-upgrade { color: var(--primary); font-weight: 600; }
.header-link-upgrade:hover { color: var(--primary-dark); }

.tutor-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.5rem 1rem;
  max-width: 672px;
  margin: 0 auto;
  width: 100%;
}

.input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
  gap: 1rem;
}
.char-count { font-size: 0.75rem; color: var(--faint); }
.char-count.warn { color: #d97706; }
.input-hint { font-size: 0.75rem; color: var(--faint); margin-top: 0.375rem; }

/* Welcome prompts */
.welcome-label { font-size: 0.875rem; color: var(--faint); margin-bottom: 0.5rem; }
.prompt-list { display: flex; flex-direction: column; gap: 0.5rem; }
.prompt-btn {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: #4b5563;
  text-align: left;
  transition: border-color 0.15s, color 0.15s;
}
.prompt-btn:hover { border-color: var(--border-focus); color: var(--text); }

/* Thinking indicator */
.thinking {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 0;
  font-size: 0.875rem;
  color: var(--muted);
}
.dots { display: inline-flex; gap: 4px; }
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
  animation: bounce 1s infinite;
}
.dot:nth-child(2) { animation-delay: 0.15s; }
.dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%           { transform: translateY(-5px); }
}

/* Response */
.response-card {
  background: var(--white);
  border: 1px solid #f3f4f6;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  line-height: 1.75;
}
.response-card p      { margin-bottom: 0.75rem; color: #374151; }
.response-card p:last-child { margin-bottom: 0; }
.response-card strong { font-weight: 600; color: var(--text); }
.response-card ul     { list-style: disc inside; margin-bottom: 0.75rem; color: #374151; }
.response-card li     { margin-bottom: 0.25rem; }
.response-card code   { background: var(--stone); border-radius: 4px; padding: 2px 6px; font-size: 0.875em; }
.response-card em     { font-style: italic; color: var(--muted); }

.error-card {
  background: var(--red-bg);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--red);
}
.error-card button {
  background: none;
  border: none;
  color: var(--red);
  text-decoration: underline;
  font-size: 0.875rem;
  font-weight: 500;
  margin-left: 0.5rem;
}

/* ══ LIBRARY PAGE ══════════════════════════════════════ */
.library-main {
  flex: 1;
  max-width: 672px;
  margin: 0 auto;
  width: 100%;
  padding: 1.5rem 1rem;
}

.lib-list { display: flex; flex-direction: column; gap: 0.75rem; }

.lib-item {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.lib-toggle {
  width: 100%;
  background: none;
  border: none;
  padding: 1rem;
  text-align: left;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  transition: background 0.15s;
}
.lib-toggle:hover { background: #f9fafb; }

.lib-input {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.lib-meta { display: flex; align-items: center; gap: 0.5rem; margin-top: 3px; }
.lib-tag {
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--stone);
  border-radius: 4px;
  padding: 2px 8px;
}
.lib-date { font-size: 0.75rem; color: var(--faint); }

.chevron { color: var(--faint); transition: transform 0.2s; flex-shrink: 0; margin-top: 2px; }
.lib-item.open .chevron { transform: rotate(180deg); }

.lib-body {
  display: none;
  border-top: 1px solid var(--stone);
  padding: 1rem;
  font-size: 0.875rem;
  line-height: 1.75;
  color: #374151;
}
.lib-item.open .lib-body { display: block; }
.lib-body strong { font-weight: 600; color: var(--text); }
.lib-body ul { list-style: disc inside; margin-bottom: 0.5rem; }

.empty-state { text-align: center; padding: 4rem 0; color: var(--muted); font-size: 0.875rem; }
.empty-state a { color: var(--text); }

/* ══ HEADER NAV ════════════════════════════════════════ */
.header-nav { display: flex; align-items: center; gap: 1.25rem; }

/* ══ PROFILE PAGE ══════════════════════════════════════ */
.profile-main {
  flex: 1;
  max-width: 672px;
  margin: 0 auto;
  width: 100%;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
}

.stat-number {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 0.375rem;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.3;
}


.section-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; }
.section-sub { font-size: 0.875rem; color: var(--muted); margin-bottom: 1rem; }

.weak-list { display: flex; flex-direction: column; gap: 0.625rem; }
.weak-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
}
.weak-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.weak-name { font-size: 0.875rem; font-weight: 500; color: var(--text); text-transform: capitalize; }
.weak-count { font-size: 0.75rem; color: var(--muted); }
.weak-bar { height: 4px; background: var(--stone); border-radius: 9999px; overflow: hidden; }
.weak-fill { height: 100%; background: var(--primary); border-radius: 9999px; }

.topic-list { display: flex; flex-direction: column; gap: 0.375rem; }
.topic-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 1rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.topic-name { font-size: 0.875rem; color: var(--text); text-transform: capitalize; }
.topic-count {
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--stone);
  border-radius: 9999px;
  padding: 2px 10px;
}

.setup-list { display: flex; flex-direction: column; }
.setup-row {
  display: flex;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--stone);
  font-size: 0.875rem;
}
.setup-row:last-child { border-bottom: none; }
.setup-key { color: var(--muted); min-width: 140px; flex-shrink: 0; }
.setup-val { color: var(--text); }

/* ══ SETTINGS PAGE ═════════════════════════════════════ */
.settings-main {
  flex: 1;
  max-width: 672px;
  margin: 0 auto;
  width: 100%;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.settings-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.settings-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--stone);
}

.settings-meta { font-size: 0.875rem; color: var(--muted); }

/* ── Subscription card ─────────────────────────────── */
.sub-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.sub-card-top { padding: 1.25rem; }
.sub-plan-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: 9999px;
  padding: 0.25rem 0.75rem;
  margin-bottom: 0.5rem;
}
.sub-plan-free     { background: var(--stone); color: var(--muted); }
.sub-plan-pro      { background: #dbeafe; color: var(--primary); }
.sub-plan-unlimited { background: #ede9fe; color: #6d28d9; }
.sub-plan-desc { font-size: 0.875rem; color: var(--muted); line-height: 1.5; margin-bottom: 0.75rem; }
.sub-meta      { font-size: 0.8125rem; color: var(--faint); }
.sub-usage { margin-top: 0.75rem; }
.sub-usage-bar {
  height: 6px;
  background: var(--stone);
  border-radius: 9999px;
  margin-bottom: 0.375rem;
  overflow: hidden;
}
.sub-usage-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 9999px;
  transition: width 0.3s ease;
}
.sub-usage-label { font-size: 0.8125rem; color: var(--muted); }
.sub-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--stone);
  flex-wrap: wrap;
}
.sub-cancel-btn {
  margin-left: auto;
  font-size: 0.8125rem;
  color: var(--muted);
  border-color: transparent;
}
.sub-cancel-btn:hover { color: var(--red); border-color: var(--red); }
.sub-cancel-confirm {
  padding: 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--red-bg);
}
.sub-cancel-heading { font-weight: 600; font-size: 0.9375rem; margin-bottom: 0.375rem; }
.sub-cancel-desc    { font-size: 0.875rem; color: var(--muted); line-height: 1.5; }

.radio-group { display: flex; flex-direction: column; gap: 0.5rem; }
.radio-label {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.875rem;
  color: #374151;
  cursor: pointer;
  padding: 0.375rem 0;
}
.radio-label input[type="radio"] { accent-color: var(--primary); width: 16px; height: 16px; }

.check-group { display: flex; flex-direction: column; gap: 0.375rem; }
.check-label {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.875rem;
  color: #374151;
  cursor: pointer;
  padding: 0.375rem 0;
}
.check-label input[type="checkbox"] { accent-color: var(--primary); width: 16px; height: 16px; }

.btn-danger {
  background: var(--white);
  color: var(--red);
  border: 1px solid #fecaca;
  padding: 0.75rem 1.25rem;
}
.btn-danger:hover { background: var(--red-bg); }

/* ══ LEGAL PAGES ════════════════════════════════════════ */
.legal-page { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }

.legal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--white);
}

.legal-main {
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
  padding: 3rem 1.5rem 5rem;
}

.legal-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.375rem;
}

.legal-date {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 2rem;
}

.legal-main h2 {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 2rem 0 0.625rem;
}

.legal-main p {
  font-size: 0.9375rem;
  color: #374151;
  line-height: 1.75;
  margin-bottom: 0.75rem;
}

.legal-main ul {
  margin: 0 0 0.75rem 1.25rem;
}

.legal-main li {
  font-size: 0.9375rem;
  color: #374151;
  line-height: 1.75;
  margin-bottom: 0.25rem;
}

.legal-main a {
  color: var(--primary);
  text-decoration: underline;
}

.auth-footer a {
  color: inherit;
  text-decoration: underline;
}
.auth-footer a:hover { color: var(--text); }

/* ══ MISC ══════════════════════════════════════════════ */
.success-msg {
  font-size: 0.875rem;
  color: #166534;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
}

/* ══ PUBLIC EXPLANATION PAGE ═══════════════════════════ */
.explain-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.explain-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}


.explain-main {
  flex: 1;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  padding: 3rem 1.5rem 4rem;
}

.explain-input-label {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.explain-headline {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 2rem;
}

.explain-response {
  margin-bottom: 3rem;
  font-size: 1rem;
}

.explain-cta {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.explain-cta-inner {
  padding: 2rem;
  text-align: center;
}

.explain-cta-heading {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.explain-cta-sub {
  font-size: 0.9375rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.explain-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--muted);
}

.explain-footer a {
  color: var(--muted);
  text-decoration: none;
}
.explain-footer a:hover { color: var(--text); }

/* ══ EXPLANATION SECTION LABELS ════════════════════════ */
.section-label {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  background: #dbeafe;
  border-radius: 4px;
  padding: 2px 7px;
  margin-right: 6px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

/* ══ TAG CHIPS ══════════════════════════════════════════ */
.tag-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.tag-chip {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--primary);
  background: #dbeafe;
  border-radius: 9999px;
  padding: 3px 10px;
}

/* ══ NEXT READS ═════════════════════════════════════════ */
.next-reads {
  margin: 2.5rem 0;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.next-reads-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.875rem;
}
.next-reads-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.next-read-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.next-read-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(16,96,168,0.10);
  transform: translateY(-2px);
  color: var(--text);
}
.next-read-q {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
}
.next-read-arrow {
  font-size: 0.8125rem;
  color: var(--primary);
  font-weight: 600;
}
.next-reads-browse {
  display: inline-block;
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
  transition: color 0.15s, border-color 0.15s;
}
.next-reads-browse:hover {
  color: var(--primary);
  border-color: var(--primary);
}
@media (max-width: 520px) {
  .next-reads-grid { grid-template-columns: 1fr; }
}

/* ══ INLINE ARTICLE CTA ═════════════════════════════════ */
.article-cta {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: #f0f6ff;
  border: 1.5px solid #c7deff;
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 2rem 0;
}
.article-cta-icon {
  flex-shrink: 0;
  color: var(--primary);
  opacity: 0.7;
  display: flex;
}
.article-cta-body { flex: 1; min-width: 0; }
.article-cta-text {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.article-cta-text em { color: var(--primary); font-style: italic; }
.article-cta-sub {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 0.25rem;
}
.article-cta-btn {
  white-space: nowrap;
  flex-shrink: 0;
}
@media (max-width: 520px) {
  .article-cta { flex-direction: column; align-items: flex-start; }
  .article-cta-icon { display: none; }
}

/* ══ PROGRESS PILL ═════════════════════════════════════ */
.progress-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--muted);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 0.375rem 0.875rem;
  width: fit-content;
}
.pill-divider { color: var(--faint); }

/* ══ IMAGE UPLOAD ══════════════════════════════════════ */
.input-wrap { display: flex; flex-direction: column; gap: 0; }

.img-upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.img-upload-btn:hover { border-color: var(--border-focus); color: var(--text); }

.img-preview {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: var(--stone);
  border-radius: 8px;
}
.img-preview img { height: 48px; width: 48px; object-fit: cover; border-radius: 4px; }
.img-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  line-height: 1;
}
.img-badge {
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--stone);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 4px;
}

/* ══ PERSONALISATION NUDGE ═════════════════════════════ */
.personal-nudge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--muted);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}
.nudge-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.25rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--primary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  margin-left: auto;
}
.nudge-btn:hover { background: #dbeafe; border-color: var(--primary); }
.nudge-topic { font-weight: 600; color: var(--text); }

/* ══ CONVERSATION THREAD ═══════════════════════════════ */
.exchange { display: flex; flex-direction: column; gap: 0.75rem; }

.exchange-input {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--stone);
}


.exchange-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
}

.feedback-btns { display: flex; gap: 0.375rem; }
.feedback-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.feedback-btn:hover { background: var(--stone); color: var(--text); border-color: var(--border-focus); }
.feedback-btn:first-child.active { background: #f0fdf4; border-color: #86efac; color: #166534; }
.feedback-btn:last-child.active  { background: var(--red-bg); border-color: #fecaca; color: var(--red); }

.bookmark-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.25rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.bookmark-btn:hover { border-color: var(--border-focus); color: var(--text); }
.bookmark-btn.bookmarked { color: var(--primary); border-color: var(--primary); background: #dbeafe; }

.followup-wrap {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding-top: 0.5rem;
}
.followup-input { flex: 1; padding: 0.5rem 0.875rem; }
.followup-btn { padding: 0.5rem 1rem; white-space: nowrap; }

/* ══ LIBRARY IMPROVEMENTS ══════════════════════════════ */
.lib-filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.lib-filter {
  padding: 0.375rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--white);
  transition: all 0.15s;
}
.lib-filter.active { background: var(--text); color: var(--white); border-color: var(--text); }
.lib-filter:hover:not(.active) { border-color: var(--border-focus); color: var(--text); }

.lib-saved {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--primary);
  background: #dbeafe;
  border-radius: 4px;
  padding: 1px 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lib-actions {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--stone);
}



/* ══ MOBILE ════════════════════════════════════════════ */
@media (max-width: 640px) {

  /* Header — compress nav so it fits on small screens */
  .header { padding: 0.75rem 1rem; }
  .header-nav { gap: 0.75rem; }
  .header-link { font-size: 0.75rem; padding: 0.5rem 0; min-height: 44px; display: inline-flex; align-items: center; }

  /* Hide Profile from main nav on mobile — accessible via Settings */
  .header-nav a[href="/profile"] { display: none; }
  .header-nav a[href="/explanations"] { display: none; }

  /* Auth */
  .auth-page { padding: 2rem 1rem; }
  .auth-headline { font-size: 1.5rem; }
  .auth-card { padding: 1.5rem; }

  /* Onboarding */
  .onboarding-page { padding: 1.5rem 1rem; justify-content: flex-start; padding-top: 2rem; }
  .lang-grid { grid-template-columns: repeat(3, 1fr); gap: 0.375rem; }
  .opt-btn { font-size: 0.8125rem; padding: 0.5rem 0.25rem; }

  /* Tutor main */
  .tutor-main { padding: 1rem; gap: 1rem; }

  /* Progress pill — wrap gracefully */
  .progress-pill { flex-wrap: wrap; font-size: 0.75rem; }

  /* Personal nudge — stack on small screens */
  .personal-nudge { flex-wrap: wrap; gap: 0.5rem; }
  .nudge-btn { margin-left: 0; }

  /* Follow-up input — stack vertically */
  .followup-wrap { flex-direction: column; }
  .followup-btn { width: 100%; }

  /* Exchange actions — space evenly */
  .exchange-actions { flex-wrap: wrap; gap: 0.5rem; }

  /* Profile stats — reduce padding on small screens */
  .stats-grid { gap: 0.5rem; }
  .stat-card { padding: 1rem 0.625rem; }
  .stat-number { font-size: 1.5rem; }
  .stat-label { font-size: 0.6875rem; }

  /* Profile/settings/library main areas */
  .profile-main,
  .settings-main,
  .library-main { padding: 1rem; }

  /* Settings sections */
  .settings-section { padding: 1.25rem; }

  /* Lib filters */
  .lib-filters { margin-bottom: 0.75rem; }

  /* Legal pages */
  .legal-main { padding: 2rem 1rem 3rem; }
  .legal-title { font-size: 1.5rem; }

  /* Public explain page */
  .explain-main { padding: 2rem 1rem 3rem; }
  .explain-cta-inner { padding: 1.5rem 1rem; }

  /* Image preview */
  .img-preview img { height: 56px; width: 56px; }
}

/* Very small screens (iPhone SE, 320px) */
@media (max-width: 380px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .header-nav a[href="/settings"] { display: none; }
}

/* ══ CLICK-TO-HEAR ════════════════════════════════════ */
.response-card { cursor: text; touch-action: manipulation; }
.response-card *::selection { background: #c8e6c9; }

.speak-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: var(--text);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 0.5rem 1.25rem;
  border-radius: 9999px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
  white-space: nowrap;
  z-index: 100;
}
.speak-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.hear-hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.375rem;
  display: flex;
  align-items: center;
}

.response-card p:hover,
.response-card li:hover {
  background: #f0faf8;
  border-radius: 4px;
  margin-left: -6px;
  padding-left: 6px;
  margin-right: -6px;
  padding-right: 6px;
  cursor: pointer;
}

/* ══ LIBRARY SEARCH ════════════════════════════════════ */
.lib-search-form { margin-bottom: 0.75rem; }
.lib-search-input {
  padding: 0.625rem 1rem;
  font-size: 0.9375rem;
  background: var(--white);
}

/* ══ MODE TABS ═════════════════════════════════════════ */
.mode-tabs {
  display: flex;
  background: var(--stone);
  border-radius: 10px;
  padding: 3px;
  gap: 0;
}
.mode-tab {
  flex: 1;
  padding: 0.5rem;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.mode-tab.active {
  background: var(--white);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ══ CONTEXT PICKER ════════════════════════════════════ */
.ctx-picker { margin-top: 0.625rem; }
.ctx-label { font-size: 0.75rem; color: var(--muted); display: block; margin-bottom: 0.375rem; }
.ctx-btns { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.ctx-btn {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.ctx-btn:hover { border-color: var(--border-focus); color: var(--text); }
.ctx-btn.active { background: var(--text); color: var(--white); border-color: var(--text); }

/* ══ SPACED REPETITION RECALL CARD ════════════════════ */
.recall-card {
  background: var(--white);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: opacity 0.3s;
}
.recall-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  margin-bottom: 0.5rem;
}
.recall-phrase {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 1rem;
}
.recall-actions { display: flex; gap: 0.5rem; }
.recall-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--stone);
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--muted);
}
.recall-btn {
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: 8px;
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.15s;
}
.recall-yes:hover { background: #f0fdf4; border-color: #86efac; color: #166534; }
.recall-no:hover  { background: var(--red-bg); border-color: #fecaca; color: var(--red); }

/* ══ PATTERN INTELLIGENCE GAPS ════════════════════════ */
.gap-list { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.gap-chip {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 0.375rem 1rem;
  font-size: 0.875rem;
  color: var(--text);
  text-decoration: none;
  transition: all 0.15s;
  cursor: pointer;
}
.gap-chip:hover { border-color: var(--primary); color: var(--primary); background: #eff6ff; }

/* ══ EXPLAIN PAGE — COMMUNITY DATA ════════════════════ */
.explain-community {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

/* ══ CONVERSATION PAGE ═════════════════════════════════ */
.conv-page {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* Mode tabs */
.conv-mode-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--white);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.conv-mode-tabs::-webkit-scrollbar { display: none; }
.conv-mode-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.75rem 1.125rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}
.conv-mode-tab:hover { color: var(--text); }
.conv-mode-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.conv-tab-lock { font-size: 0.75rem; opacity: 0.6; }

/* Panels */
.conv-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.conv-panel-hidden { display: none; }

/* Voice wrapper inside conversation */
.conv-voice-wrap {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}
.conv-voice-desc {
  font-size: 0.9375rem;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

/* Upgrade prompt */
.conv-upgrade-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 300px;
}
.conv-upgrade-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.conv-upgrade-heading {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.conv-upgrade-desc {
  font-size: 0.9375rem;
  color: var(--muted);
  line-height: 1.6;
  max-width: 380px;
}

.conv-subtitle {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 1px;
}

.conv-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 672px;
  margin: 0 auto;
  width: 100%;
}

.conv-msg { display: flex; }
.conv-msg.user   { justify-content: flex-end; }
.conv-msg.tutor  { justify-content: flex-start; }

.conv-bubble {
  max-width: 78%;
  padding: 0.75rem 1rem;
  border-radius: 18px;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.conv-msg.user .conv-bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.conv-msg.tutor .conv-bubble {
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.conv-msg.tutor .conv-bubble p  { margin-bottom: 0.5rem; }
.conv-msg.tutor .conv-bubble p:last-child { margin-bottom: 0; }
.conv-msg.tutor .conv-bubble strong { font-weight: 600; }

.conv-input-area {
  border-top: 1px solid var(--border);
  background: var(--white);
  padding: 0.75rem 1rem 1rem;
  max-width: 672px;
  margin: 0 auto;
  width: 100%;
}

.conv-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}

.conv-input {
  flex: 1;
  min-height: 44px;
  max-height: 160px;
  resize: none;
  border-radius: 22px;
  padding: 0.625rem 1rem;
  font-size: 16px;
  line-height: 1.5;
}

.conv-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  padding: 0;
  flex-shrink: 0;
}

.conv-mic-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.conv-mic-btn:hover { border-color: var(--border-focus); color: var(--text); }
.conv-mic-btn.listening {
  background: #fef2f2;
  border-color: var(--red);
  color: var(--red);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.08); }
}

.conv-hint {
  font-size: 0.75rem;
  color: var(--faint);
  text-align: center;
  margin-top: 0.5rem;
}

@media (max-width: 640px) {
  .conv-bubble { max-width: 88%; }
}

/* ══ EXPLANATION INDEX PAGE ════════════════════════════ */
/* ── Explanations index ──────────────────────────── */
/* ══ EXPLANATIONS INDEX — REDESIGNED ════════════════════════════════════ */
.expl-main { max-width: 780px; }

/* Hero */
.expl-hero { padding: 2.5rem 0 1.75rem; }
.expl-hero-title {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.625rem;
  color: var(--text);
}
.expl-hero-sub {
  font-size: 1.0625rem;
  color: var(--muted);
  line-height: 1.65;
  max-width: 520px;
}

/* Search */
.expl-search-wrap {
  position: relative;
  margin-bottom: 1.25rem;
}
.expl-search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.expl-search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.625rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-family: inherit;
  background: var(--white);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.expl-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16,96,168,0.10);
}
.expl-search-count {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8125rem;
  color: var(--muted);
}

/* Category pills */
.expl-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}
.expl-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.375rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: 9999px;
  background: var(--white);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.expl-pill span { font-size: 0.75rem; opacity: 0.7; }
.expl-pill:hover { border-color: var(--primary); color: var(--primary); }
.expl-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}
.expl-pill.active span { opacity: 0.85; }

/* Category sections */
.expl-section { margin-bottom: 2.5rem; }
.expl-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 0.25rem;
}
.expl-section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.expl-section-count {
  font-size: 0.75rem;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

/* List rows */
.expl-list { display: flex; flex-direction: column; }
.expl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 0.75rem;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--stone);
  transition: background 0.12s, padding-left 0.12s;
  border-radius: 6px;
}
.expl-row:last-child { border-bottom: none; }
.expl-row:hover {
  background: var(--stone);
  padding-left: 1rem;
}
.expl-row-q {
  font-size: 0.9375rem;
  line-height: 1.45;
  flex: 1;
}
.expl-row-arrow {
  font-size: 0.875rem;
  color: var(--faint);
  flex-shrink: 0;
  transition: color 0.12s, transform 0.12s;
}
.expl-row:hover .expl-row-arrow {
  color: var(--primary);
  transform: translateX(3px);
}

.expl-no-results {
  text-align: center;
  color: var(--muted);
  font-size: 0.9375rem;
  padding: 3rem 0;
}

@media (max-width: 600px) {
  .expl-hero { padding: 1.5rem 0 1.25rem; }
  .expl-pills { gap: 0.375rem; }
  .expl-pill { font-size: 0.75rem; padding: 0.3rem 0.7rem; }
}

/* ══ CONVERSATION STOP BUTTON ══════════════════════════ */
.conv-stop-wrap {
  display: flex;
  justify-content: center;
  padding: 0 0 0.625rem;
}
.conv-stop-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  background: var(--white);
  border: 1.5px solid #fca5a5;
  color: var(--red);
  border-radius: 9999px;
  padding: 0.5rem 1.25rem 0.5rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(185,28,28,0.12);
  transition: all 0.15s ease;
  letter-spacing: 0.01em;
}
.conv-stop-btn:hover {
  background: #fff5f5;
  box-shadow: 0 4px 16px rgba(185,28,28,0.18);
  transform: translateY(-1px);
}

/* Pulsing dot instead of the square icon */
.conv-stop-btn::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  flex-shrink: 0;
  animation: speaking-pulse 1.4s ease-in-out infinite;
}

@keyframes speaking-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.45; transform: scale(0.75); }
}

/* ══════════════════════════════════════════════════════
   VISUAL DESIGN IMPROVEMENTS
   ══════════════════════════════════════════════════════ */

/* ── Richer shadows and depth ──────────────────────── */
:root {
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg:  0 16px 48px rgba(0,0,0,0.14), 0 4px 12px rgba(0,0,0,0.06);
}

/* ── Auth page — dark brand background ─────────────── */
.auth-page {
  background: linear-gradient(155deg, #0a3d6b 0%, #1060a8 55%, #1472be 100%);
  padding: 3rem 1.25rem;
}

.auth-dot {
  width: 2.75rem;
  height: 2.75rem;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.35);
  box-shadow: 0 0 0 6px rgba(255,255,255,0.06);
}

.auth-headline {
  font-size: clamp(1.75rem, 5vw, 2.375rem);
  color: #ffffff;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.auth-sub { color: rgba(255,255,255,0.6); font-size: 0.9375rem; }

.auth-card {
  border: none;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 2.25rem;
}

.auth-card .btn-primary {
  background: #1265bd;
  box-shadow: 0 2px 8px rgba(18,101,189,0.3);
}
.auth-card .btn-primary:hover:not(:disabled) {
  background: #0e55a3;
  box-shadow: 0 6px 20px rgba(18,101,189,0.4);
}

.auth-footer { color: rgba(255,255,255,0.35); }
.auth-footer a { color: rgba(255,255,255,0.5); text-decoration: underline; }
.auth-footer a:hover { color: rgba(255,255,255,0.85); }

/* ── Buttons — lift on hover ───────────────────────── */
.btn {
  transition: all 0.18s ease;
  will-change: transform;
}
.btn-primary {
  box-shadow: 0 2px 8px rgba(16,96,168,0.28);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  color: #fff;
  box-shadow: 0 6px 20px rgba(16,96,168,0.36);
  transform: translateY(-1px);
}
.btn:active:not(:disabled) { transform: translateY(0); box-shadow: none; }

/* ── Inputs — better focus ring ────────────────────── */
.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16,96,168,0.10);
  background: var(--white);
}

/* ── Header — frosted glass ────────────────────────── */
.header {
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(255,255,255,0.88);
  border-bottom: 1px solid rgba(0,0,0,0.07);
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
}

/* ── Response cards — more depth ───────────────────── */
.response-card {
  border: 1px solid #ebebea;
  border-radius: 16px;
  padding: 1.75rem;
  line-height: 1.85;
  box-shadow: var(--shadow-sm);
}

.response-card p  { margin-bottom: 0.875rem; }
.response-card p:last-child { margin-bottom: 0; }
.response-card ul { margin: 0.25rem 0 0.875rem 1rem; }
.response-card li { margin-bottom: 0.375rem; }

/* ── Section labels — more polished ────────────────── */
.section-label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--primary);
  background: rgba(16,96,168,0.09);
  padding: 3px 8px;
  border-radius: 5px;
}

/* ── Cards across the app ──────────────────────────── */
.settings-section {
  border: 1px solid #ebebea;
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

.stat-card {
  border: 1px solid #ebebea;
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.weak-card {
  border: 1px solid #ebebea;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.lib-item {
  border: 1px solid #ebebea;
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 0.625rem;
}

.recall-card {
  border: 1.5px solid var(--primary);
  border-radius: 16px;
  box-shadow: 0 0 0 4px rgba(16,96,168,0.07);
}

/* ── Conversation bubbles ──────────────────────────── */
.conv-messages {
  background: #f4f7f5;
}

.conv-msg.user .conv-bubble {
  background: linear-gradient(140deg, #0d3b2e 0%, #165c43 100%);
  color: #fff;
  box-shadow: 0 3px 12px rgba(16,96,168,0.22);
  border-bottom-right-radius: 4px;
  border-radius: 18px 18px 4px 18px;
}

.conv-msg.tutor .conv-bubble {
  background: #ffffff;
  border: 1px solid #e8e8e6;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border-bottom-left-radius: 4px;
  border-radius: 18px 18px 18px 4px;
}

.conv-input-area {
  background: var(--white);
  border-top: 1px solid rgba(0,0,0,0.07);
  box-shadow: 0 -4px 16px rgba(0,0,0,0.04);
}

/* ── Onboarding cards ──────────────────────────────── */
.level-btn, .goal-btn, .opt-btn {
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}
.level-btn:hover, .goal-btn:hover, .opt-btn:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* ── Progress pill ─────────────────────────────────── */
.progress-pill {
  border-radius: 9999px;
  border: 1px solid #e8e8e6;
  box-shadow: var(--shadow-sm);
}

/* ── Library list ──────────────────────────────────── */
.lib-list { display: flex; flex-direction: column; gap: 0; }

.explain-cta {
  background: linear-gradient(135deg, #0a3d6b, #1472be);
  border: none;
  border-radius: 20px;
}
.explain-cta-inner { padding: 2.5rem; text-align: center; }
.explain-cta-heading { color: #fff; }
.explain-cta-sub { color: rgba(255,255,255,0.7); }
.explain-cta .btn-primary {
  background: #fff;
  color: #0a3d6b;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.explain-cta .btn-primary:hover:not(:disabled) {
  background: rgba(255,255,255,0.92);
  box-shadow: 0 6px 24px rgba(0,0,0,0.2);
  transform: translateY(-1px);
}

/* ── Tabs ──────────────────────────────────────────── */
.tab.active {
  box-shadow: 0 1px 6px rgba(0,0,0,0.1);
  font-weight: 600;
}

/* ── Mode tabs ─────────────────────────────────────── */
.mode-tab.active {
  box-shadow: 0 1px 6px rgba(0,0,0,0.1);
  font-weight: 600;
}

/* ── Auth feature list ─────────────────────────────── */
.auth-features {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.auth-feature {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.55);
}
.auth-feature svg { color: rgba(255,255,255,0.5); flex-shrink: 0; }

/* ── Logo ──────────────────────────────────────────── */
.auth-logo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 1.5rem;
  display: block;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.12), 0 8px 24px rgba(0,0,0,0.25);
}

.header-logo-img {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  margin-right: 0.375rem;
  display: inline-block;
}

/* ══ ACTIVE NAV LINK ════════════════════════════════════ */
.header-link-active {
  color: var(--text);
  font-weight: 600;
}

/* ══ DAILY PHRASE WIDGET ════════════════════════════════ */
.daily-phrase {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: 0.875rem 1rem 0.875rem 1.125rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
}
.daily-phrase-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--primary);
  white-space: nowrap;
  padding-top: 0.1rem;
}
.daily-phrase-body { flex: 1; min-width: 0; }
.daily-phrase-phrase {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.2rem;
}
.daily-phrase-meaning {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
  line-height: 1.45;
}
.daily-phrase-example {
  font-size: 0.8125rem;
  color: var(--text);
  font-style: italic;
  line-height: 1.45;
}
.daily-phrase-dismiss {
  background: none;
  border: none;
  color: var(--faint);
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s;
}
.daily-phrase-dismiss:hover { color: var(--muted); }

/* ══ PRACTICE PAGE ══════════════════════════════════════ */
.practice-main {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}
.practice-header { margin-bottom: 1.75rem; }
.practice-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.375rem;
  letter-spacing: -0.02em;
}
.practice-sub {
  font-size: 0.9375rem;
  color: var(--muted);
  line-height: 1.5;
}
.practice-tabs {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.practice-tab {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 9999px;
  padding: 0.4rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: inherit;
}
.practice-tab:hover { border-color: var(--primary); color: var(--primary); }
.practice-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}
.practice-content { display: flex; flex-direction: column; gap: 1rem; }
.practice-mode-desc {
  font-size: 0.9375rem;
  color: var(--muted);
  line-height: 1.6;
  padding: 0.75rem 1rem;
  background: var(--stone);
  border-radius: var(--radius);
}
.practice-prompt-box {
  background: #f0f6ff;
  border: 1.5px solid #c7deff;
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
}
.practice-prompt-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--primary);
  margin-bottom: 0.4rem;
}
.practice-prompt-text {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}
.practice-prompt-new {
  font-size: 0.8125rem;
  padding: 0.35rem 0.75rem;
}
.practice-input {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  font-size: 0.9375rem;
  line-height: 1.6;
}
.practice-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.practice-char-count {
  font-size: 0.8125rem;
  color: var(--muted);
}
.practice-hint {
  font-size: 0.75rem;
  color: var(--faint);
  margin-left: auto;
}
.practice-output {
  font-size: 0.9375rem;
  line-height: 1.7;
}
.practice-output h2,
.practice-output h3 { font-size: 0.9375rem; font-weight: 700; margin: 1rem 0 0.4rem; }
.practice-output p  { margin-bottom: 0.75rem; }
.practice-output ul,
.practice-output ol { padding-left: 1.25rem; margin-bottom: 0.75rem; }
.practice-output li { margin-bottom: 0.3rem; }
.practice-output strong { color: var(--text); }
.thinking-dots {
  display: inline-block;
  font-size: 1.25rem;
  color: var(--faint);
  animation: blink 1.2s step-start infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.2} }

@media (max-width: 600px) {
  .practice-main { padding: 1.25rem 1rem 3rem; }
  .practice-tabs { gap: 0.25rem; }
  .practice-tab  { font-size: 0.75rem; padding: 0.35rem 0.7rem; }
  .practice-actions { flex-wrap: wrap; }
  .practice-hint { display: none; }
}

/* ══ PRICING PAGE ════════════════════════════════════════════════════════ */
.pricing-page { min-height: 100vh; display: flex; flex-direction: column; }
.pricing-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  flex: 1;
}
.pricing-hero { text-align: center; padding: 2rem 0 2.5rem; }
.pricing-title {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.pricing-sub { font-size: 1.0625rem; color: var(--muted); }

.pricing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  align-items: start;
}
.pricing-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 1.75rem 1.5rem;
  position: relative;
}
.pricing-card-featured {
  border-color: var(--primary);
  box-shadow: 0 8px 32px rgba(16,96,168,0.12);
}
.pricing-card-current { border-color: #10b981; }
.pricing-popular {
  position: absolute;
  top: -0.875rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.25rem 0.875rem;
  border-radius: 9999px;
  white-space: nowrap;
}
.pricing-tier {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.pricing-price {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 0.5rem;
  line-height: 1;
}
.pricing-per { font-size: 1rem; font-weight: 400; color: var(--muted); }
.pricing-tagline {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}
.pricing-features {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.pricing-features li {
  font-size: 0.875rem;
  color: var(--text);
  padding-left: 1.375rem;
  position: relative;
  line-height: 1.4;
}
.pricing-features li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.8125rem;
}
.pricing-cta { margin-top: auto; }
.pricing-current-note {
  display: block;
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted);
  padding: 0.75rem;
}
.pricing-manage-link {
  display: block;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted);
  text-decoration: none;
  margin-top: 0.625rem;
  transition: color 0.15s;
}
.pricing-manage-link:hover { color: var(--red); }
.pricing-downgrade-note {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  margin-top: 0.5rem;
  line-height: 1.4;
}
.pricing-note {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 2rem;
  line-height: 1.6;
}
.pricing-note a { color: var(--primary); }

@media (max-width: 700px) {
  .pricing-grid { grid-template-columns: 1fr; max-width: 420px; margin: 0 auto; }
}

/* ══ UPGRADE BANNER ══════════════════════════════════════════════════════ */
.upgrade-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, #f0f6ff, #e8f0fe);
  border: 1.5px solid #c7deff;
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 0.875rem 1.125rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
}
.upgrade-banner-text { flex: 1; color: var(--text); line-height: 1.4; }
.upgrade-banner-text strong { color: var(--primary); }
.upgrade-banner .btn { flex-shrink: 0; padding: 0.4rem 0.875rem; font-size: 0.8125rem; }

/* ══ VOICE RECORDER ══════════════════════════════════════════════════════ */
.voice-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; }
.voice-recorder {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
}
.voice-status {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}
.voice-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}
.voice-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: all 0.15s;
}
.voice-btn-record { background: var(--primary); color: #fff; }
.voice-btn-record:hover { background: var(--primary-dark); transform: scale(1.03); }
.voice-btn-stop { background: var(--red); color: #fff; }
.voice-btn-stop:hover { background: #991b1b; }
.voice-timer {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--red);
  font-variant-numeric: tabular-nums;
  min-width: 3rem;
}
.voice-pronounce-box {
  background: #f0f6ff;
  border: 1.5px solid #c7deff;
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
  margin-bottom: 1rem;
}

/* ══ UPGRADE SUCCESS BANNER ═════════════════════════ */
.upgrade-success-banner {
  background: linear-gradient(135deg, #0a3d6b, #1472be);
  color: #fff;
  border-radius: var(--radius);
  padding: 0.875rem 1.125rem;
  font-size: 0.9375rem;
  font-weight: 500;
  margin-bottom: 1rem;
  animation: slideDown 0.4s ease;
}
.upgrade-success-banner a { color: rgba(255,255,255,0.9); text-decoration: underline; }
.upgrade-success-banner a:hover { color: #fff; }

/* ══ BETA BANNER (public pages) ══════════════════════ */
.beta-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  background: linear-gradient(135deg, #0a3d6b, #1060a8);
  color: #fff;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  text-align: center;
}
.beta-badge {
  background: rgba(255,255,255,0.2);
  border: 1.5px solid rgba(255,255,255,0.45);
  border-radius: 4px;
  padding: 0.1rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.beta-banner-text { line-height: 1.5; }
.beta-banner-text strong { color: #fff; }
.beta-banner-text a { color: rgba(255,255,255,0.9); font-weight: 600; text-decoration: underline; margin-left: 0.375rem; }
.beta-banner-text a:hover { color: #fff; }

/* ══ BETA TRIAL NOTICE (logged-in tutor page) ════════ */
.beta-trial-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: #f0f6ff;
  border: 1px solid #c7dbf8;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: #1a3a6b;
  margin-bottom: 1rem;
}
.beta-trial-notice strong { color: #1060a8; }
.beta-trial-notice a { color: #1060a8; font-weight: 600; text-decoration: underline; white-space: nowrap; }
.beta-trial-notice a:hover { color: #0a3d6b; }
[data-theme="dark"] .beta-trial-notice { background: #0d2a4d; border-color: #1a4a8a; color: #93c5fd; }
[data-theme="dark"] .beta-trial-notice strong { color: #60a5fa; }
[data-theme="dark"] .beta-trial-notice a { color: #60a5fa; }

/* ══ PWA INSTALL BANNER ══════════════════════════════ */
.pwa-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: linear-gradient(135deg, #0a3d6b, #1472be);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.875rem;
  animation: slideDown 0.3s ease;
}
.pwa-banner-text { flex: 1; line-height: 1.4; }
.pwa-banner-btn  { padding: 0.375rem 0.875rem; font-size: 0.8125rem; background: rgba(255,255,255,0.2); border: 1.5px solid rgba(255,255,255,0.4); }
.pwa-banner-btn:hover { background: rgba(255,255,255,0.35); }
.pwa-banner-close { background: none; border: none; color: rgba(255,255,255,0.7); font-size: 1rem; cursor: pointer; padding: 0 0.25rem; }
.pwa-banner-close:hover { color: #fff; }

/* ══ TUTOR PAGE ANIMATIONS ═══════════════════════════ */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.exchange     { animation: fadeIn 0.25s ease; }
.response-card { animation: fadeIn 0.3s ease; }

/* Smooth textarea auto-resize */
.conv-input, .practice-input { transition: height 0.1s ease; }

/* ══ DARK MODE REFINEMENTS ═══════════════════════════ */
[data-theme="dark"] .header          { background: #1a1d27; border-bottom-color: #2a2d3a; }
[data-theme="dark"] .auth-page       { background: linear-gradient(135deg, #0a0e1a, #0f1525); }
[data-theme="dark"] .pricing-card    { background: #1a1d27; border-color: #2a2d3a; }
[data-theme="dark"] .explain-page    { background: #0f1117; }
[data-theme="dark"] .explain-header  { background: #1a1d27; border-bottom-color: #2a2d3a; }
[data-theme="dark"] .daily-phrase    { background: #1a1d27; border-color: #2a2d3a; }
[data-theme="dark"] .upgrade-banner  { background: linear-gradient(135deg, #0d2a4d, #0d3a6b); border-color: #1a4a8a; }
[data-theme="dark"] .input           { background: #1a1d27; color: var(--text); border-color: #2a2d3a; }
[data-theme="dark"] .input:focus     { border-color: var(--primary); background: #1e2235; }
[data-theme="dark"] .btn-ghost       { background: #1a1d27; border-color: #2a2d3a; color: var(--muted); }
[data-theme="dark"] .btn-ghost:hover { background: #2a2d3a; }
[data-theme="dark"] .section-label   { background: #1a2a4a; }
[data-theme="dark"] .tag-chip        { background: #1a2a4a; }
[data-theme="dark"] .next-read-card  { background: #1a1d27; }
[data-theme="dark"] .sub-card        { border-color: #2a2d3a; }
[data-theme="dark"] .sub-actions     { background: #0f1117; border-color: #2a2d3a; }
[data-theme="dark"] .settings-section { background: #1a1d27; border-color: #2a2d3a; }
[data-theme="dark"] .conv-bubble     { border-color: #2a2d3a; }

/* ══ BILLING TOGGLE ══════════════════════════════════ */
.pricing-billing-toggle {
  display: inline-flex;
  background: var(--stone);
  border-radius: 9999px;
  padding: 3px;
  margin-top: 1.25rem;
  gap: 2px;
}
.billing-btn {
  padding: .4rem 1.125rem;
  border-radius: 9999px;
  border: none;
  background: none;
  font-size: .875rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: .375rem;
}
.billing-btn.active { background: var(--white); color: var(--text); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.billing-save { font-size: .6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #16a34a; background: #dcfce7; border-radius: 9999px; padding: 1px 6px; }

/* ══ PRICING TEAM + FAQ ══════════════════════════════ */
.pricing-team {
  margin-top: 2.5rem;
  background: var(--stone);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}
.pricing-team-inner { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.pricing-team-label { font-size: .875rem; font-weight: 700; color: var(--text); margin-bottom: .25rem; }
.pricing-team-desc  { font-size: .875rem; color: var(--muted); line-height: 1.5; }
.pricing-faq { margin-top: 2.5rem; display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
.pricing-faq-item { padding: 1.25rem; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); }
.pricing-faq-item strong { font-size: .9375rem; color: var(--text); display: block; margin-bottom: .375rem; }
.pricing-faq-item p { font-size: .875rem; color: var(--muted); line-height: 1.55; margin: 0; }
@media (max-width: 600px) { .pricing-faq { grid-template-columns: 1fr; } }

/* ══ REFERRAL BOX ════════════════════════════════════ */
.referral-box {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--stone);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
}
.referral-link {
  flex: 1;
  font-size: .875rem;
  color: var(--primary);
  font-family: monospace;
  word-break: break-all;
  min-width: 0;
}
