@import url("theme.css");

/* =========================================================
   CRRAZYGAME.COM - MODERN HOMEPAGE STYLES (index.css)
   Fully responsive for Mobile, Tablet, and Desktop
   ========================================================= */

/* --- Layout Grid Defaults --- */
.item-1 {
    grid-area: 1 / 1 / 3 / 3 !important;
}

.item-2 {
    grid-area: 6 / 1 / 8 / 3;
}

.ad-1 {
    grid-row: 4;
    grid-column: 1 / -1;
    width: 100%;
}

.ads-tips {
    color: #8e9aaf;
    font-size: 12px;
}

.ads-container {
    width: 100%;
    max-width: 100%;
    min-height: 380px;
    margin: 0 auto;
    padding: 0;
    position: relative;
}

.tops-ads.ads {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    margin: 0;
    padding: 0;
}

.ads-label {
    text-align: center;
}

/* --- Auto-Sliding Category Slider Bar (Only Categories) --- */
.category-slider-wrapper {
    width: 100%;
    background: linear-gradient(180deg, #101526 0%, #0b0e17 100%);
    border-bottom: 1px solid rgba(0, 210, 255, 0.15);
    padding: 10px 0;
    margin: 0;
    position: relative;
    overflow: hidden;
    display: block;
    box-sizing: border-box;
}

/* Gradient fade on left & right edges for seamless aesthetic */
.category-slider-wrapper::before,
.category-slider-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    z-index: 5;
    pointer-events: none;
}

.category-slider-wrapper::before {
    left: 0;
    background: linear-gradient(90deg, #0b0e17 0%, transparent 100%);
}

.category-slider-wrapper::after {
    right: 0;
    background: linear-gradient(270deg, #0b0e17 0%, transparent 100%);
}

.category-slider-track {
    display: flex;
    width: -webkit-max-content;
    width: -moz-max-content;
    width: max-content;
    -webkit-animation: categoryAutoSlide 25s linear infinite;
    animation: categoryAutoSlide 25s linear infinite;
    will-change: transform;
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
}

/* Pause slide on hover */
.category-slider-wrapper:hover .category-slider-track {
    -webkit-animation-play-state: paused;
    animation-play-state: paused;
}

.category-slider-group {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-right: 12px;
    flex-shrink: 0;
}

@-webkit-keyframes categoryAutoSlide {
    0% {
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
    }
    100% {
        -webkit-transform: translate3d(-50%, 0, 0);
        transform: translate3d(-50%, 0, 0);
    }
}

@keyframes categoryAutoSlide {
    0% {
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
    }
    100% {
        -webkit-transform: translate3d(-50%, 0, 0);
        transform: translate3d(-50%, 0, 0);
    }
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    padding: 7px 16px;
    border-radius: 22px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.tag-pill:hover,
.tag-pill.active {
    background: linear-gradient(135deg, rgba(0, 210, 255, 0.25), rgba(255, 183, 0, 0.25));
    border-color: var(--theme-primary, #00d2ff);
    color: #ffffff;
    box-shadow: 0 2px 12px rgba(0, 210, 255, 0.35);
    transform: translateY(-1px);
}

/* --- Section Heading --- */
.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 10px 16px 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.section-heading {
    font-family: 'Poppins', 'Inter', sans-serif;
    font-size: clamp(18px, 3vw, 22px);
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-sub {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

/* --- Main Layout Container (Full Width on Desktop) --- */
.game-home-layout {
    width: 100%;
    max-width: 100% !important;
    padding: 12px 24px 30px;
    margin: 0 auto;
    box-sizing: border-box;
}

.section-header {
    width: 100%;
    box-sizing: border-box;
    margin: 10px 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* --- Responsive Game Grid --- */
.game-list-2 {
    display: grid;
    grid-gap: 16px;
    padding: 4px 0;
    width: 100%;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
}

@media (min-width: 480px) {
    .game-list-2 {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        grid-gap: 16px;
    }
}

@media (min-width: 768px) {
    .game-list-2 {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        grid-gap: 18px;
    }
}

@media (min-width: 1200px) {
    .game-home-layout {
        padding: 12px 30px 40px !important;
    }
    .game-list-2 {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        grid-gap: 20px;
    }
}

@media (min-width: 1600px) {
    .game-home-layout {
        padding: 14px 40px 50px !important;
    }
    .game-list-2 {
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
        grid-gap: 24px;
    }
}

@media (max-width: 380px) {
    .game-list-2 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-gap: 10px;
    }
}

/* --- Game Item Card Styling --- */
.game-item {
    border-radius: 14px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    background: linear-gradient(160deg, #182035 0%, #0f1424 100%);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.game-item:hover {
    transform: translateY(-6px) scale(1.03);
    box-shadow: 0 12px 28px rgba(0, 210, 255, 0.35);
    border-color: rgba(0, 210, 255, 0.6);
    background: linear-gradient(160deg, #1d2742 0%, #12192e 100%);
}

.game-item:active {
    transform: translateY(-2px) scale(0.99);
}

.game-item .game-icon {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 13px 13px 0 0;
    width: 100%;
    background: #101424;
}

.game-item .game-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.game-item:hover .game-icon img {
    transform: scale(1.1);
}

/* Play button overlay on hover */
.game-item .game-icon::after {
    content: "▶";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.6);
    background: var(--theme-gradient);
    color: #ffffff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 4px 18px rgba(0, 210, 255, 0.6);
    z-index: 2;
    padding-left: 3px;
    pointer-events: none;
}

.game-item:hover .game-icon::after {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.game-item .game-icon::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(11, 14, 23, 0.4);
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: 1;
    pointer-events: none;
}

.game-item:hover .game-icon::before {
    opacity: 1;
}

.game-item .game-title,
.text-ellipsis-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    -webkit-box-pack: center;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    overflow-wrap: break-word;
}

.game-item .game-title {
    color: #f1f5f9;
    padding: 0 5px;
    font-size: 11.5px;
    line-height: 1.25;
    text-align: center;
    font-weight: 600;
    margin: 0;
    height: 36px;
    max-height: 36px;
    box-sizing: border-box;
    transition: color 0.25s ease;
}

@media (min-width: 600px) {
    .game-item .game-title {
        font-size: 12.5px;
        line-height: 1.25;
        height: 38px;
        max-height: 38px;
        padding: 0 6px;
    }
}

.game-item:hover .game-title {
    color: var(--theme-primary, #00d2ff);
}

/* TOP badges for first 5 games */
.game-list-2 .game-item:nth-child(-n+5) {
    border: 1px solid rgba(255, 183, 0, 0.5);
    box-shadow: 0 4px 18px rgba(255, 183, 0, 0.25);
    background: linear-gradient(160deg, #251d12 0%, #111526 100%);
}

.game-list-2 .game-item:nth-child(-n+5)::before {
    content: "TOP";
    position: absolute;
    top: 10px;
    left: -20px;
    background: linear-gradient(90deg, #ff3b30, #ff8c00);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 24px;
    text-align: center;
    transform: rotate(-45deg);
    z-index: 10;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    letter-spacing: 1px;
}

/* --- Responsive Media Grid Area (Large Displays) --- */
@media (min-width: 640px) {
    .item-1 {
        grid-area: 1 / 1 / 3 / 3 !important;
    }
    .item-2 {
        grid-area: 3 / 3 / 5 / 5;
    }
}

@media (min-width: 768px) {
    .item-1 {
        grid-area: 1 / 1 / 3 / 3 !important;
    }
    .item-2 {
        grid-area: 3 / 4 / 5 / 6;
    }
}

@media (min-width: 1280px) {
    .item-1 {
        grid-area: 1 / 1 / 3 / 3 !important;
    }
    .item-2 {
        grid-area: 2 / 5 / 4 / 7;
    }
}

/* ============================================================
   COMPLETE CSS RESET & ISOLATION FOR ADVERTISEMENT CONTAINERS
   Ensures:
   - No parent CSS affects the ad box (all: unset / isolated)
   - Zero fixed width or height, zero clipping (overflow: visible)
   - Ads never get cut off on mobile or desktop
   - No background colors, borders, shadows, or filters
   ============================================================ */
.ads-container,
.tops-ads,
.ads,
.banner-ad {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    filter: none !important;
    backdrop-filter: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 8px auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 380px !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    box-sizing: border-box !important;
    transform: none !important;
    contain: none !important;
    clip-path: none !important;
}

[id^="div-gpt-ad"] {
    display: block !important;
    margin: 0 auto !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    overflow: visible !important;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    text-align: center !important;
}

/* Google Publisher Tag rendered divs & iframes */
[id^="div-gpt-ad"] > div {
    display: inline-block !important;
    margin: 0 auto !important;
    overflow: visible !important;
}

[id^="div-gpt-ad"] iframe {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    margin: 0 auto !important;
    vertical-align: middle !important;
    display: block !important;
}

/* Subtle Advertisement text disclaimer without any boxes */
.ads-label {
    text-align: center !important;
    margin: 2px 0 0 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
}

.ads-label span {
    font-size: 10px !important;
    color: rgba(255, 255, 255, 0.4) !important;
    letter-spacing: 0.8px !important;
    text-transform: uppercase !important;
    background: transparent !important;
}

/* ============================================================
   MOBILE VIEW SPACING OPTIMIZATION & HEADER REMOVAL
   - Completely removes the top header on mobile screens (< 768px)
   - Eliminates unnecessary top & bottom whitespace
   ============================================================ */
@media screen and (max-width: 767px) {
    header.header,
    .header {
        display: none !important;
    }

    body {
        padding-top: 0 !important;
        margin-top: 0 !important;
    }

    .category-slider-wrapper {
        padding: 8px 0 !important;
        margin: 0 !important;
        border-top: none !important;
    }

    .ads-container,
    .tops-ads,
    .ads {
        margin: 4px auto !important;
        padding: 0 !important;
    }

    .game-home-layout {
        padding: 6px 10px 20px !important;
        margin: 0 auto !important;
    }

    .section-header {
        margin: 4px 4px 10px 4px !important;
        padding-bottom: 8px !important;
    }

    .section-heading {
        font-size: 17px !important;
    }

    .section-sub {
        font-size: 12px !important;
    }

    .game-list-2 {
        grid-gap: 10px !important;
        padding: 0 !important;
    }
}



/* ========================================================
 * 🎮 Animated GIF Preview Engine (1st Game Live & Hover)
 * ======================================================== */
.game-item .game-icon .game-hover-gif {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.28s ease-in-out;
    pointer-events: none;
    z-index: 1;
    border-radius: inherit;
    will-change: opacity;
}

/* Hover: Fade in animated GIF smoothly */
.game-item:hover .game-icon .game-hover-gif {
    opacity: 1 !important;
}

/* 1st Game: Animated GIF always active & playing */
.game-item.is-first-gif .game-icon .game-hover-gif {
    opacity: 1 !important;
}

.game-item.is-first-gif .game-icon img.lazy-img {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.game-item.is-first-gif {
    box-shadow: 0 0 0 2px rgba(0, 210, 255, 0.5), 0 8px 24px rgba(0, 210, 255, 0.28) !important;
}
