/* =========================
   BASE DO JOGO
========================= */
html, body {
  height: 100%;
}

body {
  font-family: Arial, sans-serif;
  background: radial-gradient(circle at top, #123a4d, #050f14);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
}

/* =========================
   CONTAINER PRINCIPAL
========================= */
.container {
  display: flex;
  flex-direction: row; /* 🔥 evita colapso vertical */
  gap: 30px;
  justify-content: center;
  align-items: flex-start;
  margin-top: 10px;
}

/* =========================
   GRID (CAÇA-PALAVRAS)
========================= */
#grid {
  display: grid !important; /* 🔥 força grid */
  gap: 4px;

  width: min(90vw, 520px);

  user-select: none;
  touch-action: none;

  padding: 12px;
  border-radius: 14px;

  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);

  box-shadow:
    0 10px 35px rgba(0, 0, 0, 0.5),
    inset 0 0 10px rgba(255, 255, 255, 0.05);
}

/* =========================
   CÉLULAS
========================= */
.cell {
  width: 100%;
  aspect-ratio: 1 / 1;

  display: flex;
  align-items: center;
  justify-content: center;

  background: #163a4d;
  border-radius: 7px;

  font-weight: bold;

  font-size: clamp(14px, 2.5vw, 26px);

  color: #ffffff;
  cursor: pointer;

  transition: all 0.15s ease-in-out;

  box-shadow: inset 0 0 6px rgba(255, 255, 255, 0.05);
}

.cell:hover {
  background: #1f5a73;
  transform: scale(1.05);
}

.cell.selected {
  background: #2ecc71;
  color: #000;
  transform: scale(1.1);
  box-shadow: 0 0 12px rgba(46, 204, 113, 0.8);
}

.cell.found {
  background: #f1c40f;
  color: #000;
  text-decoration: line-through;
  box-shadow: 0 0 14px rgba(241, 196, 15, 0.8);
}

/* =========================
   PAINEL DE PALAVRAS
========================= */
.panel {
  max-width: 340px;
  min-width: 280px;

  padding: 12px;
  border-radius: 14px;

  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);

  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

/* =========================
   PALAVRAS
========================= */
.word {
  padding: 8px;
  margin: 6px 0;

  background: #1e4b63;
  border-radius: 8px;

  text-align: center;
  font-weight: bold;

  transition: all 0.2s ease;
  letter-spacing: 0.5px;
}

.word.found {
  background: #27ae60;
  color: #fff;
  text-decoration: line-through;
  transform: scale(0.98);
}

/* =========================
   SELECT
========================= */
select {
  padding: 10px 14px;
  margin-bottom: 20px;

  font-size: 15px;

  background: rgba(30, 75, 99, 0.85);
  color: white;

  border: none;
  border-radius: 8px;

  cursor: pointer;

  backdrop-filter: blur(6px);
}

/* =========================
   MENSAGEM FINAL
========================= */
#mensagem {
  margin-top: 15px;
  padding: 12px;

  background: #27ae60;
  color: white;

  border-radius: 8px;

  display: none;
  font-weight: bold;

  box-shadow: 0 0 15px rgba(39, 174, 96, 0.5);
}

/* =========================
   VITÓRIA
========================= */
.win-screen {
  position: fixed;
  top: 0;
  left: 0;

  width: 100%;
  height: 100%;

  background: rgba(0, 0, 0, 0.75);

  display: flex;
  align-items: center;
  justify-content: center;

  z-index: 999;
}

.win-card {
  background: linear-gradient(145deg, #1e4b63, #123a4d);
  padding: 30px 20px;
  border-radius: 16px;

  text-align: center;

  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.win-card button {
  padding: 10px 16px;
  border: none;
  border-radius: 10px;

  background: #2ecc71;
  color: white;

  font-weight: bold;
  cursor: pointer;
}

/* =========================
   POPUP INFO
========================= */
.info-popup {
  position: fixed;
  inset: 0;

  background: rgba(0,0,0,0.6);

  display: flex;
  align-items: center;
  justify-content: center;

  z-index: 1000;
}

.info-card {
  background: #123a4d;
  color: white;

  padding: 20px;
  border-radius: 14px;

  max-width: 300px;
  text-align: center;
}

/* =========================
   HIDDEN GLOBAL
========================= */
.hidden {
  display: none !important;
}

/* =========================
   TELA INICIAL (MESMA IDENTIDADE DO JOGO)
========================= */
.intro-screen {
  position: fixed;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  /* 🔥 mesmo fundo do body */
  background: radial-gradient(circle at top, #123a4d, #050f14);

  z-index: 2000;
}

/* CARD PRINCIPAL (MESMO ESTILO DO GRID/PANEL) */
.intro-card {
  position: relative;

  width: min(92vw, 480px);

  padding: 26px 22px;
  border-radius: 14px;

  text-align: center;
  color: #ffffff;

  /* 🔥 mesmo “glass” do grid e panel */
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);

  backdrop-filter: blur(10px);

  box-shadow:
    0 10px 35px rgba(0, 0, 0, 0.5),
    inset 0 0 10px rgba(255, 255, 255, 0.05);

  animation: introPop 0.35s ease;
}

/* TÍTULO */
.intro-card h1 {
  font-size: 22px;
  margin-bottom: 12px;
  color: #ffffff;
  letter-spacing: 0.5px;
}

/* TEXTO */
.intro-card p {
  font-size: 14px;
  line-height: 1.6;
  opacity: 0.9;
  color: #e6f2f7;
}

/* BOTÃO COMEÇAR (MESMA LINGUAGEM DO VERDE DO JOGO) */
#startBtn {
  margin-top: 18px;

  padding: 10px 18px;
  border: none;
  border-radius: 10px;

  background: #2ecc71;
  color: #000;

  font-weight: bold;
  cursor: pointer;

  transition: 0.2s ease;

  box-shadow: 0 0 12px rgba(46, 204, 113, 0.4);
}

#startBtn:hover {
  transform: scale(1.05);
  background: #27ae60;
  color: #fff;
}

/* BOTÃO X (MESMO ESTILO DOS INTERAÇÕES DO GRID) */
.close-btn {
  position: absolute;
  top: 10px;
  right: 12px;

  background: transparent;
  border: none;

  color: #ffffff;
  font-size: 18px;

  cursor: pointer;
  opacity: 0.7;

  transition: 0.2s;
}

.close-btn:hover {
  opacity: 1;
  transform: scale(1.2);
}

/* ANIMAÇÃO IGUAL AO RESTO DO JOGO */
@keyframes introPop {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* =========================
   MOBILE (CORRIGIDO)
========================= */
/* =========================
   MOBILE PEQUENO (até 600px)
========================= */
@media (max-width: 600px) {

  .container {
    flex-direction: column;
    align-items: center;
    margin-top: 0px;
    gap: 8px;
  }

  .panel {
    order: -1;
    width: 100%;
    max-width: 240px;
    margin-bottom: 12px;
    padding: 10px;
  }

  #wordList {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .word {
    font-size: 12px;
    padding: 5px;
    margin: 0;
  }

  #grid {
    width: 95vw;
    margin-top: -8px;
    gap: 3px;
    padding: 8px;
  }

  .cell {
    font-size: clamp(16px, 4vw, 24px);
  }
}

/* =========================
   TABLETS / MOBILE GRANDE (até 768px)
========================= */
@media (max-width: 768px) {

  .container {
    flex-direction: column;
    align-items: center;
    margin-top: 0px;
    gap: 12px;
  }

  .panel {
    order: -1;
    width: 100%;
    max-width: 260px;
    margin-bottom: 14px;
    padding: 12px;
  }

  #wordList {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .word {
    font-size: 13px;
    padding: 6px;
    margin: 0;
  }

  #grid {
    width: 92vw;
    max-width: 430px;
    gap: 3px;
    padding: 10px;
    transform: translateY(-10px);
  }

  .cell {
    font-size: clamp(16px, 3.5vw, 26px);
  }
}

/* =========================
   DESKTOP GRANDE
========================= */
@media (min-width: 900px) {

  #grid {
    width: min(70vw, 550px);
  }

  .cell {
    font-size: clamp(18px, 1.8vw, 32px);
  }

  .intro-card {
    width: min(520px, 60vw); /* 🔥 mais espaço no desktop */
    padding: 32px 28px;
  }

  .intro-card h1 {
    font-size: 36px;
  }

  .intro-card p {
    font-size: 15px;
    line-height: 1.7;
  }

  #startBtn {
    padding: 12px 20px;
    font-size: 16px;
  }
  
}