* {
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', sans-serif;
  margin: 0;
  padding: 30px;
  color: #ffffff;
  background:
    linear-gradient(rgba(20, 60, 80, 0.68), rgba(20, 60, 80, 0.68)),
    url('bg.jpeg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

.container {
  max-width: 560px;
  width: 92%;
  margin: 40px auto;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  padding: 30px;
  border-radius: 18px;
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.25);
}

h1 {
  text-align: center;
  font-family: 'Playfair Display', serif;
  font-size: 34px;
  margin-bottom: 12px;
  color: #EAFBFF;
}

.game-instructions {
  font-size: 17px;
  margin-bottom: 16px;
  text-align: center;
  color: #CDEFF7;
}

.difficulty-display {
  text-align: center;
  margin-bottom: 16px;
  font-weight: 600;
  color: #FFE082;
}

.stats {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.16);
  padding: 12px 10px;
  border-radius: 12px;
}

.stats p {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #E0F7FA;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin: 0 auto 20px;
  max-width: 420px;
}

.grid-cell {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: 0.25s ease;
}

.grid-cell:hover {
  background: rgba(255, 255, 255, 0.26);
}

.water-can-wrapper {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.water-can {
  width: 58px;
  height: 58px;
  background-image: url('img/water-can.png');
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  cursor: pointer;
  animation: popUp 0.25s ease;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

@keyframes popUp {
  0% {
    transform: scale(0.5);
    opacity: 0.3;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

button {
  background: linear-gradient(135deg, #2E9DF7, #4FCB53);
  color: white;
  border: none;
  padding: 12px 20px;
  font-size: 15px;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.25s ease;
  font-weight: 600;
}

button:hover {
  transform: translateY(-2px);
  background: #FFC907;
  color: black;
}

.button-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

#start-game {
  display: none;
}

#reset-game {
  display: none;
  background: #FFC907;
  color: black;
}

.achievement {
  text-align: center;
  font-size: 20px;
  margin: 14px 0;
  font-weight: bold;
  min-height: 28px;
}

.milestone-message {
  text-align: center;
  min-height: 28px;
  font-size: 17px;
  font-weight: 700;
  color: #FFE082;
  margin-bottom: 10px;
  transition: 0.3s ease;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 20, 40, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.overlay-card {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(15px);
  padding: 30px;
  border-radius: 18px;
  width: min(420px, 92%);
  text-align: center;
  color: white;
}

.overlay-card h2 {
  margin-top: 0;
  margin-bottom: 14px;
  font-family: 'Playfair Display', serif;
}

.goal {
  font-size: 17px;
  margin-bottom: 18px;
}

.instructions-list {
  text-align: left;
  margin-bottom: 20px;
  padding-left: 20px;
}

.instructions-list li {
  margin-bottom: 8px;
}

#start-from-overlay {
  background: #FFC907;
  color: black;
}

.difficulty-box {
  margin: 18px 0;
  padding: 14px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 12px;
}

.difficulty-box h3 {
  margin-top: 0;
  margin-bottom: 12px;
}

.difficulty-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.difficulty-btn {
  background: rgba(255, 255, 255, 0.18);
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
}

.difficulty-btn.active {
  background: #FFC907;
  color: black;
}

.difficulty-details {
  margin-top: 12px;
  font-size: 14px;
  color: #EAFBFF;
}

.game-footer {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.22);
  text-align: center;
}

.game-footer p {
  margin-bottom: 12px;
  color: #DDF7FF;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
}

.footer-links a {
  color: #FFD54F;
  text-decoration: none;
  font-weight: 600;
}

.footer-links a:hover {
  text-decoration: underline;
}

@media (max-width: 600px) {
  body {
    padding: 16px;
  }

  .container {
    max-width: 96%;
    padding: 20px;
  }

  .game-grid {
    max-width: 280px;
    gap: 12px;
  }

  .water-can {
    width: 46px;
    height: 46px;
  }

  h1 {
    font-size: 28px;
  }

  .stats {
    flex-direction: column;
    align-items: center;
  }
}