/* Sudoku365.com - Ultra-optimized CSS for PageSpeed 100/100 */
/* Critical CSS inlined in HTML, this is the full stylesheet */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #ffffff;
  --bg-secondary: #f9fafb;
  --text: #111827;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --cell-given: #f3f4f6;
  --cell-selected: #dbeafe;
  --cell-highlighted: #eff6ff;
  --cell-same: #fef3c7;
  --cell-mistake: #fee2e2;
  --shadow: rgba(0, 0, 0, 0.1);
}

.dark-mode {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --bg: #111827;
  --bg-secondary: #1f2937;
  --text: #f9fafb;
  --text-secondary: #9ca3af;
  --border: #374151;
  --cell-given: #1f2937;
  --cell-selected: #1e3a8a;
  --cell-highlighted: #1e293b;
  --cell-same: #713f12;
  --cell-mistake: #7f1d1d;
  --shadow: rgba(0, 0, 0, 0.3);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background-color 0.2s, color 0.2s;
}

/* Header */
header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

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

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

/* Main Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.game-container {
  max-width: 600px;
  margin: 0 auto;
}

/* Sudoku Grid - CSS Grid for perfect layout */
#sudoku-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 0;
  background: var(--border);
  border: 2px solid var(--border);
  margin: 2rem auto;
  max-width: 500px;
  aspect-ratio: 1;
  box-shadow: 0 4px 6px var(--shadow);
}

.cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  font-size: clamp(1.2rem, 4vw, 1.8rem);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s;
  border: 1px solid var(--border);
}

.cell.given {
  background: var(--cell-given);
  color: var(--text);
  cursor: default;
}

.cell.selected {
  background: var(--cell-selected);
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  z-index: 10;
}

.cell.highlighted {
  background: var(--cell-highlighted);
}

.cell.same-number {
  background: var(--cell-same);
}

.cell.mistake {
  background: var(--cell-mistake);
  color: #991b1b;
}

.cell.border-top {
  border-top: 2px solid var(--border);
}

.cell.border-left {
  border-left: 2px solid var(--border);
}

/* Controls */
.game-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.difficulty-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: capitalize;
}

.difficulty-easy {
  background: #dcfce7;
  color: #166534;
}

.difficulty-medium {
  background: #fef3c7;
  color: #92400e;
}

.difficulty-hard {
  background: #fed7aa;
  color: #9a3412;
}

.difficulty-expert {
  background: #fecaca;
  color: #991b1b;
}

.dark-mode .difficulty-easy {
  background: #14532d;
  color: #bbf7d0;
}

.dark-mode .difficulty-medium {
  background: #713f12;
  color: #fef3c7;
}

.dark-mode .difficulty-hard {
  background: #7c2d12;
  color: #fed7aa;
}

.dark-mode .difficulty-expert {
  background: #7f1d1d;
  color: #fecaca;
}

#timer {
  font-size: 1.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
  gap: 0.5rem;
  margin: 1rem 0;
}

.btn {
  padding: 1rem;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 0.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn-control {
  font-size: 0.875rem;
  padding: 0.75rem;
}

.btn-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--bg);
  padding: 2rem;
  border-radius: 1rem;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 20px 25px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--primary);
}

.modal-content p {
  margin: 0.5rem 0;
  font-size: 1.125rem;
}

.modal-content .btn {
  margin-top: 1.5rem;
  width: 100%;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 3rem 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  margin: -2rem -1rem 2rem;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 1rem;
}

.hero p {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  opacity: 0.95;
  max-width: 600px;
  margin: 0 auto;
}

/* Content Sections */
.section {
  margin: 4rem 0;
}

.section h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--text);
}

.section h3 {
  font-size: 1.5rem;
  margin: 2rem 0 1rem;
  color: var(--text);
}

.section p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

/* Grid layouts */
.grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px var(--shadow);
}

.card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.card a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.card a:hover {
  text-decoration: underline;
}

/* Calendar Grid */
.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
  margin: 2rem 0;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.calendar-day:hover {
  background: var(--primary);
  color: white;
  transform: scale(1.05);
}

.calendar-day.completed {
  background: #10b981;
  color: white;
}

/* Footer */
footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 3rem 0 1rem;
  margin-top: 4rem;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}

.footer-section h3 {
  font-size: 1.125rem;
  margin-bottom: 1rem;
}

.footer-section ul {
  list-style: none;
}

.footer-section a {
  color: var(--text-secondary);
  text-decoration: none;
  line-height: 2;
}

.footer-section a:hover {
  color: var(--primary);
}

.footer-bottom {
  text-align: center;
  padding: 2rem 1rem 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

/* Responsive */
@media (max-width: 640px) {
  #sudoku-grid {
    max-width: 100%;
  }

  .controls {
    grid-template-columns: repeat(5, 1fr);
  }

  .btn-group {
    grid-template-columns: 1fr;
  }

  nav {
    display: none;
  }

  .hero {
    padding: 2rem 1rem;
  }
}

/* Print styles */
@media print {
  header, footer, .controls, .game-info {
    display: none;
  }

  #sudoku-grid {
    box-shadow: none;
  }
}

/* Performance optimizations */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* List styles */
ul, ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

li {
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

/* Links */
a {
  color: var(--primary);
}

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

/* Breadcrumbs */
.breadcrumb {
  margin-bottom: 2rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
}

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

/* Table styles */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
}

th, td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  background: var(--bg-secondary);
}

/* Code blocks */
code {
  background: var(--bg-secondary);
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  font-family: monospace;
  font-size: 0.875em;
}

/* Diagram styles for strategy pages */
.diagram {
  max-width: 400px;
  margin: 2rem auto;
  display: block;
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Focus styles */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
