/* Tend — sensory-friendly pet companion. Plain CSS, no build step. */
:root {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s5: 1.25rem; --s6: 1.5rem; --s8: 2rem; --s10: 2.5rem;
  --r-sm: 10px; --r-md: 16px; --r-lg: 24px; --r-full: 999px;

  --bg: #F3F0E8; --surface: #FBFAF6; --surface-2: #EEEBE2; --border: #DDD8CB;
  --text: #2B3630; --muted: #5F6A63; --faint: #8B948D;
  --accent: #4F7F63; --accent-ink: #FFFFFF; --accent-soft: #DCE8DE;
  --clay: #B8775A; --clay-soft: #F1DFD3;
  --lav: #6E6AA6; --lav-soft: #E3E1F0;
  --sky: #4F86A3; --sky-soft: #DCEAF1;
  --shadow: 0 1px 2px rgba(43,54,48,.06), 0 8px 24px rgba(43,54,48,.06);

  --pet: #8DB59A; --pet-belly: #CFE2D1; --pet-ink: #2B3630; --cheek: #E9A99A;

  --font-display: 'Chillax', 'General Sans', system-ui, sans-serif;
  --font-body: 'General Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(.2,.7,.2,1);
  --scale: 1;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #1C2320; --surface: #232B27; --surface-2: #2B3530; --border: #38443E;
  --text: #E5E9E3; --muted: #A9B3AC; --faint: #7D877F;
  --accent: #8EBF9F; --accent-ink: #13201A; --accent-soft: #2F4338;
  --clay: #D9A07F; --clay-soft: #3E3029; --lav: #ABA6DA; --lav-soft: #34324A; --sky: #8FBCD4; --sky-soft: #26363F;
  --shadow: 0 1px 2px rgba(0,0,0,.2), 0 8px 24px rgba(0,0,0,.2);
  --pet-ink: #1C2320;
  color-scheme: dark;
}
/* Low-stim: fewer colors, no motion, quieter contrast (still AA). */
[data-lowstim="true"] {
  --accent: #5E716A; --accent-soft: #E3E6E1; --clay: #7E7770; --clay-soft: #E8E5E0; --lav: #6F7280; --lav-soft: #E5E6EA; --sky: #66737A; --sky-soft: #E3E7E9;
  --bg: #EFEEEA; --surface: #F6F5F2; --cheek: transparent;
}
[data-theme="dark"][data-lowstim="true"] { --bg: #1E2120; --surface: #252928; --accent: #9DAAA4; --accent-soft: #333937; --clay-soft:#333; --lav-soft:#333; --sky-soft:#333; }
[data-pet="clay"] { --pet: #D9A384; --pet-belly: #F2D9C8; }
[data-pet="lavender"] { --pet: #A9A5D2; --pet-belly: #DEDCEF; }
[data-pet="sky"] { --pet: #92B9CE; --pet-belly: #D3E5EE; }
[data-lowstim="true"] { --pet: #A8B2AC; --pet-belly: #DADFDB; }
[data-tsize="s"] { font-size: 93.75%; }
[data-tsize="l"] { font-size: 118.75%; }
[data-readable="true"] { --font-body: 'Atkinson Hyperlegible', system-ui, sans-serif; --font-display: 'Atkinson Hyperlegible', system-ui, sans-serif; letter-spacing: .01em; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: var(--text-base); line-height: 1.55;
  -webkit-font-smoothing: antialiased; overflow-x: clip;
  transition: background-color .4s var(--ease), color .4s var(--ease);
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; margin: 0; letter-spacing: -.005em; }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-base); }
p { margin: 0; }
small { font-size: var(--text-xs); color: var(--muted); font-weight: 400; }
a { color: var(--accent); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
.app {
  max-width: 1180px; margin: 0 auto; padding: var(--s4) var(--s4) calc(96px + env(safe-area-inset-bottom));
  display: grid; gap: var(--s5);
  grid-template-columns: 1fr; grid-template-areas: "top" "stage" "main";
}
@media (min-width: 900px) {
  .app { grid-template-columns: 360px 1fr; grid-template-areas: "top top" "stage main"; padding: var(--s6) var(--s6) var(--s10); gap: var(--s6); align-items: start; }
  .stage { position: sticky; top: var(--s6); }
}
.topbar { grid-area: top; display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.brand { display: flex; align-items: center; gap: var(--s2); color: var(--accent); }
.brand-mark { width: 28px; height: 28px; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: var(--text-lg); color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: var(--s2); }
.seed-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--r-full); background: var(--surface); border: 1px solid var(--border); font-size: var(--text-sm); font-weight: 600; font-variant-numeric: tabular-nums; }
.seed-pill svg { width: 16px; height: 16px; color: var(--clay); }
[data-lowstim="true"] .seed-pill { display: none; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--r-full); background: var(--surface); border: 1px solid var(--border); color: var(--text); transition: background .2s; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ---------- Stage ---------- */
.stage { grid-area: stage; }
.stage-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s5); box-shadow: var(--shadow); position: relative; }
.bubble {
  min-height: 3.2em; background: var(--accent-soft); color: var(--text); border-radius: var(--r-md); padding: var(--s3) var(--s4);
  font-size: var(--text-sm); position: relative; margin-bottom: var(--s2); transition: opacity .3s;
}
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -8px; width: 16px; height: 16px; background: inherit; transform: translateX(-50%) rotate(45deg); border-radius: 3px; }
.bubble:empty { opacity: 0; }
.pet-wrap { position: relative; display: grid; place-items: center; padding: var(--s2) 0; }
.pet { width: min(220px, 60vw); height: auto; overflow: visible; }
@media (max-width: 899px) { .pet { width: min(170px, 46vw); } }

.pet .pet-shadow { fill: rgba(43,54,48,.10); }
.pet .body { fill: var(--pet); transition: fill .4s; }
.pet .belly { fill: var(--pet-belly); transition: fill .4s; }
.pet .foot { fill: var(--pet); filter: brightness(.92); }
.pet .stem { fill: none; stroke: #5E8C68; stroke-width: 4; stroke-linecap: round; }
.pet .leaf { fill: #79AD82; }
.pet .leaf-r { fill: #8DBE90; }
.pet .leaf-3, .pet .bloom { display: none; }
.pet.stage-3 .leaf-3, .pet.stage-4 .leaf-3 { display: inline; fill: #6FA279; }
.pet.stage-4 .bloom { display: inline; }
.pet .bloom circle { fill: #F2C4B6; }
.pet .bloom .bloom-core { fill: #EBC366; }
.pet.stage-1 .sprout { transform: scale(.75); transform-origin: 100px 64px; }
.pet.stage-2 .sprout { transform: scale(.92); transform-origin: 100px 64px; }
[data-lowstim="true"] .pet .leaf, [data-lowstim="true"] .pet .leaf-r { fill: #9AA79E; }
[data-lowstim="true"] .pet .stem { stroke: #87958B; }

.pet .face ellipse, .pet .face circle { fill: var(--pet-ink); }
.pet .face .glint { fill: #fff; }
.pet .face path { fill: none; stroke: var(--pet-ink); stroke-width: 3.5; stroke-linecap: round; }
.pet .face .mouth-big { fill: var(--pet-ink); stroke-width: 2; stroke-linejoin: round; }
.pet .face .cheek { fill: var(--cheek); opacity: .55; }
.pet .eyes-happy, .pet .eyes-closed, .pet .mouth-big, .pet .mouth-o, .pet .mouth-flat { display: none; }
.pet.mood-happy .eyes-open, .pet.mood-proud .eyes-open { display: none; }
.pet.mood-happy .eyes-happy, .pet.mood-proud .eyes-happy { display: inline; }
.pet.mood-proud .mouth-smile { display: none; }
.pet.mood-proud .mouth-big { display: inline; }
.pet.mood-sleep .eyes-open, .pet.mood-calm .eyes-open { display: none; }
.pet.mood-sleep .eyes-closed, .pet.mood-calm .eyes-closed { display: inline; }
.pet.mood-sleep .mouth-smile { display: none; }
.pet.mood-sleep .mouth-o { display: inline; }
.pet.mood-think .mouth-smile { display: none; }
.pet.mood-think .mouth-flat { display: inline; }
.pet .zzz { display: none; font-family: var(--font-display); font-weight: 600; fill: var(--muted); }
.pet .zzz text:nth-child(1) { font-size: 14px; } .pet .zzz text:nth-child(2) { font-size: 18px; } .pet .zzz text:nth-child(3) { font-size: 22px; }
.pet.mood-sleep .zzz { display: inline; }

.acc { display: none; }
.pet.wear-glasses .acc-glasses, .pet.wear-bow .acc-bow, .pet.wear-cap .acc-cap, .pet.wear-crown .acc-crown { display: inline; }
.acc-glasses circle, .acc-glasses path { fill: none; stroke: #3D4A44; stroke-width: 3; }
.acc-bow path { fill: #C98B6B; } .acc-bow circle { fill: #A8694C; }
.acc-cap path:first-child { fill: #9C6E4E; } .acc-cap .cap-lines { fill: none; stroke: #7C5439; stroke-width: 2.5; stroke-linecap: round; }
.acc-crown circle { fill: #F2C4B6; } .acc-crown .crown-core { fill: #EBC366; }

/* motion (only when allowed) */
@media (prefers-reduced-motion: no-preference) {
  [data-motion="on"] .pet .pet-bob { animation: bob 4.5s ease-in-out infinite; transform-origin: 100px 180px; }
  [data-motion="on"] .pet .eyes-open { animation: blink 6s infinite; transform-origin: 100px 118px; }
  [data-motion="on"] .pet.mood-sleep .pet-bob { animation-duration: 7s; }
  [data-motion="on"] .pet .zzz text { animation: zfloat 3s ease-in-out infinite; }
  [data-motion="on"] .pet .zzz text:nth-child(2) { animation-delay: .5s; }
  [data-motion="on"] .pet .zzz text:nth-child(3) { animation-delay: 1s; }
  [data-motion="on"] .pet.bounce .pet-bob { animation: hop .7s var(--ease) 1; }
}
@keyframes bob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-4px) } }
@keyframes hop { 0% { transform: translateY(0) } 35% { transform: translateY(-16px) } 70% { transform: translateY(0) } 85% { transform: translateY(-4px) } 100% { transform: translateY(0) } }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1) } 96% { transform: scaleY(.1) } }
@keyframes zfloat { 0%,100% { opacity: .35; transform: translateY(0) } 50% { opacity: 1; transform: translateY(-4px) } }
.pet .pet-breathe { transform-origin: 100px 178px; transition: transform 4s ease-in-out; }

.particles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.particle { position: absolute; bottom: 30%; width: 14px; height: 14px; border-radius: 0 70% 0 70%; background: #8DBE90; opacity: 0; animation: rise 1.8s var(--ease) forwards; }
.particle.seed { background: var(--clay); border-radius: 50% 50% 50% 0; width: 10px; height: 12px; }
@keyframes rise { 0% { opacity: 0; transform: translateY(0) rotate(0) } 15% { opacity: .9 } 100% { opacity: 0; transform: translateY(-120px) rotate(160deg) } }

.pet-meta { display: grid; gap: var(--s3); margin-top: var(--s2); }
.pet-name-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s2); }
.pet-name { font-size: var(--text-xl); }
.pet-stage-label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 600; background: var(--accent-soft); padding: 3px 10px; border-radius: var(--r-full); }
.growth { display: grid; gap: 6px; }
.growth-bar, .rp-bar { height: 10px; background: var(--surface-2); border-radius: var(--r-full); overflow: hidden; }
.growth-bar span, .rp-bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .6s var(--ease); }
.growth-text { font-size: var(--text-xs); color: var(--muted); }
.today-ring-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.today-item { background: var(--surface-2); border-radius: var(--r-md); padding: var(--s2) var(--s3); display: grid; text-align: center; }
.today-num { font-family: var(--font-display); font-weight: 600; font-size: var(--text-lg); font-variant-numeric: tabular-nums; }
.today-lbl { font-size: var(--text-xs); color: var(--muted); }
[data-lowstim="true"] .today-ring-row, [data-lowstim="true"] .growth-text { display: none; }
.no-shame { font-size: var(--text-xs); color: var(--muted); border-left: 3px solid var(--accent-soft); padding-left: var(--s3); }
@media (max-width: 899px) { .no-shame { display: none; } }

.wardrobe { margin-top: var(--s4); border-top: 1px solid var(--border); padding-top: var(--s3); }
.wardrobe summary { cursor: pointer; font-weight: 600; font-size: var(--text-sm); list-style: none; display: flex; justify-content: space-between; align-items: center; min-height: 32px; }
.wardrobe summary::after { content: "+"; font-size: 1.2em; color: var(--muted); }
.wardrobe[open] summary::after { content: "–"; }
.wardrobe-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s2); margin-top: var(--s3); }
.ward-item { display: grid; gap: 2px; text-align: left; padding: var(--s3); border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); font-size: var(--text-sm); }
.ward-item .wi-cost { font-size: var(--text-xs); color: var(--muted); }
.ward-item[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.ward-item:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Activities ---------- */
.activities { grid-area: main; min-width: 0; }
.tabs { display: flex; gap: var(--s1); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-full); padding: 5px; margin-bottom: var(--s5); box-shadow: var(--shadow); }
.tab { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; background: transparent; border-radius: var(--r-full); padding: 10px 8px; font-size: var(--text-sm); font-weight: 500; color: var(--muted); min-height: 44px; transition: background .2s, color .2s; white-space: nowrap; }
.tab svg { width: 20px; height: 20px; flex: none; }
.tab[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.tab:not([aria-selected="true"]):hover { background: var(--surface-2); color: var(--text); }
@media (max-width: 899px) {
  .tabs { position: fixed; left: var(--s3); right: var(--s3); bottom: calc(var(--s3) + env(safe-area-inset-bottom)); z-index: 20; margin: 0; border-radius: var(--r-lg); }
  .tab { flex-direction: column; gap: 2px; padding: 6px 2px; font-size: var(--text-xs); border-radius: var(--r-md); }
}
@media (max-width: 380px) { .tab span { font-size: 11px; } }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s6); box-shadow: var(--shadow); display: grid; gap: var(--s5); }
@media (max-width: 600px) { .panel { padding: var(--s4); } }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s4); flex-wrap: wrap; }
.panel-head > div:first-child { flex: 1 1 320px; display: grid; gap: var(--s2); }
.lede { color: var(--muted); max-width: 60ch; }
.hint { font-size: var(--text-xs); color: var(--muted); }

/* segmented control */
.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--r-full); padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: var(--r-full); font-size: var(--text-sm); color: var(--muted); font-weight: 500; min-height: 40px; display: grid; justify-items: center; line-height: 1.2; }
.seg button small { font-size: 11px; }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.seg-wide { display: flex; width: 100%; }
.seg-wide button { flex: 1; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: var(--r-full); padding: 10px 20px; min-height: 44px; font-weight: 600; font-size: var(--text-sm); border: 1px solid transparent; text-decoration: none; transition: background .2s, border-color .2s, transform .15s; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-soft { background: var(--accent-soft); color: var(--text); }
.btn-soft:hover { border-color: var(--accent); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.row-gap { display: flex; gap: var(--s2); flex-wrap: wrap; }

/* fields */
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: var(--s2); min-width: 0; }
legend { font-weight: 600; font-size: var(--text-sm); margin-bottom: var(--s2); padding: 0; }
.field { display: grid; gap: 6px; font-size: var(--text-sm); font-weight: 600; }
.field small { font-weight: 400; }
input[type="text"], textarea {
  width: 100%; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--bg); font-weight: 400; font-size: var(--text-base); min-height: 48px;
}
input[type="text"]:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { font-family: ui-monospace, monospace; font-size: var(--text-xs); resize: vertical; }
input[type="range"] { width: 100%; accent-color: var(--accent); min-height: 32px; }
.toggle { display: flex; align-items: center; gap: var(--s3); font-size: var(--text-sm); cursor: pointer; min-height: 44px; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-ui { width: 44px; height: 26px; border-radius: var(--r-full); background: var(--border); position: relative; flex: none; transition: background .2s; }
.toggle-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle input:checked + .toggle-ui { background: var(--accent); }
.toggle input:checked + .toggle-ui::after { transform: translateX(18px); }
.toggle input:focus-visible + .toggle-ui { outline: 3px solid var(--accent); outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip { display: grid; justify-items: center; border: 1px solid var(--border); background: var(--surface); border-radius: var(--r-md); padding: 8px 16px; font-size: var(--text-sm); font-weight: 500; min-height: 44px; line-height: 1.2; }
.chip small { font-size: 11px; }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Care ---------- */
.routine-tabs { display: flex; gap: var(--s2); overflow-x: auto; scrollbar-width: none; }
.routine-tab { border: 1px solid var(--border); background: var(--surface); border-radius: var(--r-full); padding: 8px 16px; font-size: var(--text-sm); font-weight: 500; white-space: nowrap; min-height: 40px; display: inline-flex; gap: 8px; align-items: center; }
.routine-tab .rt-count { font-size: var(--text-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.routine-tab[aria-selected="true"] { background: var(--text); color: var(--surface); border-color: var(--text); }
.routine-tab[aria-selected="true"] .rt-count { color: inherit; opacity: .75; }
.routine-progress { display: flex; align-items: center; gap: var(--s3); font-size: var(--text-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.routine-progress .rp-bar { flex: 1; }
.task-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.task { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s3) var(--s3) var(--s4); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); transition: background .25s, border-color .25s; }
.task.done { background: var(--accent-soft); border-color: transparent; }
.task-check { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--accent); background: transparent; flex: none; display: grid; place-items: center; padding: 0; }
.task-check svg { width: 18px; height: 18px; opacity: 0; color: var(--accent-ink); transition: opacity .2s; }
.task.done .task-check { background: var(--accent); }
.task.done .task-check svg { opacity: 1; }
.task-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.task-main { font-weight: 500; }
.task-sub { font-size: var(--text-xs); color: var(--muted); }
.task.done .task-main { text-decoration: line-through; text-decoration-color: var(--faint); }
.task-mins { font-size: var(--text-xs); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.task-tools { display: flex; gap: 2px; }
.mini-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--faint); display: grid; place-items: center; }
.mini-btn:hover { background: var(--surface-2); color: var(--text); }
.mini-btn svg { width: 18px; height: 18px; }
.task-edit { flex: 1; display: grid; gap: var(--s2); }
.task-edit input { min-height: 40px; padding: 8px 12px; font-size: var(--text-sm); }
.add-task { display: flex; gap: var(--s2); }
.add-task input { flex: 1; }
.routine-done { text-align: center; padding: var(--s4); background: var(--accent-soft); border-radius: var(--r-md); font-weight: 500; }

/* ---------- Focus ---------- */
.focus-grid { display: grid; gap: var(--s6); grid-template-columns: 1fr; }
@media (min-width: 720px) { .focus-grid { grid-template-columns: minmax(240px, 300px) 1fr; align-items: start; } }
.timer-card { display: grid; gap: var(--s4); justify-items: center; }
.timer-ring { position: relative; width: min(260px, 70vw); aspect-ratio: 1; }
.timer-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--surface-2); stroke-width: 14; }
.ring-fill { fill: none; stroke: var(--accent); stroke-width: 14; stroke-linecap: round; transition: stroke-dashoffset .5s linear; }
.timer-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 2px; }
.timer-time { font-family: var(--font-display); font-weight: 600; font-size: var(--text-xl); font-variant-numeric: tabular-nums; }
.timer-sub { font-size: var(--text-xs); color: var(--muted); max-width: 16ch; margin: 0 auto; }
[data-tstyle="visual"] .timer-time { display: none; }
.timer-actions { display: flex; gap: var(--s2); flex-wrap: wrap; justify-content: center; }
.focus-setup { display: grid; gap: var(--s5); }
.focus-setup.locked { opacity: .55; pointer-events: none; }
.log-list { list-style: none; padding: 0; margin: var(--s2) 0 0; display: grid; gap: var(--s2); }
.log-list li { display: flex; justify-content: space-between; gap: var(--s3); font-size: var(--text-sm); padding: var(--s2) var(--s3); background: var(--surface-2); border-radius: var(--r-sm); }
.log-list li span:last-child { color: var(--muted); white-space: nowrap; }
.log-empty { color: var(--muted); font-size: var(--text-sm); }

/* ---------- Pebble path ---------- */
.breaker-form { display: grid; gap: var(--s4); }
.breaker-out { display: grid; gap: var(--s4); }
.path-viz { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: var(--s3); background: var(--surface-2); border-radius: var(--r-md); min-height: 52px; }
.pebble { width: 26px; height: 20px; border-radius: 50% 50% 45% 55% / 60% 60% 40% 40%; background: var(--border); transition: background .3s, transform .3s; }
.pebble.done { background: var(--clay); }
.pebble.current { outline: 2px dashed var(--accent); outline-offset: 3px; }
.pebble.skipped { background: transparent; border: 2px dashed var(--border); }
.one-step { display: grid; gap: var(--s4); padding: var(--s6); border-radius: var(--r-lg); background: var(--accent-soft); text-align: center; justify-items: center; }
.one-count { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.one-text { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 500; max-width: 32ch; }
.one-actions { display: flex; gap: var(--s2); flex-wrap: wrap; justify-content: center; }
.step-list { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--s2); counter-reset: st; }
.step-list li { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3); border: 1px solid var(--border); border-radius: var(--r-md); counter-increment: st; }
.step-list li::before { content: counter(st); width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: var(--text-xs); font-weight: 600; flex: none; }
.step-list li.done::before { content: "✓"; background: var(--clay); color: #fff; }
.step-list li.done .st-text { text-decoration: line-through; color: var(--muted); }
.step-list .st-text { flex: 1; min-width: 0; }
.step-list input { min-height: 40px; padding: 6px 10px; font-size: var(--text-sm); }
.breaker-foot { display: flex; justify-content: flex-end; }

/* ---------- Calm ---------- */
.calm-check { display: grid; gap: var(--s3); }
.feel-reply { color: var(--text); background: var(--lav-soft); border-radius: var(--r-md); padding: var(--s3) var(--s4); font-size: var(--text-sm); }
.feel-reply:empty { display: none; }
.calm-grid { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.calm-card { display: grid; gap: var(--s3); align-content: start; padding: var(--s5); border-radius: var(--r-lg); background: var(--surface-2); }
.breath-cue { font-family: var(--font-display); font-size: var(--text-lg); text-align: center; padding: var(--s3); min-height: 2.4em; }
.range-field span { font-weight: 500; }
.ground-text { min-height: 3em; }
.ground-dots { display: flex; gap: 6px; }
.ground-dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.ground-dots span.on { background: var(--lav); }

/* ---------- Games ---------- */
.hub-group { display: grid; gap: var(--s3); }
.hub-title { display: flex; align-items: center; gap: var(--s2); font-size: var(--text-sm); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-anx { background: var(--lav); } .dot-mood { background: var(--clay); } .dot-lung { background: var(--sky); }
.hub-grid { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.game-card { text-align: left; display: grid; gap: 4px; padding: var(--s4) var(--s5); border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); transition: border-color .2s, background .2s; min-height: 88px; }
.game-card:hover { border-color: var(--accent); background: var(--surface-2); }
.gc-name { font-family: var(--font-display); font-weight: 600; font-size: var(--text-base); }
.gc-sub { font-size: var(--text-sm); color: var(--muted); }
.safety-line { padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--surface-2); }
.back-btn { justify-self: start; margin-bottom: var(--s4); }
#gameView { display: block; }
.game { display: grid; gap: var(--s4); }
.game-head { display: grid; gap: var(--s2); }
.tag { display: inline-flex; align-self: start; justify-self: start; font-size: var(--text-xs); font-weight: 600; padding: 3px 10px; border-radius: var(--r-full); }
.tag-anx { background: var(--lav-soft); color: var(--lav); } .tag-mood { background: var(--clay-soft); color: var(--clay); } .tag-lung { background: var(--sky-soft); color: var(--sky); }
[data-theme="dark"] .tag { color: var(--text); }
.why { font-size: var(--text-xs); color: var(--muted); border-left: 3px solid var(--border); padding-left: var(--s3); }
.scene { position: relative; border-radius: var(--r-lg); overflow: hidden; background: var(--surface-2); min-height: 240px; }
.scene svg { display: block; width: 100%; height: auto; }

/* worry sorter */
.sorter-zones { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.zone { border: 2px dashed var(--border); border-radius: var(--r-md); padding: var(--s3); min-height: 120px; display: grid; align-content: start; gap: var(--s2); }
.zone h4 { margin: 0; font-size: var(--text-sm); }
.zone p { font-size: var(--text-xs); color: var(--muted); }
.zone-act { border-color: var(--accent); }
.zone-float { border-color: var(--lav); }
.worry-chip { font-size: var(--text-sm); padding: 6px 10px; border-radius: var(--r-sm); background: var(--surface); }
.cloud-card { display: grid; gap: var(--s3); padding: var(--s5); border-radius: 40px; background: var(--lav-soft); text-align: center; justify-items: center; }
.cloud-text { font-family: var(--font-display); font-size: var(--text-lg); max-width: 30ch; }
@media (prefers-reduced-motion: no-preference) {
  [data-motion="on"] .floating-away { animation: floataway 1.6s var(--ease) forwards; }
  [data-motion="on"] .leaf-drift { animation: drift linear forwards; }
  [data-motion="on"] .flower-pop { animation: pop .6s var(--ease); transform-box: fill-box; transform-origin: bottom center; }
}
@keyframes floataway { to { transform: translateY(-80px) scale(.8); opacity: 0; } }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }

/* stream */
.stream { height: 260px; background: linear-gradient(180deg, var(--sky-soft), var(--surface-2)); }
.stream-leaf { position: absolute; left: -30%; display: flex; align-items: center; gap: 8px; padding: 8px 16px 8px 12px; background: #8DBE90; color: #1F2E25; border-radius: 4px 30px 4px 30px; font-size: var(--text-sm); max-width: 70%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
[data-lowstim="true"] .stream-leaf { background: #B8C2BC; }
@keyframes drift { from { transform: translateX(0) } to { transform: translateX(170vw) } }
.stream-still .stream-leaf { position: static; margin: 6px; display: inline-flex; }

/* glimmer */
.garden { background: linear-gradient(180deg, var(--sky-soft) 0%, var(--surface-2) 70%); }
.glimmer-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.glimmer-list li { font-size: var(--text-sm); padding: var(--s2) var(--s3); border-radius: var(--r-sm); background: var(--clay-soft); }
.prompt-chips .chip { font-size: var(--text-xs); }

/* quest */
.quest-card { padding: var(--s6); border-radius: var(--r-lg); background: var(--clay-soft); display: grid; gap: var(--s3); text-align: center; justify-items: center; }
.quest-text { font-family: var(--font-display); font-size: var(--text-lg); max-width: 30ch; }
.quest-kind { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.feel-scale { display: flex; gap: var(--s2); flex-wrap: wrap; justify-content: center; }

/* dandelion */
.dandelion-scene { background: linear-gradient(180deg, var(--sky-soft), var(--surface-2)); }
.breath-phase { text-align: center; font-family: var(--font-display); font-size: var(--text-xl); min-height: 1.4em; }
.breath-count { text-align: center; color: var(--muted); font-size: var(--text-sm); min-height: 1.5em; }
.mic-meter { height: 10px; border-radius: var(--r-full); background: var(--surface-2); overflow: hidden; }
.mic-meter span { display: block; height: 100%; width: 0; background: var(--sky); transition: width .1s linear; }
.round-dots { display: flex; justify-content: center; gap: 8px; }
.round-dots span { width: 12px; height: 12px; border-radius: 50%; background: var(--border); }
.round-dots span.on { background: var(--sky); }

/* stroll */
.stroll-scene { background: linear-gradient(180deg, var(--sky-soft) 0%, var(--surface-2) 75%); }
.stroll-status { display: grid; gap: 4px; text-align: center; }
.stroll-phase { font-family: var(--font-display); font-size: var(--text-xl); }
.borg { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.borg button { display: grid; gap: 2px; justify-items: center; padding: 8px 4px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); font-size: var(--text-xs); min-height: 56px; }
.borg button b { font-size: var(--text-base); font-family: var(--font-display); }
.borg button[aria-pressed="true"] { border-color: var(--sky); background: var(--sky-soft); }
@media (max-width: 480px) { .borg { grid-template-columns: repeat(3, 1fr); } }
.redflags { border: 2px solid #B4533F; background: #FBEDE8; color: #5A2418; border-radius: var(--r-md); padding: var(--s4); font-size: var(--text-sm); display: grid; gap: var(--s2); }
[data-theme="dark"] .redflags { background: #3A2420; color: #F5D9D1; }
.redflags ul { margin: 0; padding-left: 1.2em; }
.redflags a { color: inherit; font-weight: 700; }
.result-note { padding: var(--s3) var(--s4); background: var(--accent-soft); border-radius: var(--r-md); font-size: var(--text-sm); }
.result-note:empty { display: none; }

/* ---------- Drawer ---------- */
.drawer-scrim { position: fixed; inset: 0; background: rgba(20,26,23,.35); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 100vw); background: var(--surface); z-index: 41; box-shadow: -8px 0 32px rgba(0,0,0,.12); transform: translateX(100%); transition: transform .3s var(--ease); display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: var(--s5); border-bottom: 1px solid var(--border); }
.drawer-body { padding: var(--s5); overflow-y: auto; display: grid; gap: var(--s5); align-content: start; }
.drawer hr { border: 0; border-top: 1px solid var(--border); margin: 0; width: 100%; }
.swatches { display: flex; gap: var(--s3); }
.swatches button { width: 44px; height: 44px; border-radius: 50%; border: 3px solid transparent; box-shadow: inset 0 0 0 2px rgba(255,255,255,.6); }
.swatches button[aria-pressed="true"] { border-color: var(--text); }
.swatches [data-color="sage"] { background: #8DB59A; } .swatches [data-color="clay"] { background: #D9A384; } .swatches [data-color="lavender"] { background: #A9A5D2; } .swatches [data-color="sky"] { background: #92B9CE; }

/* ---------- Crisis + dim ---------- */
.crisis { position: fixed; inset: 0; z-index: 60; background: rgba(20,26,23,.5); display: grid; place-items: center; padding: var(--s4); }
.crisis-card { background: var(--surface); border-radius: var(--r-lg); padding: var(--s6); max-width: 440px; display: grid; gap: var(--s4); box-shadow: var(--shadow); }
.crisis-actions { display: flex; gap: var(--s2); flex-wrap: wrap; }
.dim { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 30; transition: opacity .3s; }

/* Reduced motion overrides everything */
[data-motion="off"] *, [data-motion="off"] *::before, [data-motion="off"] *::after { animation: none !important; transition-duration: .01ms !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; } }

/* ---------- Rewards, suggestions, portrait (v2) ---------- */
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: var(--text-xs); }
.back-home { white-space: nowrap; }
@media (max-width: 480px) { .back-home { display: none; } }
.toast { position: fixed; left: 50%; top: 16px; transform: translate(-50%, -20px); opacity: 0; background: var(--text); color: var(--surface); padding: 8px 16px; border-radius: var(--r-full); font-size: var(--text-sm); font-weight: 600; z-index: 70; pointer-events: none; transition: opacity .25s, transform .25s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
[data-lowstim="true"] .toast { display: none; }
.suggest { display: grid; gap: var(--s3); padding: var(--s4); border-radius: var(--r-lg); background: var(--accent-soft); }
.suggest-head { display: grid; gap: 4px; }
.suggest-grid { display: grid; gap: var(--s2); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.suggest-card { text-align: left; display: grid; gap: 4px; padding: var(--s3) var(--s4); border-radius: var(--r-md); border: 1px solid transparent; background: var(--surface); min-height: 72px; }
.suggest-card:hover { border-color: var(--accent); }
.suggest .btn { justify-self: start; }
.dot-fun { background: var(--accent); }
.game-card-wide { grid-column: 1 / -1; }
.pouch { border-top: 1px solid var(--border); padding-top: var(--s3); display: grid; gap: var(--s2); }
.pouch summary { cursor: pointer; font-family: var(--font-display); font-weight: 600; min-height: 32px; display: flex; align-items: center; }
.badge-pouch { display: grid; gap: var(--s2); }
.badge-row { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3); border-radius: var(--r-md); background: var(--surface-2); }
.badge-row.shiny { background: linear-gradient(90deg, #F6E6B8, var(--surface-2)); }
[data-theme="dark"] .badge-row.shiny { background: linear-gradient(90deg, #4A4128, var(--surface-2)); }
.badge-txt { flex: 1; display: grid; font-size: var(--text-sm); min-width: 0; }
.badge-icon { width: 34px; height: 34px; border-radius: 50%; flex: none; background: var(--accent); position: relative; box-shadow: inset 0 0 0 3px rgba(255,255,255,.5); }
.badge-icon[data-b="care"] { background: #D98C8C; } .badge-icon[data-b="nap"] { background: #7E7AB8; } .badge-icon[data-b="pebble"] { background: #B8775A; }
.badge-icon[data-b="sorted"] { background: #8A86B5; } .badge-icon[data-b="leaf"] { background: #79AD82; } .badge-icon[data-b="glimmer"] { background: #E2B74F; }
.badge-icon[data-b="quest"] { background: #C98B6B; } .badge-icon[data-b="breeze"] { background: #6FA3BF; } .badge-icon[data-b="boot"] { background: #6B7F74; }
.shiny .badge-icon { box-shadow: inset 0 0 0 3px #F6E6B8, 0 0 0 2px #E2B74F; }
.ward-locked { opacity: .7; border-style: dashed; }
.ward-rare[aria-pressed] { border-color: #E2B74F; }
.helped { display: grid; gap: var(--s2); padding: var(--s3) var(--s4); background: var(--surface-2); border-radius: var(--r-md); }
.helped p { font-size: var(--text-sm); font-weight: 500; }

/* Rootling portrait mode */
.pet-portrait { display: none; width: min(200px, 52vw); aspect-ratio: 1; object-fit: cover; border-radius: 50%; box-shadow: var(--shadow); transition: filter .4s, transform .4s; }
.has-portrait .pet-portrait { display: block; }
.has-portrait .pet { display: none; }
.has-portrait[data-mood="sleep"] .pet-portrait { filter: saturate(.7) brightness(.85); }
.has-portrait[data-mood="sleep"]::after { content: "z z z"; position: absolute; top: 8%; right: 18%; font-family: var(--font-display); color: var(--muted); font-weight: 600; letter-spacing: .2em; }
.has-portrait[data-mood="calm"] .pet-portrait { filter: saturate(.85); }
@media (prefers-reduced-motion: no-preference) { [data-motion="on"] .has-portrait[data-mood="proud"] .pet-portrait, [data-motion="on"] .has-portrait[data-mood="happy"] .pet-portrait { transform: translateY(-6px) rotate(-2deg); } }
.worn-tags { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-top: var(--s2); }
.worn-tag { font-size: 11px; padding: 2px 8px; border-radius: var(--r-full); background: var(--accent-soft); }
.worn-tags:empty { display: none; }

/* Adventures placeholder */
.soon-card { cursor: default; border-style: dashed; background: var(--surface-2); }
.soon-card:hover { border-color: var(--border); background: var(--surface-2); }
.soon-tag { display: inline-block; margin-left: 6px; font-family: var(--font-body); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; border-radius: var(--r-full); background: var(--accent-soft); color: var(--accent); vertical-align: middle; }
#gamesHub { display: grid; gap: var(--s6); }
.game-card { align-content: start; }
/* rare items */
.pet.wear-scarf .acc-scarf, .pet.wear-nightcap .acc-nightcap, .pet.wear-star .acc-star, .pet.wear-pinwheel .acc-pinwheel, .pet.wear-charm .acc-charm, .pet.wear-map .acc-map { display: inline; }
.acc-scarf path { fill: #C96F5B; } .acc-scarf .scarf-tail { fill: #B35F4C; }
.acc-nightcap path:first-child { fill: #6E6AA6; } .acc-nightcap .cap-band { fill: #ECE6D6; } .acc-nightcap .pom { fill: #ECE6D6; }
.pet.wear-nightcap .acc-cap, .pet.wear-nightcap .acc-crown { display: none; }
.acc-star path { fill: #EBC366; stroke: #C9A040; stroke-width: 1.5; stroke-linejoin: round; }
.acc-pinwheel .pw-stick { stroke: #9C6E4E; stroke-width: 3; stroke-linecap: round; }
.acc-pinwheel .pw-a { fill: #92B9CE; } .acc-pinwheel .pw-b { fill: #F2C4B6; } .acc-pinwheel .pw-pin { fill: #EBC366; }
.acc-charm .charm-string { stroke: #8B948D; stroke-width: 1.5; } .acc-charm .charm-cloud * { fill: #FFFFFF; stroke: #C9C6E0; stroke-width: 1; }
.acc-map rect { fill: #F1DFC0; stroke: #B8986A; stroke-width: 1.5; } .acc-map .map-line { fill: none; stroke: #B8775A; stroke-width: 1.5; stroke-dasharray: 2 2; } .acc-map .map-x { fill: #C96F5B; }
@media (prefers-reduced-motion: no-preference) { [data-motion="on"] .acc-pinwheel { } }
/* compact stage on phones: pet beside its stats */
@media (max-width: 899px) {
  .stage-card { display: grid; grid-template-columns: 112px 1fr; column-gap: var(--s4); padding: var(--s4); align-items: center; }
  .bubble { grid-column: 1 / -1; min-height: 0; }
  .bubble:empty { display: none; }
  .pet-wrap { padding: 0; }
  .pet { width: 112px; }
  .pet-portrait { width: 104px; }
  .pet-meta { margin-top: 0; gap: var(--s2); }
  .pet-name { font-size: var(--text-lg); }
  .today-item { padding: 4px 6px; }
  .today-num { font-size: var(--text-base); }
  .today-lbl { font-size: 11px; line-height: 1.2; }
  .wardrobe { grid-column: 1 / -1; margin-top: var(--s3); }
  .app { gap: var(--s4); }
}
.redflags { display: block; line-height: 1.5; }
.redflags b { font-weight: 700; }
.stroll-scene, .dandelion-scene, .garden { min-height: 0; }
