:root {
    --color-bg: #eef0fb;
    --color-header: #4f46e5;
    --color-header-hover: #c7d2fe;
    --color-primary: #6366f1;
    --color-primary-dark: #4338ca;
    --color-primary-light: #eef2ff;
    --color-text: #1e1b4b;
    --color-text-muted: #64748b;
    --color-card: #ffffff;
    --color-card-bg: #f5f3ff;
    --color-border: #ddd6fe;
    --color-border-hover: #a78bfa;
    --color-shadow: rgba(79, 70, 229, 0.12);
    --color-shadow-hover: rgba(79, 70, 229, 0.22);
}

body {
    background: linear-gradient(160deg, #eef0fb 0%, #e8ecff 45%, #f3effc 100%);
    background-attachment: fixed;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--color-text);
    min-height: 100vh;
}

.site-header {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    box-shadow: 0 4px 20px var(--color-shadow-hover);
    padding: 18px 0;
    margin-bottom: 28px;
}

.site-header .site-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: 0.02em;
}

.site-header .site-title:hover {
    color: var(--color-header-hover);
}

.section-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 32px;
    color: var(--color-primary-dark);
    padding-left: 14px;
    border-left: 4px solid var(--color-primary);
}

.ad-banner {
    display: none;
    margin: 28px auto 40px;
    /* padding: 20px 0; */
    box-sizing: border-box;
}

.ad-banner.is-visible {
    display: flex !important;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
}

.ad-banner__frame {
    width: 300px;
    max-width: 300px;
    margin: 0 auto;
    overflow: hidden;
    flex-shrink: 0;
    line-height: 0;
}

.ad-banner .ad-slot {
    width: 300px !important;
    max-width: 300px !important;
    min-width: 300px;
    margin: 0 auto !important;
    overflow: hidden !important;
    text-align: center;
    line-height: 0;
}

.ad-banner .ad-slot > div,
.ad-banner .ad-slot iframe {
    max-width: 300px !important;
}

.ad-banner .ad-slot iframe {
    width: 300px !important;
}

.main {
    margin-bottom: 48px;
}

.box {
    background: var(--color-card);
    border-radius: 16px;
    padding: 48px 32px 56px;
    box-shadow: 0 8px 32px var(--color-shadow);
    border: 1px solid var(--color-border);
}

.item {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 16px 12px;
    margin-bottom: 16px;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s, background 0.2s;
    height: 100%;
}

a:hover .item {
    transform: translateY(-4px);
    background: var(--color-card);
    border-color: var(--color-border-hover);
    box-shadow: 0 10px 24px var(--color-shadow-hover);
}

.item .logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text);
    margin-bottom: 0;
    word-break: break-word;
    text-align: center;
    line-height: 1.3;
}

.item .logo img {
    width: 80px;
    height: 80px;
    border-radius: 14px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

.item .desc {
    display: none;
}

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

/* Detail page */
.game-detail {
    text-align: center;
    padding-bottom: 16px;
}

.game-detail .game-icon {
    width: 160px;
    height: 160px;
    border-radius: 22px;
    object-fit: cover;
    box-shadow: 0 8px 28px var(--color-shadow-hover);
    margin-bottom: 16px;
    border: 3px solid var(--color-border);
}

.game-detail .game-name {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--color-primary-dark);
}

.game-detail .game-desc {
    color: var(--color-text-muted);
    margin-bottom: 24px;
}

.btn-start-game {
    padding: 12px 48px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 50px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border: none;
    box-shadow: 0 4px 16px var(--color-shadow-hover);
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-start-game:hover,
.btn-start-game:focus {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    box-shadow: 0 6px 20px var(--color-shadow-hover);
    transform: translateY(-1px);
}

.game-frame-wrap {
    display: none;
    margin-top: 32px;
    margin-bottom: 16px;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 8px 28px var(--color-shadow);
    background: #1e1b4b;
    border: 1px solid var(--color-border);
}

.game-frame-wrap.active {
    display: block;
}

.game-frame-toolbar {
    display: flex;
    justify-content: flex-end;
    padding: 8px 12px;
    background: var(--color-primary-light);
    border-bottom: 1px solid var(--color-border);
}

.game-frame-wrap iframe {
    width: 100%;
    height: 600px;
    border: none;
    display: block;
    background: #000;
}

.game-frame-wrap:fullscreen,
.game-frame-wrap:-webkit-full-screen,
.game-frame-wrap:-moz-full-screen {
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
}

.game-frame-wrap:fullscreen .game-frame-toolbar,
.game-frame-wrap:-webkit-full-screen .game-frame-toolbar,
.game-frame-wrap:-moz-full-screen .game-frame-toolbar {
    flex-shrink: 0;
}

.game-frame-wrap:fullscreen iframe,
.game-frame-wrap:-webkit-full-screen iframe,
.game-frame-wrap:-moz-full-screen iframe {
    flex: 1;
    height: auto;
    min-height: 0;
}

.more-games {
    margin-top: 64px;
    padding: 48px 0 56px;
    border-top: 2px solid var(--color-border);
}

.more-games .section-title {
    margin-top: 0;
    margin-bottom: 32px;
}

.more-games .item {
    margin-bottom: 0;
}

.main .box .row.g-4 .item {
    margin-bottom: 0;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--color-text-muted);
    text-decoration: none;
    margin-bottom: 20px;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--color-primary);
}

@media (max-width: 768px) {
    .box {
        padding: 28px 16px 48px;
    }

    .section-title {
        margin-bottom: 16px;
    }

    .ad-banner {
        margin: 32px auto 40px;
        padding: 24px 0;
    }

    .ad-banner .ad-slot {
        width: 300px;
        max-width: 300px;
        min-width: 300px;
    }

    .back-link {
        margin-bottom: 4px;
    }

    .ad-banner + .game-detail {
        padding-top: 12px;
    }

    .ad-banner + .row {
        margin-top: 4px;
    }

    .item {
        padding: 12px 8px;
        text-align: center;
    }

    .game-detail .game-desc {
        display: none;
    }

    .item .logo {
        font-size: 0.8rem;
    }

    .item .logo img {
        width: 72px;
        height: 72px;
    }

    .game-frame-wrap iframe {
        height: 400px;
    }
}
