/* Custom Variables */
:root {
    --bg: #1a0b2e;
    --header: #12061f;
    --card: #2d1b4d;
    --accent: #ffcc00;
    --text: #ffffff;
    --transition: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Base Styles - Optimasi Firefox & Safari Mac */
html {
    height: 100%;
    overflow-y: scroll; /* Memaksa scrollbar tetap aktif */
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    overflow-x: hidden; /* Mengganti clip agar kompatibel dengan versi lama */
    line-height: 1.5;
}

/* Professional Header */
.site-header {
    background: rgba(18, 6, 31, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.4);
    width: 100%;
    box-sizing: border-box;
}

.site-header .header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 14px 20px;
}

.site-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), filter 0.3s ease;
}

.site-logo:hover {
    transform: scale(1.04);
    filter: drop-shadow(0 0 12px rgba(255, 50, 50, 0.45));
}

.site-logo .logo-img {
    height: 48px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
    display: block;
}

@media (max-width: 768px) {
    .site-header .header-inner {
        padding: 10px 15px;
    }
    .site-logo .logo-img {
        height: 38px;
    }
}

/* Navigation */
.filter-bar {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 25px 5%;
    flex-wrap: wrap;
    background: linear-gradient(to bottom, var(--header), transparent);
}

.filter-btn {
    background: var(--card);
    color: white;
    text-decoration: none;
    padding: 10px 22px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: bold;
    transition: var(--transition);
    border: 1px solid rgba(255,255,255,0.1);
}

.filter-btn.active, .filter-btn:hover {
    background: var(--accent);
    color: var(--header);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(255, 204, 0, 0.3);
}

/* Main Container */
.main-container { 
    padding: 0 5% 80px;
    width: 100%;
    box-sizing: border-box;
    flex: 1; /* Penting agar kontainer mengisi ruang kosong */
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
}

/* Game Card */
.game-card {
    text-decoration: none;
    color: white;
    outline: none;
}

.card-inner {
    background: var(--card);
    border-radius: 18px;
    overflow: hidden;
    position: relative;
    aspect-ratio: 1 / 1;
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
    transition: var(--transition);
}

.game-card:hover .card-inner { 
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.6);
}

.game-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block; /* Menghilangkan gap bawah gambar di Firefox */
}

/* Sembunyikan thumbnail di index page sebelum iklan ADX tampil */
body.index-page .game-card img {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease-in-out, visibility 0.4s ease-in-out;
}

body.index-page.adx-loaded .game-card img {
    opacity: 1;
    visibility: visible;
}

/* Efek Shimmer & Spinner Loading saat thumbnail disembunyikan */
body.index-page:not(.adx-loaded) .card-inner {
    position: relative;
    background: linear-gradient(110deg, #2d1b4d 8%, #3d2666 18%, #2d1b4d 33%);
    background-size: 200% 100%;
    animation: thumbShimmer 1.5s linear infinite;
}

body.index-page:not(.adx-loaded) .card-inner::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 26px;
    height: 26px;
    margin-top: -13px;
    margin-left: -13px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: thumbSpinner 0.8s linear infinite;
    z-index: 2;
}

@keyframes thumbShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes thumbSpinner {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.game-title {
    padding: 12px 8px;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    position: absolute;
    bottom: 0; 
    width: 100%;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Loader */
#loader { 
    text-align: center; 
    padding: 50px 0; 
    color: var(--accent); 
    display: none; 
    font-weight: bold;
    width: 100%;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .game-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 15px; }
}

@media (max-width: 480px) {
    .game-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
    .filter-btn { padding: 8px 15px; font-size: 11px; }
}


/* ==========================================
   PREMIUM GAMING FOOTER
   ========================================== */
footer {
    background: linear-gradient(to bottom, transparent, var(--header));
    padding: 80px 5% 40px;
    margin-top: 100px;
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

/* Garis aksen di atas footer */
footer::before {
    content: '';
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.3;
}

.footer-main {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1.5fr;
    gap: 40px;
}

.footer-brand .f-logo {
    font-size: 28px;
    font-weight: 900;
    color: #fff;
    text-decoration: none;
    display: block;
    margin-bottom: 20px;
    letter-spacing: -1px;
}

.footer-brand .f-logo span {
    color: var(--accent);
    text-shadow: 0 0 15px rgba(255, 204, 0, 0.4);
}

.footer-brand p {
    color: #8b829d;
    font-size: 14px;
    line-height: 1.7;
    max-width: 280px;
}

.footer-box h4 {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 25px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.footer-box ul {
    list-style: none;
    padding: 0; margin: 0;
}

.footer-box ul li {
    margin-bottom: 15px;
}

.footer-box ul li a {
    color: #8b829d;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
}

.footer-box ul li a:hover {
    color: var(--accent);
    transform: translateX(8px);
}

/* Newsletter / Stats Box */
.footer-newsletter {
    background: rgba(255, 255, 255, 0.03);
    padding: 25px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-newsletter h4 { margin-bottom: 15px; }
.footer-newsletter p { font-size: 13px; color: #8b829d; margin-bottom: 20px; }

.f-stats {
    display: flex;
    gap: 15px;
}

.stat-item {
    background: var(--card);
    padding: 10px 15px;
    border-radius: 12px;
    text-align: center;
    flex: 1;
}

.stat-item span { display: block; font-size: 10px; color: #8b829d; text-transform: uppercase; }
.stat-item b { display: block; font-size: 14px; color: var(--accent); }

.footer-bottom {
    max-width: 1200px;
    margin: 60px auto 0;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #5d546d;
    font-size: 13px;
}

/* Responsive */
@media (max-width: 1024px) {
    .footer-main { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
    .footer-main { grid-template-columns: 1fr; text-align: center; }
    .footer-brand p { max-width: 100%; }
    .footer-box ul li a { justify-content: center; }
    .footer-bottom { flex-direction: column; gap: 20px; }
    .footer-newsletter { text-align: left; }
}

/* --- CSS KHUSUS IKLAN ARCADEFUN --- */

/* 1. Iklan Feed (Yang disisipkan di tengah grid) */
.ad-feed-row {
    /* KUNCI: Memaksa iklan memakan 1 baris penuh (7 kolom desktop / 3 kolom mobile) */
    grid-column: 1 / -1; 
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 15px 0;
    padding: 20px 0;
    background: rgba(255, 255, 255, 0.03); /* Background tipis agar estetik */
    border-radius: 18px; /* Menyesuaikan border-radius game-card kamu */
    min-height: 100px; /* Jaga layout agar tidak melompat saat iklan muncul */
}

/* 2. Pembungkus Iklan Header (Atas Filter) */
.ad-header-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 10px 0 20px 0;
    min-height: 90px;
}

/* 3. Penyesuaian Frame Iklan agar tidak meluber */
#div-gpt-ad-gm-header, 
#div-gpt-ad-gm-feed {
    max-width: 100% !important;
    overflow: hidden;
}

/* 4. Responsive Mobile */
@media (max-width: 768px) {
    .ad-feed-row {
        margin: 10px 0;
        padding: 15px 0;
        border-radius: 12px;
    }
}

/* --- SECTION & VIDEO STYLING --- */
.section-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--accent);
    margin: 25px 0 15px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.video-section {
    margin: 35px 0;
}

.video-grid {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 12px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.video-grid::-webkit-scrollbar {
    height: 6px;
}

.video-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 204, 0, 0.4);
    border-radius: 10px;
}

.video-card {
    flex: 0 0 260px;
    text-decoration: none;
    color: white;
    outline: none;
}

@media (max-width: 768px) {
    .video-card {
        flex: 0 0 200px;
    }
}

@media (max-width: 480px) {
    .video-card {
        flex: 0 0 160px;
    }
}

.video-card-inner {
    background: var(--card);
    border-radius: 14px;
    overflow: hidden;
    position: relative;
    aspect-ratio: 16 / 9; /* Thumb video berbentuk persegi panjang */
    box-shadow: 0 6px 15px rgba(0,0,0,0.4);
    transition: var(--transition);
}

.video-card:hover .video-card-inner {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.6);
}

.video-card-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 38px;
    height: 38px;
    background: rgba(255, 204, 0, 0.9);
    color: #12061f;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    transition: transform 0.2s ease;
}

.video-card:hover .video-play-icon {
    transform: translate(-50%, -50%) scale(1.15);
}

.video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

.video-title {
    font-size: 12px;
    font-weight: bold;
    color: #fff;
    margin-top: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}