* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #f4ecd8;
  color: #3b2f2f;
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
}
#app { max-width: 720px; margin: 0 auto; padding: 12px; }
.pixel { image-rendering: pixelated; image-rendering: crisp-edges; }
button {
  font: inherit; padding: 10px 16px; border-radius: 10px; border: 2px solid #3b2f2f;
  background: #ffd97d; cursor: pointer;
}
button:disabled { opacity: .45; cursor: default; }
#overlay {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: rgba(0,0,0,.55); color: #fff; text-align: center; padding: 24px;
}
#overlay[hidden] { display: none; }
.stage { position: relative; height: 260px; display: grid; place-items: center; }
.pet {
  width: 120px; height: 120px; border-radius: 24px;
  animation: bob 1.6s ease-in-out infinite;
}
.pet[data-mood="sleepy"] { animation-duration: 3s; opacity: .85; }
.pet[data-mood="bored"]  { animation-name: wiggle; }
.pet.anim-eat  { animation: chomp .4s steps(2) 3; }
.pet.anim-peek { opacity: .5; }
.pet.anim-sleep { animation: snooze 1.6s ease-in-out infinite; }
.speech {
  position: absolute; top: 8px; max-width: 80%; background: #fff;
  border: 2px solid #3b2f2f; border-radius: 12px; padding: 8px 12px; font-size: 14px;
}
.speech[hidden] { display: none; }
@keyframes bob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-10px) } }
@keyframes wiggle { 0%,100% { transform: rotate(-4deg) } 50% { transform: rotate(4deg) } }
@keyframes chomp { 0%,100% { transform: scale(1) } 50% { transform: scale(.9) } }
@keyframes snooze { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.96); opacity: 0.75; } }
.room {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px;
  background: #cd8c5c; padding: 6px; border-radius: 10px;
}
.room.theme-space   { background: #2a2350; }
.room.theme-beach   { background: #e8d6a0; }
.room.theme-bedroom { background: #b98cc0; }
.cell {
  aspect-ratio: 1; padding: 0; border-radius: 4px; border: 1px solid rgba(0,0,0,.15);
  background: rgba(255,255,255,.35); display: grid; place-items: center; font-size: 12px;
}
.deco { font-weight: 700; }
.cards { display: flex; flex-wrap: wrap; gap: 8px; }
.card { text-align: left; }
.preview { width: 140px; height: 140px; border-radius: 24px; margin: 12px 0; }
.bigcode { font-size: 2rem; letter-spacing: .1em; font-weight: 800; }
.err { color: #b00020; }
.hud { display: flex; justify-content: space-between; align-items: center; font-size: 1.3rem; font-weight: 800; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
#panel { min-height: 80px; display: flex; flex-wrap: wrap; gap: 8px; }
