:root {
  --game-bg: #090e24;
}

.top-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 6px 14px;
  box-sizing: border-box;
  gap: 10px;
  z-index: 20;
}

.top-controls .instruction-banner {
  flex: 1 1 auto;
  min-width: 0;
  border-radius: 16px;
  margin: 0;
  font-size: 0.95rem;
  padding: 6px 12px;
}

.nightlight-btn {
  background: rgba(255, 238, 88, 0.2);
  border: 2px solid #ffee58;
  color: #fff9c4;
  font-size: 16px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s, transform 0.2s;
}

.nightlight-btn:hover {
  background: rgba(255, 238, 88, 0.35);
  transform: scale(1.04);
}

.nightlight-btn.active {
  background: #ffee58;
  color: #1a237e;
  box-shadow: 0 0 16px rgba(255, 238, 88, 0.6);
}

.kitty-field {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  background: radial-gradient(circle at 50% 30%, #151c3d 0%, #090e24 100%);
}

.sparks-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 40;
}

.spark-item {
  position: absolute;
  font-size: 26px;
  pointer-events: none;
  animation: spark-fly 1s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes spark-fly {
  0% { transform: translate(0, 0) scale(0.6); opacity: 1; }
  100% { transform: translate(var(--tx, 0px), var(--ty, -70px)) scale(1.3) rotate(var(--rot, 20deg)); opacity: 0; }
}

.room-canvas {
  --lx: 50%;
  --ly: 50%;
  --beam-radius: 130px;
  --mask-opacity: 0.95;
  position: absolute;
  inset: 0;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.room-canvas:focus-visible {
  outline: 4px solid #ffee58;
  outline-offset: -4px;
}

/* Room Decor items */
.room-decor {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.decor-item {
  position: absolute;
  font-size: 64px;
  line-height: 1;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.4));
  transform: translate(var(--dx, 0px), var(--dy, 0px)) scale(var(--scale, 1));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.decor-item.lit {
  --scale: 1.08;
}

/* Natural Cozy Bedroom Layout */
.decor-bed { bottom: 40px; left: 30px; }
.decor-box { bottom: 50px; right: 35px; }
.decor-basket { bottom: 45px; left: 50%; --dx: -50%; }
.decor-bear { top: 70px; right: 40px; }
.decor-plant { top: 60px; left: 30px; }
.decor-chair { top: 50%; left: 35px; --dy: -50%; }
.decor-shelf { top: 60px; left: 50%; --dx: -50%; }
.decor-yarn { top: 52%; right: 40px; --dy: -50%; }

/* Faint Paw Hint */
.paw-hint {
  position: absolute;
  font-size: 32px;
  pointer-events: none;
  color: #ffca28;
  opacity: 0.6;
  animation: pulse-paw 1.5s infinite ease-in-out;
  z-index: 3;
}

@keyframes pulse-paw {
  0%, 100% { transform: scale(0.85); opacity: 0.3; }
  50% { transform: scale(1.15); opacity: 0.8; }
}

/* Hidden Kitty */
.hidden-kitty {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 8px;
  z-index: 5;
  transition: transform 0.25s ease;
  outline: none;
}

.hidden-kitty:focus-visible {
  outline: 3px solid #ffee58;
  border-radius: 24px;
  z-index: 15;
}

.hidden-kitty.awake .kitty-emoji {
  animation: kitty-awake 0.6s ease-in-out infinite alternate;
}

@keyframes kitty-awake {
  0% { transform: scale(1.04) rotate(-3deg); }
  100% { transform: scale(1.12) rotate(3deg); }
}

.kitty-emoji {
  font-size: 82px;
  line-height: 1;
  display: inline-block;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.4));
  animation: kitty-sleep 2.4s infinite ease-in-out;
}

@keyframes kitty-sleep {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.04, 0.96) translateY(2px); }
}

.kitty-status {
  position: absolute;
  top: -8px;
  right: -6px;
  font-size: 28px;
  line-height: 1;
}

.kitty-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff9c4;
  background: rgba(10, 15, 36, 0.7);
  padding: 2px 10px;
  border-radius: 12px;
  margin-top: 4px;
  opacity: 0.8;
  pointer-events: none;
}

/* Flashlight Dark Mask */
.flashlight-mask {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle var(--beam-radius) at var(--lx) var(--ly),
    rgba(255, 253, 231, 0.08) 0%,
    rgba(255, 238, 88, 0.05) 55%,
    rgba(9, 14, 36, var(--mask-opacity)) 80%,
    rgba(9, 14, 36, var(--mask-opacity)) 100%
  );
  pointer-events: none;
  z-index: 10;
  transition: opacity 0.3s;
}

/* Discovery Celebration Overlay */
.discovery-overlay {
  position: absolute;
  inset: 0;
  background: rgba(9, 14, 36, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  backdrop-filter: blur(4px);
  animation: overlay-fade 0.3s ease-out;
}

.discovery-overlay[hidden],
.paw-hint[hidden] {
  display: none !important;
}

@keyframes overlay-fade {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

.discovery-card {
  background: linear-gradient(180deg, #1e295d 0%, #10163a 100%);
  border: 4px solid #ffee58;
  border-radius: 36px;
  padding: 20px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  max-width: 320px;
  width: 85%;
  text-align: center;
  animation: card-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes card-pop {
  0% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.celebrate-kitty-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  outline: none;
}

.celebrate-kitty-btn:hover,
.celebrate-kitty-btn:active {
  transform: scale(1.18) rotate(6deg);
}

.celebrate-kitty-btn.petting {
  animation: kitty-bounce 0.35s ease;
}

@keyframes kitty-bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.22) rotate(8deg); }
}

.celebrate-kitty-btn:focus-visible {
  outline: 4px solid #ffee58;
  outline-offset: 4px;
}

.celebrate-emoji {
  font-size: 110px;
  line-height: 1;
  display: inline-block;
  filter: drop-shadow(0 8px 24px rgba(255, 238, 88, 0.35));
  animation: kitty-wiggle 1.2s infinite ease-in-out;
}

@keyframes kitty-wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-8deg); }
  75% { transform: rotate(8deg); }
}

.found-title {
  font-size: 26px;
  font-weight: 800;
  color: #fff9c4;
  margin-top: 10px;
}

.purr-subtitle {
  font-size: 18px;
  font-weight: 700;
  color: #ff80ab;
  margin-top: 4px;
}

.next-hide-btn {
  margin-top: 16px;
  background: linear-gradient(135deg, #ffd54f 0%, #ff8f00 100%);
  color: #212121;
  border: 3px solid #ffe082;
  font-size: 20px;
  font-weight: 800;
  padding: 10px 30px;
  border-radius: 28px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(255, 143, 0, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}

.next-hide-btn:hover,
.next-hide-btn:active {
  transform: scale(1.06);
  box-shadow: 0 8px 24px rgba(255, 143, 0, 0.5);
}

.next-hide-btn:focus-visible {
  outline: 4px solid #ffffff;
  outline-offset: 3px;
}

@media (max-width: 480px) {
  .top-controls {
    padding: 4px 8px;
    gap: 6px;
  }
  .top-controls .instruction-banner {
    font-size: 0.85rem;
    padding: 4px 8px;
  }
  .nightlight-btn {
    font-size: 14px;
    padding: 5px 10px;
  }
  .decor-item {
    font-size: 52px;
  }
  .kitty-emoji {
    font-size: 70px;
  }
}

@media (max-height: 520px) {
  .discovery-card {
    padding: 10px 18px;
    border-radius: 24px;
  }
  .celebrate-emoji {
    font-size: 72px;
  }
  .found-title {
    font-size: 20px;
    margin-top: 4px;
  }
  .purr-subtitle {
    font-size: 15px;
  }
  .next-hide-btn {
    margin-top: 10px;
    padding: 6px 20px;
    font-size: 16px;
  }
  .decor-item {
    font-size: 46px;
  }
  .kitty-emoji {
    font-size: 60px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .celebrate-emoji,
  .kitty-emoji,
  .paw-hint,
  .spark-item,
  .discovery-card,
  .decor-item,
  .celebrate-kitty-btn.petting,
  .hidden-kitty.awake .kitty-emoji {
    animation: none !important;
    transition: none !important;
  }
}
