/* ==========================================================================
   PALAVRAS CRUZADAS DO HARDWARE & TI — ESTILOS MATRIX & GRID
   ========================================================================== */

:root {
  --cw-bg: #050811;
  --cw-surface: #0a1120;
  --cw-surface-soft: #131f37;
  --cw-line: rgba(255, 255, 255, 0.12);
  --cw-text: #f8fafc;
  --cw-text-muted: #94a3b8;
  --cw-neon-cyan: #38bdf8;
  --cw-neon-green: #10b981;
  --cw-neon-purple: #a855f7;
  --cw-neon-gold: #f59e0b;
}

body.crossword-app-body {
  background-color: var(--cw-bg);
  background-image: 
    radial-gradient(circle at 50% 15%, rgba(56, 189, 248, 0.1) 0%, transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(16, 185, 129, 0.08) 0%, transparent 40%),
    linear-gradient(to bottom, #04060c, #090e1a);
  color: var(--cw-text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

.cw-container {
  max-width: 1180px;
  width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 1.25rem 1rem 3.5rem 1rem;
}

/* Header */
.cw-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--cw-line);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.cw-logo-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cw-logo-icon {
  background: rgba(56, 189, 248, 0.15);
  border: 1.5px solid rgba(56, 189, 248, 0.4);
  padding: 0.45rem 0.65rem;
  border-radius: 12px;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cw-logo-text h1 {
  font-size: 1.4rem;
  font-weight: 800;
  margin: 0;
  color: #ffffff;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cw-logo-text p {
  font-size: 0.78rem;
  color: var(--cw-text-muted);
  margin: 0.15rem 0 0 0;
}

/* Abas */
.cw-top-nav {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.cw-nav-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--cw-line);
  padding: 0.25rem;
  border-radius: 10px;
  gap: 0.35rem;
}

.cw-nav-tab {
  background: transparent;
  border: none;
  color: var(--cw-text-muted);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.45rem 0.95rem;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.cw-nav-tab:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

.cw-nav-tab.active {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

.cw-nav-btn {
  background: var(--cw-surface);
  border: 1px solid var(--cw-line);
  color: var(--cw-text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.cw-nav-btn:hover {
  background: var(--cw-surface-soft);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
}

/* Card Geral */
.cw-card {
  background: var(--cw-surface);
  border: 1.5px solid var(--cw-line);
  border-radius: 16px;
  padding: 1.75rem;
  width: 100%;
  box-sizing: border-box;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  animation: fadeIn 0.3s ease;
}

/* Botões de Fase / Puzzle */
.opt-puzzle-btn {
  background: var(--cw-surface);
  border: 1.5px solid var(--cw-line);
  color: var(--cw-text-muted);
  font-size: 0.86rem;
  font-weight: 700;
  padding: 0.55rem 1.1rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.opt-puzzle-btn:hover {
  background: var(--cw-surface-soft);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
}

.opt-puzzle-btn.selected {
  background: rgba(56, 189, 248, 0.25) !important;
  border-color: var(--cw-neon-cyan) !important;
  color: #ffffff !important;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

/* ==========================================================================
   LAYOUT DO JOGO (GRADE DE LETRAS + PISTAS)
   ========================================================================== */
.cw-game-layout {
  display: grid;
  grid-template-columns: minmax(320px, 450px) 1fr;
  gap: 1.5rem;
  align-items: start;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 960px) {
  .cw-game-layout {
    grid-template-columns: 1fr;
  }
}

.cw-grid-container-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
}

.cw-grid-wrapper {
  background: #000000;
  border: 2px solid var(--cw-line);
  border-radius: 14px;
  padding: 0.85rem;
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.95);
  box-sizing: border-box;
  width: 100%;
  overflow: hidden;
}

.crossword-board-table {
  display: grid;
  gap: 2px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Células da Matriz */
.cw-cell {
  position: relative;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Courier New', Courier, monospace;
  font-weight: 900;
  color: #ffffff;
  border-radius: 4px;
  transition: all 0.12s ease;
  user-select: none;
}

/* Botão Solucionar Matriz */
.phm-btn-solve-matrix {
  background: rgba(168, 85, 247, 0.12);
  border: 1.5px solid rgba(168, 85, 247, 0.4);
  color: #d8b4fe;
  font-size: 0.86rem;
  font-weight: 700;
  padding: 0.65rem 1.25rem;
  border-radius: 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  width: 100%;
  box-sizing: border-box;
}

.phm-btn-solve-matrix:hover {
  background: rgba(168, 85, 247, 0.25);
  border-color: #a855f7;
  color: #ffffff;
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
}

@media (max-width: 500px) {
  .cw-cell {
    width: 32px;
    height: 32px;
    font-size: 1.05rem;
  }
}

.cw-cell.cell-blocked {
  background: #060912;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.cw-cell.cell-playable {
  background: #0f172a;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  cursor: pointer;
}

.cw-cell.cell-playable:hover {
  border-color: var(--cw-neon-cyan);
}

/* Célula Ativa / Palavra em Foco */
.cw-cell.in-word-highlight {
  background: rgba(56, 189, 248, 0.25) !important;
  border-color: rgba(56, 189, 248, 0.6) !important;
}

.cw-cell.is-focused {
  background: rgba(56, 189, 248, 0.5) !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.7);
  animation: cellPulse 1.5s infinite alternate;
}

.cw-cell.is-correct {
  background: rgba(16, 185, 129, 0.35) !important;
  border-color: #10b981 !important;
  color: #34d399 !important;
}

.cw-cell.is-error {
  background: rgba(239, 68, 68, 0.35) !important;
  border-color: #ef4444 !important;
  color: #fca5a5 !important;
}

/* Número da Pista no Canto Superior Esquerdo da Célula */
.cw-cell-number {
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: 0.62rem;
  font-weight: 800;
  color: #38bdf8;
  font-family: system-ui;
  line-height: 1;
}

/* Painel de Pistas (Horizontais & Verticais) */
.cw-clues-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.clues-columns-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 600px) {
  .clues-columns-box {
    grid-template-columns: 1fr;
  }
}

.clues-group-card {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--cw-line);
  border-radius: 12px;
  padding: 1.25rem;
  overflow: visible;
}

.clues-group-title {
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--cw-neon-cyan);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border-bottom: 1px solid var(--cw-line);
  padding-bottom: 0.45rem;
}

.clue-item-row {
  font-size: 0.88rem;
  line-height: 1.55;
  color: #cbd5e1;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 0.65rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  word-break: normal;
}

.clue-item-row:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.clue-item-row.is-active-clue {
  background: rgba(56, 189, 248, 0.2);
  border-left: 3px solid #38bdf8;
  color: #ffffff;
  font-weight: 700;
}

.clue-item-row.is-completed {
  text-decoration: line-through;
  opacity: 0.6;
}

/* Botões de Ação */
.btn-cw-action {
  background: var(--cw-surface-soft);
  border: 1.5px solid var(--cw-line);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-cw-action:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-cw-action.check {
  background: linear-gradient(135deg, #059669, #10b981);
  border-color: #10b981;
}

.btn-cw-action.check:hover {
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.5);
}

/* Dicionário */
.dict-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.dict-card-box {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--cw-line);
  border-radius: 12px;
  padding: 1.25rem;
}

@keyframes cellPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.04); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Animação de Dica Laser (Pulso Dourado na Célula) */
@keyframes hintCellPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 rgba(250, 204, 21, 0); }
  50% { transform: scale(1.1); background: rgba(250, 204, 21, 0.45) !important; border-color: #facc15 !important; color: #facc15 !important; box-shadow: 0 0 18px rgba(250, 204, 21, 0.8); }
  100% { transform: scale(1); }
}

.cw-cell.cell-hint {
  animation: hintCellPulse 1.2s ease;
}

.setup-section-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.85rem;
  letter-spacing: -0.01em;
}

.setup-section-title svg {
  flex-shrink: 0;
}

/* Bolinhas estilo semáforo (glowing dots) */
.phm-sem-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.phm-sem-dot.dot-green {
  background: #10b981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.8), inset 0 1px 2px rgba(255, 255, 255, 0.6);
  border: 1px solid #34d399;
}

.phm-sem-dot.dot-yellow {
  background: #facc15;
  box-shadow: 0 0 10px rgba(250, 204, 21, 0.8), inset 0 1px 2px rgba(255, 255, 255, 0.6);
  border: 1px solid #fde047;
}

.phm-sem-dot.dot-red {
  background: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.8), inset 0 1px 2px rgba(255, 255, 255, 0.6);
  border: 1px solid #f87171;
}