/* Games Section Styling - Retropixel Theme */

/* Games Container */
#gamesContainer {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.games-header {
  text-align: center;
  margin-bottom: 40px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 15px;
  padding: 30px;
  box-shadow: var(--retro-shadow);
}

.games-header h1 {
  color: var(--accent-color);
  font-size: 3em;
  margin-bottom: 10px;
  text-shadow: var(--neon-glow);
  font-family: 'Courier New', monospace;
}

.games-header p {
  color: var(--text-secondary);
  font-size: 1.2em;
  margin: 0;
}

/* Games Grid */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  margin-bottom: 40px;
}

.game-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  background: var(--glass-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 2px solid var(--glass-border);
  border-radius: 15px;
  padding: 25px;
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: var(--retro-shadow);
  cursor: pointer;
}

.game-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent-color);
  box-shadow: var(--retro-shadow), var(--neon-glow);
}

.game-icon {
  font-size: 4em;
  margin-bottom: 15px;
  filter: drop-shadow(0 0 10px rgba(0, 255, 255, 0.5));
}

.game-card h3 {
  color: var(--text-primary);
  font-size: 1.5em;
  margin-bottom: 15px;
  font-weight: bold;
}

.game-card p {
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.algorithm-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}

.tag {
  background: rgba(0, 255, 255, 0.2);
  border: 1px solid var(--accent-color);
  color: var(--accent-color);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8em;
  font-weight: bold;
  text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
}

.info-btn {
  background: transparent;
  border: 1px dashed var(--accent-color);
  color: var(--accent-color);
  padding: 6px 20px;
  border-radius: 20px;
  font-size: 0.9em;
  margin-top: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.info-btn:hover {
  background: rgba(0, 255, 255, 0.2);
  box-shadow: 0 0 10px rgba(0,255,255,0.6);
}

.play-btn {
  margin-top: auto;
  background: var(--secondary-bg);
  border: 2px solid var(--accent-color);
  color: var(--text-primary);
  padding: 12px 30px;
  border-radius: 25px;
  font-weight: bold;
  font-size: 1.1em;
  cursor: pointer;
  transition: all 0.3s ease;
  text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.play-btn:hover {
  background: rgba(0, 255, 255, 0.3);
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.6);
  transform: scale(1.05);
}

/* Game Area */
#gameArea {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 15px;
  padding: 20px;
  box-shadow: var(--retro-shadow);
}

.game-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 15px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  border: 1px solid var(--glass-border);
}

#gameTitle {
  color: var(--accent-color);
  font-size: 1.5em;
  font-weight: bold;
  text-shadow: var(--neon-glow);
}

#gameScore {
  color: var(--text-primary);
  font-weight: bold;
}

.hidden {
  display: none !important;
}

/* General select styling */
select {
  background: #ffffff;
  border: 1px solid var(--accent-color);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  transition: all .2s ease;
}

select option {
  background: #ffffff;
  color: var(--text-primary);
}

/* Maze Runner Styles */
.maze-controls {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.maze-controls select {
  background: #ffffff;
  border: 1px solid var(--accent-color);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 5px;
}

#mazeGrid {
  display: grid;
  gap: 1px;
  background: var(--accent-color);
  border: 2px solid var(--accent-color);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 20px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.maze-cell {
  width: 20px;
  height: 20px;
  border-radius: 2px;
  transition: all 0.2s ease;
}

.maze-wall { background: #2c3e50; }
.maze-path { background: rgba(255, 255, 255, 0.1); }
.maze-start { background: #00ff00; box-shadow: 0 0 10px #00ff00; }
.maze-end { background: #ff0080; box-shadow: 0 0 10px #ff0080; }
.maze-visited { background: rgba(0, 255, 255, 0.5); }
.maze-solution { background: #ffff00; box-shadow: 0 0 5px #ffff00; }

#mazeStats {
  display: flex;
  justify-content: center;
  gap: 30px;
  color: var(--text-primary);
  font-weight: bold;
}

/* Sorting Race Styles */
.sorting-controls {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.sorting-controls input[type="range"] {
  margin-left: 10px;
}

#sortingArena {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.sorting-lane {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 15px;
}

.sorting-lane h4 {
  color: var(--accent-color);
  text-align: center;
  margin-bottom: 10px;
  font-weight: bold;
  white-space: nowrap;
}

.bars-container {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  height: 150px;
  gap: 2px;
  margin-bottom: 10px;
  overflow: hidden;
}

.sort-bar {
  background: linear-gradient(to top, var(--accent-color), var(--secondary-bg));
  border-radius: 2px 2px 0 0;
  transition: all 0.3s ease;
  min-width: 4px;
  width: 100%;
}

.sort-bar.comparing {
  background: #ff4444;
  box-shadow: 0 0 10px #ff4444;
}

.sort-bar.sorted {
  background: #00ff00;
  box-shadow: 0 0 5px #00ff00;
}

.progress-indicator {
  text-align: center;
  color: var(--text-primary);
  font-weight: bold;
  padding: 5px;
  border-radius: 5px;
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
}

/* Sorting results */
.sorting-results {
  margin-top: 10px;
  color: var(--text-primary);
  font-family: monospace;
  white-space: pre-line;
}

/* Tower of Hanoi Styles */
.hanoi-controls {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.hanoi-controls select {
  background: #ffffff;
  border: 1px solid var(--accent-color);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 5px;
  margin-left: 10px;
}

#hanoiTowers {
  display: flex;
  justify-content: space-around;
  align-items: end;
  height: 300px;
  margin-bottom: 20px;
  padding: 20px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  border: 1px solid var(--glass-border);
}

.tower {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  width: 200px;
  height: 100%;
}

.tower-base {
  background: var(--accent-color);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: bold;
  font-size: 1.2em;
  text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
  margin-top: auto;
}

.tower::before {
  content: '';
  position: absolute;
  bottom: 50px;
  width: 4px;
  height: 200px;
  background: var(--glass-border);
  border-radius: 2px;
}

.disk {
  position: absolute;
  height: 20px;
  border-radius: 10px;
  margin: 2px 0;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid rgba(255, 255, 255, 0.3);
  position: relative;
  z-index: 10;
}

.disk:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.disk.selected {
  transform: translateY(-10px);
  box-shadow: 0 0 20px var(--accent-color);
}

#hanoiStats {
  display: flex;
  justify-content: center;
  gap: 30px;
  color: var(--text-primary);
  font-weight: bold;
}

/* Memory Game Styles */
.memory-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

#memoryGrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-width: 400px;
  margin: 0 auto;
}

.memory-card {
  position: relative;
  aspect-ratio: 1;
  background: var(--glass-bg);
  border: 2px solid var(--glass-border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
  font-weight: bold;
  color: var(--text-primary);
  position: relative;
  overflow: hidden;
}

.memory-card:hover {
  border-color: var(--accent-color);
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

.memory-card.flipped {
  background: rgba(0, 255, 255, 0.2);
  border-color: var(--accent-color);
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

.memory-card.matched {
  background: rgba(0, 255, 0, 0.2);
  border-color: #00ff00;
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
}

.card-back {
  background: var(--secondary-bg);
  border-radius: 8px;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2em;
}

.card-front {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 10px;
  text-align: center;
}

.memory-card.flipped .card-front {
  opacity: 1;
}

.memory-card.flipped .card-back {
  opacity: 0;
}

.card-title {
  font-size: 0.8em;
  margin-bottom: 5px;
  color: var(--accent-color);
}

.card-description {
  font-size: 0.6em;
  color: var(--text-secondary);
  line-height: 1.2;
}

.chess-board{
  display:grid;
  grid-template-columns:repeat(8,1fr);
  max-width:400px;
  margin:20px auto;
  border:2px solid var(--glass-border);
}
.chess-cell{
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:1.4em;
  width:100%;
  aspect-ratio:1/1;
  position:relative;
  overflow:hidden;
}
.chess-cell.light{background:#f0d9b5;}
.chess-cell.dark{background:#b58863;}
.chess-cell.start::after,
.chess-cell.target::after{
  display:none;
}
.cell-icon{pointer-events:none;}

.chess-cell.path{
  background:radial-gradient(circle, rgba(255,255,0,0.8) 0%, rgba(255,165,0,0.6) 60%);
} 

.tube-container{display:flex;gap:15px;justify-content:center;align-items:flex-end;margin:20px auto;}
.tube{width:60px;height:220px;border:3px solid var(--accent-color);border-radius:10px;display:flex;flex-direction:column-reverse;justify-content:flex-start;align-items:center;padding:4px;cursor:pointer;transition:transform .2s;}
.tube.selected{transform:translateY(-10px);}
.ball-slot{width:50px;height:50px;display:flex;align-items:center;justify-content:center;margin:2px 0;}
.ball{width:42px;height:42px;border-radius:50%;box-shadow:0 0 5px rgba(0,0,0,0.4);}

/* Responsive Design */
@media (max-width: 768px) {
  .games-grid {
    grid-template-columns: 1fr;
  }
  
  .game-controls {
    flex-direction: column;
    gap: 10px;
  }
  
  #sortingArena {
    grid-template-columns: 1fr;
  }
  
  #hanoiTowers {
    flex-direction: column;
    height: auto;
    gap: 20px;
  }
  
  .tower {
    width: 100%;
    height: 100px;
  }
  
  .maze-controls,
  .sorting-controls,
  .hanoi-controls {
    justify-content: center;
  }
}
