:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #10b981;
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-header: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --radius: 0.75rem;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: inherit;
    text-decoration: none;
    transition: all 0.2s;
}

img {
    max-width: 100%;
    display: block;
}

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
.main-header {
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    height: 70px;
    display: flex;
    align-items: center;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

.main-nav a {
    font-weight: 500;
    color: var(--text-muted);
}

.main-nav a:hover, .main-nav a.active {
    color: var(--text-main);
}

.dropdown {
    position: relative;
}

.dropdown-content {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 200px;
    padding: 0.5rem;
    display: none;
    box-shadow: var(--shadow);
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a {
    display: block;
    padding: 0.5rem 1rem;
    border-radius: calc(var(--radius) - 0.25rem);
}

.dropdown-content a:hover {
    background-color: var(--border);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Main Content Area */
main {
    flex: 1;
    padding: 2rem 0;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 0;
    background: radial-gradient(circle at center, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* Games Grid */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.game-card {
    background-color: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    border-color: var(--primary);
}

.game-thumb-wrapper {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.game-thumb-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.game-card:hover .game-thumb-wrapper img {
    transform: scale(1.1);
}

.play-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.game-card:hover .play-overlay {
    opacity: 1;
}

.play-icon {
    width: 48px;
    height: 48px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-info {
    padding: 1.25rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.game-title {
    font-weight: 700;
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

/* Game Page */
.game-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
}

.game-play-section {
    background-color: var(--bg-card);
    border-radius: var(--radius);
    padding: 1rem;
    border: 1px solid var(--border);
}

.game-frame-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: calc(var(--radius) - 0.5rem);
    overflow: hidden;
}

iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.game-meta {
    margin-top: 1.5rem;
}

.game-meta h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.game-description {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.instructions {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.sidebar-section {
    background-color: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background: var(--border);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.tag:hover {
    background: var(--primary);
    color: white;
}

/* Featured Game Section */
.featured-game {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 3rem;
    display: flex;
    align-items: center;
    gap: 3rem;
    margin-bottom: 4rem;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.featured-game::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    height: 300px;
    background: var(--primary);
    filter: blur(150px);
    opacity: 0.1;
}

.featured-content {
    flex: 1;
}

.featured-content h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.featured-img {
    width: 300px;
    height: 300px;
    border-radius: var(--radius);
    object-fit: cover;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.3);
}

.btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    background-color: var(--primary);
    color: white;
    font-weight: 700;
    border-radius: var(--radius);
    cursor: pointer;
    border: none;
    font-size: 1.125rem;
}

.btn:hover {
    background-color: var(--primary-hover);
    transform: scale(1.05);
}

/* Footer */
.main-footer {
    background-color: var(--bg-header);
    border-top: 1px solid var(--border);
    padding: 4rem 0 2rem;
    margin-top: 4rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-brand h2 {
    color: var(--primary);
    margin-bottom: 1rem;
}

.footer-links h4 {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: var(--text-muted);
}

.footer-links a:hover {
    color: var(--text-main);
}

.footer-bottom {
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Ads */
.ad-container {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
}

.home-layout {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    gap: 2rem;
    max-width: 1650px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.home-main {
    flex: 1;
    max-width: 1100px;
    min-width: 0;
}

.sticky-ad-wrapper {
    width: 160px;
    flex-shrink: 0;
    display: none;
    height: auto;
}

.sticky-ad {
    position: sticky;
    top: 90px;
    width: 160px;
    height: 600px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 10;
}

@media (min-width: 1200px) {
    .sticky-ad-wrapper {
        display: block;
    }
}

@media (max-width: 1199px) {
    .sticky-ad-wrapper {
        display: none !important;
    }
}

.ad-centered {
    margin: 2rem auto !important;
    width: 100% !important;
    min-height: 90px;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}

.ad-centered * {
    margin-left: auto !important;
    margin-right: auto !important;
}

.ad-centered iframe,
.ad-centered ins,
.ad-centered div {
    display: block !important;
    margin: 0 auto !important;
}

.ad-game-card {
    background-color: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    position: relative;
    height: 100%;
}

.ad-game-card > div {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 320px !important;
    height: 250px !important;
}

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

@media (max-width: 768px) {
    .main-nav {
        display: none;
    }
    
    .menu-toggle {
        display: block;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .featured-game {
        flex-direction: column;
        padding: 2rem;
        text-align: center;
    }

    .featured-img {
        width: 100%;
        height: 200px;
    }
}

/* Interstitial */
.interstitial-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.interstitial-content {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--radius);
    max-width: 450px;
    width: 95%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.5);
}

.interstitial-ad-box {
    margin: 1.5rem auto;
    width: 320px;
    height: 250px;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    overflow: hidden;
}

@media (max-width: 400px) {
    .interstitial-content {
        padding: 1rem 0.5rem;
    }
}
