/* Global Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(120deg, #5833b0, #504e5c);
  color: #f0f0f0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
}

.game-container {
  background: rgba(255, 255, 255, 0.05);
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.37);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  width: 100%;
  max-width: 600px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

h1 {
  font-size: 36px;
  margin-bottom: 10px;
  letter-spacing: 2px;
  color: #ffffff;
}

.hint {
  font-size: 18px;
  margin-bottom: 15px;
  color: #cfcfcf;
}

.word {
  font-size: 36px;
  letter-spacing: 12px;
  margin: 20px 0;
  color: #ffffff;
}

canvas {
  background-color: rgba(255, 255, 255, 0.1);
  border: 2px solid #fff;
  border-radius: 10px;
  margin: 20px auto;
  display: block;
}

.keyboard {
  margin-top: 25px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 20px 0;
  min-height: 80px;
}

.key {
  width: 44px;
  height: 44px;
  background: linear-gradient(145deg, #6e48aa, #9d50bb);
  border: none;
  color: white;
  font-weight: bold;
  font-size: 18px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
  transition: 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}

.key:hover:not(:disabled) {
  transform: scale(1.1);
  background: linear-gradient(145deg, #9d50bb, #6e48aa);
}

.key:disabled {
  background-color: #555;
  color: #aaa;
  cursor: not-allowed;
  box-shadow: none;
}

#wrongLetters {
  color: #ff9a9e;
  font-size: 16px;
  margin-top: 15px;
  min-height: 20px;
}

/* WIN CELEBRATION OVERLAY */
.win-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, rgba(46, 213, 115, 0.9), rgba(0, 184, 148, 0.9));
  display: none;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  border-radius: 20px;
  z-index: 100;
  animation: celebration 0.5s ease-in-out;
}

.win-overlay.show {
  display: flex;
}

.win-text {
  font-size: 48px;
  font-weight: bold;
  color: white;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
  margin-bottom: 20px;
  animation: bounce 1s infinite;
}

.win-confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #ffd700;
  animation: confetti 3s linear infinite;
}

/* LOSE POPUP */
.popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.popup.show {
  display: flex;
}

.popup-content {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
  max-width: 400px;
  width: 90%;
  animation: popupSlide 0.4s ease-out;
}

.popup-content h2 {
  font-size: 32px;
  margin-bottom: 20px;
  color: white;
}

.popup-content p {
  font-size: 18px;
  margin-bottom: 30px;
  color: #f0f0f0;
}

.popup-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.popup-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 100px;
}

.btn-reset {
  background: linear-gradient(145deg, #ff6b6b, #ee5a52);
  color: white;
}

.btn-new-game {
  background: linear-gradient(145deg, #4ecdc4, #44a08d);
  color: white;
}

.popup-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

/* ANIMATIONS */
@keyframes celebration {
  0% { opacity: 0; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-20px); }
  60% { transform: translateY(-10px); }
}

@keyframes confetti {
  0% { 
    transform: translateY(-100vh) rotate(0deg);
    opacity: 1;
  }
  100% { 
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popupSlide {
  from { 
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }
  to { 
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .game-container {
    padding: 20px;
    margin: 20px;
  }
  
  h1 {
    font-size: 28px;
  }
  
  .word {
    font-size: 28px;
    letter-spacing: 8px;
  }
  
  .win-text {
    font-size: 36px;
  }
  
  .popup-content {
    padding: 30px 20px;
  }
  
  .popup-buttons {
    flex-direction: column;
  }
}