/* ==========================================
   Shiva's Wisdom - Stylesheet
   ========================================== */

/* Design Tokens & Custom Variables */
:root {
  --color-sky-night: #0a1128;
  --color-saffron-light: #ffb703;
  --color-saffron-dark: #fb8500;
  --color-gold: #fee440;
  --color-glow-gold: rgba(254, 228, 64, 0.4);
  --color-lotus-pink: #ff85a1;
  --color-glass-border: rgba(255, 255, 255, 0.08);
  --font-display: "Cinzel Decorative", "Playfair Display", Georgia, serif;
  --font-body: "Comfortaa", "Outfit", sans-serif;
}

/* Reset and Base Styling */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: var(--font-body);
  background-color: black;
  color: #f7fafc;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

/* Main Container: Fullscreen */
#game-container {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  z-index: 1;
}

/* Transparent canvas overlay for lightweight particle animations */
canvas,
.game-background,
.background-image,
.scene-background,
.game-layer {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
}

.ambient-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  pointer-events: none;
  z-index: 1;
}

/* Dedicated single background container rendering the panoramic background image */
.game-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-image: url("../assets/backgrounds/background.jpg");
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center center;
  z-index: -100;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  animation: bgFadeIn 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;

  /* Background transitions for smooth sharpening */
  filter: blur(0px);
  transition: filter 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

#game-container.state-opening .game-bg {
  filter: blur(0px);
}

@keyframes bgFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Header & Status Bar */
#game-header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 20;
  opacity: 0;
  transform: translateY(-20px);
  transition:
    opacity 1s ease,
    transform 1s ease;
  pointer-events: none;
}

#game-container:not(.state-opening) #game-header {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Header Brand Logo */
.header-left {
  display: flex;
  align-items: center;
  z-index: 25;
  pointer-events: auto;
}

.brand-logo {
  height: clamp(25px, 3cqh, 42px);
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  transition: transform 0.3s ease;
}

.brand-logo:hover {
  transform: scale(1.05);
}

/* Landing Page Brand Logo */
.landing-company-logo {
  position: absolute;
  top: 15px;
  left: 30px;
  z-index: 50;
  display: flex;
  align-items: center;
}

.landing-company-logo img {
  height: clamp(30px, 4cqh, 45px);
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  transition: transform 0.3s ease;
}

.landing-company-logo img:hover {
  transform: scale(1.05);
}

/* Lotus Flower Progress Bar */
.lotus-tracker {
  display: flex;
  gap: 15px;
}

.lotus-slot {
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lotus-flower-svg {
  width: 100%;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Grey outline when unbloomed, Pink when bloomed */
.lotus-flower-svg .lotus-petals {
  opacity: 0.15;
  transform: scale(0.6);
  transform-origin: 50% 75%;
  transition:
    opacity 0.8s ease,
    transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.lotus-flower-svg.bloomed .lotus-petals {
  opacity: 1;
  transform: scale(1);
  animation: bloomSparkle 2s ease-in-out infinite alternate;
}

.lotus-flower-svg.bloomed .lotus-bg {
  opacity: 0;
}

@keyframes bloomSparkle {
  0% {
    filter: drop-shadow(0 0 2px var(--color-lotus-pink));
  }

  100% {
    filter: drop-shadow(0 0 10px var(--color-lotus-pink)) brightness(1.1);
  }
}

/* Scoreboard display */
.scoreboard {
  font-family: var(--font-body);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-glass-border);
  padding: 8px 16px;
  border-radius: 30px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-label {
  font-size: 0.85rem;
  color: #a0aec0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.score-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--color-saffron-light);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
}

.sound-toggle {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-glass-border);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #fff;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  padding: 0;
  margin: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.sound-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--color-saffron-light);
  transform: scale(1.05);
  box-shadow: 0 0 12px rgba(251, 133, 0, 0.3);
}

.sound-toggle:active {
  transform: scale(0.95);
}

/* Game Scene Layout */
.game-scene {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  display: block;
  overflow: hidden;
  background: transparent;
}

.scene-content {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  box-sizing: border-box;
  box-shadow: none;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

/* Completely hide characters and unnecessary elements */
#shiva-character,
#vishnu-character,
.sky-background {
  display: none !important;
}

/* Characters System */
.character {
  position: absolute;
  z-index: 4;
  pointer-events: none;
}

/* Shiva Placement */
#shiva-character {
  position: absolute;
  left: 4%;
  top: 25%;
  width: 28%;
  height: 60%;
  z-index: 4;
  pointer-events: none;
  animation: shivaBreathe 6s ease-in-out infinite alternate;
}

@keyframes shivaBreathe {
  0% {
    transform: translateY(0);
  }

  100% {
    transform: translateY(-5px);
  }
}

/* Shiva SVG inner parts states */

/* Shiva expression toggling */

/* Spoken Sentence overlay (Step 1 & 2) */
/* Positioned horizontally and vertically in the upper sky, */
/* centering the continuous sentence horizontally while avoiding Shiva, Vishnu, mountains and temple. */
.sentence-container {
  position: absolute;
  top: 10%;
  transform: translateY(-50%);
  /* Centered vertically and horizontally */
  left: 0;
  right: 0;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-wrap: nowrap;
  /* Keep on a single horizontal row for natural reading flow */
  justify-content: center;
  align-items: center;
  gap: 0;
  z-index: 10;
  padding: 0 2%;
  opacity: 1 !important;
  /* Explicit active state opacity */
  transition: opacity 2s ease;
  container-type: inline-size;

  /* Cohesive floating animation for the entire sentence group */
  animation: sentenceFloat 7s ease-in-out infinite alternate;
}

.sentence-container.hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Word Cloud & Blank shared styles (increased by 10-15% for soft fluffy readability) */
/* Word Cloud & Blank shared styles (increased by 10-15% for soft fluffy readability) */
.word-cloud,
.blank-placeholder {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 15cqw;
  height: auto;
  aspect-ratio: 1.8 / 1;

  background-image: url("../assets/clouds/cloud.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;

  padding: 0 clamp(16px, 3.3cqw, 35px);
  margin: 0;
  border: 0;
  box-shadow: none;
  z-index: 2;

  text-shadow:
    0 1px 0 #fff8dc,
    0 2px 4px rgba(255, 220, 120, 0.45),
    0 0 10px rgba(255, 215, 120, 0.25);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition:
    filter 0.3s ease,
    opacity 0.5s ease,
    scale 0.25s ease-in-out,
    text-shadow 0.25s ease-in-out;
  will-change: transform, opacity;
  filter: drop-shadow(0 15px 20px rgba(0, 0, 0, 0.4));
}

/* Add natural overlap to overcome transparent PNG padding (approx 24% of bounding box) */
.sentence-container>*+* {
  margin-left: clamp(-62px, -6cqw, -28px);
}

/* Custom cloud overrides removed so all sentence words use the default cloud.png */

.cloud-text {
  font-family: "Berkshire Swash", cursive;
  font-weight: 400;
  font-size: clamp(16px, 4cqw, 42px);
  letter-spacing: 0.5px;
  line-height: 1;
  text-align: center;
  color: #4a2b08;
  /* rich dark golden-brown */
  text-shadow:
    0 1px 0 #fff8dc,
    0 2px 4px rgba(255, 220, 120, 0.45),
    0 0 10px rgba(255, 215, 120, 0.25);
  z-index: 3;
  pointer-events: none;
}

.word-cloud:hover {
  transform: scale(1.04);
  z-index: 10;
  opacity: 1;
}

@keyframes cloudEntrance {
  0% {
    opacity: 0;
    transform: translateX(-100%) scale(0.95);
  }

  70% {
    opacity: 1;
    transform: translateX(3px) scale(1);
  }

  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.word-cloud:hover {
  z-index: 10;
  scale: 1.04;
  /* Slightly increase scale by ~4% */
  filter: drop-shadow(0 0 10px rgba(254, 228, 64, 0.5)) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
  text-shadow:
    -0.5px -0.5px 0px rgba(255, 255, 255, 0.9),
    0.5px 0.5px 0px rgba(44, 22, 7, 0.9),
    0 0 12px rgba(254, 228, 64, 0.9),
    /* Brighten glow on hover */
    0 2px 4px rgba(44, 22, 7, 0.4);
  /* Override textGlowBreath to keep hover text-shadow static, but keep float */
  animation: breatheCloud 4.5s ease-in-out infinite alternate;
}

.word-cloud.glowing {
  filter: drop-shadow(0 0 12px var(--color-gold)) brightness(1.1);
  box-shadow: none;
  border-color: transparent;
  transition:
    filter 0.8s ease,
    transform 0.8s ease,
    scale 0.25s ease-in-out,
    text-shadow 0.25s ease-in-out;
  scale: 1.04;
  text-shadow:
    -0.5px -0.5px 0px rgba(255, 255, 255, 0.9),
    0.5px 0.5px 0px rgba(44, 22, 7, 0.9),
    0 0 14px rgba(254, 228, 64, 0.95),
    0 2px 4px rgba(44, 22, 7, 0.4);
  animation-play-state: paused;
}

.word-cloud.locked-arrival {
  filter: drop-shadow(0 0 25px var(--color-gold)) brightness(1.4);
  transform: scale(1.15) !important;
  text-shadow:
    -0.5px -0.5px 0px rgba(255, 255, 255, 0.9),
    0.5px 0.5px 0px rgba(44, 22, 7, 0.9),
    0 0 14px rgba(254, 228, 64, 0.95),
    0 2px 4px rgba(44, 22, 7, 0.4);
}

/* Missing Word Blank Placeholder styled as a matching cloud shape */
.blank-placeholder {
  opacity: 1;
  filter: brightness(1.15) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.08));
  border-bottom: none;
  align-self: center;
  animation:
    cloudEntrance 850ms cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards,
    blankDivineGlow 3s ease-in-out infinite alternate;
  animation-delay: 0s, 850ms;
  /* Pulse starts after entrance fade-in */
}

/* Faint golden sparkle / pulsing glow inside the empty cloud */
@keyframes blankDivineGlow {
  0% {
    filter: brightness(1.1) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.08)) drop-shadow(0 0 5px rgba(254, 228, 64, 0.2));
  }

  100% {
    filter: brightness(1.25) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.08)) drop-shadow(0 0 15px rgba(254, 228, 64, 0.6));
  }
}

/* Stop the breathing animation and revert to normal cloud style after correct word is placed */
.blank-placeholder.locked-arrival,
.blank-placeholder.glowing,
.blank-placeholder.filled-success-pulse {
  animation: none !important;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.08));
  /* Normal shadow */
}

/* Fade in the text smoothly when filled */
.blank-placeholder .cloud-text {
  opacity: 0;
  transition: opacity 400ms ease;
}

.blank-placeholder.locked-arrival .cloud-text,
.blank-placeholder.glowing .cloud-text,
.blank-placeholder.filled-success-pulse .cloud-text {
  opacity: 1;
}

/* Subtle static vertical baseline offsets (within ±5px range) for an organic floating line */
.word-cloud:nth-child(3n + 1),
.blank-placeholder:nth-child(3n + 1) {
  transform: translateY(-3px);
  z-index: 2;
}

.word-cloud:nth-child(3n + 2),
.blank-placeholder:nth-child(3n + 2) {
  transform: translateY(3px);
  z-index: 3;
}

.word-cloud:nth-child(3n + 3),
.blank-placeholder:nth-child(3n + 3) {
  transform: translateY(0);
  z-index: 4;
}

@keyframes sentenceFloat {
  0% {
    transform: translateY(-3.5px) rotate(-0.2deg);
  }

  100% {
    transform: translateY(3.5px) rotate(0.2deg);
  }
}

/* Word Shaking Animation (Step 2) */

/* Gentle shake for incorrect option clouds */

@keyframes shakeGentle {

  0%,
  100% {
    transform: translateX(0);
  }

  20%,
  60% {
    transform: translateX(-6px);
  }

  40%,
  80% {
    transform: translateX(6px);
  }
}

@keyframes shakeCloud {
  0% {
    transform: translate(1px, 1px) rotate(0deg);
  }

  10% {
    transform: translate(-1px, -2px) rotate(-1deg);
  }

  20% {
    transform: translate(-3px, 0px) rotate(1deg);
  }

  30% {
    transform: translate(0px, 2px) rotate(0deg);
  }

  40% {
    transform: translate(1px, -1px) rotate(1deg);
  }

  50% {
    transform: translate(-1px, 2px) rotate(-1deg);
  }

  60% {
    transform: translate(-3px, 1px) rotate(0deg);
  }

  70% {
    transform: translate(2px, 1px) rotate(-1deg);
  }

  80% {
    transform: translate(-1px, -1px) rotate(1deg);
  }

  90% {
    transform: translate(2px, 2px) rotate(0deg);
  }

  100% {
    transform: translate(1px, -2px) rotate(-1deg);
  }
}

/* Word Falling Animation (Step 2) */

/* River Ganga Layout */
.river-ganga-container {
  position: absolute;
  bottom: 2%;
  /* Sits lower directly overlapping deep water */
  left: 38%;
  width: 58%;
  height: 26%;
  z-index: 5;
  pointer-events: none;
}

/* Option clouds container inside River */
.river-options-container {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10%;
  width: 100%;
  height: auto;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: nowrap;
  z-index: 10;
  pointer-events: none;
  box-sizing: border-box;
}

.river-options-container.active {
  pointer-events: auto;
}

/* Options Floating Bobbing in River */
.option-container {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  z-index: 2;
  box-sizing: border-box;
  cursor: pointer;
  transform: translateY(0);
  transition:
    transform 0.3s ease,
    filter 0.3s ease,
    opacity 0.5s ease;
  margin: 0;
  width: 220px;
}

/* Lotus Base Layer */
.option-lotus {
  position: relative;
  width: 80%;
  height: auto;
  pointer-events: none;
  z-index: 1;
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
  margin-top: -22px;
}

/* Warm Golden Glow Layer */
.option-glow {
  position: absolute;
  left: 50%;
  bottom: 8px;
  /* Centered in the gap between cloud and lotus */
  transform: translateX(-50%);
  width: 50%;
  height: 35%;
  background: radial-gradient(ellipse at center bottom,
      rgba(254, 228, 64, 0.8) 0%,
      rgba(251, 133, 0, 0.4) 45%,
      rgba(251, 133, 0, 0) 75%);
  filter: blur(6px);
  pointer-events: none;
  z-index: 2;
  animation: glowPulse 4s ease-in-out infinite alternate;
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
}

@keyframes glowPulse {
  0% {
    opacity: 0.65;
    transform: translateX(-50%) scale(0.95);
  }

  100% {
    opacity: 0.95;
    transform: translateX(-50%) scale(1.1);
  }
}

/* Interactive Cloud Layer */
.option-cloud {
  background: url("../assets/clouds/cloud.png") no-repeat center center;
  background-size: contain;
  color: #4a2b08;
  /* rich dark golden-brown */
  border: none;
  box-shadow: none;
  font-family: "Berkshire Swash", cursive;
  font-weight: 400;
  font-size: calc(clamp(25px, 1.9cqw, 36px) * var(--font-scale, 1));
  letter-spacing: 0.5px;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  padding: 0 35px;
  border-radius: 0;

  aspect-ratio: 1.8 / 1;
  width: 100%;
  height: auto;
  flex: 0 0 auto;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 3;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  will-change: transform, opacity;

  text-shadow:
    0 1px 0 #fff8dc,
    0 2px 4px rgba(255, 220, 120, 0.45),
    0 0 10px rgba(255, 215, 120, 0.25);

  transition:
    opacity 0.5s ease,
    scale 0.25s ease-in-out,
    text-shadow 0.25s ease-in-out;
  animation: textGlowBreath 3s ease-in-out infinite alternate;
}

/* Water ripple overlay at the base of the floating container */
.option-container::before {
  content: "";
  position: absolute;
  bottom: -5px;
  /* Waterline under the smaller lotus */
  left: 20%;
  right: 20%;
  height: clamp(6px, 1.5cqh, 12px);
  /* Swapped cqh to cqh */
  background: radial-gradient(ellipse at center,
      rgba(160, 235, 255, 0.4) 0%,
      rgba(255, 255, 255, 0) 70%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(0, 180, 216, 0.15);
  z-index: -1;
  pointer-events: none;
  transform: scale(1);
  animation: cloudWaterRipple 4s cubic-bezier(0.25, 0.8, 0.25, 1) infinite;
}

.option-container:nth-child(4n + 1)::before {
  animation-delay: -0.5s;
}

.option-container:nth-child(4n + 2)::before {
  animation-delay: -1.5s;
}

.option-container:nth-child(4n + 3)::before {
  animation-delay: -2.5s;
}

.option-container:nth-child(4n + 4)::before {
  animation-delay: -3.5s;
}

/* Flipped semi-transparent mirror reflection on the river surface */
.option-container::after {
  content: "";
  position: absolute;
  bottom: -15px;
  /* Shifted up relative to smaller lotus base */
  left: 30%;
  right: 30%;
  height: clamp(8px, 2cqh, 14px);
  /* Swapped cqh to cqh */
  background: url("../assets/clouds/cloud.png") no-repeat center center;
  background-size: contain;
  opacity: 0.12;
  filter: blur(1.5px) sepia(1) hue-rotate(185deg) saturate(2.5);
  transform: scaleY(-0.6) scaleX(0.95);
  z-index: -2;
  pointer-events: none;
}

@keyframes cloudWaterRipple {
  0% {
    transform: scale(0.75);
    opacity: 0.85;
  }

  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

.option-container:hover {
  animation-play-state: paused;
  transform: translateY(-8px) !important;
  z-index: 50;
  background: transparent;
  border: none;
  box-shadow: none;
  outline: none;
}

/* Strictly remove ALL default browser highlights, rectangles, and focus rings */
.option-container,
.option-container:focus,
.option-container:active,
.option-container:focus-visible,
.option-container.selected,
.option-container.glowing,
.option-cloud,
.option-cloud:focus,
.option-cloud:active,
.option-cloud:focus-visible,
.option-cloud.selected {
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

.option-container:hover .option-cloud {
  scale: 1.04;
  /* Slightly scale up cloud inside hovered container */
  filter: drop-shadow(0 0 10px rgba(255, 215, 120, 0.6)) drop-shadow(0 0 20px rgba(255, 215, 120, 0.4)) drop-shadow(0 0 30px rgba(255, 240, 180, 0.25)) brightness(1.08);
  text-shadow:
    -0.5px -0.5px 0px rgba(255, 255, 255, 0.9),
    0.5px 0.5px 0px rgba(44, 22, 7, 0.9),
    0 0 12px rgba(254, 228, 64, 0.9),
    /* Brighten text glow */
    0 2px 4px rgba(44, 22, 7, 0.4);
  animation-play-state: paused;
  /* Pause text glow breath on hover */
}

.option-container.glowing {
  background: transparent;
  border: none;
  box-shadow: none;
  outline: none;
}

.option-container.glowing .option-cloud {
  scale: 1.05;
  filter: drop-shadow(0 0 10px rgba(255, 215, 120, 0.6)) drop-shadow(0 0 20px rgba(255, 215, 120, 0.4)) drop-shadow(0 0 30px rgba(255, 240, 180, 0.25)) brightness(1.15);
  text-shadow:
    -0.5px -0.5px 0px rgba(255, 255, 255, 0.9),
    0.5px 0.5px 0px rgba(44, 22, 7, 0.9),
    0 0 14px rgba(254, 228, 64, 0.95),
    0 2px 4px rgba(44, 22, 7, 0.4);
  animation-play-state: paused;
}

.option-container.glowing .option-glow {
  animation: glowPulseFast 1s ease-in-out infinite alternate;
}

@keyframes glowPulseFast {
  0% {
    opacity: 0.8;
    transform: translateX(-50%) scale(1);
  }

  100% {
    opacity: 1;
    transform: translateX(-50%) scale(1.25);
    filter: blur(4px);
  }
}

/* Offset float animations & Stagger margins vertically to match Ganga's diagonal stream flow */
.option-container:nth-child(4n + 1) {
  animation: riverBob1 6.2s ease-in-out infinite alternate;
  animation-delay: -1.5s;
}

.option-container:nth-child(4n + 2) {
  animation: riverBob2 7.5s ease-in-out infinite alternate;
  animation-delay: -3.8s;
}

.option-container:nth-child(4n + 3) {
  animation: riverBob3 5.4s ease-in-out infinite alternate;
  animation-delay: -0.9s;
}

.option-container:nth-child(4n + 4) {
  animation: riverBob4 6.8s ease-in-out infinite alternate;
  animation-delay: -2.4s;
}

@keyframes riverBob1 {
  0% {
    transform: translateY(-3px) translateX(-4px) rotate(-1.5deg);
  }

  100% {
    transform: translateY(4px) translateX(4px) rotate(1.5deg);
  }
}

@keyframes riverBob2 {
  0% {
    transform: translateY(4px) translateX(5px) rotate(2deg);
  }

  100% {
    transform: translateY(-4px) translateX(-5px) rotate(-2deg);
  }
}

@keyframes riverBob3 {
  0% {
    transform: translateY(-4px) translateX(-5px) rotate(-2deg);
  }

  100% {
    transform: translateY(3px) translateX(3px) rotate(1deg);
  }
}

@keyframes riverBob4 {
  0% {
    transform: translateY(3px) translateX(4px) rotate(1.5deg);
  }

  100% {
    transform: translateY(-5px) translateX(-4px) rotate(-1.5deg);
  }
}

/* Option container melting / magical dissolve animation (Incorrect answer) */
.option-container.melting-water {
  pointer-events: none !important;
  opacity: 0 !important;
  transform: scale(0.65) translateY(20px) !important;
  transition:
    opacity 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
}

.option-container.melting-water .option-glow {
  transform: translateX(-50%) scale(0.1) !important;
  opacity: 0 !important;
  transition:
    transform 0.5s ease,
    opacity 0.5s ease !important;
}

@keyframes reformCloud {
  0% {
    transform: translateY(120px) scale(0.1) rotate(5deg);
    opacity: 0;
    filter: blur(6px) brightness(1.5);
  }

  40% {
    transform: translateY(40px) scale(0.6) rotate(-3deg);
    opacity: 0.7;
    filter: blur(2px) brightness(1.2);
  }

  100% {
    transform: translateY(0) scale(1) rotate(0deg);
    opacity: 1;
    filter: blur(0) brightness(1);
  }
}

/* Melt Particle Styles */
.melt-particle {
  pointer-events: none;
  will-change: transform, opacity;
}

/* Interactive Water Ripple/Splash Effect */
.water-ripple {
  position: absolute;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  pointer-events: none;
  z-index: 8;
  transform: translate(-50%, -50%) scale(0);
  animation: rippleAnim 0.8s ease-out forwards;
}

@keyframes rippleAnim {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 1;
  }

  100% {
    transform: translate(-50%, -50%) scale(3);
    opacity: 0;
    border-color: rgba(72, 202, 228, 0);
  }
}

.water-splash {
  position: absolute;
  pointer-events: none;
  z-index: 9;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  width: 40px;
  height: 40px;
  transform: translate(-50%, -100%);
}

.splash-drop {
  width: 4px;
  height: 10px;
  background-color: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  margin: 0 2px;
  animation: splashAnim 0.6s ease-out forwards;
}

.splash-drop:nth-child(1) {
  transform-origin: center bottom;
  animation-delay: 0s;
  --dx: -15px;
  --dy: -30px;
}

.splash-drop:nth-child(2) {
  transform-origin: center bottom;
  animation-delay: 0.05s;
  --dx: 0px;
  --dy: -45px;
}

.splash-drop:nth-child(3) {
  transform-origin: center bottom;
  animation-delay: 0s;
  --dx: 15px;
  --dy: -30px;
}

@keyframes splashAnim {
  0% {
    transform: translate(0, 0) scaleY(1);
    opacity: 1;
  }

  50% {
    transform: translate(calc(var(--dx) * 0.7), calc(var(--dy) * 0.7)) scaleY(1.2);
    opacity: 0.9;
  }

  100% {
    transform: translate(var(--dx), var(--dy)) scale(0.3);
    opacity: 0;
  }
}

/* Camera Gaze following transition */
.camera-focus-ganga {
  /* Disabled camera zoom/pan to keep background fixed and uncropped */
}

/* Floating Score popup */
.floating-score-container {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

.floating-score {
  position: absolute;
  color: var(--color-gold);
  font-size: 1.8rem;
  font-weight: 800;
  text-shadow:
    0 0 10px var(--color-saffron-dark),
    0 0 4px #000;
  animation: floatScoreUp 1.8s ease-out forwards;
}

@keyframes floatScoreUp {
  0% {
    transform: translateY(0) scale(0.6);
    opacity: 0;
  }

  15% {
    transform: translateY(-30px) scale(1.2);
    opacity: 1;
  }

  100% {
    transform: translateY(-120px) scale(0.8);
    opacity: 0;
  }
}

/* Overlays (Opening & Ending screens) */
.screen-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(10, 17, 40, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition:
    opacity 0.8s ease,
    visibility 0.8s;
  padding: 20px;
}

.screen-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Redesigned Welcome/Landing Screen */
.welcome-screen-overlay {
  background: #0f1016 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  flex-direction: column;
  overflow: visible;
  /* changed from hidden to let background bleed */
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1000;

  /* Layout variables for enlarged logo and overlapping play button */
  --logo-width: clamp(550px, 85cqw, 1100px);
  --logo-max-width: min(95cqw, 115cqh);
  --logo-height: calc(min(var(--logo-width), var(--logo-max-width)) / 1.5);
  /* ~15% overlap of the 54px play button height */
  /* Fade out over 500ms when hidden is added */
  transition:
    opacity 500ms ease,
    visibility 500ms ease !important;
}

/* Fullscreen cover background utilizing pseudo-element for zoom transition */
.welcome-screen-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: url("../assets/backgrounds/landing.jpg") no-repeat center center;
  background-size: cover;
  z-index: 1;
  pointer-events: none;
  transition:
    transform 500ms cubic-bezier(0.25, 1, 0.5, 1),
    filter 500ms cubic-bezier(0.25, 1, 0.5, 1);
}

.welcome-screen-overlay.hidden::before {
  transform: scale(1.06) !important;
  filter: brightness(1.2) !important;
}

.welcome-screen-overlay.hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* --- Instruction Screen --- */
#screen-instructions {
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  /* Darken background slightly to focus on instructions */
  background: rgba(0, 0, 0, 0.4);
}

.instructions-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.instruction-box-img {
  max-width: 825px;
  height: auto;
}

.ok-btn-image {
  max-width: 288px;
  height: auto;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.ok-btn-image:hover {
  transform: scale(1.05);
  filter: brightness(1.1);
}

/* Ambient water shimmer overlay */
.water-shimmer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 40%;
  background: radial-gradient(ellipse at 50% 50%,
      rgba(255, 255, 255, 0.08) 0%,
      rgba(255, 255, 255, 0) 70%);
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: 5;
  animation: shimmerCycle 8s ease-in-out infinite alternate;
}

@keyframes shimmerCycle {
  0% {
    opacity: 0.35;
    transform: scaleX(1);
  }

  50% {
    opacity: 0.65;
    transform: scaleX(1.08);
  }

  100% {
    opacity: 0.25;
    transform: scaleX(0.95);
  }
}

/* Welcome overlay canvas */
.welcome-particles-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
  /* layered above image, below button */
}

/* Transparent Logo Centerpiece */
.logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: var(--logo-width);
  height: var(--logo-height);
  z-index: 10;
}

.magical-logo-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 
  Magical Effects Around Logo 
*/
.logo-halo {
  position: absolute;
  width: 80%;
  height: 80%;
  top: 10%;
  left: 10%;
  border-radius: 50%;
  background: radial-gradient(circle,
      rgba(254, 228, 64, 0.4) 0%,
      rgba(254, 228, 64, 0) 70%);
  filter: blur(20px);
  z-index: 1;
  animation: divineGlow 3.5s ease-in-out infinite alternate;
  pointer-events: none;
}

.logo-rays {
  position: absolute;
  width: 120%;
  height: 120%;
  top: -10%;
  left: -10%;
  background: repeating-conic-gradient(from 0deg,
      rgba(254, 228, 64, 0) 0deg,
      rgba(254, 228, 64, 0.15) 10deg,
      rgba(254, 228, 64, 0) 20deg);
  border-radius: 50%;
  mask-image: radial-gradient(circle, black 20%, transparent 60%);
  -webkit-mask-image: radial-gradient(circle, black 20%, transparent 60%);
  z-index: 2;
  animation:
    rotateRays 20s linear infinite,
    divineGlow 3.5s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes rotateRays {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes divineGlow {
  0% {
    opacity: 0.4;
    transform: scale(0.95);
  }

  100% {
    opacity: 1;
    transform: scale(1.05);
  }
}

.css-sparkles {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: 3;
  pointer-events: none;
}

.sparkle {
  position: absolute;
  width: 4px;
  height: 4px;
  background-color: #fee440;
  border-radius: 50%;
  box-shadow: 0 0 8px 2px rgba(254, 228, 64, 0.8);
  opacity: 0;
  animation: floatSparkle 4s ease-in-out infinite;
}

/* Position and delay sparkles randomly around the wrapper */
.s1 {
  top: 20%;
  left: 10%;
  animation-delay: 0.1s;
}

.s2 {
  top: 80%;
  left: 85%;
  animation-delay: 1.2s;
}

.s3 {
  top: 15%;
  left: 70%;
  animation-delay: 0.5s;
}

.s4 {
  top: 70%;
  left: 15%;
  animation-delay: 2.1s;
}

.s5 {
  top: 50%;
  left: 90%;
  animation-delay: 1.5s;
}

.s6 {
  top: 90%;
  left: 45%;
  animation-delay: 3.2s;
}

.s7 {
  top: 10%;
  left: 40%;
  animation-delay: 2.8s;
}

.s8 {
  top: 40%;
  left: 5%;
  animation-delay: 0.9s;
}

.s9 {
  top: 85%;
  left: 25%;
  animation-delay: 1.8s;
}

.s10 {
  top: 30%;
  left: 80%;
  animation-delay: 2.5s;
}

@keyframes floatSparkle {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.5);
  }

  50% {
    opacity: 1;
    transform: translateY(-10px) scale(1.5);
  }

  100% {
    opacity: 0;
    transform: translateY(-30px) scale(0.5);
  }
}

#logo-centerpiece {
  width: 100%;
  height: auto;
  display: block;
  position: relative;
  z-index: 4;

  /* Divine glow that pulses */
  filter: drop-shadow(0 0 15px rgba(254, 228, 64, 0.5)) drop-shadow(0 0 5px rgba(255, 255, 255, 0.8));
  animation: divineGlow 3.5s ease-in-out infinite alternate;
}

@keyframes logoEntrance {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
  }

  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes logoFloat {
  0% {
    transform: translate(-50%, -50%) translateY(-1.5px);
    /* Gentle float (1-3px drift) */
  }

  100% {
    transform: translate(-50%, -50%) translateY(1.5px);
  }
}

@keyframes logoGlowPulse {
  0% {
    filter: drop-shadow(0 0 8px rgba(254, 228, 64, 0.15)) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
  }

  100% {
    filter: drop-shadow(0 0 22px rgba(254, 228, 64, 0.55)) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
  }
}

/* Play button wrapper running slow breathing scale pulse */
/* Play button wrapper running slow breathing scale pulse */
.play-button-wrapper {
  position: absolute;
  left: 50%;
  /* Move the Play button to overlap the logo's bottom edge */
  top: calc(42% + (var(--logo-height) / 2) - 20px);
  width: clamp(280px, 30cqw, 340px);
  /* Scaled to 280-340px responsive */
  transform: translate(-50%, -50%);
  z-index: 100;

  /* Ensure no background renders behind the image */
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  overflow: visible !important;

  /* Gentle floating motion (2-4px up and down) and subtle scale breathing (1 -> 1.03 -> 1) */
  animation: buttonBreath 3.5s ease-in-out infinite alternate;
}

@keyframes buttonBreath {
  0% {
    transform: translate(-50%, -50%) translateY(-3px) scale(1);
  }

  100% {
    transform: translate(-50%, -50%) translateY(3px) scale(1.03);
  }
}

/* Soft reflection onto the water below the button */
.button-reflection {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) scaleY(-0.6);
  width: 60%;
  height: 40%;
  background: linear-gradient(to bottom,
      rgba(254, 228, 64, 0.4) 0%,
      rgba(72, 202, 228, 0) 100%);
  filter: blur(8px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 5;
}

/* Replaced HTML button with image button */
.custom-play-btn {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  overflow: visible !important;
  padding: 0;
  margin: 0;
  width: 100%;
  height: auto;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition:
    transform 300ms cubic-bezier(0.25, 0.8, 0.25, 1),
    filter 300ms ease;

  /* Soft golden glow that slowly pulses */
  filter: drop-shadow(0 0 10px rgba(254, 228, 64, 0.5));
  animation: buttonGlowPulse 3s ease-in-out infinite alternate;
}

@keyframes buttonGlowPulse {
  0% {
    filter: drop-shadow(0 0 8px rgba(254, 228, 64, 0.4));
  }

  100% {
    filter: drop-shadow(0 0 16px rgba(254, 228, 64, 0.8));
  }
}

.play-btn-image {
  width: 100%;
  height: auto;
  display: block;
  /* Ensure original aspect ratio without distortion */
  object-fit: contain;
}

/* Button hover effects */
.play-button-wrapper:hover .custom-play-btn {
  /* Slight enlargement (about 8%) and stronger glow */
  transform: scale(1.08);
  filter: drop-shadow(0 0 25px rgba(254, 228, 64, 1));
  animation: none;
  /* override pulse to stay bright */
}

/* Click animation: quick press effect spring back */
.custom-play-btn:active {
  transform: scale(0.95);
  transition: transform 100ms cubic-bezier(0.4, 0, 0.2, 1);
}

.welcome-screen-overlay.hidden .play-button-wrapper {
  transform: translate(-50%, -50%) scale(0.8) translateY(20px) !important;
  opacity: 0 !important;
  transition:
    transform 500ms cubic-bezier(0.25, 1, 0.5, 1),
    opacity 500ms ease;
}

/* Prefers Reduced Motion Media Query */
@media (prefers-reduced-motion: reduce) {
  .welcome-screen-overlay::before {
    transform: none !important;
    animation: none !important;
  }

  .play-button-wrapper,
  .custom-play-btn {
    animation: none !important;
  }
}

/* Titles and Typography */

.game-instruction {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #cbd5e0;
  margin-bottom: 30px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 20px;
}

/* Custom Button */

/* Ending Screen Styles */

.final-score-num {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--color-gold);
}

/* Giant Lotus Blooming in River (Ending Screen) */
.ending-lotus-container {
  position: absolute;
  bottom: 5%;
  left: 60%;
  width: 150px;
  height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 15;
  transition:
    transform 1.5s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 1s ease;
  transform: scale(0);
  opacity: 0;
}

.ending-lotus-container.bloomed {
  transform: scale(1);
  opacity: 1;
}

@keyframes giantLotusFloat {
  0% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-6px) rotate(1deg);
  }

  100% {
    transform: translateY(0) rotate(0deg);
  }
}

/* Opening blooming animation offsets */

.wisdom-reveal-text {
  position: absolute;
  bottom: -35px;
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: #ffffff;
  text-shadow:
    0 0 10px var(--color-lotus-pink),
    0 0 5px #000;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 1s ease 1s,
    transform 1s ease 1s;
}

.wisdom-reveal-text.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Warm Sunrise Glow Overlay */
.scene-content::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 38%,
      rgba(255, 235, 200, 0.15) 0%,
      rgba(9, 14, 24, 0) 80%);
  pointer-events: none;
  z-index: 8;
}

/* Golden Transition Flash on game ending */
#game-container.state-ending::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle,
      #fee440 0%,
      rgba(254, 228, 64, 0.8) 50%,
      rgba(251, 133, 0, 0.4) 100%);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  animation: goldenFlash 1.8s ease-out;
}

@keyframes goldenFlash {
  0% {
    opacity: 0;
  }

  35% {
    opacity: 0.85;
  }

  100% {
    opacity: 0;
  }
}

/* Cloud Staggered Floating Animations for Options in Ganga */
.option-cloud:nth-child(1) {
  animation: floatGanga1 5.5s ease-in-out infinite alternate;
}

.option-cloud:nth-child(2) {
  animation: floatGanga2 6.5s ease-in-out infinite alternate;
}

.option-cloud:nth-child(3) {
  animation: floatGanga3 6s ease-in-out infinite alternate;
}

.option-cloud:nth-child(4) {
  animation: floatGanga4 5s ease-in-out infinite alternate;
}

@keyframes floatGanga1 {
  0% {
    transform: translateY(-15px) rotate(0deg);
  }

  100% {
    transform: translateY(-21px) rotate(1.2deg);
  }
}

@keyframes floatGanga2 {
  0% {
    transform: translateY(5px) rotate(0deg);
  }

  100% {
    transform: translateY(-1px) rotate(-1deg);
  }
}

@keyframes floatGanga3 {
  0% {
    transform: translateY(-8px) rotate(0deg);
  }

  100% {
    transform: translateY(-14px) rotate(0.8deg);
  }
}

@keyframes floatGanga4 {
  0% {
    transform: translateY(12px) rotate(0deg);
  }

  100% {
    transform: translateY(6px) rotate(-0.8deg);
  }
}

/* Continuous breathing for other clouds (fallback defaults) */
/* Continuous breathing for other clouds (fallback defaults) */
.word-cloud {
  animation:
    cloudEntrance 1s cubic-bezier(0.4, 0, 0.2, 1) var(--delay, 0s) forwards,
    breatheCloud1 5s ease-in-out calc(var(--delay, 0s) + 1s) infinite alternate,
    textGlowBreath 3s ease-in-out calc(var(--delay, 0s) + 1s) infinite alternate;
}

.word-cloud.cloud_1 {
  animation:
    cloudEntrance 1s cubic-bezier(0.4, 0, 0.2, 1) var(--delay, 0s) forwards,
    breatheCloud1 5s ease-in-out calc(var(--delay, 0s) + 1s) infinite alternate,
    textGlowBreath 3s ease-in-out calc(var(--delay, 0s) + 1s) infinite alternate;
}

.word-cloud.cloud_2 {
  animation:
    cloudEntrance 1s cubic-bezier(0.4, 0, 0.2, 1) var(--delay, 0s) forwards,
    breatheCloud2 5.5s ease-in-out calc(var(--delay, 0s) + 1s) infinite alternate,
    textGlowBreath 3.2s ease-in-out calc(var(--delay, 0s) + 1s) infinite alternate;
}

.word-cloud.cloud_3 {
  animation:
    cloudEntrance 1s cubic-bezier(0.4, 0, 0.2, 1) var(--delay, 0s) forwards,
    breatheCloud3 4.8s ease-in-out calc(var(--delay, 0s) + 1s) infinite alternate,
    textGlowBreath 2.8s ease-in-out calc(var(--delay, 0s) + 1s) infinite alternate;
}

.word-cloud.cloud_4 {
  animation:
    cloudEntrance 1s cubic-bezier(0.4, 0, 0.2, 1) var(--delay, 0s) forwards,
    breatheCloud4 5.2s ease-in-out calc(var(--delay, 0s) + 1s) infinite alternate,
    textGlowBreath 3.4s ease-in-out calc(var(--delay, 0s) + 1s) infinite alternate;
}

/* 4 Desynchronized organic floating animations (bobbing + side drift + rotate) */
@keyframes breatheCloud1 {
  0% {
    transform: translate3d(0, 0, 0) rotate(-0.3deg);
  }

  100% {
    transform: translate3d(1px, -3px, 0) rotate(0.3deg);
  }
}

@keyframes breatheCloud2 {
  0% {
    transform: translate3d(0, 0, 0) rotate(0.2deg);
  }

  100% {
    transform: translate3d(-1.5px, -2.5px, 0) rotate(-0.2deg);
  }
}

@keyframes breatheCloud3 {
  0% {
    transform: translate3d(0, 0, 0) rotate(-0.4deg);
  }

  100% {
    transform: translate3d(1.5px, -2px, 0) rotate(0.4deg);
  }
}

@keyframes breatheCloud4 {
  0% {
    transform: translate3d(0, 0, 0) rotate(0.3deg);
  }

  100% {
    transform: translate3d(-1px, -3px, 0) rotate(-0.3deg);
  }
}

/* Breathing text shadow golden glow animation */
@keyframes textGlowBreath {
  0% {
    text-shadow:
      0 0 4px rgba(255, 215, 120, 0.2),
      0 1px 2px rgba(0, 0, 0, 0.15);
  }

  100% {
    text-shadow:
      0 0 8px rgba(255, 215, 120, 0.5),
      0 2px 4px rgba(0, 0, 0, 0.25);
  }
}

/* River Waves Horizontal Flow */
.wave {
  animation: waveFlow 7s ease-in-out infinite alternate;
}

@keyframes waveFlow {
  0% {
    transform: translateX(-2.5%) translateY(0);
  }

  100% {
    transform: translateX(2.5%) translateY(1.5px);
  }
}

/* Title animations */

@keyframes titleGlow {
  0% {
    text-shadow:
      0 2px 10px rgba(255, 183, 3, 0.3),
      0 0 20px rgba(255, 183, 3, 0.1);
  }

  100% {
    text-shadow:
      0 2px 15px rgba(255, 183, 3, 0.6),
      0 0 35px rgba(255, 183, 3, 0.4);
  }
}

/* Magical Cloud-styled Buttons */

/* Scroll & Instructions Card Styling */

/* Responsive Media Queries Removed */
/* Compact In-game Instructions Overlay */
.game-instructions-panel {
  position: absolute;
  bottom: 28%;
  /* Centered horizontally, positioned above the river option clouds */
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  width: max-content;
  max-width: 90cqw;
  background: rgba(15, 23, 42, 0.7);
  /* Subtle translucent slate glass */
  border: 1.5px solid var(--color-gold);
  /* Premium golden rim */
  border-radius: 30px;
  /* Pill-shaped */
  padding: 10px 28px;
  z-index: 150;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow:
    0 4px 15px rgba(0, 0, 0, 0.4),
    0 0 10px var(--color-glow-gold);
  /* Soft glow */
  color: #fff;
  font-family: var(--font-body);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
  opacity: 0;
  pointer-events: none;
}

.game-instructions-panel.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
  animation: instructionFloat 3s ease-in-out infinite alternate;
}

.game-instructions-panel.fade-out {
  opacity: 0;
  transform: translateX(-50%) translateY(-10px);
  pointer-events: none;
}

.game-instructions-text {
  font-size: clamp(12px, 1.8cqw, 14.5px);
  text-align: center;
  font-weight: 500;
  letter-spacing: 0.5px;
  margin: 0;
  line-height: 1.4;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

@keyframes instructionFloat {
  0% {
    transform: translateX(-50%) translateY(0);
  }

  100% {
    transform: translateX(-50%) translateY(-4px);
  }
}

/* Incorrect Cloud Wobble & Falling Animations */
.word-cloud.wobble {
  animation: loseBalanceWobble 300ms ease-in-out forwards;
}

@keyframes loseBalanceWobble {
  0% {
    transform: scale(1.1) rotate(0deg);
  }

  25% {
    transform: scale(1.1) rotate(-6deg);
  }

  75% {
    transform: scale(1.1) rotate(6deg);
  }

  100% {
    transform: scale(1.1) rotate(0deg);
  }
}

/* Cinematic Splash Container */
.cinematic-splash {
  position: absolute;
  pointer-events: none;
  z-index: 120;
}

/* Expansion ripples */
.splash-ripple {
  position: absolute;
  width: 10px;
  height: 6px;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  animation: splashRippleAnim 900ms cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes splashRippleAnim {
  0% {
    width: 10px;
    height: 6px;
    opacity: 0.8;
  }

  100% {
    width: 100px;
    height: 45px;
    opacity: 0;
    border-color: rgba(72, 202, 228, 0);
  }
}

/* Upward droplets */
.splash-droplet {
  position: absolute;
  width: 5px;
  height: 5px;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: splashDropletAnim 800ms cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes splashDropletAnim {
  0% {
    transform: translate(-50%, -50%) translate(0, 0) scale(1.2);
    background: #ffffff;
  }

  50% {
    background: #e0f2fe;
  }

  100% {
    transform: translate(-50%, -50%) translate(var(--dx), var(--dy)) scale(0.4);
    opacity: 0;
  }
}

/* White Foam Particles */
.splash-foam {
  position: absolute;
  width: 7px;
  height: 5px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: splashFoamAnim 900ms ease-out forwards;
}

@keyframes splashFoamAnim {
  0% {
    transform: translate(-50%, -50%) translate(0, 0) scale(1);
    opacity: 0.9;
  }

  100% {
    transform: translate(-50%, -50%) translate(var(--fx), var(--fy)) scale(1.5);
    opacity: 0;
  }
}

/* Sparkles */
.splash-sparkle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #fee440;
  clip-path: polygon(50% 0%,
      61% 35%,
      98% 35%,
      68% 57%,
      79% 91%,
      50% 70%,
      21% 91%,
      32% 57%,
      2% 35%,
      39% 35%);
  transform: translate(-50%, -50%) scale(0);
  animation: splashSparkleAnim 700ms ease-out forwards;
}

@keyframes splashSparkleAnim {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 1;
  }

  50% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 1;
  }

  100% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
  }
}

/* ==========================================
   Cinematic Cloud Entrance Sequence
   ========================================== */

/* Animated entrance for words: smooth slide down from top and soft fade in */
@keyframes wordReveal {
  0% {
    opacity: 0;
    transform: translateY(-40px) scale(0.96);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Animated entrance for option clouds: gentle float up and fade in */
@keyframes optionReveal {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Magical Sparkles for Cloud Emergence */
.magical-sparkle {
  position: absolute;
  background: radial-gradient(circle,
      #fee440 0%,
      rgba(251, 133, 0, 0.8) 50%,
      rgba(255, 255, 255, 0) 100%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 20;
  transform: translate(-50%, -50%) scale(1);
  animation: sparkleFly 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes sparkleFly {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }

  100% {
    transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0);
    opacity: 0;
  }
}

/* ==========================================
   Satisfying Answer Click Feedback
   ========================================== */

/* CORRECT ANSWER: Glowing Success styles */
.option-container.correct-success {
  transform: translate3d(0, 0, 0) scale(1.1) !important;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1) !important;
  pointer-events: none;
  z-index: 999;
}

.option-container.correct-success .option-cloud {
  animation: correctCloudFlash 0.65s ease-in-out forwards;
  border: none !important;
}

@keyframes correctCloudFlash {
  0% {
    filter: drop-shadow(0 0 10px rgba(254, 228, 64, 0.8)) brightness(1.15);
  }

  50% {
    filter: drop-shadow(0 0 25px rgba(254, 228, 64, 1)) brightness(1.35);
  }

  100% {
    filter: drop-shadow(0 0 12px rgba(254, 228, 64, 0.8)) brightness(1);
  }
}

/* Success Halo behind the cloud */
.magical-halo {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate3d(-50%, -50%, 0) scale(0.2);
  width: 190px;
  height: 190px;
  background: radial-gradient(circle,
      rgba(254, 228, 64, 0.6) 0%,
      rgba(254, 228, 64, 0.25) 45%,
      rgba(254, 228, 64, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  animation: haloExpansion 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes haloExpansion {
  0% {
    transform: translate3d(-50%, -50%, 0) scale(0.2);
    opacity: 0;
  }

  40% {
    opacity: 1;
  }

  100% {
    transform: translate3d(-50%, -50%, 0) scale(1.45);
    opacity: 0;
  }
}

/* Success sparkles styling */
.success-sparkle {
  z-index: 1000;
  background: radial-gradient(circle,
      #fee440 0%,
      #ffb703 60%,
      rgba(255, 255, 255, 0) 100%) !important;
  box-shadow: 0 0 8px #fee440;
}

/* Final soft golden pulse when correct word merges into sentence */
.word-cloud.filled-success-pulse {
  animation: correctWordPulse 0.8s ease-out forwards !important;
}

@keyframes correctWordPulse {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 0 5px rgba(254, 228, 64, 0.5)) brightness(1);
  }

  30% {
    transform: scale(1.08);
    filter: drop-shadow(0 0 25px rgba(254, 228, 64, 1)) brightness(1.25);
  }

  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 5px rgba(254, 228, 64, 0.5)) brightness(1);
  }
}

/* WRONG ANSWER: Peaceful Dimming */
.option-container.dimmed-cloud {
  pointer-events: none;
  transition: filter 0.25s ease-out;
}

.option-container.dimmed-cloud .option-cloud {
  filter: brightness(0.8) !important;
  /* Dim by 20% */
  transition: filter 0.25s ease-out;
}

/* Peaceful Melting into Water */
.option-container.melting-water-peaceful {
  opacity: 0;
  transform: translateY(30px) scaleY(1.1) scaleX(0.95) !important;
  filter: blur(5px);
  transition:
    transform 0.85s ease-in,
    opacity 0.75s ease-in,
    filter 0.8s ease-in;
  pointer-events: none;
}

/* =========================================
   UI Polish Layout Fixes 
   ========================================= */

/* Background Layers Styling */
.background-layers {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  filter: blur(3px) brightness(0.85);
  box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.5);
  /* Vignette */
  transition:
    filter 1s ease,
    background 1s ease;
}

/* Enlarge characters by 10% */
#shiva-character {
  transform: scale(1.1);
  transform-origin: bottom center;
}

#vishnu-character {
  transform: scale(1.1);
  transform-origin: bottom center;
}

/* Duplicate river-options-container removed in favor of unified container at line 699 */

.option-container {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  z-index: 2;
  cursor: pointer;
  transition:
    transform 0.3s ease,
    filter 0.3s ease,
    opacity 0.5s ease;
}

/* Arc positioning removed for proper horizontal alignment */

.option-container:hover {
  transform: translateY(-10px) scale(1.05) !important;
  z-index: 10;
}

/* Duplicate cloud base styling removed */

/* Journey Tracker */

.journey-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0.5;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

.journey-node.active {
  opacity: 1;
  transform: scale(1.1);
  filter: drop-shadow(0 0 5px rgba(254, 228, 64, 0.6));
}

/* --- CINEMATIC ENDING SCREEN --- */
.screen-overlay.cinematic-ending {
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  flex-direction: column;
}

.cinematic-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  height: 100%;
  padding-top: 20cqh;
  /* ~20% from the top */
  z-index: 10;
}

.wisdom-restored-img {
  width: clamp(300px, 60cqw, 1000px);
  /* 55-65% of screen width */
  max-width: 100%;
  height: auto;
  object-fit: contain;
  opacity: 0;
  image-rendering: auto;
  /* Ensure high-DPI crisp rendering */
  animation:
    cinematicFadeIn 1s ease-out forwards,
    floatPulse 6s ease-in-out infinite alternate 1s;
}

.final-score-float {
  margin-top: -120px;
  text-align: center;
  opacity: 0;
  animation: cinematicFadeIn 2s ease-out 1s forwards;
  color: #f9e286;
  text-shadow:
    0 0 10px rgba(255, 215, 0, 0.6),
    0 2px 4px rgba(0, 0, 0, 0.5);
  font-family: "Cinzel", serif;
}

.final-score-float .score-title {
  font-size: clamp(20px, 2.5cqw, 32px);
  font-weight: 700;
  margin-bottom: 5px;
}

.final-score-float .score-stars {
  font-size: clamp(14px, 1.5cqw, 20px);
  letter-spacing: 2px;
  margin-bottom: 10px;
}

.final-score-float .score-value {
  font-size: clamp(32px, 4cqw, 56px);
  font-weight: 800;
}

.ending-buttons {
  margin-top: 50px;
  display: flex;
  gap: 20px;
  opacity: 0;
  /* JS will remove hidden and trigger fade in */
  transition: opacity 1s ease-in;
}

.ending-buttons:not(.hidden) {
  opacity: 1;
}

.ending-effects-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

/* Animations */
@keyframes cinematicFadeIn {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes floatPulse {
  0% {
    transform: translateY(0);
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.25));
  }

  100% {
    transform: translateY(-3px);
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.45));
  }
}

/* Celebration particles generated in visual.js */
.celebration-particle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle,
      rgba(255, 240, 150, 1) 0%,
      rgba(255, 200, 0, 0) 70%);
  animation: floatUpSlow linear forwards;
}

.celebration-petal {
  position: absolute;
  background: url("../assets/clouds/lotus.png") no-repeat center center;
  background-size: contain;
  animation: driftDown linear forwards;
}

@keyframes floatUpSlow {
  0% {
    transform: translateY(0) scale(0.5);
    opacity: 0;
  }

  20% {
    opacity: 1;
  }

  80% {
    opacity: 0.8;
  }

  100% {
    transform: translateY(-100%) scale(1.2);
    opacity: 0;
  }
}

@keyframes driftDown {
  0% {
    transform: translateY(-10cqh) rotate(0deg) scale(0.2);
    opacity: 0;
  }

  10% {
    opacity: 0.8;
  }

  90% {
    opacity: 0.8;
  }

  100% {
    transform: translateY(110cqh) rotate(360deg) scale(0.4);
    opacity: 0;
  }
}

.state-ending .game-bg {
  filter: blur(3px) brightness(0.75);
  transition: filter 2s ease;
}

.state-ending .scene-content {
  filter: blur(2px) brightness(0.8);
  transition: filter 2s ease;
}

/* ==========================================
   Ambient Environment Animations (Mount Kailash)
   ========================================== */

.ambient-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

.bg-layer {
  z-index: 0;
}

.fg-layer {
  z-index: 10;
}

.ambient-firefly {
  position: absolute;
  border-radius: 50%;
  background: #fee440;
  box-shadow: 0 0 6px 2px rgba(254, 228, 64, 0.6);
  pointer-events: none;
  opacity: 0;
  animation:
    fireflyWander var(--dur) ease-in-out infinite alternate,
    fireflyBlink var(--blink) ease-in-out infinite alternate;
  will-change: transform, opacity;
}

@keyframes fireflyWander {
  0% {
    transform: translate(0, 0);
  }

  100% {
    transform: translate(var(--tx), var(--ty));
  }
}

@keyframes fireflyBlink {
  0% {
    opacity: 0.1;
    scale: 0.8;
  }

  100% {
    opacity: 0.9;
    scale: 1.2;
  }
}

.ambient-bird {
  position: absolute;
  width: 15px;
  height: 15px;
  opacity: 0.7;
  pointer-events: none;
  animation: birdFly var(--dur) linear forwards;
  will-change: transform;
}

.ambient-bird svg {
  width: 100%;
  height: 100%;
  fill: #1a202c;
  /* dark silhouette */
}

@keyframes birdFly {
  0% {
    transform: translate(-50px, var(--sy)) scale(var(--s));
    opacity: 0;
  }

  10% {
    opacity: var(--op);
  }

  90% {
    opacity: var(--op);
  }

  100% {
    transform: translate(110cqw, var(--ey)) scale(var(--s));
    opacity: 0;
  }
}

.ambient-leaf {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #2d6a4f;
  border-radius: 0 50% 0 50%;
  opacity: 0.6;
  pointer-events: none;
  animation:
    leafDrift var(--dur) linear forwards,
    leafSpin var(--spin) ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes leafDrift {
  0% {
    transform: translate(var(--sx), -20px);
    opacity: 0;
  }

  10% {
    opacity: var(--op);
  }

  90% {
    opacity: var(--op);
  }

  100% {
    transform: translate(var(--ex), 110cqh);
    opacity: 0;
  }
}

@keyframes leafSpin {
  0% {
    rotate: -30deg;
  }

  100% {
    rotate: 60deg;
  }
}

/* Lotuses Bobbing & Glow */
.lotus-flower-svg {
  animation: lotusBob 4s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 5px rgba(254, 228, 64, 0.3));
}

@keyframes lotusBob {
  0% {
    transform: translateY(0) rotate(-1deg);
    filter: drop-shadow(0 0 3px rgba(254, 228, 64, 0.2));
  }

  100% {
    transform: translateY(-4px) rotate(1deg);
    filter: drop-shadow(0 0 8px rgba(254, 228, 64, 0.5));
  }
}

/* Character Breathing Glow */
.character {
  animation: divineBreath 6s ease-in-out infinite alternate;
}

@keyframes divineBreath {
  0% {
    filter: drop-shadow(0 0 10px rgba(254, 228, 64, 0.15));
  }

  100% {
    filter: drop-shadow(0 0 25px rgba(254, 228, 64, 0.4));
  }
}

/* =========================================================
   GLOBAL GAME VIEWPORT LOCK — DO NOT REMOVE
   ========================================================= */

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

html {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden !important;
  overscroll-behavior: none;
  scrollbar-width: none;
}

body {
  position: fixed !important;
  inset: 0 !important;

  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;

  margin: 0 !important;
  padding: 0 !important;

  overflow: hidden !important;
  overscroll-behavior: none;
  touch-action: none;

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

html::-webkit-scrollbar,
body::-webkit-scrollbar,
body *::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Replace these selectors with the actual root screen selectors if different */
#game-container,
#app,
.game-wrapper,
.game-container,
.screen,
.game-screen,
.start-screen,
.landing-screen,
.loading-screen,
.instruction-screen,
.gameplay-screen,
.end-screen {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;

  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;

  margin: 0;
  padding: 0;

  overflow: hidden !important;
  overscroll-behavior: none;
}