/* ============================================
   Untwist - Design System
   A Gamified Wellness App for Healing
   ============================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;500;600;700&family=Source+Sans+Pro:wght@400;600;700&display=swap');

/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
  /* Primary Colors */
  --sage-embrace: #7C9A82;
  --warm-sand: #E8DED1;

  /* Secondary Colors */
  --dusk-lavender: #B8A9C9;
  --soft-terracotta: #D4A574;

  /* Accent Colors */
  --golden-hour: #E6B85C;
  --dawn-rose: #E8B4B8;

  /* Neutrals */
  --deep-forest: #2D3B2D;
  --muted-sage: #5A6B5A;
  --fog: #F5F2EE;
  --mist: #E0DCD6;

  /* Semantic Colors */
  --gentle-success: #7C9A82;
  --soft-alert: #D4A574;
  --tender-error: #C98B8B;

  /* Mood Colors */
  --mood-1: #8B9DC3;
  --mood-2: #A8B5A0;
  --mood-3: #C9C0B0;
  --mood-4: #D4C4A8;
  --mood-5: #E6B85C;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(45, 59, 45, 0.06);
  --shadow-md: 0 4px 16px rgba(45, 59, 45, 0.08);
  --shadow-lg: 0 8px 32px rgba(45, 59, 45, 0.12);
  --shadow-glow: 0 0 24px rgba(230, 184, 92, 0.3);

  /* Typography */
  --font-heading: 'Quicksand', 'Nunito', 'Segoe UI', sans-serif;
  --font-body: 'Source Sans Pro', 'Open Sans', 'Helvetica Neue', sans-serif;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 300ms ease;
}

/* ============================================
   Reset & Base Styles
   ============================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--warm-sand);
  color: var(--deep-forest);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.3;
  color: var(--deep-forest);
}

h1 {
  font-size: 28px;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 24px;
}

h3 {
  font-size: 20px;
}

h4 {
  font-size: 18px;
  font-weight: 500;
}

p {
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: 0.01em;
}

.text-large {
  font-size: 18px;
  line-height: 1.6;
}

.text-small {
  font-size: 14px;
  line-height: 1.5;
}

.text-caption {
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: 0.02em;
}

.text-muted {
  color: var(--muted-sage);
}

.text-golden {
  color: var(--golden-hour);
}

/* ============================================
   App Container
   ============================================ */
.app {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--warm-sand) 0%, var(--fog) 100%);
}

/* ============================================
   Header
   ============================================ */
.header {
  height: 56px;
  padding: 0 var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--warm-sand);
  border-bottom: 1px solid var(--mist);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-logo {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 600;
  color: var(--sage-embrace);
}

.header-back {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: none;
  border: none;
  color: var(--deep-forest);
  font-size: 16px;
  cursor: pointer;
  padding: var(--space-sm);
  margin-left: -8px;
}

.header-title {
  font-size: 18px;
  font-weight: 600;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

/* ============================================
   Main Content Area
   ============================================ */
.main-content {
  flex: 1;
  padding: var(--space-lg);
  padding-bottom: calc(64px + var(--space-lg) + env(safe-area-inset-bottom, 0));
}

/* ============================================
   Views (Show/Hide)
   ============================================ */
.view {
  display: none;
  animation: fadeIn 0.2s ease;
}

.view.active {
  display: block;
}

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

/* ============================================
   Greeting Card (Dashboard)
   ============================================ */
.greeting-card {
  background: linear-gradient(135deg, var(--warm-sand) 0%, var(--fog) 100%);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  box-shadow: var(--shadow-sm);
}

.greeting-text {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.greeting-subtext {
  color: var(--muted-sage);
  font-size: 14px;
  margin-bottom: var(--space-lg);
}

/* Level Display */
.level-display {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.level-badge {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.level-badge.survivor { background: var(--sage-embrace); }
.level-badge.thriver { background: var(--dusk-lavender); }
.level-badge.warrior { background: var(--soft-terracotta); }
.level-badge.phoenix { background: var(--golden-hour); }
.level-badge.luminary { background: linear-gradient(135deg, var(--sage-embrace), var(--dusk-lavender), var(--golden-hour)); }

.level-info {
  flex: 1;
}

.tier-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--deep-forest);
}

/* XP Bar */
.xp-bar-container {
  width: 100%;
}

.xp-bar {
  height: 12px;
  background: var(--mist);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-xs);
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sage-embrace), var(--dusk-lavender));
  border-radius: var(--radius-full);
  transition: width 0.6s ease-out;
}

.xp-bar-fill.glow {
  box-shadow: var(--shadow-glow);
}

.xp-text {
  font-size: 12px;
  color: var(--muted-sage);
  font-weight: 600;
  letter-spacing: 0.05em;
}

/* ============================================
   Hero CTA Button
   ============================================ */
.hero-cta {
  width: 100%;
  height: 64px;
  background: var(--sage-embrace);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
  margin-bottom: var(--space-lg);
}

.hero-cta:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.hero-cta:active {
  transform: scale(0.98);
}

.hero-cta.completed {
  background: var(--fog);
  color: var(--sage-embrace);
  box-shadow: var(--shadow-sm);
}

.hero-cta.completed:hover {
  transform: none;
}

/* ============================================
   Streak Card
   ============================================ */
.streak-card {
  background: var(--fog);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.streak-flame {
  font-size: 40px;
  animation: flicker 1.5s ease-in-out infinite;
}

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

.streak-number {
  font-family: var(--font-heading);
  font-size: 48px;
  font-weight: 700;
  color: var(--deep-forest);
}

.streak-label {
  font-size: 14px;
  color: var(--muted-sage);
}

/* ============================================
   Section Headers
   ============================================ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.section-title {
  font-size: 18px;
  font-weight: 600;
}

.section-link {
  color: var(--sage-embrace);
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}

.section-link:hover {
  text-decoration: underline;
}

/* ============================================
   Quest Cards
   ============================================ */
.quests-scroll {
  display: flex;
  gap: var(--space-md);
  overflow-x: auto;
  padding-bottom: var(--space-sm);
  margin: 0 calc(-1 * var(--space-lg));
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.quests-scroll::-webkit-scrollbar {
  display: none;
}

.quest-card {
  min-width: 260px;
  background: var(--fog);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.quest-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.quest-card.completed {
  opacity: 0.7;
}

.quest-icon {
  font-size: 32px;
  margin-bottom: var(--space-sm);
}

.quest-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.quest-description {
  font-size: 14px;
  color: var(--muted-sage);
  margin-bottom: var(--space-md);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.quest-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quest-xp {
  background: rgba(230, 184, 92, 0.15);
  color: var(--golden-hour);
  font-size: 14px;
  font-weight: 600;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-full);
}

.quest-btn {
  background: var(--sage-embrace);
  color: white;
  border: none;
  font-size: 14px;
  font-weight: 500;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quest-btn:hover {
  background: var(--deep-forest);
}

.quest-btn.in-progress {
  background: var(--dusk-lavender);
}

.quest-btn.completed {
  background: var(--mist);
  color: var(--muted-sage);
  cursor: default;
}

/* Quest List View */
.quest-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.quest-list .quest-card {
  min-width: auto;
  width: 100%;
}

/* ============================================
   Achievement Badges
   ============================================ */
.achievements-row {
  display: flex;
  gap: var(--space-md);
  overflow-x: auto;
  padding-bottom: var(--space-sm);
  margin: 0 calc(-1 * var(--space-lg));
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.achievements-row::-webkit-scrollbar {
  display: none;
}

.achievement-badge {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  transition: all var(--transition-normal);
  cursor: pointer;
}

.achievement-badge.locked {
  background: var(--mist);
  filter: grayscale(100%);
  opacity: 0.5;
}

.achievement-badge.unlocked {
  background: var(--fog);
  box-shadow: var(--shadow-md);
}

.achievement-badge.new {
  animation: sparkle 0.5s ease;
  box-shadow: var(--shadow-glow);
}

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

/* Achievement Grid (Progress View) */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.achievement-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-md);
  background: var(--fog);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.achievement-item .achievement-badge {
  margin-bottom: var(--space-sm);
}

.achievement-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--deep-forest);
}

.achievement-item.locked .achievement-name {
  color: var(--muted-sage);
}

/* ============================================
   Bottom Navigation
   ============================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(64px + env(safe-area-inset-bottom, 0));
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: var(--fog);
  box-shadow: 0 -4px 16px rgba(45, 59, 45, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-sm) var(--space-md);
  background: none;
  border: none;
  color: var(--muted-sage);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-item.active {
  color: var(--sage-embrace);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  width: 20px;
  height: 3px;
  background: var(--sage-embrace);
  border-radius: 0 0 3px 3px;
}

.nav-icon {
  font-size: 24px;
  line-height: 1;
}

.nav-label {
  font-size: 11px;
  font-weight: 500;
}

/* ============================================
   Check-in Flow
   ============================================ */
.checkin-container {
  min-height: calc(100vh - 56px - 64px);
  display: flex;
  flex-direction: column;
}

/* Progress Indicator */
.progress-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-lg) 0;
}

.progress-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--mist);
  transition: all var(--transition-normal);
}

.progress-dot.active {
  background: var(--sage-embrace);
  transform: scale(1.2);
}

.progress-dot.completed {
  background: var(--sage-embrace);
}

.progress-line {
  width: 24px;
  height: 2px;
  background: var(--mist);
}

.progress-line.completed {
  background: var(--sage-embrace);
}

/* Check-in Steps */
.checkin-step {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-lg);
  animation: fadeIn 0.3s ease;
}

.checkin-step.active {
  display: flex;
}

.checkin-question {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.checkin-subtext {
  color: var(--muted-sage);
  margin-bottom: var(--space-xl);
}

/* Mood Picker */
.mood-picker {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.mood-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-md);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  background: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mood-option:hover {
  background: var(--fog);
}

.mood-option.selected {
  border-color: var(--sage-embrace);
  background: var(--fog);
  transform: scale(1.1);
}

.mood-icon {
  font-size: 40px;
  line-height: 1;
}

.mood-label {
  font-size: 12px;
  color: var(--muted-sage);
}

.mood-option.selected .mood-label {
  color: var(--deep-forest);
  font-weight: 500;
}

/* Journal Textarea */
.journal-container {
  width: 100%;
  margin-bottom: var(--space-lg);
}

.journal-prompt {
  font-family: var(--font-heading);
  font-size: 20px;
  font-style: italic;
  color: var(--sage-embrace);
  margin-bottom: var(--space-md);
}

.journal-textarea {
  width: 100%;
  min-height: 150px;
  padding: var(--space-md);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--deep-forest);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--mist);
  border-radius: var(--radius-md);
  resize: vertical;
  transition: border-color var(--transition-fast);
}

.journal-textarea:focus {
  outline: none;
  border-color: var(--sage-embrace);
  border-width: 2px;
}

.journal-textarea::placeholder {
  color: var(--muted-sage);
}

.privacy-note {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 12px;
  color: var(--muted-sage);
}

/* Reflection Card */
.reflection-card {
  background: var(--fog);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
  text-align: center;
}

.reflection-text {
  font-size: 18px;
  line-height: 1.6;
  color: var(--deep-forest);
}

/* Celebration */
.celebration-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-xl);
}

.celebration-icon {
  font-size: 64px;
  margin-bottom: var(--space-lg);
  animation: celebratePop 0.5s ease;
}

@keyframes celebratePop {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.celebration-title {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 600;
  margin-bottom: var(--space-lg);
}

.celebration-stats {
  background: var(--fog);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
  width: 100%;
}

.xp-earned {
  font-family: var(--font-heading);
  font-size: 32px;
  font-weight: 700;
  color: var(--golden-hour);
  margin-bottom: var(--space-sm);
  animation: xpPop 0.5s ease 0.2s both;
}

@keyframes xpPop {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.streak-earned {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-size: 18px;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-normal);
}

.btn-primary {
  background: var(--sage-embrace);
  color: white;
}

.btn-primary:hover {
  background: var(--deep-forest);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: var(--fog);
  color: var(--sage-embrace);
}

.btn-secondary:hover {
  background: var(--mist);
}

.btn-full {
  width: 100%;
}

.btn-link {
  background: none;
  border: none;
  color: var(--sage-embrace);
  font-size: 14px;
  cursor: pointer;
  text-decoration: underline;
  padding: var(--space-sm);
}

/* ============================================
   Quest Detail View
   ============================================ */
.quest-detail {
  padding: var(--space-lg);
}

.quest-detail-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.quest-detail-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
}

.quest-detail-title {
  font-size: 24px;
  margin-bottom: var(--space-md);
}

.quest-detail-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  color: var(--muted-sage);
  font-size: 14px;
}

.quest-detail-xp {
  color: var(--golden-hour);
  font-weight: 600;
}

.quest-detail-description {
  font-size: 16px;
  line-height: 1.7;
  margin-bottom: var(--space-xl);
  padding: var(--space-lg);
  background: var(--fog);
  border-radius: var(--radius-md);
}

.quest-steps {
  margin-bottom: var(--space-xl);
}

.quest-steps-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: var(--space-md);
}

.quest-steps-list {
  list-style: none;
}

.quest-steps-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  font-size: 14px;
}

.quest-steps-list li::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--sage-embrace);
  border-radius: 50%;
  margin-top: 8px;
  flex-shrink: 0;
}

.quest-pause-note {
  text-align: center;
  color: var(--muted-sage);
  font-size: 14px;
  margin-top: var(--space-md);
}

/* Quest Activity Content */
.quest-activity {
  margin-bottom: var(--space-xl);
}

.quest-activity-prompt {
  font-family: var(--font-heading);
  font-size: 18px;
  margin-bottom: var(--space-md);
}

.quest-textarea {
  width: 100%;
  min-height: 120px;
  padding: var(--space-md);
  font-family: var(--font-body);
  font-size: 16px;
  border: 1px solid var(--mist);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.5);
  resize: vertical;
}

.quest-textarea:focus {
  outline: none;
  border-color: var(--sage-embrace);
}

/* ============================================
   Progress View
   ============================================ */
.progress-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--fog);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  text-align: center;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 700;
  color: var(--sage-embrace);
}

.stat-label {
  font-size: 12px;
  color: var(--muted-sage);
}

/* ============================================
   Level Up Modal
   ============================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(45, 59, 45, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-lg);
  animation: fadeIn 0.2s ease;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: var(--fog);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  max-width: 320px;
  width: 100%;
  text-align: center;
  animation: modalPop 0.3s ease;
}

@keyframes modalPop {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 600;
  margin-bottom: var(--space-md);
}

.modal-badge {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-md);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: white;
  animation: badgeGlow 1s ease infinite;
}

@keyframes badgeGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(230, 184, 92, 0.3); }
  50% { box-shadow: 0 0 40px rgba(230, 184, 92, 0.6); }
}

.modal-level {
  font-size: 18px;
  margin-bottom: var(--space-xs);
}

.modal-tier {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 600;
  color: var(--sage-embrace);
  margin-bottom: var(--space-md);
}

.modal-message {
  color: var(--muted-sage);
  margin-bottom: var(--space-xl);
  line-height: 1.6;
}

/* ============================================
   Achievement Modal
   ============================================ */
.achievement-modal .modal-badge {
  width: 96px;
  height: 96px;
  font-size: 48px;
  background: var(--golden-hour);
}

.achievement-modal .modal-title {
  color: var(--golden-hour);
}

/* ============================================
   Loading States
   ============================================ */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--mist);
  border-top-color: var(--sage-embrace);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, var(--mist) 25%, var(--fog) 50%, var(--mist) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================
   Empty States
   ============================================ */
.empty-state {
  text-align: center;
  padding: var(--space-xl);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.empty-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.empty-text {
  color: var(--muted-sage);
  margin-bottom: var(--space-lg);
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--deep-forest);
  color: white;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  z-index: 1001;
  animation: toastIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.toast.hidden {
  display: none;
}

.toast.success {
  background: var(--sage-embrace);
}

.toast.golden {
  background: var(--golden-hour);
  color: var(--deep-forest);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ============================================
   XP Popup Animation
   ============================================ */
.xp-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-heading);
  font-size: 48px;
  font-weight: 700;
  color: var(--golden-hour);
  z-index: 1002;
  pointer-events: none;
  animation: xpFloat 1.5s ease-out forwards;
}

@keyframes xpFloat {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.5);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -100%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -150%) scale(1);
  }
}

/* ============================================
   Onboarding Screen
   ============================================ */
.onboarding {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  text-align: center;
}

.onboarding-logo {
  font-family: var(--font-heading);
  font-size: 48px;
  font-weight: 700;
  color: var(--sage-embrace);
  margin-bottom: var(--space-md);
}

.onboarding-tagline {
  font-size: 18px;
  color: var(--muted-sage);
  margin-bottom: var(--space-3xl);
}

.onboarding-form {
  width: 100%;
  max-width: 300px;
}

.onboarding-input {
  width: 100%;
  padding: var(--space-md);
  font-family: var(--font-body);
  font-size: 18px;
  text-align: center;
  border: 2px solid var(--mist);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.5);
  margin-bottom: var(--space-lg);
  transition: border-color var(--transition-fast);
}

.onboarding-input:focus {
  outline: none;
  border-color: var(--sage-embrace);
}

.onboarding-input::placeholder {
  color: var(--muted-sage);
}

.onboarding-note {
  font-size: 14px;
  color: var(--muted-sage);
  margin-top: var(--space-md);
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (min-width: 480px) {
  .mood-picker {
    gap: var(--space-lg);
  }

  .mood-icon {
    font-size: 48px;
  }

  .achievements-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 768px) {
  .app {
    max-width: 700px;
  }

  h1 {
    font-size: 36px;
  }

  .greeting-text {
    font-size: 28px;
  }

  .bottom-nav {
    max-width: 700px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .achievements-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

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