/* Game play page — matches portal homepage */

.game-page {
    --shell: 1440px;
}

.game-main {
    padding: 16px 0 48px;
}

.game-shell {
    max-width: var(--shell);
    margin: 0 auto;
    padding: 0 16px;
}

.game-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 18px;
    align-items: start;
}

.game-primary {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Stage */
.game-stage-card {
    background: var(--bg-elevated, #141b24);
    border: 1px solid var(--line, rgba(255, 255, 255, 0.08));
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.game-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    max-height: min(72vh, 820px);
    background: #000;
    overflow: hidden;
}

.game-page.theater-mode .game-stage {
    aspect-ratio: auto;
    height: min(86vh, 920px);
    max-height: none;
}

.game-iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
    opacity: 0;
    pointer-events: none;
}

.game-stage.is-playing .game-iframe {
    opacity: 1;
    pointer-events: auto;
}

.game-stage:fullscreen,
.game-stage:-webkit-full-screen {
    aspect-ratio: auto;
    width: 100vw;
    height: 100vh;
    max-height: none;
}

.game-stage:fullscreen .game-iframe,
.game-stage:-webkit-full-screen .game-iframe {
    opacity: 1;
    pointer-events: auto;
}

/* Play gate */
.game-play-gate {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    cursor: pointer;
    background: #0b1220;
}

.game-play-gate[hidden] {
    display: none !important;
}

.game-play-cover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.45) saturate(1.05);
    transform: scale(1.02);
}

.game-play-gate-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px;
    text-align: center;
}

.game-play-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    border: 0;
    border-radius: 999px;
    padding: 16px 28px;
    font: inherit;
    font-weight: 800;
    font-size: 1.05rem;
    color: #111827;
    background: var(--accent, #ffe14a);
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(255, 225, 74, 0.28);
    transition: transform 0.2s cubic-bezier(0.34, 1.4, 0.64, 1), box-shadow 0.2s ease;
}

.game-play-btn i {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.12);
    font-size: 0.85rem;
    padding-left: 2px;
}

.game-play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 14px 34px rgba(255, 225, 74, 0.4);
}

.game-play-hint {
    margin: 0;
    color: #e2e8f0;
    font-size: 0.9rem;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.65);
}

/* Toolbar */
.game-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: linear-gradient(180deg, #1a2330 0%, #121922 100%);
    border-top: 1px solid var(--line, rgba(255, 255, 255, 0.08));
}

.game-toolbar-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.game-toolbar-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.game-toolbar-title h1 {
    margin: 0;
    font-family: "Pixelify Sans", "Outfit", sans-serif;
    font-size: clamp(1rem, 2vw, 1.25rem);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.game-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: #e2e8f0;
    border-radius: 10px;
    padding: 9px 12px;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.game-tool-btn:hover,
.game-tool-btn.is-active {
    background: rgba(255, 225, 74, 0.14);
    border-color: rgba(255, 225, 74, 0.45);
    color: #ffe14a;
}

.game-tool-btn:active {
    transform: translateY(1px);
}

/* Details */
.game-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.game-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.game-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 11px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    font-size: 0.8rem;
    font-weight: 600;
}

.game-chip--genre {
    background: color-mix(in srgb, var(--chip, #3ddc97) 22%, transparent);
    border-color: color-mix(in srgb, var(--chip, #3ddc97) 45%, transparent);
    color: #f8fafc;
}

.game-panel {
    background: var(--bg-elevated, #141b24);
    border: 1px solid var(--line, rgba(255, 255, 255, 0.08));
    border-radius: 14px;
    padding: 18px 20px;
}

.game-panel h2 {
    margin: 0 0 10px;
    font-family: "Pixelify Sans", "Outfit", sans-serif;
    font-size: 1.15rem;
}

.game-panel p {
    margin: 0;
    color: var(--muted, #94a3b8);
    line-height: 1.7;
    font-size: 0.98rem;
}

/* Related */
.game-aside {
    position: sticky;
    top: 76px;
    background: var(--bg-elevated, #141b24);
    border: 1px solid var(--line, rgba(255, 255, 255, 0.08));
    border-radius: 14px;
    padding: 14px;
    max-height: calc(100vh - 96px);
    overflow: auto;
}

.game-aside-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.game-aside-head h2 {
    margin: 0;
    font-family: "Pixelify Sans", "Outfit", sans-serif;
    font-size: 1.05rem;
}

.game-aside-link {
    color: var(--accent-2, #3ddc97);
    font-size: 0.82rem;
    font-weight: 700;
}

.game-related-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.game-related-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}

.game-related-media {
    position: relative;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #1a2330;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.game-related-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.game-related-card:hover .game-related-media {
    transform: translateY(-2px) scale(1.02);
    border-color: rgba(61, 220, 151, 0.45);
}

.game-related-card:hover .play-burst {
    opacity: 1;
}

.game-related-card .play-burst i {
    width: 36px;
    height: 36px;
    font-size: 0.75rem;
}

.game-related-title {
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #e2e8f0;
}

/* Theater mode */
.game-page.theater-mode .game-aside,
.game-page.theater-mode .game-details,
.game-page.theater-mode .site-footer {
    display: none;
}

.game-page.theater-mode .game-layout {
    grid-template-columns: 1fr;
}

.game-page.theater-mode .game-shell {
    max-width: 1600px;
}

.game-page.theater-mode .portal-header {
    opacity: 0.92;
}

@media (max-width: 1100px) {
    .game-layout {
        grid-template-columns: 1fr;
    }

    .game-aside {
        position: static;
        max-height: none;
    }

    .game-related-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }
}

@media (max-width: 700px) {
    .game-stage {
        aspect-ratio: 4 / 3;
        max-height: min(62vh, 560px);
        border-radius: 0;
    }

    .game-stage-card {
        border-radius: 12px;
    }

    .game-toolbar {
        flex-wrap: wrap;
        padding: 10px;
    }

    .game-toolbar-actions {
        width: 100%;
        justify-content: stretch;
    }

    .game-tool-btn {
        flex: 1;
        justify-content: center;
        padding: 10px 8px;
    }

    .game-tool-btn span {
        display: none;
    }

    .game-play-btn {
        padding: 14px 22px;
        font-size: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .game-play-btn,
    .game-related-media,
    .game-tool-btn {
        transition: none;
    }
}
