/* =================================================================
   VEBEYX PLAY — Games page (catalog + playable demos)
   ================================================================= */

.games-catalog {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
  margin-top: 60px;
}
@media (max-width: 768px) { .games-catalog { grid-template-columns: 1fr; } }

.game-detail {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.4s var(--ease-out);
}
.game-detail:hover {
  border-color: var(--border-strong);
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
}
.game-detail-visual {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--card-from, #7B6FF0) 0%, var(--card-to, #22D3EE) 100%);
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.game-detail-visual::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.2) 1px, transparent 1px);
  background-size: 30px 30px;
  opacity: 0.5;
}
.game-detail-visual::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 30%, rgba(0, 0, 0, 0.4));
}
.game-detail-visual-icon {
  font-size: 80px;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.4));
}
.game-detail-visual-tag {
  position: absolute;
  top: 20px;
  left: 20px;
  padding: 6px 14px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: white;
  z-index: 2;
}
.game-detail-body {
  padding: 32px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.game-detail-body h3 { font-size: 1.625rem; margin-bottom: 12px; }
.game-detail-body > p { margin-bottom: 20px; }
.game-detail-features {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.game-feature-tag {
  padding: 4px 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.game-detail-actions {
  display: flex;
  gap: 12px;
  margin-top: auto;
  flex-wrap: wrap;
}

/* ---------- Game Play Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.3s var(--ease-out), visibility 0.3s var(--ease-out);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.modal-game {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.3s var(--ease-out);
  position: relative;
}
.modal-overlay.open .modal-game { transform: scale(1); }

.modal-game-header {
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.modal-game-title {
  display: flex;
  align-items: center;
  gap: 12px;
}
.modal-game-title .icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 18px;
}
.modal-game-title h3 {
  font-family: 'Unbounded', sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
}
.modal-game-title span {
  font-size: 0.75rem;
  color: var(--text-dim);
}
.modal-close {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 18px;
  transition: all 0.2s var(--ease-out);
}
.modal-close:hover { background: var(--bg-glass-strong); color: var(--text); }

.modal-game-body {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
}

/* ---------- Playable Quiz Game ---------- */
.game-arena {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 400px;
}
.game-stage {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.game-stage::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--cyan), transparent);
  background-size: 200% 100%;
  animation: shimmer 3s linear infinite;
}

.game-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  font-size: 0.8125rem;
  color: var(--text-dim);
}
.game-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-glass);
  border-radius: 100px;
  margin: 0 12px;
  overflow: hidden;
}
.game-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  border-radius: 100px;
  transition: width 0.4s var(--ease-out);
}

.game-question {
  font-family: 'Unbounded', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 32px;
  letter-spacing: -0.02em;
}

.game-timer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 24px;
  font-variant-numeric: tabular-nums;
}
.game-timer.warn { color: #FBBF24; border-color: rgba(251, 191, 36, 0.4); }
.game-timer.danger { color: #F87171; border-color: rgba(248, 113, 113, 0.4); animation: pulse 0.5s ease-in-out infinite; }

.game-answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 520px;
  margin: 0 auto;
}
@media (max-width: 540px) { .game-answers { grid-template-columns: 1fr; } }

.game-answer-btn {
  padding: 16px 20px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 500;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s var(--ease-out);
  cursor: pointer;
}
.game-answer-btn:hover {
  background: var(--bg-glass-strong);
  border-color: var(--accent);
  transform: translateY(-2px);
}
.game-answer-btn .letter {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--bg);
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.8125rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.game-answer-btn:hover .letter { background: var(--accent); color: white; }
.game-answer-btn.correct {
  background: rgba(34, 211, 238, 0.12);
  border-color: var(--cyan);
}
.game-answer-btn.correct .letter { background: var(--cyan); color: var(--bg); }
.game-answer-btn.wrong {
  background: rgba(248, 113, 113, 0.12);
  border-color: #F87171;
}
.game-answer-btn.wrong .letter { background: #F87171; color: var(--bg); }
.game-answer-btn:disabled { cursor: not-allowed; transform: none; }

/* Game intro screen */
.game-intro {
  text-align: center;
  padding: 32px 0;
}
.game-intro .big-emoji {
  font-size: 64px;
  margin-bottom: 24px;
  display: block;
  animation: float 3s ease-in-out infinite;
}
.game-intro h4 {
  font-family: 'Unbounded', sans-serif;
  font-size: 1.5rem;
  margin-bottom: 12px;
  font-weight: 700;
}
.game-intro p { margin-bottom: 24px; max-width: 480px; margin-left: auto; margin-right: auto; }
.game-intro-meta {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-bottom: 32px;
  font-size: 0.875rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.game-intro-meta strong { color: var(--text); display: block; font-family: 'Unbounded', sans-serif; font-size: 1.125rem; margin-bottom: 4px; }

/* Game over / score */
.game-over {
  text-align: center;
  padding: 32px 0;
}
.game-over .big-emoji {
  font-size: 64px;
  margin-bottom: 16px;
  display: block;
}
.game-over h4 {
  font-family: 'Unbounded', sans-serif;
  font-size: 2rem;
  margin-bottom: 8px;
  font-weight: 800;
}
.game-over .final-score {
  font-family: 'Unbounded', sans-serif;
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  margin: 16px 0;
}
.game-over p { margin-bottom: 24px; }
.game-over-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- Memory Game ---------- */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-width: 480px;
  margin: 0 auto;
}
@media (max-width: 540px) { .memory-grid { grid-template-columns: repeat(3, 1fr); } }

.memory-card {
  aspect-ratio: 1;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-size: 32px;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  position: relative;
  perspective: 600px;
}
.memory-card:hover:not(.flipped):not(.matched) {
  border-color: var(--accent);
  transform: scale(1.05);
}
.memory-card .front, .memory-card .back {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  backface-visibility: hidden;
  transition: transform 0.5s var(--ease-out);
}
.memory-card .back {
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  color: white;
  font-size: 18px;
  font-weight: 700;
}
.memory-card .front {
  background: var(--bg);
  transform: rotateY(180deg);
  font-size: 32px;
}
.memory-card.flipped .back { transform: rotateY(180deg); }
.memory-card.flipped .front { transform: rotateY(0); }
.memory-card.matched {
  border-color: var(--cyan);
  background: rgba(34, 211, 238, 0.1);
}
.memory-card.matched .front { background: rgba(34, 211, 238, 0.15); }
.memory-card.matched::after {
  content: '✓';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  background: var(--cyan);
  color: var(--bg);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
}

/* ---------- Blind Test Game ---------- */
.blind-cover {
  width: 200px;
  height: 200px;
  margin: 0 auto 32px;
  background: linear-gradient(135deg, var(--accent), var(--magenta));
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  animation: spin 8s linear infinite;
  box-shadow: 0 0 60px rgba(123, 111, 240, 0.4);
}
.blind-cover::after {
  content: '';
  width: 60px;
  height: 60px;
  background: var(--bg);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.blind-cover::before {
  content: '🎵';
  position: absolute;
  z-index: 1;
  font-size: 36px;
}

/* ---------- Game stats ---------- */
.game-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.game-stat {
  text-align: center;
  padding: 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.game-stat strong {
  display: block;
  font-family: 'Unbounded', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.game-stat span {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
