:root {
    --color-bg: #f0fdfa;
    --color-surface: #ffffff;
    --color-header-from: #0f766e;
    --color-header-to: #134e4a;
    --color-primary: #0d9488;
    --color-primary-hover: #0f766e;
    --color-primary-light: #ccfbf1;
    --color-accent: #fb923c;
    --color-text: #134e4a;
    --color-text-muted: #5b7c7a;
    --color-border: #99f6e4;
    --color-border-strong: #5eead4;
    --color-frame-bg: #042f2e;
    --shadow-color: rgba(15, 118, 110, 0.1);
    --shadow-hover: rgba(13, 148, 136, 0.18);
    --shadow-btn: rgba(13, 148, 136, 0.35);
}

body {
    background-color: var(--color-bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--color-text);
}

.site-header {
    background: linear-gradient(135deg, var(--color-header-from) 0%, var(--color-header-to) 100%);
    box-shadow: 0 4px 16px var(--shadow-color);
    padding: 16px 0;
    margin-bottom: 24px;
}

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

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 32px;
    color: var(--color-text);
}

.main {
    margin-bottom: 48px;
}

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

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

a:hover .item {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px var(--shadow-hover);
    background: var(--color-primary-light);
    border-color: var(--color-border-strong);
}

.item .logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text);
    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 var(--shadow-color);
}

.item .desc {
    display: none;
}

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

/* Bootstrap overrides */
.btn-primary {
    --bs-btn-bg: var(--color-primary);
    --bs-btn-border-color: var(--color-primary);
    --bs-btn-hover-bg: var(--color-primary-hover);
    --bs-btn-hover-border-color: var(--color-primary-hover);
    --bs-btn-active-bg: var(--color-primary-hover);
    --bs-btn-active-border-color: var(--color-primary-hover);
    --bs-btn-focus-shadow-rgb: 13, 148, 136;
}

.btn-outline-secondary {
    --bs-btn-color: var(--color-text-muted);
    --bs-btn-border-color: var(--color-border-strong);
    --bs-btn-hover-bg: var(--color-primary-light);
    --bs-btn-hover-border-color: var(--color-primary);
    --bs-btn-hover-color: var(--color-primary-hover);
}

/* 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: 0 6px 24px var(--shadow-hover);
    margin-bottom: 16px;
}

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

.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;
    box-shadow: 0 4px 14px var(--shadow-btn);
}

.game-frame-wrap {
    display: none;
    margin-top: 32px;
    margin-bottom: 16px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px var(--shadow-color);
    background: var(--color-frame-bg);
    border: 1px solid var(--color-border-strong);
}

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

.game-frame-wrap iframe {
    width: 100%;
    height: 600px;
    border: none;
    display: block;
    background: var(--color-frame-bg);
}

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

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

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

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