/* crossword.css — easter egg del crucigrama diario ("crucigrama" + Enter,
   igual estilo que el Konami code de duck-hunt.js). Reusa los tokens de
   /style.css (--ink, --accent, --muted, --border, --card, --bg). */

.cw-no-scroll { overflow: hidden; }

.cw-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 20, 20, 0.72);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.cw-modal {
  background: var(--card, #fff);
  border-radius: 20px;
  width: 100%;
  max-width: 620px;
  max-height: 94vh;
  overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
  font-family: var(--font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif);
  color: var(--ink, #1a1414);
}

.cw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: linear-gradient(135deg, var(--grad-1, #FB4D2A), var(--grad-2, #F72218));
  color: #fff;
  border-radius: 20px 20px 0 0;
  position: sticky;
  top: 0;
  z-index: 2;
}
.cw-header-title { display: flex; flex-direction: column; }
.cw-header-eyebrow { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.85; }
.cw-header-num { font-weight: 800; font-size: 1.15rem; }
.cw-header-right { display: flex; align-items: center; gap: 16px; }
.cw-timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.05rem; }
.cw-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.cw-close:hover { background: rgba(255, 255, 255, 0.32); }

.cw-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding: 24px;
}

.cw-grid-wrap { flex: 0 0 auto; }
.cw-grid {
  display: grid;
  grid-template-columns: repeat(var(--cw-n, 7), 56px);
  grid-template-rows: repeat(var(--cw-n, 7), 56px);
  gap: 3px;
  background: var(--ink, #1a1414);
  padding: 3px;
  border-radius: 8px;
}
.cw-cell {
  position: relative;
  background: #fff;
}
.cw-cell-block { background: var(--ink, #1a1414); }
.cw-cell input {
  width: 100%;
  height: 100%;
  border: none;
  text-align: center;
  font-size: 1.3rem;
  font-weight: 700;
  text-transform: uppercase;
  background: transparent;
  color: var(--ink, #1a1414);
  caret-color: transparent;
}
.cw-cell input:focus { outline: none; }
.cw-cell.is-hinted { background: rgba(250, 200, 90, 0.35); }
.cw-cell.is-in-word { background: #d9566a; }
.cw-cell.is-in-word input { color: #fff; }
.cw-cell.is-active { background: var(--accent, #D72638); }
.cw-cell.is-active input { color: #fff; }
.cw-cell.is-wrong { box-shadow: inset 0 0 0 2px #ffb020; }
.cw-cell.is-wrong input { color: var(--accent, #D72638); }
.cw-cell.is-active.is-wrong input,
.cw-cell.is-in-word.is-wrong input { color: #fff; }
.cw-cell.is-correct { background: #e3e3e3; }
.cw-cell.is-correct input { color: var(--ink, #1a1414); cursor: default; }
.cw-num {
  position: absolute;
  top: 2px; left: 3px;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--muted, #837878);
  pointer-events: none;
}

.cw-clues-row { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.cw-clues { min-width: 0; }
.cw-clues h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted, #837878); margin-bottom: 10px; }
.cw-clue-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow-y: auto; }
.cw-clue-item { font-size: 0.88rem; line-height: 1.4; cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.cw-clue-item:hover { background: rgba(215, 38, 56, 0.06); }
.cw-clue-item.is-active { background: rgba(215, 38, 56, 0.14); font-weight: 700; }
.cw-clue-num { color: var(--accent, #D72638); font-weight: 700; }

.cw-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px 24px;
  flex-wrap: wrap;
}
.cw-btn {
  background: var(--ink, #1a1414);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
}
.cw-btn:hover { opacity: 0.88; }
.cw-btn-check { background: var(--accent, #D72638); }
.cw-btn:disabled { opacity: 0.5; cursor: default; }
.cw-stats { color: var(--muted, #837878); font-size: 0.85rem; margin-left: auto; }

.cw-complete { padding: 4px 24px 28px; border-top: 1px solid var(--border, #ede4e3); margin-top: 4px; padding-top: 20px; }
.cw-complete h3 { font-size: 1.2rem; margin-bottom: 6px; }
.cw-complete-stats { color: var(--muted, #837878); font-size: 0.9rem; margin-bottom: 6px; }
.cw-complete-score { font-size: 1.05rem; margin-bottom: 16px; }
.cw-complete-score strong { color: var(--accent, #D72638); font-size: 1.3rem; }
.cw-name-row { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.cw-name-input {
  flex: 1 1 160px;
  padding: 10px 14px;
  border: 1.5px solid var(--border, #ede4e3);
  border-radius: 10px;
  font-size: 0.92rem;
  font-family: inherit;
}
.cw-name-input:focus { outline: none; border-color: var(--accent, #D72638); }
.cw-btn-submit { flex: 0 0 auto; }
.cw-leaderboard-title { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted, #837878); margin-bottom: 10px; }
.cw-leaderboard { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cw-leaderboard li { display: flex; align-items: center; gap: 8px; font-size: 0.92rem; padding: 6px 10px; border-radius: 8px; background: var(--bg, #faf7f6); }
.cw-lb-rank { font-weight: 700; color: var(--accent, #D72638); width: 20px; }
.cw-lb-name { flex: 1; font-weight: 600; }
.cw-lb-score { font-weight: 700; }
.cw-leaderboard-empty { color: var(--muted, #837878); background: none !important; }

@media (max-width: 640px) {
  .cw-modal { border-radius: 16px; max-height: 96vh; }
  .cw-header { padding: 16px 18px; border-radius: 16px 16px 0 0; }
  .cw-body { padding: 18px; gap: 16px; }
  .cw-grid { grid-template-columns: repeat(var(--cw-n, 7), 40px); grid-template-rows: repeat(var(--cw-n, 7), 40px); }
  .cw-cell input { font-size: 0.95rem; }
  .cw-clues-row { grid-template-columns: 1fr; gap: 16px; }
  .cw-clue-list { max-height: 140px; }
  .cw-actions { padding: 0 18px 18px; }
  .cw-stats { margin-left: 0; width: 100%; }
  .cw-complete { padding: 20px 18px 24px; }
}

@media (max-width: 380px) {
  .cw-grid { grid-template-columns: repeat(var(--cw-n, 7), 36px); grid-template-rows: repeat(var(--cw-n, 7), 36px); }
}
