/**
 * 스도쿠 전용 스타일 (sudoku.css)
 */

.sudoku-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 520px;
  margin: 0 auto;
}

/* 9×9 스도쿠 보드 */
.sudoku-board {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  background: white;
  border: 3px solid var(--ink);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  overflow: hidden;
  user-select: none;
}

.sudoku-cell {
  position: relative;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: clamp(18px, 4vw, 24px);
  font-weight: 700;
  font-family: var(--font-sans);
  color: var(--blue-dark);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

/* 3×3 서브 블록 굵은 경계선 */
.sudoku-cell:nth-child(3n) {
  border-right: 2px solid var(--ink);
}
.sudoku-cell:nth-child(9n) {
  border-right: none;
}
.sudoku-cell:nth-child(n+19):nth-child(-n+27),
.sudoku-cell:nth-child(n+46):nth-child(-n+54) {
  border-bottom: 2px solid var(--ink);
}
.sudoku-cell:nth-child(n+73) {
  border-bottom: none;
}

/* 초기 기본 제공 숫자 (수정 불가) */
.sudoku-cell.initial {
  color: var(--ink);
  font-weight: 800;
  background-color: #fafbfc;
}

/* 선택 셀 및 하이라이트 */
.sudoku-cell.selected {
  background-color: #dbeafe !important;
}

.sudoku-cell.highlight-peer {
  background-color: #f1f5f9;
}

.sudoku-cell.highlight-same {
  background-color: #e0e7ff;
  color: var(--blue);
}

.sudoku-cell.error {
  background-color: #fee2e2 !important;
  color: var(--rose) !important;
  animation: shakeCell 0.2s ease-in-out;
}

@keyframes shakeCell {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

/* 펜슬 메모 모드 (3×3 미니 그리드) */
.notes-grid {
  position: absolute;
  inset: 2px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  pointer-events: none;
}

.note-num {
  display: grid;
  place-items: center;
  font-size: clamp(8px, 1.6vw, 11px);
  font-weight: 600;
  color: var(--muted);
  line-height: 1;
}

/* 컨트롤 툴바 & 넘패드 */
.sudoku-controls {
  width: 100%;
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.action-bar {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.action-bar .btn-control {
  flex: 1;
  height: 44px;
  font-size: 13px;
}

.action-bar .btn-control.active {
  background: var(--violet);
  color: white;
  border-color: var(--violet);
}

.numpad {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 6px;
}

.btn-num {
  aspect-ratio: 1 / 1.1;
  display: grid;
  place-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: clamp(16px, 3.5vw, 22px);
  font-weight: 800;
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.btn-num:hover {
  background: var(--surface-alt);
  border-color: var(--blue);
  color: var(--blue);
  transform: translateY(-2px);
}

.btn-num:active {
  transform: translateY(0);
}

.btn-num.completed {
  opacity: 0.35;
  pointer-events: none;
}

@media (max-width: 500px) {
  .numpad {
    gap: 4px;
  }
  .btn-num {
    border-radius: 8px;
  }
}
