/* ========================================
   Game Page — SEO Template Styles
   ======================================== */

/* --- Game Page Layout --- */
.game-page {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 80px 24px 40px;
}

/* --- Two-column layout: game + sidebar --- */
.game-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 0;
}

.game-main {
    flex: 1;
    min-width: 0;
}

/* --- Breadcrumb --- */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb a:hover {
    color: var(--text-primary);
}

.bc-sep {
    color: var(--text-muted);
    font-size: 14px;
}

.bc-current {
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

/* --- Game Hero (Above the Fold) --- */
.game-hero-section {
    margin-bottom: 20px;
}

.game-hero-section h1 {
    font-size: clamp(24px, 4vw, 36px);
    font-weight: 900;
    letter-spacing: -1px;
    line-height: 1.15;
    margin-bottom: 14px;
}

.game-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.genre-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.platform-badges {
    display: flex;
    gap: 6px;
}

.platform-badge {
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(6, 182, 212, 0.08);
    color: var(--accent-2);
    border: 1px solid rgba(6, 182, 212, 0.15);
}

/* --- Game Container --- */
.game-container-wrap {
    margin-bottom: 40px;
}

.game-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overflow: hidden;
    border: 1px solid var(--border-glass);
    border-bottom: none;
}

.game-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.game-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: var(--bg-primary);
    z-index: 5;
}

.game-loading.hidden {
    display: none;
}

.game-loading p {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-glass);
    border-top-color: var(--accent-1);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Toolbar */
.game-toolbar {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.toolbar-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-glass-hover);
}

.toolbar-btn:active {
    transform: scale(0.97);
}

.toolbar-btn svg {
    width: 15px;
    height: 15px;
}

/* --- Recommendations Sidebar --- */
.game-sidebar {
    width: 290px;
    flex-shrink: 0;
    position: sticky;
    top: 72px;
    max-height: calc(100vh - 90px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-glass) transparent;
    padding-right: 4px;
}

.game-sidebar::-webkit-scrollbar {
    width: 4px;
}

.game-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.game-sidebar::-webkit-scrollbar-thumb {
    background: var(--border-glass);
    border-radius: 2px;
}

.sidebar-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-glass);
}

.sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-loading {
    display: flex;
    justify-content: center;
    padding: 24px 0;
}

.sidebar-card {
    display: flex;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: background 0.15s;
}

.sidebar-card:hover {
    background: var(--bg-card-hover);
}

.sidebar-card:hover .sidebar-card-play {
    opacity: 1;
}

.sidebar-card-img {
    position: relative;
    width: 106px;
    height: 60px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-secondary);
}

.sidebar-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-card-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.15s;
}

.sidebar-card-info {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}

.sidebar-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}

.sidebar-card-genre {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: capitalize;
}

/* --- More Games You May Like Section --- */
.more-games-section {
    margin-top: 48px;
    padding-top: 36px;
    border-top: 1px solid var(--border-glass);
}

.more-games-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 8px;
}

.more-games-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.more-games-all {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-2);
    text-decoration: none;
    transition: opacity 0.15s;
}

.more-games-all:hover {
    opacity: 0.8;
}

.more-games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
}

/* Game card */
.mgc {
    text-decoration: none;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.mgc:hover {
    transform: translateY(-4px);
    border-color: var(--border-glass-hover);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.mgc-img {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: var(--bg-secondary);
}

.mgc-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.mgc:hover .mgc-img img {
    transform: scale(1.05);
}

.mgc-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity 0.2s;
}

.mgc:hover .mgc-play {
    opacity: 1;
}

.mgc-play svg {
    width: 32px;
    height: 32px;
    color: #fff;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
}

.mgc-body {
    padding: 10px 12px 12px;
    flex: 1;
}

.mgc-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.mgc-genre {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: capitalize;
}

/* Skeleton loading cards — same shimmer as homepage */
@keyframes skeleton-shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}

.mgc-skeleton {
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
}

.mgc-skeleton-img {
    aspect-ratio: 16/9;
    background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.10) 50%, rgba(255,255,255,0.04) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.6s infinite linear;
}

.mgc-skeleton-body {
    padding: 10px 12px 14px;
}

.mgc-skeleton-line {
    height: 11px;
    background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.10) 50%, rgba(255,255,255,0.04) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.6s infinite linear;
    border-radius: 6px;
    margin-bottom: 8px;
}

.mgc-skeleton-short {
    width: 55%;
    margin-bottom: 0;
}

/* --- SEO Content --- */
.game-content {
    max-width: 800px;
}

.seo-section {
    margin-bottom: 32px;
}

.seo-section h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.seo-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.seo-section p {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 12px;
    white-space: pre-line;
}

.seo-tips {
    list-style: none;
    padding: 0;
}

.seo-tips li {
    position: relative;
    padding: 8px 0 8px 28px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-glass);
}

.seo-tips li:last-child {
    border-bottom: none;
}

.seo-tips li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--accent-2);
    font-weight: 700;
    font-size: 14px;
}

/* --- Responsive: sidebar collapses to horizontal strip --- */
@media (max-width: 1080px) {
    .game-layout {
        flex-direction: column;
    }

    .game-sidebar {
        width: 100%;
        position: static;
        max-height: none;
        overflow-y: visible;
        padding-right: 0;
    }

    .sidebar-list {
        flex-direction: row;
        overflow-x: auto;
        gap: 8px;
        padding-bottom: 8px;
        scrollbar-width: none;
    }

    .sidebar-list::-webkit-scrollbar {
        display: none;
    }

    .sidebar-card {
        flex-direction: column;
        width: 148px;
        flex-shrink: 0;
        padding: 6px;
    }

    .sidebar-card-img {
        width: 100%;
        height: 83px;
    }

    .sidebar-card-play {
        opacity: 0;
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .game-page {
        padding: 68px 14px 24px;
    }

    .breadcrumb {
        display: none;
    }

    .game-hero-section {
        margin-bottom: 14px;
    }

    .game-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .game-toolbar {
        flex-wrap: wrap;
        gap: 6px;
    }

    .toolbar-btn {
        padding: 10px 16px;
        font-size: 13px;
        flex: 1;
        justify-content: center;
    }

    .more-games-section {
        margin-top: 32px;
        padding-top: 28px;
    }

    .more-games-title {
        font-size: 18px;
    }

    .more-games-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .game-page {
        padding: 64px 12px 20px;
    }

    .game-hero-section h1 {
        font-size: 20px;
        margin-bottom: 10px;
    }

    .game-container-wrap {
        margin-bottom: 28px;
    }

    .game-frame {
        /* taller on portrait phones for better playability */
        aspect-ratio: 4/3;
    }

    .toolbar-btn {
        padding: 12px 16px;
        font-size: 14px;
    }

    .seo-section h2 {
        font-size: 17px;
    }

    .seo-section p,
    .seo-tips li {
        font-size: 14px;
    }
}

/* --- QR Code Popup (game pages) --- */
/* Toolbar is the positioning parent so the popup floats above it */
.game-toolbar { position: relative; }

.gp-qr-popup {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    z-index: 50;
    width: 210px;
    padding: 16px;
    background: var(--bg-secondary, #0f0f23);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transform: translateY(6px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.gp-qr-popup.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.gp-qr-popup img { width: 160px; height: 160px; border-radius: var(--radius-sm); background: #fff; display: block; }
.gp-qr-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-align: center; }
.gp-qr-close {
    position: absolute; top: 8px; right: 8px;
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--bg-glass-strong); border: 1px solid var(--border-glass);
    color: var(--text-muted); display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.15s;
}
.gp-qr-close:hover { background: var(--accent-3); border-color: var(--accent-3); color: #fff; }
#qrBtn.active { color: var(--accent-2, #06b6d4); border-color: var(--accent-2, #06b6d4); }

@media (max-width: 480px) {
    .gp-qr-popup { position: fixed; bottom: 16px; right: 16px; left: 16px; width: auto; }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}