#emailBlock {
  display: none;
  position: absolute;
  left: 0;
  bottom: 5vh; /* viewport unit keeps a consistent gap on different screen sizes */
  width: 100%;
  text-align: center;
  color: cyan;
  z-index: 20; /* make sure the email block sits above the splash title */
  font-size: 1em;
  opacity: 0;
  transition: opacity 1s;
  pointer-events: auto;
  box-sizing: border-box;
  padding: 0 1rem; /* prevent touching the viewport edges */
}

/* make the inner layout resilient so inputs/buttons wrap instead of overlapping the title */
#emailBlock .inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  max-width: 900px;
  width: calc(100% - 2rem);
}

/* ensure fadeIn still works */
#emailBlock.fadeIn {
  display: block;
  opacity: 1;
}

#emailBlock input,
#emailBlock button {
  padding: 10px;
  font-size: 1em;
  border-radius: 6px;
  border: none;
  margin: 5px;
  box-sizing: border-box;
}

#emailBlock input {
  background: rgba(0, 0, 0, 0.6);
  color: cyan;
  border: 1px solid cyan;
  width: 250px;
  max-width: 60vw;
}

#emailBlock button {
  background: cyan;
  color: black;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s ease;
}

#emailBlock button:hover {
  background: #00ffff;
}

.fadeIn {
  display: block;
  animation: fadeOnly 2s ease forwards;
}

@keyframes fadeOnly {
  from { opacity: 0; }
  to { opacity: 1; }
}

body {
  margin: 0;
  background: black;
  font-family: 'Segoe UI', sans-serif;
  overflow: hidden;
}

/* Position the splash title above the email block using viewport units.
   Use clamp() + a max-width and line-height to avoid multi-line wrapping that pushes down into the email block. */
#splashTitle {
  position: absolute;
  top: 30vh; /* move title higher so it doesn't collide with the email block */
  width: 100%;
  text-align: center;
  font-size: clamp(1.2em, 3.5vw, 2.2em); /* responsive sizing to avoid wrapping/overlap */
  font-weight: bold;
  color: cyan;
  z-index: 10;
  text-shadow: 0 0 10px cyan;
  opacity: 0;
  line-height: 1.05;
  padding: 0 1rem; /* small horizontal padding to avoid touching edges */
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  left: 0;
  right: 0;
}

/* small neatness: keep text from growing too tall and pushing down */
#splashTitle p, #splashTitle h1, #splashTitle span {
  margin: 0;
  word-break: break-word;
}

/* subtle fade animation class */
.fade {
  animation: fadeInOut 6s ease-in-out;
}

@keyframes fadeInOut {
  0%   { opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { opacity: 0; }
}

canvas#starMap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
}

/* Responsive adjustments for short/tall screens to prevent overlap between title and email block */
@media (max-height: 700px) {
  #splashTitle {
    top: 22vh; /* move title higher on short screens */
    font-size: clamp(1em, 3.5vh, 1.6em);
  }

  #emailBlock {
    bottom: 3vh;
    font-size: 0.95em;
  }

  /* make sure the email block uses less vertical space when height is constrained */
  #emailBlock .inner {
    gap: 0.25rem;
  }

  #emailBlock input {
    width: 180px;
    max-width: 50vw;
  }
}

/* On narrow screens stack inputs vertically to avoid horizontal overflow/overlap */
@media (max-width: 420px) {
  #emailBlock .inner {
    flex-direction: column;
    align-items: stretch;
  }

  #emailBlock input,
  #emailBlock button {
    width: 100%;
    max-width: none;
  }

  #splashTitle {
    top: 18vh;
    font-size: 1.1em;
  }
}

/* On very large screens allow the title to sit slightly higher for better balance */
@media (min-width: 1200px) and (min-height: 800px) {
  #splashTitle {
    top: 28vh;
    font-size: clamp(1.6em, 2.2vw, 2.6em);
  }
}
