* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #5d9c48; overflow: hidden; font-family: "Trebuchet MS", system-ui, sans-serif; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
#wrap { position: fixed; inset: 0; overflow: hidden; background: #6aa84f; }
#wrap::before { content: ""; position: absolute; inset: -40px; background: url(img/bg.webp) center / cover no-repeat; filter: blur(18px) brightness(.9) saturate(1.1); }
#stage { position: relative; width: 1600px; height: 900px; transform-origin: 0 0; overflow: hidden; touch-action: none; border-radius: 18px; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); position: absolute; left: 0; top: 0; }
#bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }

.pet { position: absolute; transform: translate(-50%, -100%); cursor: pointer; }
.pet img.body { display: block; height: 100%; width: auto; pointer-events: none; transition: transform .25s; filter: drop-shadow(0 8px 6px rgba(0, 0, 0, .18)); }
.pet .shadow { position: absolute; left: 12%; right: 12%; bottom: -10px; height: 26px; border-radius: 50%; background: rgba(40, 70, 20, .25); z-index: -1; }
.pet.sad img.body { filter: grayscale(.35) drop-shadow(0 8px 6px rgba(0, 0, 0, .18)); }
.pet.hop img.body { animation: hop .45s ease-in-out infinite; }
.pet.idle img.body { animation: breathe 3.2s ease-in-out infinite; transform-origin: 50% 100%; }
.pet.drop img.body { transform: scale(1.06); }
@keyframes hop { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-38px); } }
@keyframes breathe { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.025); } }

.bubble { position: absolute; left: 62%; bottom: 92%; width: 112px; height: 104px; background: #fff; border: 5px solid #3a2e2a; border-radius: 50% 50% 50% 50% / 55% 55% 45% 45%; display: grid; place-items: center; animation: pop .35s ease-out, bob 2s ease-in-out .35s infinite; pointer-events: none; }
.bubble::after { content: ""; position: absolute; left: 14px; bottom: -22px; width: 22px; height: 22px; background: #fff; border: 5px solid #3a2e2a; border-radius: 50%; }
.bubble img { width: 74%; height: 74%; object-fit: contain; }
@keyframes pop { from { transform: scale(.2); } 70% { transform: scale(1.12); } to { transform: scale(1); } }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }

.bed { position: absolute; transform: translate(-50%, -100%); width: 190px; height: 190px; display: grid; place-items: end center; pointer-events: none; }
.bed img { max-width: 100%; max-height: 100%; pointer-events: none; transition: transform .3s; }
.bed.ripe img { animation: wiggle 1.4s ease-in-out infinite; }
.bed.drop { outline: 6px dashed rgba(255, 255, 255, .8); outline-offset: -6px; border-radius: 30px; }
.bed .drop-mark { position: absolute; left: 50%; bottom: 2px; width: 62%; height: 26%; transform: translateX(-50%); border-radius: 50%; border: 6px dashed rgba(255, 255, 255, .8); pointer-events: none; animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.bed .thirst { position: absolute; top: 8px; right: 8px; width: 54px; height: 54px; border-radius: 50%; background: #fff; border: 4px solid #3a2e2a; display: grid; place-items: center; animation: bob 2s ease-in-out infinite; }
.bed .thirst img { width: 80%; }
.bed .meter { position: absolute; left: 20%; right: 20%; bottom: -14px; height: 12px; border-radius: 8px; background: rgba(0, 0, 0, .2); overflow: hidden; }
.bed .meter i { display: block; height: 100%; width: 0; background: #5fc4ff; transition: width .1s; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-5deg); } 75% { transform: rotate(5deg); } }

#tray { z-index: 30; position: absolute; left: 50%; bottom: calc(var(--vb, 0px) + 14px); transform: translateX(-50%); display: flex; gap: 12px; padding: 10px 16px; background: rgba(255, 250, 235, .88); border: 5px solid #3a2e2a; border-radius: 28px; box-shadow: 0 6px 0 rgba(58, 46, 42, .45); }
.tool { position: relative; width: 104px; height: 104px; border-radius: 22px; background: #fff; border: 4px solid #d9c9a8; display: grid; place-items: center; cursor: grab; touch-action: none; }
.tool:hover { border-color: #f0a03c; transform: translateY(-3px); }
.tool img { width: 82%; height: 82%; object-fit: contain; pointer-events: none; }
.tool.empty { opacity: .35; cursor: default; }
.tool .count { position: absolute; right: -8px; top: -8px; min-width: 34px; height: 34px; border-radius: 17px; background: #f0a03c; color: #fff; font-weight: 800; font-size: 20px; display: grid; place-items: center; border: 3px solid #3a2e2a; }

.ghost-item { position: absolute; width: 120px; height: 120px; transform: translate(-50%, -50%) scale(1.1); pointer-events: none; z-index: 50; filter: drop-shadow(0 10px 8px rgba(0, 0, 0, .3)); }
.ghost-item img { width: 100%; height: 100%; object-fit: contain; }

#hud { position: absolute; left: calc(var(--vs, 0px) + 18px); top: calc(var(--vt, 0px) + 16px); display: flex; gap: 12px; }
#corner { position: absolute; right: calc(var(--vs, 0px) + 18px); top: calc(var(--vt, 0px) + 16px); display: flex; gap: 10px; }
.round { position: relative; height: 84px; min-width: 84px; padding: 0 18px 0 10px; border-radius: 42px; background: rgba(255, 250, 235, .92); border: 5px solid #3a2e2a; display: flex; align-items: center; gap: 6px; cursor: pointer; font: 800 38px "Trebuchet MS", system-ui, sans-serif; color: #3a2e2a; box-shadow: 0 5px 0 rgba(58, 46, 42, .45); }
.round img { width: 60px; height: 60px; }
.round.small { height: 62px; min-width: 62px; padding: 0; justify-content: center; }
.round svg { width: 34px; height: 34px; fill: none; stroke: #3a2e2a; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.hold i { position: absolute; inset: -5px; border-radius: 50%; border: 5px solid #f0a03c; clip-path: inset(0 100% 0 0); }
.hold.holding i { transition: clip-path 1.8s linear; clip-path: inset(0 0 0 0); }
#bAlbum.bump { animation: pop .5s ease-out; }

#fx { position: absolute; inset: 0; pointer-events: none; z-index: 40; }
.float { position: absolute; transform: translate(-50%, -50%); animation: floatup 1.4s ease-out forwards; }
.float.heart { width: 54px; height: 54px; }
.float img { width: 64px; height: 64px; }
@keyframes floatup { from { opacity: 1; translate: 0 0; scale: .6; } 30% { scale: 1.1; } to { opacity: 0; translate: 0 -150px; scale: 1; } }
.sparkle { position: absolute; width: 22px; height: 22px; background: radial-gradient(circle, #fff 0 30%, #ffe680 40%, transparent 70%); border-radius: 50%; animation: spark .9s ease-out forwards; }
@keyframes spark { from { opacity: 1; scale: .3; } to { opacity: 0; scale: 1.6; translate: var(--dx) var(--dy); } }
.confetti { position: absolute; width: 16px; height: 24px; border-radius: 4px; animation: fall 2.2s ease-in forwards; }
@keyframes fall { from { translate: 0 0; rotate: 0deg; } to { translate: var(--dx) 1000px; rotate: 720deg; } }
.flystar { position: absolute; width: 80px; height: 80px; transform: translate(-50%, -50%); transition: left .8s cubic-bezier(.5, -0.3, .4, 1), top .8s cubic-bezier(.5, -0.3, .4, 1), scale .8s; z-index: 45; }

#hand { position: absolute; width: 120px; height: 120px; pointer-events: none; z-index: 60; opacity: 0; transform: translate(-25%, -10%); }
#hand.show { opacity: 1; transition: left 1.4s ease-in-out, top 1.4s ease-in-out, opacity .3s; }

.overlay { position: fixed; inset: 0; background: rgba(40, 60, 30, .55); display: grid; place-items: center; z-index: 100; }
.overlay[hidden] { display: none; }
.sheet { position: relative; background: #fffaf0; border: 6px solid #3a2e2a; border-radius: 30px; padding: 28px; max-width: min(92vw, 980px); max-height: 92vh; overflow: auto; }
.stickers { display: grid; grid-template-columns: repeat(4, 150px); gap: 18px; padding: 10px 30px 10px 10px; }
.sticker { width: 150px; height: 150px; border-radius: 26px; background: #efe6d2; border: 4px dashed #c9b88f; display: grid; place-items: center; }
.sticker.got { background: #fff; border: 4px solid #f0a03c; animation: pop .4s ease-out; }
.sticker img { width: 86%; height: 86%; object-fit: contain; }
.sticker:not(.got) img { filter: brightness(0) opacity(.12); }
.close { position: absolute; right: 12px; top: 12px; height: 62px; min-width: 62px; padding: 0; justify-content: center; }
.text { font: 18px/1.5 system-ui, sans-serif; color: #3a2e2a; max-width: 560px; user-select: text; }
.text h1 { margin: 0 0 8px; font-size: 28px; }
.text label { display: flex; align-items: center; gap: 10px; margin: 12px 0; }
.text select { font-size: 17px; padding: 6px 10px; border-radius: 10px; }
.text .small { font-size: 14px; color: #6b5d55; }
.text .row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.btn { font: 700 17px system-ui, sans-serif; padding: 10px 18px; border-radius: 14px; border: 3px solid #3a2e2a; background: #f0a03c; color: #fff; cursor: pointer; }
.btn.ghost { background: #fff; color: #3a2e2a; }
#rotate { display: none; }
#rotate svg { width: 90px; height: 90px; fill: none; stroke: #3a2e2a; stroke-width: 3; }
@media (orientation: portrait) and (max-width: 900px) { #rotate { display: grid; } }

#frame { position: absolute; left: 28px; top: 219px; width: 112px; height: 144px; pointer-events: none; z-index: 3; }
#hides { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.peek { position: absolute; overflow: hidden; cursor: pointer; pointer-events: auto; }
.peek img { position: absolute; pointer-events: none; animation: peekup .6s ease-out both, peekwig 2.2s ease-in-out .6s infinite; }
.peek.found img { animation: peekgo .5s ease-in forwards; }
@keyframes peekup { from { translate: 0 60%; } to { translate: 0 0; } }
@keyframes peekwig { 0%, 100% { rotate: 0deg; } 30% { rotate: -6deg; } 60% { rotate: 5deg; } }
@keyframes peekgo { to { translate: 0 80%; opacity: 0; } }
.pet.hidden { opacity: 0; pointer-events: none; transition: opacity .4s; }
.pet { transition: opacity .4s; }
#door { position: absolute; left: 222px; top: 182px; width: 90px; height: 186px; cursor: pointer; z-index: 4; border-radius: 10px 10px 0 0; }
#door:hover { box-shadow: inset 0 0 0 5px rgba(255, 220, 120, .8); }
#night { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 2.5s; z-index: 1; background: linear-gradient(#0f1a4d 0%, #1d2b6b 35%, rgba(20, 35, 90, .55) 55%, rgba(15, 25, 70, .45) 100%); mix-blend-mode: multiply; }
#stage.isnight #night { opacity: 1; }
#night .moon { position: absolute; left: 760px; top: 60px; width: 90px; height: 90px; border-radius: 50%; box-shadow: 22px -6px 0 0 #fff4c4; mix-blend-mode: screen; }
#night .stars { position: absolute; inset: 0 0 55% 0; background-image: radial-gradient(2px 2px at 10% 20%, #fff, transparent), radial-gradient(2px 2px at 30% 8%, #fff, transparent), radial-gradient(3px 3px at 52% 25%, #fff, transparent), radial-gradient(2px 2px at 64% 10%, #fff, transparent), radial-gradient(2px 2px at 72% 30%, #fff, transparent), radial-gradient(3px 3px at 88% 14%, #fff, transparent), radial-gradient(2px 2px at 42% 40%, #fff, transparent), radial-gradient(2px 2px at 20% 45%, #fff, transparent); mix-blend-mode: screen; animation: twinkle 3s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .5; } }
#glow { position: absolute; left: 30px; top: 220px; width: 110px; height: 142px; background: radial-gradient(circle, #ffe08a 0%, #ffcf5a 55%, rgba(255, 200, 80, .0) 100%); opacity: 0; transition: opacity 2s; z-index: 2; pointer-events: none; }
#stage.edge { border-radius: 0; box-shadow: none; }
#stage.isnight #glow { opacity: .95; }
#stage.isnight .bubble { display: none; }

#tip { position: absolute; left: 50%; top: calc(var(--vt, 0px) + 18px); transform: translateX(-50%); max-width: 1000px; padding: 12px 26px; background: #fffaf0; border: 5px solid #3a2e2a; border-radius: 26px; font: 800 30px/1.25 "Trebuchet MS", system-ui, sans-serif; color: #3a2e2a; text-align: center; box-shadow: 0 5px 0 rgba(58, 46, 42, .4); z-index: 55; pointer-events: none; animation: tipin .22s ease-out; transition: opacity .25s, translate .25s; }
#tip.out { opacity: 0; translate: 0 -8px; }
@keyframes tipin { from { opacity: 0; translate: 0 -8px; } to { opacity: 1; translate: 0 0; } }
#tip[hidden] { display: none; }

.play { width: 220px; height: 220px; border-radius: 50%; background: #f0a03c; border: 8px solid #3a2e2a; box-shadow: 0 10px 0 rgba(58, 46, 42, .45); cursor: pointer; display: grid; place-items: center; animation: breathe 2.4s ease-in-out infinite; }
.play svg { width: 120px; height: 120px; fill: #fff; stroke: #3a2e2a; stroke-width: 1.4; stroke-linejoin: round; margin-left: 14px; }
#bPause svg { stroke-width: 3.4; }

#bVoice .x { display: none; }
#bVoice.off .x { display: inline; }
#bVoice.off .w { display: none; }

.askbox { text-align: center; padding: 26px 40px 30px; }
.askbox img { height: 150px; }
.askbox p { font: 800 30px/1.3 "Trebuchet MS", system-ui, sans-serif; color: #3a2e2a; margin: 10px 0 22px; max-width: 520px; }
.askbox .row { display: flex; justify-content: center; gap: 40px; }
.round.big { height: 110px; min-width: 110px; padding: 0; justify-content: center; }
.round.big svg { width: 64px; height: 64px; stroke-width: 3.2; }
.round.yes { background: #8fd06b; }
.round.no { background: #ffd3c7; }
