:root {
  color-scheme: dark;
  --gh-primary: #7c5cfc;
  --gh-primary-dark: #6a48ee;
  --gh-violet: #a855f7;
  --gh-bg: #0c0a17;
  --gh-surface: #14111f;
  --gh-card-bg: #1a1730;
  --gh-card-bg-2: #211d3a;
  --gh-text: #eceaf6;
  --gh-muted: #9b97bd;
  --gh-border: rgba(255, 255, 255, 0.07);
  --gh-border-strong: rgba(255, 255, 255, 0.12);
  --gh-radius: 1rem;
  --gh-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
  --gh-hover-shadow: 0 14px 34px rgba(124, 92, 252, 0.28);
  --bs-primary: var(--gh-primary);
  --bs-body-bg: var(--gh-bg);
  --bs-body-color: var(--gh-text);
  --bs-border-color: var(--gh-border);
}

body {
  background-color: var(--gh-bg);
  color: var(--gh-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* Recently Played / Featured render async and insert above the fold; without
     this the browser scroll-anchors past them, hiding them on load. */
  overflow-anchor: none;
}

/* Re-tint Bootstrap primary to the mockup blue */
.btn-primary {
  --bs-btn-bg: var(--gh-primary);
  --bs-btn-border-color: var(--gh-primary);
  --bs-btn-hover-bg: var(--gh-primary-dark);
  --bs-btn-hover-border-color: var(--gh-primary-dark);
  --bs-btn-active-bg: var(--gh-primary-dark);
  --bs-btn-active-border-color: var(--gh-primary-dark);
  border-radius: 0.6rem;
  font-weight: 600;
}
.btn-outline-primary {
  --bs-btn-color: var(--gh-primary);
  --bs-btn-border-color: var(--gh-primary);
  --bs-btn-hover-bg: var(--gh-primary);
  --bs-btn-hover-border-color: var(--gh-primary);
  --bs-btn-active-bg: var(--gh-primary);
  --bs-btn-active-border-color: var(--gh-primary);
  border-radius: 0.6rem;
  font-weight: 600;
}
a {
  color: var(--gh-primary);
}

/* ============ Navbar ============ */
.gh-navbar {
  box-shadow: 0 1px 0 rgba(20, 24, 60, 0.04);
}
.gh-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.7rem;
  background: linear-gradient(135deg, var(--gh-primary), var(--gh-violet));
  color: #fff;
  font-size: 1.2rem;
}
.gh-nav-link {
  position: relative;
  font-weight: 600;
  color: var(--gh-muted);
}
.gh-nav-link.active,
.gh-nav-link:hover {
  color: var(--gh-primary);
}
/* Blue underline indicator on the active link (desktop navbar) */
@media (min-width: 992px) {
  .gh-nav-link.active::after {
    content: '';
    position: absolute;
    left: 0.5rem;
    right: 0.5rem;
    bottom: -0.85rem;
    height: 3px;
    border-radius: 2px;
    background: var(--gh-primary);
  }
}
.gh-nav-bell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 1px solid var(--gh-border);
  background: #fff;
  color: var(--gh-text);
  font-size: 1.05rem;
  transition: background 0.15s ease;
}
.gh-nav-bell:hover {
  background: var(--gh-bg);
}
.gh-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border: none;
  background: transparent;
  font-weight: 600;
  color: var(--gh-text);
}
.gh-user-chip::after {
  color: var(--gh-muted);
}
.gh-user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #e4dcff, #d4e2ff);
  font-size: 1.2rem;
}
.gh-nav-search {
  max-width: 480px;
}

/* Search input with leading icon */
.gh-search {
  position: relative;
}
.gh-search .bi-search {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gh-muted);
  pointer-events: none;
}
.gh-search .form-control {
  padding-left: 2.5rem;
  border-radius: 0.7rem;
  border-color: var(--gh-border);
  background-color: #f8f9fc;
}
.gh-search .form-control:focus {
  background-color: #fff;
  border-color: var(--gh-primary);
  box-shadow: 0 0 0 0.2rem rgba(35, 80, 245, 0.12);
}
.gh-search-sm {
  width: 220px;
}
.gh-select {
  width: auto;
  border-radius: 0.7rem;
  border-color: var(--gh-border);
  font-weight: 500;
}

/* ============ Sidebar ============ */
.gh-sidebar {
  position: sticky;
  top: 84px;
}
.gh-side-nav {
  gap: 0.15rem;
}
.gh-side-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.9rem;
  border-radius: 0.7rem;
  font-weight: 600;
  color: var(--gh-text);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.gh-side-link .bi {
  font-size: 1.05rem;
  color: var(--gh-muted);
}
.gh-side-link:hover {
  background: rgba(35, 80, 245, 0.06);
  color: var(--gh-primary);
}
.gh-side-link:hover .bi {
  color: var(--gh-primary);
}
.gh-side-link.active {
  background: rgba(35, 80, 245, 0.1);
  color: var(--gh-primary);
}
.gh-side-link.active .bi {
  color: var(--gh-primary);
}
.gh-promo {
  background: #efeafe;
  border-radius: var(--gh-radius);
  padding: 1.1rem;
}
.gh-btn-violet {
  background: var(--gh-violet);
  color: #fff;
  font-weight: 600;
  border-radius: 0.6rem;
}
.gh-btn-violet:hover {
  background: #6d2bd9;
  color: #fff;
}

/* ============ Hero ============ */
.gh-hero {
  background: linear-gradient(110deg, #3730c9 0%, #4f3fe0 45%, #6d3df0 100%);
  min-height: 230px;
}
.gh-hero-content {
  z-index: 2;
  max-width: 60%;
}
.gh-hero .btn-outline-light {
  border-radius: 0.6rem;
  font-weight: 600;
}
.gh-hero-art {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.gh-hero-img {
  position: absolute;
  right: 1.75rem;
  top: 50%;
  transform: translateY(-50%);
  max-height: 78%;
  max-width: 42%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.25));
}
.gh-art {
  position: absolute;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.25));
}
.gh-art-pad {
  font-size: 7rem;
  right: 6%;
  top: 50%;
  transform: translateY(-50%) rotate(-8deg);
}
.gh-art-trophy {
  font-size: 4.5rem;
  right: 28%;
  bottom: 8%;
}
.gh-art-star {
  font-size: 2.2rem;
  right: 32%;
  top: 12%;
}
.gh-art-cube {
  font-size: 2rem;
  right: 3%;
  top: 8%;
  transform: rotate(15deg);
}
@media (max-width: 767.98px) {
  .gh-hero-content {
    max-width: 100%;
  }
  .gh-art-pad {
    font-size: 4rem;
    right: 2%;
    top: 12%;
    transform: rotate(-8deg);
  }
  .gh-art-trophy,
  .gh-art-star,
  .gh-art-cube {
    display: none;
  }
}

/* ============ Cards ============ */
.gh-card {
  border: 1px solid var(--gh-border);
  border-radius: var(--gh-radius);
  box-shadow: var(--gh-shadow);
}

.gh-game-card {
  border: 1px solid var(--gh-border);
  border-radius: var(--gh-radius);
  background: var(--gh-card-bg);
  box-shadow: var(--gh-shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.gh-game-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--gh-hover-shadow);
}
.gh-game-thumb {
  aspect-ratio: var(--gh-thumb-aspect, 16 / 9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  overflow: hidden;
  position: relative;
}
/* Premium ribbon overlaid on a game card's thumbnail. */
.gh-premium-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.4;
  color: #3a2a00;
  background: linear-gradient(135deg, #ffd66b, #f5a623);
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  pointer-events: none;
}
.gh-sub-plan:hover { background: rgba(0, 0, 0, 0.02); }
.gh-game-thumb img {
  max-width: 60%;
  max-height: 70%;
  object-fit: contain;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.12));
}
/* 16:9 thumbnail image fills the whole card edge-to-edge. */
.gh-game-thumb img.gh-thumb-full {
  max-width: none;
  max-height: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: none;
}
/* Rotating pastel tile backgrounds */
.gh-tile-0 { background: linear-gradient(135deg, #ddd9ff, #c9c2f8); }
.gh-tile-1 { background: linear-gradient(135deg, #d9f3e0, #c3ecd2); }
.gh-tile-2 { background: linear-gradient(135deg, #ffe8d2, #ffd9b8); }
.gh-tile-3 { background: linear-gradient(135deg, #ffdff0, #fcc9e4); }
.gh-tile-4 { background: linear-gradient(135deg, #d8ecff, #c2dffc); }
.gh-tile-5 { background: linear-gradient(135deg, #fff3c4, #ffe9a3); }

/* Category badges */
.gh-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.3rem 0.6rem;
  border-radius: 0.5rem;
}
.gh-badge-arcade { background: #ede9fe; color: #6d28d9; }
.gh-badge-puzzle { background: #d1fae5; color: #047857; }
.gh-badge-action { background: #ffedd5; color: #c2410c; }
.gh-badge-strategy { background: #e0e7ff; color: #4338ca; }
.gh-badge-racing { background: #fee2e2; color: #b91c1c; }
.gh-badge-sports { background: #dcfce7; color: #15803d; }
.gh-badge-adventure { background: #fef9c3; color: #a16207; }
.gh-badge-default { background: #e5e7eb; color: #374151; }

/* ============ Right column widgets ============ */
.gh-progress {
  height: 0.55rem;
  border-radius: 1rem;
  background-color: #e7e9f2;
}
.gh-progress .progress-bar {
  background-color: var(--gh-primary);
  border-radius: 1rem;
}
.gh-reward {
  background: #e7f7ec;
  color: #157347;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 0.7rem;
  padding: 0.7rem 0.9rem;
}
.gh-lb-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.45rem 0;
}
.gh-lb-rank {
  width: 1.4rem;
  text-align: center;
  font-weight: 700;
  color: var(--gh-muted);
}
.gh-lb-avatar {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: #eef1fb;
}
.gh-lb-name {
  font-weight: 600;
  flex-grow: 1;
}
.gh-lb-pts {
  font-weight: 600;
  color: var(--gh-muted);
  font-size: 0.9rem;
}

/* ============ In-page game player (iframe overlay) ============ */
.gh-no-scroll {
  overflow: hidden;
}
.gh-player {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  background: #101218;
}
.gh-player-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  color: #fff;
  background: #181b24;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.gh-logo-sm {
  width: 1.9rem;
  height: 1.9rem;
  font-size: 0.95rem;
  border-radius: 0.55rem;
}
.gh-player-title {
  font-weight: 700;
}
.gh-player-btn {
  width: 2.3rem;
  height: 2.3rem;
  border: none;
  border-radius: 0.6rem;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.gh-player-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}
.gh-player-stage {
  position: relative;
  flex-grow: 1;
  background: #000;
}
.gh-player-stage iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.gh-player-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: radial-gradient(1200px 600px at 50% 30%, #232737, #101218);
  transition: opacity 0.35s ease;
}
.gh-player-loading.gh-done {
  opacity: 0;
  pointer-events: none;
}
.gh-player-icon {
  font-size: 3.5rem;
  animation: gh-bounce 1.2s ease-in-out infinite;
}
/* Icon-image variant of the splash/loading icon: the container is sized by
   font-size for the emoji fallback, so give the image its own fixed box. */
.gh-player-icon img {
  width: 5.5rem;
  height: 5.5rem;
  object-fit: cover;
  border-radius: 1.1rem;
}
@keyframes gh-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.gh-player-loadbar {
  width: min(420px, 70vw);
  height: 0.6rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.gh-player-loadbar-fill {
  height: 100%;
  width: 0%;
  border-radius: 1rem;
  background: linear-gradient(90deg, var(--gh-primary), var(--gh-violet));
  transition: width 0.25s ease;
}
.gh-player-loadtext {
  font-weight: 600;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.65);
}
.gh-player-loadtext.gh-error {
  color: #f87171;
}
.gh-player-splash {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: radial-gradient(1200px 600px at 50% 30%, #232737, #101218);
}
.gh-player-splash[hidden] {
  display: none;
}
.gh-player-splash-title {
  color: #fff;
  font-weight: 800;
  font-size: 1.6rem;
}
.gh-player-playbtn {
  padding: 0.7rem 3.2rem;
  font-size: 1.25rem;
  font-weight: 700;
  border-radius: 0.8rem;
}

/* ============ Play page stage (CrazyGames-style) ============ */
.gh-stage-card {
  border-radius: var(--gh-radius);
  overflow: hidden;
  box-shadow: var(--gh-hover-shadow);
  background: #101218;
  /* Cap the width so the portrait (9:16) stage's derived height never exceeds
     the viewport. On phones this ≈ column width (fills, stands tall); on desktop
     it becomes a centered phone-like portrait frame. 180px reserves the navbar,
     page padding and the stage action bar. */
  max-width: calc((100vh - 180px) * 9 / 16);
  max-width: calc((100dvh - 180px) * 9 / 16);
  margin-inline: auto;
}
.gh-stage {
  position: relative;
  aspect-ratio: 9 / 16;
  background: #000;
}
/* Fullscreen: center the portrait game (letterboxed) instead of stretching it */
.gh-stage:fullscreen {
  max-width: none;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gh-stage:fullscreen #unity-canvas,
.gh-stage:fullscreen .gh-stage-frame {
  position: relative;
  inset: auto;
  width: auto;
  height: 100%;
  aspect-ratio: 9 / 16;
  max-width: 100%;
}
/* Desktop (≥992px, lg): landscape 16:9 stage filling the main column */
@media (min-width: 992px) {
  .gh-stage {
    aspect-ratio: 16 / 9;
  }
  .gh-stage-card {
    max-width: none;
  }
  /* Landscape fullscreen: let the canvas/iframe fill the screen normally */
  .gh-stage:fullscreen {
    display: block;
  }
  .gh-stage:fullscreen #unity-canvas,
  .gh-stage:fullscreen .gh-stage-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    max-width: none;
  }
}
.gh-stage #unity-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000;
}
.gh-stage-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.gh-stage-bar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 1rem;
  background: #181b24;
  /* The stage card is always portrait-narrow now, so keep the title on one line
     and never shrink the action buttons; scroll horizontally as a last resort. */
  overflow-x: auto;
}
.gh-stage-bar > .fw-bold {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gh-stage-bar > .ms-auto {
  flex-shrink: 0;
}
.gh-stage-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.55rem;
  background: rgba(255, 255, 255, 0.1);
  font-size: 1.1rem;
}
.gh-stage-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.3rem;
  height: 2.3rem;
  padding: 0 0.55rem;
  border: none;
  border-radius: 0.6rem;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  transition: background 0.15s ease;
}
.gh-stage-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}
.gh-stage-btn.gh-active {
  background: var(--gh-primary);
}
.gh-info-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.6rem;
  height: 3.6rem;
  border-radius: 0.9rem;
  font-size: 1.8rem;
  flex-shrink: 0;
}
.gh-info-stats {
  border: 1px solid var(--gh-border);
  border-radius: 0.8rem;
  padding: 0.55rem 0;
}
.gh-mini-card {
  display: block;
  border: 1px solid var(--gh-border);
  background: var(--gh-card-bg);
  border-radius: 0.9rem;
  padding: 0.7rem;
  box-shadow: var(--gh-shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.gh-mini-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--gh-hover-shadow);
}
.gh-mini-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 10;
  border-radius: 0.7rem;
  font-size: 2.2rem;
}
.gh-upnext {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 0.9rem;
  padding: 1.4rem 1rem;
  background: linear-gradient(120deg, #3730c9, #7c3aed);
}
.gh-upnext-icon {
  font-size: 2.6rem;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.35));
}
.gh-upnext-title {
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
  text-align: center;
}
.gh-upnext-hot {
  position: absolute;
  bottom: 0.6rem;
  left: 0.6rem;
}

/* ============ Play page global leaderboard widget ============ */
.gh-lbw-tabs {
  display: flex;
  gap: 0.25rem;
  background: var(--gh-bg);
  border-radius: 0.7rem;
  padding: 0.25rem;
}
.gh-lbw-tab {
  flex: 1;
  border: none;
  background: transparent;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--gh-muted);
  border-radius: 0.5rem;
  padding: 0.45rem 0.3rem;
}
.gh-lbw-tab.active {
  background: var(--gh-primary);
  color: #fff;
}

.gh-lbw-podium {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  align-items: end;
  margin-bottom: 0.5rem;
}
.gh-lbw-pod {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  border-radius: 0.9rem;
  padding: 1.8rem 0.4rem 0.8rem;
  text-align: center;
}
.gh-lbw-pod-1 { background: linear-gradient(180deg, #fff2bf, #ffe084); padding-top: 2.4rem; }
.gh-lbw-pod-2 { background: linear-gradient(180deg, #eef1fb, #dfe4f2); }
.gh-lbw-pod-3 { background: linear-gradient(180deg, #ffe7d4, #ffd2b0); }
.gh-lbw-pod-empty { background: var(--gh-bg); min-height: 7rem; }
.gh-lbw-crown {
  position: absolute;
  top: -1.15rem;
  font-size: 1.4rem;
}
.gh-lbw-pod-av {
  width: 3rem;
  height: 3rem;
  margin-top: -3rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: #fff;
  border: 2px solid #fff;
  box-shadow: 0 3px 8px rgba(20, 24, 60, 0.16);
}
.gh-lbw-pod-1 .gh-lbw-pod-av {
  width: 3.6rem;
  height: 3.6rem;
  margin-top: -3.6rem;
  font-size: 1.85rem;
}
.gh-lbw-pod-name {
  font-weight: 700;
  font-size: 0.8rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gh-lbw-pod-pts {
  font-size: 0.72rem;
  font-weight: 600;
  color: #7a6a3a;
}
.gh-lbw-pod-2 .gh-lbw-pod-pts { color: #5b6173; }
.gh-lbw-pod-3 .gh-lbw-pod-pts { color: #8a5a3a; }
.gh-lbw-pod-rank {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1;
  color: rgba(0, 0, 0, 0.22);
}
.gh-lbw-pod-1 .gh-lbw-pod-rank { color: #d99a00; }

.gh-lbw-lv {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.12rem 0.4rem;
  border-radius: 0.4rem;
  white-space: nowrap;
}
.gh-lbw-lv-gold { background: #fef3c7; color: #b45309; }
.gh-lbw-lv-green { background: #d1fae5; color: #047857; }
.gh-lbw-lv-teal { background: #cffafe; color: #0e7490; }
.gh-lbw-lv-violet { background: #ede9fe; color: #6d28d9; }
.gh-lbw-lv-blue { background: #dbeafe; color: #1d4ed8; }
.gh-lbw-lv-rose { background: #ffe4e6; color: #be123c; }

.gh-lbw-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--gh-border);
}
.gh-lbw-row-rank {
  width: 1.3rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--gh-muted);
}
.gh-lbw-row-av {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  background: #eef1fb;
}
.gh-lbw-row-name {
  font-weight: 600;
  font-size: 0.9rem;
  flex-grow: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gh-lbw-row-pts {
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
}

.gh-lbw-you {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: rgba(35, 80, 245, 0.06);
  border: 1px solid rgba(35, 80, 245, 0.15);
  border-radius: 0.9rem;
  padding: 0.8rem;
}
.gh-lbw-you-cta {
  display: block;
  text-align: center;
}
.gh-lbw-you-rankbox { text-align: center; min-width: 2.4rem; }
.gh-lbw-you-rank {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--gh-primary);
}
.gh-lbw-you-total {
  font-size: 0.68rem;
  color: var(--gh-muted);
}
.gh-lbw-up { color: #16a34a; font-weight: 600; }

/* ============ Play page (/play/:slug) ============ */
.gh-playpage {
  background: #101218;
  overflow: hidden;
}
.gh-playpage .gh-player {
  position: fixed;
  inset: 0;
}
.gh-playpage #unity-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000;
}
.gh-play-leaderboard {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  z-index: 4;
  width: min(300px, 85vw);
  max-height: calc(100% - 1.6rem);
  overflow-y: auto;
  background: rgba(24, 27, 36, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  padding: 1rem;
  backdrop-filter: blur(6px);
}

/* ============ Upload page ============ */
.gh-upload-card {
  max-width: 640px;
  margin: 2.5rem auto;
}
.gh-upload-drop {
  border: 2px dashed var(--gh-border);
  border-radius: var(--gh-radius);
  padding: 1.6rem;
  text-align: center;
  color: var(--gh-muted);
  background: #f8f9fc;
}

/* ============ Leaderboard page ============ */
.gh-nav-pill.active {
  background: rgba(35, 80, 245, 0.1);
  border-radius: 0.7rem;
  color: var(--gh-primary) !important;
  padding-left: 0.9rem;
  padding-right: 0.9rem;
}
.gh-side-sub {
  margin-left: 0.6rem;
}
.gh-side-sub .gh-side-link {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  font-weight: 500;
  font-size: 0.92rem;
}
.gh-lb-crown {
  font-size: 1.8rem;
}
.gh-lb-tabs {
  display: inline-flex;
  background: #fff;
  border: 1px solid var(--gh-border);
  border-radius: 0.7rem;
  padding: 0.25rem;
  gap: 0.25rem;
}
.gh-lb-tab {
  border: none;
  background: transparent;
  font-weight: 600;
  color: var(--gh-muted);
  border-radius: 0.5rem;
  padding: 0.35rem 1.1rem;
}
.gh-lb-tab.active {
  background: rgba(35, 80, 245, 0.1);
  color: var(--gh-primary);
}
.gh-lb-table thead th {
  border-bottom: 1px solid var(--gh-border);
  padding-top: 1rem;
  padding-bottom: 0.75rem;
  font-weight: 600;
}
.gh-lb-table td {
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}
.gh-lb-medal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: #f1f3fa;
  font-weight: 700;
  color: var(--gh-muted);
}
.gh-lb-merow {
  background: rgba(35, 80, 245, 0.06);
}
.gh-lb-avatar2 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  background: #eef1fb;
  margin-right: 0.6rem;
  font-size: 1.1rem;
}
.gh-profile-card {
  background: linear-gradient(160deg, #f6f3ff 0%, #ffffff 70%);
}
.gh-lb-avatar-big {
  width: 4.5rem;
  height: 4.5rem;
  margin: 0 auto 0.6rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #e4dcff, #d4e2ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
}
.gh-profile-stats {
  border-top: 1px solid var(--gh-border);
  padding-top: 0.9rem;
}
.gh-stat-ic {
  font-size: 1.25rem;
  line-height: 1;
  margin-bottom: 0.25rem;
}
.gh-profile-edit {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  width: 1.9rem;
  height: 1.9rem;
  border: 1px solid var(--gh-border);
  border-radius: 0.55rem;
  background: #fff;
  color: var(--gh-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.gh-profile-edit:hover {
  color: var(--gh-primary);
  border-color: var(--gh-primary);
}
.gh-season-gem {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 0.9rem;
  background: #eef1fb;
  font-size: 1.5rem;
}
.gh-topgame {
  cursor: pointer;
  border-radius: 0.5rem;
  padding-left: 0.3rem;
  padding-right: 0.3rem;
}
.gh-topgame:hover {
  background: rgba(35, 80, 245, 0.06);
}
.gh-topgame-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.55rem;
  background: #eef1fb;
  overflow: hidden;
}
/* Thumbnail image filling any small game badge (top-games list, recently
   played, mini cards, splash/loading icons). Falls back to the emoji when a
   game has no thumbnail. */
.gh-topgame-icon img,
.gh-recent-icon img,
.gh-mini-thumb img,
.gh-badge-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}
.gh-ach-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.7rem;
  background: #fff6e0;
  font-size: 1.2rem;
}
.gh-social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.6rem;
  background: #eef1fb;
  color: var(--gh-primary);
  text-decoration: none;
}
.gh-social:hover {
  background: var(--gh-primary);
  color: #fff;
}

/* ============ Browse by category pills ============ */
.gh-cat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}
.gh-cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid var(--gh-border);
  background: var(--gh-card-bg);
  border-radius: 0.9rem;
  padding: 0.55rem 1.1rem 0.55rem 0.6rem;
  font-weight: 600;
  color: var(--gh-text);
  box-shadow: var(--gh-shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.gh-cat-pill:hover {
  transform: translateY(-2px);
  box-shadow: var(--gh-hover-shadow);
  color: var(--gh-primary);
}
.gh-cat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.65rem;
  font-size: 1.05rem;
}
.gh-cat-arcade { background: #ede9fe; color: #6d28d9; }
.gh-cat-puzzle { background: #d1fae5; color: #047857; }
.gh-cat-action { background: #ffedd5; color: #c2410c; }
.gh-cat-strategy { background: #e0e7ff; color: #4338ca; }
.gh-cat-racing { background: #fef9c3; color: #a16207; }
.gh-cat-more { background: #e5e7eb; color: #374151; }

/* ============ Recently played ============ */
.gh-recent-card {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  border: 1px solid var(--gh-border);
  background: var(--gh-card-bg);
  border-radius: 0.9rem;
  padding: 0.55rem 0.8rem;
  box-shadow: var(--gh-shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.gh-recent-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--gh-hover-shadow);
}
.gh-recent-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 0.7rem;
  font-size: 1.3rem;
  flex-shrink: 0;
}

/* ============ Pagination ============ */
.gh-pagination .page-link {
  border: none;
  border-radius: 0.6rem;
  margin: 0 0.15rem;
  color: var(--gh-text);
  font-weight: 600;
}
.gh-pagination .page-item.active .page-link {
  background: var(--gh-primary);
  color: #fff;
}
.gh-pagination .page-item.disabled .page-link {
  color: #c3c6d1;
}

/* ============ Responsive ============ */
/* Tablet & down: collapsed navbar gets a full-width search and roomier links */
@media (max-width: 991.98px) {
  .gh-nav-search {
    max-width: 100%;
  }
  #ghNav .navbar-nav {
    gap: 0.15rem;
    margin-bottom: 0.5rem;
  }
  #ghNav .gh-nav-link {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }
}

/* Phones: stack toolbar controls, trim the leaderboard table, tame overflow */
@media (max-width: 575.98px) {
  /* Grid header toolbar: search takes a full row, selects share the next */
  .gh-search-sm {
    width: 100%;
  }
  .gh-search-sm.gh-search {
    flex: 1 1 100%;
  }
  .gh-select {
    flex: 1 1 auto;
    width: auto;
  }

  /* Leaderboard: hide Games Played (3rd) and Average Score (5th) columns.
     Header and body share column order, so this stays aligned regardless of
     how leaderboard.js renders rows; table-responsive still scrolls as fallback. */
  .gh-lb-table th:nth-child(3),
  .gh-lb-table td:nth-child(3),
  .gh-lb-table th:nth-child(5),
  .gh-lb-table td:nth-child(5) {
    display: none;
  }

  /* Hero: smaller heading + hide decorative art so it can't overlap text */
  .gh-hero {
    min-height: 200px;
  }
  .gh-hero-content .display-6 {
    font-size: 1.6rem;
  }
  .gh-hero-art,
  .gh-hero-img {
    display: none;
  }

  /* Compact game cards so the 2-up grid (and smaller featured rail) stays readable */
  .gh-game-thumb {
    font-size: 3rem;
  }
  .gh-game-card > .p-3 {
    padding: 0.7rem !important;
  }
  .gh-game-card .fw-bold {
    font-size: 0.92rem;
  }
  .gh-game-card .justify-content-between {
    flex-wrap: wrap;
    gap: 0.25rem;
  }
  .gh-game-card .btn {
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
  }

  /* Upload form: less top margin and side gutters (card has no container) */
  .gh-upload-card {
    margin: 1.25rem 0.75rem;
  }
}

/* ============ Mobile app shell (header icons + bottom tab bar) ============ */
.gh-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 1px solid var(--gh-border);
  background: #fff;
  color: var(--gh-text);
  font-size: 1.05rem;
  transition: background 0.15s ease;
}
.gh-nav-icon:hover {
  background: var(--gh-bg);
}
.gh-nav-bell {
  position: relative;
}
.gh-nav-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.05rem;
  text-align: center;
}

/* Bottom tab bar is mobile-only */
.gh-tabbar {
  display: none;
}

@media (max-width: 991.98px) {
  /* Clear the fixed bottom bar */
  body {
    padding-bottom: 4.75rem;
  }

  /* The tapped search icon reveals the field as its own full-width row */
  #ghNavSearch.gh-nav-search {
    flex: 0 0 100%;
    margin-top: 0.5rem;
  }

  .gh-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: 0.25rem;
    height: 4.4rem;
    padding: 0.5rem 0.5rem calc(0.5rem + env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid var(--gh-border);
    box-shadow: 0 -2px 12px rgba(20, 24, 60, 0.06);
  }
  .gh-tab {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 0.15rem;
    padding: 0.25rem 0.1rem;
    border: none;
    background: transparent;
    color: var(--gh-muted);
    text-decoration: none;
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    min-width: 0;
  }
  .gh-tab i {
    font-size: 1.2rem;
  }
  .gh-tab span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }
  .gh-tab-active {
    color: var(--gh-primary);
  }
  .gh-tab-fab {
    color: var(--gh-primary);
  }
  .gh-fab-ic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.2rem;
    height: 3.2rem;
    margin-top: -1.7rem;
    margin-bottom: 0.1rem;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, var(--gh-primary), var(--gh-violet));
    box-shadow: 0 8px 18px rgba(35, 80, 245, 0.4);
  }
  .gh-fab-ic i {
    font-size: 1.5rem;
  }

  /* Horizontal-scroll rails for Recently Played + Featured */
  #recentList,
  #featuredGames {
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  #recentList::-webkit-scrollbar,
  #featuredGames::-webkit-scrollbar {
    display: none;
  }
  #recentList > .col {
    flex: 0 0 auto;
    width: 15rem;
    scroll-snap-align: start;
  }
  #featuredGames > .col {
    flex: 0 0 auto;
    width: 60%;
    scroll-snap-align: start;
  }
}

/* CSS full-viewport fallback for browsers without element fullscreen (iOS Safari).
   The fullscreen button toggles .gh-fakefs; the stage card covers the whole
   viewport, game above, controls bar (with the same button) at the bottom. */
.gh-stage-card.gh-fakefs {
  position: fixed;
  inset: 0;
  z-index: 2000;
  max-width: none !important;
  border-radius: 0 !important;
  display: flex;
  flex-direction: column;
}
.gh-stage-card.gh-fakefs .gh-stage {
  flex: 1 1 auto;
  height: auto !important;
  aspect-ratio: auto !important;
}
.gh-stage-card.gh-fakefs .gh-stage-bar {
  flex: 0 0 auto;
}
body.gh-fakefs-lock {
  overflow: hidden;
}

/* ============ Immersive mobile play (CrazyGames-style) ============ */
/* Exit button that lives inside the stage action bar (shown only in immersive). */
.gh-stage-exit {
  display: none;
  align-items: center;
  background: var(--gh-primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.4rem 0.85rem;
  border-radius: 0.5rem;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
  flex: 0 0 auto;
}
.gh-stage-exit:hover,
.gh-stage-exit:focus {
  background: var(--gh-primary-dark);
  color: #fff;
}

/* On phones, html.gh-immersive turns the play page into a full-screen game:
   the navbar is hidden and the stage action bar becomes a single sticky top bar
   (Exit on the left, like/share/fullscreen on the right) with the game filling
   the rest. Info card / More Games / leaderboard remain below — scroll to reach. */
@media (max-width: 991.98px) {
  html.gh-immersive .gh-navbar,
  html.gh-immersive #mobileTabbar { display: none !important; }
  html.gh-immersive body { padding-bottom: 0 !important; }
  html.gh-immersive .container-fluid.py-4 { padding: 0 !important; }
  html.gh-immersive .container-fluid.py-4 > .row {
    --bs-gutter-x: 0;
    --bs-gutter-y: 0;
    margin: 0 !important;
  }
  html.gh-immersive #mainContent { padding: 0 !important; }
  html.gh-immersive .gh-stage-card {
    max-width: none !important;
    border-radius: 0 !important;
    display: flex;
    flex-direction: column-reverse; /* action bar moves to the top, game below */
  }
  /* The action bar is the sticky top control bar */
  html.gh-immersive .gh-stage-bar {
    position: sticky;
    top: 0;
    z-index: 1035;
  }
  html.gh-immersive .gh-stage-exit { display: inline-flex !important; }
  html.gh-immersive #barIcon,
  html.gh-immersive #barTitle,
  html.gh-immersive #barBadge { display: none !important; }

  /* Compact top bar: smaller height, icons and padding */
  html.gh-immersive .gh-stage-bar {
    padding: 0.25rem 0.5rem;
    gap: 0.3rem;
  }
  html.gh-immersive .gh-stage-bar .gap-1 { gap: 0.25rem !important; }
  html.gh-immersive .gh-stage-btn {
    min-width: 1.85rem;
    height: 1.85rem;
    padding: 0 0.35rem;
    border-radius: 0.45rem;
    font-size: 0.85rem;
  }
  html.gh-immersive .gh-stage-btn i { font-size: 0.9rem; }
  html.gh-immersive .gh-stage-btn .small { font-size: 0.72rem; }
  html.gh-immersive .gh-stage-exit {
    padding: 0.3rem 0.6rem;
    font-size: 0.78rem;
    border-radius: 0.45rem;
  }
  /* Game fills the viewport minus the compact top bar (~40px) */
  html.gh-immersive .gh-stage {
    aspect-ratio: auto !important;
    height: calc(100dvh - 40px) !important;
  }
}

/* ---------- Avatar images (chip + rail) ---------- */
.gh-user-avatar img,
.gh-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* Initials fallback: fills the parent circle and supplies its own color.
   Font size is inherited from each circle (chip / modal / rail). */
.gh-avatar-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 0.92em;
  letter-spacing: 0.02em;
  line-height: 1;
}
.gh-lb-avatar-big .gh-avatar-img,
.gh-lb-avatar-big img {
  width: 100%;
  height: 100%;
}

/* ---------- Edit Profile modal ---------- */
.gh-profile-section {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--gh-text);
  margin: 1.25rem 0 0.75rem;
}
.gh-profile-section:first-of-type {
  margin-top: 0;
}
.gh-profile-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, #e4dcff, #d4e2ff);
  font-size: 2.1rem;
}
.gh-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gh-profile-switch {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding-left: 0;
}
.gh-profile-switch .form-check-input {
  flex: 0 0 auto;
  width: 2.4rem;
  height: 1.3rem;
  margin-top: 0.1rem;
  margin-left: 0;
  cursor: pointer;
  order: 2;
}
.gh-profile-switch .form-check-label {
  order: 1;
  flex-grow: 1;
  cursor: pointer;
}

/* Two-pane section nav — shared by the admin dashboard and the game-edit modal.
   Left vertical nav (icon + title + subtitle) with one .gh-panel shown at a time;
   collapses to a horizontal scroll strip on phones. */
.gh-emodal { display: flex; gap: 1.75rem; align-items: stretch; }
.gh-emodal-nav { flex: 0 0 238px; display: flex; flex-direction: column; gap: .15rem;
  border-right: 1px solid var(--gh-border, #e9eaf0); padding-right: 1rem; }
.gh-emodal-main { flex: 1 1 auto; min-width: 0; }
.gh-emodal-navbtn {
  display: flex; align-items: flex-start; gap: .65rem; width: 100%; text-align: left;
  border: 0; background: transparent; border-radius: .55rem; padding: .6rem .75rem; color: inherit;
  transition: background .12s ease, color .12s ease;
}
.gh-emodal-navbtn:hover { background: var(--gh-bg, #f3f4f8); }
.gh-emodal-navbtn.active {
  background: color-mix(in srgb, var(--gh-primary, #2350f5) 12%, transparent);
  color: var(--gh-primary, #2350f5);
}
.gh-emodal-navbtn .bi { font-size: 1.15rem; line-height: 1.3; margin-top: 1px; flex: 0 0 auto; }
.gh-emodal-navbtn .gh-nav-t { display: block; font-weight: 600; line-height: 1.25; }
.gh-emodal-navbtn .gh-nav-s { display: block; font-size: .75rem; line-height: 1.25; margin-top: 2px;
  color: var(--gh-muted, #6b7280); }
.gh-emodal-navbtn.active .gh-nav-s { color: inherit; opacity: .85; }
.gh-panel { animation: ghFade .15s ease; }
/* Hardening: a hidden panel must never render (guards against any stale/conflicting
   display rule leaking a panel's image into the nav), and no image inside the modal
   may exceed its column. */
.gh-emodal .gh-panel[hidden] { display: none !important; }
.gh-emodal img { max-width: 100%; }
.gh-emodal-nav img { display: none; }
@keyframes ghFade { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
@media (max-width: 767.98px) {
  .gh-emodal { flex-direction: column; gap: .75rem; }
  .gh-emodal-nav { flex: 0 0 auto; flex-direction: row; overflow-x: auto; width: 100%;
    border-right: 0; border-bottom: 1px solid var(--gh-border, #e9eaf0); padding-right: 0; padding-bottom: .5rem; }
  .gh-emodal-navbtn { width: auto; flex: 0 0 auto; }
  .gh-emodal-navbtn .gh-nav-s { display: none; }
}

/* ============================================================================
   DARK PURPLE THEME OVERRIDES
   Applies the gaming dark-purple look to every page (home, leaderboard, play,
   upload, admin, auth). Catches hardcoded light surfaces from the rules above
   and re-tints Bootstrap's default white components. Kept at the end so it wins
   on equal specificity.
   ========================================================================== */

/* Page chrome + Bootstrap base re-tint */
body { background-color: var(--gh-bg); color: var(--gh-text); }
.bg-white { background-color: var(--gh-card-bg) !important; }
.text-dark { color: var(--gh-text) !important; }
.text-muted { color: var(--gh-muted) !important; }
.text-black, .text-body { color: var(--gh-text) !important; }
.border, .border-top, .border-bottom, .border-start, .border-end {
  border-color: var(--gh-border) !important;
}
hr { border-color: var(--gh-border); opacity: 1; }

/* Custom-styled scrollbars to match the dark surface */
* { scrollbar-color: rgba(255,255,255,.18) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.24); }

/* Navbar */
.gh-navbar, .gh-navbar.bg-white {
  background-color: rgba(20, 17, 31, 0.92) !important;
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--gh-border) !important;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
  --bs-navbar-color: var(--gh-muted);
  --bs-navbar-hover-color: var(--gh-text);
  --bs-navbar-active-color: var(--gh-text);
  --bs-navbar-brand-color: var(--gh-text);
  --bs-navbar-brand-hover-color: var(--gh-text);
}
.gh-navbar .navbar-brand, .navbar-brand { color: var(--gh-text); }
.gh-nav-bell, .gh-nav-icon {
  background: var(--gh-card-bg);
  border-color: var(--gh-border);
  color: var(--gh-text);
}
.gh-nav-bell:hover, .gh-nav-icon:hover { background: var(--gh-card-bg-2); }
.gh-user-chip { color: var(--gh-text); }

/* Cards — Bootstrap base + custom */
.card {
  --bs-card-bg: var(--gh-card-bg);
  --bs-card-color: var(--gh-text);
  --bs-card-border-color: var(--gh-border);
  --bs-card-cap-bg: var(--gh-card-bg-2);
  background-color: var(--gh-card-bg);
  color: var(--gh-text);
  border-color: var(--gh-border);
}
.gh-card { background-color: var(--gh-card-bg); }

/* Search + form controls */
.gh-search .form-control,
.form-control, .form-select {
  background-color: var(--gh-surface);
  color: var(--gh-text);
  border-color: var(--gh-border);
}
.gh-search .form-control:focus,
.form-control:focus, .form-select:focus {
  background-color: var(--gh-card-bg-2);
  color: var(--gh-text);
  border-color: var(--gh-primary);
  box-shadow: 0 0 0 0.2rem rgba(124, 92, 252, 0.2);
}
.form-control::placeholder { color: var(--gh-muted); opacity: 1; }
.form-control::file-selector-button {
  background: var(--gh-card-bg-2);
  color: var(--gh-text);
  border: 0;
  border-right: 1px solid var(--gh-border);
}
.form-control::file-selector-button:hover { background: var(--gh-surface); color: #fff; }
.form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%239b97bd' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
}
.form-select option { background-color: var(--gh-card-bg); color: var(--gh-text); }
.input-group-text { background-color: var(--gh-card-bg-2); color: var(--gh-muted); border-color: var(--gh-border); }
.form-check-input { background-color: var(--gh-surface); border-color: var(--gh-border-strong); }
.form-check-input:checked { background-color: var(--gh-primary); border-color: var(--gh-primary); }

/* Sidebar — re-tint blue hover/active states to purple + dark promo */
.gh-side-link:hover { background: rgba(124, 92, 252, 0.12); color: var(--gh-primary); }
.gh-side-link.active { background: rgba(124, 92, 252, 0.18); color: #fff; }
.gh-side-link.active .bi { color: var(--gh-primary); }
.gh-promo {
  background: linear-gradient(160deg, rgba(124,92,252,.22), rgba(168,85,247,.12));
  border: 1px solid var(--gh-border);
}

/* Dropdowns / menus (auth user menu, etc.) */
.dropdown-menu {
  --bs-dropdown-bg: var(--gh-card-bg);
  --bs-dropdown-color: var(--gh-text);
  --bs-dropdown-border-color: var(--gh-border);
  --bs-dropdown-link-color: var(--gh-text);
  --bs-dropdown-link-hover-bg: var(--gh-card-bg-2);
  --bs-dropdown-link-hover-color: #fff;
  --bs-dropdown-divider-bg: var(--gh-border);
  box-shadow: 0 12px 30px rgba(0,0,0,.5);
}

/* Modals (edit profile, admin, payment) */
.modal-content {
  background-color: var(--gh-card-bg);
  color: var(--gh-text);
  border: 1px solid var(--gh-border);
}
.modal-header, .modal-footer { border-color: var(--gh-border); }

/* Lists + tables (admin, leaderboard) */
.list-group {
  --bs-list-group-bg: var(--gh-card-bg);
  --bs-list-group-color: var(--gh-text);
  --bs-list-group-border-color: var(--gh-border);
  --bs-list-group-action-hover-bg: var(--gh-card-bg-2);
  --bs-list-group-action-hover-color: #fff;
}
.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--gh-text);
  --bs-table-border-color: var(--gh-border);
  --bs-table-striped-bg: rgba(255,255,255,.03);
  --bs-table-striped-color: var(--gh-text);
  --bs-table-hover-bg: rgba(124,92,252,.1);
  --bs-table-hover-color: #fff;
  color: var(--gh-text);
}
.table > :not(caption) > * > * { border-bottom-color: var(--gh-border); }

/* Pagination */
.pagination, .gh-pagination {
  --bs-pagination-bg: var(--gh-card-bg);
  --bs-pagination-color: var(--gh-text);
  --bs-pagination-border-color: var(--gh-border);
  --bs-pagination-hover-bg: var(--gh-card-bg-2);
  --bs-pagination-hover-color: #fff;
  --bs-pagination-hover-border-color: var(--gh-border);
  --bs-pagination-active-bg: var(--gh-primary);
  --bs-pagination-active-border-color: var(--gh-primary);
  --bs-pagination-disabled-bg: var(--gh-surface);
  --bs-pagination-disabled-color: var(--gh-muted);
  --bs-pagination-disabled-border-color: var(--gh-border);
}

/* Nav tabs / pills (admin) */
.nav-tabs {
  --bs-nav-tabs-border-color: var(--gh-border);
  --bs-nav-tabs-link-hover-border-color: var(--gh-border);
  --bs-nav-tabs-link-active-bg: var(--gh-card-bg);
  --bs-nav-tabs-link-active-color: var(--gh-text);
  --bs-nav-tabs-link-active-border-color: var(--gh-border);
}
.nav-link { color: var(--gh-muted); }
.nav-link:hover { color: var(--gh-text); }

/* Mobile bottom tab bar */
.gh-tabbar { background: rgba(20,17,31,.96) !important; border-top: 1px solid var(--gh-border); }

/* Close buttons need to be visible on dark surfaces */
.btn-close { filter: invert(1) grayscale(100%) brightness(1.6); }

/* Leaderboard / profile / sidebar widgets — light chips & segmented controls */
.gh-lb-tabs, .gh-nav-pill { background: var(--gh-surface); border-color: var(--gh-border); }
.gh-lb-tab.active, .gh-nav-pill.active {
  background: rgba(124, 92, 252, 0.18); color: #fff;
}
.gh-progress { background-color: rgba(255, 255, 255, 0.08); }
.gh-reward { background: rgba(34, 197, 94, 0.12); color: #7fe0a8; }
.gh-lb-avatar, .gh-lb-avatar2, .gh-lbw-row-av, .gh-lb-medal,
.gh-season-gem, .gh-topgame-icon, .gh-social {
  background: var(--gh-card-bg-2);
}
.gh-lbw-pod-av, .gh-profile-edit { background: var(--gh-card-bg-2); border-color: var(--gh-border); }
.gh-lbw-you, .gh-lb-merow, .gh-topgame:hover {
  background: rgba(124, 92, 252, 0.1);
}
.gh-lbw-you { border-color: rgba(124, 92, 252, 0.3) !important; }

/* Dark placeholder tiles behind game thumbnails (shown when no artwork) */
.gh-tile-0 { background: linear-gradient(135deg, #2a2350, #1c1838); }
.gh-tile-1 { background: linear-gradient(135deg, #143a30, #11251f); }
.gh-tile-2 { background: linear-gradient(135deg, #3a2a18, #241a10); }
.gh-tile-3 { background: linear-gradient(135deg, #3a1d30, #241224); }
.gh-tile-4 { background: linear-gradient(135deg, #16304a, #11212f); }
.gh-tile-5 { background: linear-gradient(135deg, #3a3418, #241f10); }

/* ============================================================================
   MOBILE HOME (phones / tablets) — the #mobileHome block, matching the app
   mockup: wordmark header, search, featured carousel, game rails, pill nav.
   The whole block is d-lg-none, so these rules never affect desktop. The hide
   rules for the desktop layout are scoped to body.gh-home-page only.
   ========================================================================== */
.gh-mhome { display: none; }

@media (max-width: 991.98px) {
  .gh-mhome { display: block; padding: 1.1rem 1rem 0; }

  /* Home page only: hide the desktop chrome on phones (other pages keep it). */
  body.gh-home-page .gh-navbar { display: none !important; }
  body.gh-home-page #recent,
  body.gh-home-page #hero,
  body.gh-home-page #featured { display: none !important; }
  body.gh-home-page .container-fluid > .row > aside.col-lg-3 { display: none !important; }
  /* The full catalog grid stays available below the rails (Browse / See All),
     but hidden until the user asks for it. */
  body.gh-home-page #all-games { display: none; }
  body.gh-home-page.gh-show-browse #all-games { display: block; }
  body.gh-home-page .container-fluid { padding-top: 0 !important; }

  /* ---- Header ---- */
  .gh-mhead-row {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem;
  }
  .gh-mhead-logo {
    font-size: 1.8rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.05;
    color: #fff;
  }
  .gh-mhead-logo span { color: var(--gh-primary); }
  .gh-mhead-tag { color: var(--gh-muted); font-size: 0.9rem; margin-top: 0.15rem; }
  .gh-mhead-actions { display: flex; gap: 0.55rem; flex-shrink: 0; }
  .gh-mhead-icon {
    position: relative;
    width: 2.7rem; height: 2.7rem; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--gh-border);
    color: var(--gh-text); font-size: 1.1rem;
  }
  .gh-mhead-icon:active { background: rgba(255, 255, 255, 0.1); }
  .gh-mhead-dot {
    position: absolute; top: 0.45rem; right: 0.5rem;
    width: 0.5rem; height: 0.5rem; border-radius: 50%;
    background: var(--gh-primary); box-shadow: 0 0 0 2px var(--gh-bg);
  }

  /* ---- Search ---- */
  .gh-msearch {
    display: flex; align-items: center; gap: 0.6rem;
    margin-top: 1rem;
    background: var(--gh-card-bg);
    border: 1px solid var(--gh-border);
    border-radius: 0.9rem;
    padding: 0.2rem 0.85rem;
    height: 3.25rem;
  }
  .gh-msearch-ic { color: var(--gh-muted); font-size: 1.05rem; }
  .gh-msearch-input {
    flex: 1 1 auto; min-width: 0;
    background: transparent; border: 0; outline: none;
    color: var(--gh-text); font-size: 0.98rem;
  }
  .gh-msearch-input::placeholder { color: var(--gh-muted); }
  .gh-msearch-filter {
    flex-shrink: 0; border: 0; background: transparent;
    color: var(--gh-primary); font-size: 1.2rem; padding: 0.25rem;
  }

  /* ---- Featured carousel ---- */
  .gh-mfeat { margin-top: 1.1rem; }
  .gh-mfeat-track {
    display: flex; gap: 0.85rem;
    overflow-x: auto; scroll-snap-type: x mandatory;
    -ms-overflow-style: none; scrollbar-width: none;
  }
  .gh-mfeat-track::-webkit-scrollbar { display: none; }
  .gh-mfeat-card {
    position: relative; flex: 0 0 100%; width: 100%;
    height: 13.5rem; border-radius: 1.25rem; overflow: hidden;
    scroll-snap-align: center; display: block;
    box-shadow: var(--gh-shadow);
  }
  .gh-mfeat-bg {
    position: absolute; inset: 0;
    background-size: cover; background-position: center;
  }
  .gh-mfeat-shade {
    position: absolute; inset: 0;
    background: linear-gradient(90deg, rgba(10,8,20,0.92) 0%, rgba(10,8,20,0.55) 45%, rgba(10,8,20,0.12) 100%);
  }
  .gh-mfeat-body {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
    padding: 1.3rem; gap: 0.5rem; max-width: 78%;
  }
  .gh-mfeat-tag {
    display: inline-flex; align-items: center; gap: 0.35rem;
    background: var(--gh-primary); color: #fff;
    font-size: 0.68rem; font-weight: 800; letter-spacing: 0.06em;
    padding: 0.28rem 0.7rem; border-radius: 999px;
  }
  .gh-mfeat-tag .bi { color: #ffd66b; }
  .gh-mfeat-title { color: #fff; font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
  .gh-mfeat-sub {
    color: rgba(255, 255, 255, 0.82); font-size: 0.9rem; line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .gh-mfeat-btn {
    margin-top: 0.35rem;
    display: inline-flex; align-items: center; gap: 0.35rem;
    background: var(--gh-primary); color: #fff;
    font-weight: 700; font-size: 0.95rem;
    padding: 0.6rem 1.2rem; border-radius: 0.85rem;
  }
  .gh-mfeat-dots {
    display: flex; justify-content: center; gap: 0.4rem; margin-top: 0.8rem;
  }
  .gh-mfeat-dot {
    width: 0.45rem; height: 0.45rem; border-radius: 999px;
    background: rgba(255, 255, 255, 0.25); transition: width 0.2s, background 0.2s;
  }
  .gh-mfeat-dot.active { width: 1.3rem; background: var(--gh-primary); }

  /* ---- Rails ---- */
  .gh-mrail { margin-top: 1.6rem; }
  .gh-mrail-head {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.85rem;
  }
  .gh-mrail-title {
    display: inline-flex; align-items: center; gap: 0.5rem;
    font-size: 1.2rem; font-weight: 800; color: var(--gh-text);
  }
  .gh-mrail-emoji { font-size: 1.15rem; }
  .gh-mrail-all {
    display: inline-flex; align-items: center; gap: 0.15rem;
    color: var(--gh-primary); font-weight: 700; font-size: 0.9rem; text-decoration: none;
  }
  .gh-mrail-track {
    display: flex; gap: 0.85rem;
    overflow-x: auto; scroll-snap-type: x proximity;
    -ms-overflow-style: none; scrollbar-width: none;
    padding-bottom: 0.2rem;
  }
  .gh-mrail-track::-webkit-scrollbar { display: none; }

  /* ---- Game card ---- */
  .gh-mcard, .gh-mgrid .gh-mcard {
    flex: 0 0 9.6rem; width: 9.6rem;
    background: var(--gh-card-bg);
    border: 1px solid var(--gh-border);
    border-radius: 1rem; overflow: hidden;
    scroll-snap-align: start;
    display: flex; flex-direction: column;
  }
  .gh-mcard-thumb {
    position: relative; display: flex; align-items: center; justify-content: center;
    aspect-ratio: 1 / 1; font-size: 2.6rem; overflow: hidden; color: #fff;
  }
  .gh-mcard-thumb img { width: 100%; height: 100%; object-fit: cover; }
  .gh-mcard-thumb img:not(.gh-thumb-full) { width: 60%; height: 60%; object-fit: contain; }
  .gh-mcard-body { padding: 0.65rem 0.7rem 0.75rem; display: flex; flex-direction: column; gap: 0.45rem; }
  .gh-mcard-title {
    font-weight: 700; font-size: 0.95rem; color: var(--gh-text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .gh-mcard-meta {
    display: flex; align-items: center; gap: 0.8rem;
    font-size: 0.78rem; color: var(--gh-muted);
  }
  .gh-mcard-meta span { display: inline-flex; align-items: center; gap: 0.25rem; }
  .gh-mcard-meta .bi-star-fill { color: #ffce47; }
  .gh-mcard-play {
    width: 100%; border-radius: 0.7rem; font-weight: 700; font-size: 0.9rem;
    padding: 0.45rem 0.5rem;
    display: inline-flex; align-items: center; justify-content: center;
  }

  /* Search-results grid (2-up) */
  .gh-mgrid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.85rem;
  }
  .gh-mgrid .gh-mcard { flex: none; width: auto; }

  /* Extra bottom space so the floating nav never covers the last rail. */
  .gh-mhome { padding-bottom: 6.5rem; }

  /* ---- Floating pill bottom nav (Home / Browse / Ranks / Profile) ---- */
  .gh-tabbar {
    left: 0.9rem; right: 0.9rem; bottom: 0.9rem;
    height: auto;
    background: rgba(26, 23, 48, 0.96) !important;
    border: 1px solid var(--gh-border);
    border-radius: 1.5rem;
    padding: 0.5rem 0.6rem calc(0.5rem + env(safe-area-inset-bottom));
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    align-items: center;
  }
  .gh-tabbar .gh-tab {
    flex-direction: column; gap: 0.2rem;
    font-size: 0.7rem; padding: 0.45rem 0.3rem; border-radius: 1rem;
    color: var(--gh-muted);
  }
  .gh-tabbar .gh-tab i { font-size: 1.25rem; }
  .gh-tabbar .gh-tab-active {
    flex-direction: row; gap: 0.4rem;
    background: var(--gh-primary); color: #fff;
    padding: 0.6rem 1.1rem; font-weight: 700;
  }
  .gh-tabbar .gh-tab-active i { font-size: 1.15rem; }
}
