/* ==========================================================
   DESVENDADO - ESTILOS CSS (DARK MODE & RESPONSIVO)
   Compatível com todos os navegadores modernos e Hostinger
   ========================================================== */

:root {
  --bg-primary: #121213;
  --bg-secondary: #1a1a1b;
  --bg-card: #202022;
  --border-color: #3a3a3c;
  --border-active: #565758;

  --color-correct: #15803d; /* Verde Esmeralda */
  --color-correct-border: #16a34a;
  --color-present: #ca8a04; /* Amarelo Âmbar */
  --color-present-border: #eab308;
  --color-absent: #3a3a3c;  /* Cinza Escuro */
  --color-absent-border: #3a3a3c;
  --color-empty: #1a1a1b;

  --key-bg: #818384;
  --key-bg-hover: #9b9d9e;
  --key-text: #ffffff;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;

  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
}

/* Container do Aplicativo */
.app-container {
  width: 100%;
  max-width: 500px;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px 12px 16px 12px;
  position: relative;
}

/* Cabeçalho */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px 12px 4px;
  border-bottom: 1px solid var(--border-color);
}

.game-title {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  text-align: center;
  background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  color: var(--text-main);
  background-color: var(--bg-card);
}

.icon-btn:active {
  transform: scale(0.92);
}

.streak-badge {
  background: rgba(22, 163, 74, 0.15);
  border: 1px solid rgba(22, 163, 74, 0.3);
  color: #4ade80;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 3px;
}

/* Toast de Notificação */
.toast {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #27272a;
  color: #f8fafc;
  border: 1px solid #3f3f46;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  z-index: 100;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.toast.hidden {
  opacity: 0;
  transform: translate(-50%, -10px);
}

/* Tabuleiro */
.board-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
}

.board {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  gap: 6px;
  width: 100%;
  max-width: 340px;
  aspect-ratio: 5 / 6;
}

.board-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

/* Caixas de Letras (Tiles) */
.tile {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  background-color: var(--color-empty);
  border: 2px solid var(--border-color);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  text-transform: uppercase;
  user-select: none;
  transition: transform 0.15s ease;
}

/* Estados das Caixas */
.tile.active {
  border-color: var(--border-active);
  animation: pop 0.1s ease-in-out;
}

.tile.correct {
  background-color: var(--color-correct) !important;
  border-color: var(--color-correct-border) !important;
  color: #ffffff;
}

.tile.present {
  background-color: var(--color-present) !important;
  border-color: var(--color-present-border) !important;
  color: #ffffff;
}

.tile.absent {
  background-color: var(--color-absent) !important;
  border-color: var(--color-absent-border) !important;
  color: #a1a1aa;
}

.tile.flip {
  animation: flipTile 0.5s ease forwards;
}

/* Teclado Virtual */
.keyboard-wrapper {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.keyboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 5px;
  width: 100%;
}

.key {
  flex: 1;
  min-width: 28px;
  max-width: 42px;
  height: 52px;
  background-color: #4a4a4d;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: manipulation;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.key:hover {
  background-color: #5c5c60;
}

.key:active {
  transform: scale(0.94);
}

.key.key-wide {
  flex: 1.5;
  max-width: 65px;
  font-size: 0.75rem;
  font-weight: 800;
}

.key.correct {
  background-color: var(--color-correct) !important;
  color: #ffffff;
}

.key.present {
  background-color: var(--color-present) !important;
  color: #ffffff;
}

.key.absent {
  background-color: #27272a !important;
  color: #71717a !important;
}

/* Modais */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 200;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-card h2 {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  margin-bottom: 14px;
  text-align: center;
}

.modal-card h3 {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 16px 0 10px 0;
  text-align: center;
}

.modal-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 10px;
}

/* Exemplos de Regras */
.example-box {
  margin: 12px 0;
}

.example-row {
  display: flex;
  gap: 5px;
  margin-bottom: 6px;
}

.example-row .tile {
  width: 38px;
  height: 38px;
  font-size: 1.1rem;
}

.example-desc {
  font-size: 0.8rem !important;
}

.color-correct { color: #4ade80; }
.color-present { color: #facc15; }
.color-absent { color: #a1a1aa; }

.tip-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px;
  border-radius: 8px;
  margin-top: 12px;
}

.tip-box p {
  margin: 0;
  font-size: 0.8rem;
}

/* Estatísticas */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.stat-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-number {
  font-size: 1.4rem;
  font-weight: 900;
  color: #ffffff;
}

.stat-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.guess-distribution {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
  font-family: monospace;
}

.dist-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

.dist-bar-wrapper {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  overflow: hidden;
  height: 22px;
}

.dist-bar {
  background: #3f3f46;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 6px;
  font-weight: 700;
  font-size: 0.75rem;
  color: #fff;
  transition: width 0.4s ease;
}

.dist-bar.has-wins {
  background: var(--color-correct);
}

/* Modal de Fim de Jogo */
.modal-gameover {
  text-align: center;
}

.gameover-icon {
  font-size: 3rem;
  margin-bottom: 8px;
}

.secret-reveal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px;
  margin: 16px 0;
}

.secret-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.secret-word {
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  color: #4ade80;
  text-transform: uppercase;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background-color: #16a34a;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background-color: #15803d;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  width: 100%;
  padding: 12px;
  background-color: #27272a;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background-color: #3f3f46;
}

/* Animações */
@keyframes pop {
  0% { transform: scale(0.9); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes flipTile {
  0% { transform: rotateX(0deg); }
  50% { transform: rotateX(90deg); }
  100% { transform: rotateX(0deg); }
}

@keyframes shakeRow {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.shake {
  animation: shakeRow 0.4s ease-in-out;
}

/* Utilitário universal de ocultação */
.hidden {
  display: none !important;
}

/* Área de Dica */
.hint-container {
  width: 100%;
  max-width: 380px;
  margin: 6px auto;
  padding: 0 12px;
  box-sizing: border-box;
  animation: fadeIn 0.3s ease;
}

.hint-container.hidden,
.hint-banner.hidden,
.btn-hint.hidden {
  display: none !important;
}

.btn-hint {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fcd34d;
  padding: 8px 14px;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-hint:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: rgba(245, 158, 11, 0.6);
  transform: translateY(-1px);
}

.btn-hint .hint-icon {
  font-size: 1rem;
  animation: pulse 1.5s infinite;
}

.hint-banner {
  background: linear-gradient(135deg, rgba(69, 26, 3, 0.6), rgba(24, 24, 27, 0.95));
  border: 1px solid rgba(245, 158, 11, 0.5);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  animation: fadeIn 0.3s ease;
}

.hint-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.hint-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #f59e0b;
}

.hint-close-btn {
  background: none;
  border: none;
  color: #a1a1aa;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.hint-close-btn:hover {
  color: #f4f4f5;
}

.hint-text {
  margin: 0;
  font-size: 0.85rem;
  color: #f4f4f5;
  font-weight: 500;
  line-height: 1.4;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.8; }
}

/* Ajustes para telas muito pequenas */
@media (max-height: 650px) {
  .game-title { font-size: 1.2rem; }
  .key { height: 42px; font-size: 0.8rem; }
  .board { max-width: 280px; }
  .tile { font-size: 1.3rem; }
}
