:root {
  --font-rounded: 'SF Pro Rounded', ui-rounded, 'Nunito', 'Fredoka', 'Arial Rounded MT Bold', system-ui, -apple-system, sans-serif;
  --ink: #4a3525;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  font-family: var(--font-rounded);
  color: var(--ink);
  background: linear-gradient(180deg, #b8ebff 0%, #e8f9ff 52%, #a8e48c 100%);
  cursor: pointer;
}

.clearing-bg {
  position: fixed;
  inset: 0;
  background-image: url('assets/images/forest-bg.jpg');
  background-size: cover;
  background-position: center bottom;
  z-index: 0;
  pointer-events: none;
}

/* Interactive Rainbow */
.rainbow-btn {
  position: fixed;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: clamp(220px, 28vw, 360px);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  z-index: 3;
  filter: drop-shadow(0 6px 14px rgba(255, 255, 255, 0.55));
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rainbow-btn:hover {
  transform: translateX(-50%) scale(1.07);
}

.rainbow-btn.sparkle {
  animation: rainbow-bounce 0.85s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes rainbow-bounce {
  0% { transform: translateX(-50%) scale(1); }
  35% { transform: translateX(-50%) scale(1.18) translateY(-8px); }
  70% { transform: translateX(-50%) scale(0.96); }
  100% { transform: translateX(-50%) scale(1); }
}

/* Top Bar */
.top-bar {
  position: fixed;
  top: 12px;
  left: 16px;
  right: 16px;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.top-bar > * {
  pointer-events: auto;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 253, 247, 0.94);
  padding: 8px 18px;
  border-radius: 999px;
  border: 3px solid #ffd43b;
  box-shadow: 0 5px 0 rgba(217, 159, 34, 0.38), 0 10px 20px rgba(74, 53, 37, 0.12);
  font-size: clamp(17px, 1.8vw, 22px);
  font-weight: 900;
  color: #5c3b1e;
}

.brand-emoji {
  font-size: 1.25em;
}

.mode-pills {
  display: flex;
  align-items: center;
  gap: 8px;
}

.found-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff5c2 0%, #ffd859 100%);
  border: 3px solid #ffffff;
  box-shadow: 0 5px 0 #d49f1f;
  font-size: clamp(16px, 1.5vw, 20px);
  font-weight: 900;
  color: #5e3800;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 3px solid #ffffff;
  text-decoration: none;
  font-family: var(--font-rounded);
  font-size: clamp(15px, 1.4vw, 18px);
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pill-btn:hover {
  transform: translateY(-2px) scale(1.04);
}

.pill-btn:active {
  transform: translateY(3px) scale(0.97);
}

.pill-shuffle {
  background: linear-gradient(180deg, #ff9ebb 0%, #ff5c93 100%);
  color: #ffffff;
  box-shadow: 0 5px 0 #cc2d66, 0 8px 18px rgba(255, 92, 147, 0.3);
}

.pill-bubble {
  background: linear-gradient(180deg, #8ce0ff 0%, #4ec3f7 100%);
  color: #0b4161;
  box-shadow: 0 5px 0 #2695cb, 0 8px 18px rgba(78, 195, 247, 0.28);
}

.pill-switch {
  background: rgba(255, 253, 247, 0.94);
  color: #5c3b1e;
  box-shadow: 0 5px 0 rgba(120, 145, 165, 0.28), 0 8px 18px rgba(74, 53, 37, 0.12);
}

.util-pills {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 3px solid #ffffff;
  background: rgba(255, 253, 247, 0.94);
  box-shadow: 0 4px 0 rgba(120, 145, 165, 0.28), 0 6px 14px rgba(74, 53, 37, 0.12);
  font-size: 20px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.16s ease;
}

.icon-btn:hover {
  transform: scale(1.08);
}

/* Bubbles & Popped Flowers */
.bubbles-layer {
  position: fixed;
  inset: 0;
  z-index: 22;
  pointer-events: none;
  overflow: hidden;
}

.flowers-layer {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
}

.soap-bubble {
  position: absolute;
  border-radius: 50%;
  pointer-events: auto;
  cursor: pointer;
  background: radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.92) 0%, rgba(255, 215, 245, 0.45) 35%, rgba(162, 230, 255, 0.35) 68%, rgba(255, 240, 175, 0.42) 100%);
  border: 2.5px solid rgba(255, 255, 255, 0.85);
  box-shadow: inset -6px -8px 18px rgba(170, 225, 255, 0.45), 0 8px 20px rgba(120, 170, 215, 0.22);
}

.soap-bubble::after {
  content: '';
  position: absolute;
  top: 16%;
  left: 20%;
  width: 26%;
  height: 16%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  transform: rotate(-28deg);
}

.pop-flower {
  position: absolute;
  font-size: 36px;
  transform: translate(-50%, -50%) scale(0);
  animation: bloom-fade 2.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes bloom-fade {
  0% { transform: translate(-50%, -50%) scale(0) rotate(-25deg); opacity: 0; }
  22% { transform: translate(-50%, -50%) scale(1.25) rotate(8deg); opacity: 1; }
  80% { transform: translate(-50%, -58%) scale(1) rotate(0deg); opacity: 0.95; }
  100% { transform: translate(-50%, -72%) scale(0.4) rotate(12deg); opacity: 0; }
}

/* Main Stage: 3 x 2 Giant Hiding Spots */
.stage {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 90px clamp(20px, 4vw, 56px) 26px;
  pointer-events: none;
}

.spots-grid {
  width: 100%;
  max-width: 1260px;
  height: 100%;
  max-height: 760px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: clamp(16px, 2.4vw, 32px);
  pointer-events: none;
}

/* Individual Hiding Spot Container */
.spot-card {
  position: relative;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.spot-card:hover {
  transform: scale(1.045) translateY(-4px);
  z-index: 9;
}

.spot-card:active {
  transform: scale(0.95);
}

/* Teasing wiggle animation when still hidden */
.spot-card.tease .prop-layer {
  animation: spot-tease 0.9s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes spot-tease {
  0% { transform: rotate(0deg) scale(1); }
  18% { transform: rotate(-7deg) scale(1.08, 0.94); }
  38% { transform: rotate(7deg) scale(0.96, 1.07); }
  58% { transform: rotate(-5deg) scale(1.05, 0.96); }
  78% { transform: rotate(4deg) scale(1.02); }
  100% { transform: rotate(0deg) scale(1); }
}

/* Floating playful "?" badge on hidden spots */
.mystery-badge {
  position: absolute;
  top: 4%;
  right: 8%;
  z-index: 12;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffe66d 0%, #ffb703 100%);
  color: #6b3b00;
  font-size: 26px;
  font-weight: 900;
  display: grid;
  place-items: center;
  border: 3.5px solid #ffffff;
  box-shadow: 0 5px 12px rgba(74, 53, 37, 0.22);
  animation: badge-bob 2s ease-in-out infinite;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.spot-card.revealed .mystery-badge {
  opacity: 0;
  transform: scale(0);
}

@keyframes badge-bob {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-7px) rotate(6deg); }
}

/* Speech bubble ("CUCUBAU!") */
.peek-bubble {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%) scale(0);
  z-index: 20;
  background: #ffffff;
  color: #e64980;
  font-size: clamp(19px, 2vw, 26px);
  font-weight: 900;
  padding: 6px 20px;
  border-radius: 999px;
  border: 4px solid #ffd43b;
  box-shadow: 0 8px 20px rgba(74, 53, 37, 0.22);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
}

.peek-bubble.show {
  animation: bubble-pop 1.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes bubble-pop {
  0% { transform: translateX(-50%) translateY(20px) scale(0.2); opacity: 0; }
  18% { transform: translateX(-50%) translateY(-10px) scale(1.16); opacity: 1; }
  32% { transform: translateX(-50%) translateY(-5px) scale(1); opacity: 1; }
  78% { transform: translateX(-50%) translateY(-12px) scale(1); opacity: 1; }
  100% { transform: translateX(-50%) translateY(-28px) scale(0.7); opacity: 0; }
}

/* Hiding Prop SVG Layer (foreground cover that animates open!) */
.prop-layer {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 7;
  transition: opacity 0.45s ease, transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 12px 18px rgba(58, 43, 28, 0.2));
}

.prop-svg {
  width: 92%;
  height: 92%;
  max-width: 310px;
  max-height: 295px;
  overflow: visible;
}

/* Physical opening animations for each SVG prop's movable parts! */
.prop-svg .door-left,
.prop-svg .door-right,
.prop-svg .egg-top,
.prop-svg .gift-lid,
.prop-svg .bush-left,
.prop-svg .bush-right,
.prop-svg .curtain-left,
.prop-svg .curtain-right,
.prop-svg .shroom-door {
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.45s ease;
}

.spot-card.revealed .prop-layer {
  transform: scale(0.86) translateY(34px);
  opacity: 0.14;
  pointer-events: none;
}

.spot-card.revealed .door-left { transform: translateX(-48px) rotate(-18deg); opacity: 0; }
.spot-card.revealed .door-right { transform: translateX(48px) rotate(18deg); opacity: 0; }
.spot-card.revealed .egg-top { transform: translateY(-88px) rotate(-24deg); opacity: 0; }
.spot-card.revealed .gift-lid { transform: translateY(-96px) rotate(18deg); opacity: 0; }
.spot-card.revealed .bush-left { transform: translateX(-68px) rotate(-16deg); opacity: 0; }
.spot-card.revealed .bush-right { transform: translateX(68px) rotate(16deg); opacity: 0; }
.spot-card.revealed .curtain-left { transform: translateX(-56px) scaleX(0.45); opacity: 0; }
.spot-card.revealed .curtain-right { transform: translateX(56px) scaleX(0.45); opacity: 0; }
.spot-card.revealed .shroom-door { transform: translateX(-44px) rotate(-20deg); opacity: 0; }

/* Revealed Animal Card (pops UP right out of the hiding spot!) */
.animal-reveal {
  position: absolute;
  inset: 4px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  padding: 9px 9px 10px;
  border-radius: 32px;
  background: #fffdf7;
  border: 5px solid #ffffff;
  box-shadow:
    0 11px 0 var(--ledge, #d9c7a3),
    0 20px 36px rgba(68, 49, 32, 0.24);
  opacity: 0;
  transform: scale(0.25) translateY(55px);
  pointer-events: none;
  transition: transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.spot-card.revealed .animal-reveal {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

.animal-reveal-img-wrap {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  border-radius: 22px;
  overflow: hidden;
  background: #fdf6e3;
}

.animal-reveal img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.animal-reveal-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-top: 8px;
}

.animal-reveal-name {
  font-size: clamp(19px, 1.9vw, 25px);
  font-weight: 900;
  color: #4a3525;
}

.animal-reveal-sound {
  font-size: clamp(13px, 1.15vw, 15px);
  font-weight: 900;
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--badge, #ffe066);
  color: var(--badge-ink, #6b4200);
}

/* Extra bounce when petting a revealed animal */
.spot-card.pet-bounce .animal-reveal {
  animation: pet-boogie 0.85s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sing-btn {
  position: absolute;
  top: -12px;
  left: -10px;
  z-index: 16;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3.5px solid #ffffff;
  background: linear-gradient(180deg, #ffdf6b 0%, #ff922b 100%);
  color: #ffffff;
  font-size: 22px;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 5px 0 #d97316, 0 8px 16px rgba(255, 146, 43, 0.4);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sing-btn:hover { transform: scale(1.16) rotate(-10deg); }

.spot-card.singing .animal-reveal {
  border-color: #ff6b9d !important;
  box-shadow: 0 12px 0 #e64980, 0 0 0 8px rgba(255, 212, 59, 0.72), 0 24px 44px rgba(255, 107, 157, 0.4) !important;
}

.spot-card.singing .sing-btn {
  background: linear-gradient(180deg, #ff85b3 0%, #ff4f8b 100%);
  animation: sing-pulse 0.5s ease-in-out infinite alternate;
}

@keyframes sing-pulse {
  from { transform: scale(1) rotate(-8deg); }
  to { transform: scale(1.2) rotate(8deg); }
}

.spot-card.beat-pop .animal-reveal { transform: translateY(-16px) scale(1.07) rotate(-2deg) !important; }
.spot-card.beat-pop-alt .animal-reveal { transform: translateY(-16px) scale(1.07) rotate(2deg) !important; }

@keyframes pet-boogie {
  0% { transform: scale(1) rotate(0deg); }
  22% { transform: translateY(-24px) scale(1.12) rotate(-6deg); }
  50% { transform: translateY(-10px) scale(1.1) rotate(6deg); }
  78% { transform: translateY(-16px) scale(1.05) rotate(-3deg); }
  100% { transform: scale(1) rotate(0deg); }
}

/* Victory parade dance for ALL 6 animals! */
body.parade .spot-card.revealed .animal-reveal {
  animation: parade-dance 0.95s ease-in-out infinite;
  animation-delay: var(--parade-delay, 0s);
}

@keyframes parade-dance {
  0%, 100% { transform: translateY(0) rotate(-3deg) scale(1); }
  50% { transform: translateY(-16px) rotate(3deg) scale(1.05); }
}

/* Victory Bottom Floating Replay Button */
.victory-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  animation: pop-up-bar 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pop-up-bar {
  from { transform: translateX(-50%) translateY(80px) scale(0.7); opacity: 0; }
  to { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
}

.victory-replay-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 34px;
  border-radius: 999px;
  border: 5px solid #ffffff;
  background: linear-gradient(180deg, #ff85b3 0%, #ff4f8b 100%);
  color: #ffffff;
  font-family: var(--font-rounded);
  font-size: clamp(20px, 2.3vw, 28px);
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 9px 0 #c92a63, 0 20px 38px rgba(255, 79, 139, 0.45);
  animation: start-pulse 1.5s ease-in-out infinite;
}

.victory-replay-btn:hover {
  transform: scale(1.06);
}

/* Welcome Splash Screen */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: radial-gradient(circle at 50% 42%, rgba(255, 250, 224, 0.94) 0%, rgba(168, 228, 255, 0.92) 100%);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  cursor: pointer;
  transition: opacity 0.42s ease, transform 0.42s ease;
}

.splash-screen.fade-out {
  opacity: 0;
  transform: scale(1.06);
  pointer-events: none;
}

.splash-card {
  background: #fffdf8;
  border: 6px solid #ffffff;
  border-radius: 44px;
  padding: clamp(26px, 4vw, 46px) clamp(28px, 5vw, 58px);
  text-align: center;
  box-shadow: 0 18px 0 #e5d5bc, 0 32px 70px rgba(74, 53, 37, 0.22);
  max-width: 580px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.splash-egg-emoji {
  font-size: clamp(64px, 9vw, 96px);
  line-height: 1.1;
  animation: splash-wiggle 1.8s ease-in-out infinite;
}

@keyframes splash-wiggle {
  0%, 100% { transform: rotate(-5deg) scale(1); }
  50% { transform: rotate(5deg) scale(1.09); }
}

.splash-title {
  margin: 0;
  font-size: clamp(36px, 5vw, 54px);
  font-weight: 900;
  color: #543214;
}

.splash-subtitle {
  margin: 0 0 8px;
  font-size: clamp(18px, 2.1vw, 24px);
  font-weight: 700;
  color: #7c5c40;
}

.start-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 18px 40px;
  border-radius: 999px;
  border: 5px solid #ffffff;
  background: linear-gradient(180deg, #ff85b3 0%, #ff4f8b 100%);
  color: #ffffff;
  font-family: var(--font-rounded);
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 9px 0 #cc2d66, 0 18px 34px rgba(255, 79, 139, 0.42);
  animation: start-pulse 1.7s ease-in-out infinite;
}

@keyframes start-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.fx-canvas {
  position: fixed;
  inset: 0;
  z-index: 35;
  pointer-events: none;
}

.hidden {
  display: none !important;
}
