:root {
  --bg: #14161A;
  --surface: #1D2027;
  --surface2: #242832;
  --border: #2B2F38;
  --text: #F3F4F0;
  --text-secondary: #9DA1AC;
  --text-muted: #838996;
  --accent: #C6FF3D;
  --accent-soft: rgba(198, 255, 61, 0.14);
  --negative: #FF7A68;
  --negative-soft: rgba(255, 122, 104, 0.14);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'Work Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
  color: var(--text);
  background: var(--bg);
}
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }
::-webkit-scrollbar { width: 0; height: 0; }

#phone { background: var(--bg); position: relative; overflow: hidden; }
@media (min-width: 481px) {
  body { background: #0A0B0D; display: flex; justify-content: center; }
  #phone {
    width: 412px;
    height: 860px;
    margin: 32px auto;
    border-radius: 36px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
    border: 1px solid #26282F;
  }
}
@media (max-width: 480px) {
  #phone { width: 100%; height: 100dvh; }
}

#app, .screen { height: 100%; display: flex; flex-direction: column; background: var(--bg); color: var(--text); position: relative; }

/* Topbar */
.topbar { padding: 12px 24px 8px; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.topbar.spread { justify-content: space-between; }
.topbar-title { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 18px; }
.spacer-36 { width: 36px; display: inline-block; }

.back-btn, .avatar-sm, .ghost-btn, .icon-btn {
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; flex-shrink: 0;
}
.back-btn { width: 36px; height: 36px; border-radius: 11px; background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.back-btn svg { width: 18px; height: 18px; }

/* Section header — brand mark + large title, used by Dashboard, Progress and Profile */
.dash-header { padding: 22px 24px 20px; display: flex; flex-direction: column; gap: 22px; flex-shrink: 0; }
.brand-row { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 6px; font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-secondary); }
.brand svg { width: 13px; height: 13px; color: var(--accent); }
.avatar-sm { width: 34px; height: 34px; border-radius: 50%; background: var(--surface2); border: 1px solid var(--border); color: var(--text-secondary); }
.avatar-sm svg { width: 16px; height: 16px; }
.name-hero { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 32px; line-height: 1.05; }
.header-divider { height: 1px; background: var(--border); flex-shrink: 0; }

.scroll-body { flex: 1; overflow-y: auto; padding: 4px 24px 96px; -webkit-overflow-scrolling: touch; }

/* FAB + bottom nav */
.fab {
  position: absolute; right: 24px; bottom: 96px; width: 56px; height: 56px; border-radius: 18px;
  background: var(--accent); color: var(--bg); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px rgba(198, 255, 61, .25); text-decoration: none;
}
.fab svg { width: 24px; height: 24px; }

.bottom-nav { height: 76px; background: var(--surface); border-top: 1px solid var(--border); display: flex; justify-content: space-around; align-items: center; flex-shrink: 0; }
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text-muted); font-size: 11px; font-weight: 600; text-decoration: none; padding: 8px 12px; }
.nav-item svg { width: 22px; height: 22px; }
.nav-item.active { color: var(--accent); }

/* Hero card */
.hero-card { background: var(--surface); border-radius: 22px; padding: 20px; margin-top: 8px; }
.label-caps { font-size: 12px; color: var(--text-secondary); letter-spacing: .5px; }
.hero-row { display: flex; align-items: flex-end; gap: 4px; margin-top: 6px; }
.hero-value { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 38px; line-height: 1; }
.hero-unit { font-size: 15px; color: var(--text-secondary); padding-bottom: 6px; }
.spacer { flex: 1; }
.delta-chip { font-size: 12px; font-weight: 700; padding: 6px 10px; border-radius: 10px; }
.delta-chip.good { background: var(--accent-soft); color: var(--accent); }
.delta-chip.bad { background: var(--negative-soft); color: var(--negative); }
canvas.chart { width: 100%; display: block; margin-top: 14px; }

.section-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); letter-spacing: .5px; margin: 20px 0 10px; text-transform: uppercase; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-card { background: var(--surface); border-radius: 16px; padding: 14px; }
.stat-label { font-size: 11px; color: var(--text-secondary); letter-spacing: .4px; }
.stat-value { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 22px; margin-top: 4px; }
.stat-delta { display: flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; margin-top: 6px; }
.stat-delta svg { width: 11px; height: 11px; }
.stat-delta.good { color: var(--accent); }
.stat-delta.bad { color: var(--negative); }

.measure-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.measure-pill { background: var(--surface); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; justify-content: space-between; min-height: 72px; }
.measure-label { font-size: 11px; color: var(--text-secondary); }
.measure-value { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 15px; }

.ad-slot { margin: 24px 0 4px; display: flex; justify-content: center; }

/* Empty state */
.empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px; text-align: center; }
.empty-icon { width: 64px; height: 64px; border-radius: 18px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; margin-bottom: 18px; }
.empty-icon svg { width: 30px; height: 30px; }
.title-lg { font-family: 'Space Grotesk', sans-serif; font-size: 18px; margin: 0 0 8px; }
.title-xl { font-family: 'Space Grotesk', sans-serif; font-size: 28px; margin: 0 0 10px; }
.muted { color: var(--text-secondary); line-height: 1.5; margin: 0; }
.center { text-align: center; }
.pad { padding: 24px 0; }

.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 8px; height: 52px;
  background: var(--accent); color: var(--bg); border: none; border-radius: 16px;
  font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 15px; width: 100%; text-decoration: none;
}
.btn-primary svg { width: 18px; height: 18px; }
.btn-primary.inline { width: auto; padding: 0 24px; margin-top: 22px; }
.btn-primary:disabled { opacity: .7; }

/* Choice cards */
.choice-card { display: flex; gap: 16px; padding: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; text-decoration: none; color: inherit; margin-bottom: 14px; }
.choice-card.highlighted { background: var(--surface2); }
.choice-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--surface2); color: var(--text-secondary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.choice-icon svg { width: 24px; height: 24px; }
.choice-icon.accent { background: var(--accent-soft); color: var(--accent); }
.choice-title { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.badge { font-size: 10px; font-weight: 700; background: var(--accent); color: var(--bg); padding: 2px 7px; border-radius: 6px; }
.choice-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.45; margin-top: 4px; }

/* Scan capture */
.scan-screen { background: #0E0F12; overflow: hidden; }
.scan-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; z-index: 0; }
.scan-scrim {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(to bottom, rgba(0,0,0,.55) 0%, rgba(0,0,0,0) 24%, rgba(0,0,0,0) 62%, rgba(0,0,0,.6) 100%);
}
.scan-topbar, .scan-center, .scan-bottom { position: relative; z-index: 2; }
.scan-topbar { display: flex; justify-content: space-between; padding: 8px 24px; flex-shrink: 0; }
.ghost-btn { width: 44px; height: 44px; border-radius: 50%; background: rgba(255, 255, 255, .08); color: #fff; display: flex; align-items: center; justify-content: center; }
.ghost-btn svg { width: 20px; height: 20px; }
.ghost-btn-spacer { width: 44px; height: 44px; flex-shrink: 0; }
.scan-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 24px; text-align: center; }
.scan-frame { position: relative; width: 300px; max-width: 100%; aspect-ratio: 3 / 4; display: flex; align-items: center; justify-content: center; }
.corner { position: absolute; width: 26px; height: 26px; border-color: var(--accent); border-style: solid; border-width: 0; }
.corner.tl { top: 0; left: 0; border-top-width: 3px; border-left-width: 3px; border-top-left-radius: 4px; }
.corner.tr { top: 0; right: 0; border-top-width: 3px; border-right-width: 3px; border-top-right-radius: 4px; }
.corner.bl { bottom: 0; left: 0; border-bottom-width: 3px; border-left-width: 3px; border-bottom-left-radius: 4px; }
.corner.br { bottom: 0; right: 0; border-bottom-width: 3px; border-right-width: 3px; border-bottom-right-radius: 4px; }
.scan-hint { margin-top: 22px; font-size: 13px; color: #C7C9D1; line-height: 1.5; text-shadow: 0 1px 4px rgba(0, 0, 0, .9); }
.scan-bottom { display: flex; justify-content: space-between; align-items: center; padding: 0 40px 40px; flex-shrink: 0; }
.shutter-btn {
  width: 76px; height: 76px; border-radius: 50%; border: 4px solid var(--accent); display: flex; align-items: center;
  justify-content: center; background: transparent; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.shutter-dot { width: 60px; height: 60px; border-radius: 50%; background: var(--accent); display: block; }
.shutter-btn.busy .shutter-dot { display: none; }
.spinner { width: 24px; height: 24px; border-radius: 50%; border: 2px solid rgba(198, 255, 61, .3); border-top-color: var(--accent); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Banner + form fields */
.banner { display: flex; align-items: center; gap: 10px; background: var(--accent-soft); border-radius: 14px; padding: 12px 14px; margin-bottom: 20px; font-size: 12px; }
.banner svg { width: 16px; height: 16px; color: var(--accent); flex-shrink: 0; }

.field { margin-bottom: 12px; }
.field-label { display: block; font-size: 12px; color: var(--text-secondary); font-weight: 600; letter-spacing: .5px; margin-bottom: 6px; text-transform: uppercase; }
.field-label.small { text-transform: none; font-weight: 400; letter-spacing: 0; }
.input-box { height: 52px; padding: 0 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; display: flex; align-items: center; }
.input-box.row { justify-content: space-between; }
.input-box input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 17px; width: 100%; }
.input-box .unit { color: var(--text-muted); font-size: 13px; margin-left: 8px; }
.input-box.small { height: 46px; padding: 0 14px; }
.input-box.small input { font-size: 15px; }
.age-chip { font-size: 11px; color: var(--text-secondary); background: var(--surface2); padding: 4px 9px; border-radius: 8px; margin-right: 8px; white-space: nowrap; }

.measure-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }

.delete-link { display: block; text-align: center; margin-top: 28px; padding: 8px; font-size: 14px; font-weight: 600; color: var(--negative); text-decoration: none; }
.policy-link { display: block; text-align: center; margin-top: 18px; padding: 8px; font-size: 13px; color: var(--text-secondary); text-decoration: underline; }

.readonly-box { background: var(--surface2); border: 1px solid var(--border); border-radius: 14px; padding: 12px 16px; margin-bottom: 12px; }
.ro-row { display: flex; justify-content: space-between; align-items: center; }
.ro-label { font-size: 12px; color: var(--text-secondary); }
.ro-value { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 17px; }
.ro-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.bottom-bar { padding: 16px; background: var(--surface); border-top: 1px solid var(--border); flex-shrink: 0; }

/* Progress */
.pill-row { display: flex; gap: 8px; overflow-x: auto; padding: 14px 24px 16px; -webkit-overflow-scrolling: touch; flex-shrink: 0; }
.pill { flex-shrink: 0; padding: 9px 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.pill.active { background: var(--accent); border-color: var(--accent); color: var(--bg); }

.stat-row { display: flex; gap: 10px; }
.stat-block { flex: 1; background: var(--surface); border-radius: 14px; padding: 14px; }
.stat-block.good { background: var(--accent-soft); }
.stat-block.bad { background: var(--negative-soft); }
.sb-label { font-size: 11px; color: var(--text-secondary); }
.sb-value { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 19px; margin-top: 4px; }
.stat-block.good .sb-value { color: var(--accent); }
.stat-block.bad .sb-value { color: var(--negative); }

.chart-card { background: var(--surface); border-radius: 20px; padding: 18px; margin-top: 20px; }
.chart-card-top { display: flex; justify-content: space-between; align-items: center; }
.chart-title { font-size: 13px; font-weight: 600; }
.icon-btn { width: 30px; height: 30px; border-radius: 9px; background: var(--surface2); color: var(--text-secondary); }
.icon-btn svg { width: 15px; height: 15px; }
.chart-axis { display: flex; justify-content: space-between; margin-top: 8px; }
.chart-axis span { font-size: 10px; color: var(--text-muted); }

.history-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.history-row .strong { flex: 1; text-align: right; }
.history-row:hover, .history-row:active { background: var(--surface2); }
.strong { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 14px; }

/* Share story */
.share-preview { flex: 1; display: flex; align-items: center; justify-content: center; padding: 20px; }
.story-card { width: 260px; height: 462px; border-radius: 28px; border: 1px solid var(--border); background: linear-gradient(180deg, #1B1E24, #101215); padding: 22px; display: flex; flex-direction: column; box-sizing: border-box; }
.story-brand { display: flex; align-items: center; gap: 8px; font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 13px; }
.story-brand-icon { width: 26px; height: 26px; border-radius: 8px; background: var(--accent-soft); position: relative; flex-shrink: 0; }
.story-brand-icon::after { content: ''; position: absolute; inset: 8px; border-radius: 50%; background: var(--accent); }
.story-metric-label { font-size: 11px; color: var(--text-secondary); letter-spacing: .6px; margin-top: 22px; }
.story-delta { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 40px; color: var(--accent); margin-top: 6px; }
.story-range { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.story-card canvas { width: 100%; margin-top: 18px; }
.story-caption { font-size: 13px; line-height: 1.4; margin-top: auto; padding-top: 14px; }
.story-watermark { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--text-muted); margin-top: 14px; }
.story-watermark .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--text-muted); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translate(-50%, 10px);
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  padding: 10px 18px; border-radius: 12px; font-size: 13px; opacity: 0;
  transition: opacity .25s, transform .25s; z-index: 50; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Onboarding */
.onboarding { padding: 0 28px 32px; box-sizing: border-box; }
.brand-row { display: flex; align-items: center; gap: 10px; padding-top: 24px; flex-shrink: 0; }
.brand-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.brand-icon svg { width: 20px; height: 20px; }
.brand-name { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 20px; }
.onboarding .title-xl { margin-top: 36px; }
.subtitle { color: var(--text-secondary); font-size: 15px; line-height: 1.5; margin: 0 0 28px; }
.form-scroll { flex: 1; overflow-y: auto; }
.form-scroll .field-label { margin-top: 20px; }
.form-scroll .field-label:first-child { margin-top: 0; }
