/* ================================================================
   EGGERMATH — Game Page Styles
   DuckMath-inspired dark theater mode
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,300..900;1,14..32,300..900&display=swap');

:root {
  --green:          #87dc83;
  --green-dark:     #5cb85c;
  --bg-dark:        #111111;
  --bg-panel:       #1c1c1c;
  --text-white:     #ffffff;
  --text-muted:     rgba(255,255,255,0.55);
  --border:         rgba(255,255,255,0.08);
  --radius:         12px;
  --transition:     0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-dark);
  color: var(--text-white);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img { display: block; max-width: 100%; }

/* ================================================================
   HEADER (Simple back bar)
   ================================================================ */
.game-header {
  padding: 12px 20px;
  background: rgba(0,0,0,0.4);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.back-btn {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-muted);
  font-size: 14px; font-weight: 600;
  transition: color var(--transition);
}
.back-btn:hover { color: #fff; }
.back-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

.header-logo {
  display: flex; align-items: center; gap: 8px;
  font-weight: 900; font-size: 16px; letter-spacing: -0.02em;
}
.header-logo img { width: 28px; height: 28px; border-radius: 6px; }

/* ================================================================
   THEATER (Iframe wrapper)
   ================================================================ */
.theater-wrap {
  width: 100%;
  max-width: 1200px;
  margin: 20px auto 0;
  padding: 0 20px;
  display: flex; flex-direction: column; gap: 16px;
  flex: 1;
}

.iframe-container {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.iframe-container iframe {
  width: 100%; height: 100%;
  border: none;
  display: block;
}

/* Fullscreen mode */
.iframe-container.fullscreen {
  position: fixed; inset: 0; z-index: 9999;
  width: 100vw; height: 100vh;
  border-radius: 0; border: none;
  aspect-ratio: auto;
}

/* Loading overlay */
.loading-overlay {
  position: absolute; inset: 0;
  background: #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 10;
  transition: opacity 0.4s ease;
}
.loading-overlay.hidden { opacity: 0; pointer-events: none; }
.loading-spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ================================================================
   CONTROLS & INFO
   ================================================================ */
.game-info-bar {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px;
  padding: 20px;
  background: var(--bg-panel);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.game-details { display: flex; gap: 20px; flex: 1; }
.game-icon {
  width: 80px; height: 80px;
  border-radius: 12px;
  object-fit: cover;
}
.game-text { display: flex; flex-direction: column; justify-content: center; }
.game-title { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 4px; }
.game-dev { font-size: 14px; color: var(--green); font-weight: 600; margin-bottom: 8px; }
.game-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; max-width: 600px; }

.game-actions {
  display: flex; align-items: center; gap: 12px;
}
.action-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  color: #fff;
  font-size: 13px; font-weight: 700;
  transition: all var(--transition);
  border: 1px solid rgba(255,255,255,0.1);
}
.action-btn:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); }
.action-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

/* Like / Dislike styling */
.action-btn.active.like { background: rgba(92,184,92,0.15); color: var(--green); border-color: var(--green); }
.action-btn.active.dislike { background: rgba(229,57,53,0.15); color: #e53935; border-color: #e53935; }
.action-btn.active.fav { background: rgba(255,193,7,0.15); color: #ffc107; border-color: #ffc107; }

/* ================================================================
   RELATED GAMES
   ================================================================ */
.related-section {
  padding: 40px 0;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.related-title {
  font-size: 18px; font-weight: 800;
  margin-bottom: 20px;
  color: #fff;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.related-card {
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 1;
  position: relative;
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
.related-card:hover { transform: scale(1.05); z-index: 2; }
.related-card img { width: 100%; height: 100%; object-fit: cover; transition: opacity 0.3s ease; }
.related-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 20px 10px 8px;
  background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
  font-size: 11px; font-weight: 700; color: #fff;
  text-align: center; text-transform: uppercase;
}

/* ================================================================
   VIDEO MODAL
   ================================================================ */
.video-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.video-modal.active {
  opacity: 1;
  visibility: visible;
}
.video-modal-content {
  position: relative;
  width: 90%;
  max-width: 900px;
  background: var(--bg-panel);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.video-modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 28px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  z-index: 10;
  line-height: 1;
  transition: color var(--transition);
}
.video-modal-close:hover {
  color: #fff;
}
.video-modal-header {
  padding: 16px 20px;
  font-size: 18px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.video-modal-body {
  width: 100%;
  aspect-ratio: 16 / 9;
}
.video-modal-body iframe {
  width: 100%;
  height: 100%;
  border: none;
}

@media (max-width: 768px) {
  .game-info-bar { flex-direction: column; }
  .game-actions { width: 100%; justify-content: space-between; }
  .game-icon { width: 60px; height: 60px; }
  .game-title { font-size: 20px; }
  .theater-wrap { padding: 0 10px; }
  .video-modal-content { width: 95%; }
}
