.tool-ui { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }

.sudoku-container {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
  max-width: 620px;
  width: 100%;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  position: relative;
}

.sudoku-left-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.sudoku-right-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  gap: 0.85rem;
  justify-content: flex-start;
}

.sudoku-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 0.5rem;
}

.sudoku-status {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--snow);
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.sudoku-board-wrapper {
  position: relative;
  width: 280px;
  height: 280px;
}

.sudoku-board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  width: 100%;
  height: 100%;
  border: 3px solid var(--snow);
  background: var(--ink);
}

.sudoku-pause-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 17, 23, 0.88);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--snow);
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  z-index: 10;
  border-radius: 4px;
  gap: 0.5rem;
}

.sudoku-modal-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 17, 23, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  border-radius: 14px;
  padding: 1.5rem;
}

.sudoku-modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  max-width: 300px;
  width: 100%;
  box-shadow: 0 15px 35px rgba(0,0,0,0.4);
  animation: modalScaleIn 0.2s ease-out;
}

@keyframes modalScaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@media (max-width: 640px) {
  .sudoku-container {
    flex-direction: column;
    align-items: center;
    max-width: 360px;
    padding: 1rem;
  }
  .sudoku-board-wrapper { width: 260px; height: 260px; }
  .sudoku-right-pane { width: 100%; }
}

.sudoku-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  color: var(--snow);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, color 0.15s;
}

.sudoku-cell:hover { background: var(--accent-dim); }
.sudoku-cell.selected { background: var(--accent) !important; color: white; }
.sudoku-cell.given { font-weight: 700; color: var(--snow); background: rgba(255,255,255,0.03); }
.sudoku-cell.user-input { color: #4F8EF7; }
.sudoku-cell.error { color: #ef4444; background: rgba(239,68,68,0.15); }
.sudoku-cell.highlight { background: rgba(79, 142, 247, 0.15); }

/* Prominent bold borders for 3x3 subgrid boxes */
.sudoku-cell:nth-child(3n) { border-right: 3px solid var(--snow); }
.sudoku-cell:nth-child(9n) { border-right: 1px solid var(--border); }
.sudoku-cell:nth-child(n+19):nth-child(-n+27),
.sudoku-cell:nth-child(n+46):nth-child(-n+54) { border-bottom: 3px solid var(--snow); }

.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  width: 100%;
}

.numpad-btn {
  background: var(--ink);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0;
  font-size: 1.05rem;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  color: var(--snow);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.numpad-btn:hover { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }
.numpad-btn[data-num="0"] { grid-column: span 3; }

.controls-column {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
}

.controls-row {
  display: flex;
  gap: 0.35rem;
  width: 100%;
  justify-content: space-between;
}

.btn-primary {
  background: var(--accent); color: white;
  border: none; border-radius: 6px;
  padding: 0.5rem 0.6rem; font-size: 0.8rem;
  cursor: pointer; font-family: 'DM Sans', sans-serif; font-weight: 600;
  transition: opacity 0.2s;
  flex: 1;
  text-align: center;
}
.btn-primary:hover { opacity: 0.85; }

.btn-secondary {
  background: var(--ink); color: var(--snow);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 0.5rem 0.6rem; font-size: 0.8rem;
  cursor: pointer; font-family: 'Inter', sans-serif; font-weight: 500;
  transition: background 0.2s;
  flex: 1;
  text-align: center;
}
.btn-secondary:hover { background: var(--border); }

.ad-post-op {
  border: 1px solid var(--border);
  border-radius: 8px; padding: 0.75rem;
  font-size: 0.75rem; color: var(--muted); text-align: center;
  width: 100%;
}
