/* === SPLASH SCREEN === */
#splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    180deg,
    rgba(26, 28, 44, 0.95),
    rgba(17, 20, 30, 0.95)
  );
  z-index: 10001;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

#splash-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.splash-content {
  text-align: center;
  max-width: 760px;
  padding: 40px;
  border: 4px solid var(--panel-border);
}

.splash-content h1 {
  font-size: 48px;
  color: var(--primary);
  margin-bottom: 10px;
}

.splash-content p {
  font-size: 20px;
  color: var(--text-light);
  margin-bottom: 24px;
}

.splash-btn {
  font-family: "VT323", monospace;
  font-size: 26px;
  padding: 12px 28px;
  background: var(--accent);
  color: var(--text-light);
  border: 4px solid var(--text-light);
  cursor: pointer;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.35);
}

.splash-btn:active {
  transform: translate(4px, 4px);
  box-shadow: none;
}

/* === OPENING STORY (Subtitle) === */
/* Under the top letterbox bar (V6): the bike rides along the bottom and must stay in view. */
#opening-story {
  position: fixed;
  top: max(calc(clamp(24px, 9vh, 80px) + 12px), 72px); /* and below the Quick View button */
  left: 50%;
  transform: translateX(-50%);
  max-width: 92%;
  display: block;
  background: rgba(8, 10, 16, 0.64);
  border: 2px solid var(--panel-border);
  padding: 12px 18px;
  z-index: 10002;
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
  opacity: 1;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.35);
}

#opening-story.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-8px);
}

.opening-content {
  text-align: center;
}

.opening-content .story-line {
  font-size: 18px;
  color: var(--text-light);
  margin: 6px 0;
}

.skip-intro-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10003; /* above the opening subtitle */
  padding: 6px 16px;
  font-family: "VT323", monospace;
  font-size: 22px;
  color: var(--text-light);
  background: rgba(8, 10, 16, 0.8);
  border: 3px solid var(--text-light);
  cursor: pointer;
}

/* === CINEMA: letterbox + chapter title card (V5, V6) === */
/* Body-level, above #fade-overlay (3000) and below the loader/splash/opening layers.
   Toggled with .is-on, never .hidden (the global .hidden rule is display:none). */
.letterbox {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3100;
}

.letterbox-bar {
  position: absolute;
  left: 0;
  right: 0;
  background: #000;
  transition: transform 0.5s ease;
}

.letterbox-bar--top {
  top: 0;
  height: clamp(24px, 9vh, 80px);
  transform: translateY(-100%);
}

/* Thin at the bottom: the bike sprite ends 30 px above the canvas bottom. */
.letterbox-bar--bottom {
  bottom: 0;
  height: clamp(12px, 3vh, 26px);
  transform: translateY(100%);
}

.letterbox.is-on .letterbox-bar {
  transform: translateY(0);
}

.title-card {
  position: fixed;
  left: 50%;
  top: 22%;
  width: max-content;
  max-width: 92vw;
  padding: 10px 24px 12px;
  text-align: center;
  /* A dark pane keeps the text readable over the busy forest layers. */
  background: rgba(20, 22, 30, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.15);
  pointer-events: none;
  z-index: 3200;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.title-card.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.title-card-name {
  font-family: "VT323", monospace;
  font-size: clamp(28px, 7.5vmin, 56px);
  line-height: 1;
  color: var(--text-light);
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.6);
}

.title-card-sub {
  margin-top: 6px;
  font-family: "VT323", monospace;
  font-size: clamp(18px, 4.6vmin, 26px);
  color: var(--primary);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.6);
}

/* Landscape phones: the card sits just under the Quick View button and clears the
   interaction prompt (top 40%) and the bike. */
@media (max-height: 500px) {
  .title-card {
    top: 64px;
  }
}

/* Reduced motion: no bars; the title text only fades (V5). */
@media (prefers-reduced-motion: reduce) {
  .letterbox {
    display: none;
  }

  .title-card,
  .title-card.is-on {
    transform: translate(-50%, 0);
    transition: opacity 0.5s ease;
  }
}
