:root {
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --accent-color: #6366f1;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --error-color: #ef4444;
  --success-color: #10b981;
  --highlight-bg: rgba(94, 77, 43, 0.3);
  /* Tono pizarra discreto */
  --selected-bg: rgba(99, 102, 241, 0.15);
  /* Suave para la selección */
  --selected-border: #6366f1;
}

body {
  font-family: 'Outfit', sans-serif;
  background: radial-gradient(circle at top left, #1e1b4b, #0f172a, #020617);
  background-attachment: fixed;
  color: #f8fafc;
  user-select: none;
  /* Evitar selección de texto accidental */
}

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 2rem;
}

.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sudoku-wrapper {
  width: 100%;
  padding: 0;
  display: flex;
  justify-content: center;
}

.sudoku-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  width: 100%;
  max-width: 450px; /* Tamaño máximo razonable */
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  border: 3px solid var(--accent-color);
  border-radius: 8px;
  background-color: var(--accent-color);
  gap: 1px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

.sudoku-cell {
  background-color: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.1s ease;
  position: relative;
}

/* Grillas de 3x3 */
.sudoku-cell:nth-child(3n) {
  border-right: 2px solid var(--accent-color);
}

.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(--accent-color);
}

/* Estados de Celda */
.sudoku-cell.fixed {
  background-color: #0f172a;
  color: #818cf8; /* Color azulado para celdas originales */
  cursor: default;
  font-weight: 700;
}

.sudoku-cell.solved {
  color: #10b981; /* Verde esmeralda para números revelados/resueltos */
  font-weight: 600;
}

.sudoku-cell.highlight {
  background-color: var(--highlight-bg);
}

.sudoku-cell.selected {
  background-color: var(--selected-bg) !important;
  box-shadow: inset 0 0 0 3px var(--selected-border);
  /* Borde interno más marcado */
  color: #fff;
  z-index: 2;
  /* Para que el borde se vea sobre otros */
}

.sudoku-cell:not(.fixed):hover {
  background-color: #334155;
}

/* Numpad */
.numpad {
  gap: 6px !important;
}

.num-btn {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.1rem;
}

.num-btn i {
  font-size: 1rem;
}

.action-btn {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-btn:hover {
  transform: translateY(-2px);
}

#message {
  min-height: 2em;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

.success {
  color: var(--success-color);
}

.error {
  color: var(--error-color);
}

.hover-underline:hover {
  text-decoration: underline !important;
  opacity: 1;
}

@media (max-width: 576px) {
  .container {
    padding-left: 8px;
    padding-right: 8px;
  }
  
  .glass-card {
    padding: 1rem 0.5rem !important; /* Menos padding interno */
    border-radius: 1.5rem;
  }

  .display-4 {
    font-size: 2.2rem;
  }

  .sudoku-cell {
    font-size: 1.25rem;
  }

  .num-btn {
    width: 36px;
    height: 36px;
    font-size: 1rem;
    padding: 0;
  }

  /* Ajuste botones de acción */
  .action-btn {
    font-size: 0.9rem;
    padding: 0.5rem 1rem !important;
  }
}