:root {
  --primary-color: #1e88e5;
  --secondary-color: #42a5f5;
  --accent-color: #64b5f6;
  --light-color: #e3f2fd;
  --dark-color: #1565c0;
  --white: #ffffff;
  --error-color: #ff5252;
  --text-color: #212121;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

body {
  background: rgba(179, 229, 252, 0.541);
  color: var(--text-color);
  line-height: 1.6;
  padding-top: 100px;
}

/* Header Styles */
.header {
  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:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.logo {
  font-size: 28px;
  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;
}

.header .navigation ul li {
  float: left;
  position: relative;
}

.header .navigation ul li a {
  font-size: 16px;
  font-weight: 500;
  color: var(--white);
  text-decoration: none;
  padding: 22px 20px;
  display: block;
  transition: all 0.3s ease;
}

.header .navigation ul li a:hover {
  background-color: rgba(255, 255, 255, 0.733);
  transform: translateY(-2px);
  color: var(--text-color);
}

#toggle,
.header label {
  display: none;
  cursor: pointer;
}

.menu {
  width: 28px;
  height: 28px;
  filter: brightness(0) invert(1);
}

@media (max-width: 950px) {
  .header label {
    display: initial;
  }

  .header {
    padding: 15px 10%;
  }

  .header .navigation {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--primary-color);
    display: none;
    border-radius: 0 0 12px 12px;
  }

  .header .navigation ul li {
    width: 100%;
  }

  .header .navigation ul li a {
    padding: 12px 20px;
  }

  #toggle:checked ~ .navigation {
    display: block;
    animation: slideDown 0.4s ease-out;
  }
}

/* Game Styles */
h1 {
  color: var(--primary-color);
  text-align: center;
  font-size: 2.5rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 5px;
  background: linear-gradient(
    to right,
    var(--primary-color),
    var(--secondary-color)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
}

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;
}

.game-container {
  display: flex;
  flex-wrap: wrap;
  gap: 25px;
  justify-content: center;
  margin-top: 20px;
}

.word-search {
  background-color: white;
  padding: 20px;
  border-radius: 15px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  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(30, 136, 229, 0.1) 0%,
    rgba(66, 165, 245, 0.1) 50%,
    rgba(100, 181, 246, 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: bold;
  cursor: pointer;
  background-color: white;
  transition: all 0.3s ease;
  font-size: 1.1rem;
  color: var(--text-color);
  position: relative;
}

td:hover {
  transform: scale(1.05);
  z-index: 10;
  box-shadow: 0 0 10px rgba(66, 165, 245, 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: white;
  padding: 20px;
  border-radius: 15px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  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;
}

.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: 10px;
  border-radius: 8px;
  background-color: #f8f9fa;
  display: flex;
  align-items: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.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: #e8f4fd;
  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: rgba(255, 255, 255, 0.9);
  padding: 15px;
  border-radius: 50px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  max-width: 600px;
  backdrop-filter: blur(5px);
  z-index: 100;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

button {
  background: linear-gradient(
    to right,
    var(--primary-color),
    var(--secondary-color)
  );
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 50px;
  cursor: pointer;
  margin: 0 10px;
  font-weight: bold;
  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(-2px);
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.15);
}

button:hover::after {
  transform: translateX(100%);
}

button:active {
  transform: translateY(0);
}

#reset-button {
  background: linear-gradient(to right, #f44336, #d32f2f);
}

.stats {
  text-align: center;
  margin: 20px auto;
  font-weight: bold;
  color: var(--text-color);
  position: sticky;
  top: 100px;
  background-color: rgba(255, 255, 255, 0.9);
  padding: 15px;
  border-radius: 50px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  max-width: 300px;
  z-index: 100;
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-size: 1.1rem;
}

.stats span {
  color: var(--primary-color);
  font-weight: bold;
}

.instructions {
  background-color: white;
  padding: 20px;
  border-radius: 15px;
  margin: 20px auto;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  border-left: 5px solid var(--accent-color);
  position: relative;
  max-width: 800px;
}

.instructions::before {
  content: "ℹ️";
  position: absolute;
  left: 15px;
  top: 15px;
  font-size: 1.5rem;
}

.instructions p {
  margin-left: 40px;
}

.instructions strong {
  color: var(--primary-color);
}

.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  background-color: var(--accent-color);
  opacity: 0;
  z-index: 999;
  animation: confetti-fall 5s ease-in-out;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(-100px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(360deg);
    opacity: 0;
  }
}

@media (max-width: 768px) {
  .game-container {
    flex-direction: column;
  }

  .word-list {
    max-width: 100%;
  }

  button {
    margin: 5px;
    padding: 8px 15px;
    font-size: 0.8rem;
  }

  td {
    width: 30px;
    height: 30px;
    font-size: 1rem;
  }

  .header {
    padding: 15px 5%;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
