/* ════════════════════════════════════════════════════
   ZenPlay — Mobile Landscape Enforcement v7
   Add to zenplay.css
   ════════════════════════════════════════════════════ */

/* ── Rotate overlay ── */
.zp-rotate-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #0A1F1F;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

/* Show ONLY on mobile portrait */
@media screen and (max-width: 768px) and (orientation: portrait) {
  .zp-rotate-overlay {
    display: flex !important;
  }
  /* Why: do not hide the actual game surface; fullscreen play mode now handles rotation and landscape prompts at click time. */
  body:not(.zp-game-fullscreen-active) .zp-rotate-overlay {
    display: flex !important;
  }
}

.zp-rotate-phone {
  width: 80px;
  height: 80px;
  margin-bottom: 1.5rem;
  animation: zp-rotate-anim 2s ease-in-out infinite;
}

@keyframes zp-rotate-anim {
  0%   { transform: rotate(0deg);   }
  30%  { transform: rotate(0deg);   }
  60%  { transform: rotate(90deg);  }
  90%  { transform: rotate(90deg);  }
  100% { transform: rotate(0deg);   }
}

.zp-rotate-title {
  font-family: var(--font-display, 'Syne', sans-serif);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--zen-text, #E8EDE8);
  margin-bottom: 0.5rem;
}

.zp-rotate-sub {
  font-size: 13px;
  color: var(--zen-sub, #8FA89E);
  line-height: 1.6;
  max-width: 260px;
}

/* ── PWA install banner ── */
.zp-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--zen-mid, #163535);
  border-top: 1px solid var(--zen-border, #234040);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 100;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.zp-install-banner.show {
  transform: translateY(0);
}

.zp-install-banner-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.zp-install-banner-text {
  flex: 1;
  font-size: 13px;
  color: var(--zen-text, #E8EDE8);
}

.zp-install-banner-text strong {
  display: block;
  margin-bottom: 2px;
}

.zp-install-banner-text span {
  font-size: 11px;
  color: var(--zen-sub, #8FA89E);
}

.zp-install-btn {
  background: var(--zen-green, #29B474);
  color: var(--zen-dark, #0A1F1F);
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font-body, sans-serif);
}

.zp-install-close {
  background: none;
  border: none;
  color: var(--zen-dim, #4A6560);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

/* ── Mobile bottom nav ── */
.zp-mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--zen-mid, #163535);
  border-top: 1px solid var(--zen-border, #234040);
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom);
}

@media screen and (max-width: 768px) {
  .zp-mobile-nav {
    display: flex;
  }
  /* Add padding to body so content not hidden behind bottom nav */
  body {
    padding-bottom: 60px;
  }
}

.zp-mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  text-decoration: none;
  color: var(--zen-dim, #4A6560);
  font-size: 10px;
  transition: color 0.2s;
  gap: 3px;
}

.zp-mobile-nav-item.active,
.zp-mobile-nav-item:hover {
  color: var(--zen-green, #29B474);
}

.zp-mobile-nav-icon {
  font-size: 1.3rem;
  line-height: 1;
}

/* Animated nav icons */
.zp-nav-icon-endless { animation: zp-spin 8s linear infinite; display: inline-block; }
.zp-nav-icon-fire    { animation: zp-flicker 1.5s ease-in-out infinite; display: inline-block; }
.zp-nav-icon-snake   { animation: zp-wiggle 2s ease-in-out infinite; display: inline-block; }

@keyframes zp-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes zp-flicker {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.7; transform: scale(1.1); }
}

@keyframes zp-wiggle {
  0%, 100% { transform: rotate(0deg); }
  25%       { transform: rotate(-10deg); }
  75%       { transform: rotate(10deg); }
}

/* ── Favourites heart button on game cards ── */
.zp-fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(10, 26, 10, 0.7);
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
  z-index: 5;
  backdrop-filter: blur(4px);
}

.zp-fav-btn:hover { transform: scale(1.15); }
.zp-fav-btn.active { color: #E85D8A; }

/* ── Dynamic game card hover ── */
.zp-game-card {
  position: relative;
  overflow: hidden;
}

.zp-game-card:hover .zp-game-thumb {
  transform: scale(1.05);
}

.zp-game-card:hover .zp-game-card-overlay {
  opacity: 1;
}

.zp-game-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(10,26,10,0.95) 0%,
    rgba(10,26,10,0.4) 60%,
    transparent 100%
  );
  opacity: 0;
  transition: opacity 0.25s;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 10px;
  pointer-events: none;
}

.zp-game-card-play-btn {
  background: var(--zen-green, #29B474);
  color: var(--zen-dark, #0A1F1F);
  border: none;
  border-radius: 6px;
  padding: 7px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  font-family: var(--font-display, 'Syne', sans-serif);
}

.zp-game-card-stats {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.zp-game-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(41,180,116,0.3);
  color: var(--zen-green, #29B474);
  font-weight: 600;
}

.zp-game-tag.hot   { background: rgba(232,93,93,0.3); color: #E85D5D; }
.zp-game-tag.new   { background: rgba(77,166,232,0.3); color: #4DA6E8; }

/* ── Game carousel / rotating band ── */
.zp-game-carousel {
  position: relative;
  overflow: hidden;
  padding: 0.5rem 0;
  margin: 0.5rem 0;
}

.zp-carousel-track {
  display: flex;
  gap: 10px;
  animation: zp-carousel-scroll 30s linear infinite;
  width: max-content;
}

.zp-carousel-track:hover {
  animation-play-state: paused;
}

@keyframes zp-carousel-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.zp-carousel-item {
  flex-shrink: 0;
  width: 120px;
  background: var(--zen-mid, #163535);
  border: 1px solid var(--zen-border, #234040);
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, transform 0.2s;
}

.zp-carousel-item:hover {
  border-color: var(--zen-green, #29B474);
  transform: translateY(-2px);
}

.zp-carousel-thumb {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  background: var(--zen-muted, #1E4545);
}

.zp-carousel-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--zen-text, #E8EDE8);
  padding: 6px 8px 4px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zp-carousel-plays {
  font-size: 9px;
  color: var(--zen-dim, #4A6560);
  text-align: center;
  padding-bottom: 6px;
}
/* ══════════════════════════════════════════════════════════
   CANVAS MOBILE FIX v3 — Clean, scoped, no conflicts
   ══════════════════════════════════════════════════════════ */

/* 1. Kill horizontal overflow everywhere */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw;
}

/* 2. Prevent 300ms tap delay on all interactive elements */
a, button, canvas, input, select, textarea {
  touch-action: manipulation;
}

/* 3. Remove rotate-to-landscape overlay — games now work portrait */
.zp-rotate-overlay { display: none !important; }
.canvas-wrap, #game-container { visibility: visible !important; }

/* 4. Mobile game page — canvas-first layout */
@media (max-width: 900px) {

  /* canvas-wrap: exact height set by canvas-scaler.js via --zp-chrome-h */
  body.page-game .canvas-wrap {
    width: 100vw !important;
    max-width: 100vw !important;
    /* height managed by JS, but set a sane default */
    min-height: 200px;
    aspect-ratio: unset !important;
    max-height: none !important;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #0A1A0A !important;
  }

  /* canvas element: JS sets explicit px width/height — these are fallback caps */
  body.page-game canvas#game-canvas {
    display: block !important;
    max-width: 100vw !important;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    /* Do NOT set width/height here — JS handles it */
  }

  /* Body bottom padding for mobile nav */
  body.page-game { padding-bottom: 56px !important; }
}

/* 5. Homepage mobile fixes */
@media (max-width: 768px) {
  .zp-hcard { min-width: 120px !important; max-width: 140px !important; }
  .zp-hcard-emoji { font-size: 2rem !important; }
  .zp-hcard-name  { font-size: 11px !important; }
  .zp-cluster-grid { grid-template-columns: 1fr 1fr !important; }
  .hero h1 { font-size: clamp(1.5rem, 5.5vw, 2.2rem) !important; }
}


/* ZP v8: forced landscape fallback for mobile browsers that deny orientation lock. */
@media screen and (max-width: 900px) and (orientation: portrait) {
  body.zp-game-fullscreen-active #game-container,
  body.zp-game-fullscreen-active .canvas-wrap,
  body.zp-game-fullscreen-active .unity-wrap,
  body.zp-game-fullscreen-active .iframe-wrap {
    /* Why: rotate the actual play shell so the game is landscape even on portrait phones. */
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    width: var(--zp-mobile-vh, 100dvh) !important;
    height: var(--zp-mobile-vw, 100vw) !important;
    max-width: none !important;
    max-height: none !important;
    transform: translate(-50%, -50%) rotate(90deg) !important;
    transform-origin: center center !important;
    z-index: 2147482000 !important;
    background: #000 !important;
  }
  body.zp-game-fullscreen-active canvas#game-canvas,
  body.zp-game-fullscreen-active .unity-wrap canvas,
  body.zp-game-fullscreen-active .iframe-wrap iframe {
    /* Why: fill the rotated landscape shell. */
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
  }
}


/* ZP v8: permanently suppress legacy mobile rotate prompts that block gameplay. */
#zp-rotate-overlay,
.zp-rotate-overlay,
.rotate-hint,
.zpw-mobile-rotate-hint,
html.zp-mobile-legacy-rotate-disabled #zp-rotate-overlay {
  /* Why: these prompts block mobile canvas touches; gameplay uses fullscreen/CSS landscape shell instead. */
  display: none !important;
  /* Why: even if a stale cached script forces display:flex inline, it must not capture taps. */
  pointer-events: none !important;
  /* Why: keep stale overlays behind the playable canvas if display is forced by an old inline style. */
  z-index: -1 !important;
  /* Why: remove any visual opacity from stale overlays. */
  opacity: 0 !important;
}
