:root {
    /* Light Theme */
    --bg-color: #f5f5f5;
    --header-bg: #ffffff;
    --text-color: #333333;
    --text-light: #666666;
    --card-bg: #ffffff;
    --pill-bg: #f0f2ff;
    --pill-text: #3e51b5;
    --pill-active-bg: #3e51b5;
    --pill-active-text: #ffffff;
    --accent-color: #3e51b5;
    --border-color: rgba(0, 0, 0, 0.1);
    --ad-label-color: #999999;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --placeholder-bg: #e0e0e0;
}

body.dark-theme {
    /* Dark Theme */
    --bg-color: #0e0f27;
    --header-bg: #1b1c3d;
    --text-color: #ffffff;
    --text-light: #bbbddd;
    --card-bg: #1b1c3d;
    --pill-bg: #2d2e5a;
    --pill-text: #ffffff;
    --pill-active-bg: #3e51b5;
    --pill-active-text: #ffffff;
    --accent-color: #3e51b5;
    --border-color: rgba(255, 255, 255, 0.1);
    --ad-label-color: #666666;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    --placeholder-bg: #2d2e5a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
        Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
    line-height: 1.5;
}

/* Header */
.header {
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.header-container {
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 0 20px;
}

.logo img {
    height: 36px;
}

.nav-container {
    flex: 1;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    margin: 0 10px;
}

.nav-pills {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 5px 0;
    scroll-behavior: smooth;
    width: 100%;
}

.nav-pills::-webkit-scrollbar {
    display: none;
}

.pill {
    background-color: var(--pill-bg);
    color: var(--pill-text);
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    height: 36px;
}

.pill.active {
    background-color: var(--pill-active-bg);
    color: var(--pill-active-text);
}

.pill i {
    font-size: 14px;
}

/* Category Page Styles */
.category-view {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Advertisement Module (Part 1) */
.ad-module {
    background-color: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.ad-label-top {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    font-size: 10px;
    color: var(--ad-label-color);
    padding: 10px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mgid-logo {
    position: absolute;
    right: 20px;
    font-weight: bold;
    color: #3e51b5;
    font-size: 14px;
}

.mgid-logo span {
    color: #55acee;
}

.ad-content-wrapper {
    display: flex;
    height: 320px;
    border-top: 1px solid var(--border-color);
}

.ad-image {
    width: 45%;
    background-color: #ddd;
    position: relative;
    overflow: hidden;
}

.ad-image::after {
    content: "Ad Image";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #999;
}

.ad-details {
    flex: 1;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-color: #ffffff;
}

body.dark-theme .ad-details {
    background-color: #1b1c3d;
}

.ad-brand {
    font-size: 14px;
    font-weight: 700;
    color: #2d3748;
    text-transform: uppercase;
    margin-bottom: 12px;
}

body.dark-theme .ad-brand {
    color: #e2e8f0;
}

.ad-title {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-color);
    margin-bottom: 20px;
}

.ad-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.learn-more-btn {
    background-color: #3e4d59;
    color: white;
    padding: 14px 28px;
    border-radius: 2px;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.learn-more-btn:hover {
    background-color: #2d3748;
}

/* Category Grid (Part 2) */
.category-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.category-header h2 {
    font-size: 22px;
    font-weight: 700;
}

.category-game-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 24px;
}

@media (max-width: 1300px) {
    .category-game-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 1000px) {
    .category-game-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 800px) {
    .category-game-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 500px) {
    .category-game-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Search Bar Animation */
.search-wrapper {
    display: flex;
    align-items: center;
    position: relative;
    /* overflow: hidden; */
    /* Remove to allow dropdown to show */
    height: 40px;
    background: var(--pill-bg);
    border-radius: 20px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 40px;
    /* Initial width only showing icon */
    z-index: 1001;
    /* Above header */
}

.search-wrapper.active {
    width: 300px;
}

#search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0 10px;
    color: var(--text-color);
    font-size: 14px;
    outline: none;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.search-wrapper.active #search-input {
    opacity: 1;
    pointer-events: auto;
}

/* Search Results Dropdown */
.search-results-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 350px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    max-height: 500px;
    z-index: 1002;
}

.search-wrapper.active.has-results .search-results-dropdown {
    display: flex;
}

.search-loading {
    padding: 30px;
    text-align: center;
    color: var(--accent-color);
    font-size: 24px;
    display: none;
}

.search-results-dropdown.loading .search-loading {
    display: block;
}

.search-results-dropdown.loading .search-results-content {
    display: none;
}

.search-results-content {
    overflow-y: auto;
}

.search-no-results {
    padding: 30px;
    text-align: center;
    color: var(--text-light);
    border-bottom: 1px solid var(--border-color);
}

.search-featured-header {
    padding: 15px 20px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-color);
    background: rgba(0, 0, 0, 0.02);
}

.search-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    gap: 15px;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}

.search-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.search-item-img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    /* A bit smaller for search but still unified feel */
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.search-item-info {
    flex: 1;
    overflow: hidden;
}

.search-item-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-item-category {
    font-size: 12px;
    color: var(--text-light);
}

.search-item-fav {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    transition: all 0.2s;
}

.search-item-fav:hover {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
}

#search-open {
    display: flex;
    z-index: 2;
}

.search-wrapper.active #search-open {
    /* Optionally change color or style when active, but icon stays */
}

#search-close {
    display: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.search-wrapper.active #search-close {
    display: flex;
    opacity: 1;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 16px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.avatar-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--placeholder-bg);
}

/* Main Content Layout */
.main-content {
    max-width: 1300px;
    margin: 20px auto;
    padding: 0 20px;
}

/* Blank Ad Slots Styles */
.hero-ad-blank {
    background-color: var(--card-bg);
    border-radius: 12px;
    height: 180px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    width: 100%;
}

.sidebar-ad-blank {
    background-color: var(--card-bg);
    border-radius: 12px;
    height: 324px;
    /* Matches the height of the left featured grid (100*3 + 12*2) */
    box-shadow: var(--shadow);
    width: 300px;
}

/* Grid Section */
.grid-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    margin-bottom: 30px;
}

.featured-grid-wrapper {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    height: 100%;
    /* Ensure wrapper takes full height */
}

.featured-grid-flex {
    display: flex;
    gap: 12px;
    width: 100%;
    flex: 1;
    /* Allow grid to stretch and fill available space */
}

.grid-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.grid-sub-row {
    display: flex;
    gap: 12px;
}

.grid-item {
    border-radius: 20px;
    /* Unified rounded corners as per Image 1 */
    background-color: var(--placeholder-bg);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    width: 100%;
    transition: transform 0.2s;
}

.grid-item .fav-icon {
    background-color: rgba(255, 255, 255, 0.9);
    color: #ccc;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.grid-item .fav-icon.active {
    background-color: #ffebee !important;
}

.grid-item .fav-icon.active i {
    color: #ff4757 !important;
}

.grid-item:hover {
    transform: scale(1.02);
}

/* Standard height for small items to ensure alignment across columns */
.grid-item.small {
    height: 100px;
}

/* In a 3-small-item column, they sum to 300px + 2 gaps (24px) = 324px */
/* In a 1-large + 1-subrow column, large should be 324 - 100 - 12 = 212px */
.grid-item.large {
    height: 212px;
}

/* For the 3-small-item column specifically to ensure it matches precisely */
.grid-col:first-child .grid-item.small {
    height: 100px;
}

.grid-col:first-child .grid-item.small:last-child {
    height: 100px;
    /* Could be adjusted if needed, but 100px is standard */
}

.grid-sub-row .grid-item {
    flex: 1;
}

.item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    font-weight: bold;
    font-size: 14px;
    text-align: center;
}

/* Progress Bar below Grid */
.grid-progress-container {
    height: 8px;
    background-color: var(--placeholder-bg);
    border-radius: 4px;
    width: 100%;
    max-width: 600px;
    /* As per first image */
    margin: 0 auto;
    overflow: hidden;
}

.grid-progress-bar {
    height: 100%;
    width: 30%;
    /* Placeholder width */
    background: var(--text-color);
    border-radius: 4px;
    opacity: 0.6;
}

/* Game Sections & Scrolling */
.scroll-section,
.featured-games-module,
.play-again-module {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.scroll-section {
    /* Keep margin as is or rely on shared */
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.scroll-container {
    position: relative;
}

.scroll-content {
    display: flex;
    gap: 15px;
    padding: 10px 5px;
    /* Added small horizontal padding to avoid item clipping */
    overflow-x: auto;
    scrollbar-width: none;
    scroll-behavior: smooth;
    width: 100%;
}

.scroll-content::-webkit-scrollbar {
    display: none;
}

/* Mobile Side: Hide buttons and enable snap scrolling */
@media (max-width: 900px) {
    .scroll-content {
        scroll-snap-type: x mandatory;
    }

    .scroll-btn {
        display: none !important;
    }
}

/* Game Cards Base Style */
.game-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

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

.card-img-placeholder {
    background-color: var(--placeholder-bg);
    position: relative;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Home Page Scrollable Game Cards */
.scroll-content .game-card {
    width: 190px;
    flex-shrink: 0;
    scroll-snap-align: start;
}

.game-card .card-img-placeholder {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 20px;

}

.scroll-content.tall .card-img-placeholder {
    height: 220px;
    aspect-ratio: unset;
}

/* Category Page Grid Game Cards */
.category-game-grid .game-card {
    width: 100%;
}

.fav-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 16px;
    z-index: 10;
    transition: all 0.2s;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.fav-icon.active {
    background-color: #ffebee !important;
    /* 浅粉色背景 */
}

.fav-icon.active i {
    color: #ff4757 !important;
    /* 红色桃心 */
    transform: scale(1.1);
}

.fav-icon:hover i {
    transform: scale(1.2);
}

/* Search result fav icon override */
.search-item-fav {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    transition: all 0.2s;
    cursor: pointer;
}

.search-item-fav.active {
    background-color: #ffebee;
}

.search-item-fav.active i {
    color: #ff4757;
}

/* Play Again Specific Style (Image 2) */
.play-again-module {
    /* Shared styles handled background/padding */
}

.play-again-container {
    width: 100%;
    /* No overflow: hidden here so buttons aren't cut off */
    padding: 0;
    /* Remove top/bottom padding to let scroll buttons be centered vertically correctly */
    position: relative;
}

.play-again-container .scroll-btn {
    opacity: 0;
    transition: opacity 0.3s;
}

.play-again-container:hover .scroll-btn {
    opacity: 1;
}

@media (max-width: 900px) {
    .play-again-container .scroll-btn {
        display: none !important;
    }
}

.play-again-container::-webkit-scrollbar {
    display: none;
}

.play-again-scroll {
    display: flex;
    gap: 20px;
    width: 100%;
}

.play-again-card {
    width: 230px;
    flex-shrink: 0;
    /* Important for scroll-content behavior */
    cursor: pointer;
    transition: transform 0.2s;
}

.play-again-card:hover {
    transform: translateY(-5px);
}

.play-again-card .card-img {
    width: 100%;
    aspect-ratio: 13 / 10;
    /* 横版比例 */
    border-radius: 16px;
    background-size: cover;
    background-position: center;
    position: relative;
    box-shadow: var(--shadow);
    background-color: var(--placeholder-bg);
}

.play-again-card .game-title {
    margin-top: 12px;
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    color: var(--text-color);
    padding: 0 5px;
}

/* Remove specific overrides to keep it consistent */
.category-game-grid .fav-icon,
.featured-game-card .fav-icon {
    background-color: rgba(255, 255, 255, 0.9);
    color: #ccc;
}

.category-game-grid .fav-icon.active,
.featured-game-card .fav-icon.active {
    background-color: #ffebee;
}

.category-game-grid .fav-icon.active i,
.featured-game-card .fav-icon.active i {
    color: #ff4757;
}

.fav-icon:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.game-title {
    width: 100%;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Larger title for category grid */
.category-game-grid .game-title {
    font-size: 14px;
}

.scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--card-bg);
    color: var(--text-color);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    z-index: 20;
    /* Increased z-index to stay on top */
    opacity: 0;
    transition: opacity 0.3s;
}

.scroll-container:hover .scroll-btn {
    opacity: 1;
}

.scroll-btn.prev {
    left: -20px;
}

.scroll-btn.next {
    right: -20px;
}

.scroll-btn:disabled {
    display: none;
}

/* Banners */
.banners-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 40px;
}

.orange-banner-placeholder,
.quiz-banner-placeholder {
    height: 200px;
    border-radius: 12px;
    background-color: var(--placeholder-bg);
    position: relative;
}

.view-all {
    color: #3e51b5;
    text-decoration: none;
    font-size: 14px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
}

.view-all i {
    background-color: #fede34;
    color: #3e51b5;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* Policy Page Styles */
.policy-content {
    background-color: var(--card-bg);
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 40px;
}

.policy-content h1 {
    font-size: 32px;
    margin-bottom: 24px;
    color: var(--text-color);
}

.policy-content h4 {
    font-size: 20px;
    margin-top: 30px;
    margin-bottom: 16px;
    color: var(--text-color);
    border-bottom: 2px solid var(--accent-color);
    display: inline-block;
    padding-bottom: 4px;
}

.policy-content p {
    margin-bottom: 16px;
    color: var(--text-color);
    line-height: 1.8;
}

.policy-content ul {
    margin-bottom: 16px;
    padding-left: 20px;
}

.policy-content li {
    margin-bottom: 8px;
    color: var(--text-color);
}

.policy-content a {
    color: var(--accent-color);
    text-decoration: none;
}

.policy-content a:hover {
    text-decoration: underline;
}

/* Footer Implementation */
.footer {
    padding: 60px 0 20px;
    border-top: 1px solid var(--border-color);
    background-color: var(--header-bg);
    width: 100%;
}

.footer-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.footer-logo img {
    height: 32px;
}

.footer-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.theme-toggle-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fede34;
    padding: 4px 12px;
    border-radius: 20px;
    cursor: pointer;
}

.theme-label {
    font-size: 13px;
    font-weight: bold;
    color: #333;
}

.theme-switch-v2 {
    width: 40px;
    height: 24px;
    background: #fff;
    border-radius: 12px;
    position: relative;
}

.switch-handle {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s;
}

.switch-handle i {
    color: #fede34;
    font-size: 12px;
}

body.dark-theme .switch-handle {
    transform: translateX(16px);
}

body.dark-theme .theme-toggle-container {
    background: #3e51b5;
}

body.dark-theme .theme-label {
    color: #fff;
}

body.dark-theme .switch-handle i {
    color: #3e51b5;
}

.lang-btn {
    background: none;
    border: 1px solid var(--border-color);
    padding: 6px 15px;
    border-radius: 20px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
}

.footer-nav {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.footer-nav a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 14px;
}

.footer-description {
    color: var(--text-light);
    font-size: 12px;
    line-height: 1.8;
    margin-bottom: 40px;
}

.footer-description p {
    margin-bottom: 15px;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-light);
    font-size: 12px;
    font-weight: bold;
}

/* Modal Implementation */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    width: 90%;
    max-width: 400px;
    border-radius: 15px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 20px;
    cursor: pointer;
}

.lang-list {
    display: grid;
    gap: 10px;
}

.lang-option {
    background: var(--pill-bg);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 8px;
    color: var(--text-color);
    cursor: pointer;
    text-align: left;
    transition: background 0.2s;
}

.lang-option:hover {
    background: var(--accent-color);
    color: #fff;
}

/* Featured Games Module Styles (shared background/padding) */
.featured-games-module {
    /* Background/Padding/Shadow/Margin handled by shared class */
}

.featured-games-container {
    width: 100%;
    overflow: hidden;
}

.featured-games-scroll {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
}

.featured-game-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    cursor: pointer;
    transition: transform 0.2s;
    align-items: center;
    width: 170px;
}

.featured-game-card:hover {
    transform: translateY(-5px);
}

.featured-game-card .card-img {
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    position: relative;
    box-shadow: var(--shadow);
}

.featured-game-card .fav-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.2s;
}

.featured-game-card .fav-icon.active i {
    color: #ff4757;
}

.featured-game-card .game-title {
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Fullscreen Game Mode */
body.playing-game-fullscreen {
    overflow: hidden;
}

body.playing-game-fullscreen .header,
body.playing-game-fullscreen .footer,
body.playing-game-fullscreen .game-detail-hero>*:not(#game-play-area),
body.playing-game-fullscreen .recommended-section {
    display: none !important;
}

body.playing-game-fullscreen .main-content {
    padding: 0;
    max-width: 100vw;
}

body.playing-game-fullscreen .game-detail-hero {
    padding: 0;
    margin: 0;
    border-radius: 0;
}

body.playing-game-fullscreen .game-play-area {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    margin: 0;
    z-index: 9999;
}

.fullscreen-exit-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

/* Mobile Adjustments */
@media (max-width: 900px) {
    .grid-container {
        grid-template-columns: 1fr;
    }

    .sidebar-ad-blank {
        display: none;
    }

    .featured-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto;
    }

    .banners-grid {
        grid-template-columns: 1fr;
    }

    .hero-ad-blank {
        height: 120px;
    }

    /* Global Overflow Fix */
    html,
    body {
        overflow-x: hidden;
        width: 100%;
        margin: 0;
        padding: 0;
    }
}

/* Mobile Responsive Logic for Grid Section */
@media (max-width: 768px) {
    .grid-section.hide-on-mobile {
        display: none !important;
    }

    .grid-section.play-again-active .sidebar-ad-blank {
        display: none !important;
    }

    /* Mobile Header Layout Adjustment */
    .header {
        height: auto;
        padding: 10px 0;
    }

    .header-container {
        display: flex;
        flex-wrap: wrap;
        padding: 0 15px;
        gap: 15px 0;
        justify-content: space-between;
        align-items: center;
    }

    .logo {
        order: 1;
        flex: 0 0 auto;
    }

    .logo img {
        height: 32px;
    }

    .header-right {
        order: 2;
        flex: 0 0 auto;
        gap: 10px;
    }

    .nav-container {
        order: 3;
        flex: 0 0 100%;
        width: 100vw;
        margin: 0;
        /* Offset parent padding */
        padding: 10px 0;
        overflow-x: auto;
        overflow-y: hidden;
        border-top: 1px solid var(--border-color);
        scrollbar-width: none;
        /* Firefox */
        -ms-overflow-style: none;
        /* IE 10+ */
        position: relative;
    }

    .nav-container::-webkit-scrollbar {
        display: none;
        /* Chrome/Safari/Webkit */
    }

    .nav-pills {
        display: flex;
        flex-wrap: nowrap;
        animation: navLoop 30s linear infinite;
        width: max-content;
        overflow: clip;
        gap: 12px;
        padding: 0 15px;
        will-change: transform;
    }

    /* Pause animation on manual touch/scroll handled via JS class */
    .nav-pills.paused {
        animation-play-state: paused !important;
    }

    .search-wrapper {
        width: 36px;
        height: 36px;
        background: var(--pill-bg);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .search-wrapper.active {
        width: 180px;
        border-radius: 20px;
        position: absolute;
        right: 15px;
    }

    .user-avatar {
        width: 36px;
        height: 36px;
        border-radius: 8px;
        background-image: url('assets/comet/publishers/xQInlbFVP/logo.png');
        /* Mocking the tarot look */
        background-size: cover;
    }

    /* Add Button style from image */
    .nav-add-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        background: linear-gradient(135deg, #ffcc33, #ff9900);
        color: #fff;
        border-radius: 50%;
        font-size: 20px;
        border: 2px solid #fff;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        position: absolute;
        right: 0;
        z-index: 10;
    }

    .featured-games-container {
        overflow-x: auto;
        scrollbar-width: none;
        margin: 0 -15px;
        padding: 0 15px;
    }

    .featured-games-container::-webkit-scrollbar {
        display: none;
    }

    .featured-games-scroll {
        display: flex;
        flex-wrap: nowrap;
        gap: 15px;
        width: max-content;
    }

    .featured-game-card {
        width: 180px;
    }

    /* Detail page mobile fixes */
    .game-detail-hero {
        padding: 15px;
        margin-bottom: 20px;
    }

    .game-play-area {
        border-radius: 8px;
    }

    .game-info-left {
        gap: 10px;
    }

    .game-icon-small {
        width: 40px;
        height: 40px;
    }

    .game-name-detail {
        font-size: 18px;
    }

    @keyframes navLoop {
        0% {
            transform: translateX(0);
        }

        100% {
            transform: translateX(-50%);
        }
    }

    @keyframes navSlideOnce {
        0% {
            transform: translateX(0);
        }

        100% {
            transform: translateX(var(--slide-distance, -200px));
        }
    }
}

/* Header Container Fix */
.header-container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* Main Content Fix */
.main-content {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

/* Footer Fix */
.footer-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* Game Detail Page Styles */
.game-detail-hero {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 40px;
    box-shadow: var(--shadow);
}

.game-detail-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
    color: var(--text-color);
}

.game-play-area {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background-color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.game-bg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    filter: blur(5px) brightness(0.5);
    z-index: 1;
}

.play-game-btn {
    position: relative;
    z-index: 2;
    background-color: #b34df2;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    box-shadow: 0 4px 15px rgba(179, 77, 242, 0.4);
}

.play-game-btn:hover {
    transform: scale(1.05);
    background-color: #a036e0;
}

.game-iframe-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    display: none;
}

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

.game-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 15px;
}

.game-info-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.game-icon-small {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background-size: cover;
    background-position: center;
}

.game-name-detail {
    font-size: 20px;
    font-weight: 700;
}

.game-stats {
    font-size: 14px;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 5px;
}

.game-description-detail {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    margin-bottom: 20px;
}

.game-tags-detail {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.game-tag {
    padding: 5px 15px;
    border-radius: 15px;
    border: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-light);
    background-color: rgba(0, 0, 0, 0.02);
}

body.dark-theme .game-tag {
    background-color: rgba(255, 255, 255, 0.05);
}

.recommended-section {
    margin-top: 40px;
}

/* Alert Notification Styles */
.alert-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    pointer-events: none;
}

.alert {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-color);
    color: var(--text-color);
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 90vw;
    width: 100%;
    pointer-events: auto;
    min-height: 50px;
}

.alert-icon {
    font-size: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alert-content {
    flex: 1;
    line-height: 1.4;
    font-size: 14px;
}

.alert-close {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    margin-left: 8px;
    flex-shrink: 0;
    transition: color 0.2s;
}

.alert-close:hover {
    color: var(--text-color);
}

/* Alert Type Variants */
.alert.info {
    border-left-color: #2196F3;
}

.alert.success {
    border-left-color: #4CAF50;
}

.alert.warning {
    border-left-color: #FF9800;
}

.alert.error {
    border-left-color: #F44336;
}

/* Alert Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
}

.alert.show {
    animation: slideDown 0.3s ease-out forwards;
}

.alert.hide {
    animation: slideUp 0.3s ease-out forwards;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .alert-container {
        top: 10px;
        left: 10px;
        right: 10px;
        transform: none;
    }

    .alert {
        max-width: none;
        width: calc(100% - 20px);
        font-size: 13px;
        padding: 12px 15px;
    }

    .alert-icon {
        font-size: 18px;
    }
}