/* ===== Games Hub ===== */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-lg);
}

.game-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: var(--shadow-card);
  border: 2px solid var(--color-border-light);
  transition: all var(--transition-normal);
  cursor: pointer;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.game-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-float);
  border-color: var(--color-primary-light);
}

.game-card-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
}

.game-card h3 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-sm);
}

.game-card p {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  margin-bottom: var(--space-md);
}

.game-card .high-score {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 600;
}

.game-card.locked {
  opacity: 0.6;
  cursor: default;
}

.game-card.locked::after {
  content: '🔒';
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  font-size: 1.2rem;
}

/* ===== Game Play Area ===== */
.game-container {
  max-width: 700px;
  margin: 0 auto;
  background: var(--color-bg-card);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: var(--shadow-card);
  min-height: 400px;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 2px solid var(--color-border);
}

.game-score {
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--color-primary);
}

.game-timer {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 700;
  font-size: var(--text-lg);
}

.game-timer.warning {
  color: var(--color-error);
  animation: pulse 1s infinite;
}

.timer-bar {
  width: 120px;
  height: 8px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.timer-bar-fill {
  height: 100%;
  background: var(--color-success);
  border-radius: var(--radius-full);
  transition: width 0.3s linear;
}

.timer-bar-fill.warning {
  background: var(--color-warning);
}

.timer-bar-fill.danger {
  background: var(--color-error);
  animation: pulse 0.5s infinite;
}

/* ===== Quiz ===== */
.quiz-question {
  font-size: var(--text-xl);
  font-weight: 700;
  text-align: center;
  margin-bottom: var(--space-xl);
  line-height: 1.5;
}

.quiz-options {
  display: grid;
  gap: var(--space-sm);
}

.quiz-option {
  padding: var(--space-md) var(--space-lg);
  background: var(--color-bg-alt);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  font-weight: 600;
  text-align: left;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.quiz-option:hover:not(.disabled) {
  border-color: var(--color-primary);
  background: var(--color-primary-lighter);
}

.quiz-option.correct {
  border-color: var(--color-success);
  background: var(--color-success-light);
  color: var(--color-success-dark);
}

.quiz-option.incorrect {
  border-color: var(--color-error);
  background: var(--color-error-light);
  color: var(--color-error-dark);
}

.quiz-option.disabled {
  cursor: default;
  opacity: 0.7;
}

.quiz-option .option-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--color-bg-card);
  font-weight: 700;
  margin-right: var(--space-sm);
}

.quiz-explain {
  margin-top: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  background: var(--color-bg-alt);
  font-size: var(--text-sm);
  animation: fadeIn 0.3s ease;
}

.quiz-explain strong {
  color: var(--color-primary);
}

/* ===== Code Challenge ===== */
.challenge-code {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 2;
  margin-bottom: var(--space-lg);
  overflow-x: auto;
}

.challenge-blank {
  display: inline-block;
  min-width: 80px;
  border-bottom: 3px solid var(--color-warning);
  background: rgba(251, 191, 36, 0.15);
  padding: 0 var(--space-sm);
  color: var(--color-warning);
  font-weight: 700;
}

.challenge-input-area {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.challenge-input {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.challenge-input:focus {
  border-color: var(--color-primary);
  outline: none;
}

.challenge-hint {
  padding: var(--space-md);
  background: #FEF3C7;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  margin-top: var(--space-md);
  animation: fadeIn 0.3s ease;
}

.challenge-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}

/* ===== Matching Game ===== */
.match-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.match-card {
  padding: var(--space-md);
  background: var(--color-bg-alt);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  text-align: center;
  font-weight: 600;
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.match-card:hover:not(.matched):not(.selected) {
  border-color: var(--color-primary-light);
  background: var(--color-primary-lighter);
}

.match-card.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-lighter);
  box-shadow: 0 0 0 2px var(--color-primary);
}

.match-card.matched {
  border-color: var(--color-success);
  background: var(--color-success-light);
  cursor: default;
  opacity: 0.8;
}

.match-card.wrong {
  border-color: var(--color-error);
  background: var(--color-error-light);
  animation: shake 0.4s ease;
}

.match-card.term {
  border-left: 4px solid var(--color-accent);
}

.match-card.definition {
  border-left: 4px solid var(--color-secondary);
}

/* ===== Game Results ===== */
.game-results {
  text-align: center;
  padding: var(--space-2xl);
}

.game-results .score-big {
  font-size: 3rem;
  font-weight: 800;
  background: var(--gradient-pink);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.game-results .result-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-xl);
  margin: var(--space-xl) 0;
}

.game-results .result-stat {
  text-align: center;
}

.game-results .result-stat .value {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-text);
}

.game-results .result-stat .label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 600;
}

/* ===== Game Difficulty Selector ===== */
.difficulty-select {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  margin-bottom: var(--space-xl);
}

.difficulty-btn {
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-full);
  border: 2px solid var(--color-border);
  font-weight: 700;
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.difficulty-btn:hover {
  border-color: var(--color-primary);
}

.difficulty-btn.selected {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: white;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .games-grid {
    grid-template-columns: 1fr;
  }

  .game-container {
    padding: var(--space-md);
  }

  .match-grid {
    grid-template-columns: 1fr;
  }

  .challenge-options-grid {
    grid-template-columns: 1fr;
  }

  .game-results .result-stats {
    flex-direction: column;
    gap: var(--space-md);
  }
}
