/* ==========================================================================
   Crypto Universes — Poki-Style Portal Stylesheet
   Flat vibrant design, mosaic grid, no-hero layout
   ========================================================================== */

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

:root {
  --font-head: 'Outfit', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;

  /* Theme variables (Default: Light theme, matching Poki's default look) */
  --bg:           #f0f4f7;
  --bg-darker:    #e4e9ed;
  --nav-bg:       #ffffff;
  --surface:      #ffffff;
  --surface-hover:#f8fafc;
  --border:       rgba(0, 0, 0, 0.05);
  --border-hover: rgba(0, 0, 0, 0.1);
  --text:         #0f172a;
  --text-muted:   #64748b;
  --nav-h:        60px;
  
  --radius:       20px;
  --radius-sm:    14px;
  --transition:   all 0.18s cubic-bezier(0.25, 0.8, 0.25, 1);
  --shadow:       0 4px 12px rgba(0, 0, 0, 0.03), 0 1px 3px rgba(0, 0, 0, 0.02);
  --shadow-hover: 0 12px 24px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);

  /* Vibrant Poki-like category gradients */
  --grad-space:   linear-gradient(135deg, #1e3a8a, #3b82f6);
  --grad-puzzle:  linear-gradient(135deg, #065f46, #10b981);
  --grad-typing:  linear-gradient(135deg, #5b21b6, #8b5cf6);
  --grad-action:  linear-gradient(135deg, #991b1b, #ef4444);
  --grad-word:    linear-gradient(135deg, #c2410c, #f97316);
  --grad-math:    linear-gradient(135deg, #3730a3, #6366f1);
  
  --accent:       #3b82f6;
  --accent-glow:  rgba(59, 130, 246, 0.25);
  --gold:         #f59e0b;
}

html[data-theme="dark"] {
  --bg:           #0f172a;
  --bg-darker:    #0b0f19;
  --nav-bg:       #1e293b;
  --surface:      #1e293b;
  --surface-hover:#334155;
  --border:       rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --text:         #f1f5f9;
  --text-muted:   #94a3b8;
  --shadow:       0 4px 12px rgba(0, 0, 0, 0.2);
  --shadow-hover: 0 12px 28px rgba(0, 0, 0, 0.4), 0 4px 10px rgba(59, 130, 246, 0.15);
}

/* ── BASE & UTILS ── */
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; border: none; background: none; cursor: pointer; }
.hidden { display: none !important; }

/* ── NAV BAR ── */
.nav {
  height: var(--nav-h);
  background: var(--nav-bg);
  border-bottom: 1.5px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.nav-inner {
  max-width: 1400px; height: 100%; margin: 0 auto;
  padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}

.nav-logo {
  font-family: var(--font-head);
  font-size: 1.6rem; font-weight: 800;
  letter-spacing: -1.5px;
  color: var(--text);
  text-transform: lowercase;
  white-space: nowrap;
}
.nav-logo strong {
  color: var(--accent);
  font-weight: 900;
}

.nav-search {
  flex: 1; max-width: 460px;
  position: relative;
}
.nav-search input {
  width: 100%;
  padding: 10px 16px 10px 42px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 40px;
  color: var(--text);
  font-family: inherit; font-size: 0.9rem; font-weight: 500;
  outline: none;
  transition: var(--transition);
}
.nav-search input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.nav-search input::placeholder { color: var(--text-muted); }
.search-icon {
  position: absolute; left: 15px; top: 50%;
  transform: translateY(-50%);
  font-size: 0.95rem; pointer-events: none;
  opacity: 0.6;
}

.nav-actions { display: flex; align-items: center; }
.nav-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  color: var(--text);
  font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.nav-btn:hover { background: var(--surface-hover); border-color: var(--accent); }

/* ── MAIN CONTENT ── */
.main-content {
  max-width: 1400px; margin: 0 auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 40px;
}

/* ── MOSAIC GRID (Poki Style) ── */
.grid-section { width: 100%; }
.mosaic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  grid-auto-rows: 130px;
  grid-auto-flow: dense;
  gap: 14px;
  width: 100%;
}

/* Card basic styling */
.game-card, .category-card {
  border-radius: var(--radius);
  background: var(--surface);
  border: 1.5px solid var(--border);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  content-visibility: auto;
  contain-intrinsic-size: 130px;
}

.game-card:hover {
  transform: scale(1.04) translateY(-2px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
  z-index: 10;
}

/* Spanning rules for Mosaic Grid */
.card-large {
  grid-column: span 2;
  grid-row: span 2;
}
.card-wide {
  grid-column: span 2;
  grid-row: span 1;
}

/* Full-Photo Poki-Style Thumbnails */
.game-card-thumb {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--radius);
}

.game-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
  transition: transform 0.3s ease;
}

.game-card:hover .game-card-img {
  transform: scale(1.08);
}

/* Poki Card Overlay */
.game-card-play-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.2) 60%, rgba(0, 0, 0, 0) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.22s ease;
  padding: 10px;
  text-align: center;
  border-radius: var(--radius);
}

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

.play-btn-circle {
  width: 48px; height: 48px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.6);
  transform: scale(0.85); transition: transform 0.2s ease;
}

.game-card:hover .play-btn-circle { transform: scale(1); }

.game-card-overlay-title {
  color: #fff;
  font-family: var(--font-head);
  font-size: 0.8rem;
  font-weight: 800;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card footer text */
.game-card-body {
  padding: 10px 12px;
  background: var(--surface);
  border-top: 1.5px solid var(--border);
  flex-shrink: 0;
}
.game-card-title {
  font-family: var(--font-head);
  font-size: 0.9rem; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 2px;
}
.game-card-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.72rem; color: var(--text-muted);
}
.game-card-rating { color: var(--gold); font-weight: 700; }

/* ── CATEGORY CARDS ── */
.category-card {
  align-items: center; justify-content: center;
  text-align: center;
  padding: 16px;
  color: #ffffff;
  border: none;
  font-family: var(--font-head);
  font-weight: 800;
  text-shadow: 0 2px 4px rgba(0,0,0,0.25);
}
.category-card:hover { transform: scale(1.04); }

.category-card .cat-icon { font-size: 2.5rem; margin-bottom: 8px; block-size: auto; }
.category-card .cat-name { font-size: 1rem; letter-spacing: 0.5px; }

/* Category specific gradients */
.cat-space   { background: var(--grad-space); }
.cat-puzzle  { background: var(--grad-puzzle); }
.cat-typing  { background: var(--grad-typing); }
.cat-action  { background: var(--grad-action); }
.cat-word    { background: var(--grad-word); }
.cat-math    { background: var(--grad-math); }

/* ── INFO & FAQ SECTION ── */
.info-section, .faq-section {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.info-section h2, .faq-section h2 {
  font-family: var(--font-head);
  font-size: 1.3rem; font-weight: 800; margin-bottom: 12px;
}
.info-section p { font-size: 0.88rem; color: var(--text-muted); line-height: 1.6; }

.faq-list { display: flex; flex-direction: column; gap: 8px; }
.faq-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.faq-item summary {
  padding: 14px 18px; cursor: pointer; font-weight: 600; font-size: 0.9rem;
  list-style: none; display: flex; justify-content: space-between; align-items: center;
}
.faq-item summary::after { content: '+'; font-size: 1.1rem; color: var(--text-muted); }
.faq-item[open] summary::after { content: '−'; }
.faq-item p { padding: 0 18px 14px; font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; }

/* ── FOOTER ── */
.footer {
  background: var(--bg-darker);
  border-top: 1.5px solid var(--border);
  padding: 30px 16px; text-align: center;
}
.footer-inner p { font-size: 0.82rem; color: var(--text-muted); line-height: 1.6; }
.footer-keywords { opacity: 0.45; margin-top: 5px; font-size: 0.72rem; }

/* ── GAME VIEWER SUBPAGE VIEW ── */
#game-view {
  width: 100%;
}
.gv-layout {
  display: grid;
  grid-template-columns: 140px 1fr 140px;
  gap: 16px;
  width: 100%;
  align-items: start;
  margin-bottom: 24px;
}

.gv-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.gv-sidebar .game-card {
  aspect-ratio: 1;
  width: 100%;
}

.gv-center-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.gv-player-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
  max-height: 70vh;
}

.game-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.gv-loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; color: var(--text-muted); background: var(--bg);
}
.gv-spinner {
  width: 38px; height: 38px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.gv-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.gv-title-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.gv-title-left h1 {
  font-family: var(--font-head);
  font-size: 1.4rem;
  font-weight: 800;
}

.gv-badge {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  padding: 4px 12px; border-radius: 20px;
  border: 1px solid var(--border);
}
.gv-badge.space { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.gv-badge.puzzle { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.gv-badge.typing { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.gv-badge.action { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.gv-badge.word { background: rgba(249, 115, 22, 0.1); color: #f97316; }
.gv-badge.math { background: rgba(99, 102, 241, 0.1); color: #6366f1; }

.gv-btn {
  padding: 8px 18px;
  background: var(--accent);
  color: #ffffff;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-head);
  transition: var(--transition);
  box-shadow: 0 4px 12px var(--accent-glow);
}
.gv-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.gv-description-block {
  display: flex;
  gap: 32px;
  padding: 24px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.gv-description-left, .gv-description-right {
  flex: 1;
}
.gv-description-block h3 {
  font-family: var(--font-head);
  font-size: 0.8rem; font-weight: 750;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); margin-bottom: 10px;
}
.gv-description-block p, .gv-description-block ul {
  font-size: 0.88rem; color: var(--text-muted); line-height: 1.6;
}
.gv-description-block ul { padding-left: 18px; }
.gv-description-block li { margin-bottom: 4px; }

.gv-bottom-recommendations {
  padding: 24px 0 48px;
}
.gv-bottom-recommendations h2 {
  font-family: var(--font-head);
  font-size: 1.3rem; font-weight: 800;
  margin-bottom: 16px;
}

/* ── SEARCH OVERLAY ── */
.search-overlay {
  position: fixed; top: var(--nav-h); left: 50%;
  transform: translateX(-50%);
  width: 100%; max-width: 600px;
  z-index: 150; padding: 0 16px;
}
.search-results {
  background: var(--surface);
  border: 1.5px solid var(--border-hover);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-hover);
  overflow: hidden; max-height: 380px; overflow-y: auto;
}
.search-result-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; cursor: pointer; transition: var(--transition);
  border-bottom: 1.5px solid var(--border);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--surface-hover); }
.search-result-icon { font-size: 1.6rem; }
.search-result-info { flex: 1; }
.search-result-name { font-weight: 700; font-size: 0.9rem; }
.search-result-tag { font-size: 0.72rem; color: var(--text-muted); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .gv-layout {
    grid-template-columns: 1fr;
  }
  .gv-sidebar {
    display: none;
  }
  .gv-description-block {
    flex-direction: column;
    gap: 20px;
  }
  .gv-player-box {
    aspect-ratio: 4 / 3;
  }
}

@media (max-width: 600px) {
  .main-content { padding: 8px; gap: 20px; }
  .mosaic-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    grid-auto-rows: 90px;
    gap: 8px;
  }
  .card-large { grid-column: span 2; grid-row: span 2; }
  .card-wide { grid-column: span 2; grid-row: span 1; }
  .game-card-thumb span { font-size: 2.2rem; }
  .card-large .game-card-thumb span { font-size: 4rem; }
  .category-card .cat-icon { font-size: 1.8rem; margin-bottom: 4px; }
  .category-card .cat-name { font-size: 0.78rem; }
}

/* ── CATEGORY BAR PILLS ── */
.category-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 12px 2px;
  margin-bottom: 10px;
  scrollbar-width: none;
}
.category-bar::-webkit-scrollbar { display: none; }
.cat-pill {
  background: var(--card-bg, #1a1d2e);
  color: var(--text-color, #fff);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.cat-pill:hover {
  background: rgba(0, 240, 255, 0.15);
  border-color: #00f0ff;
  transform: translateY(-2px);
}
.cat-pill.active {
  background: linear-gradient(135deg, #00f0ff, #7000ff);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(0, 240, 255, 0.4);
}

/* ── FOOTER SEO LINKS ── */
.footer-seo-links {
  display: flex;
  justify-content: center;
  gap: 60px;
  margin-bottom: 25px;
  flex-wrap: wrap;
}
.footer-col {
  text-align: left;
}
.footer-col h4 {
  font-size: 0.95rem;
  color: #00f0ff;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-col li {
  margin-bottom: 6px;
}
.footer-col a {
  color: var(--text-color, #a0a5c0);
  text-decoration: none;
  font-size: 0.88rem;
  transition: color 0.2s ease;
}
.footer-col a:hover {
  color: #00f0ff;
}
