/* Pocket Pal. A warm, soft room in pastel colors: cream paper, plum ink,
   coral and pink accents, rounded everything. Light only (the room has its
   own day and night through the window). */
:root {
  color-scheme: light;
  --bg: #fff4ea;
  --bg-2: #ffe9dc;
  --panel: #fffdfa;
  --panel-2: #fbefe6;
  --ink: #3b2c3f;
  --muted: #8a7383;
  --faint: #b9a6b2;
  --line: rgba(59, 44, 63, 0.11);
  --accent: #ff7f6e;        /* coral: primary buttons */
  --accent-deep: #e8604f;
  --accent-ink: #fff;
  --pink: #ff8fab;
  --mint: #7fd1a8;
  --gold: #ffcf4d;
  --danger: #d6455d;
  --focus: #ff9f8f;
  --display: "Fredoka", "Nunito", ui-rounded, system-ui, sans-serif;
  --body: "Nunito", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
  --shadow: 0 1px 2px rgba(59, 44, 63, 0.06), 0 10px 30px rgba(59, 44, 63, 0.12);
  --shadow-sm: 0 1px 1px rgba(59, 44, 63, 0.06), 0 3px 10px rgba(59, 44, 63, 0.08);
  --spring: cubic-bezier(.2, 1.3, .35, 1);
  --ease: cubic-bezier(.2, .9, .25, 1);
  --scrim: rgba(59, 44, 63, 0.32);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  background-image: radial-gradient(rgba(255, 143, 171, 0.14) 1.4px, transparent 1.8px);
  background-size: 22px 22px;
  color: var(--ink);
  font: 700 16px/1.4 var(--body);
  overscroll-behavior: none;
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

#app {
  position: relative; height: 100%; max-width: 520px; margin: 0 auto; overflow: hidden;
  background: var(--bg);
}
@media (min-width: 600px) {
  #app { height: min(100%, 940px); top: 50%; transform: translateY(-50%); border-radius: 34px; box-shadow: 0 30px 80px rgba(59, 44, 63, 0.18), 0 0 0 1px var(--line); }
}

/* ------------------------------------------------------------ screens -- */
.screen { position: absolute; inset: 0; display: none; flex-direction: column; }
.screen.active { display: flex; }

/* ------------------------------------------------------------ buttons -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border: 0; border-radius: 999px; cursor: pointer;
  font: 600 17px/1 var(--display); letter-spacing: 0.01em;
  transition: transform 160ms var(--spring), filter 160ms;
}
.btn:active { transform: scale(0.96); }
.btn:focus-visible, .icon-btn:focus-visible, .act:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn.primary { background: linear-gradient(180deg, #ff9585, var(--accent)); color: var(--accent-ink); box-shadow: 0 2px 0 var(--accent-deep), 0 8px 18px rgba(255, 127, 110, 0.35); }
.btn.ghost { background: var(--panel-2); color: var(--ink); }
.btn.danger { background: #fde8eb; color: var(--danger); }
.btn.wide { width: 100%; }
.btn.big { min-height: 56px; font-size: 19px; }
.btn.small { min-height: 38px; padding: 0 16px; font-size: 15px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn svg { width: 20px; height: 20px; }
.icon-btn {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; padding: 0; cursor: pointer;
  border: 0; border-radius: 50%; background: var(--panel-2); color: var(--ink);
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.small { width: 32px; height: 32px; }
.icon-btn.small svg { width: 16px; height: 16px; }
.link-btn { background: none; border: 0; padding: 8px; color: var(--accent-deep); cursor: pointer; font-weight: 800; }
.eyebrow { margin: 0; font: 600 13px/1 var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-deep); }
[data-ui] { display: inline-grid; color: var(--ink); }
[data-ui] svg { width: 100%; height: 100%; }

/* ------------------------------------------------------------- header -- */
.top {
  display: flex; align-items: center; gap: 10px;
  padding: max(12px, env(safe-area-inset-top)) 16px 6px;
}
.who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.who b { font: 600 24px/1.1 var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { color: var(--muted); font-size: 13.5px; }
.coins {
  display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px 0 8px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--panel); box-shadow: var(--shadow-sm); font: 600 17px/1 var(--display); font-variant-numeric: tabular-nums;
}
.coins .coin-ico { width: 26px; height: 26px; }
.coins.bump { animation: bump 420ms var(--spring); }
peanut-menu {
  --pm-bg: var(--panel); --pm-fg: var(--ink); --pm-muted: var(--muted); --pm-line: var(--line);
  --pm-hover: var(--panel-2); --pm-accent: var(--accent); --pm-accent-fg: #fff; --pm-danger: var(--danger);
  --pm-trigger-bg: var(--panel); --pm-font: var(--body);
}

/* ------------------------------------------------------------- meters -- */
.meters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 6px 16px 10px; }
.meter {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 6px; border-radius: 16px;
  background: var(--panel); box-shadow: var(--shadow-sm);
}
.m-ico { width: 24px; height: 24px; flex: none; }
.bar { flex: 1; height: 9px; border-radius: 6px; background: var(--panel-2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 50%; border-radius: inherit; background: var(--mint); transition: width 600ms var(--ease), background-color 400ms; }
.meter.mid .bar i { background: var(--gold); }
.meter.low .bar i { background: #ff7f8f; }
.meter.low { animation: nudge 1.8s ease-in-out infinite; }
.meters.off { opacity: 0.4; }

/* -------------------------------------------------------------- stage -- */
.stage { position: relative; flex: 1; min-height: 0; margin: 0 12px; border-radius: 28px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line), var(--shadow-sm); }
.room { position: absolute; inset: 0; }
.room svg { width: 100%; height: 100%; display: block; }
.night { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(60% 40% at 50% 78%, rgba(40, 32, 90, 0.2), rgba(26, 22, 64, 0.72)); opacity: 0; transition: opacity 1.2s ease; }
.stage.asleep .night { opacity: 1; }
.glow-lamp { position: absolute; right: 2%; bottom: 22%; width: 46%; aspect-ratio: 1; border-radius: 50%; pointer-events: none; background: radial-gradient(circle, rgba(255, 233, 160, 0.6), transparent 65%); opacity: 0; transition: opacity 1.2s; z-index: 2; }
.stage.asleep.lamp .glow-lamp { opacity: 1; }

/* The pet stands on the floor, about a fifth of the way up from the bottom. */
.pet-wrap {
  position: absolute; left: 50%; bottom: 7%; width: min(64%, 300px); aspect-ratio: 1;
  transform: translateX(calc(-50% + var(--x, 0px))); transition: transform 1.8s var(--ease);
  z-index: 3;
}
.pet { width: 100%; height: 100%; cursor: pointer; touch-action: none; outline: none; }
.pet svg { width: 100%; height: 100%; display: block; overflow: visible; }
.pet.flip svg .body { transform: scaleX(-1); }
.pet svg .body { transform-box: view-box; transform-origin: 100px 178px; animation: breathe 3.4s ease-in-out infinite; }
.pet svg .eye { transform-box: fill-box; transform-origin: center; animation: blink 5.2s infinite; }
.pet svg .arm.l { transform-box: fill-box; transform-origin: 80% 20%; }
.pet svg .arm.r { transform-box: fill-box; transform-origin: 20% 20%; }
.pet svg .glow { animation: glow 2.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.pet svg .drops path { animation: drip 1.6s ease-in infinite; }
.pet svg .drops path + path { animation-delay: -0.8s; }
.pet svg .chomp { transform-box: fill-box; transform-origin: center; animation: chomp 0.32s ease-in-out infinite alternate; }
.pet svg .shadow { transform-box: fill-box; transform-origin: center; animation: shadow 3.4s ease-in-out infinite; }
.pet.walking svg .body, .pet.hop svg .body { animation: hop 0.45s ease-in-out infinite; }
.pet.hop svg .shadow, .pet.walking svg .shadow { animation: shadow-hop 0.45s ease-in-out infinite; }
.pet.jump svg .body { animation: jump 0.7s var(--ease); }
.pet.wiggle svg .body { animation: wiggle 0.6s ease-in-out; }
.pet.shiver svg .body { animation: shiver 0.12s linear infinite; }
.pet.egg svg .body { animation: egg-rock 2.8s ease-in-out infinite; }
.pet.egg.soon svg .body { animation: egg-rock 0.9s ease-in-out infinite; }
.pet.asleep svg .body { animation: breathe 4.6s ease-in-out infinite; }
.pet.wave svg .arm.r { animation: wave 0.5s ease-in-out 3; }
.pet.leave { animation: leave 1.4s var(--ease) forwards; }
.pet.arrive { animation: arrive 1s var(--spring) both; }
.pet.lean-l svg .body { transform: rotate(-12deg) translateX(-8px); transition: transform 200ms; animation: none; }
.pet.lean-r svg .body { transform: rotate(12deg) translateX(8px); transition: transform 200ms; animation: none; }
.pet.spin svg .body { animation: spin-y 0.6s var(--ease); }
.pet.pop { animation: pop-in 700ms var(--spring) both; }

@keyframes breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.025, 0.975); } }
@keyframes shadow { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(0.08); } }
@keyframes glow { 0%, 100% { opacity: 0.55; transform: scale(0.9); } 50% { opacity: 1; transform: scale(1.12); } }
@keyframes drip { 0% { transform: translateY(-14px); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(6px); opacity: 0; } }
@keyframes chomp { from { transform: scaleY(1); } to { transform: scaleY(0.25); } }
@keyframes hop { 0%, 100% { transform: translateY(0) scale(1.03, 0.97); } 45% { transform: translateY(-9%) scale(0.97, 1.04); } }
@keyframes shadow-hop { 0%, 100% { transform: scale(1); opacity: 0.13; } 45% { transform: scale(0.8); opacity: 0.08; } }
@keyframes jump { 0% { transform: scale(1.06, 0.92); } 35% { transform: translateY(-16%) scale(0.94, 1.08); } 70% { transform: translateY(0) scale(1.08, 0.92); } 100% { transform: none; } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-7deg); } 75% { transform: rotate(7deg); } }
@keyframes shiver { 0% { transform: translateX(-1px); } 50% { transform: translateX(1px); } }
@keyframes egg-rock { 0%, 70%, 100% { transform: rotate(0); } 78% { transform: rotate(-6deg); } 86% { transform: rotate(6deg); } 93% { transform: rotate(-3deg); } }
@keyframes wave { 50% { transform: rotate(-40deg); } }
@keyframes leave { 0% { transform: none; } 20% { transform: translateY(-6%); } 100% { transform: translateX(140%) translateY(-4%); opacity: 0; } }
@keyframes arrive { from { transform: translateX(-140%); opacity: 0; } }
@keyframes spin-y { 50% { transform: scaleX(-1) translateY(-6%); } }
@keyframes pop-in { 0% { transform: scale(0.3); opacity: 0; } 60% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1); } }
@keyframes bump { 40% { transform: scale(1.14); } }
@keyframes nudge { 0%, 85%, 100% { transform: none; } 90% { transform: translateY(-2px); } }

/* A thought bubble above the pet when it needs something. */
.bubble { position: absolute; left: 62%; top: -2%; z-index: 4; animation: float 2.6s ease-in-out infinite; }
.bubble button {
  width: 58px; height: 58px; border-radius: 50%; border: 0; padding: 11px; cursor: pointer;
  background: #fff; box-shadow: var(--shadow); display: grid; place-items: center;
}
.bubble button svg { width: 100%; height: 100%; }
.bubble::before, .bubble::after { content: ""; position: absolute; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); }
.bubble::before { width: 13px; height: 13px; left: -4px; bottom: -10px; }
.bubble::after { width: 7px; height: 7px; left: -12px; bottom: -20px; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* Effects: hearts, sparkles, Zzz, bubbles, food on its way. */
.fx { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.fx > * { position: absolute; }
.fx .heart { width: 26px; height: 26px; animation: rise-fade 1.1s ease-out forwards; }
.fx .spark { width: 18px; height: 18px; animation: sparkle 0.9s ease-out forwards; }
.fx .z { font: 600 22px/1 var(--display); color: #fff; text-shadow: 0 2px 8px rgba(40, 32, 90, 0.5); animation: zzz 3s ease-out forwards; }
.fx .coin-fly { width: 28px; height: 28px; animation: coin-up 0.9s var(--ease) forwards; }
.fx .food-in { width: 22%; aspect-ratio: 1; transition: transform 500ms var(--spring), opacity 300ms; }
.fx .food-in svg { width: 100%; height: 100%; }
.fx .drop { width: 6px; height: 12px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: #8fd0ff; animation: fall 0.7s linear forwards; }
@keyframes rise-fade { 0% { transform: translateY(0) scale(0.4); opacity: 0; } 20% { opacity: 1; transform: translateY(-10px) scale(1); } 100% { transform: translateY(-80px) scale(0.9); opacity: 0; } }
@keyframes sparkle { 0% { transform: scale(0) rotate(0); opacity: 1; } 60% { transform: scale(1) rotate(60deg); opacity: 1; } 100% { transform: scale(0.4) rotate(90deg); opacity: 0; } }
@keyframes zzz { 0% { transform: translate(0, 0) scale(0.6); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(36px, -90px) scale(1.2); opacity: 0; } }
@keyframes coin-up { 0% { transform: translateY(0) scale(0.6); opacity: 0; } 25% { opacity: 1; transform: translateY(-20px) scale(1.1); } 100% { transform: translateY(-70px) scale(0.9); opacity: 0; } }
@keyframes fall { to { transform: translateY(240px); opacity: 0.2; } }

.poops { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.poop { position: absolute; bottom: 9%; width: 13%; max-width: 64px; aspect-ratio: 1; border: 0; padding: 0; background: none; cursor: pointer; pointer-events: auto; animation: pop-in 500ms var(--spring) both; }
.poop svg { width: 100%; height: 100%; }
.poop .stink { animation: stink 1.6s ease-in-out infinite; }
.poop.gone { animation: poof 380ms ease-in forwards; }
@keyframes stink { 50% { transform: translateY(-3px); opacity: 0.4; } }
@keyframes poof { to { transform: scale(0.2) translateY(-20px); opacity: 0; } }

.float-btn {
  position: absolute; z-index: 6; border: 0; cursor: pointer; display: flex; align-items: center; gap: 8px;
  background: var(--panel); box-shadow: var(--shadow); border-radius: 999px;
}
.float-btn.gift { left: 12px; top: 12px; width: 54px; height: 54px; padding: 10px; justify-content: center; animation: gift 2.4s ease-in-out infinite; }
.float-btn.gift span { width: 100%; height: 100%; }
.float-btn.meds { right: 12px; top: 12px; padding: 8px 16px 8px 10px; font: 600 16px/1 var(--display); animation: nudge 1.6s ease-in-out infinite; }
.float-btn.meds span { width: 30px; height: 30px; }
@keyframes gift { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-10deg) scale(1.06); } 90% { transform: rotate(10deg) scale(1.06); } 95% { transform: rotate(-4deg); } }

.egg-timer { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); z-index: 6; padding: 8px 16px; border-radius: 999px; background: rgba(255, 255, 255, 0.9); box-shadow: var(--shadow-sm); font: 600 15px/1 var(--display); white-space: nowrap; }

.away {
  position: absolute; z-index: 6; left: 50%; top: 50%; transform: translate(-50%, -54%) rotate(-2deg);
  width: min(80%, 300px); padding: 12px 12px 14px; border-radius: 18px; background: #fff; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px; text-align: center;
}
.away .postcard { border-radius: 10px; overflow: hidden; aspect-ratio: 16 / 10; }
.away .postcard svg { width: 100%; height: 100%; display: block; }
.away p { margin: 0; font: 600 18px/1.25 var(--display); }
.away p small { display: block; font: 700 14px/1.3 var(--body); color: var(--muted); }
.away-bar, .bath-progress { height: 8px; border-radius: 6px; background: var(--panel-2); overflow: hidden; }
.away-bar i, .bath-progress i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--pink), var(--accent)); transition: width 800ms var(--ease); }
.away .btn { align-self: center; }

.bath-ui { position: absolute; z-index: 6; left: 12px; right: 12px; top: 12px; padding: 12px 14px; border-radius: 18px; background: rgba(255, 255, 255, 0.92); box-shadow: var(--shadow-sm); display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; }
.bath-ui p { margin: 0; font: 600 16px/1.2 var(--display); }
.bath-ui .bath-progress { grid-column: 1; }
.bath-ui .btn { grid-row: 1 / span 2; grid-column: 2; }
.bath-foam { position: absolute; inset: 0; pointer-events: none; }
.bath-foam i { position: absolute; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #eef7ff 60%, #cfe6ff); box-shadow: inset -2px -3px 4px rgba(120, 170, 220, 0.25); animation: pop-in 300ms var(--spring) both; }
.stage.bathing .room { filter: saturate(0.85) brightness(1.04); }

.nudge {
  position: absolute; z-index: 6; left: 12px; right: 12px; bottom: 12px; padding: 10px 10px 10px 12px; border-radius: 18px;
  background: rgba(255, 255, 255, 0.95); box-shadow: var(--shadow); display: flex; align-items: center; gap: 10px;
  animation: rise 400ms var(--spring);
}
.nudge > span { width: 30px; height: 30px; flex: none; }
.nudge p { margin: 0; flex: 1; font-size: 14.5px; line-height: 1.25; }

/* --------------------------------------------------------------- dock -- */
.dock {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px;
  padding: 10px 10px max(10px, env(safe-area-inset-bottom));
}
.act {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0 6px; border: 0; border-radius: 18px; cursor: pointer;
  background: none; transition: transform 160ms var(--spring), background-color 160ms;
}
.act > span { width: 44px; height: 44px; padding: 7px; border-radius: 16px; background: var(--panel); box-shadow: var(--shadow-sm); transition: transform 200ms var(--spring); }
.act b { font: 600 13.5px/1 var(--display); color: var(--ink); }
.act:active > span { transform: scale(0.9); }
.act:disabled { opacity: 0.38; cursor: default; }
.act.want > span { box-shadow: 0 0 0 3px #ffd2c9, var(--shadow-sm); animation: nudge 1.6s ease-in-out infinite; }
@media (hover: hover) { .act:not(:disabled):hover > span { transform: translateY(-2px); } }

/* -------------------------------------------------------------- adopt -- */
#adopt { background: radial-gradient(120% 60% at 50% 0%, #ffe3d6, transparent 70%), var(--bg); }
.adopt-inner { flex: 1; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: max(18px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom)); text-align: center; }
.adopt-top { align-self: stretch; display: flex; justify-content: flex-end; min-height: 40px; }
.adopt-title { margin: 0; font: 600 38px/1.05 var(--display); }
.adopt-sub { margin: -4px 0 6px; color: var(--muted); }
.eggs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; max-width: 360px; }
.egg-pick { position: relative; border: 0; padding: 4px; border-radius: 24px; background: var(--panel); box-shadow: var(--shadow-sm); cursor: pointer; transition: transform 200ms var(--spring), box-shadow 200ms; }
.egg-pick svg { width: 100%; height: auto; display: block; }
.egg-pick span { display: block; margin: -10px 0 8px; font: 600 14px/1 var(--display); color: var(--muted); }
.egg-pick[aria-checked="true"] { box-shadow: 0 0 0 3px var(--accent), var(--shadow); transform: translateY(-3px); }
.egg-pick[aria-checked="true"] svg .body { animation: egg-rock 1.6s ease-in-out infinite; transform-box: view-box; transform-origin: 100px 178px; }
.name-field { width: 100%; max-width: 360px; display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 16px; border-radius: 18px; background: var(--panel); box-shadow: var(--shadow-sm); }
.name-field span { color: var(--muted); }
.name-field input, #askInput { flex: 1; min-width: 0; height: 44px; border: 0; background: none; font: 600 20px/1 var(--display); color: var(--ink); outline: none; }
.adopt-inner .btn.big { width: 100%; max-width: 360px; }

/* ------------------------------------------------------------- sheets -- */
.overlay {
  position: absolute; inset: 0; z-index: 10; display: flex; align-items: flex-end; justify-content: center;
  padding: 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); background: var(--scrim); animation: fade 180ms ease;
}
.overlay.center { align-items: center; }
.sheet {
  position: relative; width: 100%; max-width: 480px; max-height: 92%; overflow-y: auto; overscroll-behavior: contain;
  padding: 22px 18px 18px; border-radius: 28px; background: var(--panel); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 12px; animation: rise 320ms var(--spring);
}
.sheet.tall { height: 92%; }
.sheet h3 { margin: -4px 0 0; font: 600 26px/1.1 var(--display); padding-right: 40px; }
.sheet .close { position: absolute; top: 14px; right: 14px; z-index: 2; }
.sheet-copy { margin: 0; color: var(--muted); font-size: 15px; }
.sheet-actions { display: flex; gap: 10px; }
.sheet-actions .btn { flex: 1; }
.sub-label { margin: 6px 0 -4px; font: 600 15px/1 var(--display); color: var(--muted); }
.sub-label small { font: inherit; color: var(--faint); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }

/* Feed */
.food-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.food {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 8px; border: 0; border-radius: 18px; cursor: pointer;
  background: var(--panel-2); transition: transform 160ms var(--spring);
}
.food:active { transform: scale(0.94); }
.food:disabled { opacity: 0.45; cursor: default; }
.food .art { width: 46px; height: 46px; }
.food .art svg { width: 100%; height: 100%; }
.food b { font-size: 12px; line-height: 1.1; }
.price { display: inline-flex; align-items: center; gap: 3px; font: 600 13px/1 var(--display); color: var(--muted); }
.price [data-ui] { width: 15px; height: 15px; }
.price.free { color: var(--mint); color: #3f9f72; }

/* Play */
.game-list { display: flex; flex-direction: column; gap: 8px; }
.game-card {
  display: flex; align-items: center; gap: 14px; padding: 10px 14px 10px 10px; border: 0; border-radius: 20px; cursor: pointer; text-align: left;
  background: var(--panel-2); transition: transform 160ms var(--spring);
}
.game-card:active { transform: scale(0.98); }
.game-card .gart { width: 56px; height: 56px; flex: none; border-radius: 16px; display: grid; place-items: center; padding: 6px; }
.game-card .gart svg { width: 100%; height: 100%; }
.game-card span { flex: 1; display: flex; flex-direction: column; }
.game-card b { font: 600 18px/1.15 var(--display); }
.game-card small { color: var(--muted); font-size: 13.5px; }
.game-card em { font-style: normal; font: 600 13px/1 var(--display); color: var(--muted); white-space: nowrap; }

/* Walk */
.places { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.place { border: 0; padding: 0; border-radius: 20px; overflow: hidden; cursor: pointer; background: var(--panel-2); text-align: left; transition: transform 160ms var(--spring); }
.place:active { transform: scale(0.97); }
.place .postcard { aspect-ratio: 16 / 10; }
.place .postcard svg { width: 100%; height: 100%; display: block; }
.place > span { display: flex; flex-direction: column; padding: 8px 12px 10px; }
.place b { font: 600 17px/1.2 var(--display); }
.place small { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 4px; }
.place small [data-ui] { width: 15px; height: 15px; flex: none; }

/* Shop */
.shop-preview { height: 150px; margin: -6px auto -4px; aspect-ratio: 1; flex: none; }
.shop-preview svg { width: 100%; height: 100%; }
.shop-preview.room-preview { aspect-ratio: 360 / 300; height: 150px; border-radius: 16px; overflow: hidden; position: relative; }
.shop-preview.room-preview .mini-pet { position: absolute; left: 50%; bottom: 4%; width: 46%; transform: translateX(-50%); }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--panel-2); flex: none; }
.tabs button { flex: 1; height: 38px; border: 0; border-radius: 999px; background: none; cursor: pointer; font: 600 15px/1 var(--display); color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-sm); }
.shop-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.shop-grid .sub-label { grid-column: 1 / -1; }
.item {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px 10px; border: 0; border-radius: 20px; cursor: pointer;
  background: var(--panel-2); transition: transform 160ms var(--spring);
}
.item:active { transform: scale(0.95); }
.item .art { width: 58px; height: 58px; display: grid; place-items: center; }
.item .art svg { max-width: 100%; max-height: 100%; }
.item b { font-size: 13px; line-height: 1.1; text-align: center; }
.item .tag { font: 600 12.5px/1 var(--display); color: var(--muted); display: inline-flex; align-items: center; gap: 3px; }
.item .tag [data-ui] { width: 14px; height: 14px; }
.item.on { background: #ffe7e1; box-shadow: inset 0 0 0 2px var(--accent); }
.item.on .tag { color: var(--accent-deep); }
.item.cant { opacity: 0.55; }

/* Album */
.profile { display: grid; grid-template-columns: 120px 1fr; gap: 6px 14px; align-items: center; }
.profile .pf-art { width: 120px; height: 120px; grid-row: span 4; border-radius: 24px; background: radial-gradient(circle at 50% 40%, #fff, var(--panel-2)); }
.profile .pf-art svg { width: 100%; height: 100%; }
.profile h3 { margin: 0; padding: 0; font: 600 28px/1 var(--display); }
.profile .form-name { font: 600 16px/1.2 var(--display); color: var(--accent-deep); }
.profile p { margin: 0; color: var(--muted); font-size: 14px; }
.profile-actions { display: flex; gap: 8px; }
.profile-actions .btn [data-ui] { width: 20px; height: 20px; }
.growth { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.growth figure { margin: 0; flex: none; width: 76px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.growth figure div { width: 70px; height: 70px; border-radius: 18px; background: var(--panel-2); }
.growth figure div svg { width: 100%; height: 100%; }
.growth figcaption { font: 600 13px/1.1 var(--display); text-align: center; }
.growth figcaption small { display: block; font: 700 11.5px/1.2 var(--body); color: var(--muted); }
.growth .next div { display: grid; place-items: center; font: 600 28px/1 var(--display); color: var(--faint); }
.stickers { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.stickers figure { margin: 0; aspect-ratio: 1; border-radius: 14px; background: var(--panel-2); display: grid; place-items: center; padding: 4px; }
.stickers figure svg { width: 100%; height: 100%; }
.stickers figure.missing { color: var(--faint); font: 600 20px/1 var(--display); }
.bests { margin: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.bests div { padding: 8px 4px; border-radius: 14px; background: var(--panel-2); text-align: center; }
.bests dt { font-size: 11px; color: var(--muted); line-height: 1.15; }
.bests dd { margin: 4px 0 0; font: 600 18px/1 var(--display); }
.past { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.past figure { margin: 0; text-align: center; }
.past figure div { aspect-ratio: 1; border-radius: 16px; background: var(--panel-2); }
.past figure div svg { width: 100%; height: 100%; }
.past figcaption { font: 600 13px/1.15 var(--display); }
.past figcaption small { display: block; font: 700 11px/1.2 var(--body); color: var(--muted); }

/* Settings */
.toggles { display: flex; flex-direction: column; }
.toggle { display: flex; align-items: center; gap: 12px; min-height: 58px; padding-block: 8px; border-top: 1px solid var(--line); cursor: pointer; }
.toggle:first-child { border-top: 0; }
.toggle span { flex: 1; display: flex; flex-direction: column; }
.toggle small { color: var(--muted); font-size: 13px; font-weight: 700; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle i { flex: none; width: 48px; height: 30px; border-radius: 15px; background: var(--panel-2); border: 1px solid var(--line); position: relative; transition: background 150ms; }
.toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 200ms var(--spring); }
.toggle input:checked + i { background: var(--accent); }
.toggle input:checked + i::after { transform: translateX(18px); }
.toggle input:focus-visible + i { outline: 2px solid var(--focus); outline-offset: 2px; }
.toggle input:disabled + i { opacity: 0.5; }

/* How it works */
.rules { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.rules li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; }
.rules li > [data-ui] { width: 32px; height: 32px; flex: none; }

/* Moments */
.moment { text-align: center; align-items: center; max-width: 360px; padding-top: 18px; }
.moment-art { width: 190px; height: 190px; position: relative; display: grid; place-items: center; }
.moment-art::before { content: ""; position: absolute; inset: 6%; border-radius: 50%; background: radial-gradient(circle, #fff3c9, transparent 70%); animation: glow 2.6s ease-in-out infinite; }
.moment-art > * { position: relative; }
.moment-art svg { width: 100%; height: 100%; }
.moment-art.small svg { width: 60%; height: 60%; }
.moment-art .pair { display: flex; align-items: center; gap: 4px; width: 100%; }
.moment-art .pair > div { flex: 1; }
.moment-art .pair > div:first-child { opacity: 0.55; transform: scale(0.75); }
.moment-art .pair i { font-style: normal; font: 600 22px/1 var(--display); color: var(--faint); }
.moment h3 { padding: 0; }
.moment .sheet-copy { max-width: 300px; }
.moment .gain { display: inline-flex; align-items: center; gap: 6px; font: 600 20px/1 var(--display); }
.moment .gain [data-ui] { width: 24px; height: 24px; }
#askInput { width: 100%; padding: 0 14px; border-radius: 14px; background: var(--panel-2); text-align: center; }

/* ------------------------------------------------------------ account -- */
.account { display: flex; flex-direction: column; gap: 12px; }
.acct-row { display: flex; gap: 8px; }
.acct-row input {
  flex: 1; min-width: 0; height: 48px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--ink); font: 700 16px var(--body);
}
.acct-row input::placeholder { color: var(--faint); }
.acct-row input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
#acctCodeInput { letter-spacing: 0.35em; font-variant-numeric: tabular-nums; text-align: center; }
.acct-row .btn { flex: none; padding-inline: 18px; }
.acct-links { display: flex; justify-content: space-between; gap: 8px; margin: -4px -8px 0; }
.acct-links .link-btn { font-size: 14px; }
.acct-wait { margin: 0; min-height: 50px; display: flex; align-items: center; gap: 10px; color: var(--muted); }
.acct-in p { margin: 0 0 4px; display: flex; flex-direction: column; gap: 2px; }
.acct-in b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-in small { color: var(--muted); font-size: 13px; }
.acct-captcha:empty { display: none; }
.acct-captcha { display: flex; justify-content: center; }
.acct-error { margin: 0; color: var(--danger); font-size: 14px; }
.spin { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* -------------------------------------------------------------- toast -- */
.toast {
  position: absolute; z-index: 30; left: 50%; bottom: 120px; transform: translateX(-50%); max-width: calc(100% - 32px);
  padding: 11px 18px; border-radius: 16px; background: var(--ink); color: #fff; text-align: center;
  font: 600 15px/1.25 var(--display); box-shadow: var(--shadow); animation: toast 300ms var(--spring);
}
@keyframes toast { from { transform: translate(-50%, 16px); opacity: 0; } }
.build { position: absolute; z-index: 1; right: 14px; bottom: 2px; margin: 0; font-size: 10px; color: var(--faint); pointer-events: none; display: none; }

/* -------------------------------------------------------------- games -- */
.game-screen { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; background: linear-gradient(180deg, #fff7ee, #ffe9dc); animation: fade 200ms ease; }
.game-top { display: flex; align-items: center; gap: 12px; padding: max(12px, env(safe-area-inset-top)) 14px 8px; }
.game-top b { flex: 1; font: 600 22px/1 var(--display); }
.game-score { min-width: 64px; text-align: right; font: 600 22px/1 var(--display); font-variant-numeric: tabular-nums; }
.game-field { position: relative; flex: 1; margin: 0 12px max(12px, env(safe-area-inset-bottom)); border-radius: 28px; overflow: hidden; background: #fff; box-shadow: inset 0 0 0 1px var(--line); touch-action: none; }
.g-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 20px; text-align: center; }
.g-center h4 { margin: 0; font: 600 30px/1.1 var(--display); }
.g-center p { margin: 0; color: var(--muted); max-width: 280px; }
.g-intro { z-index: 5; background: rgba(255, 250, 245, 0.6); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.g-pet { width: 150px; height: 150px; }
.g-pet svg { width: 100%; height: 100%; overflow: visible; }
.g-pet svg .body { transform-box: view-box; transform-origin: 100px 178px; animation: breathe 3.4s ease-in-out infinite; }
.g-pet.jump svg .body { animation: jump 0.7s var(--ease); }
.g-timer { position: absolute; left: 14px; right: 14px; top: 12px; height: 8px; border-radius: 6px; background: rgba(59, 44, 63, 0.08); overflow: hidden; z-index: 3; }
.g-timer i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--pink), var(--accent)); transform-origin: left; }

/* Treat Catch */
.catch { position: absolute; inset: 0; background: linear-gradient(180deg, #cdeaff, #fff6e6 70%, #ffe1c9); }
.catch .catcher { position: absolute; bottom: 2%; width: 28%; max-width: 140px; aspect-ratio: 1; transform: translateX(-50%); will-change: left; }
.catch .catcher svg { width: 100%; height: 100%; overflow: visible; }
.catch .faller { position: absolute; top: 0; width: 13%; max-width: 60px; aspect-ratio: 1; will-change: transform; }
.catch .faller svg { width: 100%; height: 100%; }
.catch .faller.star svg { filter: drop-shadow(0 0 6px rgba(255, 210, 80, 0.8)); }
.catch .yum { position: absolute; font: 600 22px/1 var(--display); color: var(--accent-deep); animation: rise-fade 0.8s ease-out forwards; pointer-events: none; }

/* Memory */
.memory { position: absolute; inset: 0; display: grid; place-items: center; padding: 14px; background: linear-gradient(180deg, #fff3f6, #ffe9ef); }
.memory .cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; max-width: 420px; }
.card { aspect-ratio: 3 / 4; border: 0; padding: 0; background: none; cursor: pointer; perspective: 600px; }
.card .in { position: relative; width: 100%; height: 100%; transition: transform 380ms var(--ease); transform-style: preserve-3d; }
.card.up .in, .card.done .in { transform: rotateY(180deg); }
.card .front, .card .back { position: absolute; inset: 0; border-radius: 14px; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: grid; place-items: center; box-shadow: var(--shadow-sm); }
.card .back { background: linear-gradient(135deg, #ffb3c7, #ff8fab); }
.card .back::after { content: ""; width: 36%; aspect-ratio: 1; background: rgba(255, 255, 255, 0.55); clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.card .front { background: #fff; transform: rotateY(180deg); padding: 14%; }
.card .front svg { width: 100%; height: 100%; }
.card.done .front { box-shadow: 0 0 0 3px var(--mint), var(--shadow-sm); }

/* Which way */
.guess { position: absolute; inset: 0; background: linear-gradient(180deg, #e6f6ec, #fff7e8); }
.guess .g-pet { width: 190px; height: 190px; transition: transform 300ms var(--ease); }
.guess .g-pet.look-l { transform: rotate(-8deg) translateX(-24px); }
.guess .g-pet.look-r { transform: rotate(8deg) translateX(24px); }
.guess .row { display: flex; gap: 14px; }
.guess .row .btn { min-width: 110px; }
.guess .dots { display: flex; gap: 8px; }
.guess .dots i { width: 14px; height: 14px; border-radius: 50%; background: rgba(59, 44, 63, 0.1); }
.guess .dots i.win { background: var(--mint); }
.guess .dots i.lose { background: #ffb3bd; }

/* Bubble pop */
.bubbles { position: absolute; inset: 0; background: linear-gradient(180deg, #d6efff, #f1e8ff); overflow: hidden; }
.bub { position: absolute; border: 0; padding: 0; border-radius: 50%; cursor: pointer; will-change: transform;
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.95) 0 12%, rgba(255, 255, 255, 0.25) 13% 55%, rgba(170, 210, 255, 0.35) 75%, rgba(200, 170, 255, 0.55));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.7), 0 4px 10px rgba(120, 140, 220, 0.18); }
.bub.gold { background: radial-gradient(circle at 32% 28%, #fff 0 12%, rgba(255, 240, 180, 0.6) 13% 55%, rgba(255, 210, 90, 0.7)); }
.bub.popped { animation: bub-pop 260ms ease-out forwards; pointer-events: none; }
@keyframes bub-pop { to { transform: scale(1.5); opacity: 0; } }

/* Dance */
.dance { position: absolute; inset: 0; background: radial-gradient(80% 50% at 50% 40%, #ffe9f6, #e9e3ff); }
.dance .pads { display: grid; grid-template-columns: repeat(2, 84px); gap: 12px; }
.pad { height: 70px; border: 0; border-radius: 22px; cursor: pointer; font: 600 30px/1 var(--display); color: #fff; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.12); transition: transform 120ms, filter 120ms; }
.pad[data-m="0"] { background: #ff9fb8; }
.pad[data-m="1"] { background: #8fd3ff; }
.pad[data-m="2"] { background: #ffd95e; color: #8a6514; }
.pad[data-m="3"] { background: #a8e6c1; color: #2f7d55; }
.pad.lit { transform: scale(1.08); filter: brightness(1.1); box-shadow: 0 0 0 4px #fff, 0 0 24px rgba(255, 255, 255, 0.9); }
.pad:disabled { cursor: default; }
.dance .g-pet { width: 170px; height: 170px; }
.dance .g-pet.m0 svg .body { animation: jump 0.5s var(--ease); }
.dance .g-pet.m1 svg .body { animation: spin-y 0.5s var(--ease); }
.dance .g-pet.m2 svg .body { transform: rotate(-14deg) translateX(-10px); animation: none; transition: transform 150ms; }
.dance .g-pet.m3 svg .body { transform: rotate(14deg) translateX(10px); animation: none; transition: transform 150ms; }

@media (prefers-reduced-motion: reduce) {
  .pet svg .body, .pet svg .shadow, .bubble, .meter.low, .act.want > span, .float-btn, .pet svg .glow { animation: none !important; }
  .pet-wrap { transition: none; }
}
@media (max-height: 680px) {
  .meters { padding-bottom: 6px; }
  .act > span { width: 40px; height: 40px; padding: 6px; }
  .who b { font-size: 21px; }
}
