/* ═══════════════════════════════════════════════════════════
   JustStaySober — Styles  v2
   Warm, hopeful, mobile-first
═══════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────── */
:root {
  /* Greens — slightly warmer, more olive */
  --green-deep:    #2a5240;
  --green-mid:     #3d7055;
  --green-soft:    #5d9470;
  --green-pale:    #9ec9b0;
  --green-mist:    #e6f2eb;
  --green-ghost:   #f3f9f5;

  /* Warm tones — amber, cream, sand */
  --warm-white:    #fdfaf5;
  --warm-cream:    #f8f2e8;
  --warm-sand:     #e8d9c0;
  --warm-amber:    #d4a06a;
  --warm-gold:     #c48c45;
  --warm-terracotta: #c2714f;

  /* Serenity blue for crisis */
  --serenity-deep: #1a3a5c;
  --serenity-mid:  #2563a8;
  --serenity-soft: #4a90d9;

  /* Text */
  --text-dark:     #1c2b22;
  --text-mid:      #3a5445;
  --text-soft:     #64836e;
  --text-muted:    #96b0a0;
  --text-white:    #ffffff;

  /* Semantic */
  --danger:        #b83232;
  --danger-light:  #fdf0ee;

  /* Geometry */
  --radius-sm:     8px;
  --radius-md:     14px;
  --radius-lg:     20px;
  --radius-xl:     28px;
  --radius-2xl:    36px;
  --radius-full:   9999px;

  /* Shadows */
  --shadow-sm:     0 1px 4px rgba(42, 82, 64, 0.08);
  --shadow-md:     0 4px 18px rgba(42, 82, 64, 0.13);
  --shadow-lg:     0 8px 36px rgba(42, 82, 64, 0.18);
  --shadow-warm:   0 4px 18px rgba(196, 140, 69, 0.18);

  --transition:    0.2s ease;
  --safe-top:      env(safe-area-inset-top, 0px);
  --safe-bottom:   env(safe-area-inset-bottom, 0px);
}

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

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--green-ghost);
  color: var(--text-dark);
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── Screen System ──────────────────────────────────────── */
.screen {
  display: none;
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
}
.screen.active {
  display: flex;
  flex-direction: column;
}

/* ════════════════════════════════════════════════════════
   FLOATING 988 CRISIS BUTTON
════════════════════════════════════════════════════════ */
.crisis-float {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 76px);
  right: 16px;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #1e4b8a, #2563a8);
  color: white;
  border-radius: var(--radius-full);
  padding: 10px 18px 10px 14px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 4px 20px rgba(37, 99, 168, 0.45);
  transition: all 0.2s ease;
  text-decoration: none;
  letter-spacing: 0.02em;
}
.crisis-float:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(37, 99, 168, 0.55);
}
.crisis-float-icon { font-size: 16px; }
.crisis-float-text { font-size: 15px; font-weight: 800; letter-spacing: 0.05em; }

/* ════════════════════════════════════════════════════════
   LANDING SCREEN
════════════════════════════════════════════════════════ */
#screen-landing {
  background: linear-gradient(160deg, var(--green-deep) 0%, #3d7055 50%, #4d8a66 100%);
  min-height: 100dvh;
  position: relative;
  overflow: hidden;
}

.landing-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 120% 80% at 20% -10%, rgba(255,235,180,0.07) 0%, transparent 60%),
    radial-gradient(ellipse 80% 60% at 80% 110%, rgba(0,0,0,0.15) 0%, transparent 60%);
  pointer-events: none;
}

.landing-bg::before {
  content: '';
  position: absolute;
  top: -20%;
  right: -20%;
  width: 70vw;
  height: 70vw;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
}

.landing-bg::after {
  content: '';
  position: absolute;
  bottom: -10%;
  left: -15%;
  width: 50vw;
  height: 50vw;
  border-radius: 50%;
  background: rgba(255,220,150,0.04);
}

.landing-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: calc(var(--safe-top) + 56px) 28px calc(var(--safe-bottom) + 40px);
  flex: 1;
}

.logo-mark {
  font-size: 60px;
  margin-bottom: 18px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.2));
  animation: floatIn 0.8s ease-out;
}

.landing-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(30px, 8vw, 44px);
  font-weight: 600;
  color: var(--text-white);
  letter-spacing: -0.5px;
  margin-bottom: 14px;
  animation: slideUp 0.6s 0.1s ease-out both;
}

.landing-tagline {
  font-size: clamp(16px, 4vw, 20px);
  color: rgba(255,255,255,0.82);
  font-weight: 300;
  line-height: 1.7;
  margin-bottom: 32px;
  animation: slideUp 0.6s 0.2s ease-out both;
}

.landing-features {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 40px;
  animation: slideUp 0.6s 0.3s ease-out both;
}

.feature-pill {
  background: rgba(255,255,255,0.14);
  backdrop-filter: blur(8px);
  color: white;
  border-radius: var(--radius-full);
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid rgba(255,255,255,0.2);
}

.landing-cta {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 320px;
  margin-bottom: 28px;
  animation: slideUp 0.6s 0.4s ease-out both;
}

.landing-crisis {
  width: 100%;
  max-width: 320px;
  margin-bottom: 24px;
  animation: slideUp 0.6s 0.45s ease-out both;
}

.landing-crisis-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  background: rgba(37, 99, 168, 0.35);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-full);
  padding: 10px 20px;
  font-size: 13px;
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  transition: all var(--transition);
}
.landing-crisis-btn:hover {
  background: rgba(37, 99, 168, 0.5);
}
.landing-crisis-btn strong { color: white; }

.landing-privacy {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  line-height: 1.7;
  animation: slideUp 0.6s 0.5s ease-out both;
}

.landing-privacy a {
  color: rgba(255,255,255,0.72);
  text-decoration: underline;
}

/* ════════════════════════════════════════════════════════
   BUTTONS
════════════════════════════════════════════════════════ */
.btn-primary {
  background: var(--warm-white);
  color: var(--green-deep);
  border-radius: var(--radius-full);
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 600;
  transition: all var(--transition);
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  display: inline-block;
  text-align: center;
}
.btn-primary:hover, .btn-primary:active {
  background: var(--green-ghost);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.18);
}
.btn-primary:active { transform: translateY(0); }

.btn-primary.on-light {
  background: var(--green-mid);
  color: white;
  box-shadow: var(--shadow-md);
}
.btn-primary.on-light:hover {
  background: var(--green-deep);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: rgba(255,255,255,0.8);
  border-radius: var(--radius-full);
  padding: 12px 28px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid rgba(255,255,255,0.25);
  transition: all var(--transition);
  display: inline-block;
  text-align: center;
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

.btn-ghost-dark {
  background: transparent;
  color: var(--text-soft);
  border-radius: var(--radius-full);
  padding: 12px 28px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--green-mist);
  transition: all var(--transition);
  display: inline-block;
  text-align: center;
}
.btn-ghost-dark:hover {
  background: var(--green-mist);
}

.btn-secondary {
  background: var(--green-mist);
  color: var(--green-deep);
  border-radius: var(--radius-full);
  padding: 13px 24px;
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition);
  display: inline-block;
  text-align: center;
}
.btn-secondary:hover { background: var(--green-pale); }

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border-radius: var(--radius-full);
  padding: 13px 24px;
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition);
  display: inline-block;
  text-align: center;
}
.btn-danger:hover { background: #fce4e1; }

.btn-share {
  background: var(--warm-cream);
  color: var(--warm-gold);
  border-radius: var(--radius-full);
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  border: 2px solid var(--warm-amber);
  transition: all var(--transition);
  display: inline-block;
  text-align: center;
}
.btn-share:hover {
  background: #fff5e2;
  transform: translateY(-1px);
}

.btn-large { padding: 16px 36px; font-size: 16px; }
.btn-full { width: 100%; text-align: center; }

.btn-back {
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 4px;
  transition: color var(--transition);
}
.btn-back:hover { color: var(--green-deep); }

/* ════════════════════════════════════════════════════════
   ONBOARDING SCREEN
════════════════════════════════════════════════════════ */
#screen-onboarding {
  background: var(--warm-white);
  padding-top: var(--safe-top);
}

.onboarding-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 8px;
}

.onboarding-steps {
  display: flex;
  gap: 6px;
  align-items: center;
}

.step {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warm-sand);
  transition: all 0.3s ease;
}
.step.active {
  width: 24px;
  border-radius: var(--radius-full);
  background: var(--green-mid);
}
.step.done {
  background: var(--green-pale);
}

.onboarding-step {
  display: none;
  flex: 1;
}
.onboarding-step.active {
  display: block;
  animation: slideUp 0.35s ease-out;
}

.step-content {
  padding: 28px 24px calc(var(--safe-bottom) + 36px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

.step-icon {
  font-size: 48px;
  margin-bottom: 4px;
  line-height: 1;
}

.step-content h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(22px, 5vw, 30px);
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.3;
}

.step-subtitle {
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.65;
  margin-top: -10px;
}

/* ── Forms ──────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.form-group label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.optional {
  font-weight: 400;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
}

.form-group input,
.form-group select,
.setting-row input,
.setting-row select {
  background: var(--green-ghost);
  border: 1.5px solid var(--green-mist);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 16px;
  color: var(--text-dark);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.setting-row input:focus,
.setting-row select:focus {
  border-color: var(--green-soft);
  box-shadow: 0 0 0 3px rgba(61, 112, 85, 0.12);
  background: white;
}

.form-group input::placeholder { color: var(--text-muted); }

input[type="date"] { color-scheme: light; }

/* ── Not Sure checkbox ─────────────────────────────────── */
.not-sure-box {
  background: var(--warm-cream);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--warm-sand);
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-mid);
  line-height: 1.5;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  accent-color: var(--green-mid);
  margin-top: 2px;
}

.not-sure-hint {
  font-size: 13px;
  color: var(--text-muted);
  padding-left: 30px;
  line-height: 1.5;
}

/* ── Pathway Grid ───────────────────────────────────────── */
.pathway-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pathway-btn {
  background: var(--green-ghost);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  transition: all var(--transition);
  cursor: pointer;
}

.pathway-btn:hover {
  border-color: var(--green-pale);
  background: var(--green-mist);
}

.pathway-btn.selected {
  border-color: var(--green-mid);
  background: var(--green-mist);
  box-shadow: 0 0 0 3px rgba(61, 112, 85, 0.1);
}

.pathway-icon { font-size: 24px; margin-bottom: 3px; }
.pathway-name { font-size: 13px; font-weight: 600; color: var(--text-dark); line-height: 1.2; }
.pathway-desc { font-size: 11px; color: var(--text-muted); line-height: 1.3; }

.error-msg {
  background: var(--danger-light);
  color: var(--danger);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid rgba(184, 50, 50, 0.12);
}

/* ════════════════════════════════════════════════════════
   DASHBOARD SCREEN
════════════════════════════════════════════════════════ */
#screen-dashboard {
  background: var(--green-ghost);
  padding-bottom: calc(var(--safe-bottom) + 68px);
}

.dashboard-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 18px) 20px 8px;
}

.greeting {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-soft);
}

.settings-btn {
  font-size: 20px;
  padding: 6px;
  line-height: 1;
  opacity: 0.55;
  transition: opacity var(--transition);
}
.settings-btn:hover { opacity: 1; }

/* ── Days Hero ──────────────────────────────────────────── */
.days-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 24px 20px;
  gap: 12px;
}

.days-sober-ring {
  width: min(220px, 56vw);
  height: min(220px, 56vw);
  border-radius: 50%;
  background: linear-gradient(145deg, var(--green-deep), var(--green-mid));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 10px 40px rgba(42, 82, 64, 0.32),
    inset 0 1px 0 rgba(255,255,255,0.15);
  position: relative;
}

.days-sober-ring::before {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.12);
}

.days-number {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(52px, 14vw, 70px);
  font-weight: 600;
  color: white;
  line-height: 1;
  letter-spacing: -2px;
}

.days-label {
  font-size: 12px;
  color: rgba(255,255,255,0.72);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 5px;
}

.days-since {
  font-size: 14px;
  color: var(--text-soft);
  text-align: center;
  line-height: 1.5;
}

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 22px;
  margin: 0 16px 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(61, 112, 85, 0.07);
}

.card-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--green-soft);
  margin-bottom: 12px;
}

.daily-quote {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(15px, 4vw, 17px);
  font-weight: 300;
  font-style: italic;
  color: var(--text-dark);
  line-height: 1.7;
  border-left: 3px solid var(--warm-amber);
  padding-left: 16px;
  margin-bottom: 12px;
}

.quote-attribution {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  padding-left: 19px;
}

.milestone-preview-card {
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
.milestone-preview-card:hover, .milestone-preview-card:active {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.milestone-preview-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.milestone-preview-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--green-deep);
  font-family: 'Fraunces', Georgia, serif;
}

.milestone-preview-days {
  font-size: 13px;
  color: var(--text-soft);
  margin-top: 3px;
}

.milestone-preview-arrow {
  font-size: 22px;
  color: var(--green-pale);
}

/* ── Quick Actions ──────────────────────────────────────── */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 4px 16px 0;
}

.quick-action-btn {
  background: white;
  border-radius: var(--radius-md);
  padding: 18px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  box-shadow: var(--shadow-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mid);
  transition: all var(--transition);
  border: 1px solid rgba(61, 112, 85, 0.07);
}

.quick-action-btn:hover, .quick-action-btn:active {
  background: var(--green-mist);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.qa-icon { font-size: 26px; }

/* ════════════════════════════════════════════════════════
   BOTTOM NAV
════════════════════════════════════════════════════════ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid var(--green-mist);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding-bottom: var(--safe-bottom);
  z-index: 100;
  box-shadow: 0 -4px 24px rgba(42, 82, 64, 0.08);
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 4px 8px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition);
}

.nav-btn span:first-child { font-size: 20px; }

.nav-btn.active { color: var(--green-mid); }
.nav-btn.active span:first-child {
  filter: drop-shadow(0 2px 4px rgba(61, 112, 85, 0.3));
}

/* ════════════════════════════════════════════════════════
   SCREEN HEADER (shared)
════════════════════════════════════════════════════════ */
.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 16px) 20px 12px;
  position: sticky;
  top: 0;
  background: inherit;
  z-index: 10;
}

.screen-header h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-dark);
}

/* ════════════════════════════════════════════════════════
   MILESTONES SCREEN
════════════════════════════════════════════════════════ */
#screen-milestones {
  background: var(--green-ghost);
  padding-bottom: calc(var(--safe-bottom) + 72px);
}

.milestones-hero {
  background: linear-gradient(135deg, var(--green-deep), var(--green-mid));
  margin: 0 16px 16px;
  border-radius: var(--radius-xl);
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.milestones-days {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 60px;
  font-weight: 600;
  color: white;
  line-height: 1;
}

.milestones-days-label {
  font-size: 13px;
  color: rgba(255,255,255,0.68);
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}

.milestones-list {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.milestone-item {
  background: white;
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(61, 112, 85, 0.07);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.milestone-item.reached {
  background: linear-gradient(135deg, var(--green-mist), white);
  border-color: var(--green-pale);
}

.milestone-item.reached::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to bottom, var(--green-mid), var(--green-soft));
  border-radius: 2px 0 0 2px;
}

.milestone-item.next {
  border-color: var(--warm-amber);
  border-width: 2px;
  background: linear-gradient(135deg, #fffbf3, white);
}

.milestone-badge {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  background: var(--green-ghost);
}

.milestone-item.reached .milestone-badge { background: var(--green-mist); }
.milestone-item.next .milestone-badge     { background: #fff5e0; }

.milestone-info { flex: 1; min-width: 0; }

.milestone-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
  font-family: 'Fraunces', Georgia, serif;
}

.milestone-desc {
  font-size: 12px;
  color: var(--text-soft);
  margin-top: 3px;
  line-height: 1.45;
}

.milestone-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.milestone-status {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.milestone-item.reached .milestone-status { color: var(--green-mid); }
.milestone-item.next .milestone-status     { color: var(--warm-gold); }

.milestone-share-btn {
  font-size: 16px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  background: var(--warm-cream);
  transition: background var(--transition);
  line-height: 1;
}
.milestone-share-btn:hover { background: var(--warm-sand); }

/* ════════════════════════════════════════════════════════
   COMMUNITY / RESOURCES SCREEN (shared)
════════════════════════════════════════════════════════ */
#screen-community,
#screen-resources {
  background: var(--green-ghost);
  padding-bottom: calc(var(--safe-bottom) + 72px);
}

.resources-content {
  padding: 0 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.community-intro-card {
  background: linear-gradient(135deg, var(--green-deep), var(--green-mid));
  border-radius: var(--radius-lg);
  padding: 22px;
}

.community-intro-text {
  font-size: 15px;
  color: rgba(255,255,255,0.88);
  line-height: 1.7;
  font-style: italic;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 300;
}

.resource-section {
  background: white;
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(61, 112, 85, 0.07);
}

.resource-section h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--green-soft);
  margin-bottom: 16px;
}

/* Crisis */
.crisis-section {
  background: linear-gradient(135deg, var(--serenity-deep), #1e52a0);
  border: none;
  padding: 24px;
}
.crisis-section h3 { color: rgba(255,255,255,0.65); }

.crisis-btn {
  display: block;
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-lg);
  padding: 22px;
  text-align: center;
  transition: all var(--transition);
  cursor: pointer;
  margin-bottom: 12px;
}
.crisis-btn:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.45);
}

.crisis-number {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 54px;
  font-weight: 600;
  color: white;
  line-height: 1;
}
.crisis-label {
  font-size: 15px;
  font-weight: 600;
  color: white;
  margin-top: 7px;
}
.crisis-sublabel {
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  margin-top: 4px;
  line-height: 1.5;
}

.crisis-chat-btn {
  display: block;
  text-align: center;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius-full);
  padding: 11px 20px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  transition: all var(--transition);
  margin-bottom: 10px;
}
.crisis-chat-btn:hover {
  background: rgba(255,255,255,0.15);
  color: white;
}

.crisis-find-treatment {
  display: block;
  text-align: center;
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  padding: 6px;
  transition: color var(--transition);
  text-decoration: underline;
}
.crisis-find-treatment:hover { color: rgba(255,255,255,0.9); }

/* Resource links */
.resource-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.resource-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 6px;
  border-radius: var(--radius-md);
  transition: background var(--transition);
  cursor: pointer;
}
.resource-link:hover { background: var(--green-ghost); }

.resource-link + .resource-link {
  border-top: 1px solid var(--green-mist);
}

.rl-icon { font-size: 22px; flex-shrink: 0; }
.rl-name { font-size: 14px; font-weight: 600; color: var(--text-dark); }
.rl-desc { font-size: 12px; color: var(--text-soft); margin-top: 2px; line-height: 1.45; }
.rl-arrow { font-size: 16px; color: var(--text-muted); margin-left: auto; flex-shrink: 0; }

.featured-link {
  background: var(--green-mist);
  border-radius: var(--radius-md);
  padding: 14px 10px;
}
.featured-link .rl-name { color: var(--green-deep); }

/* ── Refuge Recovery Callout ─────────────────────────── */
.refuge-section {
  border: 2px solid #e8d4c8;
  background: linear-gradient(135deg, #fdf8f4, white);
}
.refuge-section h3 { color: #a0795e; }

.refuge-callout {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.refuge-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.refuge-icon { font-size: 38px; }

.refuge-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-dark);
}

.refuge-tagline {
  font-size: 13px;
  color: var(--text-soft);
  margin-top: 2px;
}

.refuge-desc {
  font-size: 14px;
  color: var(--text-mid);
  line-height: 1.7;
}

.refuge-principles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.refuge-principle {
  font-size: 12px;
  color: var(--text-soft);
  background: #fdf4f0;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  line-height: 1.45;
  font-weight: 500;
}

.btn-refuge {
  display: block;
  text-align: center;
  background: linear-gradient(135deg, #8a5a4a, #a0694e);
  color: white;
  border-radius: var(--radius-full);
  padding: 13px 24px;
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(138, 90, 74, 0.25);
}
.btn-refuge:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(138, 90, 74, 0.35);
}

.refuge-meetings-link {
  border-top: 1px solid #f0e4dc !important;
  margin-top: 4px;
}

/* ════════════════════════════════════════════════════════
   SETTINGS SCREEN
════════════════════════════════════════════════════════ */
#screen-settings {
  background: var(--warm-white);
}

.settings-content {
  padding: 16px 20px calc(var(--safe-bottom) + 40px);
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-section h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-soft);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--green-mist);
}

.setting-row {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.setting-row label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.settings-note {
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.65;
}

.danger-zone { opacity: 0.75; }
.danger-zone h3 { color: var(--danger); border-color: rgba(184, 50, 50, 0.15); }

/* ════════════════════════════════════════════════════════
   CELEBRATION OVERLAY (full-screen confetti)
════════════════════════════════════════════════════════ */
.celebration-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 60, 40, 0.88);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.celebration-content {
  background: white;
  border-radius: var(--radius-2xl);
  padding: 44px 36px;
  text-align: center;
  max-width: 360px;
  width: 100%;
  position: relative;
  z-index: 1;
  box-shadow: 0 24px 80px rgba(0,0,0,0.35);
  animation: popIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.celebration-emoji {
  font-size: 72px;
  margin-bottom: 16px;
  display: block;
  animation: bounce 0.7s 0.4s ease-in-out both;
}

.celebration-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 30px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 14px;
  line-height: 1.2;
}

.celebration-subtitle {
  font-size: 15px;
  color: var(--text-soft);
  margin-bottom: 28px;
  line-height: 1.7;
  font-style: italic;
}

.celebration-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
  will-change: transform;
}

/* ════════════════════════════════════════════════════════
   CRISIS MODAL
════════════════════════════════════════════════════════ */
.crisis-modal {
  position: fixed;
  inset: 0;
  background: rgba(26, 58, 92, 0.88);
  backdrop-filter: blur(10px);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.crisis-modal-content {
  background: white;
  border-radius: var(--radius-2xl);
  padding: 40px 32px;
  text-align: center;
  max-width: 340px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.crisis-modal-icon {
  font-size: 56px;
  margin-bottom: 14px;
  display: block;
}

.crisis-modal-content h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 24px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 12px;
}

.crisis-modal-content p {
  font-size: 14px;
  color: var(--text-soft);
  line-height: 1.7;
  margin-bottom: 24px;
}

.crisis-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ════════════════════════════════════════════════════════
   TOAST
════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 84px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text-dark);
  color: white;
  border-radius: var(--radius-full);
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  max-width: calc(100vw - 40px);
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 500;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ════════════════════════════════════════════════════════
   UTILITIES
════════════════════════════════════════════════════════ */
.hidden { display: none !important; }

/* ════════════════════════════════════════════════════════
   ANIMATIONS
════════════════════════════════════════════════════════ */
@keyframes floatIn {
  from { transform: translateY(-20px) scale(0.8); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

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

@keyframes popIn {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  30%       { transform: translateY(-20px) scale(1.1); }
  60%       { transform: translateY(-8px) scale(1.05); }
}

@keyframes confettiFall {
  0%   { transform: translateY(-20px) rotate(0deg) scale(1); opacity: 1; }
  80%  { opacity: 0.8; }
  100% { transform: translateY(105vh) rotate(720deg) scale(0.5); opacity: 0; }
}

/* ════════════════════════════════════════════════════════
   RESPONSIVE — LARGER SCREENS
════════════════════════════════════════════════════════ */
@media (min-width: 480px) {
  .pathway-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 640px) {
  body { max-width: 480px; margin: 0 auto; box-shadow: 0 0 80px rgba(0,0,0,0.08); }
  .bottom-nav { max-width: 480px; left: 50%; transform: translateX(-50%); }
  .crisis-float { right: calc(50% - 240px + 16px); }
  .toast { max-width: 440px; }
}

/* ════════════════════════════════════════════════════════
   DARK MODE — warm, not cold
════════════════════════════════════════════════════════ */
@media (prefers-color-scheme: dark) {
  body {
    background: #1a2a21;
    color: #e4ede8;
  }

  .card,
  .quick-action-btn {
    background: #1f3029;
    border-color: rgba(255,255,255,0.06);
    color: #e4ede8;
  }

  .resource-section:not(.crisis-section):not(.refuge-section) {
    background: #1f3029;
    border-color: rgba(255,255,255,0.06);
  }

  .form-group input,
  .setting-row input,
  .setting-row select {
    background: #1a2820;
    border-color: #2a3f32;
    color: #e4ede8;
  }
  .form-group input::placeholder { color: #4d6b5a; }

  .pathway-btn { background: #1a2820; }
  .pathway-btn.selected { background: #253c2f; }
  .not-sure-box { background: #182218; border-color: #2a3a24; }

  .daily-quote { color: #d4e8da; border-left-color: var(--warm-amber); }

  .milestone-item { background: #1a2820; }
  .milestone-item.reached { background: linear-gradient(135deg, #1a2820, #1f3029); }
  .milestone-item.next { background: linear-gradient(135deg, #221e14, #1f3029); }

  .resource-link:hover { background: #1a2820; }
  .resource-link + .resource-link { border-color: #2a3a30; }

  #screen-settings,
  #screen-onboarding { background: #1a2a21; }
  .settings-section h3 { border-color: #2a3a30; }

  .bottom-nav {
    background: #152018;
    border-color: #253228;
  }

  .screen-header { background: inherit; }
  .days-since, .greeting { color: #6a9a78; }

  .community-intro-card {
    background: linear-gradient(135deg, #1a2a21, #253d30);
  }

  .refuge-section {
    background: linear-gradient(135deg, #28201c, #1f2e24);
    border-color: #4a3530;
  }
  .refuge-principle { background: #1f1a16; color: #b0a090; }

  .crisis-float { box-shadow: 0 4px 20px rgba(37, 99, 168, 0.55); }
  .celebration-content { background: #1f3029; }
  .celebration-title { color: #e4ede8; }
  .celebration-subtitle { color: #9ab8a4; }
}
