/* Sudoku - Classic Board with Modern UI */
:root {
  --primary-color: #00d4ff;
  --primary-hover: #22d3ee;
  --success-color: #22c55e;
  --warning-color: #eab308;
  --error-color: #ef4444;
  --bg-color: #0f0f1a;
  --card-bg: #1a1a2e;
  --text-color: #ffffff;
  --text-muted: #9ca3af;
  --border-color: #2d2d3d;
  --border-focus: #00d4ff;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  --cell-size: 50px;
  --cell-size-mobile: 40px;
  /* Classic board colors */
  --cell-bg: #ffffff;
  --cell-bg-fixed: #f1f5f9;
  --cell-text: #1f2937;
  --cell-text-fixed: #0f172a;
  --cell-border: #cbd5e1;
  --cell-border-block: #334155;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  background: var(--bg-color);
  background-image: 
    radial-gradient(ellipse at top, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(255, 107, 107, 0.08) 0%, transparent 50%);
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  min-height: 100vh;
  line-height: 1.5;
  justify-content: flex-start;
}

header {
  text-align: center;
  padding: 1.5rem 1rem;
  background: linear-gradient(180deg, var(--card-bg) 0%, transparent 100%);
  width: 100%;
  border-bottom: 2px solid var(--primary-color);
}

header h1 {
  margin: 0 0 0.5rem 0;
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(90deg, var(--primary-color), #ff6b6b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

header a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

header a:hover {
  color: var(--primary-color);
}

.page-wrapper {
  flex: 1;
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  justify-content: center;
}

.ad-sidebar {
  width: 180px;
  padding: 2rem 1rem;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-shrink: 0;
}

.ad-banner-vertical {
  width: 160px;
  min-height: 600px;
  position: sticky;
  top: 2rem;
  background: var(--card-bg);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.05);
}

main {
  flex: 1;
  width: 100%;
  max-width: 600px;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  min-width: 0;
}

.help-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
}

/* Game Stats */
.game-stats {
  display: flex;
  gap: 2rem;
  justify-content: center;
  font-weight: 600;
  color: var(--text-color);
  background: var(--card-bg);
  padding: 0.875rem 1.5rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
}

/* Sudoku Board - Classic White/Gray Style */
#sudoku-board {
  display: grid;
  grid-template-rows: repeat(9, 1fr);
  grid-template-columns: repeat(9, 1fr);
  gap: 0;
  background: var(--cell-bg);
  border: 3px solid #1e293b;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0,0,0,0.1);
  width: fit-content;
  margin: 0 auto;
}

#sudoku-board:focus {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  text-align: center;
  font-size: 1.25rem;
  font-weight: 600;
  border: 1px solid var(--cell-border);
  background: var(--cell-bg);
  color: var(--cell-text);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.cell[contenteditable="true"] {
  outline: none;
  -webkit-user-select: text;
  user-select: text;
}

.cell[contenteditable="true"]:focus {
  outline: none;
  background: #dbeafe;
  box-shadow: inset 0 0 0 2px #3b82f6;
}

.cell[contenteditable="true"]:empty::before {
  content: '';
}

.cell:hover {
  background: #f0f9ff;
}

.cell:focus {
  outline: none;
  background: #dbeafe;
  box-shadow: inset 0 0 0 2px #3b82f6;
}

.cell.fixed {
  background: var(--cell-bg-fixed);
  color: var(--cell-text-fixed);
  font-weight: 700;
  cursor: default;
}

.cell.fixed:hover {
  background: var(--cell-bg-fixed);
}

.cell.hinted {
  background: #fef3c7 !important;
  color: #92400e !important;
  animation: hintPulse 0.6s ease-in-out;
}

.cell.error {
  background: #fee2e2 !important;
  color: #dc2626 !important;
  animation: errorShake 0.5s ease-in-out;
}

.cell.correct {
  background: #dcfce7 !important;
  color: #16a34a !important;
  animation: correctPulse 0.4s ease-in-out;
}

.cell.selected {
  background: #dbeafe;
  box-shadow: inset 0 0 0 2px #3b82f6;
}

/* 3x3 block borders - using classes for clear visual separation */
.cell.block-border-right {
  border-right: 3px solid #1e293b !important;
}

.cell.block-border-bottom {
  border-bottom: 3px solid #1e293b !important;
}

/* Button Bar */
.button-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

button {
  padding: 0.875rem 1.5rem;
  border: none;
  background: linear-gradient(135deg, var(--primary-color), #06b6d4);
  color: #0f0f1a;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  transition: all 0.2s ease;
  min-width: 100px;
  position: relative;
  overflow: hidden;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 212, 255, 0.3);
}

button:active {
  transform: translateY(0);
}

button:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

button:disabled {
  background: var(--text-muted);
  color: white;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Status Message */
.status-message {
  text-align: center;
  font-weight: 600;
  padding: 0;
  border-radius: 10px;
  min-height: 0;
  transition: all 0.3s ease;
  margin: 0;
}

.status-message:empty {
  display: none;
}

.status-message.success {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success-color);
  border: 1px solid rgba(34, 197, 94, 0.3);
  padding: 1rem;
  min-height: 1.5rem;
}

.status-message.error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error-color);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 1rem;
  min-height: 1.5rem;
}

.status-message.info {
  background: rgba(0, 212, 255, 0.15);
  color: var(--primary-color);
  border: 1px solid rgba(0, 212, 255, 0.3);
  padding: 1rem;
  min-height: 1.5rem;
}

/* Hide sidebars on mobile */
@media (max-width: 1200px) {
  .ad-sidebar {
    display: none;
  }
}

/* Animations */
@keyframes hintPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

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

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

@keyframes confetti {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(-100vh) rotate(720deg);
    opacity: 0;
  }
}

/* Party Animation */
.party-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--primary-color);
  animation: confetti 3s linear forwards;
}

.confetti:nth-child(odd) {
  background: var(--success-color);
}

.confetti:nth-child(3n) {
  background: var(--warning-color);
}

.confetti:nth-child(4n) {
  background: #ff6b6b;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  :root {
    --cell-size: var(--cell-size-mobile);
  }
  
  main {
    padding: 0.75rem;
    gap: 1rem;
  }
  
  header {
    padding: 1rem 0.75rem;
  }
  
  header h1 {
    font-size: 1.75rem;
  }
  
  .difficulty-selector {
    padding: 0.75rem;
  }
  
  .difficulty-selector select {
    min-width: 180px;
    font-size: 0.9rem;
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
  }
  
  .game-stats {
    gap: 1rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
  
  .button-bar {
    gap: 0.5rem;
  }
  
  button {
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
    min-width: 80px;
  }
  
  .cell {
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  :root {
    --cell-size: 35px;
  }
  
  .button-bar {
    flex-direction: column;
    align-items: center;
  }
  
  button {
    width: 100%;
    max-width: 200px;
  }
  
  .game-stats {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
}
