/*
 * Colors come from one hue per palette (Settings > Colors), so every palette has the same
 * calm contrast in light and dark. --h is the hue; --bs and --bl tune the button so white
 * text on it stays readable.
 */
:root {
  --h: 208; --bs: 52%; --bl: 38%; /* Sky, the default */
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Quicksand", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bg: hsl(var(--h) 42% 95%); --card: hsl(var(--h) 60% 99%); --ink: hsl(var(--h) 30% 19%);
  --mute: hsl(var(--h) 14% 37%); --line: hsl(var(--h) 26% 86%);
  --btn: hsl(var(--h) var(--bs) var(--bl)); --on: #fff; --soft: hsl(var(--h) 48% 90%);
  --peach: #FCE2D2; --peachink: #6A341E;
  --shadow: 0 1px 0 hsl(var(--h) 30% 85%), 0 8px 24px hsl(var(--h) 35% 35% / .08);
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
:root[data-palette="sage"] { --h: 152; --bs: 36%; --bl: 32%; }
:root[data-palette="blossom"] { --h: 340; --bs: 46%; --bl: 42%; }
:root[data-palette="lavender"] { --h: 262; --bs: 34%; --bl: 46%; }
:root[data-palette="butter"] { --h: 40; --bs: 62%; --bl: 30%; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: hsl(var(--h) 20% 11%); --card: hsl(var(--h) 18% 16%); --ink: hsl(var(--h) 30% 92%);
    --mute: hsl(var(--h) 14% 70%); --line: hsl(var(--h) 15% 26%);
    --btn: hsl(var(--h) 52% 74%); --on: hsl(var(--h) 45% 12%); --soft: hsl(var(--h) 20% 23%);
    --peach: #5A3A2E; --peachink: #F8D9C8; --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: hsl(var(--h) 20% 11%); --card: hsl(var(--h) 18% 16%); --ink: hsl(var(--h) 30% 92%);
  --mute: hsl(var(--h) 14% 70%); --line: hsl(var(--h) 15% 26%);
  --btn: hsl(var(--h) 52% 74%); --on: hsl(var(--h) 45% 12%); --soft: hsl(var(--h) 20% 23%);
  --peach: #5A3A2E; --peachink: #F8D9C8; --shadow: none;
}
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 17px/1.5 var(--font);
  -webkit-tap-highlight-color: transparent;
}
main {
  max-width: 560px; margin: 0 auto;
  padding: 20px max(16px, env(safe-area-inset-right, 0px)) 110px max(16px, env(safe-area-inset-left, 0px));
}
/* Installed app: no browser bar above, so give the top a little more room. */
@media (display-mode: standalone) { main { padding-top: 28px; } }
h1 { font-size: 1.15rem; font-weight: 800; margin: 0 0 4px; color: var(--mute); }
h1 .sub { font-weight: 400; }
h2 { font-size: 1.2rem; font-weight: 800; margin: 28px 0 10px; }
.status { margin: 0 0 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 20px; box-shadow: var(--shadow); }
.brief { padding: 24px 22px; }
.hello { font-size: 1.6rem; font-weight: 800; line-height: 1.2; margin: 0 0 8px; }
.brief p { margin: 0 0 8px; max-width: 46ch; }
.pebbles { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 4px; }
.pebble { width: 34px; height: 34px; border-radius: 50%; border: 2.5px solid var(--btn); transition: background .4s, transform .4s; }
.pebble.on { background: var(--btn); transform: scale(1.12); }
.count { color: var(--mute); font-size: .95rem; margin: 0; }
.task { display: flex; gap: 12px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--line); }
.task:first-child { border-top: 0; }
.tick { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 2.5px solid var(--btn); background: transparent; color: var(--on); cursor: pointer; font: 800 16px/1 var(--font); padding: 0; }
.tick.on { background: var(--btn); }
.body { flex: 1; min-width: 0; }
.title { font-weight: 600; overflow-wrap: anywhere; }
.done .title { text-decoration: line-through; color: var(--mute); }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tag { font-size: .82rem; background: var(--soft); border-radius: 999px; padding: 1px 10px; color: var(--ink); }
.tag.due { background: var(--peach); color: var(--peachink); }
.tag.start { background: var(--btn); color: var(--on); }
.link { background: none; border: 0; color: var(--mute); font: 600 .9rem var(--font); cursor: pointer; min-height: 40px; padding: 8px 4px; text-decoration: underline; text-underline-offset: 3px; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--btn); outline-offset: 2px; }
.field { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.field.auto { width: auto; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.lab { width: 100%; font-weight: 600; font-size: .92rem; color: var(--mute); }
.chip { font: 600 .95rem var(--font); color: var(--ink); background: var(--bg); border: 1.5px solid var(--line); border-radius: 999px; min-height: 44px; padding: 8px 16px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--btn); border-color: var(--btn); color: var(--on); }
.go { font: 800 1rem var(--font); background: var(--btn); color: var(--on); border: 0; border-radius: 14px; padding: 13px 22px; cursor: pointer; margin-top: 18px; }
.go.inline { margin: 0; }
#addmsg { margin: 10px 0 0; }
.empty { color: var(--mute); margin: 0; }
.acts { display: flex; flex-direction: column; align-items: flex-end; flex: none; }
.grp { font-weight: 800; font-size: .95rem; color: var(--mute); margin: 16px 0 2px; }
.grp:first-child { margin-top: 0; }
.grp + .task { border-top: 0; }
button { touch-action: manipulation; }
.cheer { margin-top: 8px; background: var(--peach); color: var(--peachink); border-radius: 14px; padding: 10px 14px; font-weight: 600; }
.cheer.note { margin: 0 0 8px; }
.confirm p { margin: 0; }
.confirm p + p { margin-top: 8px; }
.confirm .row { margin-top: 8px; }
#toast {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  background: var(--peach); color: var(--peachink); padding: 14px 20px; border-radius: 18px;
  font-weight: 600; max-width: min(92vw, 460px); text-align: center; transition: opacity .35s, transform .35s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Onboarding */
#onboard { padding-top: 48px; }
#onboard h1.hello { color: var(--ink); font-size: 1.6rem; margin: 0 0 12px; outline: none; }
#onboard p { margin: 0 0 12px; }
.choices { display: grid; gap: 10px; margin: 18px 0 8px; }
.choice {
  text-align: left; font: 700 1.05rem var(--font); color: var(--ink); background: var(--bg);
  border: 1.5px solid var(--line); border-radius: 16px; min-height: 56px; padding: 14px 18px; cursor: pointer;
}
.choice:hover { border-color: var(--btn); }
.stack { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 18px; }
.stack .go { margin: 0; }
.field.grow { flex: 1; min-width: 0; width: auto; }
.spaced { margin-top: 12px; }
.choice[aria-pressed="true"] { border-color: var(--btn); box-shadow: inset 0 0 0 1.5px var(--btn); }
.statusrow { display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; margin: 0 0 14px; }
.statusrow .status { margin: 0; }
#drive-row:not(:empty) { margin-top: 10px; }
/* Links that look like the app's buttons, and the privacy and home pages. */
a.go { display: inline-block; text-decoration: none; }
a.link { display: inline-block; }
a:focus-visible { outline: 3px solid var(--btn); outline-offset: 2px; }
.doc { padding-bottom: 40px; }
.doc article h1 { font-size: 1.6rem; color: var(--ink); line-height: 1.2; margin: 0 0 8px; }
.doc article h2 { font-size: 1.1rem; margin: 24px 0 6px; }
.doc article p, .doc article li { max-width: 60ch; }
.doc article ul { padding-left: 1.2em; margin: 6px 0; }
.doc article li { margin: 6px 0; }
.doc article a:not(.go):not(.link) { color: var(--btn); }
.note.draft { background: var(--peach); color: var(--peachink); border-radius: 14px; padding: 10px 14px; }
/* Profile button and the Settings menu behind it: a bottom sheet on phones, a panel on wider screens. */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 8px; }
.top h1 { margin: 0; }
.profile {
  flex: none; width: 44px; height: 44px; padding: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; background: var(--card); color: var(--mute); border: 1.5px solid var(--line);
}
.profile:hover { color: var(--btn); border-color: var(--btn); }
.profile svg { width: 26px; height: 26px; fill: currentColor; }
#settings-menu {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 22px; padding: 18px 20px 22px;
}
#settings-menu::backdrop { background: rgb(0 0 0 / .45); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head h2 { margin: 0; }
.sheet-head .link { font-size: 1rem; }
body:has(#settings-menu[open]) { overflow: hidden; }
@media (max-width: 600px) {
  #settings-menu {
    width: 100%; max-width: 100%; max-height: 90dvh; margin: auto 0 0; border-radius: 22px 22px 0 0;
    padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  }
}
#different:not(:empty) { margin: 0 0 14px; }
#different .cheer { margin-top: 0; }

/* ---------- the pal: a pet who talks in chat bubbles ---------- */
.pet { display: block; width: 100%; height: auto; overflow: visible; }
.pet .fur { fill: var(--fur); }
.pet .inner { fill: var(--inner); }
.pet .muzzle { fill: var(--muzzle); }
.pet .ear, .pet .patch { fill: var(--ear); }
.pet .eye { fill: #3B2A26; }
.pet .shine { fill: #fff; }
.pet .nose { fill: #4A2E2A; }
.pet .cheek { fill: #F28B9A; opacity: .55; }
.pet .tongue { fill: #EF7D8E; }
.pet .line { fill: none; stroke: #3B2A26; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.pet .line.thin { stroke-width: 2.2; }
.pet-cat { --fur: #F5B47E; --inner: #F7C9BA; --muzzle: #FCE6D4; }
.pet-cat .nose { fill: #E57A8A; }
.pet-puppy { --fur: #E9C59C; --ear: #A36F48; --muzzle: #FAEBD8; }
.pet-bunny { --fur: #F7F2F4; --inner: #F5B9C9; --muzzle: #fff; }
.pet-bunny .fur { stroke: #D8CBD1; stroke-width: 1.5; }
.pet-bunny .nose { fill: #E58A9E; }

@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.pal-pet, .ob-pet { animation: bob 3.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .pal-pet, .ob-pet { animation: none; } }

/* The daily brief: the pet above its speech bubble, the bubble's sharp corner pointing at the pet. */
.pal { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.pal-pet { width: 76px; margin-left: 14px; }
.bubble {
  align-self: stretch; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  border-radius: 8px 26px 26px 26px; padding: 20px 20px 18px;
}
.bubble p { margin: 0 0 8px; max-width: 46ch; }
.bubble .hello { font-size: 1.5rem; }

/* Onboarding: the pet on top, each question its speech bubble. */
.ob-pet { width: 92px; margin: 0 0 8px 12px; }
#onboard .card { border-radius: 8px 26px 26px 26px; }

/* Little lines from the pet: after finishing a task, notes, and the toast. */
.saying { display: flex; align-items: center; gap: 10px; }
.mini-pet { flex: none; width: 34px; }
#toast { display: flex; align-items: center; gap: 10px; text-align: left; width: max-content; border-radius: 22px 22px 22px 8px; box-shadow: 0 8px 24px rgb(0 0 0 / .15); }
#toast .mini-pet { width: 38px; }

/* Settings: color swatches and pet choices inside the chips. */
.swatch { display: inline-block; width: 16px; height: 16px; border-radius: 50%; vertical-align: -3px; margin-right: 6px; border: 1.5px solid rgb(0 0 0 / .12); }
.swatch[data-swatch="sage"] { background: hsl(152 40% 70%); }
.swatch[data-swatch="sky"] { background: hsl(208 70% 76%); }
.swatch[data-swatch="blossom"] { background: hsl(340 70% 82%); }
.swatch[data-swatch="lavender"] { background: hsl(262 55% 80%); }
.swatch[data-swatch="butter"] { background: hsl(44 85% 74%); }
.chip .mini-pet { display: inline-block; width: 24px; vertical-align: -6px; margin-right: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.pal-choice { display: flex; align-items: center; gap: 14px; }
.pal-choice .mini-pet { width: 44px; }
.palette-choice { display: flex; align-items: center; gap: 14px; }
.palette-choice .swatch { width: 30px; height: 30px; margin: 0; vertical-align: 0; }

/* The pal celebrating a finished task: happy face, a little hop, twinkling sparkles. */
.pet .mouth { fill: #7A3540; }
.pet .sparkle { fill: #F5C24A; }
.pet .sparkle.alt { fill: hsl(var(--h) 75% 70%); }
@keyframes cheer-hop {
  0%, 100% { transform: translateY(0) rotate(0); }
  20% { transform: translateY(-7px) rotate(-8deg); }
  40% { transform: translateY(0) rotate(0); }
  60% { transform: translateY(-5px) rotate(8deg); }
  80% { transform: translateY(0) rotate(0); }
}
@keyframes twinkle { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.55); } }
.cheering { animation: cheer-hop 1.1s ease-in-out 2; }
.pal-pet.cheering { animation: cheer-hop 1.1s ease-in-out 2, bob 3.2s ease-in-out 2.2s infinite; }
.pet.party .sparkle { transform-box: fill-box; transform-origin: center; animation: twinkle 1.2s ease-in-out infinite; }
.pet.party .sparkle:nth-child(2) { animation-delay: .3s; }
.pet.party .sparkle:nth-child(3) { animation-delay: .6s; }
.pet.party .sparkle:nth-child(4) { animation-delay: .9s; }
.cheer.saying .mini-pet { width: 44px; }
@media (prefers-reduced-motion: reduce) {
  .cheering, .pal-pet.cheering, .pet.party .sparkle { animation: none; }
}

/* Settings > Your progress: big friendly numbers, nothing red. */
#progress { margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
#progress .cheer.saying { margin: 12px 0 0; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 0; }
.stat { background: var(--soft); border-radius: 16px; padding: 10px 14px; display: flex; flex-direction: column-reverse; }
.stat dt { font-size: .88rem; color: var(--mute); }
.stat dd { margin: 0; font-size: 1.6rem; font-weight: 800; line-height: 1.2; }
.stat-done { grid-column: 1 / -1; background: var(--btn); }
.stat-done dt, .stat-done dd { color: var(--on); }

/* The pal is a button: tap for a cheer and a way to share progress. */
.pal-button { background: none; border: 0; padding: 0; cursor: pointer; border-radius: 50%; }
.pal-button:focus-visible { outline: 3px solid var(--btn); outline-offset: 4px; }
#pal-menu {
  width: min(420px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 26px; padding: 22px;
}
#pal-menu::backdrop { background: rgb(0 0 0 / .45); }
.pal-sheet { display: flex; flex-direction: column; align-items: center; text-align: center; }
.pal-big { width: 120px; animation: cheer-hop 1.1s ease-in-out 2; }
.pal-sheet h2 { margin: 10px 0 4px; font-size: 1.5rem; }
.pal-sheet p { margin: 0 0 10px; max-width: 34ch; }
.share-preview { background: var(--soft); border-radius: 16px; padding: 12px 16px; font-weight: 600; }
.pal-sheet .stack { align-items: center; }
body:has(#pal-menu[open]) { overflow: hidden; }
@media (max-width: 600px) {
  #pal-menu { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 26px 26px 0 0; padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) { .pal-big { animation: none; } }

/* After a finished day: the invitation to share. */
.share-prompt { margin-top: 12px; }
.share-prompt p { margin: 0 0 8px; font-weight: 600; }
.cheer + .share-prompt { margin: 8px 0 0; padding: 12px 14px; background: var(--soft); border-radius: 14px; }
/* The about page: the pal above its card, like onboarding. */
.about-card { border-radius: 8px 26px 26px 26px; }

/* Handful Plus: the trial note, the paywall and the Settings row. Calm, nothing red. */
.plus-note { margin-top: 12px; padding: 12px 14px; background: var(--soft); border-radius: 14px; }
.plus-note p { margin: 0 0 8px; }
.plans { align-items: center; }
.plans .go { margin: 0; }
#plus { margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
#plus p { margin: 6px 0; }
.chip[disabled] { opacity: .45; cursor: default; }
a.chip { display: inline-block; text-decoration: none; }
#onboard .plus-note { margin: 4px 0 16px; }
.plans + .count { margin-top: 8px; }
