/* ============================================
   Nonogram (Picross) — Game-specific styles
   ============================================ */

.nonogram-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
}

/* ---- SCORE BAR ---- */
.nonogram-container .score-board {
  display: flex;
  gap: var(--space-lg);
  font-family: 'Space Mono', monospace;
}

.nonogram-container .score-box {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-lg);
  text-align: center;
  min-width: 100px;
}

.nonogram-container .score-box .label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}

.nonogram-container .score-box .value {
  font-size: 1.6rem;
  font-weight: 700;
  color: #14b8a6;
}

/* ---- DIFFICULTY PICKER ---- */
.difficulty-picker {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  justify-content: center;
}

.diff-btn {
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: var(--space-xs) var(--space-md);
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--surface-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.diff-btn:hover { color: #14b8a6; border-color: #14b8a6; }
.diff-btn.active {
  background: rgba(20, 184, 166, 0.12);
  color: #14b8a6;
  border-color: #14b8a6;
  box-shadow: 0 0 12px rgba(20, 184, 166, 0.2);
}

/* ---- PUZZLE TITLE ---- */
.puzzle-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-align: center;
}

.puzzle-label strong {
  color: var(--text-secondary);
}

/* ---- MODE TOGGLE ---- */
.mode-toggle {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.mode-btn {
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-sm);
  border: 1px solid var(--surface-light);
  background: transparent;
  cursor: pointer;
  font-family: 'Space Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: var(--transition-fast);
  color: var(--text-muted);
}

.mode-btn.fill.active {
  background: rgba(20, 184, 166, 0.12);
  border-color: #14b8a6;
  color: #14b8a6;
}

.mode-btn.mark.active {
  background: rgba(255, 107, 107, 0.12);
  border-color: var(--accent-warm);
  color: var(--accent-warm);
}

/* ---- BOARD WRAPPER ---- */
.board-outer {
  position: relative;
  overflow: auto;
  max-width: 100%;
}

/* ---- CSS GRID BOARD ---- */
.nonogram-board {
  display: inline-grid;
  user-select: none;
  touch-action: none;
}

/* ---- CLUE CELLS ---- */
.ng-corner {
  /* Empty top-left cell */
}

.ng-col-clue {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 6px;
  gap: 1px;
  transition: var(--transition-fast);
}

.ng-row-clue {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  gap: 4px;
  transition: var(--transition-fast);
}

.ng-col-clue span,
.ng-row-clue span {
  font-family: 'Space Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  min-width: 16px;
  text-align: center;
  line-height: 1.4;
}

.ng-col-clue.done span,
.ng-row-clue.done span {
  color: var(--text-muted);
  opacity: 0.5;
}

.ng-col-clue.error span,
.ng-row-clue.error span {
  color: var(--accent-warm);
}

/* ---- GAME CELLS ---- */
.ng-cell {
  background: var(--bg-card);
  border: 1px solid var(--surface-light);
  cursor: pointer;
  position: relative;
  outline: none;
  transition: background 80ms ease, transform 60ms ease;
  border-radius: 0;
}

.ng-cell:hover {
  background: var(--surface);
  transform: scale(0.92);
  z-index: 2;
}

/* Thicker separators every 5 cells */
.ng-cell.sep-right  { border-right:  2px solid var(--surface); }
.ng-cell.sep-bottom { border-bottom: 2px solid var(--surface); }

/* States */
.ng-cell.filled {
  background: var(--text-primary);
}

.ng-cell.filled:hover {
  background: #c0c0c8;
  transform: scale(0.92);
}

.ng-cell.marked {
  background: var(--bg-card);
}

.ng-cell.marked::after {
  content: '×';
  position: absolute;
  inset: 0;
  font-size: 1.2em;
  font-weight: 700;
  color: var(--accent-warm);
  text-align: center;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* Hover hint — shows affected scope when hovering in fill mode */
.ng-cell.col-hint,
.ng-cell.row-hint {
  background: rgba(20, 184, 166, 0.08);
}

.ng-cell.filled.col-hint,
.ng-cell.filled.row-hint {
  background: var(--text-primary);
}

/* ---- WIN OVERLAY ---- */
.ng-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 15, 0.88);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  transition: var(--transition-normal);
}

.ng-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.ng-overlay h2 {
  font-family: 'Space Mono', monospace;
  font-size: 1.8rem;
  color: #14b8a6;
  text-shadow: 0 0 20px rgba(20, 184, 166, 0.6);
  letter-spacing: 0.1em;
}

.ng-overlay p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-align: center;
  line-height: 1.8;
}

.ng-overlay .win-stats {
  font-family: 'Space Mono', monospace;
  font-size: 0.9rem;
  color: #14b8a6;
}

/* ---- CONTROLS ---- */
.game-controls {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  justify-content: center;
}

.hint-text {
  font-family: 'Space Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 2;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 520px) {
  .nonogram-container .score-box {
    min-width: 80px;
    padding: var(--space-xs) var(--space-md);
  }
  .nonogram-container .score-box .value { font-size: 1.3rem; }
}
