/* ===== 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;
}
.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;
  padding: 1rem;
  gap: 1.2rem;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}

.info-bar {
  display: flex;
  justify-content: space-between;
  width: 100%;
  background: #16213e;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
}

.category-label {
  font-size: 0.95rem;
  color: #aaa;
}
.category-label span { color: #ff6b35; font-weight: 700; }

/* ===== Answer Area ===== */
.answer-area {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  min-height: 56px;
}

.answer-slot {
  width: 44px; height: 50px;
  border: 2px dashed rgba(255,255,255,0.25);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 800;
  transition: all 0.2s;
}

.answer-slot.filled {
  background: #ff6b35;
  border-color: #ff6b35;
  cursor: pointer;
}

.answer-slot.hint {
  background: #4ade80;
  border-color: #4ade80;
  cursor: default;
}

.answer-slot.correct {
  background: #4ade80;
  border-color: #4ade80;
  animation: popIn 0.3s ease;
}

.answer-slot.wrong {
  background: #ef4444;
  border-color: #ef4444;
  animation: shake 0.4s;
}

/* ===== Scramble Area ===== */
.scramble-area {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.letter-tile {
  width: 48px; height: 54px;
  background: #16213e;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  -webkit-user-select: none;
}

.letter-tile:hover { border-color: #ff6b35; transform: translateY(-2px); }
.letter-tile:active { transform: scale(0.95); }
.letter-tile.used { opacity: 0.25; pointer-events: none; }

/* ===== Controls ===== */
.controls {
  display: flex;
  gap: 0.6rem;
  width: 100%;
}

.btn {
  border: none; padding: 0.6rem 1rem; border-radius: 8px;
  font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 0.95rem;
  cursor: pointer; transition: transform 0.1s, filter 0.2s;
  flex: 1; text-align: center;
}
.btn:active { transform: scale(0.96); }
.btn-orange { background: linear-gradient(135deg, #ff6b35, #e85d2a); color: #fff; }
.btn-orange:hover { filter: brightness(1.1); }
.btn-secondary { background: #16213e; color: #fff; border: 1px solid rgba(255,255,255,0.15); }
.btn-secondary:hover { border-color: #ff6b35; }

/* ===== 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;
}
.modal-overlay.active { display: flex; }
.modal {
  background: #16213e; border-radius: 16px; padding: 2rem; text-align: center;
  max-width: 340px; width: 90%; box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal h2 { margin-bottom: 0.5rem; font-size: 1.5rem; }
.modal h2.win { color: #4ade80; }
.modal h2.loss { color: #ef4444; }
.modal p { margin-bottom: 1rem; color: #ccc; }

/* ===== Animations ===== */
@keyframes popIn {
  0% { transform: scale(0.5); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@media (max-width: 400px) {
  .letter-tile { width: 40px; height: 46px; font-size: 1.2rem; }
  .answer-slot { width: 38px; height: 44px; font-size: 1.1rem; }
}

/* ===== 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; }
