/* Word games — Word Search and Daily Word. Reuses Fire A tokens. */

.word-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space);
  padding: var(--space);
  background: radial-gradient(120% 90% at 50% 28%, #2e4d78 0%, #1d2f4a 55%, #152238 100%);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), inset 0 0 60px rgba(0,0,0,0.35);
}
@media (max-width: 800px) {
  .word-body { grid-template-columns: 1fr; }
}

/* ---- Word Search ---- */
.ws-grid {
  display: grid;
  grid-template-columns: repeat(var(--ws-size, 12), 1fr);
  gap: 2px;
  width: min(100%, 680px);
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.ws-cell {
  background: rgba(255,255,255,0.08);
  border-radius: 6px;
  color: var(--fg);
  font-weight: 700;
  font-size: clamp(11px, 2.3vmin, 22px);
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  cursor: pointer;
  min-height: 0;
  min-width: 0;
  transition: background 0.12s ease, color 0.12s ease, transform 0.12s ease;
}
.ws-cell:hover { background: rgba(255,255,255,0.14); }
.ws-cell.is-preview {
  background: rgba(87, 184, 76, 0.55);
  color: #fff;
}
.ws-cell.is-active {
  background: rgba(87, 184, 76, 0.9);
  color: #fff;
}
.ws-cell.is-cursor {
  box-shadow: 0 0 0 3px var(--focus);
  z-index: 2;
  position: relative;
}
.ws-cell.is-found {
  background: rgba(87, 184, 76, 0.32);
  color: #d6ffcf;
  box-shadow: inset 0 0 0 1px rgba(87, 184, 76, 0.55);
}
.ws-side {
  min-width: 160px;
  max-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
@media (max-width: 800px) {
  .ws-side { max-width: none; min-width: 0; }
}
.ws-words-title {
  margin: 0 0 4px;
  font-size: 0.85em;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ws-words {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.ws-word {
  padding: 4px 10px;
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95em;
  letter-spacing: 0.5px;
  transition: opacity 0.2s ease;
}
.ws-word.is-found {
  background: rgba(87, 184, 76, 0.32);
  color: #d6ffcf;
  text-decoration: line-through;
  opacity: 0.7;
}

/* ---- Daily Word ---- */
.dw-body {
  display: flex;
  flex-direction: column;
  gap: var(--space);
  align-items: center;
  padding: var(--space);
}
.dw-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(100%, 340px);
}
.dw-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.dw-cell {
  aspect-ratio: 1 / 1;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  border: 2px solid rgba(255,255,255,0.14);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: clamp(18px, 4.5vmin, 30px);
  color: var(--fg);
  text-transform: uppercase;
  transition: background 0.2s ease, color 0.2s ease;
}
.dw-cell.is-typing { border-color: rgba(255,255,255,0.4); }
.dw-cell.is-cursor { border-color: var(--focus); box-shadow: 0 0 0 2px rgba(245,197,66,0.3); }
.dw-cell.is-gray { background: #434a55; color: #cfd6df; border-color: transparent; }
.dw-cell.is-yellow { background: #b79838; color: #fff; border-color: transparent; }
.dw-cell.is-green { background: #4c9d5c; color: #fff; border-color: transparent; }

.dw-keyboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  width: min(100%, 600px);
}
.dw-key-row {
  display: flex;
  gap: 4px;
  justify-content: center;
  width: 100%;
}
.dw-key {
  flex: 1 1 0;
  min-width: 0;
  min-height: 44px;
  padding: 6px 4px;
  background: rgba(255,255,255,0.12);
  border-radius: 6px;
  font-weight: 700;
  font-size: clamp(11px, 2vmin, 15px);
  color: var(--fg);
  transition: background 0.12s ease;
}
.dw-key:hover { background: rgba(255,255,255,0.18); }
.dw-key.dw-key-wide { flex: 1.5 1 0; font-size: 0.82em; }
.dw-key.is-gray { background: #363c46; color: #afb6c1; }
.dw-key.is-yellow { background: #b79838; color: #fff; }
.dw-key.is-green { background: #4c9d5c; color: #fff; }
.dw-stats { color: var(--fg-dim); font-size: 0.95em; }

@media (max-width: 480px) {
  .dw-cell { font-size: clamp(16px, 7vw, 24px); }
}
