/* ============================================================
   Caça-palavras — tema sunset.
   ============================================================ */

.sj-game-host:has(.cp) {
  --sj-text:           #2d2438;
  --sj-text-dim:       #5d5468;
  --sj-text-mute:      rgba(45, 36, 56, 0.42);
  --sj-bg-card:        rgba(255, 255, 255, 0.85);
  --sj-bg-elev:        rgba(255, 255, 255, 0.7);
  --sj-bg-card-hover:  rgba(255, 255, 255, 0.95);
  --sj-border:         rgba(255, 255, 255, 0.5);
  --sj-border-bright:  rgba(45, 36, 56, 0.18);
  --sj-accent:         #6b5bff;
  --sj-accent-hover:   #5347d6;
  --sj-accent-soft:    rgba(107, 91, 255, 0.12);
  --sj-gold:           #ffd93d;
  --sj-danger:         #ff3355;
  --sj-score-bg:       #fff;
}
.sj-game-host:has(.cp),
body:has(.sj-game-stage) .sj-game-host:has(.cp) {
  background:
    radial-gradient(circle at 15% 25%, rgba(255,255,255,0.18), transparent 35%),
    radial-gradient(circle at 85% 80%, rgba(107,91,255,0.20), transparent 40%),
    linear-gradient(135deg, #ff7e5f 0%, #feb47b 45%, #ff6b95 100%);
}
.sj-game-stage-frame:has(.cp) {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.25);
}

/* ============ Wrapper ============ */
.cp {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  height: 100%;
  box-sizing: border-box;
}

/* ============ Jogo (grid + lista) ============ */
.cp-game {
  /* width:fit-content + margin auto força o grupo (board+lista) a ficar
     do tamanho do seu conteúdo e centralizado horizontalmente no .cp.
     Antes (width:100% + justify-content:center) o cp-game preenchia toda
     a largura do palco e o flex acabava empurrando board p/ esquerda e
     lista p/ direita conforme o item ganhava espaço residual. */
  display: flex;
  align-items: center;
  gap: 16px;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  height: 100%;
  min-height: 0;
}
.cp-game[hidden] { display: none; }

.cp-board {
  position: relative;
  display: grid;
  /* cols + --cp-cell setados via JS */
  gap: 3px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.32);
  border-radius: 14px;
  box-shadow:
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.45),
    0 8px 28px rgba(45, 36, 56, 0.18);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  user-select: none;
  flex: 0 0 auto;
}

.cp-cell {
  background: #fff;
  border: 0;
  border-radius: 4px;
  width: var(--cp-cell, 36px);
  height: var(--cp-cell, 36px);
  font-family: var(--sj-font-display);
  font-weight: 900;
  font-size: calc(var(--cp-cell, 36px) * 0.5);
  /* corrige metric da Big Shoulders */
  line-height: 1;
  padding-top: 2px;
  box-sizing: border-box;
  color: #2d2438;
  cursor: pointer;
  display: grid; place-items: center;
  transition: background .12s, color .12s, transform .12s;
}
.cp-cell.is-preview {
  background: var(--sj-accent);
  color: #fff;
  transform: scale(0.95);
}
.cp-cell.is-found {
  background: var(--sj-accent-soft);
  color: var(--sj-accent);
  font-weight: 900;
}
.cp-cell.is-found.is-preview {
  background: var(--sj-accent);
  color: #fff;
}

.cp-strikes {
  position: absolute;
  inset: 8px;
  pointer-events: none;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
}
.cp-strikes line {
  stroke: var(--sj-accent);
  stroke-width: 6;
  stroke-linecap: round;
  opacity: 0.45;
}
.cp-strikes line.is-revealed {
  stroke: var(--sj-danger);
  opacity: 0.7;
}

/* ============ Lista lateral ============ */
.cp-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  width: 220px;
  flex: 0 0 220px;
  /* align-self default (stretch) faria a lista esticar verticalmente
     e deixar espaço vazio abaixo; intrínseco mantém-na compacta. */
  align-self: center;
}
.cp-progress {
  background: rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  padding: 8px 14px;
  font-family: var(--sj-font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.cp-progress-label { color: #2d2438; }
.cp-progress-count { color: var(--sj-accent); font-size: 13px; }

.cp-words {
  list-style: none;
  padding: 8px;
  margin: 0;
  background: rgba(255, 255, 255, 0.72);
  border-radius: 12px;
  font-family: var(--sj-font-mono);
  font-size: 12px;
  font-weight: 700;
  color: #2d2438;
  /* Grid de palavras: auto-fill em colunas de ~80px. Na sidebar do desktop
     (220px) dá 2 colunas; no mobile abaixo do board (largura inteira) dá
     6-7 colunas — sempre compacto, sem deixar pílulas gigantes. */
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 4px;
  align-content: start;
  min-height: 0;
  overflow-y: auto;
}
.cp-words li {
  padding: 4px 6px;
  border-radius: 6px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .15s, color .15s;
}
.cp-words li.is-found {
  color: var(--sj-accent);
  text-decoration: line-through;
  background: var(--sj-accent-soft);
}
.cp-words li.is-revealed {
  color: var(--sj-danger);
  text-decoration: line-through;
  background: rgba(255, 51, 85, 0.12);
}

/* ============ Mobile ============ */
@media (max-width: 700px) {
  .cp { padding: 8px; gap: 10px; }
  .cp-game {
    flex-direction: column;
    gap: 8px;
  }
  .cp-board { padding: 6px; }
  .cp-side { width: 100%; flex: 0 0 auto; align-self: center; }
}
