:root {
    --color-bg: #0a1628;
    --color-bg-alt: #0f1f38;
    --color-surface: #152a4a;
    --color-surface-raised: #1c3558;
    --color-header: #071428;
    --color-accent: #38bdf8;
    --color-accent-hover: #7dd3fc;
    --color-accent-warm: #fbbf24;
    --color-text: #e8eef6;
    --color-text-muted: #94a3b8;
    --color-text-heading: #f1f5f9;
    --color-border: rgba(56, 189, 248, 0.18);
    --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.35);
    --shadow-glow: 0 4px 20px rgba(56, 189, 248, 0.15);
}

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

.site-header {
    background: linear-gradient(90deg, var(--color-header) 0%, #0e2444 100%);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    padding: 16px 0;
    margin-bottom: 24px;
}

.site-header .site-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-heading);
    text-decoration: none;
    letter-spacing: 0.02em;
}

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

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 32px;
    color: var(--color-text-heading);
    border-left: 4px solid var(--color-accent);
    padding-left: 12px;
}

.main {
    margin-bottom: 48px;
}

.box {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 48px 32px 56px;
    box-shadow: var(--shadow-md);
}

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

a:hover .item {
    transform: translateY(-3px);
    border-color: rgba(56, 189, 248, 0.45);
    box-shadow: var(--shadow-glow);
}

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

.item .logo img {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.item .desc {
    display: none;
}

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

/* Bootstrap overrides */
.btn-primary {
    background: linear-gradient(135deg, #1d4ed8 0%, var(--color-accent) 100%);
    border: none;
    color: #fff;
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.35);
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, #2563eb 0%, var(--color-accent-hover) 100%);
    border: none;
    color: #fff;
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.45);
}

.btn-outline-secondary {
    color: var(--color-text-muted);
    border-color: var(--color-border);
    background: transparent;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
    color: var(--color-accent);
    border-color: var(--color-accent);
    background: rgba(56, 189, 248, 0.08);
}

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

.game-detail .game-icon {
    width: 160px;
    height: 160px;
    border-radius: 20px;
    object-fit: cover;
    box-shadow: var(--shadow-glow);
    margin-bottom: 16px;
    border: 2px solid var(--color-border);
}

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

.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;
}

.game-frame-wrap {
    display: none;
    margin-top: 32px;
    margin-bottom: 16px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    background: #000;
    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-surface-raised);
    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: 1px 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;
}

/* Homepage pyramid layout: 1-2-3-4-4-3-2-1 */
.game-list-pyramid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.game-list-pyramid .game-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    width: 100%;
}

.game-list-pyramid .game-cell {
    flex: 0 0 auto;
    width: 200px;
}

.game-list-pyramid .game-cell .item {
    margin-bottom: 0;
    padding: 8px;
}

.game-list-pyramid .item .logo {
    gap: 14px;
    font-size: 1rem;
}

.game-list-pyramid .item .logo img {
    width: 140px;
    height: 140px;
    border-radius: 18px;
}

.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-accent);
}

.ad-banner {
    display: none;
    margin: 28px auto 40px;
    box-sizing: border-box;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
}
.ad-banner.is-visible {
    display: flex !important;
}
.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;
}
.ad-banner--home .ad-banner__frame {
    width: 980px;
    max-width: 100%;
}
.ad-banner--home .ad-slot {
    width: 980px !important;
    max-width: 100% !important;
    min-width: 0 !important;
}
.ad-banner--home .ad-slot > div,
.ad-banner--home .ad-slot iframe {
    max-width: 100% !important;
}
.ad-banner--home .ad-slot iframe {
    width: 980px !important;
    max-width: 100% !important;
}
@media (max-width: 768px) {
    .box {
        padding: 32px 16px 40px;
    }

    .item {
        padding: 10px 8px;
    }

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

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

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

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

    .game-list-pyramid {
        gap: 14px;
    }

    .game-list-pyramid .game-row {
        gap: 12px;
    }

    .game-list-pyramid .game-cell {
        width: 130px;
    }

    .game-list-pyramid .item .logo img {
        width: 96px;
        height: 96px;
    }

    .ad-banner--home .ad-banner__frame,
    .ad-banner--home .ad-slot {
        width: 300px !important;
        max-width: 300px !important;
        min-width: 300px !important;
    }

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