/* ==========================================================================
   ThinkyPlay game pages stylesheet
   File: css/game.css
   Purpose: Styles for the main Games page and later individual game pages.
   ========================================================================== */

/* ==========================================================================
   Games page hero
   ========================================================================== */

.gp-hero {
  position: relative;
  overflow: hidden;
  padding: 3rem 0 1.75rem;
}

.gp-hero::before {
  content: "";
  position: absolute;
  top: -220px;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 520px;
  background:
    radial-gradient(
      circle,
      rgba(139, 92, 246, 0.14),
      transparent 68%
    );
  pointer-events: none;
}

.gp-hero-banner {
  position: relative;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2.5rem;
  align-items: center;
  padding: 3rem;
  border-radius: 28px;
  background:
    linear-gradient(
      135deg,
      rgba(139, 92, 246, 0.12),
      rgba(6, 182, 212, 0.08)
    ),
    var(--bg-card);
  border: 1px solid var(--border-soft);
  overflow: hidden;
}

.gp-hero-banner::before {
  content: "";
  position: absolute;
  top: -120px;
  right: -80px;
  width: 320px;
  height: 320px;
  background:
    radial-gradient(
      circle,
      rgba(6, 182, 212, 0.18),
      transparent 70%
    );
  pointer-events: none;
}

.gp-hero-banner::after {
  content: "";
  position: absolute;
  bottom: -140px;
  left: -80px;
  width: 300px;
  height: 300px;
  background:
    radial-gradient(
      circle,
      rgba(139, 92, 246, 0.16),
      transparent 70%
    );
  pointer-events: none;
}

.gp-hero-copy {
  position: relative;
  z-index: 1;
  max-width: 660px;
}

.gp-hero-copy .breadcrumbs {
  margin-bottom: 1.25rem;
}

.gp-hero-copy h1 {
  margin-bottom: 0.75rem;
}

.gp-hero-copy p {
  color: var(--text-muted);
  margin-bottom: 0;
}

.gp-hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.5rem;
}

.gp-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
}

/* Hero side icons */
.gp-hero-side {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.gp-hero-tile {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--text-muted);
  transition:
    transform 0.25s ease,
    border-color 0.25s ease;
}

.gp-hero-tile:hover {
  transform: translateY(-3px);
}

.gp-hero-tile svg {
  width: 22px;
  height: 22px;
}

.gp-hero-tile--purple {
  background: rgba(139, 92, 246, 0.14);
  border-color: rgba(139, 92, 246, 0.32);
  color: #A78BFA;
}

.gp-hero-tile--green {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.32);
  color: #34D399;
}

.gp-hero-tile--yellow {
  background: rgba(251, 191, 36, 0.14);
  border-color: rgba(251, 191, 36, 0.32);
  color: #FBBF24;
}

.gp-hero-tile--pink {
  background: rgba(236, 72, 153, 0.14);
  border-color: rgba(236, 72, 153, 0.32);
  color: #F472B6;
}

.gp-hero-tile--cyan {
  background: rgba(6, 182, 212, 0.14);
  border-color: rgba(6, 182, 212, 0.32);
  color: #22D3EE;
}

.gp-hero-tile--star {
  background: rgba(251, 191, 36, 0.16);
  border-color: rgba(251, 191, 36, 0.35);
  color: #FDE68A;
}

/* Reduce gap after hero */
.gp-hero + .gp-section {
  padding-top: 2.75rem;
}

@media (max-width: 900px) {
  .gp-hero {
    padding: 2rem 0 1.25rem;
  }

  .gp-hero-banner {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1.75rem;
  }

  .gp-hero-side {
    display: none;
  }

  .gp-hero + .gp-section {
    padding-top: 2.25rem;
  }
}

@media (max-width: 560px) {
  .gp-hero {
    padding: 1.5rem 0 1rem;
  }

  .gp-hero-banner {
    padding: 1.35rem;
    border-radius: 20px;
  }

  .gp-hero-pills {
    margin-top: 1.1rem;
  }

  .gp-hero + .gp-section {
    padding-top: 1.75rem;
  }

  .gp-section-head {
    margin-bottom: 1.75rem;
  }
}

/* ==========================================================================
   Games page sections
   ========================================================================== */

.gp-section {
  padding-block: 4rem;
}

.gp-section-alt {
  background:
    linear-gradient(
      180deg,
      rgba(21, 26, 37, 0.45),
      rgba(21, 26, 37, 0.22)
    );
}

.gp-section-head {
  max-width: 760px;
  margin-bottom: 2.5rem;
}

.gp-section-head.center {
  margin-inline: auto;
  text-align: center;
}

.gp-section-head p {
  color: var(--text-muted);
}

/* ==========================================================================
   Game panels
   ========================================================================== */

.gp-panel-list {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}

.gp-panel {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 2rem;
  align-items: center;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  transition:
    transform 0.28s ease,
    border-color 0.28s ease,
    box-shadow 0.28s ease;
}

.gp-panel:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.gp-panel-list .gp-panel:nth-child(even) {
  grid-template-columns: 1fr 380px;
}

.gp-panel-list .gp-panel:nth-child(even) .gp-panel-media {
  order: 2;
}

.gp-panel-list .gp-panel:nth-child(even) .gp-panel-content {
  order: 1;
}

.gp-panel-memory:hover {
  border-color: rgba(139, 92, 246, 0.55);
  box-shadow: 0 16px 38px rgba(139, 92, 246, 0.18);
}

.gp-panel-math:hover {
  border-color: rgba(16, 185, 129, 0.55);
  box-shadow: 0 16px 38px rgba(16, 185, 129, 0.16);
}

.gp-panel-word:hover {
  border-color: rgba(251, 191, 36, 0.5);
  box-shadow: 0 16px 38px rgba(251, 191, 36, 0.14);
}

.gp-panel-typing:hover {
  border-color: rgba(236, 72, 153, 0.5);
  box-shadow: 0 16px 38px rgba(236, 72, 153, 0.16);
}

.gp-panel-maze:hover {
  border-color: rgba(6, 182, 212, 0.5);
  box-shadow: 0 16px 38px rgba(6, 182, 212, 0.16);
}

.gp-panel-media {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
}

.gp-panel-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.gp-panel:hover .gp-panel-media img {
  transform: scale(1.04);
}

.gp-panel-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
}

.gp-panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
}

.gp-panel-title {
  margin: 0;
  font-size: 1.5rem;
}

.gp-panel-desc {
  margin: 0;
  color: var(--text-muted);
}

.gp-panel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.gp-panel-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.gp-panel-controls svg {
  flex-shrink: 0;
  opacity: 0.8;
}

.gp-panel-action {
  width: 100%;
  max-width: 220px;
  margin-top: 0.35rem;
}

/* ==========================================================================
   Play button colors for remaining games
   ========================================================================== */

.game-play-typing {
  background: linear-gradient(135deg, #8B5CF6, #EC4899);
  box-shadow: 0 10px 24px rgba(236, 72, 153, 0.24);
}

.game-play-maze {
  background: linear-gradient(135deg, #06B6D4, #3B82F6);
  box-shadow: 0 10px 24px rgba(6, 182, 212, 0.24);
}

/* ==========================================================================
   Skill cards
   ========================================================================== */

.gp-grid-5 {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1rem;
}

.gp-skill-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.35rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  transition:
    transform 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}

.gp-skill-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-secondary);
  box-shadow: var(--shadow-md);
  color: var(--text-main);
}

.gp-skill-card h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text-heading);
}

.gp-skill-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  flex: 1;
}

.gp-skill-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-secondary);
}

.gp-skill-card:hover .gp-skill-link {
  color: #ffffff;
}

/* ==========================================================================
   Steps and features
   ========================================================================== */

.gp-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

.gp-step {
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.gp-step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-bottom: 1rem;
  border-radius: 12px;
  background: rgba(139, 92, 246, 0.14);
  border: 1px solid rgba(139, 92, 246, 0.25);
  color: var(--accent-primary);
  font-weight: 700;
}

.gp-step h3 {
  margin-bottom: 0.4rem;
  font-size: 1.1rem;
}

.gp-step p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.gp-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.25rem;
}

.gp-feature {
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.gp-feature h3 {
  margin-bottom: 0.4rem;
  font-size: 1.1rem;
}

.gp-feature p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ==========================================================================
   Guides box
   ========================================================================== */

.gp-guides-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: center;
  padding: 2.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 24px;
}

.gp-guide-links {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.gp-guide-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-weight: 600;
  transition:
    transform 0.25s ease,
    border-color 0.25s ease,
    color 0.25s ease;
}

.gp-guide-link:hover {
  transform: translateY(-2px);
  border-color: var(--accent-secondary);
  color: #ffffff;
}

.gp-guide-link svg {
  flex-shrink: 0;
  opacity: 0.75;
}

/* ==========================================================================
   CTA
   ========================================================================== */

.gp-cta {
  padding: 4rem 2rem;
  text-align: center;
  background:
    linear-gradient(
      135deg,
      rgba(139, 92, 246, 0.12),
      rgba(6, 182, 212, 0.1)
    ),
    var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 24px;
}

.gp-cta p {
  color: var(--text-muted);
  max-width: 560px;
  margin-inline: auto;
}

.gp-cta .btn {
  margin-top: 1rem;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
  .gp-panel,
  .gp-panel-list .gp-panel:nth-child(even) {
    grid-template-columns: 1fr;
  }

  .gp-panel-list .gp-panel:nth-child(even) .gp-panel-media {
    order: 0;
  }

  .gp-panel-list .gp-panel:nth-child(even) .gp-panel-content {
    order: 1;
  }

  .gp-grid-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gp-steps {
    grid-template-columns: 1fr;
  }

  .gp-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gp-guides-box {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .gp-grid-5 {
    grid-template-columns: 1fr;
  }

  .gp-grid-4 {
    grid-template-columns: 1fr;
  }

  .gp-panel {
    padding: 1rem;
  }

  .gp-panel-title {
    font-size: 1.3rem;
  }

  .gp-guides-box {
    padding: 1.5rem;
  }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .mm-card-inner,
  .game-btn,
  .sidebar-game-link,
  .sidebar-post-link,
  .sidebar-progress-fill {
    transition: none;
  }

  .mm-card-inner {
    transform: none !important;
  }

  .mm-face-back {
    display: none;
    transform: none;
  }

  .mm-card.is-flipped .mm-face-front {
    display: none;
  }

  .mm-card.is-flipped .mm-face-back {
    display: flex;
  }

  .mm-card.is-wrong .mm-face-back {
    animation: none;
  }

  .game-hud-value.is-pop {
    animation: none;
  }
}

/* ==========================================================================
   Individual game page base styles
   Used by all game pages. Memory Match uses purple accent.
   ========================================================================== */

.game-page {
  --game-accent: #8B5CF6;
  --game-accent-dark: #6D28D9;
  --game-accent-soft: rgba(139, 92, 246, 0.15);
  --game-success: #10B981;
  --game-danger: #EF4444;
}

.game-page-memory {
  --game-accent: #8B5CF6;
  --game-accent-dark: #6D28D9;
  --game-accent-soft: rgba(139, 92, 246, 0.15);
}

.game-page-math {
  --game-accent: #10B981;
  --game-accent-dark: #059669;
  --game-accent-soft: rgba(16, 185, 129, 0.15);
}

.game-page-word {
  --game-accent: #F59E0B;
  --game-accent-dark: #D97706;
  --game-accent-soft: rgba(245, 158, 11, 0.15);
}

.game-page-typing {
  --game-accent: #EC4899;
  --game-accent-dark: #DB2777;
  --game-accent-soft: rgba(236, 72, 153, 0.15);
}

.game-page-maze {
  --game-accent: #06B6D4;
  --game-accent-dark: #0891B2;
  --game-accent-soft: rgba(6, 182, 212, 0.15);
}

.text-game-accent {
  color: var(--game-accent);
}

/* ==========================================================================
   Game page hero
   ========================================================================== */

.game-hero {
  padding: 2.75rem 0 1.75rem;
}

.game-hero-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
}

.game-title-block {
  max-width: 720px;
}

.game-title-block h1 {
  margin-bottom: 0.65rem;
}

.game-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 1.02rem;
}

.game-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1.25rem;
}

.game-hero-side {
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .game-hero-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ==========================================================================
   Game shell
   Main game panel containing header, play area, HUD, and actions.
   ========================================================================== */

.game-shell {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(
      180deg,
      rgba(21, 26, 37, 0.96),
      rgba(13, 17, 27, 0.98)
    );
  border: 1px solid var(--border-color);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
}

.game-shell-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-soft);
}

.game-shell-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
}

.game-shell-title svg {
  color: var(--game-accent);
}

.game-shell-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Game stage */
.game-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 420px;
  padding: 1.5rem;
  background:
    radial-gradient(
      circle at top,
      rgba(139, 92, 246, 0.08),
      transparent 38%
    ),
    #0B0F19;
  overflow: hidden;
}

.game-stage-inner {
  width: 100%;
  height: 100%;
}

/* Game overlay */
.game-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  text-align: center;
  background: rgba(11, 15, 25, 0.82);
  backdrop-filter: blur(6px);
}

.game-overlay.is-hidden {
  display: none;
}

.game-overlay-title {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

.game-overlay-text {
  margin: 0;
  max-width: 560px;
  color: var(--text-muted);
}

.game-overlay-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* HUD */
.game-hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-soft);
  background: rgba(15, 20, 31, 0.6);
}

.game-hud-item {
  padding: 0.8rem;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
}

.game-hud-label {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.game-hud-value {
  font-size: 1rem;
  font-weight: 700;
}

.game-hud-value.is-pop {
  animation: hudPop 0.25s ease;
}

@keyframes hudPop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}

/* Game actions */
.game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-soft);
}

.game-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.75rem 1.3rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  color: #fff;
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    filter 0.22s ease;
}

.game-btn:hover {
  color: #fff;
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.game-btn-primary {
  background: linear-gradient(135deg, var(--game-accent), var(--game-accent-dark));
  box-shadow: 0 10px 24px var(--game-accent-soft);
}

.game-btn-secondary {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.game-btn-secondary:hover {
  border-color: var(--game-accent);
}

.game-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

@media (max-width: 768px) {
  .game-stage {
    min-height: 340px;
    padding: 1rem;
  }

  .game-hud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .game-actions {
    flex-direction: column;
  }

  .game-actions .game-btn {
    width: 100%;
  }
}

/* ==========================================================================
   Game content layout with sidebar
   Sidebar starts when main content below the game starts.
   ========================================================================== */

.game-content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 2rem;
  align-items: start;
  margin-top: 2.75rem;
}

.game-main {
  min-width: 0;
}

.game-sidebar {
  position: sticky;
  top: 92px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

@media (max-width: 1020px) {
  .game-content-layout {
    grid-template-columns: 1fr;
  }

  .game-sidebar {
    position: static;
  }
}

/* ==========================================================================
   Game content blocks
   ========================================================================== */

.game-block {
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
}

.game-block h2 {
  margin-bottom: 1.1rem;
  font-size: 1.25rem;
}

.game-block p {
  color: var(--text-muted);
}

.game-steps {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.game-step {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  padding: 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
}

.game-step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--game-accent-soft);
  color: var(--game-accent);
  font-weight: 700;
}

.game-step p {
  margin: 0;
}

.game-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.75rem;
}

.game-control-chip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  color: var(--text-main);
  font-size: 0.92rem;
}

.game-control-chip svg {
  flex-shrink: 0;
  color: var(--game-accent);
}

.game-tips-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.game-tip {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.95rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  color: var(--text-muted);
}

.game-tip svg {
  flex-shrink: 0;
  margin-top: 0.1rem;
  color: var(--game-accent);
}

.game-skill-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.game-skill-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-full);
  background: var(--game-accent-soft);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 600;
}

.game-details-table {
  width: 100%;
  border-collapse: collapse;
}

.game-details-table th,
.game-details-table td {
  padding: 0.8rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.95rem;
}

.game-details-table th {
  color: var(--text-muted);
  font-weight: 600;
  width: 36%;
}

.game-details-table tr:last-child th,
.game-details-table tr:last-child td {
  border-bottom: 0;
}

/* ==========================================================================
   Sidebar cards
   ========================================================================== */

.sidebar-card {
  padding: 1.35rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
}

.sidebar-title {
  margin-bottom: 1rem;
  font-size: 1.05rem;
}

.sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sidebar-game-link {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  color: var(--text-main);
  transition:
    transform 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease;
}

.sidebar-game-link:hover {
  transform: translateX(3px);
  border-color: var(--game-accent);
  box-shadow: var(--shadow-sm);
  color: var(--text-main);
}

.sidebar-game-thumb {
  flex-shrink: 0;
  width: 54px;
  height: 40px;
  overflow: hidden;
  border-radius: 9px;
  background: var(--bg-body);
}

.sidebar-game-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sidebar-game-title {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.25;
}

.sidebar-game-meta {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sidebar-post-link {
  display: block;
  padding: 0.8rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  color: var(--text-main);
  font-size: 0.92rem;
  line-height: 1.35;
  transition:
    transform 0.22s ease,
    border-color 0.22s ease;
}

.sidebar-post-link:hover {
  transform: translateX(3px);
  border-color: var(--accent-secondary);
  color: var(--text-main);
}

.sidebar-post-meta {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sidebar-help {
  background:
    linear-gradient(
      135deg,
      rgba(139, 92, 246, 0.12),
      rgba(6, 182, 212, 0.1)
    ),
    var(--bg-card);
}

.sidebar-help p {
  margin-bottom: 1rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* Sidebar progress / stars */
.sidebar-stars {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0.9rem;
  font-size: 1.1rem;
}

.sidebar-star {
  color: rgba(255, 255, 255, 0.18);
}

.sidebar-star.is-active {
  color: var(--highlight);
}

.sidebar-progress-label {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.sidebar-progress-bar {
  height: 8px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
}

.sidebar-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--game-accent), var(--accent-secondary));
  transition: width 0.35s ease;
}

/* ==========================================================================
   Memory Match board
   ========================================================================== */

.mm-board-wrap {
  width: 100%;
  max-width: 620px;
  margin-inline: auto;
}

.mm-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.mm-card {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  perspective: 900px;
}

.mm-card:disabled {
  cursor: default;
}

.mm-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.45s ease;
}

.mm-card.is-flipped .mm-card-inner {
  transform: rotateY(180deg);
}

.mm-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border: 1px solid var(--border-color);
}

.mm-face-front {
  background:
    linear-gradient(
      135deg,
      rgba(139, 92, 246, 0.22),
      rgba(6, 182, 212, 0.14)
    ),
    var(--bg-elevated);
}

.mm-face-front svg {
  width: 32px;
  height: 32px;
  color: rgba(255, 255, 255, 0.55);
}

.mm-face-back {
  transform: rotateY(180deg);
  background:
    radial-gradient(
      circle at top,
      rgba(139, 92, 246, 0.16),
      transparent 42%
    ),
    #151A25;
  border-color: rgba(139, 92, 246, 0.42);
}

.mm-symbol {
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  line-height: 1;
}

.mm-card.is-matched .mm-face-back {
  border-color: rgba(16, 185, 129, 0.6);
  box-shadow: 0 0 22px rgba(16, 185, 129, 0.18);
}

.mm-card.is-hint .mm-face-front {
  border-color: var(--highlight);
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.22);
}

.mm-card.is-wrong .mm-face-back {
  border-color: rgba(239, 68, 68, 0.65);
  animation: mmShake 0.38s ease;
}

@keyframes mmShake {
  0% {
    transform: rotateY(180deg) translateX(0);
  }
  25% {
    transform: rotateY(180deg) translateX(-5px);
  }
  50% {
    transform: rotateY(180deg) translateX(5px);
  }
  75% {
    transform: rotateY(180deg) translateX(-3px);
  }
  100% {
    transform: rotateY(180deg) translateX(0);
  }
}

.mm-card:focus-visible .mm-face-front {
  outline: 2px solid var(--accent-secondary);
  outline-offset: 2px;
}

@media (max-width: 560px) {
  .mm-board {
    gap: 0.5rem;
  }

  .mm-face {
    border-radius: 12px;
  }
}

/* ==========================================================================
   Game feedback utilities
   ========================================================================== */

.game-message {
  display: none;
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  font-weight: 600;
  text-align: center;
}

.game-message.is-visible {
  display: block;
}

.game-message-success {
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--success);
}

.game-message-error {
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
}

.game-message-info {
  background: rgba(6, 182, 212, 0.14);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--accent-secondary);
}

/* ==========================================================================
   Reduced motion support
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .mm-card-inner,
  .game-btn,
  .sidebar-game-link,
  .sidebar-post-link,
  .sidebar-progress-fill {
    transition: none;
  }

  .mm-card.is-flipped .mm-card-inner {
    transform: none;
  }

  .mm-card.is-flipped .mm-face-back {
    transform: none;
  }

  .mm-face-front {
    display: none;
  }

  .mm-card.is-wrong .mm-face-back {
    animation: none;
  }

  .game-hud-value.is-pop {
    animation: none;
  }
}

/* ==========================================================================
   Memory card rendering fix
   Fixes card faces not filling the card area.
   ========================================================================== */

.mm-board .mm-card {
  position: relative;
  width: 100%;
  min-height: 95px;
  aspect-ratio: 3 / 4;
}

.mm-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.45s ease;
}

.mm-face {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.mm-face-front {
  background:
    linear-gradient(
      135deg,
      rgba(139, 92, 246, 0.26),
      rgba(6, 182, 212, 0.16)
    ),
    #1E2536;
}

.mm-face-front svg {
  width: 36px;
  height: 36px;
  color: rgba(255, 255, 255, 0.72);
}

.mm-face-back {
  transform: rotateY(180deg);
  background:
    radial-gradient(
      circle at top,
      rgba(139, 92, 246, 0.18),
      transparent 42%
    ),
    #151A25;
  border-color: rgba(139, 92, 246, 0.42);
}

.mm-card.is-flipped .mm-card-inner {
  transform: rotateY(180deg);
}

.mm-card.is-matched .mm-face-back {
  border-color: rgba(16, 185, 129, 0.6);
  box-shadow: 0 0 22px rgba(16, 185, 129, 0.18);
}

/* Reduced motion fallback for the rendering fix */
@media (prefers-reduced-motion: reduce) {
  .mm-card-inner {
    transform: none !important;
    transition: none;
  }

  .mm-face-back {
    display: none;
    transform: none;
  }

  .mm-card.is-flipped .mm-face-front {
    display: none;
  }

  .mm-card.is-flipped .mm-face-back {
    display: flex;
  }
}

/* ==========================================================================
   Memory Match forced simple card mode
   This fixes card faces not appearing on some browsers.
   ========================================================================== */

.mm-card {
  -webkit-tap-highlight-color: transparent;
}

.mm-card-inner {
  transform: none !important;
  transition: none !important;
}

.mm-face {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: none !important;
  backface-visibility: visible !important;
  -webkit-backface-visibility: visible !important;
  border-radius: 16px;
}

.mm-face-front {
  display: flex;
  z-index: 2;
  background:
    linear-gradient(
      135deg,
      rgba(139, 92, 246, 0.28),
      rgba(6, 182, 212, 0.18)
    ),
    #1E2536;
  border: 1px solid rgba(139, 92, 246, 0.45);
}

.mm-face-front svg {
  width: 38px;
  height: 38px;
  color: rgba(255, 255, 255, 0.75);
}

.mm-face-back {
  display: none;
  z-index: 1;
  background:
    radial-gradient(
      circle at top,
      rgba(139, 92, 246, 0.18),
      transparent 42%
    ),
    #151A25;
  border: 1px solid rgba(139, 92, 246, 0.42);
}

.mm-card.is-flipped .mm-face-front {
  display: none;
}

.mm-card.is-flipped .mm-face-back {
  display: flex;
  animation: mmFaceShow 0.22s ease;
}

.mm-card.is-matched .mm-face-back {
  border-color: rgba(16, 185, 129, 0.65);
  box-shadow: 0 0 22px rgba(16, 185, 129, 0.18);
}

.mm-card.is-hint .mm-face-front {
  border-color: rgba(251, 191, 36, 0.75);
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.22);
}

.mm-card.is-wrong .mm-face-back {
  border-color: rgba(239, 68, 68, 0.65);
  animation: mmShakeFlat 0.38s ease;
}

@keyframes mmFaceShow {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes mmShakeFlat {
  0% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  50% {
    transform: translateX(5px);
  }
  75% {
    transform: translateX(-3px);
  }
  100% {
    transform: translateX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mm-card.is-flipped .mm-face-back {
    animation: none;
  }

  .mm-card.is-wrong .mm-face-back {
    animation: none;
  }
}

/* ==========================================================================
   Math Quiz Rush styles
   ========================================================================== */

.mq-stage-inner {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.mq-question {
  padding: 2.2rem 1.5rem;
  text-align: center;
  background: #151A25;
  border: 1px solid var(--border-color);
  border-radius: 20px;
}

.mq-question-label {
  display: block;
  margin-bottom: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.mq-question-text {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 800;
  color: #ffffff;
  line-height: 1.1;
}

.mq-answers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.mq-answer {
  display: block;
  width: 100%;
  padding: 1.1rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffffff;
  background: #1E2536;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

.mq-answer:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--game-accent);
}

.mq-answer:disabled {
  cursor: default;
}

.mq-answer.is-correct {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--game-success);
}

.mq-answer.is-wrong {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--game-danger);
  animation: mqShake 0.38s ease;
}

@keyframes mqShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

@media (max-width: 560px) {
  .mq-question {
    padding: 1.6rem 1rem;
  }

  .mq-answers {
    gap: 0.6rem;
  }

  .mq-answer {
    font-size: 1.05rem;
    padding: 0.95rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mq-answer {
    transition: none;
  }

  .mq-answer.is-wrong {
    animation: none;
  }
}

/* ==========================================================================
   Word Scramble styles
   ========================================================================== */

.ws-stage-inner {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.ws-category {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.ws-slots,
.ws-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.ws-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 56px;
  border-radius: 12px;
  background: #151A25;
  border: 1px dashed var(--border-color);
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffffff;
}

.ws-slot.is-filled {
  border-style: solid;
  border-color: var(--game-accent);
  background: #1E2536;
  cursor: pointer;
}

.ws-slot.is-correct {
  border-color: var(--game-success);
}

.ws-slots.is-wrong .ws-slot {
  animation: wsShake 0.38s ease;
  border-color: var(--game-danger);
}

.ws-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 56px;
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background:
    linear-gradient(
      135deg,
      rgba(245, 158, 11, 0.25),
      rgba(239, 68, 68, 0.15)
    ),
    #1E2536;
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffffff;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease;
}

.ws-tile:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--game-accent);
}

.ws-tile:disabled {
  opacity: 0.25;
  cursor: default;
  transform: none;
}

.ws-tile.is-hint {
  border-color: rgba(251, 191, 36, 0.8);
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.25);
}

@keyframes wsShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

@media (max-width: 560px) {
  .ws-slot,
  .ws-tile {
    width: 44px;
    height: 48px;
    font-size: 1.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ws-tile {
    transition: none;
  }

  .ws-slots.is-wrong .ws-slot {
    animation: none;
  }
}

/* ==========================================================================
   Typing Rocket styles
   ========================================================================== */

.tr-stage-inner {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

.tr-field {
  position: relative;
  height: 360px;
  overflow: hidden;
  border-radius: 16px;
  background:
    radial-gradient(
      circle at top,
      rgba(236, 72, 153, 0.08),
      transparent 40%
    ),
    #0B0F19;
  border: 1px solid var(--border-soft);
}

.tr-word {
  position: absolute;
  top: 0;
  left: 0;
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  background: #1E2536;
  border: 1px solid var(--border-color);
  color: #ffffff;
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
}

.tr-word.is-target {
  border-color: var(--game-accent);
  box-shadow: 0 0 14px rgba(236, 72, 153, 0.25);
}

.tr-word.is-hit {
  animation: trHit 0.3s ease forwards;
}

@keyframes trHit {
  to {
    transform: scale(1.2);
    opacity: 0;
  }
}

.tr-typed-bar {
  margin-top: 0.9rem;
  text-align: center;
}

.tr-typed {
  display: inline-block;
  min-width: 180px;
  min-height: 1.4em;
  padding: 0.6rem 1rem;
  border-radius: 12px;
  background: #151A25;
  border: 1px solid var(--border-color);
  color: var(--accent-secondary);
  font-weight: 700;
  letter-spacing: 0.05em;
}

@media (max-width: 560px) {
  .tr-field {
    height: 300px;
  }

  .tr-word {
    font-size: 0.9rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tr-word.is-hit {
    animation: none;
  }
}

/* ==========================================================================
   Maze Escape styles
   ========================================================================== */

.mz-stage-inner {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

.mz-grid {
  display: grid;
  gap: 2px;
  padding: 6px;
  background: #0B0F19;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  touch-action: none;
}

.mz-cell {
  aspect-ratio: 1 / 1;
  border-radius: 3px;
  background: #1E2536;
}

.mz-cell.is-wall {
  background: #0d1220;
}

.mz-cell.is-player {
  background: var(--game-accent);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.4);
}

.mz-cell.is-exit {
  background: rgba(16, 185, 129, 0.65);
}

.mz-cell.is-hint {
  background: rgba(251, 191, 36, 0.55);
}

.mz-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-top: 0.9rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.mz-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.mz-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.mz-swatch-player { background: var(--game-accent); }
.mz-swatch-exit { background: rgba(16, 185, 129, 0.65); }
.mz-swatch-wall { background: #0d1220; }

.tr-stage-inner {
  position: relative;
}

.tr-hidden-input {
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 2px;
  height: 2px;
  opacity: 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: transparent;
  pointer-events: none;
}