/* Nonogramme — clues on the top and left, the grid below-right. The column
   clues and the grid share one repeat(N,1fr) track region so they line up; the
   row clues and the grid share the row region the same way. */

.nono-root { padding: clamp(6px, 2vw, 16px); max-inline-size: 480px; margin: 0 auto; color: var(--color-text); }

.nono-bar { display: flex; justify-content: flex-end; margin-block-end: var(--space-3); }
.nono-mode {
  font-size: 13px; padding: 7px 12px; cursor: pointer; font-family: var(--font-body);
  border: 1px solid var(--color-neutral-400); border-radius: var(--radius-md);
  background: var(--color-neutral-100); color: var(--color-text);
}
.nono-mode[aria-pressed="true"] { background: var(--color-accent-200); border-color: var(--color-accent); color: var(--color-accent-900); font-weight: 600; }

.nono-wrap { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; }
.nono-corner { grid-column: 1; grid-row: 1; }

.nono-cols { grid-column: 2; grid-row: 1; display: grid; grid-template-columns: repeat(var(--n), 1fr); column-gap: 1px; align-items: end; }
.nono-cc { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-block-end: 3px; gap: 1px; }

.nono-rows { grid-column: 1; grid-row: 2; display: grid; grid-template-rows: repeat(var(--n), 1fr); row-gap: 1px; justify-items: end; }
.nono-rc { display: flex; align-items: center; justify-content: flex-end; padding-inline-end: 6px; gap: 4px; }

.nono-cc span, .nono-rc span {
  font-family: var(--font-body); font-variant-numeric: tabular-nums; font-weight: 600;
  font-size: clamp(9px, 2.1vw, 13px); line-height: 1.15; color: var(--color-text);
}
.nono-cc.done span, .nono-rc.done span { color: var(--color-neutral-400); }

/* Grid lines are the grid's own background showing through 1px gaps — rendered
   uniformly by the layout engine, unlike 1px cell borders which straddle
   fractional pixels and look uneven. The frame is an outline (no layout shift,
   so clue columns stay aligned). */
.nono-grid {
  grid-column: 2; grid-row: 2; display: grid;
  grid-template-columns: repeat(var(--n), 1fr); grid-template-rows: repeat(var(--n), 1fr);
  aspect-ratio: 1; gap: 1px; background: var(--color-neutral-400);
  outline: 2px solid var(--color-text);
}
.nono-cell {
  min-inline-size: 0; padding: 0; margin: 0; cursor: pointer; border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(9px, 2vw, 14px); color: var(--color-neutral-500);
  background: var(--color-neutral-100);
}
.nono-cell:hover:not(:disabled) { background: var(--color-neutral-200); }
.nono-cell.fill { background: var(--color-text); }
.nono-cell.cross { color: var(--color-neutral-500); background: var(--color-neutral-100); }
.nono-cell:disabled { cursor: default; }

.nono-root.solved .nono-cell.fill { background: var(--color-accent); }

/* Dark page */
.nono-root.mode-dark .nono-mode { background: #2d2b29; border-color: #403c38; color: #ece8e2; }
.nono-root.mode-dark .nono-mode[aria-pressed="true"] { background: var(--color-accent-700); border-color: var(--color-accent-400); color: #fff; }
.nono-root.mode-dark .nono-cc span, .nono-root.mode-dark .nono-rc span { color: #ece8e2; }
.nono-root.mode-dark .nono-cc.done span, .nono-root.mode-dark .nono-rc.done span { color: #5c5852; }
.nono-root.mode-dark .nono-grid { background: #403c38; outline-color: #ece8e2; }
.nono-root.mode-dark .nono-cell { background: #262421; color: #98938c; }
.nono-root.mode-dark .nono-cell:hover:not(:disabled) { background: #302d2a; }
.nono-root.mode-dark .nono-cell.fill { background: #ece8e2; }
.nono-root.mode-dark .nono-cell.cross { background: #262421; color: #98938c; }
.nono-root.mode-dark.solved .nono-cell.fill,
.nono-root.solved.mode-dark .nono-cell.fill { background: var(--color-accent-400); }
