/* Family reward chrome. Idle doll box stays 88px.
   Big actions last 0.55s and scale to 2.2 (about 106px of growth, under the 120px cap).
   The star badge sits below the fixed speaker. Companion off hides the doll only.
   Dress layers are same-size transparent PNGs stacked with z-index (pants, top, shoes, head). */
.reward-home { margin: 8px 0 12px; }
.reward-round, .reward-real { margin: 0 0 6px; font-weight: 700; color: #9a7420; }
.reward-dock {
  position: fixed;
  z-index: 75;
  top: calc(104px + env(safe-area-inset-top, 0px));
  right: max(8px, env(safe-area-inset-right, 0px));
  width: max-content;
  min-width: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
.reward-dock-count {
  margin: 0 0 6px;
  text-align: center;
  font-weight: 800;
  font-size: 1.7rem;
  line-height: 1.1;
  color: #6d4e00;
  background: #fff8e8;
  border: 3px solid #e2b43a;
  border-radius: 999px;
  padding: 6px 12px;
  min-width: 4.5rem;
  box-shadow: 0 2px 0 #fff;
  visibility: visible;
}
.reward-bunny {
  position: relative;
  width: 88px;
  height: 88px;
}
.reward-bunny img.reward-bunny-still,
.reward-bunny img.reward-bunny-happy {
  position: absolute;
  inset: 0;
  width: 88px;
  height: 88px;
  object-fit: contain;
  border-radius: 18px;
  z-index: 1;
}
.reward-layers {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  overflow: visible;
}
.reward-bunny img.reward-bunny-happy,
.reward-bunny.is-happy img.reward-bunny-still { display: none; }
.reward-bunny.is-happy img.reward-bunny-happy { display: block; }
.reward-bunny.is-off { visibility: hidden; }
.reward-bunny-preview {
  width: min(200px, 56vw);
  height: min(300px, 84vw);
  margin: 0 auto 8px;
}
.reward-bunny-preview img.reward-bunny-still,
.reward-bunny-preview img.reward-bunny-happy {
  width: 100%;
  height: 100%;
}
.reward-stage { display: flex; justify-content: center; }
.reward-pieces { margin: 8px 0 12px; }
.reward-piece {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}
.reward-piece .reward-chip {
  flex: 1;
  min-height: 76px;
  font-size: 1.35rem;
  display: flex;
  align-items: center;
}
.reward-wear-btn {
  width: auto;
  margin-top: 0;
  min-width: 112px;
  min-height: 76px;
  font-size: 1.3rem;
  font-weight: 800;
}
.reward-cats {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  background: #fff;
  padding: 8px 0 0;
}
.reward-cats .btn {
  width: auto;
  margin-top: 0;
  min-height: 48px;
  padding: 8px 4px;
  font-size: 1rem;
  font-weight: 800;
}
.reward-cats .btn.is-on {
  box-shadow: inset 0 0 0 3px #2f6fed;
  background: #e7f0ff;
  color: #1b3f86;
}
.reward-draws { display: flex; gap: 8px; }
.reward-draws .btn { width: auto; flex: 1; margin-top: 0; min-height: 72px; font-size: 1.05rem; line-height: 1.25; }
.btn.reward-draw-normal { background: #2f6fed; }
.btn.reward-draw-pretty { background: #8d4db8; }
.reward-wear {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  display: none;
  border: 0;
  border-radius: 18px;
  background: transparent;
}
.reward-wear.is-on { display: block; }
.reward-wear[data-wear="bg"],
.reward-wear[data-wear="furn"],
.reward-wear[data-wear="tail"] { z-index: 0; }
.reward-wear[data-wear="bottom"] { z-index: 2; }
.reward-wear[data-wear="shoes"] { z-index: 3; }
.reward-wear[data-wear="top"] { z-index: 4; }
.reward-wear[data-wear="hair"] { z-index: 5; }
.reward-wear[data-wear="eyes"],
.reward-wear[data-wear="ears"],
.reward-wear[data-wear="nose"],
.reward-wear[data-wear="blush"],
.reward-wear[data-wear="mouth"] { z-index: 6; }
.reward-wear[data-wear="head"] { z-index: 7; }
.reward-wear[data-wear="acc"] { z-index: 8; }
.reward-wear[data-wear="pet"],
.reward-wear[data-wear="hold"] { z-index: 9; }
.reward-wear[data-wear="fx"] { z-index: 10; }
.reward-doll-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
}
.reward-doll-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.reward-chip-layered {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff8ee;
}
.reward-sticker-grid .reward-sticker { min-width: 44px; min-height: 32px; font-size: 0.75rem; }
.reward-place-grid .reward-sticker { min-width: 120px; min-height: 72px; font-size: 1.15rem; }
.reward-wearing { margin: 0 0 8px; font-weight: 800; text-align: center; }
.reward-deco {
  position: absolute;
  z-index: 12;
  left: 0;
  right: 0;
  top: -18px;
  display: flex;
  justify-content: center;
  gap: 2px;
}
.reward-deco img { width: 18px; height: 18px; border-radius: 50%; }
.reward-bunny.act-hop { animation: reward-hop 0.55s ease-out 1 both; }
.reward-bunny.act-spin { animation: reward-spin 0.55s ease-out 1 both; }
.reward-bunny.act-pop { animation: reward-pop 0.55s ease-out 1 both; }
.reward-bunny.act-wiggle { animation: reward-wiggle 0.55s ease-out 1 both; }
.reward-bunny.act-gentle { animation: reward-gentle 0.4s ease-out 1 both; }
@keyframes reward-hop {
  0% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-28px) scale(2.2); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes reward-spin {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(2.2); }
  100% { transform: rotate(360deg) scale(1); }
}
@keyframes reward-pop {
  0% { transform: scale(1); }
  40% { transform: scale(2.2); }
  100% { transform: scale(1); }
}
@keyframes reward-wiggle {
  0% { transform: rotate(0deg) scale(1); }
  35% { transform: rotate(-14deg) scale(2.2); }
  70% { transform: rotate(12deg) scale(1.4); }
  100% { transform: rotate(0deg) scale(1); }
}
@keyframes reward-gentle {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(-8deg) scale(1.05); }
  100% { transform: rotate(0deg) scale(1); }
}
.reward-sheet {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, 0.28);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
}
.reward-sheet-card {
  width: min(560px, 100%);
  max-height: 78vh;
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  padding: 16px;
}
.reward-need {
  margin: 0 0 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #ffe8e6;
  color: #8f1d1d;
  font-weight: 800;
  font-size: 1.45rem;
  line-height: 1.35;
}
.btn.reward-draw.is-short,
.btn.reward-draw.is-short:disabled,
.btn.reward-draw.is-short:active {
  background: #fff1f0 !important;
  color: #8f1d1d !important;
  opacity: 1 !important;
  box-shadow: inset 0 0 0 3px #e35d5d !important;
}
.reward-sticker-grid, .reward-place-grid, .reward-owned {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 12px;
}
.reward-sticker, .reward-chip {
  min-width: 72px;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  padding: 8px;
  font-weight: 700;
}
.reward-chip.is-on { outline: 3px solid #2f6fed; }
.reward-owned-row { display: flex; gap: 8px; align-items: center; width: 100%; }
.reward-slot-title { margin: 8px 0 4px; font-weight: 700; }
.reward-banner {
  position: fixed;
  z-index: 76;
  left: 50%;
  top: calc(96px + env(safe-area-inset-top, 0px));
  transform: translateX(-50%);
  max-width: min(520px, calc(100% - 24px));
  background: #ffe08a;
  color: #3d2e08;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 1.35rem;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

/* Standalone house page (/bunny.html). Practice dock stays 88px. */
.house-page {
  margin: 0;
  min-height: 100%;
  background: #f6c7b8;
  overflow: hidden;
}
.house-page .house-room {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: #f6c7b8 url("reward/bunny-room-bg.jpg") center center / cover no-repeat;
}
.house-page .house-spot {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  width: min(280px, 64vw);
  height: min(420px, 62vh);
  transform: translateX(-50%);
  filter: drop-shadow(0 10px 8px rgba(90, 50, 30, 0.22));
  pointer-events: none;
}
.house-page .house-spot .reward-bunny {
  width: 100%;
  height: 100%;
}
.house-page .house-spot .reward-bunny img.reward-bunny-still,
.house-page .house-spot .reward-bunny img.reward-bunny-happy,
.house-page .house-spot .reward-bunny img.reward-wear {
  width: 100%;
  height: 100%;
  border-radius: 0;
}
.house-page #rewardBunny.is-off { visibility: visible; }
.house-page .btn.reward-draw-normal { background: #2f6fed; color: #fff; }
.house-page .btn.reward-draw-pretty { background: #8d4db8; color: #fff; }
.house-page .house-spot .reward-deco img { width: 42px; height: 42px; }
.house-page .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 12px 16px;
  font-size: 1.15rem;
  font-weight: 800;
  font-family: inherit;
  border: none;
  border-radius: 14px;
  background: #2f6fed;
  color: #fff;
  box-sizing: border-box;
}
.house-page .btn-secondary { background: #e8eef5; color: #1a2b3c; }
.house-page #rewardSheetClose { width: 100%; margin-top: 12px; }
.house-page .house-back {
  position: fixed;
  z-index: 40;
  top: calc(8px + env(safe-area-inset-top, 0px));
  left: max(12px, env(safe-area-inset-left, 0px));
  min-width: 96px;
  min-height: 64px;
  margin: 0;
  padding: 10px 18px;
  width: auto;
  text-decoration: none;
  background: #fff7ea;
  color: #5c3a12;
  border: 3px solid #e2b43a;
  box-sizing: border-box;
}
.house-page .house-bar {
  position: fixed;
  z-index: 40;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 248, 240, 0.94);
}
.house-page .house-bar .btn {
  width: auto;
  margin: 0;
  min-height: 64px;
  font-size: 1.35rem;
  background: #fff7ea;
  color: #5c3a12;
  border: 3px solid #e2b43a;
}
.house-page .hidden { display: none !important; }
.house-page #rewardHome {
  position: fixed;
  z-index: 45;
  left: 12px;
  right: 12px;
  top: calc(76px + env(safe-area-inset-top, 0px));
  pointer-events: none;
}
.house-page #rewardHome > :not(#rewardSaveNote) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.house-page #rewardSaveNote {
  margin: 0 auto;
  max-width: 520px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff7ea;
  color: #5c3a12;
  font-weight: 800;
  text-align: center;
}
.house-page .reward-sheet { z-index: 80; }

/* 換裝反饋。只係 CSS，唔用額外圖。
   普通 0.5s：輕彈＋兩粒小閃星。
   靚 0.5s：彈幅更大、外框柔光、頭頂光環（中心透明）、多粒閃星。
   光環同閃星避開面（約頂部同兩側）。fx 槽 PNG 唔係呢套動畫。 */

.doll,
.reward-bunny {
  position: relative;
  transform-origin: 50% 70%;
}

.doll.is-equip-normal,
.reward-bunny.is-equip-normal {
  animation: doll-equip-pop 0.5s ease both;
}

.doll.is-equip-pretty,
.reward-bunny.is-equip-pretty {
  animation: doll-equip-pretty-pop 0.5s cubic-bezier(0.2, 0.85, 0.2, 1) both;
}

@keyframes doll-equip-pop {
  0% { transform: scale(0.97); }
  45% { transform: scale(1.035); }
  100% { transform: scale(1); }
}

@keyframes doll-equip-pretty-pop {
  0% {
    transform: scale(0.96);
    filter: drop-shadow(0 0 0 rgba(255, 186, 220, 0));
  }
  42% {
    transform: scale(1.055);
    filter:
      drop-shadow(0 0 12px rgba(255, 170, 214, 0.9))
      drop-shadow(0 0 20px rgba(186, 150, 255, 0.45));
  }
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(255, 186, 220, 0));
  }
}

/* 普通：兩粒小星，左右側，唔蓋面 */
.doll.is-equip-normal::before,
.doll.is-equip-normal::after,
.reward-bunny.is-equip-normal::before,
.reward-bunny.is-equip-normal::after {
  content: "";
  position: absolute;
  z-index: 8;
  width: 14px;
  height: 14px;
  pointer-events: none;
  background: #ffe56a;
  clip-path: polygon(50% 0%, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0% 50%, 38% 38%);
  animation: doll-equip-spark 0.5s ease both;
}

.doll.is-equip-normal::before,
.reward-bunny.is-equip-normal::before {
  left: 12%;
  top: 22%;
}

.doll.is-equip-normal::after,
.reward-bunny.is-equip-normal::after {
  right: 14%;
  top: 18%;
  width: 10px;
  height: 10px;
}

@keyframes doll-equip-spark {
  0% { opacity: 0; transform: scale(0.4) translateY(6px); }
  35% { opacity: 1; transform: scale(1) translateY(0); }
  100% { opacity: 0; transform: scale(1.15) translateY(-10px); }
}

/* 靚：頭頂光環。只有邊，中心透明，停喺頭髮上，唔落到眼。 */
.doll.is-equip-pretty::before,
.reward-bunny.is-equip-pretty::before {
  content: "";
  position: absolute;
  z-index: 8;
  left: 50%;
  top: 2%;
  width: 46%;
  height: 16%;
  transform: translateX(-50%);
  border-radius: 50%;
  border: 3px solid rgba(255, 214, 102, 0.95);
  background: transparent;
  box-shadow:
    0 0 10px 3px rgba(255, 196, 92, 0.55),
    inset 0 0 8px rgba(255, 236, 170, 0.28);
  pointer-events: none;
  animation: doll-equip-halo 0.5s ease both;
}

@keyframes doll-equip-halo {
  0% { opacity: 0; transform: translateX(-50%) scale(0.86); }
  40% { opacity: 1; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) scale(1.08); }
}

/* 靚：多粒閃星，只放頭頂同兩側，中間面位留空 */
.doll.is-equip-pretty::after,
.reward-bunny.is-equip-pretty::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 16%, #ffe27a 0 5px, transparent 6px),
    radial-gradient(circle at 30% 10%, #fff 0 3px, transparent 4px),
    radial-gradient(circle at 78% 14%, #fff6c8 0 5px, transparent 6px),
    radial-gradient(circle at 88% 24%, #ffd0ea 0 4px, transparent 5px),
    radial-gradient(circle at 12% 32%, #ffd6ef 0 4px, transparent 5px),
    radial-gradient(circle at 84% 36%, #ffe9a0 0 3px, transparent 5px),
    radial-gradient(circle at 22% 8%, #fff 0 2px, transparent 4px);
  animation: doll-equip-spark-pretty 0.5s ease both;
}

@keyframes doll-equip-spark-pretty {
  0% { opacity: 0; transform: translateY(8px) scale(0.85); }
  30% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-14px) scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
  .doll.is-equip-normal,
  .doll.is-equip-pretty,
  .reward-bunny.is-equip-normal,
  .reward-bunny.is-equip-pretty,
  .doll.is-equip-normal::before,
  .doll.is-equip-normal::after,
  .doll.is-equip-pretty::before,
  .doll.is-equip-pretty::after,
  .reward-bunny.is-equip-normal::before,
  .reward-bunny.is-equip-normal::after,
  .reward-bunny.is-equip-pretty::before,
  .reward-bunny.is-equip-pretty::after {
    animation: none;
  }
}
