* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #0C0D14;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: 'Courier New', monospace;
  color: #fff;
  overflow: hidden;
}

#game-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 480px;
  padding: 16px;
  gap: 12px;
}

/* HUD */
#hud {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 8px 0;
  border-bottom: 1px solid #2a2d3a;
}

.hud-item {
  font-size: 13px;
  letter-spacing: 2px;
  color: #888;
  text-transform: uppercase;
}

.hud-item span {
  color: #fff;
  font-weight: 700;
}

/* Hint */
#hint {
  font-size: 14px;
  color: #ffcc00;
  letter-spacing: 1px;
  min-height: 20px;
}

/* Canvas */
#hangman-canvas {
  display: block;
  background: transparent;
}

/* Wrong count */
#wrong-count {
  font-size: 14px;
  color: #888;
  letter-spacing: 1px;
}

#wrong-count span {
  color: #ff4466;
  font-weight: 700;
}

/* Word display */
#word-display {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 0;
  min-height: 50px;
}

.letter-slot {
  width: 32px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  border-bottom: 3px solid #2a2d3a;
  color: #00ff88;
  text-transform: uppercase;
  transition: color 0.3s, border-color 0.3s;
}

.letter-slot.revealed {
  border-color: #00ff88;
}

.letter-slot.lost {
  color: #ff4466;
  border-color: #ff4466;
}

/* Keyboard */
#keyboard {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 6px;
  width: 100%;
  max-width: 400px;
  padding: 8px 0;
}

.key-btn {
  background: #1a1c28;
  color: #fff;
  border: 1px solid #2a2d3a;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 16px;
  font-weight: 700;
  padding: 10px 0;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.1s;
  text-transform: uppercase;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.key-btn:hover:not(:disabled) {
  background: #2a2d3a;
  border-color: #00ff88;
}

.key-btn:active:not(:disabled) {
  transform: scale(0.93);
}

.key-btn:disabled {
  cursor: default;
  opacity: 0.4;
}

.key-btn.correct {
  background: #00ff88;
  color: #0C0D14;
  border-color: #00ff88;
}

.key-btn.wrong {
  background: #ff4466;
  color: #0C0D14;
  border-color: #ff4466;
}

/* Overlay */
#overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(12, 13, 20, 0.88);
  z-index: 10;
  transition: opacity 0.3s ease;
}

#overlay.hidden {
  display: none;
}

#overlay-box {
  text-align: center;
  padding: 40px 48px;
  background: #161822;
  border: 2px solid #2a2d3a;
  border-radius: 12px;
}

#overlay-box h1 {
  font-size: 36px;
  margin-bottom: 14px;
  font-weight: 700;
  letter-spacing: 3px;
}

#screen-start h1 {
  color: #00ff88;
}

#screen-win h1 {
  color: #00ff88;
}

#screen-lose h1 {
  color: #ff4466;
}

#overlay-box p {
  font-size: 16px;
  margin-bottom: 8px;
  color: #ccc;
}

#win-word,
#lose-word {
  color: #ffcc00;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.action-hint {
  font-size: 14px !important;
  color: #777 !important;
  margin-top: 12px !important;
  animation: pulse 2s infinite;
}

.hidden {
  display: none !important;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* Responsive */
@media (max-width: 420px) {
  #game-container {
    padding: 10px;
    gap: 8px;
  }

  .hud-item {
    font-size: 11px;
  }

  #hangman-canvas {
    width: 160px;
    height: 176px;
  }

  .letter-slot {
    width: 26px;
    height: 36px;
    font-size: 22px;
  }

  #keyboard {
    gap: 4px;
  }

  .key-btn {
    font-size: 14px;
    padding: 8px 0;
  }

  #overlay-box {
    padding: 28px 24px;
  }

  #overlay-box h1 {
    font-size: 28px;
  }

  #overlay-box p {
    font-size: 14px;
  }
}
