* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

:root {
  --primary-color: #2041ff;
  --secondary-color: #6ea3ff;
  --accent-color: #ffffff;
  --light-color: #aff3ff;
  --text-color: #000000;
  --white: #ffffff;
  --error-color: #fe615c;
  --success-color: #66cc99;
  --card-bg: rgba(255, 255, 255, 0.9);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* Header styles */
.header-menu {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  padding: 0 10%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-bottom: 2px solid #fff;
  transition: all 0.3s ease;
}

.header-menu:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.logo {
  font-size: 28px;
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  color: var(--white);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
  letter-spacing: 1px;
}

.navigation ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
}

.header-menu .navigation ul li {
  position: relative;
}

.header-menu .navigation ul li a {
  font-family: "Poppins", sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--white);
  text-decoration: none;
  padding: 22px 20px;
  display: block;
  transition: all 0.3s ease;
}

.header-menu .navigation ul li a:hover {
  background-color: rgba(255, 255, 255, 0.733);
  transform: translateY(-2px);
  color: var(--primary-color);
}

#toggle,
.header-menu label {
  display: none;
  cursor: pointer;
}

.menu {
  width: 28px;
  height: 28px;
  filter: brightness(0) invert(1);
}

@media (max-width: 950px) {
  .header-menu label {
    display: initial;
  }

  .header-menu {
    padding: 15px 10%;
  }

  .header-menu .navigation {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--primary-color);
    display: none;
    border-radius: 0 0 12px 12px;
  }

  .header-menu .navigation ul {
    flex-direction: column;
  }

  .header-menu .navigation ul li {
    width: 100%;
  }

  .header-menu .navigation ul li a {
    padding: 12px 20px;
  }

  #toggle:checked ~ .navigation {
    display: block;
    animation: slideDown 0.4s ease-out;
  }
}

/* Body styles */
body {
  font-family: "Poppins", sans-serif;
  background: linear-gradient(135deg, hsl(215, 100%, 86%), #98c6fa, #76a9ec);
  margin: 0;
  padding: 0;
  padding-top: 80px;
  min-height: 100vh;
  color: var(--dark-color);
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Game styles */
.main-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
}

h1 {
  color: var(--primary-color);
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 10px;
  background: linear-gradient(
    to right,
    var(--primary-color),
    var(--secondary-color)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
  font-weight: 700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

h1::after {
  content: "";
  display: block;
  width: 100px;
  height: 4px;
  background: linear-gradient(
    to right,
    var(--primary-color),
    var(--secondary-color)
  );
  margin: 10px auto;
  border-radius: 2px;
}

.instructions {
  background-color: var(--card-bg);
  padding: 20px;
  border-radius: 15px;
  margin: 20px auto;
  box-shadow: var(--shadow);
  border-left: 5px solid var(--accent-color);
  position: relative;
  font-size: 1rem;
  line-height: 1.6;
}

.instructions::before {
  content: "ℹ️";
  position: absolute;
  left: 15px;
  top: 15px;
  font-size: 1.5rem;
}

.instructions p {
  margin-left: 40px;
}

.instructions strong {
  color: var(--primary-color);
  font-weight: 600;
}

.stats {
  text-align: center;
  margin: 20px auto;
  font-weight: 600;
  color: var(--dark-color);
  background-color: var(--card-bg);
  padding: 15px;
  border-radius: 50px;
  box-shadow: var(--shadow);
  max-width: 300px;
  font-size: 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.stats span {
  color: var(--primary-color);
  font-weight: 700;
}

.game-container {
  display: flex;
  flex-wrap: wrap;
  gap: 25px;
  justify-content: center;
  margin-top: 20px;
}

.word-search {
  background-color: var(--card-bg);
  padding: 25px;
  border-radius: 15px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  border: 2px solid var(--light-color);
}

.word-search::before {
  content: "";
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  background: linear-gradient(
    45deg,
    rgba(142, 68, 173, 0.1) 0%,
    rgba(52, 152, 219, 0.1) 50%,
    rgba(241, 196, 15, 0.1) 100%
  );
  z-index: -1;
  border-radius: 20px;
}

table {
  border-collapse: collapse;
  margin: 0 auto;
  background-color: white;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05);
}

td {
  width: 35px;
  height: 35px;
  text-align: center;
  vertical-align: middle;
  border: 1px solid #e0e0e0;
  font-weight: 600;
  cursor: pointer;
  background-color: white;
  transition: all 0.3s ease;
  font-size: 1.1rem;
  color: var(--dark-color);
  position: relative;
}

td:hover {
  transform: scale(1.05);
  z-index: 10;
  box-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
}

td.selected {
  background-color: var(--secondary-color);
  color: white;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
  border-color: var(--secondary-color);
}

td.found {
  background-color: var(--primary-color);
  color: white;
  animation: pop 0.5s ease;
  border-color: var(--primary-color);
}

@keyframes pop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

.word-list {
  background-color: var(--card-bg);
  padding: 25px;
  border-radius: 15px;
  box-shadow: var(--shadow);
  flex: 1;
  min-width: 250px;
  max-width: 350px;
  position: relative;
  overflow: hidden;
  border: 2px solid var(--light-color);
}

.word-list::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 10px;
  background: linear-gradient(
    to right,
    var(--primary-color),
    var(--secondary-color)
  );
}

.word-list h3 {
  margin-top: 15px;
  color: var(--primary-color);
  font-size: 1.5rem;
  text-align: center;
  position: relative;
  padding-bottom: 10px;
  font-weight: 600;
}

.word-list h3::after {
  content: "";
  display: block;
  width: 50px;
  height: 3px;
  background: var(--accent-color);
  margin: 5px auto 0;
  border-radius: 3px;
}

.word-item {
  margin-bottom: 10px;
  padding: 12px 15px;
  border-radius: 8px;
  background-color: #f8f9fa;
  display: flex;
  align-items: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  font-weight: 500;
}

.word-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: linear-gradient(
    to bottom,
    var(--secondary-color),
    var(--primary-color)
  );
}

.word-item:hover {
  transform: translateX(5px);
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.1);
}

.word-item.found {
  background-color: #e8f8f0;
  border-left: 5px solid var(--primary-color);
}

.word-item.found::after {
  content: "✓";
  color: var(--primary-color);
  font-weight: bold;
  margin-left: auto;
  font-size: 1.2rem;
}

.controls {
  margin: 30px auto;
  text-align: center;
  position: sticky;
  bottom: 20px;
  background-color: var(--card-bg);
  padding: 15px;
  border-radius: 50px;
  box-shadow: var(--shadow);
  max-width: 600px;
  z-index: 100;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

button {
  background: linear-gradient(
    to right,
    var(--primary-color),
    var(--secondary-color)
  );
  color: white;
  border: none;
  padding: 12px 25px;
  border-radius: 50px;
  cursor: pointer;
  margin: 0 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

button::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0.3) 0%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}

button:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

button:hover::after {
  transform: translateX(100%);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: linear-gradient(to right, #95a5a6, #7f8c8d);
}

#hint-button {
  background: #f39c12;
}

#reset-button {
  background: linear-gradient(to right, var(--error-color), #c0392b);
}

/* Celebration styles */
.congratulations-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.congratulations-box {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  padding: 40px;
  border-radius: 15px;
  text-align: center;
  max-width: 500px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  transform: scale(0.8);
  transition: transform 0.5s ease;
}

.congratulations-box h2 {
  color: var(--white);
  font-size: 2rem;
  margin-bottom: 20px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.congratulations-box p {
  color: var(--white);
  font-size: 1.2rem;
  margin-bottom: 30px;
}

.congratulations-box button {
  background-color: var(--white);
  color: var(--primary-color);
  border: none;
  padding: 12px 30px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.congratulations-box button:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.show-congratulations {
  opacity: 1;
  pointer-events: auto;
}

.show-congratulations .congratulations-box {
  transform: scale(1);
}

/* Confetti animation */
@keyframes fall {
  to {
    transform: translateY(100vh) rotate(360deg);
  }
}

.confetti {
  position: fixed;
  top: -10px;
  width: 10px;
  height: 10px;
  background-color: var(--accent-color);
  border-radius: 50%;
  animation: fall 3s linear forwards;
  z-index: 1000;
  pointer-events: none;
}

@media (max-width: 768px) {
  .game-container {
    flex-direction: column;
  }

  .word-list {
    max-width: 100%;
  }

  button {
    margin: 5px;
    padding: 10px 15px;
    font-size: 0.8rem;
  }

  td {
    width: 30px;
    height: 30px;
    font-size: 1rem;
  }

  .controls {
    position: static;
    border-radius: 15px;
  }

  h1 {
    font-size: 2rem;
  }
}
