/* ============================================================
   FOXFOSTER — Games hub
   Loaded after style.css; reuses the shared design tokens.
   ============================================================ */

.game-hero {
  position: relative;
  padding: 176px 0 80px;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.gh-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(var(--primary-rgb), 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--primary-rgb), 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 78%);
  mask-image: linear-gradient(to bottom, #000 0%, transparent 78%);
}

.gh-glow {
  position: absolute;
  top: -340px;
  right: -160px;
  width: 760px;
  height: 760px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--primary-rgb), 0.14), transparent 62%);
  pointer-events: none;
}

.gh-glow-2 {
  position: absolute;
  bottom: -380px;
  left: -220px;
  width: 640px;
  height: 640px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 229, 255, 0.06), transparent 65%);
  pointer-events: none;
}

.game-hero .container { position: relative; z-index: 1; }

.gh-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.06);
  border: 1px solid rgba(var(--primary-rgb), 0.22);
  border-radius: 100px;
  padding: 8px 18px;
  margin-bottom: 28px;
}

.gh-title {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: -0.03em;
  max-width: 880px;
  margin-bottom: 24px;
  color: var(--text);
}

.gh-subtitle {
  font-size: clamp(1rem, 1.3vw, 1.15rem);
  color: var(--text-secondary);
  max-width: 680px;
  line-height: 1.75;
  margin-bottom: 38px;
}

.gh-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 56px;
}

.gh-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

.gh-stat {
  text-align: left;
  padding: 24px 48px 0 0;
}

.gh-stat + .gh-stat {
  padding-left: 48px;
  border-left: 1px solid var(--border-light);
}

.gh-stat-num {
  display: block;
  font-family: var(--font-mono);
  font-size: clamp(1.6rem, 2.4vw, 2.2rem);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.gh-stat-label {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ============================================================
   FEATURED GAME
   ============================================================ */
.featured-section { padding-top: 0; margin-top: -1px; }

.featured-game {
  display: grid;
  grid-template-columns: 1.08fr 1fr;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  position: relative;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.featured-game:hover {
  border-color: rgba(var(--primary-rgb), 0.35);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.featured-game::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 3;
  background: linear-gradient(90deg, var(--primary), rgba(var(--primary-rgb), 0.15), transparent);
}

.fg-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 440px;
  overflow: hidden;
  background: #070502;
}

.fg-visual .fg-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.fg-logo {
  position: relative;
  z-index: 3;
  width: min(82%, 620px);
  height: auto;
  object-fit: contain;
  transform: rotate(-2deg);
  filter: drop-shadow(0 26px 45px rgba(0, 0, 0, 0.6));
  transition: transform var(--transition-slow);
}

.featured-game:hover .fg-visual .fg-cover { transform: scale(1.03); }
.featured-game:hover .fg-logo { transform: rotate(0deg) scale(1.02); }

.fg-visual::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(90deg, transparent 60%, rgba(8, 8, 8, 0.35) 85%, rgba(8, 8, 8, 0.7) 100%);
  pointer-events: none;
}

.fg-live {
  position: absolute;
  top: 22px;
  left: 22px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 100px;
  background: rgba(5, 5, 5, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #35e07a;
  box-shadow: 0 0 0 0 rgba(53, 224, 122, 0.55);
  animation: livePulse 1.8s infinite;
}

@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(53, 224, 122, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(53, 224, 122, 0); }
  100% { box-shadow: 0 0 0 0 rgba(53, 224, 122, 0); }
}

.fg-body {
  padding: 48px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.game-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.game-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 100px;
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.game-badge-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.game-badge-partner {
  border-color: rgba(0, 229, 255, 0.35);
  color: #7fe9f7;
  background: rgba(0, 229, 255, 0.06);
}

.fg-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: 16px;
  color: var(--text);
}

.fg-desc {
  color: var(--text-secondary);
  font-size: 0.98rem;
  line-height: 1.75;
  margin-bottom: 8px;
}

.game-points {
  list-style: none;
  display: grid;
  gap: 10px;
  margin: 20px 0 24px;
}

.game-points li {
  position: relative;
  padding-left: 26px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.55;
}

.game-points li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0.48em;
  width: 8px;
  height: 8px;
  border: 2px solid var(--primary);
  transform: rotate(45deg);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.chip {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
}

.fg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.game-credit-line {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.game-credit-line a { color: var(--text-secondary); }
.game-credit-line a:hover { color: var(--primary); }

/* ============================================================
   GAME CARDS
   ============================================================ */
.games-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--grid-gap);
}

.game-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}

.game-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(var(--primary-rgb), 0.35);
  transform: translateY(-4px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}

.game-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #08050f;
}

.game-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.game-card:hover .game-cover img { transform: scale(1.04); }

.game-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(5, 5, 5, 0.55), transparent 45%);
  pointer-events: none;
}

.game-cover .game-badges {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 2;
  margin: 0;
}

.game-cover .game-badge {
  background: rgba(5, 5, 5, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.game-cover .game-badge-primary {
  background: var(--primary);
  border-color: var(--primary);
}

.game-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 30px;
}

.game-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.game-card-body h3 {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
}

.game-category {
  flex-shrink: 0;
  padding: 5px 10px;
  border-radius: 100px;
  border: 1px solid rgba(var(--primary-rgb), 0.28);
  background: rgba(var(--primary-rgb), 0.07);
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.game-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.7;
  margin-bottom: 18px;
}

.game-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 24px;
}

.game-tag {
  padding: 4px 10px;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 500;
}

.game-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.game-card-actions .btn { padding: 10px 18px; font-size: 0.82rem; }

.game-credit {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.game-credit a { color: var(--text-secondary); }
.game-credit a:hover { color: var(--primary); }

/* ============================================================
   FREE ARCADE
   ============================================================ */
.arcade-section { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.arcade-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--grid-gap);
}

.arcade-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}

.arcade-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.arcade-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(var(--primary-rgb), 0.35);
  transform: translateY(-4px);
}

.arcade-card:hover::before { opacity: 1; }

.arcade-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.09);
  border: 1px solid rgba(var(--primary-rgb), 0.24);
}

.arcade-icon svg { width: 26px; height: 26px; }

.arcade-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.arcade-card p {
  flex: 1;
  color: var(--text-secondary);
  font-size: 0.84rem;
  line-height: 1.65;
}

.arcade-play {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 0;
  border: none;
  background: none;
  color: var(--primary);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: gap var(--transition), color var(--transition);
}

.arcade-play:hover { gap: 12px; color: var(--primary-light); }

.arcade-note {
  margin-top: 30px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ============================================================
   CREDITS
   ============================================================ */
.credits-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--grid-gap);
}

.credit-card {
  display: flex;
  flex-direction: column;
  padding: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition);
}

.credit-card:hover { border-color: rgba(var(--primary-rgb), 0.3); }

.credit-role {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 10px;
}

.credit-card h3 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
}

.credit-card p {
  color: var(--text-secondary);
  font-size: 0.87rem;
  line-height: 1.7;
}

.credit-card ul {
  list-style: none;
  display: grid;
  gap: 8px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.credit-card li {
  position: relative;
  padding-left: 16px;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.6;
}

.credit-card li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.75;
}

.credit-card a { color: var(--text-secondary); }
.credit-card a:hover { color: var(--primary); }

.credit-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.credit-links a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  transition: all var(--transition);
}

.credit-links a:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.credit-links svg { width: 14px; height: 14px; }

/* ============================================================
   GAME MODAL
   ============================================================ */
.game-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}

.game-modal.open { opacity: 1; visibility: visible; }

.gm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.gm-panel {
  position: relative;
  width: min(780px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.65);
  transform: translateY(14px) scale(0.985);
  transition: transform var(--transition);
}

.game-modal.open .gm-panel { transform: none; }

.gm-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.gm-kicker {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
}

.gm-head h3 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  margin-top: 4px;
}

.gm-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition);
}

.gm-close:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.08);
}

.gm-body { padding: 20px 24px 24px; }

.gm-hud {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 22px;
  margin-bottom: 14px;
}

.hud-item { display: flex; flex-direction: column; gap: 2px; }

.hud-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.hud-value {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

#gm-restart {
  margin-left: auto;
  padding: 8px 16px;
  font-size: 0.78rem;
}

.game-stage {
  display: grid;
  place-items: center;
  min-height: 360px;
  padding: 12px;
  background: #060606;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.game-canvas {
  display: block;
  width: 100%;
  height: auto;
  max-width: 560px;
  border-radius: 8px;
  touch-action: none;
}

.game-help {
  margin-top: 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.6;
}

.game-touch {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.game-touch:empty { display: none; }

.touch-btn {
  min-width: 48px;
  height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 1rem;
  cursor: pointer;
  touch-action: manipulation;
  transition: background var(--transition), border-color var(--transition);
}

.touch-btn:hover { border-color: rgba(var(--primary-rgb), 0.5); }

.touch-btn:active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

body.game-open { overflow: hidden; }

/* ============================================================
   MEMORY MATRIX
   ============================================================ */
.mm-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  width: min(100%, 440px);
  margin: 0 auto;
}

.mm-card {
  aspect-ratio: 1;
  padding: 0;
  border: none;
  background: transparent;
  perspective: 600px;
  cursor: pointer;
}

.mm-inner {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.mm-card.flipped .mm-inner,
.mm-card.matched .mm-inner { transform: rotateY(180deg); }

.mm-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.mm-front {
  background: rgba(var(--primary-rgb), 0.08);
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.mm-back {
  transform: rotateY(180deg);
  background: var(--bg-card-hover);
  border-color: rgba(var(--primary-rgb), 0.4);
  color: var(--text);
  font-size: 1.55rem;
  font-weight: 800;
}

.mm-card.matched .mm-back {
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.14);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1023px) {
  .game-hero { padding: 144px 0 60px; }

  .featured-game { grid-template-columns: 1fr; }

  .fg-visual { min-height: 320px; }

  .fg-visual::after {
    background: linear-gradient(to top, rgba(8, 8, 8, 0.65), transparent 55%);
  }

  .fg-body { padding: 36px; }

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

  .arcade-grid { grid-template-columns: repeat(2, 1fr); }

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

@media (max-width: 767px) {
  .game-hero { padding: 132px 0 48px; }

  .gh-actions { margin-bottom: 40px; }
  .gh-actions .btn { width: 100%; justify-content: center; }

  .gh-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
  .gh-stat { padding: 0; }
  .gh-stat + .gh-stat { padding-left: 0; border-left: none; }

  .fg-visual { min-height: 220px; }

  .fg-logo { width: 88%; }

  .fg-body { padding: 26px 22px; }

  .game-card-body { padding: 24px; }

  .game-card-actions { align-items: flex-start; }
  .game-card-actions .btn { width: 100%; justify-content: center; }

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

  .credit-card { padding: 24px; }

  .game-modal { padding: 10px; }

  .gm-panel { max-height: calc(100vh - 20px); }

  .gm-head { padding: 18px 16px; }

  .gm-head h3 { font-size: 1.15rem; }

  .gm-body { padding: 16px; }

  .gm-hud { gap: 16px; }

  #gm-restart { margin-left: 0; width: 100%; }

  .game-stage { min-height: 0; padding: 8px; }

  .mm-board { gap: 8px; }

  .mm-back { font-size: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }
  .fg-visual .fg-cover,
  .fg-logo,
  .game-cover img,
  .featured-game,
  .game-card,
  .arcade-card { transition: none; }
}
