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

body {
  font-family: 'Nunito', sans-serif;
  background: #121213;
  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: 0.5rem;
  gap: 0.5rem;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}

/* ===== Message Bar ===== */
.message-bar {
  min-height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  text-align: center;
}

/* ===== Board ===== */
.board {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  gap: 5px;
  width: min(350px, 90vw);
  aspect-ratio: 5 / 6;
}

.row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.tile {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.4rem, 5vw, 2rem);
  font-weight: 800;
  text-transform: uppercase;
  border: 2px solid #3a3a3c;
  border-radius: 4px;
  background: transparent;
  color: #fff;
  aspect-ratio: 1;
  transition: transform 0.1s;
  user-select: none;
}

.tile.filled {
  border-color: #565758;
  animation: pop 0.1s ease;
}

.tile.correct  { background: #6aaa64; border-color: #6aaa64; }
.tile.present  { background: #c9b458; border-color: #c9b458; }
.tile.absent   { background: #3a3a3c; border-color: #3a3a3c; }

/* Flip animation */
.tile.flip {
  animation: flip 0.5s ease forwards;
}

@keyframes flip {
  0%   { transform: rotateX(0deg); }
  50%  { transform: rotateX(90deg); }
  100% { transform: rotateX(0deg); }
}

@keyframes pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* Bounce for win */
.tile.bounce {
  animation: bounce 0.6s ease;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  30%      { transform: translateY(-20px); }
  60%      { transform: translateY(-8px); }
}

/* Shake row on invalid */
.row.shake {
  animation: shake 0.4s ease;
}

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

/* ===== Virtual 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.75rem, 3vw, 1rem);
  padding: 0;
  height: clamp(46px, 8vw, 58px);
  min-width: clamp(28px, 7vw, 43px);
  flex: 1;
  max-width: 50px;
  border: none;
  border-radius: 6px;
  background: #818384;
  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.95); }

.key.wide {
  min-width: clamp(52px, 12vw, 72px);
  max-width: 80px;
  font-size: clamp(0.65rem, 2.5vw, 0.85rem);
}

.key.correct { background: #6aaa64; }
.key.present { background: #c9b458; }
.key.absent  { background: #3a3a3c; }

/* ===== 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: #1a1a1b;
  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: #6aaa64;
  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);
}

/* ===== Responsivo ===== */
@media (max-height: 620px) {
  .board { width: min(280px, 80vw); }
  .message-bar { min-height: 1.5rem; font-size: 0.85rem; }
  .key { height: clamp(38px, 7vw, 48px); }
}

@media (min-width: 600px) {
  .game-container { padding: 1rem; gap: 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; }
