/* ============================================
   LEVEL 6 — The Shadowy Swamp
   Character: Shade
   ============================================ */

/* ── Character name plates ── */
.name-shade {
  color: #a080d0 !important;
  text-shadow: 0 0 8px rgba(160, 128, 208, 0.6);
}

/* The Witch — introduced in the post-Level 6 cutscene */
.name-witch {
  color: #6aee6a !important;
  text-shadow: 0 0 10px rgba(74, 170, 90, 0.7);
}


/* ══════════════════════════════════════════
   SWAMP EXPLORATION — Atmospheric Hotspots
   ══════════════════════════════════════════ */

/* Base hotspot container */
.swamp-hotspot {
  transition: opacity 0.6s ease;
}

/* Eyes — blinking glow animation */
.swamp-hotspot-eyes {
  animation: eyes-glow 3s ease-in-out infinite;
}

.swamp-hotspot-eyes img {
  filter: drop-shadow(0 0 6px rgba(255, 200, 50, 0.5));
  transition: opacity 0.2s ease;
}

@keyframes eyes-glow {
  0%, 100% { opacity: 0.7; }
  30% { opacity: 1; }
  35% { opacity: 0.1; }  /* blink */
  40% { opacity: 1; }
  70% { opacity: 0.8; }
}

/* Eyes vanish on tap: rapid blink then fade */
.swamp-eyes-vanish {
  animation: eyes-vanish 0.6s ease-out forwards !important;
}

@keyframes eyes-vanish {
  0% { opacity: 1; transform: scale(1); }
  20% { opacity: 0.1; }
  40% { opacity: 0.8; transform: scale(0.9); }
  60% { opacity: 0.1; }
  80% { opacity: 0.5; transform: scale(0.7); }
  100% { opacity: 0; transform: scale(0.3); }
}

/* Fireflies — drifting glow */
.swamp-hotspot-firefly {
  animation: firefly-drift 4s ease-in-out infinite;
}

.swamp-hotspot-firefly img {
  filter: drop-shadow(0 0 8px rgba(150, 255, 200, 0.6));
  animation: firefly-pulse 2s ease-in-out infinite alternate;
}

@keyframes firefly-drift {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(8px, -5px); }
  50% { transform: translate(-4px, -10px); }
  75% { transform: translate(6px, -3px); }
}

@keyframes firefly-pulse {
  0% { filter: drop-shadow(0 0 4px rgba(150, 255, 200, 0.4)); opacity: 0.6; }
  100% { filter: drop-shadow(0 0 12px rgba(150, 255, 200, 0.8)); opacity: 1; }
}

/* Firefly scatter on tap */
.swamp-firefly-scatter {
  animation: firefly-scatter 0.8s ease-out forwards !important;
}

@keyframes firefly-scatter {
  0% { transform: scale(1); opacity: 1; }
  30% { transform: scale(1.3) translateX(15px) translateY(-20px); opacity: 0.8; }
  60% { transform: scale(0.8) translateX(-10px) translateY(-30px); opacity: 0.5; }
  100% { transform: scale(0.4) translateX(20px) translateY(-40px); opacity: 0; }
}

/* Water ripple area */
.swamp-water-area {
  border-radius: 50%;
  background: rgba(100, 180, 200, 0.08);
  border: 1px solid rgba(100, 180, 200, 0.15);
  transition: all 0.5s ease;
}

.swamp-water-area.ripple-active {
  animation: water-ripple 1.2s ease-out;
}

@keyframes water-ripple {
  0% { box-shadow: 0 0 0 0 rgba(100, 180, 200, 0.4); }
  50% { box-shadow: 0 0 0 20px rgba(100, 180, 200, 0.15), 0 0 0 40px rgba(100, 180, 200, 0.05); }
  100% { box-shadow: 0 0 0 50px rgba(100, 180, 200, 0), 0 0 0 70px rgba(100, 180, 200, 0); }
}

/* Mushroom glow */
.swamp-mushroom-glow {
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 4px rgba(100, 255, 150, 0.3));
  transition: filter 0.5s ease;
}

.swamp-mushroom-glow.glow-bright {
  animation: mushroom-brighten 1s ease-out forwards;
}

@keyframes mushroom-brighten {
  0% { filter: drop-shadow(0 0 4px rgba(100, 255, 150, 0.3)); }
  50% { filter: drop-shadow(0 0 20px rgba(100, 255, 150, 0.8)) brightness(1.5); }
  100% { filter: drop-shadow(0 0 10px rgba(100, 255, 150, 0.5)) brightness(1.2); }
}


/* ══════════════════════════════════════════
   LOCATION GUESS OVERLAY
   ══════════════════════════════════════════ */
.swamp-guess-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 3vh, 28px);
  z-index: 30;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.swamp-guess-overlay.visible {
  opacity: 1;
}

.swamp-guess-prompt {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.6rem, 1.4vw, 0.85rem);
  color: #a080d0;
  text-shadow: 0 0 10px rgba(160, 128, 208, 0.5);
  text-align: center;
}

.swamp-guess-buttons {
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 2vh, 18px);
  width: min(85%, 420px);
}

.swamp-guess-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.5rem, 1.2vw, 0.7rem);
  color: #f0e8d0;
  background: rgba(30, 20, 40, 0.9);
  border: 2px solid rgba(160, 128, 208, 0.4);
  border-radius: 8px;
  padding: clamp(14px, 2.5vh, 22px) clamp(16px, 3vw, 28px);
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.3s ease;
}

.swamp-guess-btn:hover:not(:disabled) {
  transform: scale(1.04);
  border-color: rgba(160, 128, 208, 0.8);
  box-shadow: 0 0 16px rgba(160, 128, 208, 0.3);
}

.swamp-guess-btn:active:not(:disabled) {
  transform: scale(0.97);
}

/* Correct answer — green flash */
.swamp-guess-btn.correct {
  background: rgba(40, 120, 60, 0.9);
  border-color: #6aee6a;
  box-shadow: 0 0 20px rgba(106, 238, 106, 0.5);
  color: #ffffff;
}

/* Wrong answer — red shake */
.swamp-guess-btn.wrong {
  animation: guess-shake 0.4s ease;
  background: rgba(120, 30, 30, 0.7);
  border-color: rgba(200, 80, 80, 0.6);
}

/* Wrong answer — stays dimmed after shake */
.swamp-guess-btn.wrong-disabled {
  opacity: 0.35;
  cursor: not-allowed;
  border-color: rgba(100, 80, 80, 0.3);
}

@keyframes guess-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}


/* ══════════════════════════════════════════
   ICON CONFIRMATION OVERLAY
   ══════════════════════════════════════════ */
.swamp-icon-confirm {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.swamp-icon-confirm.visible {
  opacity: 1;
}

.swamp-icon-grid {
  display: flex;
  gap: clamp(10px, 2.5vw, 20px);
  flex-wrap: wrap;
  justify-content: center;
  max-width: 90%;
}

.swamp-icon-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(4px, 0.8vh, 8px);
  background: rgba(30, 20, 40, 0.9);
  border: 2px solid rgba(160, 128, 208, 0.4);
  border-radius: 8px;
  padding: clamp(8px, 1.5vh, 14px) clamp(10px, 2vw, 18px);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.swamp-icon-btn img {
  width: clamp(40px, 7vw, 64px);
  height: clamp(40px, 7vw, 64px);
  object-fit: contain;
  image-rendering: pixelated;
}

.swamp-icon-btn span {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.35rem, 0.8vw, 0.5rem);
  color: #f0e8d0;
}

.swamp-icon-btn:hover {
  transform: scale(1.08);
  border-color: rgba(160, 128, 208, 0.7);
  box-shadow: 0 0 12px rgba(160, 128, 208, 0.3);
}

.swamp-icon-btn:active {
  transform: scale(0.95);
}

.swamp-icon-btn.correct {
  border-color: #70e890;
  box-shadow: 0 0 20px rgba(112, 232, 144, 0.6);
  animation: icon-correct 0.5s ease-out;
}

@keyframes icon-correct {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.swamp-icon-btn.wrong {
  animation: icon-wrong 0.4s ease-out;
  border-color: #e04040;
}

@keyframes icon-wrong {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.swamp-icon-btn.already-found {
  opacity: 0.25;
  pointer-events: none;
  filter: grayscale(1);
}


/* ══════════════════════════════════════════
   FRAGMENT TRACKER (HUD — top right of scene)
   ══════════════════════════════════════════ */
.swamp-fragment-tracker {
  position: absolute;
  top: clamp(3.5rem, 9vh, 5rem);  /* below spell seals */
  right: clamp(0.5rem, 2vw, 1rem);
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.4rem, 0.9vw, 0.55rem);
  color: #f0e8d0;
  background: rgba(0, 0, 0, 0.55);
  padding: 0.3rem 0.7rem;
  border-radius: 4px;
  border: 1px solid rgba(160, 128, 208, 0.3);
  z-index: 22;
}


/* ══════════════════════════════════════════
   WAITING SCREEN (Shade waits while Eva searches)
   ══════════════════════════════════════════ */
.swamp-waiting-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: clamp(1rem, 4vh, 2rem);
  z-index: 10;
}

.swamp-waiting-shade {
  position: absolute;
  bottom: 30%;
  left: 50%;
  transform: translateX(-50%);
  height: 26%;
  image-rendering: pixelated;
  animation: shade-hover 4s ease-in-out infinite;
  opacity: 0.5;
}

.swamp-waiting-shade img {
  height: 100%;
  width: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 12px rgba(160, 128, 208, 0.4));
  /* Gentle sway layered on top of the container's hover bob */
  animation: shade-sway 6s ease-in-out infinite;
}

@keyframes shade-hover {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-8px); }
}

@keyframes shade-sway {
  0%, 100% { transform: rotate(-1.5deg) translateX(-3px); }
  50% { transform: rotate(1.5deg) translateX(3px); }
}

/* Perk up — the hover bob pauses and Shade does a quick curious hop
   (class toggled by a JS interval in level-6.js) */
.swamp-waiting-shade.perk-up {
  animation-play-state: paused;
}

.swamp-waiting-shade.perk-up img {
  animation: shade-perk-hop 0.9s ease-in-out;
}

@keyframes shade-perk-hop {
  0%, 100% { transform: translateY(0); }
  30% { transform: translateY(-10px) scale(1.04); }
  60% { transform: translateY(0); }
  80% { transform: translateY(-4px); }
}

.swamp-waiting-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  z-index: 15;
}

.swamp-waiting-text {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.5rem, 1.2vw, 0.7rem);
  color: #a080d0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  text-align: center;
}

/* "Adventure in progress" pulse — soft gold dot signalling the game is alive */
.swamp-waiting-text::before {
  content: '';
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  margin-right: 0.6em;
  border-radius: 50%;
  background: #e8c070;
  vertical-align: middle;
  animation: swamp-waiting-dot-pulse 2.2s ease-in-out infinite;
}

@keyframes swamp-waiting-dot-pulse {
  0%, 100% { opacity: 0.35; box-shadow: 0 0 0 0 rgba(232, 192, 112, 0); }
  50% { opacity: 1; box-shadow: 0 0 8px 2px rgba(232, 192, 112, 0.5); }
}

.swamp-waiting-quote {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.4rem, 1vw, 0.55rem);
  color: rgba(240, 232, 208, 0.7);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  text-align: center;
  max-width: 80%;
  min-height: 2.5em;
  transition: opacity 0.5s ease;
  line-height: 1.6;
}

.swamp-waiting-quote.fade-out {
  opacity: 0;
}

.swamp-hint-text {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.4rem, 1vw, 0.55rem);
  color: #e8c070;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  text-align: center;
  max-width: 80%;
  animation: fade-in 0.5s ease-out;
}


/* ══════════════════════════════════════════
   ASSEMBLY SCREEN (icon-ordered letter tiles)
   ══════════════════════════════════════════ */
.swamp-assembly-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(0.5rem, 2vh, 1rem) clamp(0.5rem, 2vw, 1rem);
  z-index: 10;
}

.swamp-assembly-title {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.55rem, 1.3vw, 0.8rem);
  color: #a080d0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  margin-bottom: clamp(0.25rem, 0.8vh, 0.5rem);
}

.swamp-assembly-hint {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.35rem, 0.85vw, 0.5rem);
  color: rgba(240, 232, 208, 0.6);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  margin-bottom: clamp(0.5rem, 1.5vh, 1rem);
  animation: hint-pulse 2s ease-in-out infinite;
}

@keyframes hint-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ── Icon slots row ── */
.assembly-slots-row {
  display: flex;
  gap: clamp(8px, 2vw, 16px);
  margin-bottom: clamp(1.5rem, 4vh, 2.5rem);
}

.assembly-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(4px, 0.8vh, 8px);
}

.assembly-slot-icon {
  width: clamp(48px, 8vw, 72px);
  height: clamp(48px, 8vw, 72px);
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 8px rgba(160, 128, 208, 0.5));
}

.assembly-letter-box {
  width: clamp(44px, 7vw, 64px);
  height: clamp(50px, 8vw, 72px);
  border: 2px solid rgba(160, 128, 208, 0.4);
  border-radius: 6px;
  background: rgba(30, 20, 40, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.8rem, 1.8vw, 1.2rem);
  color: #a080d0;
  cursor: pointer;
  transition: border-color 0.3s ease, background 0.3s ease, transform 0.2s ease;
}

.assembly-letter-box.highlight {
  border-color: rgba(160, 128, 208, 0.7);
  background: rgba(160, 128, 208, 0.12);
  box-shadow: 0 0 10px rgba(160, 128, 208, 0.2);
}

.assembly-letter-box.filled {
  border-color: #70e890;
  color: #70e890;
  background: rgba(112, 232, 144, 0.1);
}

.assembly-letter-box.snap-glow {
  animation: assembly-snap 0.5s ease-out;
}

@keyframes assembly-snap {
  0% { box-shadow: 0 0 0 0 rgba(112, 232, 144, 0.8); transform: scale(1); }
  50% { box-shadow: 0 0 16px 6px rgba(112, 232, 144, 0.5); transform: scale(1.08); }
  100% { box-shadow: none; transform: scale(1); }
}

/* ── Letter tiles row ── */
.assembly-tiles-row {
  display: flex;
  gap: clamp(8px, 2vw, 14px);
  flex-wrap: wrap;
  justify-content: center;
}

.assembly-tile {
  width: clamp(52px, 9vw, 74px);
  height: clamp(56px, 9.5vw, 80px);
  background: rgba(40, 30, 50, 0.85);
  border: 2px solid rgba(160, 128, 208, 0.5);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.9rem, 2vw, 1.3rem);
  color: #f0e8d0;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  animation: tile-invite 1.5s ease-in-out infinite;
}

/* Stagger the bounce per tile */
.assembly-tile:nth-child(1) { animation-delay: 0s; }
.assembly-tile:nth-child(2) { animation-delay: 0.15s; }
.assembly-tile:nth-child(3) { animation-delay: 0.3s; }
.assembly-tile:nth-child(4) { animation-delay: 0.45s; }
.assembly-tile:nth-child(5) { animation-delay: 0.6s; }

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

.assembly-tile:hover {
  animation: none;
  transform: scale(1.08);
  box-shadow: 0 0 10px rgba(160, 128, 208, 0.4);
}

.assembly-tile.selected {
  animation: none;
  transform: scale(1.12);
  border-color: #a080d0;
  box-shadow: 0 0 16px rgba(160, 128, 208, 0.6);
  color: #a080d0;
}

/* Complete — whole row glows */
.assembly-slots-row.assembly-complete .assembly-letter-box.filled {
  animation: assembly-word-glow 1s ease-in-out infinite alternate;
}

@keyframes assembly-word-glow {
  0% { box-shadow: 0 0 8px rgba(112, 232, 144, 0.3); }
  100% { box-shadow: 0 0 20px rgba(112, 232, 144, 0.7); filter: brightness(1.1); }
}
