/* --- General Utility Classes --- */

.hidden {
  opacity: 0;
  pointer-events: none;
  /* Prevents clicks/interactions on hidden elements */
}

/* --- User Word Styling --- */

.userWord {
  cursor: pointer;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
  background-color: #f3f4f6;
  display: inline-block;
  margin-right: 0.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.userWord:hover {
  color: #2563eb;
  /* Tailwind's blue-600 */
  background-color: #e0e7ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(37, 99, 235, 0.1);
}

.highlighted-word {
  font-size: 1.25rem;
  font-weight: bold;
  color: #ef4444;
  /* Tailwind's red-500 */
  background-color: #fee2e2;
  border-left: 3px solid #ef4444;
  padding: 0.5rem 1rem;
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
  display: inline-block;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }

  70% {
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

/* --- Game Container Enhancement --- */
#gameContainer {
  transition: all 0.5s ease;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border-radius: 1.5rem;
  overflow: hidden;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

#gameContainer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, #3b82f6, #6366f1, #8b5cf6);
  border-radius: 6px 6px 0 0;
}

/* --- Word Input Enhancement --- */
#wordInput {
  border-radius: 0.75rem;
  font-size: 1.25rem;
  padding: 0.75rem 1.25rem;
  border: 2px solid #e5e7eb;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

#wordInput:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3);
  transform: translateY(-1px);
}

/* --- Submit Button Enhancement --- */
#submitWord {
  border-radius: 0.75rem;
  font-size: 1.125rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #4f46e5, #3b82f6);
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  position: relative;
  overflow: hidden;
}

#submitWord:hover {
  background: linear-gradient(135deg, #4338ca, #2563eb);
  transform: translateY(-2px);
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.15);
}

#submitWord:active {
  transform: translateY(1px);
}

/* --- Hearts Animation --- */
.heart {
  display: inline-block;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.heart:hover {
  transform: scale(1.3);
}

.heart-beat {
  animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
  0% {
    transform: scale(1);
  }

  25% {
    transform: scale(1.3);
  }

  50% {
    transform: scale(1);
  }

  75% {
    transform: scale(1.3);
  }

  100% {
    transform: scale(1);
  }
}

/* --- Words List Styling --- */
#wordsList {
  background-color: #f9fafb;
  border-radius: 0.75rem;
  transition: all 0.3s ease;
  min-height: 250px;
  border: 1px solid #e5e7eb;
}

#currentlyHighlighted {
  display: flex;
  flex-wrap: wrap;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px dashed #d1d5db;
}

#allPreviousWords {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* --- Popup Styles --- */

/* General Popup Overlay */
.popup-overlay {
  display: flex;
  /* Use flexbox for centering */
  align-items: center;
  justify-content: center;
  opacity: 1;
  z-index: 9999;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(4px);
}

.popup-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* General Popup Content */
.popup-content {
  transition: all 0.3s ease;
  transform: scale(1);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.popup-content .close-button {
  transition: all 0.2s ease;
}

.popup-content .close-button:hover {
  background-color: #ef4444;
  color: white;
  border-color: #ef4444;
}

/* Specific Popup: #definitionPopup */
#definitionPopup .popup-content {
  max-width: 28rem;
  max-height: 80vh;
  /* Limiting height, with scroll */
  width: 100%;
  margin: 1rem;
  padding: 1.5rem;
  border-radius: 1rem;
  background: white;
  overflow-y: auto;
  /* Vertical scrollbar if needed */
  position: relative;
  /*  for absolutely positioned children, if any */
}

/* Specific Popup: #howToPlayPopup */
#howToPlayPopup {
  display: none;
  /* Initially hidden */
  position: fixed;
  inset: 0;
  /*  shorthand for top: 0; right: 0; bottom: 0; left: 0; */
  background-color: rgba(0, 0, 0, 0.5);
  /* Semi-transparent black */
  z-index: 9999; /* Ensure above navbar */
  /* High z-index to be on top */
  align-items: center;
  justify-content: center;
  opacity: 1;
  /* Initial opacity set*/
  transition: opacity 0.3s ease;
  backdrop-filter: blur(4px);
}

#howToPlayPopup.hidden {
  opacity: 0;
  pointer-events: none;
}

#howToPlayPopup.show {
  opacity: 1;
}

/* How-to layout enhancements */
#howToPlayPopup .howto-content {
  padding: 1.75rem;
}

#howToPlayPopup .howto-header h2 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

#howToPlayPopup .howto-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  #howToPlayPopup .howto-grid {
    grid-template-columns: 1fr 1fr;
  }
}

#howToPlayPopup .howto-card {
  text-align: center;
  background: linear-gradient(135deg, #f8fafc, #ffffff);
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

#howToPlayPopup .icon-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 18px;
  margin-bottom: 0.5rem;
  margin: 0 auto 0.5rem; /* center the circle horizontally */
}

#howToPlayPopup h3 {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #1f2937;
}

#howToPlayPopup .rule-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.25rem;
}

#howToPlayPopup .rule-list li {
  color: #374151;
  font-size: 0.95rem;
}

#howToPlayPopup .muted {
  color: #6b7280;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

#howToPlayPopup .badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #1d4ed8;
  background: #e0e7ff;
  border: 1px solid #c7d2fe;
  padding: 0.1rem 0.4rem;
  border-radius: 9999px;
  margin-right: 0.25rem;
}

#howToPlayPopup .kbd {
  display: inline-block;
  font-size: 0.8rem;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-bottom-width: 3px;
  border-radius: 6px;
  padding: 0.15rem 0.35rem;
  color: #111827;
  margin-right: 0.25rem;
}

/* --- Score Counter Animation --- */
#scoreCounter {
  position: relative;
  padding: 0.75rem 1.5rem;
  border-radius: 1rem;
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
  border: 1px solid #bfdbfe;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
}

#scoreCounter:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 10px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

#scoreValue {
  position: relative;
  display: inline-block;
  transition: all 0.3s ease;
  font-size: 1.5rem;
  font-weight: bold;
  color: #4f46e5;
}

#scoreValue.updated {
  animation: scoreUpdate 0.6s ease;
}

@keyframes scoreUpdate {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.3);
    color: #4f46e5;
    text-shadow: 0 0 8px rgba(79, 70, 229, 0.6);
  }
}

/* --- Fireworks Animation --- */

/* Container */
#fireworksContainer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  /* Ensure it's above other content, but below popups */
  overflow: visible;
  /* Allows fireworks to extend beyond the container */
  pointer-events: none;
  /*  clicks "pass through" the container */
}

/* Individual Firework */
.firework {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  /* Makes it a circle */
  background: radial-gradient(circle, #ff0, transparent);
  opacity: 0;
  /* Starts invisible */
  animation: firework-animation 1s ease-out forwards;
}

@keyframes firework-animation {
  0% {
    transform: scale(0.5);
    opacity: 1;
  }

  100% {
    transform: scale(3) translateY(-100px);
    opacity: 0;
  }
}

/* Firework Particles */
.firework-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff, transparent);
  opacity: 0;
  /* Starts invisible */
  animation: firework-particle-animation 1.5s ease-out forwards;
}

@keyframes firework-particle-animation {
  0% {
    transform: translate(0, 0) scale(1);
    /* Initial position and size */
    opacity: 1;
  }

  100% {
    transform: translate(var(--translateX), var(--translateY)) scale(0.5);
    /*  uses CSS variables */
    opacity: 0;
  }
}

/* --- Bottom Buttons --- */
#bottomButtons button {
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

#bottomButtons button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#playAgain {
  background: linear-gradient(135deg, #4f46e5, #3b82f6);
}

#playAgain:hover {
  background: linear-gradient(135deg, #4338ca, #2563eb);
}

#howToPlayButton {
  background: linear-gradient(135deg, #6b7280, #4b5563);
}

#howToPlayButton:hover {
  background: linear-gradient(135deg, #4b5563, #374151);
}

/* --- Streak Counter Enhancement --- */
#streakCounter {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-radius: 1rem;
  padding: 0.75rem 1.25rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  transition: all 0.3s ease;
}

#streakCounter.pulse-effect {
  animation: streak-pulse 1s ease-in-out;
}

@keyframes streak-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 8px 15px -3px rgba(245, 158, 11, 0.3);
  }
}

#streakValue {
  font-size: 1.5rem;
  font-weight: bold;
  color: #d97706;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* --- Streak Badge Animation --- */
.streak-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  border-radius: 50%;
  margin: 0 2px;
  font-size: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  animation: badge-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  opacity: 0;
  transform: scale(0);
}

@keyframes badge-pop {
  0% {
    opacity: 0;
    transform: scale(0);
  }

  70% {
    opacity: 1;
    transform: scale(1.2);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Apply sequential animation delay to badges */
#streakBadges .streak-badge:nth-child(1) {
  animation-delay: 0s;
}

#streakBadges .streak-badge:nth-child(2) {
  animation-delay: 0.05s;
}

#streakBadges .streak-badge:nth-child(3) {
  animation-delay: 0.1s;
}

#streakBadges .streak-badge:nth-child(4) {
  animation-delay: 0.15s;
}

#streakBadges .streak-badge:nth-child(5) {
  animation-delay: 0.2s;
}

#streakBadges .streak-badge:nth-child(6) {
  animation-delay: 0.25s;
}

#streakBadges .streak-badge:nth-child(7) {
  animation-delay: 0.3s;
}

#streakBadges .streak-badge:nth-child(8) {
  animation-delay: 0.35s;
}

#streakBadges .streak-badge:nth-child(9) {
  animation-delay: 0.4s;
}

#streakBadges .streak-badge:nth-child(10) {
  animation-delay: 0.45s;
}

/* --- Word Entry Animation --- */
@keyframes word-success {
  0% {
    transform: translateY(0);
    background-color: #f3f4f6;
  }

  50% {
    transform: translateY(-10px);
    background-color: #d1fae5;
  }

  100% {
    transform: translateY(0);
    background-color: #f3f4f6;
  }
}

.word-success {
  animation: word-success 0.8s ease-out;
}

/* --- Difficulty Level Indicator --- */
#difficultyIndicator {
  padding: 0.5rem 1rem;
  transition: all 0.3s ease;
}

#difficultyLevel {
  display: inline-block;
  transition: all 0.3s ease;
}

#difficultyLevel.updated {
  animation: difficultyUpdate 0.8s ease;
}

@keyframes difficultyUpdate {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.5);
    color: #4f46e5;
  }
}
/* Dice button: larger, borderless, more visible */
.dice-button {
  width: 64px;
  height: 64px;
  font-size: 40px;
  line-height: 1;
  background: #ffffff;
  color: #111827; /* near-black for contrast */
  border: none;   /* remove border */
  border-radius: 9999px; /* full circle */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.dice-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
  background-color: #f8fafc; /* slightly lighter on hover */
}