:root {
  --ink: #4a3427;
  --muted: #8f7b67;
  --cream: #fffaf1;
  --panel: rgba(255, 252, 244, 0.94);
  --line: rgba(126, 95, 60, 0.18);
  --green: #98bf55;
  --green-deep: #5f8f2d;
  --sky: #9edcf4;
  --coral: #f16f66;
  --blue: #72b6d4;
  --lavender: #9b95d8;
  --gold: #f6bd43;
  --shadow: 0 16px 34px rgba(88, 67, 45, 0.18);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { overflow-x: hidden; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", "Meiryo", system-ui, sans-serif;
  background: #f8f0e2;
}

button {
  border: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.app {
  width: 100%;
  min-height: 100vh;
  display: grid;
  grid-template-rows: 72px 1fr;
  background: linear-gradient(#fff9ef, #f5ead8);
}

.topbar {
  z-index: 5;
  display: grid;
  grid-template-columns: 220px auto 150px minmax(320px, 1fr) auto;
  align-items: center;
  gap: 18px;
  height: 72px;
  padding: 0 18px;
  background: rgba(255, 251, 243, 0.96);
  border-bottom: 1px solid rgba(118, 89, 56, 0.14);
  box-shadow: 0 5px 18px rgba(88, 67, 45, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 31px;
  font-weight: 900;
  letter-spacing: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border: 4px solid #503a2c;
  border-radius: 14px 14px 17px 17px;
  position: relative;
  background: #fffdf8;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  top: 13px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #503a2c;
}

.brand-mark::before { left: 10px; }
.brand-mark::after { right: 10px; }

.beta-ribbon {
  justify-self: start;
  padding: 8px 12px;
  border: 1px solid rgba(241, 111, 102, 0.26);
  border-radius: 999px;
  background: rgba(255, 238, 219, 0.92);
  color: #b65331;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.tabs {
  display: flex;
}

.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 48px;
  min-width: 150px;
  border-radius: 8px;
  background: #f1eadf;
  font-size: 20px;
  font-weight: 900;
  box-shadow: inset 0 -2px 0 rgba(104, 81, 55, 0.08);
}

.wallet {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.wallet-item {
  min-width: 150px;
  height: 46px;
  padding: 0 10px 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.9);
  box-shadow: inset 0 -2px 0 rgba(104, 81, 55, 0.05);
  font-size: 23px;
  font-weight: 900;
}

.wallet-item > span { font-size: 27px; line-height: 1; }
.wallet-item.heart > span { color: #f66e68; }
.wallet-item.coin > span { color: var(--gold); }
.wallet-item.gem > span { color: #69bff5; }
.wallet-item button {
  background: transparent;
  font-size: 25px;
  font-weight: 900;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-pill {
  min-height: 50px;
  max-width: 330px;
  padding: 6px 8px 6px 11px;
  display: grid;
  grid-template-columns: 12px minmax(92px, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(126, 95, 60, 0.18);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: inset 0 -2px 0 rgba(104, 81, 55, 0.05);
}

.account-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d8cfc4;
}

.account-pill[data-auth="user"] .account-dot { background: #73bf74; }

.account-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.account-copy small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.account-copy strong {
  overflow: hidden;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-pill a {
  min-width: 54px;
  padding: 7px 8px;
  border-radius: 9px;
  background: #f3eadf;
  color: #6e4e32;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-decoration: none;
}

.account-pill[data-auth="user"] #loginLink,
.account-pill[data-auth="user"] #registerLink {
  display: none;
}

.round-btn {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  background: #f8efe5;
  font-size: 24px;
  box-shadow: inset 0 -2px 0 rgba(104, 81, 55, 0.08);
}

.shop-btn {
  height: 72px;
  min-width: 140px;
  margin-right: -18px;
  padding: 0 24px;
  background: linear-gradient(#ff7c72, #f86d63);
  color: white;
  font-size: 23px;
  font-weight: 900;
}

.shell {
  display: grid;
  grid-template-columns: minmax(720px, 1fr) 376px;
  align-items: stretch;
  min-height: 0;
}

.room {
  position: relative;
  overflow: hidden;
  height: calc(100vh - 72px);
  min-height: 760px;
  --stage-bg: url("assets/room-background.png");
  background-image:
    linear-gradient(to bottom, rgba(255, 248, 235, 0.02), rgba(82, 55, 24, 0.12)),
    var(--stage-bg);
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
}

.room::before {
  content: none;
}

.room::after {
  content: none;
}

.room-select {
  position: absolute;
  z-index: 4;
  left: 16px;
  top: 20px;
  height: 56px;
  min-width: 275px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 13px;
  padding: 0 18px;
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.95);
  box-shadow: 0 9px 20px rgba(87, 61, 36, 0.15);
  font-size: 20px;
  font-weight: 900;
}

.room-select small {
  margin-left: auto;
  color: #8a765f;
  font-size: 14px;
  font-weight: 800;
}

.app[data-habitat="garden"] .room-select,
.app[data-habitat="walk"] .room-select {
  background: rgba(255, 253, 248, 0.9);
}

.app[data-habitat="garden"] .room-bed,
.app[data-habitat="garden"] .bowl,
.app[data-habitat="walk"] .room-bed,
.app[data-habitat="walk"] .bowl {
  display: none;
}

.round-window {
  position: absolute;
  left: 45%;
  top: 5%;
  width: 330px;
  height: 330px;
  transform: translateX(-50%);
  border: 16px solid #b88854;
  border-radius: 50%;
  background: linear-gradient(#a6def5 0 58%, #8fc979 59% 100%);
  box-shadow: inset 0 0 0 5px rgba(255,255,255,.4), 0 12px 18px rgba(100, 70, 37, 0.18);
  overflow: hidden;
}

.wall-decor,
.round-window,
.door,
.kennel,
.plant,
.plant-left,
.shelf-scene,
.floor-lines {
  display: none;
}

.round-window::before,
.round-window::after {
  content: "";
  position: absolute;
  background: rgba(255,255,255,.92);
  border-radius: 999px;
}

.round-window::before {
  left: 36px;
  top: 65px;
  width: 118px;
  height: 45px;
  box-shadow: 42px -8px 0 -5px rgba(255,255,255,.9);
}

.round-window::after {
  right: 46px;
  top: 88px;
  width: 84px;
  height: 32px;
}

.window-cross {
  position: absolute;
  z-index: 2;
  background: #b88854;
  opacity: .92;
}

.window-cross.x { left: 50%; top: 0; width: 12px; height: 100%; transform: translateX(-50%); }
.window-cross.y { left: 0; top: 50%; width: 100%; height: 12px; transform: translateY(-50%); }

.hill {
  position: absolute;
  bottom: 62px;
  width: 160px;
  height: 56px;
  border-radius: 50%;
  background: rgba(72, 150, 82, 0.45);
}

.hill-a { left: 20px; }
.hill-b { right: 12px; bottom: 56px; }

.door {
  position: absolute;
  left: 0;
  top: 0;
  width: 145px;
  height: 520px;
  background:
    radial-gradient(circle at 78% 45%, #c99b4a 0 9px, #80532a 10px 14px, transparent 15px),
    repeating-linear-gradient(90deg, rgba(23, 80, 98, 0.2) 0 2px, transparent 2px 38px),
    linear-gradient(#87b7c8, #6a9cad);
  border-right: 9px solid rgba(98, 71, 43, 0.16);
  box-shadow: inset -16px 0 25px rgba(54, 62, 56, 0.15);
}

.kennel {
  position: absolute;
  left: 205px;
  top: 330px;
  width: 208px;
  height: 160px;
  border-radius: 82px 82px 14px 14px;
  background: linear-gradient(#bd8c55, #906239);
  box-shadow: 0 11px 16px rgba(87, 61, 36, 0.2);
}

.kennel-hole {
  position: absolute;
  left: 43px;
  bottom: 17px;
  width: 122px;
  height: 94px;
  border-radius: 60px 60px 10px 10px;
  background: #4a3525;
}

.kennel-cushion {
  position: absolute;
  left: 55px;
  bottom: 20px;
  width: 100px;
  height: 33px;
  border-radius: 50%;
  background: #609a7b;
}

.plant-left {
  position: absolute;
  left: 70px;
  bottom: 238px;
  width: 68px;
  height: 72px;
  border-radius: 0 0 12px 12px;
  background: #d1a357;
}

.plant-left::before {
  content: "";
  position: absolute;
  left: -22px;
  right: -22px;
  top: -52px;
  height: 72px;
  background:
    radial-gradient(ellipse at 20% 70%, #83b75e 0 18%, transparent 19%),
    radial-gradient(ellipse at 42% 32%, #6eaa57 0 20%, transparent 21%),
    radial-gradient(ellipse at 68% 62%, #79b75e 0 19%, transparent 20%);
}

.shelf-scene {
  position: absolute;
  right: 115px;
  top: 270px;
  width: 140px;
  height: 14px;
  border-radius: 99px;
  background: #a87543;
  box-shadow: 0 8px 10px rgba(90, 60, 30, 0.16);
}

.tiny-pot {
  position: absolute;
  left: 24px;
  bottom: 14px;
  width: 34px;
  height: 30px;
  border-radius: 0 0 8px 8px;
  background: #c7924f;
}

.tiny-pot::before,
.tiny-pot.second::before {
  content: "";
  position: absolute;
  left: -15px;
  top: -38px;
  width: 62px;
  height: 45px;
  background:
    radial-gradient(ellipse at 26% 58%, #74aa52 0 18%, transparent 19%),
    radial-gradient(ellipse at 54% 22%, #8abf5e 0 18%, transparent 19%),
    radial-gradient(ellipse at 77% 65%, #6fa851 0 18%, transparent 19%);
}

.tiny-pot.second {
  left: 80px;
  transform: scale(.8);
}

.vine {
  position: absolute;
  top: -5px;
  width: 92px;
  height: 230px;
  background:
    radial-gradient(ellipse at 35% 10%, #80a94e 0 11%, transparent 12%),
    radial-gradient(ellipse at 62% 23%, #6c9c45 0 10%, transparent 11%),
    radial-gradient(ellipse at 40% 38%, #7faf52 0 11%, transparent 12%),
    radial-gradient(ellipse at 65% 54%, #6d9944 0 10%, transparent 11%),
    radial-gradient(ellipse at 37% 70%, #88b45a 0 11%, transparent 12%);
  opacity: .92;
}

.vine-left { left: 165px; }
.vine-right { right: 38px; height: 300px; }

.room-bed {
  position: absolute;
  right: 55px;
  top: 405px;
  width: 360px;
  height: 115px;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  opacity: 0;
}

.room-bed::before {
  content: none;
}

.room-bed::after {
  content: none;
}

.floor-lines {
  position: absolute;
  inset: 69% 0 0;
  background: linear-gradient(105deg, transparent 0 48%, rgba(255,255,255,.3) 49% 51%, transparent 52%);
}

.rug {
  position: absolute;
  z-index: 1;
  left: 24%;
  bottom: 190px;
  width: 295px;
  height: 86px;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
}

.toy,
.bowl {
  position: absolute;
  z-index: 3;
}

.ball {
  left: 58%;
  bottom: 285px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  opacity: 0;
}

.bowl {
  left: 195px;
  bottom: 272px;
  width: 148px;
  height: 58px;
  border-radius: 0 0 56px 56px;
  background: transparent;
  box-shadow: none;
  opacity: 0;
}

.bowl::before {
  content: none;
}

.pet-wrap {
  position: absolute;
  z-index: 3;
  left: 46%;
  bottom: 292px;
  width: 340px;
  height: 310px;
  transform: translateX(-50%);
  transform-origin: center bottom;
  transition:
    left 2.35s cubic-bezier(.16,.84,.2,1),
    bottom 2.35s cubic-bezier(.16,.84,.2,1),
    transform 1.25s ease;
}

.pet {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 0;
  background: url("assets/mofumaro.png") center bottom / contain no-repeat;
  box-shadow: none;
  filter:
    drop-shadow(0 18px 16px rgba(89, 65, 40, var(--pet-depth-shadow, .22)))
    drop-shadow(0 4px 4px rgba(255, 255, 255, .24))
    sepia(var(--pet-sepia, 0))
    brightness(var(--pet-brightness, 1))
    saturate(var(--pet-saturation, 1));
  transform-origin: center bottom;
  animation: breathe 5.2s ease-in-out infinite;
}

.pet::before,
.pet::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.pet::before {
  left: 23%;
  top: 31%;
  width: 58%;
  height: 45%;
  border-radius: 50%;
  opacity: var(--spot-mark-opacity, 0);
  background:
    radial-gradient(circle at 22% 32%, rgba(122, 103, 146, .42) 0 5%, transparent 6%),
    radial-gradient(circle at 74% 38%, rgba(122, 103, 146, .34) 0 4%, transparent 5%),
    radial-gradient(circle at 48% 72%, rgba(122, 103, 146, .28) 0 4%, transparent 5%);
  mix-blend-mode: multiply;
}

.pet::after {
  content: "♥";
  left: 48%;
  top: 46%;
  transform: translateX(-50%) rotate(-8deg);
  opacity: var(--heart-mark-opacity, 0);
  color: #f28a9e;
  font-size: 52px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 4px 12px rgba(255, 255, 255, .62);
  mix-blend-mode: multiply;
}

.pet > span {
  display: none;
}

.micro-face {
  position: absolute;
  z-index: 4;
  left: 38%;
  top: 34%;
  width: 24%;
  height: 18%;
  pointer-events: none;
  opacity: .72;
  transform:
    translate(var(--gaze-x, 0px), var(--gaze-y, 0px))
    rotate(calc(var(--pet-focus-tilt, 0deg) * .45));
  transition: transform .9s cubic-bezier(.18,.82,.25,1), opacity .45s ease;
  display: none;
}

.micro-eye {
  position: absolute;
  top: 31%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .88);
  box-shadow:
    0 0 4px rgba(255, 255, 255, .75),
    0 2px 4px rgba(56, 39, 24, .08);
  opacity: .55;
  animation: microGlint var(--blink-duration, 4.2s) ease-in-out infinite;
  transition: height .35s ease, width .35s ease, transform .45s ease, opacity .35s ease;
}

.micro-eye-left { left: 28%; }
.micro-eye-right { right: 28%; }

.micro-mouth {
  position: absolute;
  left: 50%;
  top: 64%;
  width: 24px;
  height: 10px;
  border-bottom: 3px solid rgba(74, 52, 39, .68);
  border-radius: 0 0 999px 999px;
  transform: translateX(-50%);
  transition: width .35s ease, height .35s ease, border-radius .35s ease, border-color .35s ease, transform .35s ease;
  display: none;
}

.micro-tear {
  display: none;
  position: absolute;
  top: 49%;
  width: 5px;
  height: 9px;
  border-radius: 65% 65% 75% 75%;
  background: rgba(112, 190, 218, .58);
  filter: blur(.15px);
}

.micro-tear-left { left: 23%; transform: translateY(-3px) rotate(12deg); }
.micro-tear-right { right: 23%; transform: translateY(-2px) rotate(-12deg); }

.app[data-micro-expression="soft"] .micro-mouth {
  display: block;
  width: 22px;
  height: 12px;
}

.app[data-micro-expression="sparkle"] .micro-eye {
  width: 7px;
  height: 7px;
  opacity: .88;
  box-shadow:
    0 0 0 3px rgba(255, 247, 203, .22),
    0 5px 12px rgba(246, 189, 67, .2);
}

.app[data-micro-expression="focused"] .micro-eye {
  opacity: .72;
  transform: translateY(1px) scaleX(1.08);
}

.app[data-micro-expression="scan"] .micro-face {
  animation: gazeScan 5.8s ease-in-out infinite;
}

.app[data-micro-expression="sideEye"] .micro-eye {
  opacity: .42;
  transform: translateX(4px) translateY(1px) scaleX(1.18);
}

.app[data-micro-expression="sideEye"] .micro-mouth {
  display: block;
  width: 18px;
  height: 8px;
  border-radius: 999px 999px 0 0;
  border-bottom: 0;
  border-top: 3px solid rgba(74, 52, 39, .58);
  transform: translateX(-50%) translateY(3px);
}

.app[data-micro-expression="teary"] .micro-eye {
  opacity: .28;
  transform: translateY(2px) scaleX(.9);
}

.app[data-micro-expression="teary"] .micro-mouth {
  display: block;
  width: 15px;
  border-radius: 999px 999px 0 0;
  border-bottom: 0;
  border-top: 3px solid rgba(74, 52, 39, .58);
}

.app[data-micro-expression="teary"] .micro-tear {
  display: block;
  opacity: .32;
}

.app[data-micro-expression="sleepy"] .micro-eye {
  opacity: 0;
  transform: translateY(3px) scaleX(1.1);
}

.app[data-micro-expression="sleepy"] .micro-mouth {
  display: none;
}

.app[data-micro-expression="drowsyFight"] .micro-mouth {
  display: none;
}

.app[data-micro-expression="angry"] .micro-eye,
.app[data-micro-expression="annoyed"] .micro-eye {
  width: 8px;
  height: 3px;
  opacity: .62;
  border-radius: 999px;
  background: rgba(73, 48, 34, .62);
  box-shadow: none;
}

.app[data-micro-expression="angry"] .micro-eye-left,
.app[data-micro-expression="annoyed"] .micro-eye-left {
  transform: translateY(1px) rotate(12deg);
}

.app[data-micro-expression="angry"] .micro-eye-right,
.app[data-micro-expression="annoyed"] .micro-eye-right {
  transform: translateY(1px) rotate(-12deg);
}

.app[data-micro-expression="angry"] .micro-mouth,
.app[data-micro-expression="annoyed"] .micro-mouth,
.app[data-micro-expression="flat"] .micro-mouth {
  display: block;
  width: 18px;
  height: 8px;
  border-bottom: 0;
  border-top: 3px solid rgba(74, 52, 39, .62);
  border-radius: 999px 999px 0 0;
  transform: translateX(-50%) translateY(3px);
}

.app[data-micro-expression="expectant"] .micro-eye,
.app[data-micro-expression="question"] .micro-eye {
  width: 7px;
  height: 7px;
  opacity: .76;
}

.app[data-micro-expression="expectant"] .micro-mouth,
.app[data-micro-expression="content"] .micro-mouth,
.app[data-micro-expression="happySquint"] .micro-mouth,
.app[data-micro-expression="proud"] .micro-mouth {
  display: block;
  width: 26px;
  height: 12px;
}

.app[data-micro-expression="happySquint"] .micro-eye {
  height: 3px;
  width: 9px;
  border-radius: 999px;
  opacity: .58;
}

.app[data-micro-expression="shy"] .micro-face {
  opacity: .5;
  transform:
    translate(calc(var(--gaze-x, 0px) - 5px), var(--gaze-y, 0px))
    rotate(calc(var(--pet-focus-tilt, 0deg) * .45 - .5deg));
}

.app[data-micro-expression="shy"] .micro-mouth {
  display: block;
  width: 12px;
  height: 7px;
  border-color: rgba(74, 52, 39, .42);
}

.app[data-micro-expression="startled"] .micro-eye {
  width: 8px;
  height: 8px;
  opacity: .84;
  animation: none;
}

.app[data-micro-expression="startled"] .micro-mouth {
  display: block;
  width: 10px;
  height: 10px;
  border: 2px solid rgba(74, 52, 39, .46);
  border-radius: 50%;
  transform: translateX(-50%) translateY(0);
}

.app[data-micro-expression="drowsyFight"] .micro-eye {
  width: 9px;
  height: 3px;
  opacity: .4;
  animation-duration: 2.2s;
}

.app[data-micro-expression="faraway"] .micro-face {
  opacity: .54;
  animation: gazeScan 8s ease-in-out infinite;
}

.app[data-micro-expression="flat"] .micro-eye {
  width: 9px;
  height: 3px;
  opacity: .38;
  border-radius: 999px;
  animation: none;
}

.app[data-life-phase="considering"] .micro-face {
  animation: tinyHesitation 1.4s ease-in-out infinite;
}

.app[data-expression="happy"] .pet {
  background-image: url("assets/mofumaro-happy.png");
}

.app[data-expression="sleep"] .pet {
  background-image: url("assets/mofumaro-sleep.png");
}

.app[data-expression="play"] .pet {
  background-image: url("assets/mofumaro-play.png");
}

.app[data-expression="curious"] .pet {
  background-image: url("assets/mofumaro-curious.png");
}

.app[data-expression="sad"] .pet {
  background-image: url("assets/mofumaro-sad.png");
}

.app[data-expression="grumpy"] .pet {
  background-image: url("assets/mofumaro-grumpy.png");
}

.app[data-action-cue="gobbleFood"] .pet,
.app[data-action-cue="savorFood"] .pet,
.app[data-action-cue="nibbleFood"] .pet {
  background-image: url("assets/actions/mofumaro-action-eat-bowl.png");
}

.app[data-action-cue="plateWait"] .pet {
  background-image: url("assets/actions/mofumaro-action-plate-wait.png");
}

.app[data-action-cue="approach"] .pet,
.app[data-action-cue="purrMelt"] .pet,
.app[data-action-cue="cheekRub"] .pet,
.app[data-action-cue="bellyRelax"] .pet,
.app[data-action-cue="attentionBeg"] .pet {
  background-image: url("assets/mofumaro-happy.png");
  background-position: center bottom;
  background-size: contain;
}

.app[data-action-cue="ownerApproach"] .pet {
  background-image: url("assets/actions/mofumaro-action-owner-approach.png");
}

.app[data-action-cue="chaseBall"] .pet,
.app[data-action-cue="followGame"] .pet,
.app[data-action-cue="zoomies"] .pet {
  background-image: url("assets/actions/mofumaro-action-chase-ball.png");
}

.app[data-action-cue="sleepyBallLook"] .pet {
  background-image: url("assets/actions/mofumaro-action-sleepy-ball-look.png");
}

.app[data-action-cue="sulk"] .pet,
.app[data-action-cue="refuseLook"] .pet,
.app[data-action-cue="loseInterest"] .pet,
.app[data-action-cue="changeMindSleep"] .pet {
  background-image: url("assets/actions/mofumaro-action-sulk.png");
}

.app[data-action-cue="turnAwayGrumpy"] .pet {
  background-image: url("assets/actions/mofumaro-action-turn-away-grumpy.png");
}

.app[data-action-cue="grumpyPet"] .pet,
.app[data-action-cue="resistBedtime"] .pet,
.app[data-action-cue="refusePlay"] .pet {
  background-image: url("assets/actions/mofumaro-action-grumpy-refuse.png");
}

.app[data-action-cue="groom"] .pet {
  background-image: url("assets/actions/mofumaro-action-groom.png");
}

.app[data-action-cue="startle"] .pet {
  background-image: url("assets/actions/mofumaro-action-startle.png");
}

.app[data-action-cue="dozeOff"] .pet,
.app[data-action-cue="autoNap"] .pet {
  background-image: url("assets/actions/mofumaro-action-doze-off.png");
}

.app[data-action-cue="bigJoyJump"] .pet {
  background-image: url("assets/actions/mofumaro-action-big-joy-jump.png");
}

.app[data-action-cue="happyBounce"] .pet {
  background-image: url("assets/actions/mofumaro-action-happy-bounce.png");
}

.app[data-action-cue="starTwirl"] .pet {
  background-image: url("assets/actions/mofumaro-action-star-twirl.png");
}

.app[data-action-cue="grassPounce"] .pet {
  background-image: url("assets/actions/mofumaro-action-grass-pounce.png");
}

.app[data-action-cue="proudHop"] .pet {
  background-image: url("assets/actions/mofumaro-action-proud-hop.png");
}

.app[data-action-cue="settleAfterCare"] .pet {
  background-image: url("assets/actions/mofumaro-action-settle-after-care.png");
}

.pet-shadow {
  position: absolute;
  left: 42px;
  right: 42px;
  bottom: 0;
  height: 34px;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at center, rgba(84, 69, 48, var(--pet-shadow-strength, 0.18)) 0 38%, rgba(84, 69, 48, .08) 58%, transparent 72%);
  filter: blur(2px);
  transform: scaleX(1.05);
}

.ear {
  position: absolute;
  top: 13px;
  width: 54px;
  height: 58px;
  border-radius: 70% 42% 60% 40%;
  background: #fff9e8;
  z-index: -1;
}

.ear-left { left: 14px; transform: rotate(-20deg); }
.ear-right { right: 14px; transform: rotate(20deg) scaleX(-1); }

.fur {
  position: absolute;
  border-radius: 50%;
  background: #fffdf2;
}

.puff-a { width: 55px; height: 50px; left: 42px; top: -12px; }
.puff-b { width: 64px; height: 55px; left: 82px; top: -24px; }
.puff-c { width: 52px; height: 48px; right: 35px; top: -10px; }
.puff-d { width: 43px; height: 40px; left: 24px; top: 18px; }

.eye {
  position: absolute;
  top: 80px;
  width: 14px;
  height: 20px;
  border-radius: 50%;
  background: #2d2722;
  transition: height .25s ease, transform .25s ease;
}

.eye-left { left: 78px; }
.eye-right { right: 78px; }

.nose {
  position: absolute;
  left: 50%;
  top: 105px;
  width: 5px;
  height: 4px;
  border-radius: 50%;
  background: #4a3427;
  transform: translateX(-50%);
}

.blush {
  position: absolute;
  top: 118px;
  width: 27px;
  height: 10px;
  border-radius: 50%;
  background: rgba(241, 111, 102, 0.22);
}

.blush-left { left: 55px; }
.blush-right { right: 55px; }

.tail {
  position: absolute;
  right: -36px;
  top: 86px;
  width: 62px;
  height: 45px;
  border-radius: 50%;
  background: #fffdf2;
  transform-origin: 8px 22px;
  animation: tail 2.4s ease-in-out infinite;
}

.paw {
  position: absolute;
  bottom: 3px;
  width: 38px;
  height: 24px;
  border-radius: 50%;
  background: #efe9d7;
}

.paw-left { left: 64px; }
.paw-right { right: 64px; }

.signal {
  position: absolute;
  left: 50%;
  top: -18px;
  width: 54px;
  height: 38px;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
}

.signal.show {
  opacity: 1;
  animation: pop .8s ease forwards;
}

.signal::before,
.signal::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  background: var(--coral);
  transform: rotate(45deg);
  border-radius: 5px 5px 0 5px;
}

.signal::before { left: 4px; top: 12px; }
.signal::after { right: 5px; top: 2px; transform: rotate(45deg) scale(.75); opacity: .75; }

.mote {
  position: absolute;
  z-index: 4;
  width: 20px;
  height: 20px;
  opacity: 0;
  pointer-events: none;
}

.mote::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: #f46f65;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.55);
}

.mote-a { left: 18%; top: 28%; }
.mote-b { right: 18%; top: 35%; }
.mote-c { left: 48%; top: 8%; }

.app[data-effect="hearts"] .mote::before {
  border-radius: 5px 5px 0 5px;
  transform: rotate(45deg);
  background: #f46f65;
}

.app[data-effect="spark"] .mote::before {
  border-radius: 2px;
  background: #f6bd43;
  transform: rotate(45deg);
}

.app[data-effect="zzz"] .mote::before {
  content: "Z";
  inset: auto;
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #72b6d4;
  font-size: 24px;
  font-weight: 900;
  transform: none;
}

.app[data-effect="tears"] .mote::before {
  inset: 1px 5px 3px;
  border-radius: 60% 60% 70% 70%;
  background: linear-gradient(#b7e9ff, #65badf);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.55);
  transform: rotate(12deg);
}

.app[data-effect="tears"] .mote {
  display: none;
}

.app[data-effect="startle"] .pet {
  animation: startle .18s linear 5;
}

.app[data-effect="hearts"] .mote,
.app[data-effect="spark"] .mote,
.app[data-effect="zzz"] .mote,
.app[data-effect="tears"] .mote {
  animation: floatMote 1.8s ease-out forwards;
}

.app[data-effect="hearts"] .mote-b,
.app[data-effect="spark"] .mote-b,
.app[data-effect="zzz"] .mote-b,
.app[data-effect="tears"] .mote-b { animation-delay: .18s; }

.app[data-effect="hearts"] .mote-c,
.app[data-effect="spark"] .mote-c,
.app[data-effect="zzz"] .mote-c,
.app[data-effect="tears"] .mote-c { animation-delay: .34s; }

.app[data-mood="sleepy"] .eye { height: 3px; transform: translateY(9px); }
.app[data-mood="sleepy"] .pet { animation-duration: 6.8s; }
.app[data-mood="sleepyBall"] .pet { animation: sleepyBallLook 4.8s ease-in-out infinite; }
.app[data-mood="play"] .pet { animation: hop 1.25s ease-in-out infinite alternate; }
.app[data-mood="happy"] .pet { animation: cuddle 1.7s ease-in-out infinite alternate; }
.app[data-mood="shy"] .tail { animation-duration: 3.6s; }
.app[data-mood="shy"] .pet { animation: shyHesitate 4.2s ease-in-out infinite; }
.app[data-mood="approach"] .pet { animation: approachBreath 3.4s ease-in-out infinite; }
.app[data-mood="ownerApproach"] .pet { animation: ownerApproach 3.8s ease-in-out infinite; }
.app[data-mood="curious"] .pet { animation: curiousTilt 3.8s ease-in-out infinite; }
.app[data-mood="sad"] .pet { animation: sadPulse 4.8s ease-in-out infinite; }
.app[data-mood="grumpy"] .pet { animation: grumpySway 4.2s ease-in-out infinite; }
.app[data-mood="turnAway"] .pet { animation: turnAwayHold 4.8s ease-in-out infinite; }
.app[data-mood="eat"] .pet { animation: munchBounce 1.7s ease-in-out infinite; }
.app[data-mood="plateWait"] .pet { animation: plateWait 4.4s ease-in-out infinite; }
.app[data-mood="stuffed"] .pet { animation: stuffedSettle 4.4s ease-in-out infinite; }
.app[data-mood="melt"] .pet { animation: meltRelax 3.6s ease-in-out infinite; }
.app[data-mood="chase"] .pet { animation: chaseDash 1.6s ease-in-out infinite; }
.app[data-mood="toy"] .pet { animation: toyWrestle 2.2s ease-in-out infinite; }
.app[data-mood="tucked"] .pet { animation: tuckedSleep 6.4s ease-in-out infinite; }
.app[data-mood="angry"] .pet,
.app[data-mood="impatient"] .pet { animation: angryPuff 2.8s ease-in-out infinite; }
.app[data-mood="inspect"] .pet,
.app[data-mood="listen"] .pet { animation: inspectLean 3.6s ease-in-out infinite; }
.app[data-mood="wander"] .pet,
.app[data-mood="patrol"] .pet { animation: slowStep 5.8s ease-in-out infinite; }
.app[data-mood="window"] .pet { animation: windowGaze 7.2s ease-in-out infinite; }
.app[data-mood="stretch"] .pet { animation: stretchBody 3.8s ease-in-out infinite; }
.app[data-mood="groom"] .pet,
.app[data-mood="pillow"] .pet { animation: selfCareRock 3.4s ease-in-out infinite; }
.app[data-mood="startled"] .pet { animation: startle .18s linear 5; }
.app[data-mood="beg"] .pet { animation: begBounce 2.6s ease-in-out infinite; }
.app[data-mood="settleAfterCare"] .pet { animation: settleAfterCare 4.6s ease-in-out infinite; }
.app[data-mood="bored"] .pet { animation: boredSink 5.8s ease-in-out infinite; }
.app[data-mood="guard"] .pet { animation: guardHold 4.2s ease-in-out infinite; }
.app[data-mood="proud"] .pet { animation: proudLift 3.4s ease-in-out infinite; }
.app[data-mood="spin"] .pet { animation: happySpin 1.9s ease-in-out infinite; }
.app[data-mood="joyJump"] .pet { animation: bigJoyJump 1.28s cubic-bezier(.18,.88,.2,1) infinite; }
.app[data-mood="bounce"] .pet { animation: happyBounce 1.05s ease-in-out infinite; }
.app[data-mood="twirl"] .pet { animation: starTwirl 1.55s ease-in-out infinite; }
.app[data-mood="pounce"] .pet { animation: grassPounce 1.3s ease-in-out infinite; }
.app[data-action-cue="lookUp"] .pet { animation: lookUpBreath 2.6s ease-in-out infinite; }
.app[data-action-cue="pawBall"] .pet,
.app[data-action-cue="nudgeBall"] .pet { animation: pawReach 1.8s ease-in-out infinite; }
.app[data-action-cue="yawnFight"] .pet { animation: sleepyBob 3.2s ease-in-out infinite; }
.app[data-action-cue="tinyCry"] .pet { animation: tinyCryShake 3.2s ease-in-out infinite; }

.app[data-gait-style="bouncy"][data-mood="calm"] .pet { animation: hop 2.4s ease-in-out infinite alternate; }
.app[data-gait-style="careful"][data-mood="calm"] .pet { animation: grumpySway 5.8s ease-in-out infinite; }
.app[data-gait-style="slow"][data-mood="calm"] .pet { animation-duration: 7.2s; }
.app[data-gait-style="clingy"][data-mood="calm"] .pet { animation: approachBreath 4.4s ease-in-out infinite; }

.dock {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: 82px;
  transform: translateX(-50%);
  width: min(835px, calc(100% - 420px));
  min-width: 560px;
  height: 166px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  overflow: hidden;
  border: 1px solid rgba(126, 95, 60, 0.22);
  border-radius: 8px;
  background: rgba(255, 252, 244, 0.94);
  box-shadow: 0 16px 35px rgba(75, 52, 30, 0.2);
}

.care-btn {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 9px;
  background: transparent;
  border-right: 1px solid rgba(126, 95, 60, 0.18);
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 0;
  transition: background .18s ease, transform .18s ease;
}

.care-btn:last-child { border-right: 0; }
.care-btn:hover {
  background: rgba(255, 244, 226, 0.72);
  transform: translateY(-2px);
}

.icon {
  width: 70px;
  height: 58px;
  position: relative;
  display: block;
}

.icon.food::before {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 0;
  height: 38px;
  border-radius: 0 0 32px 32px;
  background: #e85e52;
  box-shadow: inset 0 -7px 0 rgba(119, 53, 38, 0.16);
}

.icon.food::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  top: 5px;
  height: 28px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 20% 42%, #7a4d29 0 6px, transparent 7px),
    radial-gradient(circle at 50% 35%, #9d6734 0 7px, transparent 8px),
    radial-gradient(circle at 73% 48%, #8d5b30 0 6px, transparent 7px),
    #c78643;
}

.icon.hand::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 12px;
  width: 45px;
  height: 28px;
  border-radius: 999px;
  background: #ffd2ad;
  transform: rotate(-20deg);
}

.icon.hand::after {
  content: "♥";
  position: absolute;
  right: 2px;
  top: 0;
  color: #f35f5a;
  font-size: 28px;
}

.icon.play::before {
  content: "";
  position: absolute;
  inset: 4px 10px;
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 0 43%, rgba(255,255,255,.9) 44% 55%, transparent 56%),
    linear-gradient(135deg, #99bf48 0 50%, #d9f0a4 51%);
  box-shadow: inset -5px -7px 0 rgba(75, 123, 37, 0.18);
}

.icon.sleep-icon::before {
  content: "";
  position: absolute;
  left: 3px;
  bottom: 2px;
  width: 64px;
  height: 32px;
  border-radius: 22px;
  background: #74b6db;
  box-shadow:
    18px -14px 0 -2px #8dc7e8,
    36px -5px 0 0 #6faad1;
}

.icon.sleep-icon::after {
  content: "";
  position: absolute;
  right: 2px;
  top: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  box-shadow: -8px 5px 0 0 #e3a633;
}

.room-nav {
  position: absolute;
  z-index: 7;
  left: 15px;
  bottom: 10px;
  width: min(815px, calc(100% - 450px));
  height: 55px;
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  overflow: hidden;
  border: 1px solid rgba(126, 95, 60, 0.24);
  border-radius: 8px;
  background: rgba(255, 252, 244, 0.76);
  box-shadow: 0 10px 24px rgba(75, 52, 30, 0.16);
}

.room-tab {
  background: transparent;
  border-right: 1px solid rgba(126, 95, 60, 0.15);
  color: #7f715f;
  font-size: 17px;
  font-weight: 900;
}

.room-tab:last-child { border-right: 0; }
.room-tab.is-active {
  color: #5c3a20;
  background: rgba(255,255,255,.8);
  box-shadow: inset 0 0 0 4px #f3c35c;
}

.side {
  z-index: 8;
  display: grid;
  grid-template-rows: auto auto auto auto auto 1fr;
  gap: 10px;
  padding: 18px 12px 14px;
  background: rgba(255, 248, 236, 0.93);
  border-left: 1px solid rgba(126, 95, 60, 0.16);
  box-shadow: -8px 0 22px rgba(75, 52, 30, 0.11);
}

.panel {
  border: 1px solid rgba(126, 95, 60, 0.14);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: inset 0 -2px 0 rgba(104, 81, 55, 0.04);
}

.profile {
  min-height: 158px;
  padding: 16px 14px;
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 15px;
  align-items: center;
}

.mini-portrait {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  border: 1px solid rgba(126, 95, 60, 0.16);
  background:
    url("assets/mofumaro.png") center 60% / 118% auto no-repeat,
    radial-gradient(circle, rgba(255, 250, 241, 0.95), rgba(231, 219, 196, 0.9)),
    #fffaf1;
  box-shadow: inset -10px -12px 0 rgba(176, 142, 95, 0.1);
}

.name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

h1, h2, p { margin: 0; }

h1 {
  font-size: 28px;
  line-height: 1.1;
  font-weight: 900;
  white-space: nowrap;
}

h2 {
  font-size: 22px;
  line-height: 1.15;
  font-weight: 900;
}

.profile p {
  margin-top: 9px;
  font-size: 19px;
  font-weight: 900;
}

.phase {
  color: var(--green-deep);
  font-size: 17px !important;
}

.edit-btn {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: #f3eadf;
  color: #8b643d;
  font-size: 20px;
}

.mood-card,
.stats,
.today,
.relationship {
  padding: 14px 16px;
}

.hearts {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.hearts span {
  width: 46px;
  height: 42px;
  position: relative;
}

.hearts span::before,
.hearts span::after {
  content: "";
  position: absolute;
  width: 26px;
  height: 38px;
  border-radius: 26px 26px 0 0;
  background: #f46c62;
}

.hearts span::before { left: 20px; transform: rotate(-45deg); transform-origin: 0 100%; }
.hearts span::after { left: 0; transform: rotate(45deg); transform-origin: 100% 100%; }
.hearts .empty::before,
.hearts .empty::after { background: #ddd7cf; }

.stat + .stat { margin-top: 14px; }
.stat.compact { margin-top: 11px; }

.stat-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 17px;
  font-weight: 900;
}

.meter {
  height: 18px;
  border-radius: 999px;
  background: #eee6dc;
  overflow: hidden;
}

.meter span {
  display: block;
  width: 50%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8cb94d, #a8c85c);
  transition: width .35s ease;
}

.food-meter span { background: linear-gradient(90deg, #8cb94d, #77c9d6); }
.meter.sleep span { background: linear-gradient(90deg, #9b95d8, #beb5ff); }

.today h2,
.relationship h2 {
  margin-bottom: 10px;
}

.today-summary {
  margin: -2px 0 10px;
  color: #7d6d5b;
  font-size: 13px;
  font-weight: 900;
}

.today-list {
  display: grid;
  gap: 8px;
}

.today-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 52px;
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(245, 250, 247, 0.92);
  border: 1px solid rgba(126, 95, 60, 0.08);
}

.today-item strong,
.today-item small {
  display: block;
}

.today-item strong {
  margin-bottom: 2px;
  font-size: 13px;
  color: #6f5d4d;
}

.today-item small {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
}

.moment-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--moment-color, #73bf74) 18%, #fffaf1);
  border: 1px solid color-mix(in srgb, var(--moment-color, #73bf74) 28%, transparent);
  position: relative;
}

.moment-icon::before {
  font-size: 22px;
  line-height: 1;
}

.moment-icon.is-bowl::before { content: "🥣"; }
.moment-icon.is-hand::before { content: "✋"; }
.moment-icon.is-ball::before { content: "🎾"; }
.moment-icon.is-moon::before { content: "🌙"; }
.moment-icon.is-pause::before { content: "…"; font-weight: 900; color: #6d8084; }
.moment-icon.is-heart::before { content: "♡"; font-weight: 900; color: #f16f66; }
.moment-icon.is-garden::before { content: "🌳"; }
.moment-icon.is-walk::before { content: "👣"; }
.moment-icon.is-leaf::before { content: "🌿"; }

.friend-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 14px;
  align-items: center;
}

.locked-pet {
  height: 96px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #f0eeeb;
  border: 1px dashed rgba(126, 95, 60, 0.24);
}

.locked-pet span {
  width: 62px;
  height: 58px;
  border-radius: 50%;
  background: radial-gradient(circle at 45% 32%, #efede8, #d4d1cb);
  opacity: .55;
}

.friend-row strong {
  display: block;
  margin-bottom: 13px;
  font-size: 18px;
  font-weight: 900;
}

.small-btn {
  min-width: 112px;
  height: 42px;
  border-radius: 8px;
  background: #f46f65;
  color: #fff;
  font-size: 17px;
  font-weight: 900;
}

.small-btn:disabled {
  background: #d9d3ca;
  color: #7c7166;
}

.companion-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.companion-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 54px;
  padding: 7px 9px;
  border-radius: 8px;
  background: #f8f5ee;
  border: 1px solid rgba(126, 95, 60, 0.13);
}

.companion-face {
  width: 42px;
  height: 38px;
  border-radius: 50% 50% 46% 46%;
  background:
    radial-gradient(circle at 36% 42%, #392d24 0 4%, transparent 5%),
    radial-gradient(circle at 64% 42%, #392d24 0 4%, transparent 5%),
    radial-gradient(circle at 50% 55%, #5b4433 0 3%, transparent 4%),
    radial-gradient(circle at 48% 48%, #fff8e8, #f3dfb8);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.45);
}

.companion-item strong {
  display: block;
  margin: 0 0 2px;
  font-size: 15px;
  line-height: 1.15;
}

.companion-item small {
  display: block;
  color: #786f63;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.25;
}

.companion-item.is-close { background: #f0faef; border-color: rgba(115, 191, 116, .28); }
.companion-item.is-owner { background: #fff2ef; border-color: rgba(244, 111, 101, .25); }
.companion-item.is-rival { background: #f2f4fa; border-color: rgba(122, 128, 164, .24); }
.companion-item.is-distant { background: #f4f2ef; }

.premium {
  min-height: 66px;
  padding: 10px 14px;
  display: grid;
  grid-template-columns: 48px 1fr 18px;
  align-items: center;
  gap: 10px;
  border-color: rgba(86, 168, 200, 0.35);
  background: #eefaff;
  color: #5c4a36;
  font-size: 17px;
}

.crown {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #fff1b8;
  color: #d89b22;
  font-size: 27px;
}

.log {
  min-height: 0;
  padding: 11px 13px;
}

.label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
}

.log ul {
  list-style: none;
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
}

.log li {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 31px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #f3f8f7;
  color: #5b534a;
  font-size: 14px;
  font-weight: 900;
}

.log .dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--green);
}

.naming-overlay {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(74, 52, 39, .32);
  backdrop-filter: blur(6px);
}

.naming-overlay[hidden] {
  display: none;
}

.naming-card {
  width: min(440px, 100%);
  display: grid;
  gap: 14px;
  padding: 26px;
  border: 1px solid rgba(126, 95, 60, .22);
  border-radius: 8px;
  background: rgba(255, 252, 244, .98);
  box-shadow: 0 22px 54px rgba(72, 50, 30, .24);
}

.naming-card h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.25;
}

.naming-card input {
  width: 100%;
  height: 54px;
  padding: 0 14px;
  border: 1px solid rgba(126, 95, 60, .24);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 22px;
  font-weight: 900;
}

.naming-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.naming-card button {
  height: 54px;
  border-radius: 8px;
  background: linear-gradient(#ff7c72, #f86d63);
  color: white;
  font-weight: 900;
  font-size: 18px;
}

.trial-gate {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(55, 42, 31, 0.48);
  backdrop-filter: blur(8px);
}

.trial-gate[hidden] {
  display: none !important;
}

.trial-card {
  width: min(560px, 100%);
  padding: 28px;
  border: 1px solid rgba(126, 95, 60, 0.22);
  border-radius: 10px;
  background: rgba(255, 252, 244, 0.98);
  box-shadow: 0 30px 90px rgba(47, 31, 18, 0.26);
  text-align: center;
}

.trial-pet {
  width: 148px;
  height: 120px;
  margin: 0 auto 12px;
  background: url("assets/mofumaro-sad.png") center / contain no-repeat;
  filter: drop-shadow(0 18px 18px rgba(90, 60, 36, 0.22));
}

.trial-card h2 {
  margin-top: 8px;
  font-size: 26px;
}

.trial-card p {
  margin: 14px auto 0;
  max-width: 460px;
  color: #6f5e4d;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.8;
}

.trial-actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.trial-actions button {
  min-height: 50px;
  border-radius: 10px;
  font-weight: 900;
}

#keepMofumaroBtn {
  background: linear-gradient(135deg, #ef7064, #f5b957);
  color: white;
}

#newMofumaroBtn {
  border: 1px solid rgba(126, 95, 60, 0.18);
  background: #f7efe4;
  color: #6f5135;
}

.trial-card small {
  display: block;
  margin-top: 12px;
  color: #8b7b68;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
}

@keyframes breathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(3px) scale(1.018, .985); }
}

@keyframes tail {
  0%, 100% { transform: rotate(-10deg); }
  50% { transform: rotate(14deg); }
}

@keyframes hop {
  from { transform: translateY(0) rotate(-2deg); }
  to { transform: translateY(-14px) rotate(2deg); }
}

@keyframes cuddle {
  from { transform: translateY(0) rotate(-1deg) scale(1); }
  to { transform: translateY(-5px) rotate(1deg) scale(1.025); }
}

@keyframes approachBreath {
  0%, 100% { transform: translateY(0) scale(1.01); }
  45% { transform: translateY(-4px) scale(1.035, .985); }
  70% { transform: translateY(1px) scale(1.015); }
}

@keyframes curiousTilt {
  0%, 100% { transform: translateY(0) rotate(calc(-1.2deg + var(--pet-focus-tilt, 0deg))); }
  45% { transform: translateY(-3px) rotate(calc(2deg + var(--pet-focus-tilt, 0deg))); }
  70% { transform: translateY(0) rotate(calc(.6deg + var(--pet-focus-tilt, 0deg))); }
}

@keyframes sadPulse {
  0%, 100% { transform: translateY(1px) scale(.995, 1.01); filter: saturate(.95); }
  55% { transform: translateY(5px) scale(.985, 1.018); filter: saturate(.88); }
}

@keyframes grumpySway {
  0%, 100% { transform: translateX(0) rotate(-1.4deg); }
  42% { transform: translateX(-3px) rotate(-2.4deg); }
  72% { transform: translateX(1px) rotate(-1deg); }
}

@keyframes munchBounce {
  0%, 100% { transform: translateY(1px) scale(1.01, .99); }
  28% { transform: translateY(4px) scale(1.035, .965); }
  56% { transform: translateY(0) scale(.995, 1.015); }
}

@keyframes stuffedSettle {
  0%, 100% { transform: translateY(3px) scale(1.01, .995); }
  50% { transform: translateY(7px) scale(1.035, .97); }
}

@keyframes meltRelax {
  0%, 100% { transform: translateY(2px) scale(1.02, .99) rotate(-.5deg); }
  50% { transform: translateY(8px) scale(1.055, .94) rotate(.4deg); }
}

@keyframes chaseDash {
  0%, 100% { transform: translateX(-5px) translateY(0) rotate(-2deg) scale(1.01); }
  45% { transform: translateX(7px) translateY(-8px) rotate(3deg) scale(1.035, .965); }
  75% { transform: translateX(2px) translateY(1px) rotate(.8deg) scale(1); }
}

@keyframes toyWrestle {
  0%, 100% { transform: translateX(0) translateY(0) rotate(-2deg) scale(1.01); }
  35% { transform: translateX(-4px) translateY(3px) rotate(-5deg) scale(1.035, .97); }
  70% { transform: translateX(5px) translateY(-4px) rotate(4deg) scale(1.02, .98); }
}

@keyframes tuckedSleep {
  0%, 100% { transform: translateY(2px) scale(1.01, .995); filter: saturate(.98); }
  50% { transform: translateY(5px) scale(1.025, .982); filter: saturate(.94); }
}

@keyframes shyHesitate {
  0%, 100% { transform: translateX(0) translateY(1px) rotate(-1deg) scale(.99); }
  36% { transform: translateX(-4px) translateY(0) rotate(-2deg) scale(.985, 1.01); }
  68% { transform: translateX(2px) translateY(-2px) rotate(.6deg) scale(1.005, .995); }
}

@keyframes angryPuff {
  0%, 100% { transform: translateX(0) translateY(0) scale(1.01, .99) rotate(-1deg); filter: saturate(.96); }
  32% { transform: translateX(-2px) translateY(-2px) scale(1.035, .965) rotate(-2deg); filter: saturate(.9); }
  58% { transform: translateX(2px) translateY(0) scale(1.015, .985) rotate(1deg); }
}

@keyframes inspectLean {
  0%, 100% { transform: translateY(0) rotate(calc(var(--pet-focus-tilt, 0deg) - .6deg)); }
  45% { transform: translateY(-2px) translateX(3px) rotate(calc(var(--pet-focus-tilt, 0deg) + 1.8deg)); }
}

@keyframes slowStep {
  0%, 100% { transform: translateX(-2px) translateY(0) rotate(-.8deg); }
  35% { transform: translateX(2px) translateY(-2px) rotate(.9deg); }
  70% { transform: translateX(0) translateY(1px) rotate(-.2deg); }
}

@keyframes windowGaze {
  0%, 100% { transform: translateY(0) rotate(-1.4deg); filter: saturate(.98); }
  50% { transform: translateY(1px) rotate(-2.6deg); filter: saturate(.94); }
}

@keyframes stretchBody {
  0%, 100% { transform: translateY(0) scale(1); }
  42% { transform: translateY(5px) scale(1.08, .9); }
  72% { transform: translateY(-2px) scale(.98, 1.03); }
}

@keyframes selfCareRock {
  0%, 100% { transform: translateX(0) rotate(-.6deg); }
  36% { transform: translateX(-3px) rotate(-2deg); }
  72% { transform: translateX(2px) rotate(1.2deg); }
}

@keyframes begBounce {
  0%, 100% { transform: translateY(0) scale(1.015); }
  48% { transform: translateY(-6px) scale(1.035, .975); }
}

@keyframes boredSink {
  0%, 100% { transform: translateY(2px) scale(.995, 1.005); filter: saturate(.96); }
  50% { transform: translateY(7px) scale(.98, 1.015); filter: saturate(.9); }
}

@keyframes guardHold {
  0%, 100% { transform: translateY(0) rotate(-1.2deg) scale(1.01); }
  48% { transform: translateY(-2px) rotate(-1.7deg) scale(1.018); }
}

@keyframes proudLift {
  0%, 100% { transform: translateY(0) scale(1.01); }
  50% { transform: translateY(-5px) scale(1.035, .985); }
}

@keyframes happySpin {
  0%, 100% { transform: translateY(0) rotate(-3deg) scale(1.01); }
  45% { transform: translateY(-5px) rotate(4deg) scale(1.03, .98); }
  72% { transform: translateY(1px) rotate(-1deg) scale(1.01); }
}

@keyframes bigJoyJump {
  0%, 100% { transform: translateY(0) scale(1.02, .99) rotate(-1deg); }
  32% { transform: translateY(-38px) scale(.98, 1.04) rotate(2.5deg); }
  58% { transform: translateY(-18px) scale(1.04, .97) rotate(-1.2deg); }
  78% { transform: translateY(3px) scale(1.08, .92) rotate(.5deg); }
}

@keyframes happyBounce {
  0%, 100% { transform: translateY(0) scale(1.08, .94); }
  38% { transform: translateY(-18px) scale(.98, 1.04); }
  68% { transform: translateY(1px) scale(1.05, .96); }
}

@keyframes starTwirl {
  0%, 100% { transform: translateX(0) translateY(0) rotate(-7deg) scale(1.01); }
  35% { transform: translateX(-6px) translateY(-8px) rotate(8deg) scale(1.035, .975); }
  70% { transform: translateX(5px) translateY(-3px) rotate(-4deg) scale(1.02); }
}

@keyframes grassPounce {
  0%, 100% { transform: translateX(0) translateY(0) rotate(-2deg) scale(1.01); }
  42% { transform: translateX(12px) translateY(-12px) rotate(4deg) scale(1.04, .97); }
  72% { transform: translateX(4px) translateY(2px) rotate(1deg) scale(1.06, .94); }
}

@keyframes plateWait {
  0%, 100% { transform: translateY(1px) scale(1.01, .995); }
  38% { transform: translateY(-2px) translateX(-2px) scale(1.02, .99); }
  72% { transform: translateY(2px) scale(1.005, 1.002); }
}

@keyframes ownerApproach {
  0%, 100% { transform: translateX(-2px) translateY(0) scale(1.015); }
  42% { transform: translateX(4px) translateY(-4px) scale(1.035, .985); }
  76% { transform: translateX(1px) translateY(1px) scale(1.02, .995); }
}

@keyframes sleepyBallLook {
  0%, 100% { transform: translateY(3px) rotate(-.8deg) scale(1.005); filter: saturate(.96); }
  46% { transform: translateY(8px) rotate(.5deg) scale(.995, 1.01); filter: saturate(.91); }
  78% { transform: translateY(4px) translateX(2px) rotate(-.2deg); }
}

@keyframes turnAwayHold {
  0%, 100% { transform: translateX(1px) rotate(-1.2deg) scale(1.01); filter: saturate(.95); }
  45% { transform: translateX(5px) rotate(-2.1deg) scale(1.015, .99); filter: saturate(.9); }
  72% { transform: translateX(3px) rotate(-.7deg); }
}

@keyframes settleAfterCare {
  0%, 100% { transform: translateY(2px) scale(1.01, .995); filter: saturate(1.02); }
  50% { transform: translateY(5px) scale(1.025, .985); filter: saturate(1); }
}

@keyframes lookUpBreath {
  0%, 100% { transform: translateY(0) scale(1.01); }
  45% { transform: translateY(-4px) scale(1.03, .985); }
}

@keyframes pawReach {
  0%, 100% { transform: translateX(0) translateY(0) rotate(-.8deg); }
  42% { transform: translateX(5px) translateY(-4px) rotate(2deg); }
  70% { transform: translateX(1px) translateY(1px) rotate(.4deg); }
}

@keyframes sleepyBob {
  0%, 100% { transform: translateY(2px) rotate(-.6deg); }
  50% { transform: translateY(8px) rotate(.8deg); }
}

@keyframes tinyCryShake {
  0%, 100% { transform: translateX(0) translateY(2px); }
  35% { transform: translateX(-1px) translateY(4px); }
  70% { transform: translateX(1px) translateY(3px); }
}

@keyframes pop {
  0% { transform: translate(-50%, 14px) scale(.7); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translate(-50%, -28px) scale(1); opacity: 0; }
}

@keyframes floatMote {
  0% { transform: translateY(12px) scale(.55); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translateY(-62px) scale(1.08); opacity: 0; }
}

@keyframes startle {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  25% { transform: translateX(-5px) rotate(-1deg); }
  75% { transform: translateX(5px) rotate(1deg); }
}

@keyframes microGlint {
  0%, 72%, 100% { opacity: .5; transform: translateY(0) scale(1); }
  78% { opacity: .9; transform: translateY(-1px) scale(1.18); }
  84% { opacity: .38; transform: translateY(0) scale(.92); }
}

@keyframes tinyHesitation {
  0%, 100% {
    transform:
      translate(var(--gaze-x, 0px), var(--gaze-y, 0px))
      rotate(calc(var(--pet-focus-tilt, 0deg) * .35));
  }
  42% {
    transform:
      translate(calc(var(--gaze-x, 0px) - 2px), calc(var(--gaze-y, 0px) + 1px))
      rotate(calc(var(--pet-focus-tilt, 0deg) * .35 - .8deg));
  }
  72% {
    transform:
      translate(calc(var(--gaze-x, 0px) + 1px), var(--gaze-y, 0px))
      rotate(calc(var(--pet-focus-tilt, 0deg) * .35 + .4deg));
  }
}

@keyframes gazeScan {
  0%, 100% {
    transform:
      translate(var(--gaze-x, 0px), var(--gaze-y, 0px))
      rotate(calc(var(--pet-focus-tilt, 0deg) * .4));
  }
  38% {
    transform:
      translate(calc(var(--gaze-x, 0px) - 6px), calc(var(--gaze-y, 0px) + 1px))
      rotate(calc(var(--pet-focus-tilt, 0deg) * .4 - .5deg));
  }
  66% {
    transform:
      translate(calc(var(--gaze-x, 0px) + 7px), calc(var(--gaze-y, 0px) - 1px))
      rotate(calc(var(--pet-focus-tilt, 0deg) * .4 + .6deg));
  }
}

@media (max-width: 1150px) {
  .topbar {
    grid-template-columns: 190px auto 120px 1fr auto;
    gap: 10px;
  }

  .brand { font-size: 25px; }
  .tab { min-width: 120px; font-size: 17px; }
  .wallet-item { min-width: 104px; font-size: 18px; }
  .round-btn { display: none; }
  .shop-btn { min-width: 108px; font-size: 18px; }
  .shell { grid-template-columns: minmax(610px, 1fr) 312px; }
  .dock { width: min(670px, calc(100% - 330px)); min-width: 500px; }
  .care-btn { font-size: 24px; }
  .room-nav { width: min(650px, calc(100% - 345px)); }
}

@media (max-width: 860px) {
  .app {
    grid-template-rows: auto 1fr;
  }

  .topbar {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 76px;
    padding: 10px;
  }

  .tabs,
  .beta-ribbon,
  .wallet,
  .top-actions {
    grid-column: 1 / -1;
  }

  .beta-ribbon {
    justify-self: stretch;
    text-align: center;
  }

  .wallet {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    justify-content: stretch;
  }

  .wallet-item {
    flex: 1;
    min-width: 0;
    height: 42px;
    padding: 0 9px;
    font-size: 15px;
    border-radius: 11px;
  }

  .wallet-item > span { font-size: 20px; }
  .wallet-item button { display: none; }

  .top-actions {
    justify-self: stretch;
    justify-content: end;
  }

  .shop-btn {
    height: 44px;
    width: 128px;
    min-width: 0;
    margin-right: 0;
    border-radius: 8px;
  }

  .shell {
    display: block;
  }

  .room {
    height: auto;
    min-height: 690px;
  }

  .side {
    display: grid;
    grid-template-rows: auto;
    padding: 10px;
  }

  .round-window {
    width: 245px;
    height: 245px;
    left: 58%;
    top: 7%;
  }

  .door { width: 92px; height: 430px; }
  .kennel { left: 118px; top: 286px; transform: scale(.72); transform-origin: left top; }
  .room-bed { right: 10px; top: 405px; transform: scale(.72); transform-origin: right top; }
  .bowl { left: 42px; bottom: 235px; transform: scale(.76); transform-origin: left bottom; }
  .ball { left: 65%; bottom: 275px; transform: scale(.72); }
  .pet-wrap { left: 51%; bottom: 255px; transform: translateX(-50%) scale(.8); }
  .dock {
    left: 10px;
    right: 10px;
    bottom: 67px;
    width: auto;
    min-width: 0;
    height: 102px;
    transform: none;
  }
  .care-btn { font-size: 16px; gap: 3px; }
  .icon { width: 42px; height: 38px; transform: scale(.7); }
  .room-nav {
    left: 10px;
    right: 10px;
    width: auto;
    grid-template-columns: repeat(3, 1fr);
    height: 52px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
