:root {
  --bg: #efeff1;
  --card: #fafafa;
  --ink: #111111;
  --ink-2: #3a3a3c;
  --muted: #8e8e93;
  --soft: #e4e4e8;
  --line: #dcdce0;
  --r: 24px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 14px rgba(0,0,0,.04);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --on-ink: #ffffff; --on-ink-2: #bbbbbb; --faint: #c4c4c8; --ico-off: #b5b5ba; --tag: #b9b9be; --glass: rgba(250,250,250,.86);
  --h0: #e2e2e6; --h1: #c3c3c8; --h2: #8c8c92; --h3: #4a4a4f; --h4: #111111;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0d0d0f; --card: #19191c; --ink: #f2f2f4; --ink-2: #c9c9ce; --muted: #8e8e93; --soft: #29292d; --line: #3a3a3f;
  --on-ink: #111113; --on-ink-2: #6b6b70; --faint: #55555b; --ico-off: #6a6a70; --tag: #3a3a3f; --glass: rgba(30,30,34,.82);
  --h0: #222226; --h1: #48484e; --h2: #828288; --h3: #c0c0c5; --h4: #f2f2f4;
  --shadow: 0 0 0 1px rgba(255,255,255,.04);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --bg: #0d0d0f; --card: #19191c; --ink: #f2f2f4; --ink-2: #c9c9ce; --muted: #8e8e93; --soft: #29292d; --line: #3a3a3f;
  --on-ink: #111113; --on-ink-2: #6b6b70; --faint: #55555b; --ico-off: #6a6a70; --tag: #3a3a3f; --glass: rgba(30,30,34,.82);
  --h0: #222226; --h1: #48484e; --h2: #828288; --h3: #c0c0c5; --h4: #f2f2f4;
  --shadow: 0 0 0 1px rgba(255,255,255,.04);
  color-scheme: dark;
  }
}
/* Illustrations are black ink on transparent: flip to white ink in dark mode. */
:root[data-theme="dark"] .ink { filter: invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ink { filter: invert(1); } }
body, .tile, .card, .task, .stat, .jentry, .tabbar, .chip { transition: background-color .25s, color .25s; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; overscroll-behavior-y: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
svg { display: block; }

.view { max-width: 520px; margin: 0 auto; padding: calc(var(--safe-t) + 18px) 16px calc(var(--safe-b) + 110px); }

/* ---------- top chips (home-app style) ---------- */
.chips { display: flex; gap: 8px; align-items: center; margin-bottom: 22px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); font-weight: 650; font-size: 15px; white-space: nowrap; }
.chip svg { width: 17px; height: 17px; }
.chip.dark { background: var(--ink); color: var(--on-ink); }
.chips .spacer { flex: 1; }
.chip.icon { width: 40px; padding: 0; justify-content: center; }

/* ---------- headings ---------- */
.hello { font-size: 15px; color: var(--muted); font-weight: 550; margin: 0 0 2px; }
.big { font-size: clamp(34px, 10.5vw, 44px); line-height: 1.02; letter-spacing: -.035em; font-weight: 750; margin: 0; }
.big .light { font-weight: 350; color: var(--muted); white-space: nowrap; }
.h2 { font-size: 26px; letter-spacing: -.02em; font-weight: 720; margin: 30px 0 4px; }
.sub { color: var(--muted); font-size: 14px; font-weight: 550; margin: 0 0 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }

/* ---------- date strip ---------- */
.datebar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.datenav { display: flex; gap: 6px; }
.round { width: 44px; height: 44px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); display: grid; place-items: center; }
.round svg { width: 20px; height: 20px; }
.round:disabled { opacity: .35; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 20px 0 6px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 0 8px; border-radius: 18px; font-size: 18px; font-weight: 650; }
.wd small { font-size: 11px; color: var(--muted); font-weight: 550; text-transform: lowercase; }
.wd i { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.wd.has i { background: var(--ink); }
.wd.on { background: var(--ink); color: var(--on-ink); }
.wd.on small { color: var(--on-ink-2); }
.wd.on i { background: var(--on-ink); }
.wd.future { color: var(--faint); }

/* ---------- tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.tile { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px; display: flex; align-items: center; gap: 12px; text-align: left; min-height: 78px; transition: transform .12s; }
.ico { flex: none; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); color: var(--ico-off); }
.ico svg { width: 22px; height: 22px; }
.tile.on .ico { background: var(--ink); color: var(--on-ink); }
.tile b { display: block; font-size: 16px; font-weight: 680; }
.tile > div > span { display: block; font-size: 13px; color: var(--muted); font-weight: 550; margin-top: 2px; }
.tile.wide { grid-column: 1 / -1; }

/* ---------- cards ---------- */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px; }
.xpcard { margin-top: 10px; display: flex; align-items: center; gap: 14px; }
.xpcard .lvl { font-size: 34px; font-weight: 780; letter-spacing: -.03em; line-height: 1; }
.xpcard .meta { flex: 1; }
.xpcard .meta small { color: var(--muted); font-weight: 600; font-size: 12px; }
.bar { height: 8px; border-radius: 99px; background: var(--soft); overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: var(--ink); border-radius: 99px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.dots { display: flex; gap: 6px; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--soft); }
.dots i.on { background: var(--ink); }
.dots i.extra { background: var(--ink); box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px var(--ink); }

/* ---------- tasks ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.task { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 20px; padding: 14px 16px; box-shadow: var(--shadow); }
.check { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; color: transparent; transition: all .15s; }
.check svg { width: 16px; height: 16px; }
.task.done .check { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.task .t { flex: 1; font-weight: 600; font-size: 16px; }
.task.done .t { color: var(--muted); text-decoration: line-through; }
.task .xp { font-size: 12px; font-weight: 700; color: var(--muted); }
.task .del { color: var(--faint); width: 28px; height: 28px; display: grid; place-items: center; }
.task .del svg { width: 16px; height: 16px; }
.addrow { display: flex; gap: 8px; }
.addrow input { flex: 1; height: 52px; border-radius: 18px; border: 0; background: var(--card); box-shadow: var(--shadow); padding: 0 16px; font-size: 16px; outline: none; }
.addrow input:focus { box-shadow: 0 0 0 2px var(--ink); }
.empty { color: var(--muted); font-size: 14px; font-weight: 550; padding: 8px 2px; }

/* ---------- buttons ---------- */
.pill { height: 58px; border-radius: 999px; background: var(--ink); color: var(--on-ink); font-weight: 680; font-size: 17px; width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; transition: transform .12s, opacity .2s; }
.pill:disabled { opacity: .4; }
.pill.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.pill.sm { height: 52px; width: auto; padding: 0 20px; font-size: 15px; }
.seg { display: inline-flex; background: var(--soft); border-radius: 999px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg button { height: 34px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 650; color: var(--ink-2); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- tab bar ---------- */
.tabbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-b) + 14px); z-index: 20; display: flex; align-items: center; gap: 4px; padding: 8px; border-radius: 999px; background: var(--glass); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); box-shadow: 0 8px 30px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.03); }
.tab { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: #a4a4a9; }
.tab svg { width: 24px; height: 24px; }
.tab.on { color: var(--ink); background: var(--soft); }
.mic-fab { width: 64px; height: 64px; border-radius: 50%; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; margin: 0 4px; box-shadow: 0 6px 18px rgba(0,0,0,.25); transition: transform .12s; }
.mic-fab svg { width: 26px; height: 26px; }

/* ---------- sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.25); display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease; }
.sheet .panel { width: 100%; max-width: 520px; max-height: 94dvh; overflow-y: auto; background: var(--bg); border-radius: 34px 34px 0 0; padding: 22px 20px calc(var(--safe-b) + 22px); animation: up .55s var(--spring-soft); }
.sheet.full .panel { height: 100dvh; max-height: none; border-radius: 0; padding-top: calc(var(--safe-t) + 18px); display: flex; flex-direction: column; }
.sheet .top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.tag { display: inline-flex; height: 30px; align-items: center; padding: 0 12px; border-radius: 10px; background: var(--tag); color: var(--on-ink); font-weight: 650; font-size: 13px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* metric editor */
.editor-title { text-align: center; margin: 6px 0 2px; font-size: 15px; color: var(--muted); font-weight: 600; }
.editor-value { text-align: center; font-size: 72px; font-weight: 760; letter-spacing: -.045em; line-height: 1.05; margin: 4px 0 4px; }
.editor-value small { font-size: 28px; color: var(--muted); font-weight: 500; letter-spacing: -.02em; }
.stepper { display: flex; justify-content: center; gap: 14px; margin: 14px 0 22px; }
.stepper button { width: 76px; height: 76px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); font-size: 30px; font-weight: 400; display: grid; place-items: center; }
.stepper button svg { width: 26px; height: 26px; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 18px 0 24px; }
.scale button { aspect-ratio: .8; border-radius: 22px; background: var(--card); box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 28px; }
.scale button small { font-size: 11px; font-weight: 650; color: var(--muted); }
.scale button.on { background: var(--ink); color: var(--on-ink); }
.scale button.on small { color: var(--on-ink-2); }
.choice { display: flex; gap: 10px; justify-content: center; margin: 18px 0 18px; }
.choice button { flex: 1; max-width: 140px; aspect-ratio: .82; border-radius: 26px; background: var(--card); box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; font-weight: 650; font-size: 15px; }
.choice button svg { width: 30px; height: 30px; }
.choice button.on { background: var(--ink); color: var(--on-ink); }
.chipset { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 20px; }
.chipset button { height: 38px; padding: 0 16px; border-radius: 999px; box-shadow: inset 0 0 0 1.5px var(--line); font-weight: 600; font-size: 14px; }
.chipset button.on { background: var(--ink); color: var(--on-ink); box-shadow: none; }
.textarea { width: 100%; min-height: 140px; border: 0; border-radius: 22px; background: var(--card); box-shadow: var(--shadow); padding: 16px; font-size: 17px; line-height: 1.45; resize: none; outline: none; }
.textarea:focus { box-shadow: 0 0 0 2px var(--ink); }
.clear { display: block; margin: 12px auto 0; color: var(--muted); font-size: 14px; font-weight: 600; }

/* ---------- voice capture ---------- */
.capture { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; }
.capture .art { width: 200px; height: 200px; }
.capture h1 { font-size: 34px; letter-spacing: -.03em; font-weight: 450; line-height: 1.12; margin: 6px 0 4px; }
.capture h1 b { font-weight: 750; }
.capture p { color: var(--muted); font-size: 15px; font-weight: 550; max-width: 300px; margin: 0 auto; line-height: 1.4; }
.recbtn { position: relative; width: 112px; height: 112px; border-radius: 50%; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; margin: 26px auto 10px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.recbtn svg { width: 38px; height: 38px; }
.timer { font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 650; min-height: 24px; }
.linkbtn { color: var(--ink-2); font-weight: 650; font-size: 15px; text-decoration: underline; text-underline-offset: 3px; padding: 8px; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--soft); border-top-color: var(--ink); animation: spin .8s linear infinite; margin: 20px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.heard { font-size: 15px; color: var(--ink-2); line-height: 1.45; background: var(--card); border-radius: 20px; padding: 14px 16px; box-shadow: var(--shadow); margin: 6px 0 16px; }
.heard em { color: var(--muted); font-style: normal; font-size: 12px; font-weight: 700; display: block; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .05em; }
.parsed { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.parsed .dayhead { font-size: 13px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin: 10px 2px 2px; }
.pitem { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 20px; padding: 12px 14px; box-shadow: var(--shadow); text-align: left; width: 100%; }
.pitem .ico { width: 40px; height: 40px; background: var(--ink); color: var(--on-ink); }
.pitem .ico svg { width: 19px; height: 19px; }
.pitem .txt { flex: 1; min-width: 0; }
.pitem .txt b { display: block; font-size: 15px; font-weight: 680; }
.pitem .txt span { display: block; font-size: 13px; color: var(--muted); font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pitem.off { opacity: .4; }
.pitem.off .ico { background: var(--soft); color: var(--faint); }
.pitem .check { width: 24px; height: 24px; }
.pitem:not(.off) .check { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }

/* celebrate */
.celebrate { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.celebrate .art { width: 220px; height: 220px; animation: pop .5s cubic-bezier(.2,1.6,.4,1); }
.celebrate h1 { font-size: 34px; font-weight: 450; letter-spacing: -.03em; line-height: 1.12; margin: 14px 0 10px; }
.celebrate h1 b { font-weight: 760; }
.xpbig { font-size: 64px; font-weight: 800; letter-spacing: -.04em; margin: 4px 0; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }

/* ---------- heatmap ---------- */
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 4px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.heat::-webkit-scrollbar { display: none; }
.heat i { width: 100%; aspect-ratio: 1; min-width: 14px; border-radius: 4px; background: var(--h0); }
.heat i.l1, .legend i.l1 { background: var(--h1); }
.heat i.l2, .legend i.l2 { background: var(--h2); }
.heat i.l3, .legend i.l3 { background: var(--h3); }
.heat i.l4, .legend i.l4 { background: var(--h4); }
.heat i.out { background: transparent; }
.heat i.today { box-shadow: inset 0 0 0 2px var(--ink); }
.legend { display: flex; align-items: center; gap: 4px; justify-content: flex-end; font-size: 11px; color: var(--muted); font-weight: 600; margin-top: 8px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; background: var(--h0); display: inline-block; }
.statgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.stat { background: var(--card); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.stat .n { font-size: 38px; font-weight: 780; letter-spacing: -.035em; line-height: 1; }
.stat .n small { font-size: 16px; color: var(--muted); font-weight: 600; letter-spacing: 0; margin-left: 2px; }
.stat .l { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 6px; }
.spark { display: flex; align-items: end; gap: 4px; height: 70px; margin-top: 14px; }
.spark i { flex: 1; background: var(--ink); border-radius: 4px 4px 2px 2px; min-height: 3px; }
.spark i.empty { background: var(--soft); }
.sparklbl { display: flex; gap: 4px; margin-top: 6px; }
.sparklbl span { flex: 1; text-align: center; font-size: 10px; color: var(--muted); font-weight: 650; }

/* ---------- journal ---------- */
.jentry { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px 18px; }
.jentry .when { font-size: 13px; color: var(--muted); font-weight: 650; display: flex; justify-content: space-between; margin-bottom: 6px; }
.jentry p { margin: 0; font-size: 17px; line-height: 1.45; white-space: pre-wrap; }
.hero-art { width: 150px; height: 150px; margin: 10px auto 0; }

/* plan */
.plan-day { margin-top: 22px; }
.plan-day h3 { font-size: 15px; font-weight: 700; margin: 0 2px 8px; display: flex; justify-content: space-between; }
.plan-day h3 span { color: var(--muted); font-weight: 600; }
.dateinput { height: 52px; border-radius: 18px; border: 0; background: var(--card); box-shadow: var(--shadow); padding: 0 12px; font-size: 15px; font-weight: 600; }

/* settings */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 650; }
.field input { height: 52px; border-radius: 18px; border: 0; background: var(--card); box-shadow: var(--shadow); padding: 0 16px; font-size: 16px; outline: none; }

/* toast */
.toast { position: fixed; left: 50%; top: calc(var(--safe-t) + 14px); transform: translateX(-50%); z-index: 80; background: var(--ink); color: var(--on-ink); font-weight: 650; font-size: 15px; padding: 12px 20px; border-radius: 999px; box-shadow: 0 10px 30px rgba(0,0,0,.2); animation: drop .3s cubic-bezier(.2,1.4,.4,1); white-space: nowrap; }
@keyframes drop { from { transform: translate(-50%, -30px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.sheet.still, .sheet.still .panel { animation: none; }
.tile > div { min-width: 0; } .tile > div > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; } .seg::-webkit-scrollbar { display: none; } .seg button { padding: 0 12px; white-space: nowrap; flex: none; }
.pill svg { width: 20px; height: 20px; }
/* mascot + buddy picker */
.xpcard .mascot { width: 56px; height: 56px; flex: none; margin: -6px -4px -6px -6px; }
.buddies { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.buddy { background: var(--card); border-radius: 20px; box-shadow: var(--shadow); padding: 8px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; font-weight: 650; color: var(--muted); }
.buddy img { width: 100%; aspect-ratio: 1; object-fit: contain; }
.buddy.on { box-shadow: 0 0 0 2px var(--ink); color: var(--ink); }
.buddies { grid-template-columns: repeat(3, 1fr); } .buddy img { max-width: 92px; }

/* ---------------- motion ----------------
   Two spring curves (simulated physics, see README): --spring bounces a little (presses, pops),
   --spring-soft barely overshoots (sheets, bars). Older browsers fall back to a cubic-bezier. */
:root { --spring: cubic-bezier(.34, 1.45, .64, 1); --spring-soft: cubic-bezier(.22, 1.15, .36, 1); }
@supports (transition-timing-function: linear(0, 1)) {
  :root {
    --spring: linear(0, 0.036, 0.131, 0.263, 0.413, 0.567, 0.714, 0.844, 0.952, 1.038, 1.099, 1.139, 1.159, 1.163, 1.154, 1.137, 1.115, 1.09, 1.065, 1.042, 1.021, 1.004, 0.991, 0.982, 0.976, 0.974, 0.974, 0.975, 0.978, 0.982, 0.986, 0.99, 0.994, 0.997, 1, 1.002, 1.003, 1.004, 1.004, 1.004, 1);
    --spring-soft: linear(0, 0.015, 0.056, 0.115, 0.185, 0.263, 0.343, 0.424, 0.502, 0.576, 0.644, 0.707, 0.763, 0.813, 0.856, 0.893, 0.924, 0.95, 0.971, 0.988, 1.001, 1.011, 1.018, 1.023, 1.026, 1.028, 1.028, 1.028, 1.027, 1.025, 1.023, 1.021, 1.018, 1.016, 1.014, 1.012, 1.01, 1.008, 1.007, 1.005, 1);
  }
}
/* Squish on press, spring back (with a tiny overshoot) on release. */
:is(.tile, .pill, .round, .chip, .tab, .mic-fab, .check, .buddy, .wd, .pitem, .scale button, .choice button, .chipset button, .stepper button, .seg button, .recbtn) {
  transition: transform .5s var(--spring), background-color .2s, color .2s, box-shadow .2s;
}
:is(.tile, .pill, .round, .chip, .tab, .mic-fab, .check, .buddy, .wd, .pitem, .scale button, .choice button, .chipset button, .stepper button, .seg button, .recbtn):active {
  transform: scale(.94); transition: transform .08s ease-out;
}
/* One-shot pops after logging something (the class is set for a single render). */
.tile.pop .ico, .task.pop .check { animation: squish .55s var(--spring); }
.task.pop .check path { stroke-dasharray: 22; stroke-dashoffset: 22; animation: draw .32s .1s ease-out forwards; }
.task.enter { animation: enter .5s var(--spring-soft); }
@keyframes squish { 0% { transform: scale(.55); } 100% { transform: scale(1); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes enter { from { transform: translateY(10px) scale(.97); opacity: 0; } }
.bar > i { transition: width 1s var(--spring-soft); }
.xpcard .mascot { animation: float 5s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes float { 50% { transform: translateY(-3px) rotate(-3deg); } }

/* Voice rings: three circles behind the record button, scaled by your live loudness (app.js). */
.mic-wrap { position: relative; width: 112px; height: 112px; margin: 46px auto 34px; }
.mic-wrap .recbtn { margin: 0; z-index: 1; }
.mic-wrap.live .recbtn { transition: none; }
.wave { position: absolute; inset: 0; border-radius: 50%; background: var(--ink); opacity: 0; pointer-events: none; will-change: transform, opacity; }
.mic-wrap:not(.live) .wave:first-child { animation: breathe 2.8s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(1); opacity: 0; } 50% { transform: scale(1.22); opacity: .08; } }

/* Hidden switch used to trigger iPhone haptics (see haptic() in app.js). */
.haptic { position: fixed; left: -100px; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; overflow: hidden; }
/* Line icons used inside text (mic, streak flame, check, alert). */
svg.inl { display: inline-block; width: 1.3em; height: 1.3em; vertical-align: -.32em; }
img.face { display: inline-block; width: 1.45em; height: 1.45em; vertical-align: -.4em; }
.scale button img.face { width: 44px; height: 44px; }
/* Selected button has inverted colours, so the face flips the other way. */
.scale button.on img.face { filter: invert(1); }
:root[data-theme="dark"] .scale button.on img.face { filter: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .scale button.on img.face { filter: none; } }

/* Swipe right to complete (logic in swipe.js). The row slides off a layer that says Done/Undo. */
.swipe { position: relative; border-radius: 20px; }
.swipe .under { position: absolute; inset: 0; border-radius: 20px; display: flex; align-items: center; gap: 8px; padding-left: 20px;
  background: var(--soft); color: var(--muted); font-weight: 700; font-size: 15px; opacity: 0; transition: opacity .15s, background-color .2s, color .2s; }
.swipe .under svg { width: 20px; height: 20px; transform: scale(.75); transition: transform .45s var(--spring); }
.swipe.dragging .under { opacity: 1; }
.swipe.armed .under { background: var(--ink); color: var(--on-ink); }
.swipe.armed .under svg { transform: scale(1.15); }
.swipe > .task { position: relative; touch-action: pan-y; user-select: none; -webkit-user-select: none; transition: transform .5s var(--spring); }
.swipe.dragging > .task { transition: none; }
