/* ========================================
   About R — Growth Intelligence Network
   Minimal · Quiet · Growth
   ======================================== */

/* ============ Theme Variables ============ */
:root {
  /* Light theme */
  --bg: #FAFAF8;
  --bg-card: #FFFFFF;
  --bg-elevated: #F5F5F3;
  --bg-hover: #F0F0EE;
  --text-primary: #1A1A1A;
  --text-secondary: #6B6B6B;
  --text-tertiary: #A0A0A0;
  --border: #E8E8E5;
  --border-strong: #D5D5D2;

  /* Brand colors */
  --green: #1B4332;
  --green-light: #2D6A4F;
  --green-pale: #D8F3DC;
  --green-bg: #F0F7F2;
  --blue: #1A2A4A;
  --blue-light: #2C4A7C;
  --blue-pale: #D6E0F0;
  --blue-bg: #EEF3FA;
  --amber: #B7791F;
  --amber-pale: #FEF3C7;
  --red: #B91C1C;
  --red-pale: #FEE2E2;

  /* Progress bar */
  --progress-track: #E8E8E5;
  --progress-fill-green: #2D6A4F;
  --progress-fill-blue: #2C4A7C;
  --progress-fill-amber: #D4A017;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Typography */
  --font-serif: Georgia, 'Times New Roman', 'Noto Serif SC', serif;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
}

[data-theme="dark"] {
  --bg: #131316;
  --bg-card: #1C1C20;
  --bg-elevated: #252529;
  --bg-hover: #2E2E33;
  --text-primary: #E8E8E5;
  --text-secondary: #9A9A98;
  --text-tertiary: #5A5A58;
  --border: #2E2E33;
  --border-strong: #3A3A3E;

  --green: #52B788;
  --green-light: #74C69D;
  --green-pale: #1B3A2B;
  --green-bg: #182520;
  --blue: #7B9FD4;
  --blue-light: #9DB8E8;
  --blue-pale: #1A2A40;
  --blue-bg: #161E2E;

  --progress-track: #2E2E33;
  --progress-fill-green: #52B788;
  --progress-fill-blue: #7B9FD4;
  --progress-fill-amber: #E0B84C;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.3);
}

/* ============ Reset ============ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  transition: background 0.3s, color 0.3s;
  overscroll-behavior-y: none;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
svg { display: block; }

/* ============ App Container ============ */
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ============ Top Bar ============ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 0.5px solid transparent;
  transition: border-color 0.2s;
}
.topbar.scrolled { border-bottom-color: var(--border); }
.topbar-brand {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--green);
}
[data-theme="dark"] .topbar-brand { color: var(--green-light); }
.topbar-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: background 0.2s, color 0.2s;
}
.topbar-btn:active { background: var(--bg-hover); }

/* ============ Page Container ============ */
.page-container {
  flex: 1;
  padding: 8px 20px 100px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ Bottom Tab Bar ============ */
.tabbar {
  position: fixed;
  bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  display: flex;
  background: var(--bg-card);
  border-top: 0.5px solid var(--border);
  padding: 6px 0;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
  z-index: 100;
}
.tab-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 0;
  color: var(--text-tertiary);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.3px;
  transition: color 0.2s;
}
.tab-item.active { color: var(--green); }
[data-theme="dark"] .tab-item.active { color: var(--green-light); }
.tab-item span { font-size: 0.68rem; }

/* ============ Typography ============ */
.serif { font-family: var(--font-serif); }
.mono { font-family: var(--font-mono); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }

/* ============ Dashboard / Today Page ============ */
.dashboard-header {
  padding: 20px 0 24px;
}
.dashboard-greeting {
  font-family: var(--font-serif);
  font-size: 0.82rem;
  color: var(--text-tertiary);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.dashboard-title {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.dashboard-date {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  letter-spacing: 0.5px;
}
.dashboard-pieces {
  margin-top: 16px;
  display: flex; align-items: baseline; gap: 6px;
}
.dashboard-pieces-num {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--green);
  line-height: 1;
}
[data-theme="dark"] .dashboard-pieces-num { color: var(--green-light); }
.dashboard-pieces-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ============ Section ============ */
.section { margin-bottom: 28px; }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 2px;
}
.section-title-row {
  display: flex; align-items: center; gap: 8px;
}
.section-icon { font-size: 1.1rem; }
.section-title {
  font-family: var(--font-serif);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.3px;
}
.section-subtitle {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin-top: 1px;
}
.section-link {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  text-decoration: none;
}

/* ============ Progress Bar ============ */
.progress-item {
  margin-bottom: 14px;
}
.progress-item:last-child { margin-bottom: 0; }
.progress-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
}
.progress-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}
.progress-emoji { font-size: 0.9rem; }
.progress-value {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 600;
}
.progress-track {
  height: 6px;
  background: var(--progress-track);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.progress-fill.green { background: var(--progress-fill-green); }
.progress-fill.blue { background: var(--progress-fill-blue); }
.progress-fill.amber { background: var(--progress-fill-amber); }
.progress-fill::after {
  content: '';
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 20px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3));
}

/* ============ Card ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 10px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.card:active {
  transform: scale(0.98);
}
.card-tappable { cursor: pointer; }

.card-row {
  display: flex; align-items: center; justify-content: space-between;
}
.card-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}
.card-subtitle {
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-top: 2px;
}
.card-meta {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* ============ Checkbox ============ */
.check-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.check-card:active { transform: scale(0.98); }
.check-card.done {
  background: var(--green-bg);
  border-color: var(--green-pale);
}
.check-card.done .check-label {
  text-decoration: line-through;
  color: var(--text-tertiary);
}

.check-box {
  width: 22px; height: 22px;
  border: 2px solid var(--border-strong);
  border-radius: 6px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.check-card.done .check-box {
  background: var(--green);
  border-color: var(--green);
}
[data-theme="dark"] .check-card.done .check-box {
  background: var(--green-light);
  border-color: var(--green-light);
}
.check-box svg { opacity: 0; transition: opacity 0.2s; }
.check-card.done .check-box svg { opacity: 1; }

.check-content { flex: 1; min-width: 0; }
.check-label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  transition: all 0.2s;
}
.check-detail {
  font-size: 0.74rem;
  color: var(--text-secondary);
  margin-top: 2px;
}
.check-time {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-tertiary);
}

/* ============ World Brief Card ============ */
.brief-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}
.brief-category {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}
.brief-category.tech { background: var(--blue-pale); color: var(--blue); }
.brief-category.finance { background: var(--amber-pale); color: var(--amber); }
.brief-category.global { background: var(--green-pale); color: var(--green); }
[data-theme="dark"] .brief-category.tech { color: var(--blue-light); }
[data-theme="dark"] .brief-category.finance { color: #E0B84C; }
[data-theme="dark"] .brief-category.global { color: var(--green-light); }

.brief-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.4;
}
.brief-title-zh {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.4;
}
.brief-field {
  margin-bottom: 8px;
}
.brief-field:last-child { margin-bottom: 0; }
.brief-field-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}
.brief-field-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.55;
}
.brief-field-zh {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  line-height: 1.55;
  margin-top: 3px;
}

/* ============ World Status Bar ============ */
.world-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0 4px;
}
.world-updated {
  font-size: 0.72rem;
  color: var(--text-tertiary);
}
.world-refresh-btn {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--green);
  background: var(--green-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
}
.world-refresh-btn:active {
  transform: scale(0.96);
  background: var(--green-pale);
}
[data-theme="dark"] .world-refresh-btn {
  color: var(--green-light);
  background: var(--green-bg);
}

/* ============ Live Headlines Strip ============ */
.headline-strip {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  min-height: 48px;
  align-items: stretch;
}
.headline-strip.headline-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.headline-loading-text {
  font-size: 0.78rem;
  color: var(--text-tertiary);
}
.headline-failed {
  border-color: var(--red-pale);
}
.headline-strip-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font-size: 0.78rem;
  color: var(--text-tertiary);
}
.headline-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.headline-item:last-child {
  border-bottom: none;
}
.headline-item:active {
  background: var(--bg-hover);
}
.headline-source {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
}
.headline-text {
  font-size: 0.82rem;
  color: var(--text-primary);
  line-height: 1.4;
}

/* ============ Module Header (Learn sub-pages) ============ */
.module-header {
  padding: 16px 0 20px;
}
.module-icon { font-size: 1.6rem; margin-bottom: 6px; }
.module-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.module-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* ============ Stat Display ============ */
.stat-row {
  display: flex; gap: 16px;
  margin-bottom: 16px;
}
.stat-item { flex: 1; }
.stat-value {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--green);
  line-height: 1;
}
[data-theme="dark"] .stat-value { color: var(--green-light); }
.stat-label {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}
.stat-unit {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

/* ============ Form Elements ============ */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.form-input, .form-textarea, .form-select {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.88rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--green-light);
}
.form-textarea {
  resize: none;
  min-height: 72px;
  line-height: 1.5;
}
.form-hint {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* Chip selector */
.chip-group {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.chip {
  padding: 5px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: transparent;
  transition: all 0.2s;
  cursor: pointer;
}
.chip.active {
  background: var(--green);
  border-color: var(--green);
  color: white;
}
[data-theme="dark"] .chip.active {
  background: var(--green-light);
  border-color: var(--green-light);
  color: var(--bg);
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--green);
  color: white;
}
[data-theme="dark"] .btn-primary {
  background: var(--green-light);
  color: var(--bg);
}
.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red-pale);
}
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; }

/* ============ FAB / Add Button ============ */
.fab {
  position: fixed;
  bottom: 80px; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  display: flex; justify-content: center;
  z-index: 50;
  pointer-events: none;
}
.fab-btn {
  pointer-events: auto;
  display: flex; align-items: center; gap: 6px;
  padding: 10px 24px;
  background: var(--green);
  color: white;
  border-radius: 24px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  transition: all 0.2s;
}
[data-theme="dark"] .fab-btn {
  background: var(--green-light);
  color: var(--bg);
}
.fab-btn:active { transform: scale(0.95); }

/* ============ Reflection Page ============ */
.reflection-prompt {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 16px;
  font-style: italic;
}
.reflection-textarea {
  width: 100%;
  min-height: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text-primary);
  outline: none;
  resize: none;
  transition: border-color 0.2s;
}
.reflection-textarea:focus { border-color: var(--green-light); }
.reflection-textarea::placeholder {
  color: var(--text-tertiary);
  font-style: italic;
}

/* ============ Timeline ============ */
.timeline-date {
  font-family: var(--font-serif);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 20px 0 8px;
  padding: 0 2px;
}
.timeline-date:first-child { margin-top: 0; }

.timeline-entry {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 8px;
  position: relative;
}
.timeline-entry-type {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}
.timeline-entry-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.timeline-entry-content {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.55;
}
.timeline-entry-time {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-tertiary);
  margin-top: 6px;
}
.timeline-entry-delete {
  position: absolute; top: 10px; right: 10px;
  width: 24px; height: 24px;
  display: none;
  align-items: center; justify-content: center;
  border-radius: 6px;
  color: var(--text-tertiary);
}
.timeline-entry:active .timeline-entry-delete { display: flex; }
.timeline-entry-delete:active { color: var(--red); }

/* ============ Empty State ============ */
.empty-state {
  text-align: center;
  padding: 40px 20px;
}
.empty-icon { font-size: 2rem; margin-bottom: 8px; opacity: 0.5; }
.empty-text {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  font-style: italic;
}

/* ============ Modal ============ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.modal {
  width: 100%; max-width: 480px;
  background: var(--bg-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 8px 20px 32px;
  padding-bottom: max(32px, env(safe-area-inset-bottom));
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-handle {
  width: 36px; height: 4px;
  background: var(--border-strong);
  border-radius: 2px;
  margin: 0 auto 12px;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.modal-close {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
}
.modal-close:active { background: var(--bg-hover); }

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 100px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text-primary);
  color: var(--bg);
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s;
  z-index: 300;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============ Learn Sub-Tab ============ */
.sub-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.sub-tabs::-webkit-scrollbar { display: none; }
.sub-tab {
  padding: 10px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-tertiary);
  white-space: nowrap;
  position: relative;
  transition: color 0.2s;
  flex-shrink: 0;
}
.sub-tab.active { color: var(--green); }
[data-theme="dark"] .sub-tab.active { color: var(--green-light); }
.sub-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 14px; right: 14px;
  height: 2px;
  background: var(--green);
  border-radius: 1px;
}
[data-theme="dark"] .sub-tab.active::after { background: var(--green-light); }

/* ============ Speaking Scenario Card ============ */
.scenario-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}
.scenario-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--blue-pale);
  color: var(--blue);
  margin-bottom: 8px;
}
[data-theme="dark"] .scenario-badge { color: var(--blue-light); }
.scenario-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.scenario-section { margin-bottom: 12px; }
.scenario-section:last-child { margin-bottom: 0; }
.scenario-section-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.scenario-phrase {
  font-size: 0.85rem;
  color: var(--text-primary);
  padding: 8px 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
}
.scenario-phrase-en {
  font-family: var(--font-serif);
  font-style: italic;
}
.scenario-phrase-zh {
  font-size: 0.76rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ============ Speaking: Scenario Detail ============ */
.scenario-title-zh {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.scenario-scene {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 8px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--green-light);
}
.scenario-goal {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.scenario-goal strong {
  color: var(--green);
  font-weight: 600;
}
[data-theme="dark"] .scenario-goal strong { color: var(--green-light); }

/* ============ Speaking: Vocabulary Cards ============ */
.vocab-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.vocab-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  transition: border-color 0.2s;
}
.vocab-card:active {
  border-color: var(--green-light);
}
.vocab-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.vocab-en {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}
.vocab-ipa {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin-top: 2px;
  font-family: monospace;
}
.vocab-zh {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}
.vocab-example {
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  line-height: 1.5;
  font-style: italic;
}

/* ============ TTS Buttons ============ */
.tts-btn {
  flex-shrink: 0;
  background: var(--green-bg);
  border: 1px solid var(--green-pale);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.tts-btn:active {
  transform: scale(0.9);
  background: var(--green-pale);
}
[data-theme="dark"] .tts-btn {
  background: rgba(45,106,79,0.15);
  border-color: rgba(45,106,79,0.3);
}
.tts-btn-inline {
  background: none;
  border: none;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0 2px;
  -webkit-tap-highlight-color: transparent;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.tts-btn-inline:active {
  opacity: 1;
  transform: scale(1.2);
}

/* ============ TTS Speed Control ============ */
.speed-control {
  display: flex;
  align-items: center;
  gap: 4px;
}
.speed-label {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  margin-right: 2px;
}
.speed-btn {
  border: 1px solid var(--border-light);
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.2s;
}
.speed-btn.active {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}
.speed-btn:active {
  transform: scale(0.92);
}

/* ============ Speaking: Dialogue Bubbles ============ */
.dialogue-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dialogue-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
}
.dialogue-other {
  align-self: flex-start;
  background: var(--bg-elevated);
  border-bottom-left-radius: 4px;
}
.dialogue-you {
  align-self: flex-end;
  background: var(--green-bg);
  border: 1px solid var(--green-pale);
  border-bottom-right-radius: 4px;
}
[data-theme="dark"] .dialogue-you {
  background: rgba(45,106,79,0.12);
  border-color: rgba(45,106,79,0.25);
}
.dialogue-speaker {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 3px;
}
.dialogue-en {
  color: var(--text-primary);
  line-height: 1.45;
}
.dialogue-zh {
  font-size: 0.74rem;
  color: var(--text-tertiary);
  margin-top: 3px;
  line-height: 1.4;
}

/* ============ Speaking: Recording ============ */
.recording-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}
.recording-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.rec-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.rec-btn:active {
  transform: scale(0.96);
}
.rec-start-btn {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.rec-start-btn:active {
  background: var(--green-light);
}
.rec-stop-btn {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.rec-play-btn {
  background: var(--blue-bg);
  color: var(--blue);
  border-color: var(--blue-pale);
}
[data-theme="dark"] .rec-play-btn {
  color: var(--blue-light);
}
.rec-download-btn {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}
.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  display: inline-block;
  animation: rec-pulse 1.5s infinite;
}
@keyframes rec-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.rec-status {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  line-height: 1.4;
}

/* ============ Current Reading Card ============ */
.reading-now {
  background: var(--green-bg);
  border: 1px solid var(--green-pale);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}
.reading-now-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
[data-theme="dark"] .reading-now-label { color: var(--green-light); }
.reading-now-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}

/* ============ Streak Display ============ */
.streak-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--amber);
  background: var(--amber-pale);
  padding: 4px 10px;
  border-radius: 20px;
}
[data-theme="dark"] .streak-badge { color: #E0B84C; }

/* ============ Utilities ============ */
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.opacity-50 { opacity: 0.5; }
.hidden { display: none !important; }

/* ===== English Learning Module (added) ===== */
.progress-fill.purple { background: #7C5CBF; }
[data-theme="dark"] .progress-fill.purple { background: #A78BDB; }

/* Button variants */
.btn-sm { padding: 6px 12px; font-size: 0.78rem; border-radius: 10px; }
.btn-warning { background: var(--progress-fill-amber); color: #1A1A1A; border: none; border-radius: 12px; padding: 10px 14px; font-weight: 600; cursor: pointer; }

/* News Reading */
.news-card { background: var(--card-bg, #fff); border: 1px solid var(--border-color, #eee); border-radius: 14px; padding: 14px; margin-bottom: 14px; }
.news-card.read { opacity: 0.78; }
.news-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.news-source { font-size: 0.72rem; color: var(--text-tertiary, #888); }
.news-title { font-size: 0.95rem; font-weight: 700; margin-top: 2px; }
.news-read-badge { background: var(--progress-fill-green); color: #fff; border-radius: 50%; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; flex: 0 0 auto; }
.news-body { margin: 10px 0; font-size: 0.88rem; line-height: 1.6; color: var(--text-secondary, #444); }
.news-body p { margin: 0 0 8px; }
.news-word { color: inherit; cursor: pointer; padding: 0 1px; border-radius: 3px; transition: background 0.15s; }
.news-word:active { background: rgba(124,92,191,0.15); }
.news-word.vocab-highlighted { color: var(--accent, #1B4332); font-weight: 700; border-bottom: 2px dotted var(--accent, #1B4332); }
.news-word-demo { color: #7C5CBF; border-bottom: 2px dotted #7C5CBF; font-weight: 700; }
.news-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.news-hint { font-size: 0.72rem; color: var(--text-tertiary, #888); }

/* Vocabulary Bank tree */
.vocab-year { font-weight: 800; font-size: 1rem; margin: 14px 0 4px; color: var(--text-primary, #222); }
.vocab-month { font-weight: 700; font-size: 0.86rem; margin: 8px 0 6px; color: var(--text-secondary, #555); }
.vocab-month-count { color: var(--text-tertiary, #999); font-weight: 500; }
.vocab-words { display: flex; flex-wrap: wrap; gap: 8px; }
.vocab-chip { background: var(--bg-secondary, #f4f6f5); border: 1px solid var(--border-color, #e6e9e8); border-radius: 10px; padding: 6px 10px; display: flex; flex-direction: column; max-width: 48%; }
.vocab-chip.mastered { border-color: var(--progress-fill-green); background: rgba(45,106,79,0.08); }
.vocab-chip-word { font-weight: 700; font-size: 0.85rem; }
.vocab-chip-meaning { font-size: 0.74rem; color: var(--text-secondary, #555); }
.vocab-chip-src { font-size: 0.66rem; color: var(--text-tertiary, #999); margin-top: 2px; }

/* Review Center */
.review-card { background: var(--card-bg, #fff); border: 1px solid var(--border-color, #eee); border-radius: 16px; padding: 18px; text-align: center; margin-bottom: 12px; }
.review-stars { color: #D4A017; font-size: 1.1rem; letter-spacing: 2px; }
.review-word { font-size: 1.8rem; font-weight: 800; margin: 6px 0 2px; }
.review-meta { font-size: 0.74rem; color: var(--text-tertiary, #999); margin-bottom: 6px; }
.review-answer { margin-top: 12px; text-align: left; }
.review-meaning { font-size: 1rem; font-weight: 600; }
.review-example { font-size: 0.82rem; color: var(--text-secondary, #555); font-style: italic; margin-top: 4px; }
.review-actions { display: flex; gap: 8px; margin-top: 12px; }
.review-actions .btn { flex: 1; }
.review-progress { font-size: 0.72rem; color: var(--text-tertiary, #999); margin-top: 10px; }
.review-list { display: flex; flex-direction: column; gap: 6px; }
.review-list-item { background: var(--bg-secondary, #f4f6f5); border-radius: 10px; padding: 8px 12px; font-size: 0.85rem; }
.review-list-src { font-size: 0.7rem; color: var(--text-tertiary, #999); margin-left: 6px; }

/* Speaking scoring */
.scoring-card { background: var(--card-bg, #fff); border: 1px solid var(--border-color, #eee); border-radius: 14px; padding: 14px; }
.score-summary { margin-top: 12px; }
.score-overall { font-size: 2.4rem; font-weight: 800; text-align: center; color: var(--accent, #1B4332); }
.score-overall span { font-size: 1rem; color: var(--text-tertiary, #999); margin-left: 4px; }
.score-bars { margin: 12px 0; }
.score-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.score-bar-label { width: 90px; font-size: 0.78rem; color: var(--text-secondary, #555); flex: 0 0 auto; }
.score-bar-track { flex: 1; height: 8px; background: var(--bg-secondary, #eee); border-radius: 6px; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 6px; transition: width 0.4s ease; }
.score-bar-fill.green { background: var(--progress-fill-green); }
.score-bar-fill.amber { background: var(--progress-fill-amber); }
.score-bar-fill.red { background: #C1121F; }
.score-bar-val { width: 28px; text-align: right; font-size: 0.78rem; font-weight: 700; flex: 0 0 auto; }
.score-feedback { background: var(--bg-secondary, #f4f6f5); border-radius: 12px; padding: 12px; font-size: 0.82rem; line-height: 1.5; }
.fb-item { margin-bottom: 6px; }
.fb-item:last-child { margin-bottom: 0; }

/* Learning Progress */
.daily-fragment { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.fragment-row { display: flex; align-items: center; gap: 10px; }
.fragment-icon { font-size: 1.1rem; }
.fragment-label { flex: 1; font-size: 0.88rem; color: var(--text-secondary, #555); }
.fragment-value { font-weight: 700; font-size: 0.9rem; }
.growth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.growth-card { background: var(--card-bg, #fff); border: 1px solid var(--border-color, #eee); border-radius: 14px; padding: 14px; }
.growth-icon { font-size: 1.3rem; }
.growth-value { font-size: 1.2rem; font-weight: 800; margin: 4px 0 2px; }
.growth-label { font-size: 0.76rem; color: var(--text-tertiary, #999); margin-bottom: 8px; }
.growth-track { height: 6px; background: var(--bg-secondary, #eee); border-radius: 6px; overflow: hidden; }
.growth-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, #1B4332, #52B788); }

/* Word popover (News -> Vocabulary) */
.word-popover { position: fixed; inset: 0; background: rgba(0,0,0,0.35); display: none; align-items: flex-end; justify-content: center; z-index: 200; }
.word-popover.active { display: flex; }
.word-popover-card { background: var(--card-bg, #fff); width: 100%; max-width: 480px; border-radius: 18px 18px 0 0; padding: 20px; animation: popUp 0.2s ease; }
@keyframes popUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.wp-word { font-size: 1.5rem; font-weight: 800; }
.wp-meaning { font-size: 0.95rem; color: var(--text-secondary, #555); margin: 6px 0 14px; }
.wp-loading { color: var(--text-tertiary, #999); font-style: italic; }
.wp-no-result { color: var(--text-tertiary, #999); font-style: italic; }
.wp-input { outline: none; }
.wp-actions { display: flex; gap: 8px; }
.wp-actions .btn { flex: 1; }
