/* Puffling web: the children's screens, in the iPhone app's warm style. */
:root {
  --accent: #F27B3C; --accent-deep: #D9622A; --cream: #FFF7EC; --ink: #4A3426; --ink-soft: #8C7462;
  --leaf: #58B86A; --sky: #4FA8E8; --berry: #EE6A8E; --sun: #FFB92E; --grape: #9B7BEA; --coin: #F6B223; --danger: #E5484D;
  --shadow: 0 5px 14px rgba(140, 90, 43, 0.12);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--cream); color: var(--ink); font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Quicksand", system-ui, sans-serif; }
body { min-height: 100dvh; }
img { -webkit-user-drag: none; user-select: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
h1 { font-size: 30px; font-weight: 900; margin: 10px 0 4px; }
h2 { font-size: 22px; font-weight: 800; margin: 4px 0; }
h3 { font-size: 19px; font-weight: 800; margin: 18px 4px 8px; }
.muted { color: var(--ink-soft); font-weight: 600; }
.error { color: var(--danger); font-weight: 700; }
.waiting { color: var(--sky); font-weight: 700; }
.spacer { flex: 1; }
.grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.coin { width: 16px; height: 16px; vertical-align: -3px; }
.card { background: #fff; border-radius: 22px; box-shadow: var(--shadow); }
.center { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 24px 20px; }
.link { color: var(--accent-deep); font-weight: 800; padding: 10px; }

#app { max-width: 560px; margin: 0 auto; padding-bottom: 96px; }
.page { padding: 0 14px 20px; display: flex; flex-direction: column; gap: 12px; }

/* Buttons */
.chunky { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 18px; border-radius: 18px; font-weight: 800; font-size: 17px; color: #fff;
  background: var(--accent); box-shadow: 0 5px 0 #b65a2a; transition: transform .08s, box-shadow .08s; margin-bottom: 5px; }
.chunky:active { transform: translateY(4px); box-shadow: 0 1px 0 #b65a2a; }
.chunky.wide { width: 100%; }
.chunky.small { padding: 9px 14px; font-size: 15px; }
.chunky.green { background: var(--leaf); box-shadow: 0 5px 0 #3e8a4c; }
.chunky.gold { background: #FFE08A; color: var(--ink); box-shadow: 0 5px 0 #d9a73a; }
.chunky.white { background: #fff; color: var(--ink); box-shadow: 0 5px 0 #e3d6c6; }
.chunky.red-solid { background: var(--danger); box-shadow: 0 5px 0 #a8292d; }
.chunky.soft { flex-direction: column; color: var(--ink); font-size: 14px; padding: 10px 4px; gap: 4px; }
.chunky.soft img { width: 40px; height: 40px; }
.chunky.red { background: #FFE3E3; box-shadow: 0 4px 0 #e7b9b9; }
.chunky.blue { background: #DDF1FF; box-shadow: 0 4px 0 #a9cde8; }
.chunky.yellow { background: #FFF1C9; box-shadow: 0 4px 0 #e5cf8a; }
.chunky.purple { background: #EFE6FF; box-shadow: 0 4px 0 #c9b8ea; }
.chunky img.coin { width: 20px; height: 20px; }
.bubble { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 22px; background: #fff; box-shadow: 0 4px 0 #e3d6c6; }
.bubble:active { transform: translateY(3px); box-shadow: 0 1px 0 #e3d6c6; }
.bubble.tick span { width: 32px; height: 32px; border-radius: 50%; border: 3px solid rgba(88, 184, 106, .6); }
.bubble.wait { background: #E1F1FD; box-shadow: 0 4px 0 #b6d7ee; }
.bubble.chest { width: 62px; height: 62px; background: #FFE08A; box-shadow: 0 4px 0 #d9a73a; display: flex; flex-direction: column; animation: pulse 1.2s ease-in-out infinite; }
.bubble.chest img { width: 32px; }
.bubble.chest small { font-size: 11px; font-weight: 900; }
.bubble.done { background: var(--leaf); color: #fff; box-shadow: none; font-weight: 900; }
.bubble.star { background: #FFF3CC; box-shadow: 0 4px 0 #e5cf8a; color: var(--coin); width: 48px; height: 48px; }
@keyframes pulse { 50% { transform: scale(1.08); } }

/* Top bar and tabs */
.top { display: flex; align-items: center; gap: 8px; padding: 10px 14px 8px; position: sticky; top: 0; background: var(--cream); z-index: 5; }
.who { display: flex; align-items: center; gap: 8px; text-align: left; }
.who span { display: flex; flex-direction: column; line-height: 1.15; }
.who b { font-size: 18px; font-weight: 900; }
.who small { color: var(--ink-soft); font-weight: 700; font-size: 12px; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: #FDE4D2; border: 2px solid #F7C2A0; object-fit: cover; object-position: 50% 30%; padding: 2px; }
.pill { display: inline-flex; align-items: center; gap: 5px; background: #fff; border-radius: 999px; padding: 6px 12px 6px 8px; font-size: 16px; }
.pill b { font-weight: 900; }
.pill.coins img { width: 24px; height: 24px; }
.offline { margin: 0 14px 8px; padding: 8px 12px; border-radius: 12px; background: #FFE3E3; color: var(--danger); font-weight: 700; font-size: 13px; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 4px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: #fff; border-radius: 28px 28px 0 0; box-shadow: 0 -4px 14px rgba(140, 90, 43, .12); z-index: 10; }
.tabs button { flex: 1; max-width: 140px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; border-radius: 18px; color: var(--ink-soft); font-weight: 700; font-size: 13px; }
.tabs button.on { background: rgba(242, 123, 60, .1); color: var(--accent); font-weight: 900; }
.tab-art { position: relative; }
.tabs img { width: 38px; height: 38px; filter: saturate(.35); opacity: .75; transition: transform .2s; }
.tabs .on img { filter: none; opacity: 1; transform: scale(1.12); }
.badge { position: absolute; top: -4px; right: -10px; background: var(--berry); color: #fff; font-style: normal; font-size: 12px; font-weight: 900; border-radius: 999px; padding: 1px 6px; }
.badge.gold { background: var(--coin); }

/* Home */
.needs { display: flex; gap: 8px; }
.need { flex: 1; display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 16px; }
.need img { width: 26px; height: 26px; }
.meter { flex: 1; display: block; height: 9px; background: rgba(0, 0, 0, .08); border-radius: 99px; overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 99px; transition: width .5s; }
.room-card { overflow: hidden; border-radius: 28px; }
.room { position: relative; aspect-ratio: 1.18; overflow: hidden; border-radius: 28px; }
.wall, .floor { position: absolute; left: 0; right: 0; background-color: var(--top); background-image: linear-gradient(var(--top), var(--bottom)); }
.wall { top: 0; height: 66%; }
.floor { bottom: 0; height: 34%; border-top: 5px solid rgba(255, 255, 255, .7); }
[data-pattern="dots"] { background-image: radial-gradient(var(--ink) 3px, transparent 3.5px), linear-gradient(var(--top), var(--bottom)); background-size: 28px 28px, auto; }
[data-pattern="hearts"], [data-pattern="stars"] { background-image: radial-gradient(var(--ink) 4px, transparent 4.5px), linear-gradient(var(--top), var(--bottom)); background-size: 38px 38px, auto; background-position: 10px 10px, 0 0; }
[data-pattern="stripes"] { background-image: repeating-linear-gradient(90deg, var(--ink) 0 11px, transparent 11px 28px), linear-gradient(var(--top), var(--bottom)); }
[data-pattern="clouds"] { background-image: radial-gradient(circle at 15% 25%, #fff 0 22px, transparent 23px), radial-gradient(circle at 22% 22%, #fff 0 16px, transparent 17px), radial-gradient(circle at 82% 18%, #fff 0 20px, transparent 21px), radial-gradient(circle at 60% 60%, #fff 0 14px, transparent 15px), linear-gradient(var(--top), var(--bottom)); }
[data-pattern="planks"] { background-image: repeating-linear-gradient(0deg, var(--ink) 0 2px, transparent 2px 34%), repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 90px), linear-gradient(var(--top), var(--bottom)); }
[data-pattern="grass"] { background-image: radial-gradient(var(--ink) 2px, transparent 2.5px), linear-gradient(var(--top), var(--bottom)); background-size: 14px 12px, auto; }
[data-pattern="tiles"] { background-image: linear-gradient(var(--ink) 2px, transparent 2px), linear-gradient(90deg, var(--ink) 2px, transparent 2px), linear-gradient(var(--top), var(--bottom)); background-size: 36px 36px, 36px 36px, auto; }
[data-pattern="waves"] { background-image: repeating-radial-gradient(circle at 50% 120%, transparent 0 14px, var(--ink) 14px 16px), linear-gradient(var(--top), var(--bottom)); }
.window { position: absolute; top: 5%; left: 35%; width: 30%; height: 25%; border-radius: 14%; border: 5px solid #fff; overflow: hidden; box-shadow: 0 3px 6px rgba(0, 0, 0, .08);
  background: linear-gradient(#8FD3FF, #CDEEFF); }
.window::before { content: ""; position: absolute; width: 24%; aspect-ratio: 1; border-radius: 50%; background: #FFD54F; top: 18%; right: 14%; }
.window::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent calc(50% - 2px), #fff calc(50% - 2px) calc(50% + 2px), transparent calc(50% + 2px)), linear-gradient(transparent calc(50% - 2px), #fff calc(50% - 2px) calc(50% + 2px), transparent calc(50% + 2px)); }
.window.dusk { background: linear-gradient(#FFB27A, #FF8FA3); }
.window.night { background: radial-gradient(#fff 1px, transparent 1.5px) 0 0 / 18px 14px, linear-gradient(#1E2A5A, #3B3F86); }
.window.night::before { background: #FFF3B0; }
.spot { position: absolute; }
.spot.wall-left, .spot.wall-right { width: 19%; top: 13%; }
.spot.wall-left { left: 4%; } .spot.wall-right { right: 4%; }
.spot.floor-left, .spot.floor-right { width: 27%; bottom: 18%; }
.spot.floor-left { left: 1%; } .spot.floor-right { right: 1%; }
.pet-box { position: absolute; left: 50%; bottom: 5%; width: min(56%, 70% * .84); aspect-ratio: 1; transform: translateX(-50%); cursor: pointer; }
.pet-box::before { content: ""; position: absolute; bottom: 0; left: 21%; width: 58%; height: 7%; border-radius: 50%; background: rgba(0, 0, 0, .13); }
.pet-body { position: absolute; inset: 0; transform-origin: 50% 100%; animation: breathe 2.4s ease-in-out infinite; }
.pet-img { width: 100%; height: 100%; object-fit: contain; }
.thought { position: absolute; top: 2%; right: -6%; width: 22%; aspect-ratio: 1; background: #fff; border-radius: 50%; display: grid; place-items: center; box-shadow: 0 2px 4px rgba(0, 0, 0, .12); animation: float 2s ease-in-out infinite; }
.thought img { width: 60%; }
.react-cuddle .pet-body, .react-playing .pet-body { animation: hop .45s ease-out 3; }
.react-bathing .pet-body { animation: wiggle .25s ease-in-out 5; }
.react-eating .pet-body { animation: chew .3s ease-in-out 5; }
@keyframes breathe { 50% { transform: scale(.988, 1.02); } }
@keyframes hop { 40% { transform: translateY(-12%); } }
@keyframes wiggle { 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
@keyframes chew { 50% { transform: scale(1.02, .97); } }
@keyframes float { 50% { transform: translateY(-4px); } }
.room-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px 12px; }
.room-foot > div { display: flex; flex-direction: column; gap: 2px; }
.pet-name { font-size: 22px; font-weight: 900; }
.lvl { align-items: flex-end; width: 120px; color: var(--grape); font-size: 14px; }
.lvl .meter { width: 110px; flex: none; }
.care { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.treasure { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 22px; text-align: left; background: linear-gradient(135deg, #FFF3C4, #FFE08A); box-shadow: 0 6px 14px rgba(246, 178, 35, .3); }
.treasure img { width: 54px; animation: wiggle .6s ease-in-out infinite; }
.treasure span { display: flex; flex-direction: column; }
.treasure b { font-size: 17px; font-weight: 900; }
.treasure small { color: var(--ink-soft); font-weight: 700; }

/* Quests */
.head { position: relative; display: flex; align-items: center; gap: 16px; padding: 18px; }
.ring { width: 76px; height: 76px; flex: none; transform: rotate(-90deg); }
.ring circle { fill: none; stroke: rgba(0, 0, 0, .08); stroke-width: 10; }
.ring .fill { stroke: var(--leaf); stroke-linecap: round; transition: stroke-dasharray .5s; }
.ring-text { position: absolute; left: 18px; width: 76px; text-align: center; font-size: 21px; font-weight: 900; }
.head h2 { margin: 0 0 4px; }
.head p { margin: 2px 0; }
.time { color: var(--ink-soft); }
.quest { display: flex; align-items: center; gap: 14px; padding: 14px; }
.quest b { font-size: 17px; font-weight: 800; }
.quest small { font-weight: 700; font-size: 14px; }
.quest.faded { opacity: .75; }
.strike { text-decoration: line-through; color: var(--ink-soft); }
.tile { width: 58px; height: 58px; flex: none; border-radius: 18px; background: #FDEEDC; display: grid; place-items: center; }
.tile img { width: 76%; }
.tile.big { width: 100px; height: 100px; border-radius: 28px; }
.tile.small { width: 44px; height: 44px; border-radius: 14px; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px; }
.row small { font-weight: 800; }
.goal { display: flex; align-items: center; gap: 14px; padding: 16px; background: linear-gradient(135deg, #FFF6D6, #fff); }
.goal b { font-size: 18px; font-weight: 900; }

/* Shop */
.shelves { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.shelves button { display: flex; flex-direction: column; align-items: center; padding: 8px 2px; border-radius: 18px; background: #fff; font-weight: 700; font-size: 13px; border: 2px solid transparent; }
.shelves button.on { background: rgba(242, 123, 60, .14); border-color: var(--accent); color: var(--accent-deep); font-weight: 900; }
.shelves img { width: 30px; height: 30px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; }
.shop-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px 10px; }
.shop-item img:not(.coin) { width: 64px; height: 64px; object-fit: contain; }
.shop-item b { font-size: 13px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.shop-item small { font-weight: 900; font-size: 14px; }
.shop-item.locked img:not(.coin) { filter: grayscale(1); opacity: .5; }
/* Food this pet doesn't eat: faded, so children learn its diet. */
.notfor > img { opacity: .4; }
.shop-item.notfor small { color: var(--ink-soft); }
.shop-item.selected { outline: 3px solid var(--accent); }
.count { position: absolute; top: 6px; right: 6px; background: var(--leaf); color: #fff; font-style: normal; font-weight: 900; font-size: 12px; border-radius: 99px; padding: 2px 7px; }
.swatch { width: 64px; height: 64px; border-radius: 14px; background-image: linear-gradient(var(--top), var(--bottom)); }
.swatch.big { width: 120px; height: 120px; border-radius: 26px; }
.buy-art { width: 120px; height: 120px; object-fit: contain; }

/* Sheets */
#sheet { position: fixed; inset: 0; z-index: 20; }
.backdrop { position: absolute; inset: 0; background: rgba(40, 25, 15, .35); }
.panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 82dvh; overflow: auto; max-width: 560px; margin: 0 auto; background: var(--cream); border-radius: 32px 32px 0 0;
  padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; animation: up .25s ease-out; }
@keyframes up { from { transform: translateY(40%); opacity: 0; } }
.tray { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 8px; }
.tray-item { flex: none; width: 100px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; }
.tray-item img { width: 64px; height: 64px; }
.tray-item b { font-size: 13px; }
.segmented { display: flex; background: rgba(0, 0, 0, .06); border-radius: 12px; padding: 3px; }
.segmented button { flex: 1; padding: 8px; border-radius: 10px; font-weight: 700; }
.segmented .on { background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }

/* Celebrations */
#cheer { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 30; }
#cheer[hidden], #sheet[hidden] { display: none; }
#cheer span { background: var(--leaf); color: #fff; font-weight: 900; font-size: 30px; padding: 16px 28px; border-radius: 99px; box-shadow: 0 10px 20px rgba(0, 0, 0, .18); animation: pop .35s ease-out; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.pop { animation: pop .5s cubic-bezier(.3, 1.6, .5, 1); }
.confetti { position: fixed; left: 50%; top: 55%; z-index: 29; pointer-events: none; }
.confetti > * { position: absolute; width: 9px; height: 14px; border-radius: 2px; animation: burst 1.5s ease-out forwards; }
.confetti > img { width: 26px; height: 26px; }
@keyframes burst { to { transform: translate(var(--x), calc(var(--y) + 380px)) rotate(var(--r)); opacity: 0; } 30% { transform: translate(calc(var(--x) * .6), var(--y)); } }

/* Join and hatching */
.join form { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 320px; }
.join input, .hatch input { font: inherit; font-size: 26px; font-weight: 900; text-align: center; letter-spacing: 4px; padding: 14px; border-radius: 18px; border: 0; background: #fff; box-shadow: var(--shadow); color: var(--ink); text-transform: uppercase; }
.hatch input { letter-spacing: 0; text-transform: none; }
.hatch form { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 320px; }
.trio { display: flex; align-items: flex-end; margin-top: 10px; }
.trio img { width: 110px; margin: 0 -14px; }
.trio img:nth-child(2) { width: 160px; z-index: 1; }
.big-pet { width: 200px; height: 200px; object-fit: contain; }
.eggs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; width: 100%; max-width: 380px; }
.egg { position: relative; padding: 14px 6px; display: grid; place-items: center; animation: wobble 1.8s ease-in-out infinite; transform-origin: 50% 100%; }
.egg img { height: 92px; }
.egg.locked { opacity: .75; }
.egg .lock { position: absolute; top: 6px; right: 6px; width: 28px; height: auto; }
@keyframes wobble { 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
.egg-big { width: 240px; height: 240px; display: grid; place-items: center; animation: wobble .5s ease-in-out infinite; transform-origin: 50% 100%; }
.egg-big img { height: 230px; }
.egg-big { position: relative; }
.crack { position: absolute; left: 25%; top: 32%; width: 50%; fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; opacity: .75; }
.egg-big:active { transform: rotate(10deg); }

/* Seasons, pocket money, badges, presents */
.season { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 22px; text-align: left; background: linear-gradient(135deg, #EFE6FF, #FFE9D6); box-shadow: 0 6px 14px rgba(155, 123, 234, .2); }
.season img { width: 54px; animation: wiggle .8s ease-in-out infinite; }
.season span { display: flex; flex-direction: column; }
.season b { font-size: 17px; font-weight: 900; }
.season small { color: var(--ink-soft); font-weight: 700; }
.season.compact { padding: 10px; }
.season.compact img { width: 40px; }
.shelves.five { grid-template-columns: repeat(5, 1fr); }
.pocket { padding: 16px; background: linear-gradient(135deg, #E8F7EA, #fff); display: flex; flex-direction: column; gap: 12px; }
.pocket-head { display: flex; gap: 12px; align-items: center; }
.pocket b { font-size: 19px; font-weight: 900; }
.pocket .worth { color: var(--leaf); font-weight: 800; }
.pocket-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 8px; }
.pocket-choices button { flex-direction: column; gap: 0; }
.pocket-choices button small { font-size: 12px; opacity: .85; }
.pocket-choices button[disabled] { opacity: .45; }
.badges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 14px; }
.badge-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.badge-cell img { width: 58px; height: 58px; }
.badge-cell small { font-size: 11px; font-weight: 700; text-align: center; line-height: 1.15; }
.badge-cell.off img, .badge-big.off { filter: grayscale(1); opacity: .35; }
.badge-cell.off small { color: var(--ink-soft); }
.badge-big { width: 130px; height: 130px; }
.new-badge { color: var(--accent-deep); font-size: 16px; }
.grape { color: var(--grape); }
.present { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 22px; text-align: left; background: linear-gradient(135deg, #FFE6EE, #FFF3C4); box-shadow: 0 6px 14px rgba(238, 106, 142, .2); }
.present span { flex: 1; display: flex; flex-direction: column; }
.present b { font-size: 18px; font-weight: 900; }
.present small { color: var(--ink-soft); font-weight: 700; }
.present-pet { width: 60px; }
.present-box { width: 46px; animation: pulse 1s ease-in-out infinite; }
.chunky img.btn-art { width: 38px; height: 38px; }
