/* ── Variables ── */
:root {
  --ink: #2b2320;
  --muted: #8a7d76;
  --accent: #c98a6b;
  --accent2: #e8b4a0;
  --accent-dark: #a86648;
  --gold: #caa15a;
  --gold-dark: #a8823e;
  --good: #6fae7e;
  --warn: #e0a54c;
  --border: #eee2dc;
  --card-bg: #ffffff;
  --phone-border: #1c1613;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input { font: inherit; }

/* ── Body / Background ── */
body {
  font-family: var(--font);
  color: var(--ink);
  min-height: 100vh;
  background: linear-gradient(160deg, #f3e9e4 0%, #e9dcd6 50%, #f6efe9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 12px;
}

/* ── Phone Frame ── */
.phone {
  width: 100%;
  max-width: 400px;
  height: 820px;
  background: #fff;
  border-radius: 38px;
  border: 2px solid var(--phone-border);
  box-shadow:
    0 0 0 4px #2e1f19,
    0 32px 80px rgba(28, 22, 19, 0.35),
    inset 0 1px 0 rgba(255,255,255,0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ── Status Bar ── */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px 8px;
  background: #fff;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.status-bar #clock { font-size: 12px; font-weight: 600; color: var(--ink); }
.status-brand { font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: 0.04em; }
.status-sig { font-size: 8px; color: var(--muted); letter-spacing: 2px; }

/* ── Scroll Area ── */
.scroll-area {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0 0 80px; /* space for nav */
  scrollbar-width: none;
}
.scroll-area::-webkit-scrollbar { display: none; }

/* ── Screens ── */
.screen { padding: 24px 20px 12px; }
.hidden { display: none !important; }

/* ── Screen Header ── */
.screen-header { margin-bottom: 20px; }
.screen-header h2 { font-size: 22px; font-weight: 700; color: var(--ink); }
.screen-header .muted { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.5; }

/* ── Onboarding ── */
.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.logo-sq {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(201,138,107,0.4);
}
.brand-text { font-size: 16px; font-weight: 700; color: var(--ink); letter-spacing: -0.02em; }

.hero-banner {
  background: linear-gradient(135deg, #f3d5c5 0%, #e8b4a0 60%, #f0c9a0 100%);
  border-radius: 18px;
  height: 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.hero-banner::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
}
.hero-emoji { font-size: 44px; line-height: 1; }
.hero-sub { font-size: 11px; font-weight: 600; color: var(--accent-dark); letter-spacing: 0.08em; text-transform: uppercase; }

.hero-heading {
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 10px;
}
.lead {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 16px;
}

.pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.pill {
  background: rgba(232, 180, 160, 0.25);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(201,138,107,0.2);
}

.email-input {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  color: var(--ink);
  background: #faf7f5;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 6px;
}
.email-input:focus { border-color: var(--accent); background: #fff; }
.input-error { font-size: 12px; color: #d0614a; margin-bottom: 8px; }
.micro-note { font-size: 12px; color: var(--muted); text-align: center; margin-top: 10px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 20px;
  border-radius: 13px;
  font-size: 15px;
  font-weight: 600;
  transition: opacity 0.15s, transform 0.1s;
}
.btn:active { opacity: 0.85; transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-full { width: 100%; margin-bottom: 10px; }
.btn-sm { padding: 9px 18px; font-size: 13px; border-radius: 10px; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  box-shadow: 0 4px 14px rgba(168, 102, 72, 0.3);
}
.btn-primary:hover { box-shadow: 0 6px 18px rgba(168,102,72,0.4); }

.btn-secondary {
  background: rgba(232,180,160,0.3);
  color: var(--accent-dark);
  border: 1.5px solid rgba(201,138,107,0.2);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #fff;
  box-shadow: 0 4px 14px rgba(202,161,90,0.35);
  font-size: 16px;
  font-weight: 700;
}
.btn-gold:hover { box-shadow: 0 6px 18px rgba(202,161,90,0.45); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
.btn-ghost:hover { color: var(--ink); }

/* ── Scan Screen ── */
.scan-box {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 1;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, #fdf0e8 0%, #f5d9c8 100%);
  border-radius: 20px;
  border: 2px dashed var(--accent2);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.scan-face { font-size: 72px; z-index: 1; transition: transform 0.3s; }
.scan-pulse {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: transparent;
  opacity: 0;
}
.scan-box.scanning .scan-pulse {
  animation: pulse-scan 1s ease-in-out infinite;
}
.scan-box.scanning .scan-face { animation: face-float 1s ease-in-out infinite; }
@keyframes pulse-scan {
  0%, 100% { box-shadow: inset 0 0 0 3px rgba(201,138,107,0.2); opacity: 1; }
  50% { box-shadow: inset 0 0 0 10px rgba(201,138,107,0.1); opacity: 1; }
}
@keyframes face-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.corner {
  position: absolute;
  width: 22px; height: 22px;
  border-color: var(--accent);
  border-style: solid;
  border-width: 0;
}
.corner.tl { top: 10px; left: 10px; border-top-width: 2.5px; border-left-width: 2.5px; border-radius: 2px 0 0 0; }
.corner.tr { top: 10px; right: 10px; border-top-width: 2.5px; border-right-width: 2.5px; border-radius: 0 2px 0 0; }
.corner.bl { bottom: 10px; left: 10px; border-bottom-width: 2.5px; border-left-width: 2.5px; border-radius: 0 0 0 2px; }
.corner.br { bottom: 10px; right: 10px; border-bottom-width: 2.5px; border-right-width: 2.5px; border-radius: 0 0 2px 0; }

.scan-tip { text-align: center; font-size: 13px; color: var(--muted); margin-bottom: 16px; }

/* ── Score Ring ── */
.score-ring-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 8px;
}
.score-ring { width: 100%; height: 100%; }
.score-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.score-num { font-size: 34px; font-weight: 800; color: var(--ink); line-height: 1; }
.score-tag { font-size: 11px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.score-summary { text-align: center; font-size: 13px; color: var(--muted); margin-bottom: 18px; }

/* ── Cards ── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
}
.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Metrics ── */
.metric-row { margin-bottom: 12px; }
.metric-row:last-child { margin-bottom: 0; }
.metric-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 5px;
  color: var(--ink);
}
.metric-val { font-weight: 600; }
.good-text { color: var(--good); }
.warn-text { color: var(--warn); }
.bar {
  height: 7px;
  background: #f3ede9;
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}
.bar-fill.good { background: linear-gradient(90deg, #6fae7e, #5a9a6a); }
.bar-fill.warn { background: linear-gradient(90deg, #e0a54c, #c88a35); }
.more-hint { margin-top: 8px; }
.small { font-size: 12px; }

/* ── Locked Cards ── */
.locked-card { position: relative; overflow: hidden; }
.blurred-content {
  filter: blur(3px);
  pointer-events: none;
  user-select: none;
  opacity: 0.6;
}
.premium-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 252, 250, 0.88);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  border-radius: 14px;
  gap: 6px;
}
.lock-icon { font-size: 26px; margin-bottom: 4px; }
.premium-overlay h4 { font-size: 15px; font-weight: 700; color: var(--ink); }
.premium-overlay p { font-size: 12px; color: var(--muted); line-height: 1.5; max-width: 220px; }

/* ── Badges ── */
.badge-free {
  font-size: 10px;
  font-weight: 700;
  background: rgba(111,174,126,0.15);
  color: var(--good);
  border: 1px solid rgba(111,174,126,0.3);
  padding: 2px 7px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Routine Steps ── */
.routine-step {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #faf3ef;
}
.routine-step:last-child { border-bottom: none; }
.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.step-body strong { font-size: 14px; font-weight: 600; color: var(--ink); display: block; margin-bottom: 3px; }
.step-body .muted { line-height: 1.5; }

/* ── Mini Chart ── */
.mini-chart {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 14px;
  height: 80px;
  padding-bottom: 20px;
  position: relative;
}
.mini-bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
}
.mini-bar {
  width: 100%;
  background: linear-gradient(to top, #dbc5b5, #e8d4c7);
  border-radius: 4px 4px 0 0;
  flex: none;
  align-self: flex-end;
}
.mini-bar.active { background: linear-gradient(to top, var(--accent-dark), var(--accent)); }
.mini-label { font-size: 10px; color: var(--muted); font-weight: 500; }
.chart-legend { text-align: center; margin-top: 6px; }

/* ── Profile ── */
.plan-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.plan-label { font-size: 14px; font-weight: 600; color: var(--ink); }
.plan-email { font-size: 12px; margin-top: 2px; }
.plan-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 4px 9px;
  border-radius: 8px;
  background: #f0ebe7;
  color: var(--muted);
}
.plan-badge.gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #fff;
  box-shadow: 0 2px 8px rgba(202,161,90,0.3);
}
.premium-perks { }

/* ── Derm Chat ── */
.chat-preview { display: flex; flex-direction: column; gap: 6px; }
.chat-bubble {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 12px;
  max-width: 85%;
  line-height: 1.4;
}
.chat-bubble.user {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 3px;
}
.chat-bubble.reply {
  background: #f3ede9;
  color: var(--ink);
  align-self: flex-start;
  border-bottom-left-radius: 3px;
}

/* ── Bottom Nav ── */
.bottom-nav {
  display: flex;
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  border-radius: 0 0 36px 36px;
  padding: 8px 0 18px;
}
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0;
  color: var(--muted);
  transition: color 0.15s;
}
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn span { font-size: 10px; font-weight: 500; }
.nav-btn.active { color: var(--accent); }
.nav-btn:hover { color: var(--accent-dark); }

/* ── Paywall ── */
.paywall-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28,22,19,0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(3px);
}
.paywall-sheet {
  background: #fff;
  border-radius: 28px 28px 0 0;
  padding: 12px 24px 36px;
  width: 100%;
  max-width: 400px;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.25, 0.9, 0.3, 1);
}
.paywall-sheet.slide-up { transform: translateY(0); }
.sheet-handle {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 16px;
}
.crown-wrap { text-align: center; margin-bottom: 8px; }
.crown-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  width: 58px; height: 58px;
  background: linear-gradient(135deg, #fef3dc, #fde7b0);
  border-radius: 50%;
  border: 2px solid rgba(202,161,90,0.3);
}
.paywall-title {
  text-align: center;
  font-size: 19px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 18px;
  letter-spacing: -0.02em;
}

.feature-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.feature-row { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink); }
.check {
  width: 22px; height: 22px;
  background: linear-gradient(135deg, var(--good), #5a9a6a);
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.plan-options {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.plan-option {
  flex: 1;
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 12px 10px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: #faf7f5;
}
.plan-option.selected {
  border-color: var(--accent);
  background: rgba(201,138,107,0.06);
}
.plan-opt-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-wrap: wrap;
}
.plan-opt-price {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
}
.plan-opt-price span { font-size: 12px; font-weight: 500; color: var(--muted); }
.save-badge {
  font-size: 9px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #fff;
  padding: 2px 5px;
  border-radius: 5px;
  letter-spacing: 0.04em;
}

.billing-note {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  margin-top: 10px;
}

/* ── Toast ── */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  background: var(--ink);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  z-index: 200;
  max-width: 320px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  transition: transform 0.35s cubic-bezier(0.25, 0.9, 0.3, 1), opacity 0.35s;
  opacity: 0;
  white-space: nowrap;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ── Utility ── */
.muted { color: var(--muted); }
