/* Nonogram Specific Styles */

:root {
    --game-accent: #6c5ce7;
    --game-accent-soft: rgba(108, 92, 231, 0.12);
}

/* Puzzle Board Layout */
.puzzle-board {
  display: grid;
  background: var(--bg-secondary);
  padding: 10px;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  gap: 2px;
  margin: auto;
  touch-action: none; /* Prevent scroll on drag */
}

/* Hints */
.hint-row,
.hint-col {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  background-color: var(--bg-secondary);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.hint-col {
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: 4px;
}

.hint-row {
  padding-right: 4px;
}

.hint-number {
  padding: 1px;
}

.hint-number.satisfied {
  opacity: 0.3;
}

[data-theme='dark'] .hint-number.satisfied {
  opacity: 0.9;
}

/* Cells */
.cell {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  position: relative;
  transition: background-color 0.1s;
}

[data-theme='dark'] .cell {
  border-color: #64748b;
}

/* Cell States */
.cell[data-state="filled"] {
  background-color: var(--text-primary);
}

.cell[data-state="marked"] {
  color: var(--error-color);
}

.cell[data-state="marked"]::after {
  content: "×";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 16px;
  font-weight: 500;
  line-height: 0;
}

/* Responsive Hints */
@media (max-width: 480px) {
  .hint-number {
    font-size: 11px;
  }
}

/* Completion Preview (Game Specific) */
.completion-preview {
    margin: 20px auto;
    display: flex;
    justify-content: center;
    background: var(--bg-secondary);
    padding: 10px;
    border-radius: 8px;
}

.stat-box {
    background: var(--bg-secondary);
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    min-width: 80px;
}

.stat-value-lg {
    font-size: 18px;
    color: var(--text-primary);
    display: block;
}

.stats-row {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 20px 0;
}

/* Local Loading Spinner (Scoped to this game) */
.loading {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50; /* Ensure above board but below modals */
  border-radius: var(--border-radius-lg);
}

[data-theme='dark'] .loading {
  background: rgba(0, 0, 0, 0.8);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--bg-secondary);
  border-top: 4px solid var(--game-accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Ensure hidden works definitively */
[hidden] {
    display: none !important;
}

/* Modal Header Fix */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

/* Toggle Button Styles (Softer) */
.action-btn.active {
    background-color: var(--bg-secondary); /* Softer background */
    color: var(--text-primary);
    border-color: var(--text-primary);
    font-weight: 700;
}

.action-btn.secondary {
    background-color: rgba(239, 68, 68, 0.1); /* Softer error color */
    color: var(--error-color);
    border-color: var(--error-color);
    font-weight: 700;
}

[data-theme='dark'] .action-btn.secondary {
    background-color: rgba(239, 68, 68, 0.2);
}
