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

html {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html::-webkit-scrollbar {
  display: none;
}

body {
  font-family: 'Space Grotesk', sans-serif;
  background: #0077be;
  color: #fff;
  overflow-x: hidden;
  min-height: 100vh;
}

.back-link {
  position: fixed;
  top: 16px;
  left: 16px;
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  opacity: 0.25;
  z-index: 100;
  transition: opacity 0.3s;
  font-family: 'Space Grotesk', sans-serif;
}

.back-link:hover {
  opacity: 0.6;
}

#ocean {
  position: relative;
  width: 100%;
}

/* ── Discovery counter ── */
#discovery-counter {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #fff;
  opacity: 0.45;
  z-index: 100;
  letter-spacing: 1.5px;
  user-select: none;
  padding: 8px 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.3s, transform 0.3s;
}

#discovery-counter:hover {
  opacity: 0.7;
}

#discovery-counter.complete {
  opacity: 0.7;
  border-color: rgba(255, 255, 255, 0.25);
}

/* ── Minimap ── */
#minimap {
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 60vh;
  z-index: 100;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.minimap-dot {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(100, 200, 255, 0.25);
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 2;
}

.minimap-dot:hover {
  width: 12px;
  height: 12px;
  background: rgba(100, 200, 255, 0.8);
}

/* Undiscovered dots pulse */
.minimap-dot:not(.found) {
  animation: minimapPulse 2s ease-in-out infinite;
}

.minimap-dot.found {
  background: rgba(100, 255, 180, 0.6);
  width: 6px;
  height: 6px;
}

.minimap-dot.found:hover {
  width: 10px;
  height: 10px;
  background: rgba(100, 255, 180, 0.9);
}

.minimap-dot.nearby {
  width: 10px;
  height: 10px;
  background: rgba(100, 200, 255, 0.7);
  box-shadow: 0 0 8px rgba(100, 200, 255, 0.4);
}

.minimap-dot.nearby.found {
  background: rgba(100, 255, 180, 0.8);
  box-shadow: 0 0 8px rgba(100, 255, 180, 0.4);
}

@keyframes minimapPulse {
  0%, 100% { opacity: 0.4; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.4); }
}

.minimap-thumb {
  position: absolute;
  left: -3px;
  width: 26px;
  height: 4px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 2px;
  transform: translateY(-50%);
  transition: top 0.1s linear;
  z-index: 1;
}

/* ── Next signal indicator ── */
#next-signal {
  position: fixed;
  bottom: 64px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 300;
  color: rgba(100, 200, 255, 0.9);
  opacity: 0.35;
  z-index: 100;
  letter-spacing: 1px;
  user-select: none;
  white-space: nowrap;
  transition: opacity 0.3s;
}

#next-signal.hidden {
  display: none;
}

.signal-arrow {
  display: inline-block;
  animation: arrowBounce 1.5s ease-in-out infinite;
  font-size: 14px;
}

@keyframes arrowBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

/* ── Proximity warning ── */
#proximity-warning {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  transition: opacity 0.5s ease;
  border: 2px solid transparent;
}

#proximity-warning.active {
  animation: proximityGlow 1.5s ease-in-out infinite;
}

@keyframes proximityGlow {
  0%, 100% {
    box-shadow: inset 0 0 60px rgba(100, 200, 255, 0.08);
  }
  50% {
    box-shadow: inset 0 0 100px rgba(100, 200, 255, 0.15);
  }
}

/* ── Depth indicator ── */
.depth-indicator {
  position: fixed;
  top: 20px;
  right: 48px;
  font-family: 'Space Grotesk', monospace;
  font-size: 18px;
  font-weight: 300;
  color: #fff;
  opacity: 0.4;
  z-index: 100;
  letter-spacing: 1px;
  user-select: none;
}

/* ── Opening title ── */
.title-card {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  user-select: none;
}

.title-card h1 {
  font-size: clamp(48px, 10vw, 96px);
  font-weight: 300;
  letter-spacing: 8px;
  text-transform: uppercase;
  opacity: 0.9;
}

.title-card .expedition-subtitle {
  font-size: clamp(14px, 3vw, 18px);
  font-weight: 300;
  opacity: 0.3;
  margin-top: 8px;
  letter-spacing: 5px;
  text-transform: uppercase;
}

.title-card .subtitle {
  font-size: 14px;
  font-weight: 300;
  opacity: 0.35;
  margin-top: 24px;
  letter-spacing: 3px;
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.5; }
}

/* ── Sonar sweep background ── */
.sonar-sweep {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 200vmax;
  height: 200vmax;
  margin-top: -100vmax;
  margin-left: -100vmax;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    transparent 340deg,
    rgba(100, 200, 255, 0.15) 355deg,
    transparent 360deg
  );
  animation: sonarRotate 6s linear infinite;
  border-radius: 50%;
}

@keyframes sonarRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ── Light rays ── */
.light-rays {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.light-ray {
  position: absolute;
  top: -20%;
  width: 2px;
  height: 140%;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.12) 0%,
    rgba(255, 255, 255, 0.03) 60%,
    transparent 100%
  );
  transform-origin: top center;
}

/* ── Particles (marine snow) ── */
.particle {
  position: fixed;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #fff;
  pointer-events: none;
  z-index: 2;
}

/* ── Creature entries ── */
.creature {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  max-width: 500px;
  width: 90%;
  opacity: 0;
  transition: opacity 0.8s ease;
  pointer-events: none;
  z-index: 10;
}

.creature.visible {
  opacity: 1;
}

/* Make undiscovered creatures clickable */
.creature.visible.undiscovered {
  pointer-events: auto;
  cursor: pointer;
}

/* Discovered creatures are not clickable */
.creature.discovered {
  pointer-events: none;
}

.creature .emoji {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
}

.creature .name {
  font-size: clamp(24px, 5vw, 36px);
  font-weight: 500;
  letter-spacing: 2px;
  opacity: 0.95;
  margin-bottom: 6px;
}

.creature .depth-label {
  font-size: 12px;
  font-weight: 300;
  opacity: 0.3;
  letter-spacing: 2px;
  margin-bottom: 14px;
  text-transform: uppercase;
}

.creature .fact {
  font-size: clamp(14px, 3vw, 18px);
  font-weight: 300;
  opacity: 0.55;
  line-height: 1.6;
  letter-spacing: 0.5px;
}

/* ── Undiscovered state — BIGGER and more visible ── */
.sonar-blip-container {
  position: relative;
  display: inline-block;
  margin-bottom: 16px;
}

.creature.undiscovered .emoji.sonar-blip {
  font-size: 36px;
  width: 80px;
  height: 80px;
  line-height: 80px;
  margin: 0 auto;
  border-radius: 50%;
  border: 2px solid rgba(100, 200, 255, 0.4);
  background: rgba(100, 200, 255, 0.08);
  display: block;
  color: rgba(100, 200, 255, 0.8);
  position: relative;
  z-index: 2;
  animation: sonarBlipGlow 2s ease-in-out infinite;
}

@keyframes sonarBlipGlow {
  0%, 100% {
    border-color: rgba(100, 200, 255, 0.3);
    background: rgba(100, 200, 255, 0.06);
    box-shadow: 0 0 20px rgba(100, 200, 255, 0.05);
  }
  50% {
    border-color: rgba(100, 200, 255, 0.7);
    background: rgba(100, 200, 255, 0.12);
    box-shadow: 0 0 40px rgba(100, 200, 255, 0.15);
  }
}

/* Animated expanding rings around sonar blip */
.sonar-rings {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  pointer-events: none;
  z-index: 1;
}

.sonar-rings .ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(100, 200, 255, 0.3);
  animation: ringExpand 3s ease-out infinite;
}

.sonar-rings .ring.r1 { animation-delay: 0s; }
.sonar-rings .ring.r2 { animation-delay: 1s; }
.sonar-rings .ring.r3 { animation-delay: 2s; }

@keyframes ringExpand {
  0% {
    width: 80px;
    height: 80px;
    opacity: 0.5;
    border-width: 2px;
  }
  100% {
    width: 200px;
    height: 200px;
    opacity: 0;
    border-width: 1px;
  }
}

.creature.undiscovered .name {
  opacity: 0.5;
  font-weight: 300;
  font-size: clamp(18px, 4vw, 24px);
  letter-spacing: 3px;
  color: rgba(100, 200, 255, 0.8);
}

.creature.undiscovered .fact.tap-hint {
  opacity: 0.35;
  font-size: 14px;
  letter-spacing: 1.5px;
  color: rgba(100, 200, 255, 0.6);
  animation: tapHintPulse 2s ease-in-out infinite;
}

@keyframes tapHintPulse {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.5; }
}

/* ── Pinging state ── */
.creature.pinging .emoji.sonar-blip {
  animation: none;
  border-color: rgba(100, 200, 255, 0.8);
  background: rgba(100, 200, 255, 0.2);
  box-shadow: 0 0 30px rgba(100, 200, 255, 0.3);
}

.creature.pinging .sonar-rings .ring {
  animation: none;
  opacity: 0;
}

.creature.pinging .name {
  opacity: 0.7;
  color: rgba(100, 200, 255, 1);
}

/* ── Ping ring effect ── */
.ping-ring {
  position: fixed;
  width: 0;
  height: 0;
  border-radius: 50%;
  border: 2px solid rgba(100, 200, 255, 0.6);
  pointer-events: none;
  z-index: 50;
  transform: translate(-50%, -50%);
  opacity: 0;
}

.ping-ring.animate {
  animation: pingExpand 0.7s ease-out forwards;
}

@keyframes pingExpand {
  0% {
    width: 0;
    height: 0;
    opacity: 0.8;
    border-width: 2px;
  }
  100% {
    width: 160px;
    height: 160px;
    opacity: 0;
    border-width: 1px;
  }
}

/* ── Discovered state transition ── */
.creature.discovered .emoji {
  animation: revealFadeIn 0.5s ease-out;
}

.creature.discovered .name {
  animation: revealFadeIn 0.5s ease-out 0.1s both;
}

.creature.discovered .fact {
  animation: revealFadeIn 0.5s ease-out 0.2s both;
}

@keyframes revealFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Zone labels ── */
.zone-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  opacity: 0;
  transition: opacity 1.2s ease;
  pointer-events: none;
  z-index: 5;
}

.zone-label.visible {
  opacity: 1;
}

.zone-label .zone-name {
  font-size: clamp(14px, 3vw, 18px);
  font-weight: 300;
  letter-spacing: 6px;
  text-transform: uppercase;
  opacity: 0.15;
}

.zone-line {
  width: 40px;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 12px auto 0;
}

/* The bottom */
.creature.bottom .name {
  font-size: clamp(28px, 6vw, 44px);
  font-weight: 300;
}

.creature.bottom .fact {
  opacity: 0.4;
  max-width: 400px;
  margin: 0 auto;
}

/* ── Mobile ── */
@media (max-width: 600px) {
  .depth-indicator {
    font-size: 14px;
    top: 14px;
    right: 40px;
  }

  .back-link {
    top: 12px;
    left: 12px;
    font-size: 12px;
  }

  .creature .emoji {
    font-size: 36px;
  }

  .creature.undiscovered .emoji.sonar-blip {
    width: 64px;
    height: 64px;
    line-height: 64px;
    font-size: 28px;
  }

  .sonar-rings {
    width: 64px;
    height: 64px;
  }

  .sonar-rings .ring {
    animation-name: ringExpandMobile;
  }

  @keyframes ringExpandMobile {
    0% {
      width: 64px;
      height: 64px;
      opacity: 0.5;
    }
    100% {
      width: 160px;
      height: 160px;
      opacity: 0;
    }
  }

  #discovery-counter {
    font-size: 12px;
    bottom: 16px;
    padding: 6px 16px;
  }

  #next-signal {
    font-size: 11px;
    bottom: 50px;
  }

  #minimap {
    right: 8px;
    width: 16px;
    height: 50vh;
  }

  .minimap-dot {
    width: 6px;
    height: 6px;
  }

  .minimap-dot.found {
    width: 5px;
    height: 5px;
  }
}
