/* ============================================
   GratitudeWire — Neuroscience Gratitude PWA
   Mobile-first • Dark/Light • Premium Feel
   ============================================ */

/* ---------- CSS Variables ---------- */
:root {
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.12);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.18);
  --nav-height: 72px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --accent-gradient: linear-gradient(135deg, #7c3aed 0%, #2563eb 50%, #06b6d4 100%);
  --accent: #7c3aed;
  --accent-2: #2563eb;
  --accent-3: #06b6d4;
  --pink: #f472b6;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
}

[data-theme="dark"] {
  --bg: #0a0a1a;
  --bg-2: #12122a;
  --bg-3: #1a1a3e;
  --bg-card: rgba(26, 26, 62, 0.7);
  --bg-card-solid: #1a1a3e;
  --text: #f0f0ff;
  --text-2: #a0a0c0;
  --text-3: #6060a0;
  --border: rgba(124, 58, 237, 0.15);
  --border-2: rgba(124, 58, 237, 0.3);
  --glass: rgba(26, 26, 62, 0.6);
  --glass-border: rgba(124, 58, 237, 0.2);
  --input-bg: rgba(18, 18, 42, 0.8);
  --shadow-glow: 0 0 30px rgba(124, 58, 237, 0.3);
}

[data-theme="light"] {
  --bg: #f8f7ff;
  --bg-2: #efeeff;
  --bg-3: #e4e2ff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-solid: #ffffff;
  --text: #1a1a2e;
  --text-2: #4a4a6a;
  --text-3: #8a8aaa;
  --border: rgba(124, 58, 237, 0.1);
  --border-2: rgba(124, 58, 237, 0.2);
  --glass: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(124, 58, 237, 0.15);
  --input-bg: rgba(255, 255, 255, 0.9);
  --shadow-glow: 0 0 30px rgba(124, 58, 237, 0.15);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-tap-highlight-color: transparent; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
button { cursor: pointer; font-family: var(--font); }
input, textarea, select { font-family: var(--font); }

/* ---------- Views ---------- */
.view {
  min-height: 100dvh;
  animation: fadeIn 0.3s ease;
}

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

/* ---------- Loading Screen ---------- */
.loading-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 9999;
  transition: opacity 0.5s ease;
}
.loading-screen.fade-out { opacity: 0; pointer-events: none; }
.loading-brain { width: 80px; height: 80px; }
.brain-svg { width: 100%; height: 100%; }
.brain-path { animation: brainPulse 1.5s ease-in-out infinite; }
.neuron-dot { animation: neuronGlow 1.5s ease-in-out infinite alternate; }
@keyframes brainPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}
@keyframes neuronGlow {
  0% { r: 1.5; opacity: 0.4; }
  100% { r: 3; opacity: 1; }
}
.loading-text { margin-top: 16px; color: var(--text-2); font-size: 0.875rem; }

/* ---------- Gradient Text ---------- */
.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-glow); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border-2);
}
.btn-secondary:hover { background: var(--border-2); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger {
  background: rgba(248, 113, 113, 0.15);
  color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.3);
}
.btn-danger:hover { background: rgba(248, 113, 113, 0.25); }

.btn-lg { padding: 16px 32px; font-size: 1.1rem; border-radius: var(--radius); }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-full { width: 100%; }
.btn-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--bg-card);
  border-radius: 50%;
  color: var(--text);
  transition: all var(--transition);
}
.btn-icon:hover { background: var(--bg-3); }
.btn-back {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--text);
  border-radius: 50%;
  transition: all var(--transition);
}
.btn-back:hover { background: var(--bg-3); }

.btn-glow::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: var(--accent-gradient);
  z-index: -1;
  filter: blur(12px);
  opacity: 0.4;
  transition: opacity var(--transition);
}
.btn-glow:hover::after { opacity: 0.7; }

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Welcome / Landing ---------- */
.welcome-container {
  padding: 40px 20px 60px;
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}
.welcome-hero { display: flex; flex-direction: column; align-items: center; gap: 24px; }
.hero-brain-anim { width: 200px; height: 200px; margin: 0 auto; }
.hero-title { font-size: 2.4rem; font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; }
.hero-subtitle { font-size: 1.1rem; color: var(--text-2); max-width: 480px; line-height: 1.6; }

/* Social proof counter */
.social-proof {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  width: 100%;
}
.proof-item { text-align: center; }
.proof-number { font-size: 1.5rem; font-weight: 800; color: var(--text); display: inline; }
.proof-suffix { font-size: 1.5rem; font-weight: 800; color: var(--text); }
.proof-label { display: block; font-size: 0.7rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }
.proof-divider { width: 1px; height: 36px; background: var(--border); }

/* Science cards */
.science-cards { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.science-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: left;
  backdrop-filter: blur(20px);
  transition: all var(--transition);
}
.science-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-glow); }
.sc-icon { font-size: 1.8rem; flex-shrink: 0; }
.sc-weeks { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); font-weight: 700; }
.sc-title { font-size: 1rem; font-weight: 700; margin: 2px 0; }
.sc-desc { font-size: 0.85rem; color: var(--text-2); line-height: 1.5; }

.welcome-cta { display: flex; flex-direction: column; gap: 12px; width: 100%; margin-top: 8px; }
.welcome-footnote { font-size: 0.75rem; color: var(--text-3); }

/* ---------- Auth ---------- */
.auth-container {
  padding: 60px 24px 40px;
  max-width: 440px;
  margin: 0 auto;
}
.auth-header { text-align: center; margin-bottom: 32px; }
.auth-header h1 { font-size: 1.8rem; font-weight: 800; }
.auth-header p { color: var(--text-2); margin-top: 4px; }
.auth-form { display: flex; flex-direction: column; gap: 20px; }
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-group label { font-size: 0.85rem; font-weight: 600; color: var(--text-2); }
.input-group input {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  font-size: 1rem;
  transition: border-color var(--transition);
  outline: none;
}
.input-group input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,58,237,0.15); }
.input-group input::placeholder { color: var(--text-3); }
.optional { font-weight: 400; color: var(--text-3); }
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-3);
  font-size: 0.85rem;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-google {
  background: var(--bg-card-solid);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 600;
  gap: 10px;
}
.btn-google:hover { background: var(--bg-3); border-color: var(--border-2); }
.btn-google svg { flex-shrink: 0; }

.auth-switch { text-align: center; font-size: 0.9rem; color: var(--text-2); }

/* ---------- Dashboard ---------- */
.dashboard-container {
  padding: 24px 20px calc(var(--nav-height) + var(--safe-bottom) + 20px);
  max-width: 600px;
  margin: 0 auto;
}
.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}
.dash-greeting h1 { font-size: 1.5rem; font-weight: 700; }
.phase-badge {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(124,58,237,0.15);
  color: var(--accent);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 4px;
}

/* Streak banner */
.streak-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  backdrop-filter: blur(20px);
}
.streak-flame { font-size: 1.6rem; }
.streak-info { display: flex; align-items: baseline; gap: 6px; flex: 1; }
.streak-count { font-size: 1.8rem; font-weight: 800; }
.streak-label { font-size: 0.85rem; color: var(--text-2); }
.streak-best { font-size: 0.8rem; color: var(--text-3); }

/* Today card */
.today-card {
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  backdrop-filter: blur(20px);
}
.today-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.today-header h2 { font-size: 1.1rem; font-weight: 700; }
.today-date { font-size: 0.8rem; color: var(--text-3); }

.today-entries {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 20px;
}
.entry-dot {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--border-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-3);
  transition: all var(--transition);
}
.entry-dot.completed {
  border-color: var(--green);
  background: rgba(52, 211, 153, 0.15);
  color: var(--green);
}
.entry-connector {
  width: 40px;
  height: 2px;
  background: var(--border);
  transition: background var(--transition);
}
.entry-connector.completed { background: var(--green); }

.today-prompt { margin-bottom: 16px; }
.prompt-text { font-size: 0.95rem; color: var(--text-2); font-style: italic; line-height: 1.5; }

/* Week progress */
.week-progress-card {
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  backdrop-filter: blur(20px);
}
.week-progress-card h3 { font-size: 1rem; margin-bottom: 12px; }
.week-dots { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; }
.week-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-3);
  transition: all var(--transition);
}
.week-dot.active { border-color: var(--accent); color: var(--accent); background: rgba(124,58,237,0.1); }
.week-dot.completed { border-color: var(--green); color: var(--green); background: rgba(52,211,153,0.1); }

.phase-bar {
  height: 6px;
  background: var(--bg-3);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.phase-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.phase-science-text { font-size: 0.8rem; color: var(--text-3); }

/* Stats row */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-card {
  padding: 16px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  backdrop-filter: blur(20px);
}
.stat-value { display: block; font-size: 1.5rem; font-weight: 800; }
.stat-label { display: block; font-size: 0.7rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }

/* Neural preview */
.neural-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  cursor: pointer;
  transition: all var(--transition);
  backdrop-filter: blur(20px);
}
.neural-preview:hover { border-color: var(--accent); transform: translateY(-2px); }
.neural-preview canvas { flex-shrink: 0; }
.neural-preview-info h3 { font-size: 1rem; }
.neural-preview-info p { font-size: 0.85rem; color: var(--text-2); }
.link-arrow { font-size: 0.85rem; color: var(--accent); font-weight: 600; }

/* Referral card */
.referral-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: linear-gradient(135deg, rgba(124,58,237,0.1), rgba(37,99,235,0.1));
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.referral-icon { font-size: 1.6rem; }
.referral-info { flex: 1; }
.referral-info h3 { font-size: 0.95rem; }
.referral-info p { font-size: 0.8rem; color: var(--text-2); }

/* ---------- Bottom Nav ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  padding-bottom: var(--safe-bottom);
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  border: none;
  background: none;
  color: var(--text-3);
  font-size: 0.65rem;
  font-weight: 600;
  transition: color var(--transition);
}
.nav-item.active { color: var(--accent); }
.nav-item:hover { color: var(--accent); }

/* ---------- Journal ---------- */
.journal-container {
  padding: 24px 20px 40px;
  max-width: 600px;
  margin: 0 auto;
}
.journal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.journal-header h1 { font-size: 1.3rem; flex: 1; }
.journal-date { font-size: 0.8rem; color: var(--text-3); }

/* Mood picker */
.mood-checkin {
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  text-align: center;
  backdrop-filter: blur(20px);
}
.mood-label { font-size: 0.95rem; color: var(--text-2); margin-bottom: 12px; }
.mood-picker { display: flex; justify-content: center; gap: 12px; }
.mood-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--input-bg);
  font-size: 1.4rem;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.mood-btn:hover { transform: scale(1.15); }
.mood-btn.selected {
  border-color: var(--accent);
  background: rgba(124,58,237,0.15);
  transform: scale(1.15);
  box-shadow: 0 0 16px rgba(124,58,237,0.3);
}

/* Journal entry cards */
.journal-entries { display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; }
.journal-entry-card {
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  transition: border-color var(--transition);
}
.journal-entry-card:focus-within { border-color: var(--accent); }
.jec-header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.jec-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.jec-prompt { font-size: 0.9rem; color: var(--text-2); font-style: italic; line-height: 1.4; }
.journal-textarea {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color var(--transition);
  min-height: 100px;
}
.journal-textarea:focus { border-color: var(--accent); }
.journal-textarea::placeholder { color: var(--text-3); font-style: italic; }
.jec-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.specificity-badge {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(124,58,237,0.1);
  color: var(--accent);
  font-weight: 600;
}
.specificity-badge.high { background: rgba(52,211,153,0.15); color: var(--green); }
.specificity-badge.medium { background: rgba(251,191,36,0.15); color: var(--amber); }
.specificity-badge.low { background: rgba(248,113,113,0.15); color: var(--red); }
.word-count { font-size: 0.75rem; color: var(--text-3); }

/* Coaching tip */
.coaching-tip {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: rgba(251,191,36,0.08);
  border: 1px solid rgba(251,191,36,0.2);
  border-radius: var(--radius);
  margin-bottom: 20px;
  animation: fadeIn 0.3s ease;
}
.tip-icon { font-size: 1.2rem; flex-shrink: 0; }
.coaching-tip p { font-size: 0.85rem; color: var(--text-2); line-height: 1.5; }

/* ---------- Progress ---------- */
.progress-container {
  padding: 24px 20px calc(var(--nav-height) + var(--safe-bottom) + 20px);
  max-width: 600px;
  margin: 0 auto;
}
.progress-header { text-align: center; margin-bottom: 24px; }
.progress-header h1 { font-size: 1.5rem; font-weight: 700; }
.progress-subtitle { color: var(--text-2); font-size: 0.9rem; }

.brain-viz-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
}
.brain-viz-container canvas { max-width: 100%; }
.brain-phase-label {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  margin-top: 8px;
}

/* Phase cards */
.phase-cards { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.phase-card {
  padding: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  transition: all var(--transition);
}
.phase-card.locked { opacity: 0.5; }
.phase-card.active { border-color: var(--accent); box-shadow: var(--shadow-glow); }
.phase-card.completed { border-color: var(--green); }
.pc-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.pc-phase { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); font-weight: 700; }
.pc-status { font-size: 0.7rem; padding: 2px 8px; border-radius: 12px; background: var(--bg-3); color: var(--text-3); }
.phase-card.active .pc-status { background: rgba(124,58,237,0.15); color: var(--accent); }
.phase-card.completed .pc-status { background: rgba(52,211,153,0.15); color: var(--green); }
.phase-card h3 { font-size: 1.05rem; }
.phase-card p { font-size: 0.8rem; color: var(--text-2); margin-bottom: 10px; }
.pc-bar { height: 4px; background: var(--bg-3); border-radius: 2px; overflow: hidden; }
.pc-fill { height: 100%; background: var(--accent-gradient); border-radius: 2px; transition: width 0.8s ease; }

/* Heatmap */
.heatmap-section {
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  backdrop-filter: blur(20px);
}
.heatmap-section h3 { font-size: 1rem; margin-bottom: 12px; }
.heatmap {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--bg-3);
  transition: background var(--transition);
}
.heatmap-cell.level-1 { background: rgba(124,58,237,0.2); }
.heatmap-cell.level-2 { background: rgba(124,58,237,0.4); }
.heatmap-cell.level-3 { background: rgba(124,58,237,0.7); }
.heatmap-cell.today { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Specificity trend */
.specificity-trend {
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  backdrop-filter: blur(20px);
}
.specificity-trend h3 { font-size: 1rem; margin-bottom: 12px; }
.specificity-trend canvas { width: 100% !important; }

/* Share milestone */
.share-milestone {
  text-align: center;
  padding: 24px;
  background: linear-gradient(135deg, rgba(124,58,237,0.1), rgba(37,99,235,0.1));
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.share-milestone h3 { margin-bottom: 8px; }
.share-milestone p { color: var(--text-2); font-size: 0.9rem; margin-bottom: 16px; }

/* ---------- History ---------- */
.history-container {
  padding: 24px 20px calc(var(--nav-height) + var(--safe-bottom) + 20px);
  max-width: 600px;
  margin: 0 auto;
}
.history-header { margin-bottom: 20px; }
.history-header h1 { font-size: 1.5rem; }
.history-list { display: flex; flex-direction: column; gap: 12px; }

.history-day {
  padding: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
}
.history-day-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.history-day-date { font-weight: 700; font-size: 0.9rem; }
.history-day-score { font-size: 0.75rem; padding: 2px 8px; border-radius: 12px; background: rgba(124,58,237,0.1); color: var(--accent); }
.history-entry { padding: 8px 0; border-bottom: 1px solid var(--border); }
.history-entry:last-child { border-bottom: none; }
.history-entry-num { font-size: 0.75rem; color: var(--accent); font-weight: 600; }
.history-entry-text { font-size: 0.9rem; color: var(--text-2); margin-top: 2px; line-height: 1.5; }

.empty-state { text-align: center; color: var(--text-3); padding: 60px 20px; }

/* ---------- Settings ---------- */
.settings-container {
  padding: 24px 20px 60px;
  max-width: 600px;
  margin: 0 auto;
}
.settings-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.settings-header h1 { font-size: 1.3rem; }
.settings-group {
  margin-bottom: 24px;
  padding: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
}
.settings-group h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); margin-bottom: 14px; }
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.setting-row span { font-size: 0.95rem; }
.setting-row code { font-size: 0.9rem; background: var(--bg-3); padding: 4px 10px; border-radius: var(--radius-xs); }
.setting-row input[type="time"] {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.9rem;
}

/* Theme toggle */
.theme-toggle { display: flex; gap: 4px; background: var(--bg-3); border-radius: var(--radius-xs); padding: 2px; }
.theme-opt {
  padding: 6px 10px;
  border: none;
  background: none;
  color: var(--text-3);
  font-size: 0.8rem;
  border-radius: var(--radius-xs);
  transition: all var(--transition);
}
.theme-opt.active { background: var(--accent); color: #fff; }

/* Toggle switch */
.toggle { position: relative; width: 48px; height: 28px; display: inline-block; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-3);
  border-radius: 28px;
  transition: all var(--transition);
  cursor: pointer;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

.settings-footer { text-align: center; color: var(--text-3); font-size: 0.8rem; margin-top: 40px; }

/* ---------- Celebration Overlay ---------- */
.celebration-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(10px);
  animation: fadeIn 0.3s ease;
}
.celebration-overlay canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.celebration-content {
  position: relative;
  text-align: center;
  padding: 40px 32px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  max-width: 360px;
  width: 90%;
  animation: celebrationPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes celebrationPop {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.celebration-icon { font-size: 3rem; margin-bottom: 12px; }
.celebration-content h2 { font-size: 1.5rem; margin-bottom: 8px; }
.celebration-content p { color: var(--text-2); margin-bottom: 8px; }
.celebration-stat { font-size: 0.85rem; color: var(--accent); margin-bottom: 20px; font-weight: 600; }
.celebration-content .btn { margin-bottom: 8px; width: 100%; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  z-index: 500;
  animation: toastIn 0.3s ease;
  max-width: calc(100% - 40px);
  text-align: center;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---------- Responsive ---------- */
@media (min-width: 480px) {
  .science-cards { flex-direction: row; }
  .science-card { flex: 1; flex-direction: column; text-align: center; }
}

@media (min-width: 768px) {
  .hero-title { font-size: 3rem; }
  .stats-row { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Print ---------- */
@media print {
  .bottom-nav, .btn, .celebration-overlay { display: none !important; }
  body { background: #fff; color: #000; }
}
