body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  background-color: #f0f0f0;
  transition: background-color 0.3s ease;
  padding: 10px;
}

body.dark-theme {
  background-color: #1a1a2e;
  color: #ffffff;
}

.game-container {
  background-color: white;
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
  width: 100%;
  max-width: 450px;
  text-align: center;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

body.dark-theme .game-container {
  background-color: #16213e;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.game-container h1 {
  margin: 0;
  font-size: 24px;
  color: #333;
  flex: 1;
  min-width: 120px;
}

body.dark-theme .game-container h1 {
  color: #ffffff;
}

.difficulty-selector {
  display: flex;
  gap: 5px;
  margin-bottom: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.difficulty-btn {
  flex: 1;
  padding: 8px 10px;
  border: 2px solid #007bff;
  background-color: transparent;
  color: #007bff;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  font-size: 12px;
  transition: all 0.3s ease;
  min-width: 80px;
}

.difficulty-btn:hover {
  background-color: #007bff;
  color: white;
}

.difficulty-btn.active {
  background-color: #007bff;
  color: white;
  box-shadow: 0 0 10px rgba(0, 123, 255, 0.5);
}

.game-area {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 10px;
}

#guessInput {
  width: 70%;
  min-width: 150px;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s ease;
  box-sizing: border-box;
}

#guessInput:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 5px rgba(0, 123, 255, 0.3);
}

body.dark-theme #guessInput {
  border-color: #444;
  color: #ffffff;
  background-color: #1a1a2e;
}

button {
  padding: 12px 20px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

button:hover {
  background-color: #0056b3;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#message {
  margin-top: 20px;
  font-weight: bold;
  min-height: 30px;
  font-size: 16px;
  transition: color 0.3s ease;
  word-wrap: break-word;
}

#hint {
  margin-top: 10px;
  color: #666;
  font-size: 14px;
}

body.dark-theme #hint {
  color: #aaa;
}

.game-modes {
  margin: 20px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
  padding: 10px 0;
}

.mode-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
}

.mode-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.timer-display {
  font-size: 16px;
  font-weight: bold;
  color: #ff6b6b;
}

.timer-display span {
  margin-left: 5px;
}

#timerValue {
  color: #ff6b6b;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background-color: #e0e0e0;
  border-radius: 5px;
  margin: 20px 0;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #007bff, #00ff88);
  width: 0%;
  transition: width 0.5s ease;
  border-radius: 5px;
}

.guess-history {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 15px 0;
  flex-wrap: wrap;
  padding: 10px 0;
}

.history-item {
  padding: 5px 12px;
  background-color: #f0f0f0;
  border-radius: 5px;
  font-size: 13px;
  word-wrap: break-word;
  max-width: 100%;
  overflow-wrap: break-word;
  animation: popIn 0.3s ease;
}

body.dark-theme .history-item {
  background-color: #333;
}

.stats {
  display: flex;
  justify-content: space-around;
  margin: 20px 0;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: 8px;
  flex-wrap: wrap;
  gap: 15px;
}

body.dark-theme .stats {
  background-color: #252f42;
}

.stats div {
  font-size: 14px;
  color: #666;
}

body.dark-theme .stats div {
  color: #aaa;
}

#resetBtn {
  background-color: #28a745;
  flex: 1;
}

#resetBtn:hover {
  background-color: #218838;
}

/* Confetti animation */
@keyframes fall {
  0% {
    transform: translateY(-100vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

@keyframes popIn {
  0% { transform: scale(0.8); opacity: 0; }
  70% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.shake {
  animation: shake 0.4s ease;
  border-color: #ff6b6b !important;
}

.pop-in {
  animation: popIn 0.3s ease;
}

.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  animation: fall 3s linear forwards;
  pointer-events: none;
  z-index: 1000;
}

.action-buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.give-up-btn {
  background-color: #dc3545;
}

.give-up-btn:hover {
  background-color: #c82333;
}

/* Theme toggle button */
.theme-toggle {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 5px;
  box-shadow: none;
  transition: transform 0.2s ease;
}

.theme-toggle:hover {
  transform: rotate(15deg);
}

/* Mobile optimizations */
@media (max-width: 768px) {
  body {
    align-items: flex-start;
    padding: 5px;
  }

  .game-container {
    padding: 20px 15px;
  }

  .game-container h1 {
    font-size: 20px;
  }

  .difficulty-selector {
    gap: 5px;
  }

  .difficulty-btn {
    padding: 6px 8px;
    font-size: 11px;
    min-width: 70px;
  }

  #guessInput {
    width: 100%;
    margin-right: 0;
    margin-bottom: 10px;
  }

  button {
    width: 100%;
    margin-bottom: 10px;
  }

  .game-area {
    flex-direction: column;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
  }

  .game-modes {
    flex-direction: column;
    gap: 10px;
  }

  .stats {
    flex-direction: column;
  }

  .stats div {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  body {
    align-items: center;
  }

  .game-container {
    max-width: 100%;
  }

  .difficulty-selector {
    gap: 3px;
  }

  .difficulty-btn {
    padding: 5px 6px;
    font-size: 10px;
    min-width: 60px;
  }

  button {
    padding: 10px 15px;
    font-size: 14px;
  }

  .mode-toggle {
    font-size: 13px;
  }

  .timer-display {
    font-size: 14px;
  }

  .stats div {
    font-size: 12px;
  }

  #message {
    font-size: 14px;
  }

  .confetti {
    display: none;
  }
}

/* Large screens */
@media (min-width: 1024px) {
  .game-container {
    max-width: 500px;
  }

  button {
    padding: 14px 24px;
    font-size: 18px;
  }

  #guessInput {
    font-size: 18px;
  }
}
