@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Quicksand:wght@500;600;700&display=swap');

:root {
  --primary: #4F46E5;
  --primary-light: #818CF8;
  --secondary: #F59E0B;
  --accent: #EC4899;
  --success: #10B981;
  --danger: #EF4444;
  --bg-gradient: linear-gradient(135deg, #E0F2FE 0%, #F0FDF4 50%, #FEF3C7 100%);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-touch-callout: none;
}

html, body {
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}

.border-3 {
  border-width: 3px;
}

body {
  font-family: 'Fredoka', 'Quicksand', system-ui, -apple-system, sans-serif;
  background: var(--bg-gradient);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  margin: 0;
  overflow-x: hidden;
  color: #1E293B;
  user-select: none;
  -webkit-user-select: none;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* Playful custom scrollbar */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: #F1F5F9;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

/* 3D Kid-Friendly Buttons */
.btn-3d {
  position: relative;
  transition: all 0.15s ease-out;
  cursor: pointer;
  border: none;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-3d-yellow {
  background-color: #FBBF24;
  color: #78350F;
  box-shadow: 0 6px 0 #D97706, 0 10px 15px rgba(217, 119, 6, 0.3);
}
.btn-3d-yellow:hover, .btn-3d-yellow:focus {
  background-color: #FCD34D;
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #D97706, 0 14px 20px rgba(217, 119, 6, 0.35);
}
.btn-3d-yellow:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #D97706, 0 4px 6px rgba(217, 119, 6, 0.2);
}

.btn-3d-purple {
  background-color: #8B5CF6;
  color: #FFFFFF;
  box-shadow: 0 6px 0 #6D28D9, 0 10px 15px rgba(109, 40, 217, 0.3);
}
.btn-3d-purple:hover, .btn-3d-purple:focus {
  background-color: #A78BFA;
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #6D28D9, 0 14px 20px rgba(109, 40, 217, 0.35);
}
.btn-3d-purple:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #6D28D9, 0 4px 6px rgba(109, 40, 217, 0.2);
}

.btn-3d-green {
  background-color: #10B981;
  color: #FFFFFF;
  box-shadow: 0 6px 0 #047857, 0 10px 15px rgba(4, 120, 87, 0.3);
}
.btn-3d-green:hover, .btn-3d-green:focus {
  background-color: #34D399;
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #047857, 0 14px 20px rgba(4, 120, 87, 0.35);
}
.btn-3d-green:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #047857, 0 4px 6px rgba(4, 120, 87, 0.2);
}

.btn-3d-pink {
  background-color: #EC4899;
  color: #FFFFFF;
  box-shadow: 0 6px 0 #BE185D, 0 10px 15px rgba(190, 24, 93, 0.3);
}
.btn-3d-pink:hover, .btn-3d-pink:focus {
  background-color: #F472B6;
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #BE185D, 0 14px 20px rgba(190, 24, 93, 0.35);
}
.btn-3d-pink:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #BE185D, 0 4px 6px rgba(190, 24, 93, 0.2);
}

.btn-3d-blue {
  background-color: #3B82F6;
  color: #FFFFFF;
  box-shadow: 0 6px 0 #1D4ED8, 0 10px 15px rgba(29, 78, 216, 0.3);
}
.btn-3d-blue:hover, .btn-3d-blue:focus {
  background-color: #60A5FA;
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #1D4ED8, 0 14px 20px rgba(29, 78, 216, 0.35);
}
.btn-3d-blue:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #1D4ED8, 0 4px 6px rgba(29, 78, 216, 0.2);
}

/* Room card tactile styling */
.room-card {
  position: relative;
  background: #FFFFFF;
  border-radius: 1.5rem;
  border: 4px solid #E2E8F0;
  box-shadow: 0 8px 0 #CBD5E1, 0 12px 20px -3px rgba(0, 0, 0, 0.08);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  overflow: hidden;
}

.room-card:hover {
  transform: translateY(-6px) scale(1.02);
  border-color: #818CF8;
  box-shadow: 0 14px 0 #6366F1, 0 20px 25px -5px rgba(99, 102, 241, 0.25);
}

.room-card:active {
  transform: translateY(2px) scale(0.99);
  box-shadow: 0 4px 0 #6366F1, 0 6px 10px rgba(0, 0, 0, 0.1);
}

.room-card.checked-wrong {
  opacity: 0.65;
  filter: grayscale(40%);
  background-color: #F8FAFC;
  border-color: #CBD5E1;
  box-shadow: 0 4px 0 #94A3B8;
  transform: translateY(0) scale(0.98);
}
.room-card.checked-wrong:hover {
  opacity: 0.9;
  filter: grayscale(10%);
  transform: translateY(-2px);
}

.room-card.highlight-target {
  animation: pulse-border 1.2s infinite;
  border-color: #10B981 !important;
}

/* Floating animation */
@keyframes float {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-10px) rotate(1deg);
  }
}

.animate-float {
  animation: float 3.5s ease-in-out infinite;
}

/* Bounce gentle */
@keyframes soft-bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}
.animate-soft-bounce {
  animation: soft-bounce 2s infinite ease-in-out;
}

/* Wiggle animation */
@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-5deg); }
  75% { transform: rotate(5deg); }
}
.animate-wiggle {
  animation: wiggle 0.5s ease-in-out;
}

/* Clue Box Glow */
@keyframes clue-glow {
  0%, 100% {
    box-shadow: 0 0 18px rgba(245, 158, 11, 0.45), 0 8px 0 #D97706;
  }
  50% {
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.8), 0 8px 0 #D97706;
  }
}
.clue-box-active {
  animation: clue-glow 2s infinite;
}

/* Speech bubble pointer */
.speech-bubble {
  position: relative;
  background: #FFFFFF;
  border-radius: 1.5rem;
}
.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 16px 14px 0 14px;
  border-style: solid;
  border-color: #FFFFFF transparent transparent transparent;
}
.speech-bubble-left::after {
  bottom: auto;
  top: 50%;
  left: -16px;
  transform: translateY(-50%);
  border-width: 14px 16px 14px 0;
  border-color: transparent #FFFFFF transparent transparent;
}

/* Sound wave animation when speaking */
@keyframes soundwave {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 0.3; }
  100% { transform: scale(1); opacity: 0.8; }
}
.speaking-wave {
  animation: soundwave 1s infinite;
}

/* Star rating burst */
@keyframes star-pop {
  0% { transform: scale(0) rotate(-45deg); opacity: 0; }
  70% { transform: scale(1.25) rotate(10deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.star-pop-1 { animation: star-pop 0.5s 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) both; }
.star-pop-2 { animation: star-pop 0.5s 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both; }
.star-pop-3 { animation: star-pop 0.5s 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) both; }

/* Confetti canvas */
#confettiCanvas {
  pointer-events: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
}

/* Pulse border */
@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  50% { box-shadow: 0 0 0 12px rgba(16, 185, 129, 0); }
}

/* Shake wrong animation */
@keyframes shake-wrong {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
.shake {
  animation: shake-wrong 0.45s ease-in-out;
}
