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

:root {
  --wood-dark: #654321;
  --wood-med: #8B6914;
  --wood-light: #D2691E;
  --fish-green: #2E8B57;
  --fish-light: #3CB371;
  --red-btn: #CC0000;
  --red-btn-hover: #FF0000;
  --brass: #B8860B;
  --brass-light: #DAA520;
  --cream: #F5F5DC;
  --bg-wall: #3a2f25;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg-wall);
  font-family: 'Crimson Pro', serif;
}

#scene-container {
  position: fixed;
  inset: 0;
  z-index: 1;
}

#header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  text-align: center;
  padding: 10px 16px 6px;
  background: linear-gradient(180deg, rgba(40,28,15,0.95) 0%, rgba(40,28,15,0.6) 80%, transparent 100%);
  pointer-events: none;
}

#header h1 {
  font-family: 'Bungee', cursive;
  font-size: clamp(1.2rem, 4vw, 2rem);
  color: var(--brass-light);
  text-shadow: 0 2px 8px rgba(0,0,0,0.6), 0 0 20px rgba(218,165,32,0.3);
  letter-spacing: 0.05em;
}

#header .subtitle {
  font-family: 'Fredoka One', cursive;
  font-size: clamp(0.7rem, 2vw, 1rem);
  color: var(--cream);
  opacity: 0.7;
  margin-top: 2px;
}

#ui-overlay {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px 20px;
  background: linear-gradient(0deg, rgba(40,28,15,0.95) 0%, rgba(40,28,15,0.7) 60%, transparent 100%);
  pointer-events: none;
}

#ui-overlay > * { pointer-events: auto; }

#song-selector {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 12px;
}

.song-btn {
  font-family: 'Crimson Pro', serif;
  font-size: 0.75rem;
  padding: 5px 10px;
  border: 2px solid var(--wood-med);
  border-radius: 4px;
  background: linear-gradient(180deg, #5a4630 0%, #3a2f25 100%);
  color: var(--cream);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1);
}

.song-btn:hover {
  background: linear-gradient(180deg, #6a5640 0%, #4a3f35 100%);
  border-color: var(--brass);
}

.song-btn.active {
  background: linear-gradient(180deg, var(--wood-med) 0%, var(--wood-dark) 100%);
  border-color: var(--brass-light);
  color: var(--brass-light);
  box-shadow: 0 0 10px rgba(218,165,32,0.3), 0 2px 4px rgba(0,0,0,0.4);
}

#activate-btn {
  width: clamp(100px, 30vw, 140px);
  height: clamp(100px, 30vw, 140px);
  border-radius: 50%;
  border: 6px solid #990000;
  background: radial-gradient(circle at 35% 35%, #ff3333 0%, var(--red-btn) 50%, #880000 100%);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow:
    0 6px 20px rgba(0,0,0,0.6),
    0 0 30px rgba(204,0,0,0.3),
    inset 0 -4px 10px rgba(0,0,0,0.4),
    inset 0 4px 10px rgba(255,255,255,0.15);
  transition: all 0.15s;
  position: relative;
  margin-bottom: 10px;
}

#activate-btn:hover {
  background: radial-gradient(circle at 35% 35%, #ff4444 0%, var(--red-btn-hover) 50%, #990000 100%);
  box-shadow:
    0 6px 25px rgba(0,0,0,0.7),
    0 0 40px rgba(255,0,0,0.4),
    inset 0 -4px 10px rgba(0,0,0,0.4),
    inset 0 4px 10px rgba(255,255,255,0.2);
}

#activate-btn:active, #activate-btn.pressed {
  transform: scale(0.93) translateY(3px);
  box-shadow:
    0 2px 10px rgba(0,0,0,0.6),
    0 0 15px rgba(204,0,0,0.2),
    inset 0 4px 10px rgba(0,0,0,0.5);
}

#activate-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.btn-icon {
  font-size: clamp(1.5rem, 6vw, 2.5rem);
  line-height: 1;
}

.btn-text {
  font-family: 'Bungee', cursive;
  font-size: clamp(0.6rem, 2vw, 0.9rem);
  color: white;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  letter-spacing: 0.1em;
}

#volume-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--cream);
  opacity: 0.7;
}

#vol-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100px;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--wood-dark), var(--brass));
  outline: none;
}

#vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--brass-light);
  border: 2px solid var(--wood-dark);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

#lyrics-display {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 50;
  font-family: 'Fredoka One', cursive;
  font-size: clamp(1.2rem, 5vw, 2.5rem);
  color: var(--brass-light);
  text-shadow: 0 2px 10px rgba(0,0,0,0.8), 0 0 30px rgba(218,165,32,0.4);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  max-width: 80vw;
}

#lyrics-display.visible {
  opacity: 1;
  animation: lyric-bounce 0.4s ease;
}

@keyframes lyric-bounce {
  0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
  50% { transform: translate(-50%, -50%) scale(1.1); }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

#info-btn {
  position: fixed;
  top: 12px; right: 12px;
  z-index: 200;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(40,28,15,0.8);
  border: 2px solid var(--brass);
  color: var(--brass-light);
  font-family: 'Bungee', cursive;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

#info-btn:hover {
  background: rgba(60,48,35,0.9);
  box-shadow: 0 0 10px rgba(218,165,32,0.3);
}

#info-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
}

#info-modal.hidden { display: none; }

.modal-content {
  background: linear-gradient(180deg, #4a3f30 0%, #2a1f15 100%);
  border: 3px solid var(--brass);
  border-radius: 12px;
  padding: 24px;
  max-width: 360px;
  text-align: center;
  color: var(--cream);
  box-shadow: 0 10px 40px rgba(0,0,0,0.6), 0 0 20px rgba(218,165,32,0.2);
}

.modal-content p { margin-bottom: 12px; line-height: 1.5; }

.modal-content button {
  font-family: 'Bungee', cursive;
  padding: 8px 24px;
  border: 2px solid var(--brass);
  border-radius: 6px;
  background: linear-gradient(180deg, var(--wood-med), var(--wood-dark));
  color: var(--brass-light);
  cursor: pointer;
  font-size: 0.9rem;
  margin-top: 8px;
}

#dark-mode-toggle {
  position: fixed;
  top: 12px; left: 12px;
  z-index: 200;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(40,28,15,0.8);
  border: 2px solid var(--brass);
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

#dark-mode-toggle:hover {
  background: rgba(60,48,35,0.9);
}

footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 90;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 12px;
  pointer-events: none;
}

footer a, footer span {
  pointer-events: auto;
  color: rgba(184,134,11,0.5);
  font-size: 0.65rem;
  text-decoration: none;
  font-family: 'Crimson Pro', serif;
}

footer a:hover { color: var(--brass-light); }

/* Bubble particles */
.bubble {
  position: fixed;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(150,200,255,0.4), rgba(100,180,255,0.1));
  border: 1px solid rgba(150,200,255,0.2);
  pointer-events: none;
  z-index: 60;
  animation: bubble-rise 2s ease-out forwards;
}

@keyframes bubble-rise {
  0% { transform: translateY(0) scale(1); opacity: 0.8; }
  100% { transform: translateY(-200px) scale(0.3); opacity: 0; }
}

/* Haunted mode */
body.haunted {
  --bg-wall: #0a0f0a;
}

body.haunted #header {
  background: linear-gradient(180deg, rgba(5,15,5,0.95) 0%, rgba(5,15,5,0.6) 80%, transparent 100%);
}

body.haunted #ui-overlay {
  background: linear-gradient(0deg, rgba(5,15,5,0.95) 0%, rgba(5,15,5,0.7) 60%, transparent 100%);
}

body.haunted #header h1 {
  color: #4a8a4a;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8), 0 0 20px rgba(0,180,0,0.3);
}

body.haunted .song-btn {
  background: linear-gradient(180deg, #1a2a1a 0%, #0a150a 100%);
  border-color: #2a4a2a;
}

body.haunted .song-btn.active {
  border-color: #4a8a4a;
  color: #6aba6a;
}

body.haunted #lyrics-display {
  color: #4a8a4a;
  text-shadow: 0 2px 10px rgba(0,0,0,0.9), 0 0 30px rgba(0,180,0,0.4);
}