:root {
  --blue:   #2563eb;
  --blue2:  #1d4ed8;
  --sky:    #0ea5e9;
  --bg:     #f0f6ff;
  --card:   #ffffff;
  --ink:    #0f172a;
  --muted:  #64748b;
  --line:   #dbeafe;
  --red:    #ef4444;
  --green:  #22c55e;
  --amber:  #f59e0b;
  --shadow: 0 8px 28px rgba(37,99,235,.12);
  --radius: 16px;
  --radius2:12px;
}

* { box-sizing: border-box }

body {
  margin-top: 70px;
  font-family: 'Pretendard', ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 450px at 15% -10%, rgba(37,99,235,.13), transparent 60%),
    radial-gradient(700px 350px at 90% 5%, rgba(14,165,233,.09), transparent 55%),
    var(--bg);
}

.wrap { max-width: 100%; padding: 0 0 60px }

/* ── 헤더 ── */
.top { padding: 16px 0 20px }
.brand { display: flex; align-items: center; gap: 16px }
.logo {
  width: 48px; height: 48px; border-radius: 13px;
  background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(37,99,235,.35);
}
.brand h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.03em }
.brand .sub { margin: 4px 0 0; font-size: 13px; color: var(--muted) }

/* ── 컨트롤 패널 ── */
.controls {
  display: flex; gap: 10px; flex-wrap: wrap;
  align-items: center; margin: 0 0 16px;
}
.diff-btn {
  padding: 8px 18px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--card);
  font-size: 13px; font-weight: 700; cursor: pointer; color: var(--muted);
  transition: all .18s;
}
.diff-btn:hover { border-color: var(--blue); color: var(--blue) }
.diff-btn.active { background: var(--blue); border-color: var(--blue); color: #fff }

.new-btn {
  padding: 9px 22px; border-radius: 999px;
  border: none; background: var(--blue); color: #fff;
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: opacity .15s; margin-left: auto;
}
.new-btn:hover { opacity: .85 }

/* ── 상태 바 ── */
.status-bar {
  display: flex; gap: 18px; flex-wrap: wrap; align-items: center;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius2); padding: 10px 16px;
  font-size: 14px; font-weight: 600; margin: 0 0 16px;
}
.status-bar span { color: var(--muted) }
.status-bar .val { color: var(--ink) }
.hint-btn {
  margin-left: auto; padding: 6px 16px;
  border: 1.5px solid var(--amber); border-radius: 8px;
  background: #fefce8; color: #92400e;
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: all .15s;
}
.hint-btn:hover { background: #fef9c3 }
.hint-btn:disabled { opacity: .45; cursor: default }

/* ── 게임 영역 ── */
.game-area {
  display: flex; gap: 20px; flex-wrap: wrap;
  align-items: flex-start;
}

/* ── 스도쿠 보드 ── */
.board-wrap {
  flex: 0 0 auto;
  background: var(--card);
  border: 2px solid #94a3b8;
  border-radius: 14px;
  padding: 8px;
  box-shadow: var(--shadow);
  display: inline-block;
}

.sudoku-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 1px;
  background: #94a3b8;
  border: 2px solid #1e3a8a;
  border-radius: 4px;
  overflow: hidden;
}

.cell {
  width: 46px; height: 46px;
  background: var(--card);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700;
  cursor: pointer;
  position: relative;
  transition: background .12s;
  user-select: none;
  color: var(--ink);
}

/* 3x3 박스 경계 */
.cell:nth-child(3n+1):not(:nth-child(9n+1)) { border-left: 2px solid #1e3a8a }
.cell:nth-child(n+19):nth-child(-n+27)       { border-top: 2px solid #1e3a8a }
.cell:nth-child(n+46):nth-child(-n+54)       { border-top: 2px solid #1e3a8a }

/* 상태별 셀 색상 */
.cell.given     { color: #1e3a8a; background: #f0f6ff }
.cell.selected  { background: #bfdbfe !important }
.cell.highlight { background: #eff6ff }
.cell.error     { color: var(--red); background: #fef2f2 }
.cell.hint-cell { color: var(--green); background: #f0fdf4 }

/* 사용자 입력 숫자 */
.cell.user-input { color: var(--blue) }

/* ── 숫자 패드 ── */
.numpad-area { flex: 1; min-width: 200px }

.numpad {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px; margin: 0 0 12px;
}
.num-btn {
  height: 52px; border-radius: 10px;
  border: 1.5px solid var(--line); background: var(--card);
  font-size: 22px; font-weight: 800; color: var(--blue);
  cursor: pointer; transition: all .15s;
}
.num-btn:hover { background: #eff6ff; border-color: var(--blue) }
.num-btn.used  { opacity: .3 }

.erase-btn {
  width: 100%; height: 44px;
  border: 1.5px solid #fca5a5; border-radius: 10px;
  background: #fef2f2; color: var(--red);
  font-size: 15px; font-weight: 700; cursor: pointer;
  margin-bottom: 8px; transition: all .15s;
}
.erase-btn:hover { background: #fee2e2 }

/* 실수 표시 */
.mistake-row {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted); margin: 8px 0 0;
}
.mistake-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--red);
}
.mistake-dot.inactive { background: #e2e8f0 }

/* 완성 메시지 */
.complete-banner {
  display: none;
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff; border-radius: var(--radius2);
  padding: 16px 20px; text-align: center;
  font-size: 18px; font-weight: 800; margin: 16px 0 0;
  animation: pop .3s ease;
}
.complete-banner.show { display: block }
@keyframes pop {
  from { transform: scale(.9); opacity: 0 }
  to   { transform: scale(1);  opacity: 1 }
}

/* ── 사용 안내 섹션 ── */
.guide-section {
  margin-top: 28px;
  background: rgba(246,248,255,.6);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
.guide-section h2 {
  font-size: 15px; font-weight: 800;
  margin: 0 0 10px; color: var(--ink);
}
.guide-section h2:not(:first-child) { margin-top: 18px }
.guide-steps, .guide-features, .guide-usecase {
  margin: 0; padding-left: 18px;
  color: var(--muted); font-size: 13px; line-height: 1.8;
}
.guide-steps li, .guide-features li, .guide-usecase li { margin-bottom: 4px }
.guide-steps strong, .guide-features strong { color: var(--ink) }
.guide-privacy {
  margin-top: 16px;
  background: #eff6ff; border: 1px solid rgba(37,99,235,.22);
  border-radius: 12px; padding: 12px 14px;
  font-size: 12px; color: #1e40af; line-height: 1.55;
}

/* ── 반응형 ── */
@media (max-width: 540px) {
  .cell { width: 36px; height: 36px; font-size: 16px }
  .num-btn { height: 44px; font-size: 18px }
}
@media (max-width: 400px) {
  .cell { width: 30px; height: 30px; font-size: 13px }
}
