:root {
  --primary: #00ADB5;
  --primary-hover: #008C9E;
  --secondary: #393E46;
  --bg-color: #121212;
  --surface: #222831;
  --text-main: #EEEEEE;
  --text-muted: #B3B3B3;
  --error: #FF4C4C;
  --success: #00D37F;
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.3s;
}

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

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

header {
  background-color: var(--surface);
  padding: 20px 0;
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.logo-icon {
  flex-shrink: 0;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 20px;
}

nav a {
  color: var(--text-main);
  font-weight: 600;
}

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

main {
  flex: 1;
  padding: 40px 0;
}

h1 {
  font-size: 2rem;
  margin-bottom: 20px;
  text-align: center;
}

h2 {
  font-size: 1.5rem;
  margin-bottom: 15px;
  color: var(--primary);
}

/* Home grid */
.category-section {
  margin-bottom: 60px;
}

.games-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 20px;
}

@media (min-width: 768px) {
  .games-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

.game-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 20px;
  transition: transform 0.3s, box-shadow 0.3s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid rgba(255,255,255,0.05);
}

.game-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.5);
  border-color: var(--primary);
}

.game-card h3 {
  font-size: 1.25rem;
  margin-bottom: 10px;
}

.game-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.btn {
  display: inline-block;
  background-color: var(--primary);
  color: #fff;
  padding: 10px 20px;
  border-radius: 6px;
  text-align: center;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.3s;
}

.btn:hover {
  background-color: var(--primary-hover);
  color: #fff;
}

.btn-secondary {
  background-color: var(--secondary);
  color: var(--text-main);
}
.btn-secondary:hover {
  background-color: #4B525C;
}

/* Game Interface */
.game-container {
  max-width: 800px;
  margin: 0 auto;
  background: var(--surface);
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.game-header {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 30px;
  text-align: center;
}

@media (min-width: 768px) {
  .game-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    text-align: left;
  }
}

.difficulty-selector {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.difficulty-btn {
  background: var(--bg-color);
  border: 1px solid var(--secondary);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
}

.difficulty-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.print-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--success);
}
.print-btn:hover {
  background: #00b36b;
}

/* Grids and Boards */
.board-wrapper {
  display: flex;
  justify-content: center;
  margin: 30px 0;
  overflow-x: auto;
}

/* Generic input */
.input-field {
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--secondary);
  background: var(--bg-color);
  color: var(--text-main);
  font-size: 1rem;
}

footer {
  text-align: center;
  padding: 20px;
  background-color: var(--surface);
  margin-top: auto;
  color: var(--text-muted);
}

/* Utilities */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }

/* 
 * 🖨️ PRINT STYLES
 * Essential for games to be printable accurately.
 */
@media print {
  @page {
    margin: 1cm;
  }
  
  body {
    background-color: #fff !important;
    color: #000 !important;
  }
  
  header, footer, .difficulty-selector, .print-btn, .no-print {
    display: none !important;
  }
  
  main {
    padding: 0 !important;
  }
  
  .game-container {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    background: transparent !important;
    max-width: 100% !important;
  }
  
  h1 {
    color: #000 !important;
    font-size: 24pt;
    margin-bottom: 20px;
  }

  /* Force borders and backgrounds for accurate grids in PDF/Print */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  /* Make sure canvas (maze) is perfectly visible */
  canvas {
    max-width: 100%;
    page-break-inside: avoid;
  }
}