/* ==========================================================================
   ABCya! Game Player Arena - Clean Vooks-Inspired Light Theme
   Enhanced for Fullscreen Mobile Touch & Desktop Cinema
   ========================================================================== */

:root {
  --player-header-h: 64px;
  --vooks-navy: #013870;
  --vooks-blue: #0284c7;
  --vooks-blue-cta: #2563eb;
  --vooks-border: #e2e8f0;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  background: #f8fafc;
  color: #0f172a;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

/* Player Header */
.player-header {
  background: #ffffff;
  border-bottom: 2px solid var(--vooks-border);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.player-nav-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  background: #f1f5f9;
  border: 1px solid var(--vooks-border);
  color: var(--vooks-navy);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.back-btn:hover {
  background: #e2e8f0;
  transform: translateX(-2px);
}
.back-btn:active {
  transform: scale(0.96);
}

.player-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  padding: 4px 12px 4px 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1.5px solid #bae6fd;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.08);
}
.player-brand-badge:hover {
  transform: translateY(-1px) scale(1.02);
  border-color: #7dd3fc;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.16);
}

.player-logo-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: contain;
  background: #ffffff;
  padding: 2px;
  box-shadow: 0 2px 5px rgba(2, 132, 199, 0.15);
}

.player-brand-text {
  font-family: var(--font-display, "Fredoka", sans-serif);
  font-size: 0.88rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.2px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.player-brand-highlight {
  color: #0284c7;
  font-weight: 800;
}

@media (max-width: 768px) {
  .player-brand-text {
    display: none;
  }
  .player-brand-badge {
    padding: 3px 6px;
  }
}

.player-title-box {
  text-align: center;
  overflow: hidden;
  flex: 1;
}

.player-game-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--vooks-navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.player-game-grades {
  font-size: 0.75rem;
  color: var(--vooks-blue);
  font-weight: 700;
}

.player-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.action-btn {
  padding: 7px 14px;
  border-radius: var(--radius-full);
  background: #f8fafc;
  color: #334155;
  border: 1px solid var(--vooks-border);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
  font-family: inherit;
  text-decoration: none;
}
.action-btn:hover {
  background: #eff6ff;
  color: var(--vooks-blue);
  border-color: #bfdbfe;
  transform: translateY(-1px);
}
.action-btn:active {
  transform: scale(0.96);
}
.action-btn.active {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #ef4444;
}

/* Arena Viewport */
.arena-wrapper {
  max-width: 1240px;
  margin: 18px auto;
  padding: 0 16px;
}

.game-viewport-card {
  background: #f8fafc;
  background-image: radial-gradient(circle at 50% 30%, #ffffff 0%, #f1f5f9 60%, #e2e8f0 100%);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(1, 56, 112, 0.08), 0 2px 8px rgba(0, 0, 0, 0.03);
  position: relative;
  width: 100%;
  border: 2px solid var(--vooks-border);
}

.game-aspect-ratio-wrap {
  position: relative;
  width: 100%;
  padding-top: 62.5%;
}

.game-iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
}

/* Fullscreen Mode */
.game-viewport-card.is-fullscreen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99999;
  border-radius: 0;
  border: none;
  margin: 0;
  padding: 0;
  background: #f8fafc;
}

.game-viewport-card.is-fullscreen .game-aspect-ratio-wrap {
  padding-top: 0;
  height: 100vh;
}

/* Game Start Interactive Overlay (Vooks Warm Light Hero Preview) */
.game-start-overlay {
  position: absolute;
  inset: 0;
  background: rgba(248, 250, 252, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  overflow: hidden;
}

.game-start-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.overlay-backdrop-art {
  position: absolute;
  inset: -20px;
  background-size: cover;
  background-position: center;
  filter: blur(28px) saturate(1.4) opacity(0.28);
  transform: scale(1.1);
  pointer-events: none;
}

.start-card-modal {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 24px;
  background: #ffffff;
  padding: 22px 30px;
  border-radius: 26px;
  border: 2px solid #e2e8f0;
  box-shadow: 0 20px 48px rgba(1, 56, 112, 0.12), 0 4px 12px rgba(0, 0, 0, 0.04);
  max-width: 90%;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.game-start-overlay:hover .start-card-modal {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 24px 56px rgba(1, 56, 112, 0.16);
}

.start-cover-wrapper {
  width: 124px;
  height: 124px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(1, 56, 112, 0.14);
  flex-shrink: 0;
  border: 3px solid #ffffff;
  background: #f1f5f9;
}

.overlay-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.start-info-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.start-badge-tag {
  display: inline-block;
  align-self: flex-start;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--vooks-blue);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.start-title-text {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--vooks-navy);
  line-height: 1.2;
}

.start-btn-pulse {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  padding: 11px 26px;
  border-radius: var(--radius-full);
  color: white;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: all 0.25s ease;
  animation: pulseScale 2.2s infinite ease-in-out;
  cursor: pointer;
  width: fit-content;
  margin-top: 4px;
}

.game-start-overlay:hover .start-btn-pulse {
  transform: scale(1.05);
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.55);
}

.start-play-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.start-play-label {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.start-play-sub {
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 600;
}

@keyframes pulseScale {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

/* Info Details Box (Clean White) */
.game-details-box {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 24px;
  border: 1px solid var(--vooks-border);
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.04);
}

.details-heading {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--vooks-navy);
  margin-bottom: 8px;
}

.details-desc {
  font-size: 0.95rem;
  color: #475569;
  line-height: 1.6;
  margin-bottom: 16px;
}

.details-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-pill {
  background: #eff6ff;
  color: var(--vooks-blue);
  border: 1px solid #bfdbfe;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
}

/* Similar Games Section */
.similar-games-section {
  margin-top: 36px;
  margin-bottom: 40px;
}

.similar-heading {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--vooks-navy);
  margin-bottom: 16px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .player-header {
    padding: 8px 12px;
    gap: 8px;
  }
  .player-game-title {
    font-size: 0.98rem;
    max-width: 150px;
  }
  .player-game-grades {
    font-size: 0.7rem;
  }
  .back-btn {
    padding: 6px 12px;
    font-size: 0.78rem;
    gap: 4px;
  }
  .action-btn span:not(.btn-icon):not(.lang-toggle-text) {
    display: none;
  }
  .action-btn {
    padding: 6px 9px;
  }
  .arena-wrapper {
    margin: 4px auto;
    padding: 0 4px;
    max-width: 100%;
  }
  .game-viewport-card {
    border-radius: 16px;
    border-width: 1.5px;
    box-shadow: 0 4px 16px rgba(1, 56, 112, 0.08);
  }
  /* MOBILE PORTRAIT: Dynamic generous height so ABCya canvas fills mobile screen without letterboxing! */
  .game-aspect-ratio-wrap {
    padding-top: 0 !important;
    height: min(62vh, 520px) !important;
    min-height: 380px !important;
    max-height: 540px !important;
  }
  .start-card-modal {
    flex-direction: column;
    text-align: center;
    padding: 20px 22px;
    gap: 12px;
    border-radius: 20px;
    max-width: 92%;
  }
  .start-info-col {
    align-items: center;
    gap: 6px;
  }
  .start-badge-tag {
    align-self: center;
    font-size: 0.68rem;
  }
  .start-cover-wrapper {
    width: 96px;
    height: 96px;
    border-radius: 16px;
  }
  .start-title-text {
    font-size: 1.25rem;
  }
  .start-btn-pulse {
    padding: 10px 24px;
  }
  .game-details-box {
    padding: 18px 16px;
    margin-top: 14px;
    border-radius: var(--radius-md);
  }
}

/* Mobile Rotate Phone Hint Banner */
.rotate-hint-banner {
  display: none;
}
@media (max-width: 768px) and (orientation: portrait) {
  .rotate-hint-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #eff6ff;
    border: 1.5px dashed #93c5fd;
    border-radius: var(--radius-full);
    padding: 9px 18px;
    margin: 10px auto 4px auto;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--vooks-navy);
    text-align: center;
    width: fit-content;
    max-width: 95%;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    animation: bounceHint 3.5s ease-in-out infinite;
  }
  .rotate-hint-banner .rotate-phone-icon {
    color: var(--vooks-blue-cta);
    flex-shrink: 0;
    animation: rotateIcon 4s ease-in-out infinite;
  }
}

@keyframes bounceHint {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes rotateIcon {
  0%, 60%, 100% { transform: rotate(0deg); }
  25%, 35% { transform: rotate(90deg); }
}

/* Floating Landscape Back Button (Mobile Landscape Full Arcade Mode) */
.floating-landscape-back {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 99999;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  background: rgba(1, 56, 112, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 800;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: all 0.2s ease;
}
.floating-landscape-back:hover {
  background: rgba(2, 132, 199, 0.95);
  transform: scale(1.04);
}
.floating-landscape-back:active {
  transform: scale(0.96);
}

/* Mobile Landscape Auto Fullscreen Arcade Cinema */
@media (max-width: 950px) and (orientation: landscape) and (max-height: 550px) {
  .player-header {
    display: none !important;
  }
  .game-details-box,
  .similar-games-section,
  .rotate-hint-banner {
    display: none !important;
  }
  .arena-wrapper {
    margin: 0 !important;
    padding: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    position: fixed !important;
    inset: 0 !important;
    z-index: 9999 !important;
  }
  .game-viewport-card {
    border-radius: 0 !important;
    border: none !important;
    width: 100vw !important;
    height: 100vh !important;
    box-shadow: none !important;
  }
  .game-aspect-ratio-wrap {
    padding-top: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    min-height: 100vh !important;
  }
  .floating-landscape-back {
    display: inline-flex !important;
  }
}

/* Arabic & RTL Support for Player Arena */
html[dir="rtl"], body.lang-ar {
  font-family: 'Cairo', 'Fredoka', 'Plus Jakarta Sans', system-ui, sans-serif;
}
html[dir="rtl"] .player-header {
  flex-direction: row-reverse;
}
html[dir="rtl"] .back-btn svg {
  transform: scaleX(-1);
}
html[dir="rtl"] .player-actions {
  flex-direction: row-reverse;
}
html[dir="rtl"] .start-card-modal {
  flex-direction: row-reverse;
  text-align: right;
}
html[dir="rtl"] .floating-landscape-back {
  left: auto;
  right: 12px;
  flex-direction: row-reverse;
}
html[dir="rtl"] .floating-landscape-back svg {
  transform: scaleX(-1);
}
@media (max-width: 640px) {
  html[dir="rtl"] .start-card-modal {
    flex-direction: column;
    text-align: center;
  }
}

