@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700;900&family=Crimson+Text:ital,wght@0,400;0,600;1,400;1,600&display=swap');

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

:root {
  --bg: #020c18;
  --primary-glow: #0a3d6b;
  --accent: #1a6fa8;
  --bubble: rgba(100, 200, 255, 0.6);
  --text: #c8e8ff;
  --title-glow: #4dc3ff;
}

html, body {
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) var(--bg);
}

body {
  min-height: 100vh;
  position: relative;
  cursor: none;
}

/* ── Blub background layer ── */
#blub-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  user-select: none;
}

.blub-word {
  position: absolute;
  font-family: 'Crimson Text', serif;
  white-space: nowrap;
  line-height: 1;
  pointer-events: none;
}

/* ── Main page wrapper ── */
#page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── Title section ── */
#hero {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 10vh 2rem 4vh;
  flex-shrink: 0;
}

#main-title {
  font-family: 'Cinzel', serif;
  font-weight: 900;
  font-size: clamp(2.8rem, 9vw, 8rem);
  color: var(--title-glow);
  letter-spacing: 0.06em;
  text-shadow:
    0 0 10px rgba(77, 195, 255, 0.9),
    0 0 25px rgba(77, 195, 255, 0.7),
    0 0 55px rgba(77, 195, 255, 0.5),
    0 0 100px rgba(10, 61, 107, 0.8);
  animation: titlePulse 4s ease-in-out infinite;
  line-height: 1.1;
}

@keyframes titlePulse {
  0%, 100% {
    text-shadow:
      0 0 10px rgba(77, 195, 255, 0.9),
      0 0 25px rgba(77, 195, 255, 0.7),
      0 0 55px rgba(77, 195, 255, 0.5),
      0 0 100px rgba(10, 61, 107, 0.8);
    opacity: 1;
  }
  50% {
    text-shadow:
      0 0 15px rgba(77, 195, 255, 1),
      0 0 40px rgba(77, 195, 255, 0.9),
      0 0 80px rgba(77, 195, 255, 0.7),
      0 0 140px rgba(26, 111, 168, 0.9);
    opacity: 0.92;
  }
}

#subtitle {
  font-family: 'Crimson Text', serif;
  font-style: italic;
  font-size: clamp(1.1rem, 3vw, 2rem);
  color: var(--text);
  margin-top: 0.6em;
  letter-spacing: 0.12em;
  animation: shimmer 6s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% {
    opacity: 0.7;
    text-shadow: 0 0 8px rgba(77, 195, 255, 0.2);
    color: #c8e8ff;
  }
  25% {
    opacity: 1;
    text-shadow: 0 0 20px rgba(77, 195, 255, 0.6), 0 0 40px rgba(77, 195, 255, 0.3);
    color: #e8f8ff;
  }
  50% {
    opacity: 0.75;
    text-shadow: 0 0 5px rgba(77, 195, 255, 0.1);
    color: #a8d8ef;
  }
  75% {
    opacity: 0.95;
    text-shadow: 0 0 15px rgba(100, 200, 255, 0.5), 0 0 30px rgba(26, 111, 168, 0.3);
    color: #d8f0ff;
  }
}

/* ── Blub mode: title shakes ── */
body.blub-active #main-title {
  animation: titlePulse 4s ease-in-out infinite, titleShake 0.08s linear infinite;
}

@keyframes titleShake {
  0%   { transform: translate(0, 0) rotate(0deg); }
  15%  { transform: translate(-3px, 1px) rotate(-0.5deg); }
  30%  { transform: translate(3px, -1px) rotate(0.5deg); }
  45%  { transform: translate(-2px, 2px) rotate(-0.3deg); }
  60%  { transform: translate(2px, -2px) rotate(0.3deg); }
  75%  { transform: translate(-1px, 1px) rotate(-0.2deg); }
  90%  { transform: translate(1px, -1px) rotate(0.2deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

/* ── Three.js canvas container ── */
#threejs-container {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 60vh;
  margin-top: auto;
  pointer-events: none;
  flex-shrink: 0;
  overflow: hidden;
}

/* Do NOT override width/height here — Three.js manages the canvas size */
#threejs-container canvas {
  display: block;
}

#three-status {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Crimson Text', serif;
  font-size: 0.85rem;
  color: rgba(77, 195, 255, 0.5);
  pointer-events: none;
  z-index: 5;
  white-space: nowrap;
}

/* ── Cursor bubble trail ── */
.cursor-bubble {
  position: fixed;
  border-radius: 50%;
  background: var(--bubble);
  pointer-events: none;
  z-index: 9999;
  box-shadow: 0 0 4px rgba(100, 200, 255, 0.4);
  animation: bubbleRise 1.2s ease-out forwards;
}

@keyframes bubbleRise {
  0% {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(1);
  }
  60% {
    opacity: 0.5;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, calc(-50% - 40px)) scale(0.3);
  }
}

/* ── Custom cursor dot ── */
#cursor-dot {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(77, 195, 255, 0.9);
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 6px rgba(77, 195, 255, 0.8);
  transition: transform 0.05s linear;
}

/* ── Swimming fish ── */
.swimming-fish {
  position: fixed;
  z-index: 3;
  pointer-events: none;
  font-size: 20px;
  opacity: 0.4;
  white-space: nowrap;
  transition: left 8s linear, opacity 1s ease;
  color: var(--text);
  text-shadow: 0 0 6px rgba(77, 195, 255, 0.5);
}

/* ── Blub Mode button ── */
#blub-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  background: linear-gradient(135deg, var(--primary-glow) 0%, var(--accent) 100%);
  color: var(--title-glow);
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 0.75rem 1.4rem;
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  box-shadow:
    0 0 12px rgba(26, 111, 168, 0.5),
    0 0 30px rgba(10, 61, 107, 0.3),
    inset 0 0 10px rgba(0,0,0,0.3);
  transition: all 0.2s ease;
  text-shadow: 0 0 8px rgba(77, 195, 255, 0.7);
}

#blub-btn:hover {
  box-shadow:
    0 0 20px rgba(77, 195, 255, 0.7),
    0 0 50px rgba(26, 111, 168, 0.5),
    inset 0 0 10px rgba(0,0,0,0.3);
  transform: scale(1.05);
  border-color: var(--title-glow);
}

#blub-btn.active {
  background: linear-gradient(135deg, #6b0a0a 0%, #a83a1a 100%);
  border-color: #ff6030;
  color: #ffcc88;
  text-shadow: 0 0 8px rgba(255, 120, 50, 0.9);
  box-shadow:
    0 0 20px rgba(255, 80, 20, 0.7),
    0 0 50px rgba(180, 40, 10, 0.5),
    inset 0 0 10px rgba(0,0,0,0.3);
  animation: btnPulse 0.6s ease-in-out infinite;
}

@keyframes btnPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 80, 20, 0.7), 0 0 50px rgba(180, 40, 10, 0.5), inset 0 0 10px rgba(0,0,0,0.3); }
  50%       { box-shadow: 0 0 35px rgba(255, 120, 50, 0.9), 0 0 80px rgba(220, 60, 10, 0.7), inset 0 0 10px rgba(0,0,0,0.3); }
}

/* ── Spacer so canvas sits at bottom ── */
#spacer {
  flex: 1;
  min-height: 10vh;
}
