:root {
      /* Theme Config - Dark */
      --bg-dark: url("https://ec2-3-92-139-4.compute-1.amazonaws.com/gpmedia/img/catalog/darkcatalog.png");
      --bg-light: url("https://ec2-3-92-139-4.compute-1.amazonaws.com/gpmedia/img/catalog/lightcatalog.png");

      --glass: rgba(255, 255, 255, 0.08);
      --glass-strong: rgba(20, 20, 20, 0.6);
      --glass-border: rgba(255, 255, 255, 0.12);
      --text-primary: #ffffff;
      --text-secondary: rgba(255, 255, 255, 0.6);
      --accent: #60a5fa;
      --accent-glow: rgba(96, 165, 250, 0.4);

      --pill-bg: rgba(255, 255, 255, 0.08);
      --pill-hover: rgba(255, 255, 255, 0.15);

      --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.1);
      --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.3);

      --transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);

      /* Scalable Units */
      --font-main: clamp(0.9rem, 1.2vw, 1.05rem);
      --header-padding: clamp(15px, 2.5vw, 40px);
    }

    [data-theme="light"] {
      /* Light Theme Overrides */
      --glass: rgba(255, 255, 255, 0.75);
      --glass-strong: rgba(255, 255, 255, 0.9);
      --glass-border: rgba(0, 0, 0, 0.06);
      --text-primary: #3f6cb6;
      --text-secondary: #365e96;
      --accent: #2563eb;
      --accent-glow: rgba(37, 99, 235, 0.2);
      --pill-bg: rgba(0, 0, 0, 0.04);
      --pill-hover: rgba(0, 0, 0, 0.08);
      --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.05);
      --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.15);
    }

    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
      -webkit-font-smoothing: antialiased;
    }

    body {
      font-family: 'Outfit', sans-serif;
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      background-color: #000;
      color: var(--text-primary);
      overflow-x: hidden;
    }

    body.no-scroll {
      overflow: hidden;
    }

    /* Content Blur */
    body.blur-active main,
    body.blur-active header {
      filter: blur(8px);
      transition: filter 0.3s ease;
      pointer-events: none;
      /* Prevent clicks on background */
    }

    /* Dynamic Background Layer */
    .bg-layer {
      position: fixed;
      inset: 0;
      background-size: cover;
      background-position: center;
      background-repeat: no-repeat;
      z-index: -2;
      transition: background-image 0.8s ease;
      filter: saturate(40%);
    }

    [data-theme="dark"] .bg-layer {
      background-image: var(--bg-dark);
    }

    [data-theme="light"] .bg-layer {
      background-image: var(--bg-light);
      filter: brightness(1.02);
    }

    /* --- NAVIGATION --- */
    header {
      width: 100%;
      padding: var(--header-padding);
      padding-bottom: 20px;
      display: flex;
      justify-content: center;
      z-index: 100;
      position: relative;
    }

    /* Unified Navbar Pill */
    .nav-pill {
      display: flex;
      align-items: center;
      background: var(--glass);
      border: 1px solid var(--glass-border);
      border-radius: 100px;
      padding: 6px;
      backdrop-filter: blur(16px);
      box-shadow: var(--shadow-lg);
      width: 100%;
      max-width: 900px;
      gap: 8px;
    }

    .nav-item {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 10px 24px;
      color: var(--text-primary);
      text-decoration: none;
      font-weight: 600;
      border-radius: 100px;
      transition: var(--transition);
      white-space: nowrap;
      cursor: pointer;
    }

    .nav-item:hover,
    .nav-item.active {
      background: var(--pill-hover);
    }

    .nav-item i {
      width: 18px;
      height: 18px;
    }

    .search-container {
      flex: 1;
      position: relative;
      display: flex;
      align-items: center;
      background: var(--pill-bg);
      border-radius: 100px;
      padding: 2px;
      transition: var(--transition);
    }

    .search-container:focus-within {
      background: var(--pill-hover);
      box-shadow: 0 0 0 2px var(--accent-glow);
    }

    .search-input {
      width: 100%;
      border: none;
      background: transparent;
      color: var(--text-primary);
      font-family: inherit;
      font-size: 1rem;
      padding: 10px 16px;
      outline: none;
    }

    .search-input::placeholder {
      color: var(--text-secondary);
    }

    /* --- CONTENT GRIDS --- */
    main {
      width: 100%;
      max-width: 1600px;
      margin: 0 auto;
      padding: 0 var(--header-padding) 60px;
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 40px;
      z-index: 10;
    }

    /* Top Grid */
    .top-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
      gap: 24px;
      width: 100%;
    }

    /* Featured Divider */
    .featured-divider {
      display: flex;
      align-items: center;
      gap: 20px;
      width: 100%;
      margin: 10px 0;
      opacity: 0.9;
    }

    .diamond {
      width: 8px;
      height: 8px;
      background: var(--accent);
      transform: rotate(45deg);
      box-shadow: 0 0 10px var(--accent);
    }

    .divider-line {
      flex: 1;
      height: 2px;
      background: linear-gradient(90deg, var(--accent) 0%, transparent 100%);
      border-radius: 1px;
    }

    .divider-text {
      font-size: 1.25rem;
      font-weight: 700;
      color: var(--text-primary);
      text-transform: uppercase;
      letter-spacing: 1px;
      white-space: nowrap;
    }

    /* Main Grid */
    .main-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
      gap: 24px;
      /* More breathing room for text below */
      width: 100%;
      align-items: start;
    }

    /* Game Card Styling (Redesigned) */
    .game-card {
      display: flex;
      flex-direction: column;
      gap: 12px;
      cursor: pointer;
    }

    .card-image-wrapper {
      aspect-ratio: 1;
      border-radius: 16px;
      overflow: hidden;
      border: 1px solid var(--glass-border);
      background: var(--glass);
      box-shadow: var(--shadow-sm);
      transition: var(--transition);
      position: relative;
    }

    .card-image-wrapper::after {
      content: '';
      position: absolute;
      inset: 0;
      background: rgba(255, 255, 255, 0.1);
      opacity: 0;
      transition: var(--transition);
    }

    .game-card:hover .card-image-wrapper {
      transform: translateY(-6px);
      box-shadow: var(--shadow-lg);
      border-color: var(--accent);
    }

    .game-card:hover .card-image-wrapper::after {
      opacity: 1;
    }

    .game-card img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }

    .card-info {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .card-title {
      color: var(--text-primary);
      font-weight: 700;
      font-size: 1.05rem;
      line-height: 1.3;
    }

    .card-meta {
      color: var(--text-secondary);
      font-size: 0.85rem;
      font-weight: 500;
    }

    /* Loading State */
    .loader {
      grid-column: 1 / -1;
      text-align: center;
      padding: 40px;
      color: var(--text-secondary);
      font-size: 1.2rem;
      animation: pulse 1.5s infinite;
    }

    @keyframes pulse {

      0%,
      100% {
        opacity: 0.5;
      }

      50% {
        opacity: 1;
      }
    }

    /* GAME OVERLAY */
    .game-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.92);
      backdrop-filter: blur(14px);
      z-index: 9999;
      display: none;
      justify-content: center;
      align-items: center;
      flex-direction: column;
      padding: 20px;
      opacity: 0;
      transition: opacity 0.3s ease;
    }

    .game-overlay.active {
      opacity: 1;
    }

    .game-wrapper {
      width: 90vw;
      height: 80vh;
      background: #000;
      border-radius: 16px;
      overflow: hidden;
      box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
      display: flex;
      justify-content: center;
      align-items: center;
      border: 1px solid var(--glass-border);
      position: relative;
    }

    .game-wrapper iframe,
    .game-wrapper object {
      width: 100%;
      height: 100%;
      border: none;
    }

    .overlay-controls {
      margin-top: 20px;
      display: flex;
      gap: 12px;
    }

    .control-btn {
      background: rgba(255, 255, 255, 0.1);
      border: 1px solid rgba(255, 255, 255, 0.2);
      padding: 10px 20px;
      border-radius: 50px;
      color: #fff;
      cursor: pointer;
      font-family: inherit;
      font-weight: 500;
      transition: all 0.2s;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .control-btn:hover {
      background: rgba(255, 255, 255, 0.2);
      transform: translateY(-2px);
    }

    .control-btn i {
      width: 16px;
      height: 16px;
    }

    /* Split Button Group */
    .control-group {
      display: flex;
      background: rgba(255, 255, 255, 0.1);
      border: 1px solid rgba(255, 255, 255, 0.2);
      border-radius: 50px;
      overflow: hidden;
    }

    .control-group .control-btn {
      background: transparent;
      border: none;
      border-radius: 0;
      border-right: 1px solid rgba(255, 255, 255, 0.1);
      margin: 0;
    }

    .control-group .control-btn:last-child {
      border-right: none;
    }

    .control-group .control-btn:hover {
      background: rgba(255, 255, 255, 0.1);
    }

    .filter-modal {
      position: absolute;
      top: 100%;
      margin-top: -10px;
      background: var(--glass);
      backdrop-filter: blur(20px);
      border: 1px solid var(--glass-border);
      padding: 16px;
      border-radius: 16px;
      display: none;
      flex-direction: column;
      gap: 8px;
      min-width: 200px;
      max-height: 80vh;
      overflow-y: auto;
      box-shadow: var(--shadow-lg);
      border: 1px solid var(--glass-border);
      z-index: 200;

      /* Scrollbar */
      scrollbar-width: thin;
      scrollbar-color: var(--glass-border) transparent;
    }

    .filter-modal::-webkit-scrollbar {
      width: 6px;
    }

    .filter-modal::-webkit-scrollbar-thumb {
      background: var(--glass-border);
      border-radius: 4px;
    }

    .filter-modal.active {
      display: flex;
    }

    .filter-option {
      padding: 8px 12px;
      border-radius: 8px;
      cursor: pointer;
      color: var(--text-primary);
      transition: var(--transition);
    }

    .filter-option:hover {
      background: var(--pill-bg);
    }

    @media (max-width: 768px) {
      .nav-pill {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
        border-radius: 24px;
        /* Keep the container glass style active */
        background: var(--glass);
        border: 1px solid var(--glass-border);
        backdrop-filter: blur(16px);
        box-shadow: var(--shadow-lg);
      }

      .nav-item {
        width: 100%;
        justify-content: center;
        /* Remove the individual item box styling we added previously */
        background: transparent;
        border: none;
        backdrop-filter: none;
        padding: 10px;
        border-radius: 12px;
      }

      .nav-item:hover {
        background: var(--pill-hover);
      }

      .search-container {
        width: 100%;
        /* Use standard pill internal bg */
        background: var(--pill-bg);
        border: none;
        padding: 4px;
      }

      /* Responsive Grid Sizing: Keep cards explicitly same size as desktop */
      .top-grid,
      .main-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 16px;
      }
    }

    /* --- UNIFIED LOADER STYLES --- */
    .video-loader {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      display: none;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      background: #000;
      z-index: 10;
    }

    .spinner {
      width: 50px;
      height: 50px;
      border: 3px solid rgba(255, 255, 255, 0.1);
      border-top-color: var(--accent);
      border-radius: 50%;
      animation: spin 1s linear infinite;
      margin-bottom: 15px;
    }

    @keyframes spin {
      to {
        transform: rotate(360deg);
      }
    }

    .loader-text {
      color: #fff;
      font-size: 14px;
      letter-spacing: 1px;
      text-transform: uppercase;
      opacity: 0.8;
      font-weight: 500;
      font-family: 'Outfit', sans-serif;
    }

    /* Favorites Modal */
    .favorites-modal {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      background: var(--glass-strong);
      backdrop-filter: blur(24px);
      border: 1px solid var(--glass-border);
      padding: 24px;
      border-radius: 24px;
      width: 90%;
      max-width: 500px;
      max-height: 80vh;
      z-index: 2000;
      display: none;
      flex-direction: column;
      gap: 16px;
      box-shadow: var(--shadow-lg);
      opacity: 0;
      transition: opacity 0.3s ease;
    }

    .favorites-modal.active {
      display: flex;
      opacity: 1;
    }

    .fav-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding-bottom: 12px;
      border-bottom: 1px solid var(--glass-border);
    }

    .fav-title {
      font-size: 1.5rem;
      font-weight: 700;
      color: var(--text-primary);
    }

    .fav-close {
      background: transparent;
      border: none;
      color: var(--text-secondary);
      cursor: pointer;
      transition: color 0.2s;
    }

    .fav-close:hover {
      color: var(--text-primary);
    }

    .fav-list {
      display: flex;
      flex-direction: column;
      gap: 12px;
      overflow-y: auto;
      padding-right: 4px;
    }

    .fav-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 10px;
      border-radius: 12px;
      background: var(--pill-bg);
      transition: var(--transition);
      cursor: pointer;
    }

    .fav-item:hover {
      background: var(--pill-hover);
      transform: translateX(4px);
    }

    .fav-item img {
      width: 40px;
      height: 40px;
      border-radius: 8px;
      object-fit: cover;
    }

    .fav-item-info {
      flex: 1;
    }

    .fav-item-title {
      font-weight: 600;
      color: var(--text-primary);
      font-size: 1rem;
    }

    .fav-item-remove {
      background: transparent;
      border: none;
      color: #ef4444;
      /* Red for remove */
      cursor: pointer;
      padding: 8px;
      opacity: 0.6;
      transition: opacity 0.2s;
    }

    .fav-item-remove:hover {
      opacity: 1;

    }
