/* ============================================================
   Unified Game Layout — EmojiCircle
   Structure: .game-page > .game-layout > .game-main + .game-sidebar
   Inside .game-main: .game-container + .game-bottom-section

   NOTE: emoji-header.css sets body.has-shared-layout { padding-top: 70px }
         main { margin-left: 70px }
   ============================================================ */

/* ── Page wrapper ── */
.game-page {
  display: block;
  max-width: none;
  /* Consistent outer spacing from header, sidebars, and screen edges */
  padding: 50px 10vw 60px 60px;
  box-sizing: border-box;
}

/* ── Layout row: game + sidebar ── */
.game-layout {
  display: grid;
  grid-template-columns: 68% 1fr;
  /* 68% Symmetry Split */
  gap: 20px;
  /* Section gaps: 24px */
  align-items: start;
  width: 100%;

}

/* ── Main Game Column (Left-Aligned) ── */
.game-main {
  display: flex;
  flex-direction: column;

  /* LEFT-ALIGNED */
  align-items: flex-start;
  gap: 24px;
  /* Gap between game container and bottom section */
  width: 100%;
}

/* ── Game container — MAIN FOCUS (Dashboard Panel layout) ── */
.game-container {
  width: 100%;
  min-width: 0;
  /* prevents overflow blowout in CSS Grid */
  max-width: 1000px;
  /* Symmetry cap 1000px */
  height: 560px;
  /* slightly taller */
  min-height: 520px;
  /* keeps consistency */
  aspect-ratio: auto;
  /* allowed to adapt safely */
  background: #121214;
  border: 1px solid rgba(255, 255, 255, 0.08);
  /* Subtle border */
  border-radius: 0 !important;
  /* SHARP UI: No rounded corners */
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  /* Subtle shadow */
  overflow: hidden;
  /* prevents inner content stretch */
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  /* Game canvas behaves as flexible content */
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* Touch-specific: prevent page scrolling when interacting with game container on touch devices */
@media (hover: none) and (pointer: coarse) {
  .game-container {
    touch-action: none;
  }
}

/* ── Game Content Constraints ── */
.game-container canvas,
.game-container iframe,
.game-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.game-container * {
  max-width: 100%;
  box-sizing: border-box;
}

/* ── Common Full-bleed Card Shell ── */
.game-container .card {
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  margin: 0;
  max-width: none;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  box-sizing: border-box;
}

/* ── Top HUD bar ── */
.game-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  flex-shrink: 0;
}

.game-hud .hud-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.game-hud h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary, #f8fafc);
  margin: 0;
}

.game-hud h1 span {
  color: var(--accent, #ff4d00);
}

/* Score pill */
.score-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface-alt, #1e1e22);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
  padding: 6px 18px;
  min-width: 90px;
}

.score-pill .score-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted, rgba(148, 163, 184, 0.75));
}

.score-pill .score-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--accent, #ff4d00);
  line-height: 1.1;
}

/* ── Board / Canvas Areas ── */
.board-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 18px 18px;
  overflow: hidden;
}

.canvas-area {
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: #0a0a0f;
  overflow: hidden;
  height: 100%;
  padding: 0;
}

/* Mobile HUD adjustments */
@media (max-width: 600px) {
  .game-hud h1 {
    display: none;
  }
  .game-hud {
    padding: 12px 16px;
  }
  .game-hud .hud-right {
    width: 100%;
    justify-content: flex-end;
  }
}


/* ── Right Sidebar column ── */
.game-sidebar {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Remove page-level aside background/border for the games sidebar
   (some pages apply a global `aside` style; ensure the recommended
   panel uses the layout's visual style instead) */
.game-sidebar {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
}

.game-section-title {
  margin-top: 10px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #94a3b8;
  line-height: 1;
  margin-bottom: 17px;
}

.game-sidebar-grid {
  display: grid;
  gap: 16px;
  /* Card gaps: 16px */
  width: 100%;
}

/* ── Recommended section grid (Sidebar) ── */
.recommended-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  /* 2 cards per row */
  gap: 16px;

}

/* ── Bottom "More Games" section ── */
.game-bottom-section {
  width: 100%;
  max-width: none;
  /* Spans full width of the parent layout row */
  grid-column: 1 / -1;
  /* Forces full row occupation under sidebar & main */
  margin-block-start: 24px;
  margin-bottom: 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.game-bottom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  /* Fill row dynamically */
  gap: 16px;
  /* 16px tight gaps per instruction */
  justify-content: start;
  width: 100%;
}

/* ── GAME CARD CONSISTENCY (VERY IMPORTANT) ── */
.game-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 0 !important;
  /* SHARP UI: No rounded corners */
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
}

.game-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  transform: scale(1.03);
  /* scale pop effect */
}

.game-card__image {
  width: 100%;
  aspect-ratio: 16 / 9;
  /* Aspect ratio (16:9) */
  box-sizing: border-box;
  overflow: hidden;
}

.game-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Images must object-fit: cover */
  display: block;
  border-radius: 0 !important;
  /* Ensure image is also sharp */
}

.game-card__title {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
  text-transform: uppercase;
  text-align: left;
}

/* ── No horizontal scroll ── */
html,
body {
  overflow-x: hidden;
}

/* ── Zero out extra margins inside game area ── */
.game-page .game-main>*,
.game-page .game-container>*,
.game-page .game-layout>* {
  margin-top: 0 !important;
}

/* ── RESPONSIVE BEHAVIOR ── */
@media (max-width: 900px) {
  .game-layout {
    grid-template-columns: 1fr;
    /* Stack layout on tablets */
  }

  .recommended-grid {
    grid-template-columns: 1fr;
    /* single column on smaller screens */
  }

  /* Wait, on mobile screens... we should still respect the max-width... */
  /* This is handled by box-sizing naturally */
}

@media (max-width: 1024px) {

  /* Tablet layout */
  .game-layout {
    display: flex;
    flex-direction: column;
  }

  .game-sidebar {
    width: 100%;
    flex: auto;
    max-width: none;
    margin-bottom: 24px;
  }

  .game-sidebar-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

@media (max-width: 600px) {

  /* Mobile layout */
  .game-page {
    padding: 16px 16px 0 16px;
  }

  .game-sidebar {
    display: none;
    /* Hide right sidebar */
  }

  .game-bottom-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}

/* ── Accessibility: reduced motion ── */
@media (prefers-reduced-motion: reduce) {

  .game-container,
  .game-card {
    transition: none;
  }
}