:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #efeae2;
  --text: #1b2130;
  --muted: #5f6675;
  --line: #e2dcd2;
  --accent: #c9892b;        /* dawn gold */
  --accent-ink: #ffffff;
  --accent-soft: #f6e7cf;
  --calm: #2f5d8a;
  --good: #2f7d57;
  --danger: #b04a3c;
  --shadow: 0 1px 2px rgba(20, 24, 36, .06), 0 8px 24px rgba(20, 24, 36, .06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --radius: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1220;
    --surface: #161d30;
    --surface-2: #1d2640;
    --text: #eef0f6;
    --muted: #9aa3b8;
    --line: #28324d;
    --accent: #e3a548;
    --accent-ink: #1a1206;
    --accent-soft: #3a2e1c;
    --calm: #7fb0e0;
    --good: #5cc28f;
    --danger: #e0796b;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1220; --surface: #161d30; --surface-2: #1d2640; --text: #eef0f6; --muted: #9aa3b8;
  --line: #28324d; --accent: #e3a548; --accent-ink: #1a1206; --accent-soft: #3a2e1c; --calm: #7fb0e0;
  --good: #5cc28f; --danger: #e0796b; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) 0 calc(76px + env(safe-area-inset-bottom));
}
main { max-width: 560px; margin: 0 auto; padding: 20px 16px 24px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-family: var(--serif); font-weight: 600; font-size: 30px; letter-spacing: -.01em; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin-top: 28px; }
p { margin: 0 0 .8em; }
a { color: var(--calm); }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 22px; font-weight: 600; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.sync-dot { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.sync-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.sync-dot.off::before { background: var(--muted); }

/* Streak */
.streak { text-align: center; padding: 26px 18px; background: linear-gradient(160deg, var(--surface) 30%, var(--accent-soft)); }
.streak .num { font-family: var(--serif); font-size: 72px; line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums; }
.streak .label { color: var(--muted); margin-top: 6px; }

/* Verse */
.verse { font-family: var(--serif); font-size: 19px; line-height: 1.55; margin: 0 0 16px; padding-left: 14px; border-left: 3px solid var(--accent); }
.verse cite { display: block; font-family: var(--sans); font-style: normal; font-size: 13px; color: var(--muted); margin-top: 8px; letter-spacing: .02em; }
.verse.big { font-size: 23px; }

/* Buttons */
button, .btn {
  font: inherit; cursor: pointer; border: 0; border-radius: 14px; padding: 13px 18px;
  background: var(--surface-2); color: var(--text); font-weight: 600; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px;
}
button:focus-visible, .btn:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--calm); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--muted); font-weight: 500; }
.btn-good { background: var(--good); color: #fff; }
.btn-block { width: 100%; }
.tempted {
  width: 100%; min-height: 84px; font-size: 22px; border-radius: 22px;
  background: var(--accent); color: var(--accent-ink); box-shadow: 0 10px 30px -10px var(--accent);
  margin: 6px 0 10px;
}
.tempted:active { transform: scale(.98); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-align: center; }
.stat b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }

/* Bars */
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 110px 1fr 28px; align-items: center; gap: 10px; font-size: 14px; }
.bar .track { height: 10px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--accent); border-radius: 6px; }
.bar .n { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 500; font-size: 15px;
}
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* Forms */
label { display: block; font-weight: 600; margin: 16px 0 8px; }
input[type="text"], input[type="tel"], input[type="date"], textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px;
}
textarea { min-height: 90px; resize: vertical; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

/* Flow (tempted / fell) */
.flow { min-height: calc(100dvh - 140px); display: flex; flex-direction: column; }
.flow .grow { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.flow .steps { display: flex; gap: 6px; margin-bottom: 20px; }
.flow .steps i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.flow .steps i.on { background: var(--accent); }
.hero-line { font-family: var(--serif); font-size: 34px; line-height: 1.15; font-weight: 600; margin-bottom: 18px; }
.reasons { list-style: none; padding: 0; margin: 0; }
.reasons li { padding: 10px 0; border-top: 1px solid var(--line); }
.reasons li:first-child { border-top: 0; }

/* Breath */
.breath { display: grid; place-items: center; margin: 12px 0 20px; }
.breath .circle {
  width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, var(--accent-soft), transparent 70%);
  border: 2px solid var(--accent); display: grid; place-items: center; text-align: center; padding: 20px;
  font-family: var(--serif); font-size: 18px; transform: scale(.7); transition: transform 4s ease-in-out;
}
.breath .circle.in { transform: scale(1); }
@media (prefers-reduced-motion: reduce) { .breath .circle { transition: none; transform: none; } }

/* Escape list */
.escape { display: grid; gap: 10px; }
.escape a, .escape button {
  justify-content: flex-start; text-align: left; background: var(--surface); border: 1px solid var(--line); font-weight: 500;
}

/* Lists */
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; gap: 12px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .when { font-size: 13px; color: var(--muted); }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); margin-right: 4px; }
.tag.good { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.tag.fell { background: color-mix(in srgb, var(--calm) 18%, transparent); color: var(--calm); }
.icon-btn { min-height: 36px; padding: 6px 10px; font-size: 13px; background: transparent; color: var(--muted); border: 1px solid var(--line); }
.domain { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; word-break: break-all; }

.keybox { font-family: ui-monospace, Menlo, monospace; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; word-break: break-all; font-size: 14px; }
details { border-top: 1px solid var(--line); padding: 12px 0; }
details summary { cursor: pointer; font-weight: 600; }
details ol { padding-left: 20px; margin: 10px 0 0; }
details li { margin-bottom: 6px; }

/* Tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); text-decoration: none; padding: 6px 0; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.on { color: var(--accent); }
body.focus .tabbar { display: none; }
body.focus { padding-bottom: env(safe-area-inset-bottom); }

.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .25s; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.celebrate { text-align: center; }
.celebrate .big { font-family: var(--serif); font-size: 64px; font-weight: 600; color: var(--good); line-height: 1; }

/* Photos */
.photo {
  position: relative; overflow: hidden; border-radius: var(--radius); margin-bottom: 18px;
  min-height: 170px; padding: 20px; color: #fff; background: #1d2640 center / cover no-repeat;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.photo::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8, 12, 24, .05) 0%, rgba(8, 12, 24, .72) 100%); }
.photo > * { position: relative; }
.photo.tall { min-height: 260px; }
.photo.short { min-height: 140px; }
.photo.center { text-align: center; justify-content: center; }
.photo .hero-line { color: #fff; text-shadow: 0 2px 16px rgba(0, 0, 0, .35); }
.photo.streak-photo { min-height: 240px; text-align: center; justify-content: center; }
.photo.streak-photo::before { background: linear-gradient(180deg, rgba(8, 12, 24, .25), rgba(8, 12, 24, .6)); }
.photo .num { font-family: var(--serif); font-size: 76px; line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums; }
.photo .label { opacity: .9; margin-top: 6px; }
.kicker { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; font-weight: 600; opacity: .85; }
.bignum { font-family: var(--serif); font-size: 52px; line-height: 1.05; font-weight: 600; margin: 4px 0; }

/* Home cards */
.plan-cta { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--text); border-color: var(--accent); }
.plan-cta b::after { content: " →"; color: var(--accent); }
.reclaim-card .kicker { color: var(--muted); }
.reclaim-card .mid { font-size: 18px; margin: 4px 0 6px; }
.reclaim-card .mid b { font-family: var(--serif); font-size: 40px; color: var(--accent); }

/* Onboarding */
.flowtop { display: flex; justify-content: space-between; align-items: center; min-height: 48px; }
.flowtop .btn-ghost { padding-left: 0; }
.options { display: grid; gap: 10px; margin-top: 8px; }
.option { justify-content: flex-start; background: var(--surface); border: 1px solid var(--line); font-weight: 500; min-height: 56px; }
.option[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.hours { display: flex; align-items: center; justify-content: center; gap: 24px; margin: 24px 0 16px; text-align: center; }
.hours b { display: block; font-family: var(--serif); font-size: 64px; line-height: 1; font-variant-numeric: tabular-nums; min-width: 2.5ch; }
.hours span { color: var(--muted); font-size: 14px; }
.round { width: 56px; height: 56px; border-radius: 50%; font-size: 26px; padding: 0; background: var(--surface); border: 1px solid var(--line); }
.reclaim { list-style: none; margin: 0; padding: 0; }
.reclaim li { display: flex; flex-direction: column; padding: 10px 0; border-top: 1px solid var(--line); }
.reclaim li:first-child { border-top: 0; padding-top: 0; }
.reclaim b { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.reclaim span { font-family: var(--serif); font-size: 20px; }
