:root {
  --bg: #f6f3ea; --card: #ffffff; --ink: #1d2a22; --mute: #6b766f; --line: #e4dfd2; --track: #ebe6d9;
  --brand: #1f8a52; --brand-d: #156b3e; --lime: #9fd65a; --sun: #ffbf3c; --sun-d: #d99410; --coral: #ff6a4d; --coral-d: #d64a2e;
  --water: #2f9bf0; --water-d: #1c77c4; --lock: #d9d4c6; --lock-d: #bfb9a9;
  --leaf: #3fae5f; --leaf2: #2e8f4c; --stem: #2e7d46; --soil: #6b4a2f; --flower: #ffd25e;
  --limb: #1d2a22; --far: #8fa096; --prop: #d8cfbb;
  --r: 18px; --shadow: 0 1px 0 rgba(0,0,0,.04), 0 6px 20px -10px rgba(40,50,30,.25);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #101a15; --card: #18251e; --ink: #eef3ee; --mute: #9aaba1; --line: #26372d; --track: #24332a;
    --lock: #2c3b32; --lock-d: #1f2b24; --limb: #e7efe9; --far: #6f8278; --prop: #34463b; --soil: #4a3422;
    --shadow: 0 1px 0 rgba(255,255,255,.03), 0 8px 24px -12px rgba(0,0,0,.6); }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 16px/1.4 ui-rounded, "SF Pro Rounded", -apple-system, system-ui, "Segoe UI", sans-serif; touch-action: manipulation;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; min-height: 100dvh; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -.01em; }
svg { display: block; }
.boot { text-align: center; padding: 40vh 16px; color: var(--mute); }

#app { max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 8px) 16px calc(env(safe-area-inset-bottom) + 96px); }
.no-tabs #app { padding-bottom: calc(env(safe-area-inset-bottom) + 24px); }

/* top bar */
.top { position: sticky; top: 0; z-index: 5; display: flex; gap: 8px; justify-content: space-between; align-items: center;
  margin: 0 -16px 12px; padding: calc(env(safe-area-inset-top) + 8px) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
#app > .top:first-child { margin-top: calc(-8px - env(safe-area-inset-top)); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 17px; padding: 6px 10px; border-radius: 99px; }
.chip svg { width: 22px; height: 22px; }
.chip.flame { color: var(--coral); } .chip.flame.off { color: var(--mute); }
.chip.seed { color: var(--sun-d); } .chip.ice { color: var(--water); }
.brand { font-weight: 900; font-size: 22px; color: var(--brand); letter-spacing: -.02em; }

/* cards */
.card { background: var(--card); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); border: 1px solid var(--line); margin-bottom: 12px; }
.muted { color: var(--mute); } .small { font-size: 14px; }
.row { display: flex; gap: 12px; align-items: center; }
.grow { flex: 1; min-width: 0; }
.label { font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); margin: 22px 4px 10px; }

/* chunky buttons */
.btn { --c: var(--brand); --d: var(--brand-d); display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 22px;
  border-radius: 16px; font-weight: 800; font-size: 17px; letter-spacing: .02em; color: #fff; background: var(--c); box-shadow: 0 4px 0 var(--d);
  transition: transform .08s, box-shadow .08s; text-transform: uppercase; }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--d); }
.btn.block { width: 100%; }
.btn svg { width: 20px; height: 20px; }
.btn.water { --c: var(--water); --d: var(--water-d); }
.btn.sun { --c: var(--sun); --d: var(--sun-d); color: #3b2a00; }
.btn.coral { --c: var(--coral); --d: var(--coral-d); }
.btn.ghost { --c: var(--card); --d: var(--line); color: var(--ink); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn:disabled { --c: var(--lock); --d: var(--lock-d); color: var(--mute); }
.link { color: var(--brand); font-weight: 800; padding: 10px 4px; }

/* home hero */
.hero { display: flex; gap: 14px; align-items: center; }
.hero .plant { width: 108px; flex: none; }
.plant .sway { transform-origin: 50px 88px; animation: sway 5s ease-in-out infinite; }
.plant.droop .sway { animation: droop 5s ease-in-out infinite; filter: saturate(.55); }
@keyframes sway { 50% { transform: rotate(2.5deg); } }
@keyframes droop { 0%, 100% { transform: rotate(9deg); } 50% { transform: rotate(7deg); } }
.plant.pop { animation: pop .7s cubic-bezier(.3,1.6,.5,1); }
@keyframes pop { 0% { transform: scale(.6); } 100% { transform: scale(1); } }
.stage { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--brand); }
.todo { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; font-weight: 700; }
.todo li { display: flex; gap: 8px; align-items: center; }
.tick { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--lock-d); flex: none; display: grid; place-items: center; }
.tick.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.tick svg { width: 13px; height: 13px; }
.banner { background: var(--water); color: #fff; border: 0; }
.banner b { display: block; margin-bottom: 4px; }
.lost { background: color-mix(in srgb, var(--coral) 12%, var(--card)); border-color: color-mix(in srgb, var(--coral) 35%, var(--line)); }

/* water */
.ring { width: 84px; height: 84px; flex: none; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; stroke-linecap: round; }
.ring .bg { stroke: var(--track); } .ring .fg { stroke: var(--water); transition: stroke-dashoffset .5s cubic-bezier(.3,1.3,.5,1); }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; font-size: 20px; }
.ring span small { display: block; font-size: 11px; color: var(--mute); font-weight: 700; margin-top: -18px; }
.undo { color: var(--mute); font-weight: 700; font-size: 14px; padding: 8px; }

/* bars */
.bar { height: 14px; background: var(--track); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 100%; border-radius: 99px; background: var(--sun); transform-origin: left; transition: transform .6s cubic-bezier(.3,1.2,.5,1); }
.bar.green i { background: var(--brand); }

/* path */
.unit { border-radius: var(--r); padding: 16px 18px; color: #fff; margin: 26px 0 18px; box-shadow: 0 4px 0 rgba(0,0,0,.18); }
.unit small { font-weight: 800; letter-spacing: .08em; opacity: .85; text-transform: uppercase; font-size: 13px; }
.unit h2 { font-size: 21px; margin-top: 2px; }
.unit p { margin: 4px 0 0; opacity: .9; font-size: 15px; }
.nodes { display: grid; justify-items: center; gap: 20px; }
.node.current { margin-top: 46px; }
.node { position: relative; width: 74px; height: 70px; border-radius: 50%; background: var(--c); box-shadow: 0 6px 0 var(--d); color: #fff;
  display: grid; place-items: center; transition: transform .08s, box-shadow .08s; }
.node:active { transform: translateY(6px); box-shadow: 0 0 0 var(--d); }
.node svg { width: 30px; height: 30px; }
.node.locked { --c: var(--lock); --d: var(--lock-d); color: var(--mute); }
.node.gold { --c: var(--sun); --d: var(--sun-d); color: #6b4700; }
.node.current::before { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 4px solid var(--c); opacity: .35; animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(.92); opacity: .5; } 100% { transform: scale(1.22); opacity: 0; } }
.bubble { position: absolute; bottom: calc(100% + 12px); left: 50%; transform: translateX(-50%); background: var(--card); color: var(--c); border: 2px solid var(--line);
  font-weight: 900; font-size: 15px; letter-spacing: .05em; padding: 7px 12px; border-radius: 12px; white-space: nowrap; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translate(-50%, -4px); } }
.chestnode { color: var(--lock-d); width: 64px; height: 64px; display: grid; place-items: center; }
.chestnode svg { width: 54px; height: 54px; }
.chestnode.open { color: var(--sun); }

/* tab bar */
.tabs { position: fixed; z-index: 6; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; background: var(--card);
  border-top: 1px solid var(--line); padding: 6px 4px calc(env(safe-area-inset-bottom) + 6px); }
.tabs button { flex: 1; display: grid; justify-items: center; gap: 2px; padding: 6px 0; font-size: 11px; font-weight: 800; color: var(--mute); border-radius: 12px; }
.tabs button svg { width: 26px; height: 26px; }
.tabs button[aria-current="page"] { color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, transparent); }

/* session */
.sesh { min-height: calc(100dvh - env(safe-area-inset-top) - 32px); display: flex; flex-direction: column; }
.sesh-top { display: flex; align-items: center; gap: 12px; padding: 8px 0 14px; }
.sesh-top .x { width: 40px; height: 40px; display: grid; place-items: center; color: var(--mute); }
.sesh-top .x svg { width: 22px; height: 22px; }
.sesh-top .bar { flex: 1; height: 16px; } .sesh-top .bar i { background: var(--brand); }
.fig { width: 100%; max-height: 34vh; }
.fig .limb { stroke: var(--limb); stroke-width: 6; stroke-linecap: round; }
.fig .limb.far { stroke: var(--far); }
.fig .head { fill: var(--limb); }
.fig .ground { stroke: var(--line); stroke-width: 3; stroke-linecap: round; }
.fig .prop { fill: var(--prop); }
.figcard { background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 18px 10px 10px; box-shadow: var(--shadow); }
.move { text-align: center; margin: 18px 0 8px; }
.move .kind { font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.move h1 { font-size: 26px; margin-top: 4px; }
.amount { font-size: 64px; font-weight: 900; line-height: 1; color: var(--brand); font-variant-numeric: tabular-nums; margin: 6px 0 0; }
.amount small { font-size: 20px; color: var(--mute); font-weight: 800; margin-left: 4px; }
.tip { font-size: 15px; color: var(--mute); text-align: center; margin: 8px 6px 0; }
.why { margin-top: 12px; background: color-mix(in srgb, var(--lime) 22%, var(--card)); border-radius: 14px; padding: 10px 14px; font-size: 15px; }
.why b { color: var(--brand-d); }
@media (prefers-color-scheme: dark) { .why b { color: var(--lime); } }
.actions { margin-top: auto; padding-top: 18px; display: grid; gap: 12px; }
.rate { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.rate .btn { padding: 0 6px; font-size: 14px; min-height: 58px; flex-direction: column; gap: 0; line-height: 1.1; }
.rate .btn span { font-size: 11px; opacity: .85; text-transform: none; font-weight: 700; letter-spacing: 0; }
.skip { justify-self: center; }
.timer { position: relative; width: 150px; height: 150px; margin: 6px auto 0; }
.timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 12; stroke-linecap: round; }
.timer .bg { stroke: var(--track); } .timer .fg { stroke: var(--brand); }
.timer .fg.run { animation: drain var(--t) linear forwards; }
@keyframes drain { to { stroke-dashoffset: 427; } }
.timer span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 46px; font-weight: 900; font-variant-numeric: tabular-nums; }

/* end screen */
.end { text-align: center; padding-top: 4vh; display: flex; flex-direction: column; min-height: calc(100dvh - env(safe-area-inset-top) - 32px); }
.end .plant { width: 150px; margin: 0 auto; }
.end h1 { font-size: 30px; color: var(--brand); margin-top: 10px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0 10px; }
.stat { border-radius: 16px; border: 2px solid var(--c, var(--brand)); overflow: hidden; background: var(--card); }
.stat small { display: block; background: var(--c, var(--brand)); color: #fff; font-weight: 800; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; padding: 4px; }
.stat b { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 24px; padding: 10px 4px; }
.stat b svg { width: 22px; height: 22px; color: var(--c, var(--brand)); }
.wins { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 8px; text-align: left; }
.wins li { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; font-weight: 700; display: flex; gap: 10px; align-items: center; }
.wins li .e { font-size: 22px; }

/* quests, badges, league, garden, me */
.quest { display: flex; gap: 12px; align-items: center; }
.quest + .quest { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.quest .bar { margin-top: 8px; }
.qdone { color: var(--brand); width: 28px; height: 28px; flex: none; }
.qdone.no { color: var(--lock-d); }
.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.badge { text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px 6px; }
.badge .e { font-size: 34px; display: block; }
.badge b { display: block; font-size: 14px; margin-top: 4px; }
.badge small { color: var(--mute); font-size: 12px; display: block; }
.badge.off .e { filter: grayscale(1); opacity: .35; }
.badge.off b { color: var(--mute); }
.crest { width: 110px; height: 110px; margin: 28px auto 34px; border-radius: 34px; background: var(--c); display: grid; place-items: center; transform: rotate(45deg); box-shadow: 0 6px 0 rgba(0,0,0,.2); }
.crest svg { width: 64px; height: 64px; transform: rotate(-45deg); color: #fff; }
.weeks { display: flex; align-items: flex-end; gap: 10px; height: 140px; margin-top: 14px; }
.weeks div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; font-size: 12px; color: var(--mute); font-weight: 700; }
.weeks i { width: 100%; border-radius: 10px 10px 4px 4px; background: var(--lock); min-height: 6px; }
.weeks .now i { background: var(--sun); }
.garden { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.garden figure { margin: 0; text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px 6px; font-size: 12px; color: var(--mute); font-weight: 700; }
.garden .plant { width: 70px; margin: 0 auto 4px; }
.shop { display: grid; gap: 10px; }
.pots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pot { border: 2px solid var(--line); border-radius: 14px; padding: 8px 4px; text-align: center; font-size: 12px; font-weight: 800; background: var(--card); }
.pot[aria-pressed="true"] { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--card)); }
.pot i { display: block; width: 30px; height: 22px; margin: 0 auto 6px; border-radius: 4px 4px 9px 9px; background: var(--c); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.big { font-size: 26px; font-weight: 900; }
.mv { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.mv:first-of-type { border-top: 0; }
.dots { display: inline-flex; gap: 4px; margin-left: 6px; vertical-align: middle; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--lock); } .dots i.on { background: var(--brand); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; margin-top: 8px; }
.seg button { border: 2px solid var(--line); border-radius: 14px; padding: 10px 4px; font-weight: 800; background: var(--card); }
.seg button small { display: block; font-weight: 600; color: var(--mute); font-size: 12px; }
.seg button[aria-pressed="true"] { border-color: var(--brand); color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--card)); }
.set { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); font-weight: 700; }
.set:first-child { border-top: 0; }
.stepper { display: flex; align-items: center; gap: 12px; font-weight: 900; }
.stepper button { width: 36px; height: 36px; border-radius: 10px; border: 2px solid var(--line); font-weight: 900; font-size: 20px; }
details summary { font-weight: 800; cursor: pointer; padding: 4px 0; }
details ol { padding-left: 20px; margin: 10px 0 0; } details li { margin-bottom: 6px; }

/* onboarding */
.onboard { text-align: center; padding-top: 3vh; }
.onboard .plant { width: 120px; margin: 0 auto; }
.onboard h1 { font-size: 40px; color: var(--brand); font-weight: 900; margin-top: 8px; }
.onboard .q { text-align: left; margin-top: 22px; font-weight: 800; }

/* sheet + toast */
.scrim { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; animation: fade .2s; }
.sheet { width: 100%; max-width: 560px; margin: 0 auto; background: var(--card); border-radius: 24px 24px 0 0; padding: 22px 16px calc(env(safe-area-inset-bottom) + 18px); display: grid; gap: 12px; animation: rise .3s cubic-bezier(.2,1,.3,1); }
.sheet h2 { font-size: 22px; } .sheet p { margin: 0; color: var(--mute); }
@keyframes fade { from { opacity: 0; } } @keyframes rise { from { transform: translateY(100%); } }
#toast { position: fixed; z-index: 30; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 92px); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); font-weight: 800; padding: 12px 18px; border-radius: 14px; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); text-align: center; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* leaf confetti */
.burst { position: fixed; inset: 0; pointer-events: none; z-index: 25; overflow: hidden; }
.burst i { position: absolute; top: 40%; left: 50%; width: 14px; height: 9px; border-radius: 0 100% 0 100%; background: var(--c); animation: fly 1.4s cubic-bezier(.2,.7,.4,1) forwards; }
@keyframes fly { to { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; } }
.flamebig { color: var(--coral); width: 54px; height: 54px; margin: 0 auto; animation: pop .7s cubic-bezier(.3,1.6,.5,1); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .timer .fg.run { animation-duration: var(--t) !important; }
}
