/* =========================================================
   SINGLE GAME PAGE — responsive embed
   ========================================================= */
.game-page {
  padding: var(--gap-md) 0 var(--gap-lg);
}

.game-embed-wrap {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  /* default mobile aspect ratio 16:9; JS/inline style may override per-game */
  aspect-ratio: 16 / 9;
}
/* In true fullscreen, the aspect-ratio lock must NOT apply — otherwise the
   box stays letterboxed and touch controls near the real screen edges land
   outside the interactive area and appear "dead". Force it to fill the
   entire viewport instead. */
.game-embed-wrap:fullscreen,
.game-embed-wrap:-webkit-full-screen,
.game-embed-wrap:-ms-fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  aspect-ratio: unset !important;
  border-radius: 0 !important;
}
.game-embed-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* =========================================================
   AUTO ORIENTATION — Mobile game = portrait, PC game = landscape.
   Set once per game in wp-admin (dropdown), never touched again.
   ========================================================= */

/* Landscape games (default): unchanged widescreen box on all devices. */

/* Portrait games: on phones, switch to a tall phone-app style frame
   instead of a squashed widescreen letterbox. */
@media (max-width: 768px) {
  .game-embed-wrap.orientation-portrait {
    aspect-ratio: 9 / 16 !important;
    max-width: 420px;
    margin: 0 auto;
  }
}
/* On desktop/tablet, portrait games still get a sensible tall box
   instead of stretching full width. */
@media (min-width: 769px) {
  .game-embed-wrap.orientation-portrait {
    aspect-ratio: 9 / 16 !important;
    max-width: 420px;
    margin: 0 auto;
  }
}

/* Landscape games shown on a narrow phone screen: keep the widescreen
   box (don't distort it) and nudge the player to rotate for full size. */
.game-rotate-hint { display: none; }
@media (max-width: 600px) and (orientation: portrait) {
  .game-embed-wrap.orientation-landscape .game-rotate-hint {
    display: flex;
  }
}
.game-rotate-hint {
  position: absolute;
  inset: 0;
  z-index: 3;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--gap-xs);
  background: rgba(11, 10, 26, 0.88);
  color: var(--text-main);
  text-align: center;
  padding: var(--gap-md);
  pointer-events: none; /* purely informational — never blocks the game */
}
.game-rotate-icon {
  font-size: 2rem;
  animation: arcaderush-rotate-pulse 1.6s ease-in-out infinite;
}
.game-rotate-hint p { margin: 0; font-size: 0.85rem; color: var(--text-dim); max-width: 240px; }
@keyframes arcaderush-rotate-pulse {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-90deg); }
}
/* Never show the rotate hint once fullscreen (JS locks orientation there instead) */
.game-embed-wrap:fullscreen .game-rotate-hint,
.game-embed-wrap:-webkit-full-screen .game-rotate-hint { display: none !important; }

/* =========================================================
   LOADING SCREEN — shown until the game iframe fires "load"
   ========================================================= */
.game-loading-screen {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--gap-sm);
  background: var(--bg-panel);
  color: var(--text-dim);
  font-size: 0.9rem;
  transition: opacity 0.35s ease;
}
.game-loading-screen.is-hidden {
  opacity: 0;
  pointer-events: none;
}
.game-loading-spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  animation: arcaderush-spin 0.8s linear infinite;
}
@keyframes arcaderush-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .game-loading-spinner,
  .game-rotate-icon { animation: none; }
}

/* Fullscreen ALWAYS wins over the portrait/landscape aspect-ratio locks
   above, regardless of source order (belt-and-braces re-assertion). */
.game-embed-wrap.orientation-portrait:fullscreen,
.game-embed-wrap.orientation-landscape:fullscreen,
.game-embed-wrap.orientation-portrait:-webkit-full-screen,
.game-embed-wrap.orientation-landscape:-webkit-full-screen {
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  aspect-ratio: unset !important;
  margin: 0 !important;
}

/* =========================================================
   PSEUDO-FULLSCREEN FALLBACK — iOS Safari does not support the
   Fullscreen API on non-video elements (requestFullscreen silently
   does nothing there), so we simulate fullscreen with plain CSS
   instead. Applied via JS when the native API is unavailable.
   ========================================================= */
.game-embed-wrap.pseudo-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100dvh !important;
  max-width: none !important;
  aspect-ratio: unset !important;
  margin: 0 !important;
  border-radius: 0 !important;
  z-index: 999 !important;
}
body.pseudo-fullscreen-active {
  overflow: hidden !important;
}
.pseudo-fullscreen-close {
  display: none;
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 1000;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(11, 10, 26, 0.75);
  color: var(--text-main);
  font-size: 1.1rem;
  line-height: 1;
  align-items: center;
  justify-content: center;
}
.game-embed-wrap.pseudo-fullscreen .pseudo-fullscreen-close {
  display: flex;
}

/* fullscreen button sits on top of the frame */
.game-embed-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--gap-xs);
  padding: var(--gap-xs) 0;
}
.game-embed-actions button {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 0.85rem;
}
.game-embed-actions button:hover { border-color: var(--accent); color: var(--accent); }

.game-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-sm);
  margin: var(--gap-md) 0 var(--gap-sm);
}
.game-title-row h1 { font-size: 1.4rem; margin: 0; }

.game-description {
  color: var(--text-dim);
  font-size: 0.95rem;
  max-width: 760px;
}

/* two-column layout: content + sidebar ad, stacks on mobile */
.game-page-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap-lg);
}
@media (min-width: 960px) {
  .game-page-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: start;
  }
  .game-page-layout .sidebar { position: sticky; top: 80px; }
}

/* related games strip */
.related-games h2 { font-size: 1.1rem; margin: var(--gap-lg) 0 var(--gap-sm); }

/* =========================================================
   FOOTER
   ========================================================= */
.site-footer {
  border-top: 1px solid var(--line);
  padding: var(--gap-lg) 0;
  margin-top: var(--gap-xl);
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}
.site-footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--gap-md);
  margin-bottom: var(--gap-sm);
}
.site-footer .footer-links a:hover { color: var(--accent); }
