/* ==========================================================================
   SPELLER: Word Spelling & Phonics Quest Stylesheet
   ========================================================================== */

/* --------------------------------------------------------------------------
   Hub Screen Box 8 (Wasp Card)
   -------------------------------------------------------------------------- */
.wasp-stage {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #FDE047 0%, #EAB308 50%, #78350F 100%);
  border: 4px solid #FEF08A;
  box-shadow: 
    0 0 20px rgba(250, 204, 21, 0.6),
    0 8px 0 #78350F,
    inset 0 2px 4px rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wasp-stage:hover {
  transform: scale(1.1) rotate(-5deg);
}

.wasp-stage .wasp-wings {
  animation: wingFlutter 0.12s infinite alternate ease-in-out;
  transform-origin: 50% 40%;
}

@keyframes wingFlutter {
  0% { transform: scaleX(0.9) rotate(-3deg); }
  100% { transform: scaleX(1.1) rotate(4deg); }
}

/* --------------------------------------------------------------------------
   Speller Game Workspace Container
   -------------------------------------------------------------------------- */
#speller-app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 20%, #2E1065 0%, #0F051D 100%);
  color: #FFFFFF;
}

.speller-workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 24px;
}

@media (max-width: 960px) {
  .speller-workspace {
    grid-template-columns: 1fr;
  }
}

.speller-arena {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* --------------------------------------------------------------------------
   Object Picture Card (Displays Illustrated Object)
   -------------------------------------------------------------------------- */
.speller-object-card {
  background: rgba(30, 27, 75, 0.75);
  border: 3px solid #8B5CF6;
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  box-shadow: 
    0 10px 28px rgba(0, 0, 0, 0.5),
    0 4px 0 #5B21B6;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.speller-object-graphic {
  width: 140px;
  height: 140px;
  min-width: 140px;
  background: radial-gradient(circle at 40% 40%, rgba(139, 92, 246, 0.3) 0%, rgba(15, 5, 29, 0.8) 100%);
  border: 3px solid #A78BFA;
  border-radius: 20px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.2);
}

.btn-speller-speaker {
  background: rgba(139, 92, 246, 0.35);
  border: 2px solid #C4B5FD;
  color: #FFFFFF;
  border-radius: 50%;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.35rem;
  transition: transform 0.15s ease, background 0.15s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.btn-speller-speaker:hover {
  transform: scale(1.15);
  background: rgba(139, 92, 246, 0.7);
  box-shadow: 0 0 16px rgba(196, 181, 253, 0.6);
}

.btn-speller-speaker:active {
  transform: scale(0.95);
}

/* Comedic Bounce Off Screen Keyframe Animation */
.speller-object-card.bounce-off-screen {
  animation: objectBounceOffScreen 1.5s cubic-bezier(0.25, 1, 0.5, 1) forwards !important;
  z-index: 999;
}

@keyframes objectBounceOffScreen {
  0% {
    transform: scale(1) translate(0, 0) rotate(0deg);
  }
  15% {
    transform: scale(1.25, 0.75) translate(0, 20px) rotate(4deg);
  }
  30% {
    transform: scale(0.85, 1.25) translate(80px, -180px) rotate(25deg);
  }
  50% {
    transform: scale(1.15, 0.85) translate(220px, 10px) rotate(60deg);
  }
  70% {
    transform: scale(0.9, 1.15) translate(420px, -350px) rotate(140deg);
  }
  100% {
    transform: scale(0.5, 1.3) translate(950px, -900px) rotate(360deg);
    opacity: 0;
  }
}

@keyframes spellerObjectDropIn {
  0% { transform: translateY(-40px) scale(0.8); opacity: 0; }
  70% { transform: translateY(6px) scale(1.04); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* --------------------------------------------------------------------------
   Blank LEGO Letter Construction Slots
   -------------------------------------------------------------------------- */
.speller-slots-stage {
  background: rgba(15, 23, 42, 0.85);
  border: 3px solid #334155;
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 140px;
  box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.6);
  overflow: visible;
}

.speller-slots-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
  width: 100%;
  position: relative;
  z-index: 5;
}

.speller-slot {
  width: 68px;
  height: 74px;
  border-radius: 10px;
  border: 3px dashed #64748B;
  background: rgba(30, 41, 59, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
}

.speller-slot.drag-over {
  border-color: #FDE047;
  background: rgba(234, 179, 8, 0.25);
  transform: scale(1.08);
}

.speller-slot.empty .slot-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #64748B;
}

.speller-slot.empty .slot-stud-ghost {
  width: 20px;
  height: 6px;
  border-radius: 3px;
  background: rgba(100, 116, 139, 0.4);
  margin-bottom: 4px;
}

.speller-slot.empty .slot-number {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 800;
  color: #64748B;
}

/* --------------------------------------------------------------------------
   Tactile LEGO Letter Tile Brick
   -------------------------------------------------------------------------- */
.speller-letter-tile {
  width: 62px;
  height: 68px;
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 50%, #B45309 100%);
  border: 2px solid #FDE047;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  box-shadow: 
    0 4px 0 #78350F,
    0 6px 12px rgba(0, 0, 0, 0.5),
    inset 0 2px 4px rgba(255, 255, 255, 0.6);
  animation: letterDropIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.speller-letter-tile:hover {
  transform: translateY(-4px) scale(1.06);
  box-shadow: 
    0 8px 0 #78350F,
    0 10px 18px rgba(0, 0, 0, 0.6);
}

.speller-letter-tile .tile-studs {
  position: absolute;
  top: 3px;
  display: flex;
  gap: 12px;
}

.speller-letter-tile .tile-studs .stud {
  width: 10px;
  height: 4px;
  background: #FDE047;
  border-radius: 2px;
  box-shadow: 0 1px 0 #78350F;
}

.speller-letter-tile .tile-char {
  font-family: var(--font-main);
  font-size: 2.2rem;
  font-weight: 900;
  color: #FFFFFF;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8), 0 0 8px rgba(253, 224, 71, 0.5);
  margin-top: 4px;
}

@keyframes letterDropIn {
  0% { transform: translateY(-24px) scale(0.6); opacity: 0; }
  70% { transform: translateY(4px) scale(1.12); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* --------------------------------------------------------------------------
   Fire Mistake Layer (Erupts over slots on mistake)
   -------------------------------------------------------------------------- */
.speller-fire-layer {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  pointer-events: none;
  opacity: 0;
  z-index: 20;
  background: radial-gradient(circle at 50% 50%, rgba(239, 68, 68, 0.4) 0%, rgba(220, 38, 38, 0.1) 60%, transparent 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: opacity 0.2s ease;
}

.speller-fire-layer.active {
  opacity: 1;
  animation: fireFlash 1.2s ease-out;
}

.speller-fire-layer .flames-row {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 90px;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
}

.speller-fire-layer .flame {
  width: 28px;
  height: 70px;
  background: radial-gradient(ellipse at 50% 80%, #FEF08A 0%, #F59E0B 40%, #EF4444 80%, transparent 100%);
  border-radius: 50% 50% 20% 20% / 80% 80% 20% 20%;
  transform-origin: 50% 100%;
  animation: flameLick 0.35s infinite alternate ease-in-out;
  filter: blur(1px);
}

.speller-fire-layer .flame:nth-child(even) {
  height: 85px;
  animation-duration: 0.28s;
  animation-delay: 0.1s;
}

.speller-fire-layer .flame:nth-child(3n) {
  height: 60px;
  animation-duration: 0.4s;
  animation-delay: 0.05s;
}

@keyframes flameLick {
  0% { transform: scaleY(0.8) skewX(-4deg); }
  100% { transform: scaleY(1.25) skewX(5deg); }
}

@keyframes fireFlash {
  0% { opacity: 0; transform: scale(0.95); }
  20% { opacity: 1; transform: scale(1.02); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* --------------------------------------------------------------------------
   Scrambled Letter Suggestions Tray Pool
   -------------------------------------------------------------------------- */
.speller-pool-card {
  background: rgba(30, 27, 75, 0.6);
  border: 2px solid #6366F1;
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.speller-pool-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: #A5B4FC;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.speller-letter-pool-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.speller-pool-tile {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
  border: 2px solid #93C5FD;
  box-shadow: 0 4px 0 #1E3A8A, 0 4px 8px rgba(0, 0, 0, 0.4);
  font-family: var(--font-main);
  font-size: 1.6rem;
  font-weight: 900;
  color: #FFFFFF;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.speller-pool-tile:hover:not(.used) {
  transform: translateY(-3px) scale(1.1);
  box-shadow: 0 6px 0 #1E3A8A, 0 8px 14px rgba(0, 0, 0, 0.5);
  border-color: #BFDBFE;
}

.speller-pool-tile.used {
  opacity: 0.25;
  cursor: not-allowed;
  transform: scale(0.9);
  box-shadow: none;
}

/* --------------------------------------------------------------------------
   Companion Card Stage
   -------------------------------------------------------------------------- */
#speller-app-container .companion-card-stage {
  background: rgba(30, 27, 75, 0.7);
  border: 2px solid #8B5CF6;
  border-radius: var(--radius-xl);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 4px 0 #5B21B6;
}

#speller-app-container .companion-avatar-large {
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.6));
  transition: transform 0.25s ease;
}

#speller-app-container .companion-avatar-large svg {
  width: 100%;
  height: 100%;
}

