:root {
    --bg-dark: #121214;
    --bg-card: rgba(255, 255, 255, 0.08);
    --primary: #00ff88;
    --secondary: #ff3c83;
    /* Poki Pink */
    --accent: #8b5cf6;
    /* Modern Purple */
    --text-main: #ffffff;
    --text-muted: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.12);
    --shadow: rgba(0, 0, 0, 0.6);
}

body.light-theme {
    --bg-dark: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.9);
    --primary: #00c853;
    --secondary: #00acc1;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --glass-border: rgba(0, 0, 0, 0.08);
    --shadow: rgba(0, 0, 0, 0.05);
}

body.dark-theme {
    --bg-dark: #0a0a0c;
    --bg-card: rgba(255, 255, 255, 0.05);
    --primary: #00ff88;
    --secondary: #0ef;
    --text-main: #ffffff;
    --text-muted: #a0a0a0;
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow: rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Outfit', 'Inter', sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Glassmorphism Background */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 255, 136, 0.05) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
    transition: background 0.5s ease;
}

body.light-theme::before {
    background: radial-gradient(circle, rgba(0, 200, 83, 0.08) 0%, transparent 60%);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header & Glass Nav */
header {
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--glass-border);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    transition: all 0.3s ease;
}

body.light-theme .logo-wrapper {
    background: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.logo-wrapper:hover {
    transform: scale(1.02);
    border-color: var(--primary);
}

.logo-img-container {
    background: #000;
    /* Default background for logo if it has cutout issues */
    padding: 2px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.light-theme .logo-img-container {
    background: #0a0a0c;
    /* High contrast for light mode */
}

.logo-text {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
    display: none;
    /* Keep hidden by default as per user preference in layout */
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
}

body.light-theme .nav-link.active {
    color: var(--primary);
}

/* Generic Game Card Grid (Categories) */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.game-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 10px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    cursor: pointer;
    overflow: hidden;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px var(--shadow);
    border-color: var(--primary);
}

body.light-theme .game-card {
    background: white;
    border-color: rgba(0, 0, 0, 0.05);
}

body.light-theme .game-card:hover {
    box-shadow: 0 15px 35px rgba(0, 200, 83, 0.15);
}

.game-thumb {
    width: 100%;
    aspect-ratio: 16/10;
    border-radius: 8px;
    object-fit: cover;
    margin-bottom: 10px;
}

.game-title {
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Poki Redesign Styles */
.poki-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    grid-auto-rows: 150px;
    gap: 15px;
    grid-auto-flow: dense;
    padding: 20px 0;
}

.poki-card {
    position: relative;
    border-radius: 24px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.poki-card-inner {
    width: 100%;
    height: 100%;
    position: relative;
}

.poki-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.poki-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
    padding: 20px 15px 15px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.poki-title {
    font-size: 14px;
    font-weight: 800;
    color: white;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.poki-card:hover {
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 15px 35px rgba(0, 255, 136, 0.3);
    border-color: var(--primary);
    z-index: 50;
}

.poki-card:hover .poki-overlay {
    opacity: 1;
    transform: translateY(0);
}

.poki-card:hover .poki-thumb {
    transform: scale(1.1);
}

.grid-wide {
    grid-column: span 2;
}

.grid-tall {
    grid-row: span 2;
}

.grid-big {
    grid-column: span 2;
    grid-row: span 2;
}

.poki-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    z-index: 5;
}

.poki-badge.hot {
    background: #ff4d4d;
    color: white;
}

.poki-badge.new {
    background: #00ff88;
    color: black;
}

/* Game Play Page */
.play-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    margin-top: 40px;
    overflow: hidden;
    aspect-ratio: 16/9;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

iframe {
    width: 100%;
    height: 100%;
    border: none;
}

#main-search {
    background: none;
    border: none;
    color: var(--text-main);
    padding: 10px 0;
    outline: none;
    width: 100%;
    font-size: 14px;
    caret-color: var(--primary);
}

body.light-theme #main-search {
    color: #0f172a;
}

.search-box {
    transition: all 0.3s ease;
}

body.light-theme .search-box {
    background: white !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Ad Zones */
.ad-zone {
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed var(--glass-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 20px 0;
    overflow: hidden;
}

.ad-lb {
    width: 100%;
    height: 90px;
}

.ad-rect {
    width: 336px;
    height: 280px;
}

/* Animations */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Preroll Overlay */
.preroll-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .hero-title {
        font-size: 2.2rem !important;
        letter-spacing: -1px;
    }

    .hero-subtitle {
        font-size: 1rem;
        padding: 0 10px;
    }

    .poki-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        grid-auto-rows: 130px;
        gap: 12px;
    }

    .discovery-container {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    .category-item {
        min-width: 140px;
        padding: 15px !important;
    }

    .game-play-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 15px;
    }

    .game-play-header>div:last-child {
        width: 100%;
        justify-content: space-between;
    }

    #start-game-btn {
        width: 90% !important;
        padding: 15px !important;
    }

    /* Better mobile buttons */
    button,
    .slider-btn,
    .category-item {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .grid-big {
        grid-column: span 2;
        grid-row: span 2;
    }

    .grid-wide {
        grid-column: span 2;
    }

    /* Mobile Nav Improvements */
    .nav-inner {
        padding: 5px 15px;
    }

    nav {
        display: none;
        /* Hidden by default on mobile */
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: var(--bg-dark);
        flex-direction: column;
        padding: 20px;
        border-bottom: 1px solid var(--glass-border);
        z-index: 1001;
    }

    nav.active {
        display: flex;
    }

    nav div {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    .nav-link {
        width: 100%;
        justify-content: center;
        padding: 15px !important;
        font-size: 16px;
    }

    .search-container {
        display: none;
        /* Optional: Hide search in header on tiny screens or keep and adjust */
    }

    .game-container-layout {
        flex-direction: column;
    }

    aside {
        width: 100% !important;
    }

    .game-play-header h1 {
        font-size: 1.8rem !important;
    }

    /* Floating share bar on mobile */
    .share-bar-vertical {
        flex-direction: row !important;
        left: 50% !important;
        top: auto !important;
        bottom: 20px !important;
        transform: translateX(-50%) !important;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(10px);
        padding: 10px 20px;
        border-radius: 40px;
        border: 1px solid var(--glass-border);
    }
}

/* Sidebar Toggle Animation */
.sidebar-box {
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
    overflow: hidden;
}

.sidebar-box.closed {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
    border: none;
}

#mobile-menu-btn {
    display: none;
}

@media (max-width: 768px) {
    #mobile-menu-btn {
        display: flex;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--glass-border);
        color: white;
        padding: 8px;
        border-radius: 10px;
        cursor: pointer;
    }
}

/* Search Autocomplete */
.search-container {
    position: relative;
    flex: 1;
    max-width: 400px;
}

#search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-dark);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    margin-top: 10px;
    z-index: 2000;
    overflow: hidden;
    box-shadow: 0 20px 40px var(--shadow);
    display: none;
}

body.light-theme #search-suggestions {
    background: white;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    text-decoration: none;
    color: var(--text-main);
    transition: background 0.2s;
}

.suggestion-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.suggestion-item img {
    width: 40px;
    height: 30px;
    object-fit: cover;
    border-radius: 5px;
}

.suggestion-item .item-title {
    font-size: 14px;
    font-weight: 600;
}

/* Featured Slider */
.featured-slider {
    margin-top: 30px;
    position: relative;
    overflow: hidden;
    border-radius: 25px;
    height: 380px;
    border: 1px solid var(--glass-border);
    background: var(--bg-card);
    box-shadow: 0 20px 40px var(--shadow);
}

#slider-track {
    display: flex;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
}

.slider-item {
    min-width: 100%;
    height: 100%;
    position: relative;
}

.slider-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
    transition: transform 0.8s ease;
}

.slider-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 50px 40px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
    color: white;
}

body.light-theme .slider-caption {
    background: linear-gradient(transparent, rgba(255, 255, 255, 0.95));
    color: #0f172a;
}

.slider-badge {
    background: var(--primary);
    color: black;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.slider-title {
    font-size: 2.8rem;
    font-weight: 800;
    margin: 15px 0;
    letter-spacing: -1px;
}

.slider-btn {
    display: inline-block;
    background: white;
    color: black;
    padding: 12px 35px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 800;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

body.light-theme .slider-btn {
    background: var(--primary);
    color: white;
}

.slider-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px rgba(0, 0, 0, 0.2);
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 60px 0 30px;
}

.hero-title {
    font-size: 3.2rem;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -2px;
    background: linear-gradient(135deg, var(--text-main), var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    color: var(--text-muted);
    font-size: 1.2rem;
    max-width: 650px;
    margin: 0 auto;
    opacity: 0.9;
}

/* Category Grid */
.category-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.category-item {
    background: var(--bg-card);
    padding: 18px 28px;
    border-radius: 18px;
    text-decoration: none;
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    flex: 1;
    min-width: 160px;
    justify-content: center;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px var(--shadow);
}

body.light-theme .category-item {
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.category-item:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 25px var(--shadow);
}

.category-icon {
    color: var(--primary);
    font-size: 20px;
}

.category-name {
    font-weight: 600;
    font-size: 15px;
}

/* Ad-Block Notice */
#ad-block-notice {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

.ad-block-content {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    padding: 40px;
    border-radius: 30px;
    max-width: 500px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}

.ad-block-content h2 {
    font-size: 2rem;
    margin: 20px 0 10px;
    color: white;
}

.ad-block-content p {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 25px;
}

body.ad-block-active {
    overflow: hidden;
}

/* Subscription Popup */
.sub-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sub-popup-overlay.active {
    display: flex;
    opacity: 1;
}

.sub-popup-content {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    padding: 40px;
    border-radius: 30px;
    max-width: 450px;
    width: 100%;
    position: relative;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sub-popup-overlay.active .sub-popup-content {
    transform: scale(1);
}

.sub-popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 24px;
}

.sub-popup-icon {
    width: 80px;
    height: 80px;
    background: rgba(0, 210, 255, 0.1);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.sub-popup-icon span {
    font-size: 40px;
}