/* Animated Gradient Background for a dynamic look */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Global resets */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  /* A colorful animated gradient background */
  background: linear-gradient(-45deg, #81c1e8, #9ad3de, #c1e9d3, #f2f2d0);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  font-family: 'Luckiest Guy', cursive;
  color: #333;
  padding-top: 80px; /* leave room for the fixed header */
}

/* Fixed header: subtle, translucent with strawberry-pink border */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 2px solid #fc5a8d;
  padding: 15px 30px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  z-index: 100;
  text-align: center;
}

header h1 {
  font-size: 2em;
  color: #333;
}

/* Main container: game (left) and results (right) */
#main-container {
  display: flex;
  flex-wrap: wrap;
  padding: 20px;
}

/* Game container styling */
#game-container {
  flex: 1 1 65%;
  background: #fff;
  margin: 10px;
  border-radius: 15px;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.15);
  padding: 20px;
  position: relative;
}

/* Results container styling */
#result-container {
  flex: 1 1 30%;
  background: #fff4e6;
  border: 2px solid #ffcccb;
  border-radius: 10px;
  margin: 10px;
  padding: 20px;
  height: fit-content;
}

/* Board container: holds flashing word board and mascot side by side */
#board-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
}

/* Flashing word board: a "wooden board" look with a thick brown border */
#display {
  width: 80%;  /* Responsive width but within limits */
  max-width: 600px; /* Prevent oversized expansion */
  height: 150px; /* Fixed height to prevent resizing */
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: clamp(2rem, 5vw, 3rem); /* Responsive font sizing */
  overflow: hidden; /* Prevent large words from expanding the box */
  word-wrap: break-word; /* Ensure words wrap within the box */
  white-space: nowrap; /* Keep text in one line unless it's too long */
  border: 5px solid #8B4513;
  padding: 20px;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Flash animation for the board */
#display.flash {
  animation: flashAnimation 0.6s ease;
}

@keyframes flashAnimation {
  0% {
    background-color: #fff5e1;
    box-shadow: 0 0 5px rgba(252, 90, 141, 0.5);
    transform: scale(1);
  }
  50% {
    background-color: #ffe0e0;
    box-shadow: 0 0 15px rgba(252, 90, 141, 0.8);
    transform: scale(1.05); /* Slightly bigger */
  }
  100% {
    background-color: #fff5e1;
    box-shadow: 0 0 5px rgba(252, 90, 141, 0.5);
    transform: scale(1);
  }
}


/* Mascot container (next to the board) */
#mascot-container {
  width: 150px;
  height: 150px;
  position: relative;
}

/* Mascot SVG - default state before game: gentle low bounce */
#mascot {
  width: 100%;
  height: auto;
}

.mascot-before {
  animation: bounceLow 2s infinite;
}

@keyframes bounceLow {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

/* Mascot state during game: bouncing high */
.mascot-during {
  animation: bounceHigh 1s infinite;
}

@keyframes bounceHigh {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-15px);
  }
}

/* Mascot state after game: celebratory spin */
.mascot-after {
  animation: celebratorySpin 2s infinite;
}

@keyframes celebratorySpin {
  0% {
    transform: rotate(0deg) translateY(0);
  }
  50% {
    transform: rotate(360deg) translateY(-10px);
  }
  100% {
    transform: rotate(0deg) translateY(0);
  }
}

/* Tail: continuously wagging */
.tail {
  transform-origin: 100px 115px;
  animation: wag 0.8s infinite;
}

@keyframes wag {
  0% {
    transform: rotate(10deg);
  }
  50% {
    transform: rotate(-10deg);
  }
  100% {
    transform: rotate(10deg);
  }
}

/* Button container styling */
.button-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 20px 0;
}

.button-container button {
  padding: 12px 20px;
  font-size: 1.2em;
  border: none;
  border-radius: 8px;
  background: #ffacd9;
  color: white;
  cursor: pointer;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
  transition: background 0.3s ease, transform 0.2s ease;
  flex: 1 1 auto;
}

.button-container button:hover {
  background: #fc5a8d;
  transform: scale(1.05);
}

.button-container button:active {
  background: #e03e76;
}

/* Active state for difficulty buttons */
button.active {
  background: #fc5a8d;
}

/* Results list styling */
#wordList {
  font-size: 1.5em;
  line-height: 1.4;
}

/* New sections below the game */
#aboutSection,
#privacyPolicy {
  background: #f7f7f7;
  border: 1px solid #ddd;
  padding: 20px;
  margin: 20px 10px;
  border-radius: 10px;
}

#aboutSection h2,
#privacyPolicy h2 {
  margin-bottom: 10px;
  text-align: center;
}

#aboutSection strong {
  color: #007bff;
}

#aboutSection p,
#privacyPolicy p {
  font-size: 1em;
  line-height: 1.6;
}

footer {
  background-color: #333;
  color: white;
  text-align: center;
  padding: 10px;
  position: fixed;
  bottom: 0;
  width: 100%;
}

footer a {
  color: lightpink;
  text-decoration: none;
  margin: 0 10px;
}

footer a:hover {
  color: white;
}

/* Responsive adjustments */
@media (max-width: 800px) {
  #main-container {
    flex-direction: column;
    align-items: center;
  }
  #game-container,
  #result-container,
  #aboutSection,
  #privacyPolicy {
    flex: 1 1 90%;
  }
  header {
    position: relative;
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 600px) {
  #display {
    height: 120px;
    font-size: 2em;
    padding: 15px;
    margin-right: 10px;
  }
  .button-container button {
    font-size: 1em;
    padding: 10px 15px;
  }
  #wordList {
    font-size: 1.2em;
  }
  #mascot-container {
    width: 120px;
    height: 120px;
  }
}

@media (max-width: 400px) {
  #display {
    height: 100px;
    font-size: 1.8rem;
  }
}