/* PocketProof Challenges. Brand tokens match website/assets/css/style.css. */
:root {
  --bg: #faf7ef;
  --surface: #ffffff;
  --sunken: #f2ecdd;
  --text: #1a2420;
  --muted: #5c6a62;
  --faint: #8b9690;
  --primary: #1c6b56;
  --primary-deep: #0f4436;
  --accent: #d98f3a;
  --border: #ebe4d2;
  --shadow: 0 1px 2px rgba(15, 30, 24, 0.05), 0 8px 24px rgba(15, 30, 24, 0.07);
  --shadow-lift: 0 2px 4px rgba(15, 30, 24, 0.06), 0 16px 36px rgba(15, 30, 24, 0.12);
  --radius: 20px;
  --heading: "Fraunces", Georgia, serif;
  --body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mix-soft: 13%;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1613; --surface: #18211d; --sunken: #212c27; --text: #eef3ef; --muted: #a3b2aa;
    --faint: #6f7f77; --primary: #4fb393; --primary-deep: #1c6b56; --accent: #e8a95e;
    --border: #2a3731; --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lift: 0 8px 24px rgba(0, 0, 0, .5);
    --mix-soft: 22%; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1613; --surface: #18211d; --sunken: #212c27; --text: #eef3ef; --muted: #a3b2aa;
  --faint: #6f7f77; --primary: #4fb393; --primary-deep: #1c6b56; --accent: #e8a95e;
  --border: #2a3731; --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lift: 0 8px 24px rgba(0, 0, 0, .5);
  --mix-soft: 22%; color-scheme: dark;
}

/* Per-challenge color themes. --t = main, --t-deep = gradient end. */
.tint-green { --t: #1c6b56; --t-deep: #0c3d31; }
.tint-amber { --t: #a8641b; --t-deep: #6f3f0a; }
.tint-coral { --t: #b84a32; --t-deep: #7d2716; }
.tint-teal  { --t: #1d7c87; --t-deep: #0f4a52; }
.tint-plum  { --t: #7b4a8f; --t-deep: #45255a; }
.tint-sky   { --t: #2f6db0; --t-deep: #173f70; }
[class*="tint-"] {
  --t-soft: color-mix(in srgb, var(--t) var(--mix-soft), var(--surface));
  --t-ink: color-mix(in srgb, var(--t) 85%, var(--text));
}

* { box-sizing: border-box; }

.ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 var(--body); -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: var(--primary); }
h1, h2 { font-family: var(--heading); line-height: 1.12; margin: 0 0 8px; letter-spacing: -0.01em; }
p { margin: 0 0 6px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .7rem; font-weight: 700; color: var(--muted); margin: 0 0 2px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
}
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--heading); font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.brand img { border-radius: 8px; box-shadow: var(--shadow); }
.topbar-spacer { flex: 1; }
[hidden] { display: none !important; }
.icon-btn {
  border: 0; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface); box-shadow: var(--shadow); font-size: 1.5rem; line-height: 1; padding-bottom: 3px; color: var(--text);
}

main { max-width: 560px; margin: 0 auto; padding: 8px 16px 48px; outline: none; animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* ---------- intro (no challenges yet) ---------- */
.intro { text-align: center; padding: 8px 4px 4px; }
.intro h1 { font-size: 2rem; margin: 18px 0 10px; }
.hl { color: var(--primary); background: linear-gradient(transparent 62%, color-mix(in srgb, var(--accent) 35%, transparent) 62%); padding: 0 2px; }
.intro-art { position: relative; height: 150px; margin: 4px auto 0; max-width: 300px; }
.mini-card {
  position: absolute; display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  border-radius: 18px; color: #fff; box-shadow: var(--shadow-lift);
  background: linear-gradient(140deg, var(--t), var(--t-deep));
}
.mini-card b { font-family: var(--heading); font-size: 1.6rem; line-height: 1; display: block; }
.mini-card small { opacity: .8; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.mc-back { right: 6px; top: 6px; transform: rotate(6deg); opacity: .95; }
.mc-front { left: 6px; top: 50px; transform: rotate(-4deg); text-align: left; }
.mini-card .mr { width: 46px; height: 46px; transform: rotate(-90deg); }
.mini-card circle { fill: none; stroke-width: 6; }
.mr-bg { stroke: rgba(255, 255, 255, .25); }
.mr-fg { stroke: #fff; stroke-linecap: round; stroke-dasharray: 113; stroke-dashoffset: 36; }

/* ---------- home hero (has challenges) ---------- */
.hero-card {
  position: relative; overflow: hidden; color: #fff; border-radius: 24px; padding: 22px 20px 18px; margin-top: 4px;
  background: radial-gradient(120% 90% at 100% 0%, #2a8a6f 0%, transparent 55%), linear-gradient(150deg, #1c6b56, #0b3a2f);
  box-shadow: 0 18px 36px rgba(15, 68, 54, .28);
}
.hero-card::after {
  content: ""; position: absolute; right: -40px; bottom: -60px; width: 180px; height: 180px; border-radius: 50%;
  border: 28px solid rgba(255, 255, 255, .06);
}
.hero-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 600; opacity: .8; margin: 0; }
.hero-big { font-family: var(--heading); font-weight: 700; font-size: 3rem; line-height: 1.05; margin: 2px 0 12px; }
.hero-bar { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .18); overflow: hidden; }
.hero-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #f4c27a, #fff); }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 16px; position: relative; z-index: 1; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats div + div { padding-left: 14px; border-left: 1px solid rgba(255, 255, 255, .18); }
.hero-stats strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.hero-stats span { font-size: .75rem; opacity: .75; }

.section-title { font-size: 1.3rem; margin: 28px 0 12px; }
.section-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.section-tag { font-size: .72rem; font-weight: 700; padding: 4px 10px; border-radius: 99px; white-space: nowrap; }
.tag-free { background: color-mix(in srgb, var(--primary) 14%, var(--surface)); color: var(--primary); }
.tag-paid { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); color: color-mix(in srgb, var(--accent) 80%, var(--text)); }

/* ---------- cards ---------- */
.card {
  display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); text-decoration: none; color: inherit;
  animation: rise .4s ease both; animation-delay: calc(var(--d, 0) * 45ms);
}
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }

.run-card { display: flex; gap: 14px; padding: 14px; transition: transform .15s, box-shadow .15s; }
.run-card:active { transform: scale(.985); }
.mini-ring { flex: none; width: 52px; height: 52px; position: relative; }
.mini-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.mini-ring circle { fill: none; stroke-width: 5; }
.mini-ring .bg { stroke: var(--t-soft); }
.mini-ring .fg { stroke: var(--t); stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.mini-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: .8rem; color: var(--t-ink); font-variant-numeric: tabular-nums; }
.run-body { flex: 1; min-width: 0; }
.run-top { display: flex; align-items: flex-start; gap: 8px; }
.run-title { font-weight: 700; flex: 1; min-width: 0; line-height: 1.3; }
.run-amounts { margin: 2px 0 0; font-variant-numeric: tabular-nums; }
.run-amounts strong { font-family: var(--heading); font-size: 1.35rem; color: var(--t-ink); }
.run-amounts span { color: var(--faint); font-size: .9rem; }
.run-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: .8rem; color: var(--muted); }
.run-foot b { color: var(--text); }


.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pick-card {
  position: relative; text-align: left; display: flex; flex-direction: column; padding: 0 0 14px; overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}
.pick-card:hover { box-shadow: var(--shadow-lift); }
.pick-card:active { transform: scale(.97); }
.pick-art {
  position: relative; height: 66px; overflow: hidden; display: flex; align-items: flex-end; padding: 0 14px 8px;
  color: rgba(255, 255, 255, .95); font-family: var(--heading); font-weight: 700; font-size: 2rem; line-height: 1;
  background: radial-gradient(90% 120% at 85% 0%, rgba(255, 255, 255, .16) 0%, transparent 60%), linear-gradient(140deg, var(--t), var(--t-deep));
}
.pick-art::after {
  content: ""; position: absolute; right: -24px; top: -24px; width: 90px; height: 90px; border-radius: 50%;
  border: 14px solid rgba(255, 255, 255, .1);
}
.pick-art small { font-family: var(--body); font-size: .72rem; font-weight: 600; margin: 0 0 4px 6px; }
.pick-goal { font-family: var(--heading); font-weight: 700; font-size: 1.55rem; line-height: 1.1; padding: 12px 14px 0; color: var(--t-ink); }
.pick-title { font-weight: 600; font-size: .92rem; line-height: 1.25; padding: 2px 14px 0; }
.pick-meta { font-size: .75rem; color: var(--muted); padding: 6px 14px 0; margin-top: auto; }
.badge {
  position: absolute; top: 10px; right: 10px; z-index: 1; font-size: .7rem; font-weight: 700; letter-spacing: .04em;
  padding: 4px 9px; border-radius: 99px; background: rgba(255, 255, 255, .92); color: var(--t-deep);
}
.badge-lock { padding: 5px; display: grid; place-items: center; }
.badge-lock .ico { width: 14px; height: 14px; stroke-width: 2.3; }
.pick-card.locked .pick-art { filter: saturate(.75); }

.unlock-card {
  display: flex; align-items: center; gap: 14px; width: 100%; margin: 0 0 12px; padding: 16px; text-align: left;
  border: 0; border-radius: var(--radius); color: #fff;
  background: radial-gradient(100% 140% at 0% 0%, #f0b45e 0%, transparent 50%), linear-gradient(135deg, #1c6b56, #0b3a2f);
  box-shadow: 0 14px 28px rgba(15, 68, 54, .25); transition: transform .15s;
}
.unlock-card:active { transform: scale(.985); }
.unlock-emojis { display: flex; }
.unlock-emojis span {
  height: 30px; padding: 0 9px; border-radius: 99px; display: grid; place-items: center; font-size: .72rem; font-weight: 700;
  background: #fff; color: var(--t); box-shadow: 0 0 0 2px #15553f; margin-left: -8px;
}
.unlock-emojis span:first-child { margin-left: 0; }
.unlock-text { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.unlock-text span { font-size: .8rem; opacity: .8; }
.unlock-arrow { font-size: 1.3rem; }
.fine { font-size: .75rem; color: var(--faint); margin-top: 28px; text-align: center; }

.chip { font-size: .7rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; white-space: nowrap; display: inline-block; }
.chip-on, .chip-ahead { background: color-mix(in srgb, var(--primary) 14%, var(--surface)); color: var(--primary); }
.chip-behind { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); color: color-mix(in srgb, var(--accent) 80%, var(--text)); }
.chip-done { background: var(--primary); color: #fff; }

/* ---------- tracker ---------- */
.track-hero {
  position: relative; overflow: hidden; color: #fff; border-radius: 26px; padding: 20px; margin-top: 4px;
  background: radial-gradient(110% 90% at 100% 0%, rgba(255, 255, 255, .12) 0%, transparent 55%), linear-gradient(150deg, var(--t), var(--t-deep));
  box-shadow: 0 18px 36px color-mix(in srgb, var(--t-deep) 35%, transparent);
}
.track-hero::after {
  content: ""; position: absolute; left: -50px; bottom: -70px; width: 200px; height: 200px; border-radius: 50%;
  border: 30px solid rgba(255, 255, 255, .06);
}
.track-top { display: flex; gap: 18px; align-items: center; position: relative; z-index: 1; }
.ring-wrap { position: relative; flex: none; width: 112px; height: 112px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 11; }
.ring-bg { stroke: rgba(255, 255, 255, .2); }
.ring-fg { stroke: #fff; stroke-linecap: round; transition: stroke-dashoffset .6s cubic-bezier(.16, 1, .3, 1); }
.ring-label { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--heading); font-size: 1.9rem; }
.ring-label small { font-size: .55em; opacity: .8; }
.track-meta { min-width: 0; }
.track-name { font-weight: 600; font-size: .9rem; margin: 0; }
.track-big { font-family: var(--heading); font-weight: 700; font-size: 2.6rem; line-height: 1.05; margin: 2px 0 0; }
.track-sub { margin: 0 0 8px; }
.track-hero .chip { background: rgba(255, 255, 255, .2); color: #fff; }
.track-hero .chip-done { background: #fff; color: var(--t-deep); }
.track-stats {
  position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 18px;
  background: rgba(0, 0, 0, .14); border-radius: 16px; padding: 10px 4px;
}
.track-stats div { display: flex; flex-direction: column; align-items: center; }
.track-stats div + div { border-left: 1px solid rgba(255, 255, 255, .15); }
.track-stats strong { font-size: 1rem; font-variant-numeric: tabular-nums; }
.track-stats span { font-size: .72rem; }

.next-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 6px; padding: 14px 14px 14px 18px;
  border: 2px solid color-mix(in srgb, var(--t) 40%, var(--border));
}
.next-amt { font-family: var(--heading); font-weight: 700; font-size: 2rem; line-height: 1.05; margin: 0; color: var(--t-ink); }

.btn { border: 0; border-radius: 14px; padding: 12px 18px; font-weight: 600; background: var(--primary); color: #fff; white-space: nowrap; transition: transform .1s, filter .15s; }
.btn:active { transform: scale(.97); }
.btn-tint { background: linear-gradient(140deg, var(--t), var(--t-deep)); box-shadow: 0 8px 18px color-mix(in srgb, var(--t) 35%, transparent); padding: 14px 18px; }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow); }
.btn-danger { background: color-mix(in srgb, #d96a4f 14%, var(--surface)); color: #c4513a; }
.btn-block { display: block; width: 100%; margin-top: 10px; }

.list-head { display: flex; justify-content: flex-end; gap: 0; padding: 14px 16px 0; font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.list-head span:first-child { margin-right: 34px; }
.list-head span:last-child { width: 64px; text-align: right; }
.weeks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.month { font-family: var(--heading); font-weight: 600; font-size: 1.05rem; padding: 14px 4px 2px; color: var(--muted); }
.week {
  width: 100%; display: grid; grid-template-columns: 30px 1fr auto 64px; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); text-align: left;
  transition: background .2s, border-color .2s, transform .1s;
}
.week:active { transform: scale(.985); }
.week-label { font-weight: 600; display: flex; flex-direction: column; line-height: 1.2; }
.week-label small { font-weight: 500; color: var(--faint); font-size: .76rem; margin-top: 2px; }
.week-amt { font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.week-total { text-align: right; color: var(--faint); font-size: .82rem; font-variant-numeric: tabular-nums; }
.check {
  width: 28px; height: 28px; border-radius: 10px; border: 2px solid var(--border); display: grid; place-items: center;
  transition: background .2s, border-color .2s;
}
.check svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 16; stroke-dashoffset: 16; }
.week.done { background: var(--t-soft); border-color: transparent; }
.week.done .check { background: var(--t); border-color: var(--t); animation: pop .35s ease; }
.week.done .check svg { stroke-dashoffset: 0; transition: stroke-dashoffset .3s .05s ease; }
.week.done .week-amt { color: var(--t-ink); }
.week.done .week-label small { color: var(--muted); }
.week.due .check { border-color: var(--accent); }
.week.due .week-label small { color: color-mix(in srgb, var(--accent) 85%, var(--text)); font-weight: 600; }
.week.moved { background: transparent; border-style: dashed; color: var(--faint); }
.week.moved .check { border-style: dashed; }
.week.moved .week-label, .week.moved .week-amt { color: var(--faint); }
.week.next { border: 2px solid color-mix(in srgb, var(--t) 50%, var(--border)); padding: 11px 13px; }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }

.boxes { display: grid; gap: 8px; margin: 18px 0 10px; }
.boxes-envelopes { grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 5px; }
.boxes-bingo { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.box {
  aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 14px;
  border: 1px solid var(--border); background: var(--surface); font-weight: 700; font-variant-numeric: tabular-nums;
  box-shadow: 0 1px 2px rgba(15, 30, 24, .05); transition: background .2s, transform .1s;
}
.box:active { transform: scale(.93); }
.boxes-envelopes .box { border-radius: 8px; font-size: .74rem; padding: 0; }
.boxes-bingo .box { font-size: 1.2rem; }
.boxes-bingo .box::before { content: "$"; font-size: .6em; opacity: .5; line-height: 1; margin-bottom: 1px; }
.box.done { background: linear-gradient(140deg, var(--t), var(--t-deep)); color: #fff; border-color: transparent; animation: pop .35s ease; }
.box.free { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: color-mix(in srgb, var(--accent) 85%, var(--text)); font-size: 1.2rem; border-color: transparent; }
.box.free small { font-size: .55rem; letter-spacing: .08em; }
.boxes-bingo .box.free::before { content: none; }
.grid-note { text-align: center; color: var(--muted); font-size: .88rem; }

.tracker-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.tracker-actions .span-2 { grid-column: span 2; }

/* ---------- sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(10, 20, 16, .5); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .2s; }
.sheet-backdrop[hidden] { display: none; }
.sheet-backdrop.open { opacity: 1; }
.sheet {
  width: 100%; max-width: 560px; background: var(--surface); border-radius: 26px 26px 0 0;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom)); transform: translateY(40px); transition: transform .3s cubic-bezier(.16, 1, .3, 1);
  max-height: 90vh; overflow-y: auto;
}
.sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 99px; background: var(--border); margin: 0 auto 16px; }
.sheet-backdrop.open .sheet { transform: none; }
.sheet h2 { font-size: 1.6rem; }
.sheet-hero {
  margin: 0 -4px 16px; border-radius: 20px; padding: 18px; color: #fff; display: flex; align-items: center; gap: 14px;
  background: linear-gradient(140deg, var(--t), var(--t-deep));
}
.sheet-hero b { font-family: var(--heading); font-size: 2rem; line-height: 1; display: block; }
.sheet-hero span { font-size: .85rem; }
.field { display: grid; gap: 6px; font-weight: 600; font-size: .9rem; margin: 16px 0 4px; }
.field input { font: inherit; padding: 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.choice { border: 0; padding: 0; margin: 16px 0 4px; display: grid; gap: 8px; }
.choice legend { font-weight: 600; font-size: .9rem; margin-bottom: 8px; padding: 0; }
.choice label { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; cursor: pointer; }
.choice label:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, var(--surface)); }
.choice input { margin-top: 3px; accent-color: var(--primary); width: 18px; height: 18px; flex: none; }
.choice span { display: flex; flex-direction: column; line-height: 1.3; }
.choice small { color: var(--muted); font-size: .8rem; margin-top: 2px; }
.catchup-lead { margin-top: 14px; }
.catchup-list { display: grid; gap: 6px; margin: 10px 0 6px; }
.catchup-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border); cursor: pointer; }
.catchup-row input { width: 20px; height: 20px; accent-color: var(--primary); flex: none; }
.catchup-row span { flex: 1; }
.perks { list-style: none; padding: 0; margin: 14px 0; }
.perks li { margin: 8px 0; padding-left: 28px; position: relative; }
.perks li::before { content: "✓"; position: absolute; left: 0; top: 0; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; font-weight: 700; background: color-mix(in srgb, var(--primary) 15%, var(--surface)); color: var(--primary); }

/* ---------- share sheet ---------- */
.share-frame { display: grid; place-items: center; background: var(--sunken); border-radius: 18px; padding: 14px; margin: 12px 0 14px; }
.share-frame img { display: block; max-width: 100%; max-height: 44vh; border-radius: 10px; box-shadow: var(--shadow-lift); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--sunken); border-radius: 14px; margin-bottom: 10px; }
.seg button { border: 0; background: transparent; padding: 9px 8px; border-radius: 10px; font-weight: 600; font-size: .88rem; color: var(--muted); }
.share-hint { margin: 8px 0 0; }
.seg small { display: block; font-size: .72rem; font-weight: 500; opacity: .8; }
.field-label { font-weight: 600; font-size: .9rem; margin: 16px 0 8px; }
.remind-row { display: flex; gap: 12px; align-items: flex-start; margin: 16px 0 4px; padding: 12px 14px; border-radius: 14px; background: var(--bg); border: 1px solid var(--border); cursor: pointer; }
.remind-row input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--primary); flex: none; }
.remind-row span { display: flex; flex-direction: column; line-height: 1.3; }
.remind-row small { color: var(--muted); font-size: .8rem; margin-top: 2px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- get back on track ---------- */
.chip-btn { border: 0; cursor: pointer; font: inherit; font-size: .7rem; font-weight: 700; }
.track-hero .chip-btn { background: #fff; color: var(--t-deep); }
.fix-list { display: grid; gap: 8px; margin: 14px 0 10px; }
.fix-option { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); }
.fix-option:active { transform: scale(.985); }
.fix-option small { color: var(--muted); font-size: .82rem; line-height: 1.35; }

/* ---------- finish ---------- */
.finish-hero { margin: 0 -4px 16px; border-radius: 22px; padding: 26px 20px; text-align: center; color: #fff; background: linear-gradient(150deg, var(--t), var(--t-deep)); }
.finish-kicker { font-weight: 600; margin: 0 0 6px; }
.finish-big { font-family: var(--heading); font-weight: 700; font-size: 2.3rem; line-height: 1.1; margin: 0 0 8px; }
.finish-line { margin: 0 0 4px; font-weight: 600; }
.finish-dates { margin: 0; font-size: .85rem; }
.finish-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0 6px; padding: 14px 14px 14px 18px; border: 2px solid color-mix(in srgb, var(--t) 40%, var(--border)); }
.next-picks { display: grid; gap: 8px; }
.next-pick { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); }
.np-goal { font-family: var(--heading); font-weight: 700; font-size: 1.3rem; color: var(--t-ink); min-width: 78px; }
.np-name { flex: 1; display: flex; flex-direction: column; font-weight: 600; line-height: 1.3; }
.np-name small { font-weight: 500; color: var(--muted); font-size: .78rem; }
.np-lock { color: var(--muted); }
.np-lock .ico { width: 18px; height: 18px; }

/* ---------- keep progress safe ---------- */
.nudge-card { margin: 14px 0 6px; padding: 16px; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.nudge-title { font-weight: 700; margin: 0 0 4px; }
.nudge-text { font-size: .9rem; color: var(--muted); margin: 0 0 12px; }
.nudge-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.nudge-actions .btn { padding: 10px 14px; font-size: .9rem; }
.link-btn { border: 0; background: none; color: var(--primary); font-weight: 600; padding: 8px 4px; text-decoration: underline; text-underline-offset: 3px; }
.cal-tip { margin: 8px 0 4px; text-align: center; }
.file-link { display: block; margin: 12px auto 0; font-size: .82rem; font-weight: 500; color: var(--muted); }
.backup-link { display: block; margin: 22px auto 0; font-size: .85rem; }
.code-box { width: 100%; font: .78rem/1.4 ui-monospace, Menlo, Consolas, monospace; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); color: var(--text); resize: none; margin-top: 10px; word-break: break-all; }

/* ---------- waitlist ---------- */
.soon { margin: 6px 0 4px; padding: 14px; border-radius: 16px; background: var(--bg); border: 1px solid var(--border); }
.soon p { font-size: .9rem; }
.waitlist { display: flex; gap: 8px; margin-top: 10px; position: relative; }
.waitlist input[type="email"] { flex: 1; min-width: 0; font: inherit; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.soon .fine { margin: 8px 0 0; text-align: left; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- custom challenge builder ---------- */
.build-card { position: relative; display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px; text-align: left; border: 2px dashed color-mix(in srgb, var(--primary) 35%, var(--border)); background: color-mix(in srgb, var(--primary) 5%, var(--surface)); }
.build-card .badge { top: 50%; transform: translateY(-50%); background: var(--sunken); color: var(--muted); }
.bc-plus { flex: none; width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; font-size: 1.8rem; font-weight: 300; color: #fff; background: linear-gradient(140deg, var(--primary), var(--primary-deep)); }
.bc-text { display: flex; flex-direction: column; line-height: 1.3; padding-right: 30px; }
.bc-text small { color: var(--muted); font-size: .82rem; margin-top: 2px; }

.builder-title { font-size: 1.7rem; margin: 10px 0 4px; }
.bcard { padding: 16px; margin-top: 14px; }
.bcard .field:first-child { margin-top: 0; }
.field-label.first { margin-top: 0; }
.field input[type="text"], .field input[type="number"] { font: inherit; padding: 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg); color: var(--text); width: 100%; }
.money-input { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 14px; background: var(--bg); padding-left: 12px; font-weight: 600; }
.money-input input { border: 0 !important; background: transparent !important; padding-left: 4px !important; min-width: 0; }
.money-input.sm { border-radius: 10px; padding-left: 8px; width: 96px; }
.money-input.sm input { padding: 7px 6px 7px 2px !important; font-size: .95rem; width: 100%; }
#b-goal-wrap.is-auto .money-input { opacity: .6; }
#b-goal-wrap.is-auto::after { content: "Adds up from the amounts you type below"; font-weight: 500; font-size: .78rem; color: var(--muted); }
.seg-wrap { grid-auto-flow: row; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--surface); background: linear-gradient(140deg, var(--t), var(--t-deep)); box-shadow: 0 0 0 1px var(--border); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--text); }
.stepper { display: flex; align-items: stretch; gap: 6px; }
.stepper button { width: 46px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); font-size: 1.3rem; font-weight: 600; }
.stepper input { text-align: center; flex: 1; font-weight: 700 !important; }
.style-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.style-opt { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); }
.style-opt small { color: var(--muted); font-size: .76rem; line-height: 1.3; }
.style-opt[aria-pressed="true"] { border: 2px solid var(--t); padding: 11px; background: var(--t-soft); }
.range-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.range-row .field { margin-top: 12px; font-size: .82rem; }
.preview-head { display: flex; justify-content: space-between; align-items: baseline; }
.plan-summary { font-size: .88rem; color: var(--muted); margin: 0 0 8px; }
.plan-summary strong { color: var(--t-ink); font-size: 1rem; }
.plan-rows { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto; }
.plan-row { display: grid; grid-template-columns: 1fr auto 70px; align-items: center; gap: 10px; padding: 8px 2px; border-top: 1px solid var(--border); }
.pr-label { font-weight: 600; font-size: .92rem; display: flex; flex-direction: column; line-height: 1.2; }
.pr-label small { font-weight: 500; color: var(--faint); font-size: .74rem; }
.pr-amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.pr-total { text-align: right; color: var(--faint); font-size: .82rem; font-variant-numeric: tabular-nums; }
.builder-error { color: #c4513a; font-size: .88rem; font-weight: 600; min-height: 1.2em; margin: 10px 0 0; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- account + sync ---------- */
.account-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: .85rem; padding: 7px 14px; border-radius: 99px; box-shadow: var(--shadow); }
.account-btn.signed-in { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; border-radius: 50%; color: #fff; border: 0; background: linear-gradient(140deg, var(--primary), var(--primary-deep)); font-family: var(--heading); font-size: 1.05rem; }
.account-btn.is-syncing { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); }
.tips-row { margin-top: 12px; }
.code-links { display: flex; justify-content: space-between; margin-top: 10px; }
.code-links .link-btn { font-size: .85rem; }
#signin-code { font-size: 1.5rem; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.field input[type="email"] { font: inherit; padding: 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg); color: var(--text); width: 100%; }
.sync-line { font-weight: 600; color: var(--primary); margin: 10px 0 4px; }

/* ---------- feedback ---------- */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 30; width: 100%; height: 100%; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 40;
  transform: translate(-50%, 20px); opacity: 0; transition: .25s;
  background: var(--text); color: var(--bg); padding: 11px 20px; border-radius: 99px; font-weight: 600; font-size: .92rem;
  max-width: calc(100% - 32px); text-align: center; pointer-events: none; box-shadow: var(--shadow-lift);
  display: flex; align-items: center; gap: 14px; white-space: nowrap;
}
.toast.has-action { pointer-events: auto; padding-right: 8px; }
.toast-undo { border: 0; background: color-mix(in srgb, var(--bg) 18%, transparent); color: var(--bg); font-weight: 700; padding: 6px 12px; border-radius: 99px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 360px) {
  .grid { grid-template-columns: 1fr; }
  .ring-wrap { width: 92px; height: 92px; }
  .track-big { font-size: 2.1rem; }
  .week { grid-template-columns: 26px 1fr auto 56px; gap: 8px; }
}
