/* GameHive - classic game portal theme */
:root {
    --primary: #2b6cb0;
    --primary-dark: #1e4e8c;
    --primary-grad: linear-gradient(135deg, #2563eb 0%, #6d28d9 100%);
    --accent: #7c3aed;
    --bg: #eef2f7;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --radius: 14px;
    --shadow: 0 4px 14px rgba(15, 23, 42, .08);
    --shadow-hover: 0 10px 24px rgba(37, 99, 235, .18);
    --header-h: 62px;
    --adbox-gap: 18px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body { margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

a { color: inherit; text-decoration: none; }

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ===== Header ===== */
.site-header {
    background: var(--primary-grad);
    color: #fff;
    box-shadow: var(--shadow);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--header-h);
    gap: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.brand-logo {
    width: 38px;
    height: 38px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,.2));
}

.brand-name {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: .3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.menu-btn {
    width: 42px;
    height: 42px;
    border: none;
    background: rgba(255,255,255,.14);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0;
}

.menu-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.back-top-btn {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 200;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,.25);
}

.back-top-btn:hover {
    background: var(--primary-600, var(--primary));
    transform: translateY(-2px);
}

/* ===== Category bar ===== */
.cat-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 16px;
    scrollbar-width: thin;
}

.cat-chip {
    flex: 0 0 auto;
    background: rgba(255,255,255,.92);
    color: var(--primary-dark);
    font-size: .85rem;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 999px;
    box-shadow: var(--shadow);
    transition: background .2s, color .2s;
}

.cat-chip:hover {
    background: #fff;
}

/* ===== Drawer ===== */
.drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    height: 100%;
    background: #fff;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform .28s ease;
    box-shadow: 2px 0 20px rgba(0,0,0,.12);
    display: flex;
    flex-direction: column;
}

.drawer.open { transform: translateX(0); }

.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: var(--primary-grad);
    color: #fff;
    font-weight: 800;
}

.drawer-close {
    border: none;
    background: rgba(255,255,255,.16);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.drawer-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 10px;
    font-weight: 600;
    color: var(--text);
    font-size: .95rem;
    transition: background .15s, color .15s;
}

.drawer-link:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.drawer-dot {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 9px;
    background: var(--primary-grad);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 800;
}

.mask {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    z-index: 999;
}

/* ===== Main ===== */
.main {
    flex: 1;
    padding-top: 20px;
    padding-bottom: 20px;
}

/* ===== Ad boxes ===== */
.adbox {
    min-height: 90px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--adbox-gap);
    overflow: hidden;
}

.adbox-sm { min-height: 90px; margin-top: var(--adbox-gap); }

.adbox-slim { min-height: 70px; }

/* in-grid injected ad (spans full grid row, between game cards) */
.game-ad.in-grid {
    grid-column: 1 / -1;
    min-height: 90px;
    margin: 2px 0;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px dashed #cbd5e1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Section ===== */
.section {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: var(--adbox-gap);
}

.section-title {
    position: relative;
    margin: 0 0 16px;
    font-size: 1.15rem;
    font-weight: 800;
    padding-left: 14px;
    color: var(--text);
}

.section-title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 3px;
    bottom: 3px;
    width: 5px;
    border-radius: 3px;
    background: var(--primary-grad);
}

/* ===== Game grid ===== */
.game-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(6, 1fr);
}

.game-card {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: transform .18s, box-shadow .18s;
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.game-thumb {
    position: relative;
    aspect-ratio: 1 / 1;
    background: #e2e8f0;
    overflow: hidden;
}

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

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

.game-name {
    padding: 8px 10px;
    font-size: .82rem;
    font-weight: 700;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.tag {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: .65rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 999px;
    color: #fff;
    letter-spacing: .3px;
}

.tag-new { background: #16a34a; }

.tag-hot { background: #ef4444; }

/* ===== Breadcrumb ===== */
.breadcrumb {
    list-style: none;
    display: flex;
    gap: 6px;
    padding: 0;
    margin: 0 0 14px;
    font-size: .85rem;
    color: var(--muted);
}

.breadcrumb li + li::before {
    content: "/";
    margin-right: 6px;
    color: #cbd5e1;
}

.breadcrumb a { color: var(--primary); font-weight: 600; }

/* ===== Page head ===== */
.page-head {
    margin-bottom: 16px;
}

.page-head h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
}

.page-desc {
    margin: 8px 0 0;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== Detail ===== */
.detail-head {
    display: flex;
    align-items: center;
    gap: 20px;
}

.detail-icon {
    width: 96px;
    height: 96px;
    flex: 0 0 96px;
    border-radius: 18px;
    overflow: hidden;
    background: #f1f5f9;
    border: 1px solid var(--border);
}

.detail-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-meta h1 {
    margin: 0 0 12px;
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1.3;
}

.button-play {
    display: inline-block;
    background: var(--primary-grad);
    color: #fff;
    font-weight: 800;
    padding: 10px 28px;
    border-radius: 999px;
    box-shadow: var(--shadow-hover);
    transition: transform .15s, box-shadow .15s;
}

.button-play:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(37, 99, 235, .26);
}

.details h2.section-title { margin-top: 8px; }

.detail-desc {
    color: #334155;
    font-size: .95rem;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    background: #f1f5f9;
    border: 1px solid var(--border);
    color: var(--primary-dark);
    font-size: .8rem;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 999px;
}

/* ===== Play ===== */
.play-body .site-header { position: sticky; top: 0; z-index: 100; }

.menu-spacer { width: 42px; }

.btn-home {
    background: #fff;
    color: var(--primary);
    font-weight: 800;
    padding: 8px 18px;
    border-radius: 999px;
    font-size: .9rem;
}

.game-frame {
    background: #0b1220;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.game-iframe {
    width: 100%;
    height: 74vh;
    min-height: 420px;
    display: block;
}

/* ===== Static content ===== */
.static-content h2 {
    font-size: 1.1rem;
    margin: 18px 0 8px;
    color: var(--primary-dark);
}

.static-content p {
    margin: 8px 0;
    color: #334155;
}

/* ===== SEO block ===== */
.seo-block p {
    margin: 0;
    color: #334155;
    font-size: .95rem;
}

/* ===== Footer ===== */
.site-footer {
    background: #0f1a2e;
    color: #cbd5e1;
    padding: 26px 16px;
    margin-top: auto;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 18px;
    font-size: .9rem;
}

.footer-nav a {
    color: #cbd5e1;
    transition: color .15s;
}

.footer-nav a:hover { color: #fff; }

.footer-copy {
    margin: 14px 0 0;
    text-align: center;
    font-size: .82rem;
    color: #94a3b8;
}

/* ===== Tablet (769px ~ 1024px) ===== */
@media (min-width: 769px) and (max-width: 1024px) {
    .game-grid { grid-template-columns: repeat(4, 1fr); }
    .game-iframe { height: 62vh; }
}

/* ===== Mobile (<=768px) ===== */
@media (max-width: 768px) {
    .container { padding: 0 12px; }
    .brand-name { font-size: 1rem; }
    .cat-bar { padding: 8px 12px; }
    .game-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .section { padding: 14px; }
    .section-title { font-size: 1rem; }
    .game-name { font-size: .74rem; padding: 6px 6px; }
    .detail-head { flex-direction: column; align-items: flex-start; gap: 12px; }
    .detail-icon { width: 84px; height: 84px; flex-basis: 84px; }
    .game-iframe { height: 58vh; min-height: 380px; }
    .adbox { min-height: 80px; }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; animation: none !important; }
}