/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Nunito', sans-serif;
  background: #1a1a2e;
  color: #fff;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ===== Topbar ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background: linear-gradient(135deg, #ff6b35, #e85d2a);
  color: #fff;
  font-family: 'Nunito', sans-serif;
}

.btn-back {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.3rem 0.7rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.15);
  transition: background 0.2s;
}
.btn-back:hover { background: rgba(255,255,255,0.3); }

.game-title { font-size: 1.25rem; font-weight: 800; }
.stats { font-weight: 700; font-size: 1rem; }

/* ===== Game Container ===== */
.game-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  gap: 1rem;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}

.game-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

/* ===== Hangman SVG ===== */
.hangman-svg-wrapper {
  width: min(200px, 50vw);
}

.hangman-svg {
  width: 100%;
  height: auto;
}

.hm-part {
  opacity: 0;
  transition: opacity 0.4s ease;
}

.hm-part.show {
  opacity: 1;
}

/* ===== Info Area ===== */
.info-area {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 350px;
  gap: 1rem;
}

.category-hint {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.7);
}

.hint-value {
  color: #ff6b35;
  font-weight: 700;
}

.wrong-counter {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.7);
}

.wrong-counter strong {
  color: #ff4444;
}

/* ===== Word Display ===== */
.word-display {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0.5rem 0;
}

.letter-slot {
  width: clamp(32px, 8vw, 45px);
  height: clamp(40px, 10vw, 55px);
  border-bottom: 3px solid rgba(255,255,255,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.2rem, 5vw, 1.8rem);
  font-weight: 800;
  text-transform: uppercase;
  color: #fff;
  transition: border-color 0.3s;
}

.letter-slot.revealed {
  border-color: #6aaa64;
  animation: popIn 0.3s ease;
}

.letter-slot.wrong-reveal {
  border-color: #ff4444;
  color: #ff4444;
}

@keyframes popIn {
  0% { transform: scale(0.8); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ===== Keyboard ===== */
.keyboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(500px, 98vw);
  padding: 0 2px;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.key {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: clamp(0.85rem, 3.5vw, 1.1rem);
  padding: 0;
  height: clamp(42px, 8vw, 52px);
  min-width: clamp(28px, 7.5vw, 38px);
  flex: 1;
  max-width: 45px;
  border: none;
  border-radius: 8px;
  background: #3a3a5c;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  transition: background 0.2s, transform 0.1s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.key:active { transform: scale(0.93); }
.key.correct { background: #6aaa64; }
.key.wrong { background: #ff4444; opacity: 0.6; }
.key.used { pointer-events: none; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal-overlay.show { display: flex; }

.modal {
  background: #1a1a2e;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.modal h2 { font-size: 1.6rem; margin-bottom: 0.5rem; }
.modal p { font-size: 1rem; margin-bottom: 0.5rem; color: #ccc; }

.modal-word {
  font-size: 1.1rem;
  margin: 1rem 0;
  color: #fff;
}
.modal-word strong {
  color: #ff6b35;
  font-size: 1.4rem;
  letter-spacing: 3px;
}

.btn { border: none; cursor: pointer; border-radius: 10px; font-family: 'Nunito', sans-serif; font-weight: 700; }
.btn-orange {
  background: linear-gradient(135deg, #ff6b35, #e85d2a);
  color: #fff;
  padding: 0.8rem 2rem;
  font-size: 1.1rem;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-orange:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(255,107,53,0.4);
}

@media (max-height: 580px) {
  .hangman-svg-wrapper { width: min(150px, 40vw); }
  .game-container { gap: 0.5rem; padding: 0.5rem; }
  .key { height: 38px; }
}

/* ===== SEO GAME INFO SECTION ===== */
.game-info {
  max-width: 780px;
  margin: 1rem auto;
  padding: 1rem 1.2rem;
  background: rgba(0,0,0,0.15);
  border-radius: 12px;
  color: rgba(255,255,255,0.85);
  font-size: 0.88rem;
  line-height: 1.6;
}
.game-info h2 { font-size: 1.1rem; font-weight: 800; margin-bottom: 0.5rem; }
.game-info h3 { font-size: 0.95rem; font-weight: 700; margin: 0.8rem 0 0.3rem; }
.game-info ul { padding-left: 1.2rem; }
.game-info li { margin-bottom: 0.2rem; }
