@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

:root {
    --bg: #ffffff;
    --bg2: #ffffff;
    --bg3: #f0f2f5;
    --tx: #1a1a2e;
    --tx2: #555b6e;
    --tx3: #8a8fa3;
    --brand: #0066ff;
    --brand-d: #0052cc;
    --brand-l: rgba(0, 102, 255, .06);
    --border: #e5e7eb;
    --border2: #d1d5db;
    --r: 8px;
    --r2: 12px;
    --shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
    --font: 'Inter', system-ui, sans-serif;
    --maxw: 1200px;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--tx);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ── Header ── */
.site-header {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 15px 0;
}

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

.logo {
    display: flex; align-items: center; gap: 10px;
    font-size: 22px; font-weight: 700; color: var(--tx);
}

.logo-svg {
    width: 32px; height: 32px;
}

.header-search {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg3); border-radius: 4px; padding: 6px 12px;
}
.header-search input {
    background: none; border: none; outline: none; font-size: 14px;
}

.nav-links { display: flex; gap: 20px; }
.nav-link { font-size: 14px; font-weight: 500; color: var(--tx2); }
.nav-link:hover { color: var(--brand); }

.mobile-menu-btn { display: none; background: none; border: none; }
.mobile-nav { display: none; }

/* ── Categories ── */
.cat-section { padding: 30px 0 10px; }
.cat-bar { display: flex; gap: 10px; flex-wrap: wrap; }
.cat-btn {
    padding: 8px 16px; border: 1px solid var(--border);
    border-radius: 40px; background: var(--bg2); color: var(--tx2);
    font-size: 14px; transition: all .15s;
}
.cat-btn.active, .cat-btn:hover { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ── Section & Grid ── */
.section { padding: 20px 0 60px; }
.section-header { margin-bottom: 20px; }
.section-title { font-size: 22px; font-weight: 700; }
.result-bar { margin-bottom: 20px; font-size: 14px; color: var(--tx3); }

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

.game-card {
    background: var(--bg2); border-radius: var(--r2);
    border: 1px solid var(--border); overflow: hidden;
    display: flex; flex-direction: column; transition: transform 0.2s, box-shadow 0.2s;
}
.game-card:hover { transform: translateY(-4px); box-shadow: 0 10px 20px rgba(0,0,0,0.08); }

.card-img-wrap {
    aspect-ratio: 16/10; background: var(--bg3);
    display: flex; align-items: center; justify-content: center;
    font-size: 40px; color: #fff; font-weight: bold; position: relative; overflow: hidden;
}
.card-img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.game-card:hover .card-img { transform: scale(1.05); }
.card-cat {
    position: absolute; top: 10px; left: 10px;
    background: rgba(0,0,0,0.6); color: #fff; font-size: 11px;
    padding: 3px 8px; border-radius: 12px; text-transform: capitalize;
}

.card-body { padding: 15px; display: flex; flex-direction: column; flex: 1; }
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 5px; }
.card-desc { font-size: 13px; color: var(--tx2); margin-bottom: 15px; flex: 1; }
.card-play { font-size: 13px; font-weight: 600; color: var(--brand); }

/* ── Footer ── */
.site-footer {
    background: #f8f9fa; border-top: 1px solid var(--border);
    padding: 40px 0 20px; color: var(--tx2);
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 30px; margin-bottom: 30px; }
.footer-brand .logo { margin-bottom: 10px; }
.footer-brand p { font-size: 13px; }
.footer-col h4 { font-size: 14px; margin-bottom: 15px; color: var(--tx); }
.footer-col a { display: block; font-size: 13px; margin-bottom: 8px; }
.footer-col a:hover { color: var(--brand); }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 15px; font-size: 12px; display: flex; justify-content: space-between; }
.footer-bottom-links { display: flex; gap: 15px; }

/* ── Game Page ── */
.game-page-header { margin: 30px 0 20px; }
.back-link {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 14px; font-weight: 500; color: var(--tx2);
    margin-bottom: 20px; transition: color 0.2s;
}
.back-link:hover { color: var(--brand); }

.game-info {
    background: var(--bg2); border: 1px solid var(--border);
    padding: 25px; border-radius: var(--r2); margin-bottom: 25px;
}
.game-info h1 { font-size: 28px; font-weight: 700; margin-bottom: 10px; line-height: 1.2; }
.game-meta { display: flex; flex-direction: column; gap: 12px; }
.tag {
    display: inline-block; background: var(--brand-l); color: var(--brand);
    font-size: 12px; font-weight: 600; padding: 4px 12px;
    border-radius: 20px; width: fit-content; text-transform: uppercase;
}
#game-desc { font-size: 15px; color: var(--tx2); max-width: 800px; line-height: 1.6; }



.game-frame-wrap {
    position: relative; width: 100%; aspect-ratio: 16/9;
    background: #000; border-radius: var(--r2); overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1); border: 1px solid var(--border);
}
#game-frame {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    border: none;
}

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

.game-controls {
    display: flex; gap: 10px; margin-bottom: 15px;
}
.ctrl-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 18px; border-radius: var(--r); border: none;
    background: var(--brand); color: #fff; font-size: 14px;
    font-weight: 600; transition: all 0.2s;
}
.ctrl-btn:hover { background: var(--brand-d); transform: translateY(-1px); }
.ctrl-btn.secondary { background: var(--bg3); color: var(--tx2); border: 1px solid var(--border); }
.ctrl-btn.secondary:hover { background: var(--border); color: var(--tx); }

/* ── Play Overlay ── */
.play-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 10; background: #000; display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.overlay-bg {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover; opacity: 0.5; filter: blur(10px);
}
.overlay-btn-wrap {
    position: relative; z-index: 11; text-align: center; color: #fff;
}
.play-main-btn {
    display: inline-flex; align-items: center; gap: 15px;
    padding: 20px 40px; border-radius: 50px; border: none;
    background: var(--brand); color: #fff; font-size: 24px;
    font-weight: 700; box-shadow: 0 10px 30px rgba(0, 102, 255, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-bottom: 15px;
}
.play-main-btn:hover { transform: scale(1.1); background: #fff; color: var(--brand); }
.overlay-btn-wrap p { font-size: 14px; opacity: 0.8; font-weight: 500; }

/* ── Fullscreen Fix ── */
#game-container:fullscreen { width: 100vw; height: 100vh; border-radius: 0; }
#game-container:fullscreen iframe { height: 100vh; }
#game-container:-webkit-full-screen { width: 100vw; height: 100vh; }

/* ── Responsive ── */
@media(max-width:768px) {
    .header-search, .nav-links { display: none; }
    .game-grid, .popular-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .footer-grid { grid-template-columns: 1fr; gap: 20px; }
    .game-frame-wrap { aspect-ratio: 4/3; }
    .game-info h1 { font-size: 22px; }
}