/* ==========================================================================
   caca-palavras.css — Caça-Palavras Tech (Pratique Grátis F5)
   Visual Cyber Terminal, Grade Neon 10x10 Ampliada, Brilho Sutil e Modais.
   ========================================================================== */

:root {
  --cp-bg: #07111f;
  --cp-bg-deep: #030811;
  --cp-cyan: #22d3ee;
  --cp-cyan-glow: rgba(34, 211, 238, 0.4);
  --cp-yellow: #facc15;
  --cp-yellow-glow: rgba(250, 204, 21, 0.45);
  --cp-green: #22c55e;
  --cp-purple: #c084fc;
  --cp-red: #ef4444;
  --cp-text: #f0f6ff;
  --cp-text-muted: #94a3b8;
  --cp-font: 'Barlow', system-ui, sans-serif;
  --cp-font-mono: 'Barlow Condensed', monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--cp-bg-deep);
  color: var(--cp-text);
  font-family: var(--cp-font);
  user-select: none;
  -webkit-user-select: none;
}

.cp-wrapper {
  position: relative;
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 50% 15%, #0e274a 0%, var(--cp-bg-deep) 85%);
  overflow: hidden;
}

/* ── Topbar ─────────────────────────────────────────────────────────── */
.cp-topbar {
  height: 50px;
  flex-shrink: 0;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(7, 17, 31, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(56, 189, 248, 0.2);
  z-index: 50;
}

.cp-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--cp-text-muted);
  text-decoration: none;
  padding: 0.3rem 0.7rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}
.cp-back-btn:hover {
  color: var(--cp-cyan);
  border-color: var(--cp-cyan);
  background: rgba(34, 211, 238, 0.08);
}

.cp-top-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.cp-top-title span { color: var(--cp-yellow); }
.cp-top-badge {
  font-size: 0.65rem;
  padding: 0.18rem 0.5rem;
  border-radius: 99px;
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.3);
  color: var(--cp-cyan);
}

.cp-top-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cp-btn-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--cp-text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.cp-btn-icon:hover {
  color: var(--cp-text);
  border-color: var(--cp-cyan);
  background: rgba(34, 211, 238, 0.1);
}
.cp-btn-icon svg { width: 17px; height: 17px; }

/* ── Layout Principal ────────────────────────────────────────────────── */
.cp-main-stage {
  flex: 1;
  max-width: 1040px;
  width: 100%;
  margin: 0 auto;
  padding: 0.6rem 1rem 0.8rem;
  display: grid;
  grid-template-columns: auto 320px;
  justify-content: center;
  gap: 1.5rem;
  align-items: center;
  overflow: hidden;
}

/* ── Área Esquerda: Grade de Letras ──────────────────────────────────── */
.cp-board-section {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  align-items: center;
}

.cp-board-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(7, 17, 31, 0.8);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 12px;
  padding: 0.45rem 0.9rem;
}

.cp-phase-info {
  display: flex;
  flex-direction: column;
}
.cp-phase-tag {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cp-cyan);
}
.cp-phase-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: #ffffff;
}

.cp-timer-box {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--cp-font-mono);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--cp-yellow);
  background: rgba(250, 204, 21, 0.1);
  border: 1px solid rgba(250, 204, 21, 0.35);
  padding: 0.2rem 0.65rem;
  border-radius: 8px;
}
.cp-timer-box.hurry {
  color: var(--cp-red);
  border-color: var(--cp-red);
  background: rgba(239, 68, 68, 0.15);
  animation: pulseTimer 0.8s infinite alternate;
}
@keyframes pulseTimer {
  0% { transform: scale(1); }
  100% { transform: scale(1.05); }
}

/* Grade de Letras Ampliada */
.cp-grid-container {
  background: linear-gradient(145deg, #091a30 0%, #040e1c 100%);
  border: 2px solid rgba(56, 189, 248, 0.35);
  border-radius: 16px;
  padding: 0.65rem;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.55), 0 0 30px rgba(34, 211, 238, 0.15);
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
  width: min(480px, 60vh);
  height: min(480px, 60vh);
  margin: 0 auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.cp-cell {
  background: rgba(14, 38, 69, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 8px;
  color: #e2e8f0;
  font-family: var(--cp-font-mono);
  font-size: clamp(1.05rem, 2.6vh, 1.5rem);
  font-weight: 800;
  display: grid;
  place-items: center;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  transition: all 0.12s ease;
}
.cp-cell:hover {
  background: rgba(34, 211, 238, 0.22);
  border-color: var(--cp-cyan);
  color: #ffffff;
  transform: scale(1.06);
}
.cp-cell.selected {
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  color: #030811;
  border-color: #7dd3fc;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.6);
  transform: scale(1.08);
}
.cp-cell.found {
  background: linear-gradient(135deg, #facc15, #eab308);
  border-color: #fef08a;
  color: #040d1a;
  box-shadow: 0 0 14px var(--cp-yellow-glow);
}

/* Brilho Sutil na 1ª Letra — Efeito "Tá Quente, Tá Frio" ao passar o mouse perto */
.cp-cell.subtle-hint {
  border-color: rgba(250, 204, 21, 0.7) !important;
  box-shadow: 0 0 14px rgba(250, 204, 21, 0.45) !important;
  color: #fef08a !important;
  background: rgba(250, 204, 21, 0.16) !important;
  transition: all 0.2s ease;
}

.cp-cell.hint-pulse {
  animation: hintPulse 1s infinite ease-in-out;
  border-color: var(--cp-yellow);
  color: var(--cp-yellow);
}
@keyframes hintPulse {
  0%, 100% { background: rgba(250, 204, 21, 0.15); transform: scale(1); }
  50% { background: rgba(250, 204, 21, 0.5); transform: scale(1.12); }
}

/* ── Área Direita: Assistente, Palavras e Placar ─────────────────────── */
.cp-side-section {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

/* Assistente com Balão de Charadas */
.cp-assistant-card {
  background: linear-gradient(145deg, #0f274a 0%, #08172c 100%);
  border: 1.5px solid rgba(56, 189, 248, 0.35);
  border-radius: 14px;
  padding: 0.85rem;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
}

.cp-bot-header {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
}
.cp-bot-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #22d3ee, #0284c7);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  box-shadow: 0 0 10px var(--cp-cyan-glow);
}
.cp-bot-name {
  font-size: 0.82rem;
  font-weight: 800;
  color: #ffffff;
}
.cp-bot-badge {
  font-size: 0.62rem;
  color: var(--cp-cyan);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cp-speech-bubble {
  background: rgba(4, 13, 26, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  font-size: 0.85rem;
  line-height: 1.4;
  color: #e2e8f0;
}
.cp-speech-bubble strong { color: var(--cp-yellow); }

.cp-hint-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.6rem;
}
.cp-btn-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(250, 204, 21, 0.15);
  border: 1px solid rgba(250, 204, 21, 0.4);
  color: var(--cp-yellow);
  font-family: var(--cp-font);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.35rem 0.75rem;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.cp-btn-hint:hover {
  background: rgba(250, 204, 21, 0.25);
  transform: translateY(-1px);
}

/* Lista de Palavras da Fase */
.cp-words-card {
  background: rgba(7, 17, 31, 0.8);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 12px;
  padding: 0.75rem;
}
.cp-words-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cp-text-muted);
}
.cp-words-count {
  color: var(--cp-cyan);
}

.cp-words-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.cp-word-tag {
  background: rgba(14, 38, 69, 0.6);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  font-family: var(--cp-font-mono);
  font-size: 0.85rem;
  font-weight: 800;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.2s ease;
}
.cp-word-tag.current-target {
  border-color: var(--cp-yellow);
  color: #ffffff;
  background: rgba(250, 204, 21, 0.18);
  box-shadow: 0 0 10px rgba(250, 204, 21, 0.35);
  animation: pulseTarget 1.5s infinite alternate;
}
@keyframes pulseTarget {
  0% { transform: scale(1); }
  100% { transform: scale(1.04); }
}

.cp-word-tag.done {
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(34, 197, 94, 0.45);
  color: #86efac;
  text-decoration: line-through;
}

/* Placar e Recorde */
.cp-score-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.cp-score-card {
  background: rgba(7, 17, 31, 0.8);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 10px;
  padding: 0.55rem;
  text-align: center;
}
.cp-score-label {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--cp-text-muted);
  margin-bottom: 0.15rem;
}
.cp-score-val {
  font-family: var(--cp-font-mono);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--cp-cyan);
}
.cp-score-val.gold { color: var(--cp-yellow); }

/* ── Telas de Overlay (Intro, Game Over) ──────────────────────────────── */
.cp-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(4, 10, 20, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
  animation: cpFadeIn 0.25s ease-out;
  overflow-y: auto;
  overflow-x: hidden;
}

.cp-overlay.hidden {
  display: none !important;
}

.cp-card {
  background: linear-gradient(145deg, #0e223d 0%, #081628 100%);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 18px;
  max-width: 460px;
  max-height: 92vh;
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
  padding: 1.3rem 1.4rem;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65), 0 0 35px rgba(34, 211, 238, 0.15);
  position: relative;
}

.cp-card-icon {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background: linear-gradient(135deg, #1e3a5f, #0d2038);
  border: 1px solid rgba(56, 189, 248, 0.4);
  display: grid;
  place-items: center;
  margin: 0 auto 0.6rem;
  box-shadow: 0 0 20px var(--cp-cyan-glow);
  font-size: 1.5rem;
}

.cp-eyebrow {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cp-cyan);
  margin-bottom: 0.2rem;
}

.cp-title {
  font-size: clamp(1.35rem, 4vw, 1.7rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 0.4rem;
  color: var(--cp-text);
}
.cp-title span { color: var(--cp-yellow); }

.cp-desc {
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--cp-text-muted);
  margin-bottom: 1.1rem;
}

.cp-instructions {
  background: rgba(7, 17, 31, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 0.9rem;
  margin-bottom: 1.15rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.cp-instruction-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: #d1e8ff;
}

.cp-inst-icon {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 8px;
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.3);
  color: var(--cp-cyan);
  display: grid;
  place-items: center;
  font-size: 0.8rem;
}

.cp-btn-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 46px;
  padding: 0.75rem 1.4rem;
  background: linear-gradient(135deg, #fde047 0%, #facc15 50%, #eab308 100%);
  color: #08111e;
  border: 1px solid rgba(254, 240, 138, 0.6);
  border-radius: 12px;
  font-family: var(--cp-font);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(250, 204, 21, 0.35), 0 0 20px rgba(250, 204, 21, 0.2);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.cp-btn-play:hover {
  background: linear-gradient(135deg, #fef08a 0%, #fde047 50%, #facc15 100%);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 14px 35px rgba(250, 204, 21, 0.45);
}

/* Game Over Stats */
.cp-gameover-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  margin-bottom: 0.9rem;
}

.cp-go-stat {
  background: rgba(7, 17, 31, 0.8);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 10px;
  padding: 0.55rem 0.35rem;
  display: flex;
  flex-direction: column;
  text-align: center;
  min-width: 0;
  overflow: hidden;
}

.cp-go-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--cp-text-muted);
  margin-bottom: 0.15rem;
  white-space: nowrap;
}

.cp-go-val {
  font-family: var(--cp-font-mono);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--cp-cyan);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cp-go-val.highlight { color: var(--cp-yellow); }

.cp-record-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 800;
  color: #fef08a;
  background: rgba(250, 204, 21, 0.15);
  border: 1px solid rgba(250, 204, 21, 0.45);
  padding: 0.3rem 0.85rem;
  border-radius: 99px;
  margin-bottom: 0.85rem;
}

.cp-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cp-btn-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  min-height: 42px;
  padding: 0.65rem 1rem;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #86efac;
  border-radius: 10px;
  font-family: var(--cp-font);
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
}
.cp-btn-share:hover {
  background: rgba(34, 197, 94, 0.25);
  border-color: #86efac;
  color: #ffffff;
}

.cp-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  min-height: 38px;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--cp-text-muted);
  border-radius: 10px;
  font-family: var(--cp-font);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}
.cp-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--cp-text);
  border-color: rgba(255, 255, 255, 0.25);
}

.cp-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0f294a;
  border: 1px solid var(--cp-cyan);
  color: #ffffff;
  padding: 0.65rem 1.4rem;
  border-radius: 99px;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 200;
  pointer-events: none;
}
.cp-toast.show {
  transform: translateX(-50%) translateY(0);
}

@keyframes cpFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

/* Responsividade */
@media (max-width: 820px) {
  .cp-main-stage {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}
