html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

body {
  background: linear-gradient(180deg, #1e1e1e, #2b2b2b 70%, #000);
  color: #f5f5f5;
  font-family: 'Poppins', sans-serif;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 20px;
  overflow-x: hidden;
  transition: background 0.4s ease;
}

.hidden {
  display: none !important;
}

.faded-background {
  background: rgba(0, 0, 0, 0.85);
}

#how-to-play-overlay,
#game-over-overlay,
#version-credits-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.4s ease;
}

#game-over-overlay {
  background: rgba(0, 0, 0, 0.95);
  z-index: 1001;
}

#how-to-play-box,
#game-over-box,
#version-credits-box {
  background: #111;
  padding: 35px 25px;
  border-radius: 12px;
  box-shadow: 0 0 25px rgba(0,0,0,0.4);
  max-width: 400px;
  width: 90%;
  color: #eee;
  text-align: center;
  position: relative;
}

#game-over-box {
  max-width: 450px;
  box-shadow: 0 0 25px rgba(0,0,0,0.6);
  text-align: left;
}

#how-to-play-box h2,
#version-credits-box h2,
#version-credits-box h3 {
  color: #6f9ceb;
  font-weight: 700;
  margin-bottom: 10px;
  margin-top: 20px;
}

#game-over-box h2 {
  color: #e74c3c;
  font-weight: 700;
  margin-bottom: 10px;
  text-align: center;
  font-size: 2.5em;
}

#instructions-text,
#version-credits-box p {
  line-height: 1.6;
  font-size: 15px;
  margin-bottom: 10px;
}

#got-it-btn {
  background: linear-gradient(90deg, #6f9ceb, #4caf50);
  color: white;
  border: none;
  padding: 10px 25px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  letter-spacing: 0.5px;
  transition: transform 0.2s, box-shadow 0.2s;
}

#got-it-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 12px rgba(111,156,235,0.5);
}

#game-over-box p {
  line-height: 1.5;
  margin-bottom: 5px;
  text-align: center;
}

#game-over-details {
  color: #6f9ceb;
  font-weight: 600;
  margin-top: 10px;
  margin-bottom: 10px;
  text-align: center;
}

#game-over-hints-summary {
  margin-bottom: 20px;
  padding: 10px 0;
  border-top: 1px solid #333;
  border-bottom: 1px solid #333;
}

#game-over-countdown-timer {
  color: #4caf50;
  font-weight: bold;
  margin-top: 15px;
  text-align: center;
  font-size: 16px;
}

.correct-guess-indicator {
  color: #4caf50;
  font-weight: bold;
}

.incorrect-guess-indicator {
  color: #e74c3c;
  font-weight: bold;
}

#game-version-display {
  font-size: 1.5em;
  font-weight: bold;
  color: #4caf50;
  margin-bottom: 20px;
}

#version-credits-close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  color: #ccc;
  font-size: 2em;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

#version-credits-close-btn:hover {
  color: #fff;
}


.title-with-info {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 20px;
}

h1 {
  background: linear-gradient(90deg, #6f9ceb, #4caf50);
  color: white;
  border-radius: 12px;
  padding: 12px 35px;
  font-size: 38px;
  margin: 10px 0;
  font-weight: 700;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
  letter-spacing: 1px;
}

#how-to-play-toggle {
  position: absolute;
  right: calc(50% - 170px);
  top: 50%;
  transform: translateY(-50%);
  background-color: #6f9ceb;
  color: white;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: background-color 0.2s, transform 0.2s;
  margin-left: 10px;
}

#how-to-play-toggle:hover {
  background-color: #4caf50;
  transform: translateY(-50%) scale(1.05);
}

#game-info {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-bottom: 20px;
}

h6 {
  margin: 0;
  opacity: 0.8;
}

input[type="text"] {
  background-color: #222;
  border: 1px solid #555;
  padding: 10px 15px;
  width: 250px;
  height: 38px;
  font-size: 16px;
  color: #f5f5f5;
  border-radius: 8px;
  transition: border 0.2s, background 0.2s;
}

input[type="text"]:focus {
  border: 1px solid #4caf50;
  background: #2c2c2c;
  outline: none;
}

#output {
  font-weight: 600;
  margin: 15px 0;
  min-height: 28px;
  color: #9be7ff;
}

#countdown-timer {
  color: #4caf50;
  font-weight: bold;
  margin-bottom: 15px;
}

#box-container {
  margin-top: 15px;
}

.color-box {
  width: 35px;
  height: 35px;
  display: inline-block;
  margin: 6px;
  border-radius: 6px;
  border: 1px solid #444;
  background: #111;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.color-box:hover {
  transform: scale(1.1);
  box-shadow: 0 0 8px rgba(255,255,255,0.25);
}

.red-box {
  background-color: #e74c3c !important;
}

#last-updated {
  position: fixed;
  bottom: 15px;
  right: 25px;
  background: rgba(0,0,0,0.5);
  color: #ccc;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

#last-updated:hover {
  background: rgba(0,0,0,0.7);
  color: #fff;
}

#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  transform: none;
  z-index: -1;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}