/* Games Page Specific Styles */
.games-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.game-selector {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

.game-btn {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 0;
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  font-family: inherit;
  position: relative;
  min-width: 120px;
}

.game-thumbnail {
  width: 100%;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
  transition: all 0.3s ease;
  pointer-events: none;
  user-select: none;
}

.game-btn-content {
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  justify-content: center;
  pointer-events: none;
  user-select: none;
}

.game-btn i {
  font-size: 1.2rem;
  color: var(--primary-color);
  transition: color 0.3s ease;
}

.game-btn span {
  font-size: 0.9rem;
}

.game-btn:hover {
  border-color: var(--primary-color);
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(99, 102, 241, 0.2);
}

.game-btn:hover .game-thumbnail {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
  transform: scale(1.1);
}

.game-btn.active {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border-color: var(--primary-color);
  color: white;
}

.game-btn.active .game-thumbnail {
  background: rgba(255, 255, 255, 0.1);
}

.game-btn.active i {
  color: white;
}

.game-area {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem;
  margin: 0 auto;
  max-width: 600px;
}

.game-area.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.game-header h2 {
  font-size: 1.75rem;
  color: var(--text-primary);
}

.score {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.score span {
  color: var(--primary-color);
}

/* Snake Game */
#snake-canvas {
  display: block;
  margin: 0 auto;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-dark);
}

/* Tic-Tac-Toe */
.tic-tac-toe-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 400px;
  margin: 0 auto;
  padding: 1rem;
}

.cell {
  aspect-ratio: 1;
  background: var(--bg-dark);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-primary);
}

.cell:hover {
  border-color: var(--primary-color);
  background: rgba(99, 102, 241, 0.1);
}

.cell.x {
  color: var(--primary-color);
}

.cell.o {
  color: var(--secondary-color);
}

.game-message {
  text-align: center;
  margin-top: 1rem;
  font-size: 1.2rem;
  font-weight: 600;
  min-height: 2rem;
}

.game-message.win {
  color: var(--success);
}

.game-message.draw {
  color: var(--warning);
}

/* Memory Game */
.memory-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-width: 500px;
  margin: 0 auto;
  padding: 1rem;
}

.memory-card {
  aspect-ratio: 1;
  background: var(--bg-dark);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.memory-card::before {
  content: '?';
  position: absolute;
  font-size: 3rem;
  color: var(--text-secondary);
  transition: opacity 0.3s ease;
}

.memory-card.flipped::before,
.memory-card.matched::before {
  opacity: 0;
}

.memory-card.flipped,
.memory-card.matched {
  background: var(--bg-card);
  border-color: var(--primary-color);
  transform: rotateY(180deg);
}

.memory-card.matched {
  border-color: var(--success);
  cursor: default;
}

.memory-card:not(.flipped):not(.matched):hover {
  border-color: var(--primary-color);
  transform: scale(1.05);
}

/* Pong Game */
#pong-canvas {
  display: block;
  margin: 0 auto;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-dark);
}

.game-controls {
  text-align: center;
  margin-top: 1.5rem;
}

.reset-btn {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

.reset-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.instructions {
  margin-top: 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Breakout Game */
#breakout-canvas {
  display: block;
  margin: 0 auto;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-dark);
}

/* Whack-a-Mole Game */
.whack-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  max-width: 400px;
  margin: 0 auto;
  padding: 1rem;
}

.whack-hole {
  aspect-ratio: 1;
  background: var(--bg-dark);
  border: 3px solid var(--border-color);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.whack-hole::before {
  content: '🕳️';
  position: absolute;
  font-size: 2.5rem;
  opacity: 0.5;
}

.whack-hole.active::after {
  content: '🐹';
  position: absolute;
  font-size: 3rem;
  animation: popUp 0.3s ease;
  z-index: 1;
}

.whack-hole.active {
  border-color: var(--primary-color);
  background: rgba(99, 102, 241, 0.1);
  transform: scale(1.1);
}

.whack-hole:not(.active):hover {
  border-color: var(--text-secondary);
}

@keyframes popUp {
  0% {
    transform: translateY(100%);
  }
  50% {
    transform: translateY(-10%);
  }
  100% {
    transform: translateY(0);
  }
}

/* Reaction Time Game */
.reaction-container {
  text-align: center;
  padding: 2rem;
}

.reaction-status {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 2rem;
  min-height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
}

.reaction-button {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border: none;
  border-radius: 12px;
  padding: 2rem 4rem;
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  min-width: 200px;
}

.reaction-button:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.reaction-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Number Guessing Game */
.guess-container {
  text-align: center;
  padding: 2rem;
}

.guess-message {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  min-height: 2rem;
  color: var(--text-primary);
}

.guess-input {
  width: 200px;
  padding: 1rem;
  font-size: 1.25rem;
  text-align: center;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-dark);
  color: var(--text-primary);
  font-family: inherit;
  margin-bottom: 1rem;
}

.guess-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.guess-submit {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border: none;
  border-radius: 8px;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  display: block;
  margin: 0 auto;
}

.guess-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.guess-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .games-container {
    padding: 1rem 0.75rem;
  }

  .game-selector {
    gap: 0.5rem;
    padding: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  .game-btn {
    padding: 0.875rem 1.25rem;
    font-size: 0.875rem;
    min-height: 48px;
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 120px;
  }

  .game-btn span {
    display: none;
  }

  .game-thumbnail {
    font-size: 1.5rem;
  }

  .game-area {
    padding: 1.25rem 0.75rem;
  }

  .game-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
  }

  .game-instructions {
    font-size: 0.9rem;
    padding: 0.75rem;
    margin-bottom: 1rem;
  }

  #snake-canvas,
  #pong-canvas,
  #breakout-canvas {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 400px;
  }

  .tic-tac-toe-board {
    max-width: 100%;
    gap: 8px;
  }

  .tic-tac-toe-cell {
    min-height: 80px;
    font-size: 2rem;
  }

  .memory-board {
    max-width: 100%;
    gap: 8px;
  }

  .memory-card {
    min-height: 100px;
  }

  .whack-board {
    max-width: 100%;
    gap: 8px;
  }

  .whack-hole {
    min-height: 100px;
  }

  .reaction-button {
    padding: 1.25rem 2rem;
    font-size: 1.1rem;
    min-height: 60px;
    width: 100%;
    max-width: 300px;
  }

  .guess-input {
    width: 100%;
    max-width: 200px;
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 0.875rem;
    min-height: 48px;
  }

  .guess-submit {
    width: 100%;
    max-width: 200px;
    padding: 0.875rem 1.5rem;
    min-height: 48px;
  }
}

@media (max-width: 480px) {
  .games-container {
    padding: 0.75rem 0.5rem;
  }

  .game-selector {
    gap: 0.375rem;
    padding: 0.375rem;
  }

  .game-btn {
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    min-width: 100px;
    flex: 1 1 calc(50% - 0.1875rem);
  }

  .game-thumbnail {
    font-size: 1.25rem;
  }

  .game-area {
    padding: 1rem 0.5rem;
  }

  .game-title {
    font-size: 1.25rem;
  }

  .tic-tac-toe-cell {
    min-height: 70px;
    font-size: 1.75rem;
  }

  .memory-card,
  .whack-hole {
    min-height: 80px;
  }

  #snake-canvas,
  #pong-canvas,
  #breakout-canvas {
    max-height: 300px;
  }

  .reaction-button {
    padding: 1rem 1.5rem;
    font-size: 1rem;
  }
}

