:root {
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #818cf8;
  --success-color: #10b981;
  --success-hover: #059669;
  --danger-color: #ef4444;
  --bg-gradient-start: #f0f9ff;
  --bg-gradient-end: #e0f2fe;
  --card-bg: #ffffff;
  --border-color: #e5e7eb;
  --border-bold: #6b7280;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --fixed-cell-bg: #f3f4f6;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1px;
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  min-height: 100vh;
  margin: 0;
  margin-top: 10px;
}

.header {
  display: none;
  text-align: center;
  margin-bottom: 24px;
  animation: fadeIn 0.5s ease-in;
}

.subheader {
  text-align: center;
  margin-bottom: 12px;
}

h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.controls {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.date-picker-container {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}

.date-picker-container label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.date-input {
  padding: 8px 12px;
  border-radius: 8px;
  border: 2px solid var(--border-color);
  outline: none;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: white;
}

.date-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

select,
button {
  padding: 12px 20px;
  border-radius: 10px;
  border: 2px solid transparent;
  outline: none;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

select {
  background-color: var(--card-bg);
  color: var(--text-primary);
  border-color: var(--border-color);
  cursor: pointer;
}

select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

select:hover {
  border-color: var(--primary-light);
}

button {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  color: white;
  cursor: pointer;
  border: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: var(--shadow-md);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}
/* Responsive grid: use fractional columns so the board shrinks on small screens.
   Keep a max-width that matches the original 9x40px size so it doesn't grow too large. */
.grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 1px;
  margin-bottom: 10px;
  width: 100%;
  max-width: 400px;
  background-color: var(--card-bg);
  padding: 16px;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.4s ease-out;
}

.grid input {
  width: 100%;
  aspect-ratio: 1 / 1;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
  padding: 0;
  background-color: white;
  color: var(--text-primary);
}

.grid input:focus {
  outline: 3px solid var(--primary-color);
  outline-offset: -3px;
  z-index: 10;
  position: relative;
  transform: scale(1.05);
}

.grid input.fixed {
  background: linear-gradient(135deg, #f9fafb 0%, var(--fixed-cell-bg) 100%);
  color: var(--text-secondary);
  font-weight: 700;
}

.grid input.editable:not([value=""]):not(.fixed) {
  color: var(--primary-color);
}

.grid input.top-border {
  border-top: 3px solid var(--border-bold);
}

.grid input.left-border {
  border-left: 3px solid var(--border-bold);
}

.grid input.right-border {
  border-right: 3px solid var(--border-bold);
}

.grid input.bottom-border {
  border-bottom: 3px solid var(--border-bold);
}
.message {
  margin-top: 0px;
  font-size: 1.0rem;
  font-weight: 600;
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 10px;
  background-color: var(--card-bg);
  box-shadow: var(--shadow-md);
  animation: fadeIn 0.3s ease-in;
  text-align: center;
  max-width: 400px;
}

.check-solution-button {
  background: linear-gradient(135deg, var(--success-color) 0%, var(--success-hover) 100%);
}

.check-solution-button:hover {
  background: linear-gradient(135deg, var(--success-hover) 0%, #047857 100%);
}

.get-hint {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.get-hint:hover {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.incorrect-highlight {
  background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%) !important;
  animation: shake 0.5s ease-in-out;
}

.hint-highlight {
  background: linear-gradient(135deg, #a7f3d0 0%, #6ee7b7 100%) !important;
  animation: pulse 0.5s ease-in-out;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Radial selector (mobile) */
.radial-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(2px);
  display: none;
  z-index: 1000;
  animation: fadeIn 0.2s ease-in;
}

.radial {
  position: fixed;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  /* Make the radial container transparent so only the number buttons are visible */
  background: transparent;
  display: none;
  align-items: center;
  justify-content: center;
  /* Remove container shadow so only buttons are visually prominent */
  box-shadow: none;
  z-index: 1001;
  transform-origin: center center;
  transition: transform 150ms ease, opacity 150ms ease;
  /* No padding so buttons sit precisely where positioned */
  padding: 0;
}

.radial.visible {
  display: flex;
  opacity: 1;
  transform: scale(1);
}

.radial.hidden {
  opacity: 0;
  transform: scale(0.75);
  display: none;
}

.radial-button {
  position: absolute;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--primary-light);
  background: linear-gradient(135deg, white 0%, #f9fafb 100%);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary-color);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: all 100ms ease;
  box-shadow: var(--shadow-md);
}

.radial-button:active {
  transform: scale(0.9);
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
  color: white;
  border-color: var(--primary-hover);
}

/* Slightly smaller radial on very small screens */
@media (max-width: 360px) {
  .radial { width: 180px; height: 180px; }
  .radial-button { width: 40px; height: 40px; font-size: 1rem; }
}

/* Responsive adjustments */
@media (max-width: 480px) {
  h1 {
    font-size: 2rem;
  }
  
  .grid {
    max-width: 340px;
    padding: 12px;
  }
  
  button, select {
    padding: 10px 16px;
    font-size: 0.9rem;
  }
}