/* ---------- GAMEPLAY INTRO BACKGROUND OVERLAY ---------- */
#gameplay-intro-overlay {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(0, 0, 0, 0.45);
  pointer-events: none;
  opacity: 1;
}

#gameplay-intro-overlay.is-leaving {
  opacity: 0 !important;
  transition: opacity 0.3s ease;
}

/* Hide floating stage control buttons (sound + screenshot) while intro bubble is active */
body.has-intro-active #btn-share-stage,
body.has-intro-active #btn-sound,
body.has-intro-active #mobile-stage-btns,
body.has-intro-active .mobile-stage-btns {
  display: none !important;
}

/* ---------- GAMEPLAY INTRO DIALOGUE BAR (RPG STYLE) ---------- */
#gameplay-intro-bubble {
  position: absolute;
  left: 50%;
  bottom: clamp(16px, 3.5vh, 32px);
  transform: translateX(-50%) translateY(16px) scale(0.98);
  transform-origin: center bottom;
  z-index: 25;
  width: min(540px, calc(100% - 32px));
  display: flex;
  flex-direction: column;
  padding: 14px 18px;
  background: rgba(24, 14, 38, 0.88);
  border: 1.5px solid rgba(219, 125, 255, 0.45);
  border-radius: 20px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 20px rgba(219, 125, 255, 0.15);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #fff;
  pointer-events: none;
  opacity: 0;
  box-sizing: border-box;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

#gameplay-intro-bubble.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

#gameplay-intro-bubble.is-leaving {
  opacity: 0 !important;
  transform: translateX(-50%) translateY(10px) scale(0.96) !important;
  transition: opacity 0.2s ease, transform 0.2s ease !important;
}

#gameplay-intro-bubble .gameplay-intro-body {
  width: 100%;
}

#gameplay-intro-bubble .gameplay-intro-top-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.gameplay-intro-name {
  display: inline-flex;
  padding: 2px 10px;
  background: linear-gradient(135deg, #9d3bf0, #e64595);
  border-radius: 12px;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.gameplay-intro-text {
  margin: 0 0 4px;
  color: rgba(255, 255, 255, 0.95);
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}

/* ---------- INTRO TEXT HIGHLIGHTING (Pink & Gold Accent) ---------- */
.gameplay-intro-text .hl-name {
  font-weight: 800;
  color: #ff6beb;
}
.gameplay-intro-text .hl-group {
  font-weight: 800;
  background: linear-gradient(135deg, #ffe17d, #ff9d3b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.gameplay-intro-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 6px;
}

.gameplay-intro-hint {
  color: #e3b8ff;
  font-family: 'Outfit', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  display: block;
  width: 100%;
  animation: pulseHint 2s infinite ease-in-out;
}

@keyframes pulseHint {
  0%, 100% { opacity: 0.7; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-2px); }
}

@media (max-width: 859px), (max-height: 560px) {
  #gameplay-intro-bubble {
    width: min(440px, calc(100% - 20px));
    padding: 10px 14px;
    bottom: 12px;
  }
  .gameplay-intro-name {
    font-size: 0.68rem;
    padding: 2px 8px;
  }
  .gameplay-intro-text {
    font-size: 0.78rem;
    line-height: 1.3;
  }
  .gameplay-intro-hint {
    font-size: 0.65rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  #gameplay-intro-bubble { transition: none; }
}

/* ---------- LOADING SCREEN ---------- */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes starPulseGlow {
  0%, 100% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.6)); }
  50% { transform: scale(1.15) rotate(90deg); filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.95)) drop-shadow(0 0 8px rgba(255, 42, 133, 0.5)); }
}

#loading-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(-45deg, var(--main-3), var(--sec-b3), var(--sec-a3), var(--main-3));
  background-size: 400% 400%;
  animation: gradientShift 8s ease infinite;
  z-index: 1000;
}
.loading-content {
  text-align: center;
  color: var(--white);
  font-family: 'Outfit', sans-serif;
}
.loading-star {
  display: inline-block;
  margin-bottom: 1rem;
  animation: starPulseGlow 3.5s ease-in-out infinite;
}
.loading-star svg { display: block; margin: 0 auto; }
.loading-content h1 {
  font-size: 2.2rem; font-weight: 900;
  margin: 0 0 1.5rem;
  text-shadow: 0 2px 12px rgba(0,0,0,.25);
  letter-spacing: 0.5px;
}
.loading-bar-wrap {
  width: 240px; height: 6px;
  background: rgba(255,255,255,.25);
  border-radius: 99px; overflow: hidden;
  margin: 0 auto 1.2rem;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}
#loading-bar {
  height: 100%;
  background: var(--white);
  border-radius: 99px;
  width: 0;
  box-shadow: 0 0 8px rgba(255,255,255,0.8);
  transition: width .4s ease;
}
.loading-content p {
  font-size: .95rem;
  opacity: 0.9;
  font-weight: 500;
  letter-spacing: 0.2px;
  font-family: 'Montserrat', sans-serif;
  text-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
