/* ============================================================
   Nonograma — tablero con pistas de filas (izquierda) y columnas
   (arriba). Todo el tamaño sale de --cell (lo calcula nonogram.js
   según el espacio disponible). Separadores cada 5 casillas, como en
   papel: ayudan a contar sin mirar dos veces.
   ============================================================ */
.nn-host { display: flex; justify-content: center; padding: 8px 0 12px; }
.nn { width: 100%; display: flex; justify-content: center; }
.nn-grid {
  --cell: 30px;
  display: grid;
  grid-template-columns: auto calc(var(--cell) * var(--w) + 4px);
  grid-template-rows: auto calc(var(--cell) * var(--h) + 4px);
  grid-template-areas: "corner cols" "rows board";
  font-family: var(--font-num);
}
.nn-corner { grid-area: corner; }
.nn-cols { grid-area: cols; display: grid; grid-template-columns: repeat(var(--w), var(--cell)); align-items: end; padding: 0 2px; }
.nn-rows { grid-area: rows; display: grid; grid-template-rows: repeat(var(--h), var(--cell)); justify-items: end; padding: 2px 0; }

.nn-clue {
  display: flex; color: var(--ink-2);
  font-size: calc(var(--cell) * .46); font-weight: 500; line-height: 1;
  transition: color var(--dur), background var(--dur);
}
.nn-clue-col { flex-direction: column; align-items: center; justify-content: flex-end; gap: calc(var(--cell) * .22); padding-bottom: calc(var(--cell) * .28); border-radius: 6px 6px 0 0; min-height: 100%; }
.nn-clue-row { align-items: center; justify-content: flex-end; gap: calc(var(--cell) * .3); padding-right: calc(var(--cell) * .32); padding-left: 6px; border-radius: 6px 0 0 6px; width: 100%; }
.nn-clue.is-active { background: var(--surface-2); color: var(--ink); }
.nn-clue.is-ok { color: color-mix(in srgb, var(--muted) 55%, transparent); }
.nn-clue.is-ok.is-active { color: var(--muted); }

.nn-board {
  grid-area: board;
  display: grid;
  grid-template-columns: repeat(var(--w), var(--cell));
  grid-template-rows: repeat(var(--h), var(--cell));
  background: var(--surface);
  border: 2px solid var(--ink);
  box-sizing: border-box;
  border-radius: 4px;
  touch-action: none;
  user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  outline: none;
}
.nn-board:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 40%, transparent); }
.nn-cell {
  position: relative;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transition: background-color .08s ease;
}
.nn-cell.nn-vsep { border-right: 1.5px solid var(--ink-2); }
.nn-cell.nn-hsep { border-bottom: 1.5px solid var(--ink-2); }
.nn-cell.is-filled { background: var(--ink); }
.nn-cell.is-x::before, .nn-cell.is-x::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 46%; height: 1.6px;
  background: var(--muted); border-radius: 2px;
}
.nn-cell.is-x::before { transform: translate(-50%, -50%) rotate(45deg); }
.nn-cell.is-x::after { transform: translate(-50%, -50%) rotate(-45deg); }
.nn-cell.is-cursor { box-shadow: inset 0 0 0 2px var(--sel); z-index: 1; }
.nn-cell.is-filled.is-cursor { box-shadow: inset 0 0 0 2px var(--sel), inset 0 0 0 4px var(--ink); background: color-mix(in srgb, var(--ink) 88%, var(--sel)); }
.nn-cell.is-wrong { background: var(--danger); }
.nn-cell.is-wrong.is-x { background: var(--danger-weak); }
@media (hover: hover) {
  .nn-cell:not(.is-filled):hover { background: var(--surface-2); }
}

/* resuelto: el dibujo "revela" en el tono de acento, sin rejilla */
.nn.is-done .nn-cell { border-color: transparent; cursor: default; }
.nn.is-done .nn-cell.is-filled { background: var(--ink); animation: nn-pop .5s var(--ease) both; }
.nn.is-done .nn-cell.is-cursor { box-shadow: none; }
.nn.is-done .nn-clue { color: var(--muted); }
@keyframes nn-pop { 40% { transform: scale(1.08); } }

