* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  background: linear-gradient(to bottom, #87CEEB, #E0F0FF);
  font-family: 'Trebuchet MS', sans-serif;
}

.screen {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.screen.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.hidden {
  display: none !important;
}

/* Wooden plank button */
.btn-wood {
  background: linear-gradient(to bottom, #D2A050, #A07030);
  color: #fff;
  border: 3px solid #7A5020;
  border-radius: 12px;
  padding: 14px 40px;
  font-size: 1.5rem;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.4);
  cursor: pointer;
  letter-spacing: 2px;
  margin-top: 20px;
}

.btn-wood:active {
  transform: scale(0.95);
}

/* HUD */
#hud {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  font-size: 1.5rem;
  font-weight: bold;
  color: #333;
}

#lives {
  display: flex;
  gap: 6px;
}

#btn-pause {
  background: rgba(0, 0, 0, 0.25);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  padding: 8px 12px;
}

#btn-pause:active {
  background: rgba(0, 0, 0, 0.4);
}

#btn-pause svg {
  display: block;
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

/* Game area */
#game-area {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/* Pause overlay */
#pause-overlay {
  background: rgba(0, 0, 0, 0.6);
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-align: center;
  gap: 10px;
  z-index: 50;
}

#pause-overlay h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

/* Game over overlay */
#gameover-overlay {
  background: rgba(0, 0, 0, 0.6);
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-align: center;
  gap: 10px;
}

#gameover-overlay h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

#btn-back {
  color: #ccc;
  font-size: 0.9rem;
  margin-top: 10px;
}

/* Totem */
#totem-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 70vh;
}

#totem-svg {
  max-height: 65vh;
  width: auto;
}

.totem-head {
  transition: transform 0.1s;
}

.totem-head.tapped .totem-pupil {
  animation: pupil-bounce 0.5s ease-out;
}

@keyframes pupil-bounce {
  0% { transform: scale(1); }
  30% { transform: scale(1.4); }
  60% { transform: scale(0.7); }
  100% { transform: scale(1); }
}

.totem-pupil {
  transform-origin: center;
  transform-box: fill-box;
}

.totem-head.tapped {
  animation: head-shake 0.5s ease-out;
}

@keyframes head-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

.propeller {
  animation: spin 0.15s linear infinite;
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.drone-led {
  animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
  50% { opacity: 0.2; }
}

.dreamcatcher {
  position: absolute;
  pointer-events: none;
  z-index: 5;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.heart {
  font-size: 1.5rem;
  transition: transform 0.2s;
}

.heart-lost {
  animation: heart-shake 0.4s ease-out;
}

@keyframes heart-shake {
  0%, 100% { transform: translateY(0); }
  25% { transform: translateY(-6px); }
  50% { transform: translateY(4px); }
  75% { transform: translateY(-2px); }
}

.drone-caught {
  animation: caught 0.3s ease-out forwards;
  pointer-events: none;
}

@keyframes caught {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.2); opacity: 0; }
}

.cloud {
  position: absolute;
  z-index: 0;
  pointer-events: none;
  animation: drift linear infinite;
}

@keyframes drift {
  from { transform: translateX(-150px); }
  to { transform: translateX(calc(100vw + 150px)); }
}

/* Sound toggle */
#btn-sound {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  opacity: 0.7;
}

#btn-sound:active {
  opacity: 1;
}

#btn-sound svg {
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

#score {
  transition: transform 0.15s;
}

#score.bump {
  transform: scale(1.3);
}
