/* base.css - shared site styles for Cocos Games */

:root {
    --bg-base: #f4f6f8; /* Light gray Poki-like background */
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --accent-primary: #0077b6; /* Accessible blue for white button text */
    --accent-hover: #005f91;
    
    --ad-bg: #e2e8f0;
    --ad-border: #cbd5e1;
    
    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
    --radius-full: 9999px;
    
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Styles & Resets */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
    overflow-x: hidden;
}

body.has-bottom-ad {
    padding-bottom: 70px;
}

body.is-playing {
    padding-bottom: 0;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button, input { font-family: inherit; border: none; outline: none; }
.hidden { display: none !important; }

/* Layout Containers */
.container {
    width: 100%;
    max-width: 1200px; /* Poki is usually compact and dense */
    margin: 0 auto;
    padding: 0 1rem;
}

/* Typography Utilities */
.text-gradient {
    background: linear-gradient(135deg, #0077b6, #6d28d9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

.ui-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-style: normal;
    flex: 0 0 auto;
}

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    padding: 0.75rem 0;
    margin-bottom: 2rem;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: -0.05em;
    cursor: pointer;
    color: var(--text-primary);
}

.logo-icon {
    font-size: 2.2rem;
    transition: transform 0.3s ease;
}

.logo:hover .logo-icon {
    transform: rotate(-15deg) scale(1.1);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Search Box */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    background: #f1f5f9;
    border: 2px solid transparent;
    color: var(--text-primary);
    padding: 0.6rem 2.5rem 0.6rem 1.2rem;
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-weight: 500;
    width: 250px;
    transition: var(--transition);
}

.search-input:focus {
    background: #ffffff;
    border-color: var(--accent-primary);
    box-shadow: 0 4px 15px rgba(0, 119, 182, 0.22);
    width: 300px;
}

.search-icon {
    position: absolute;
    right: 15px;
    color: var(--text-secondary);
    pointer-events: none;
}

/* Language Dropdown */
.lang-dropdown {
    position: relative;
    cursor: pointer;
}

.lang-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    color: var(--text-primary);
    background: #ffffff;
    border: 1px solid #cbd5e1;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    transition: var(--transition);
}

.lang-dropdown:hover .lang-toggle {
    color: var(--text-primary);
    background: #e2e8f0;
}

.lang-menu {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 0.5rem;
    min-width: 120px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
    z-index: 101;
}

.lang-dropdown:hover .lang-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-menu-item {
    display: block;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.lang-menu-item:hover {
    background: #f8fafc;
    color: var(--accent-primary);
}

.lang-menu-item.is-disabled {
    opacity: 0.56;
    pointer-events: none;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 1rem 1rem 2rem;
}

.hero-title {
    color: var(--text-primary);
    font-size: clamp(2rem, 4vw, 3.5rem);
    line-height: 1.05;
    margin: 0 auto 0.75rem;
    max-width: 820px;
    font-weight: 800;
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: 1.2rem;
    max-width: 700px;
    margin: 0 auto;
    font-weight: 600;
}

.mobile-search {
    display: none;
    margin-bottom: 1.5rem;
}

.mobile-search .search-input {
    width: 100%;
    padding: 0.8rem 1.5rem;
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    .search-box { display: none; }
    .hero {
        padding: 0.75rem 0.75rem 1rem;
    }

    .hero-title,
    .hero-subtitle {
        display: none;
    }

    .mobile-search {
        display: flex;
        position: relative;
        margin-bottom: 0.75rem;
    }

    .mobile-search::after {
        content: '🔍';
        font-size: 0.9rem;
        font-weight: 800;
        position: absolute;
        right: 1.5rem;
        top: 50%;
        transform: translateY(-50%);
        color: var(--text-secondary);
    }

    .filters {
        flex-wrap: nowrap;
        gap: 0.45rem;
        margin-bottom: 1rem;
        min-height: 42px;
    }

    .filter-btn {
        flex: 1 1 0;
        min-width: 0;
        padding: 0.52rem 0.35rem;
        font-size: 0.9rem;
        text-align: center;
        white-space: nowrap;
    }
}

/* Filters */
.filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    min-height: 48px;
}

.filter-btn {
    background: #ffffff;
    border: 2px solid #d7dee8;
    color: var(--text-secondary);
    padding: 0.6rem 1.5rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    transition: var(--transition);
}

.filter-btn:hover {
    transform: translateY(-2px);
    color: var(--text-primary);
    box-shadow: 0 6px 12px rgba(0,0,0,0.05);
}

.filter-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #ffffff;
    box-shadow: 0 6px 15px rgba(0, 119, 182, 0.28);
}

.game-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-full);
    background: rgba(15, 23, 42, 0.72);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    backdrop-filter: blur(6px);
}

/* Game Grid (Dense Poki Style) */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    grid-auto-flow: dense;
    grid-auto-rows: 178px;
    gap: 1rem;
    margin-bottom: 3rem;
    min-height: 760px;
}

#recommend-grid {
    min-height: 0;
    margin-bottom: 1rem;
}

@media (min-width: 1024px) {
    .game-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        grid-auto-rows: 198px;
        gap: 1.25rem;
        min-height: 640px;
    }
}

@media (max-width: 640px) {
    .game-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-auto-rows: 118px;
        gap: 0.5rem;
        min-height: 900px;
    }
}

/* Game Card */
.game-card {
    background: var(--bg-card);
    border-radius: 1.25rem;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.04);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    position: relative;
    min-width: 0;
    height: 100%;
}

.game-card:hover {
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    z-index: 5;
}

.game-media {
    position: relative;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    background: #e2e8f0;
}

.game-card.rank-2 {
    grid-column: span 2;
}

.game-card.rank-3 {
    grid-column: span 2;
    grid-row: span 2;
}

.game-card.rank-2,
.game-card.rank-3 {
    border: 2px solid rgba(0, 191, 255, 0.18);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.game-img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center center;
    transition: transform 0.3s ease;
}

.game-card.rank-2 .game-img,
.game-card.rank-3 .game-img {
    object-fit: contain;
    background: #eef2f7;
}

.game-card:hover .game-img {
    transform: scale(1.1);
}

.game-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(8, 47, 73, 0.1) 0%, rgba(8, 47, 73, 0.28) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.22s ease;
}

.game-card:hover .game-overlay {
    opacity: 1;
}

.play-icon {
    position: relative;
    width: 2.55rem;
    height: 2.55rem;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0.24) 45%, rgba(255, 255, 255, 0.16) 100%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 10px 22px rgba(2, 6, 23, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.55);
    color: transparent;
    font-size: 0;
    transform: translateY(3px) scale(0.84);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.play-icon::before {
    content: '';
    position: absolute;
    left: 52%;
    top: 50%;
    transform: translate(-45%, -50%);
    width: 0;
    height: 0;
    border-top: 0.43rem solid transparent;
    border-bottom: 0.43rem solid transparent;
    border-left: 0.68rem solid rgba(255, 255, 255, 0.97);
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
}

.game-card:hover .play-icon {
    transform: translateY(0) scale(1);
    box-shadow: 0 12px 26px rgba(2, 6, 23, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

@media (max-width: 640px) {
    .game-overlay { display: none; }
}

.game-info {
    padding: 0.5rem 0.5rem 0.75rem;
    text-align: center;
    background: #ffffff;
}

.game-title {
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

@media (max-width: 640px) {
    .game-card,
    .game-card.rank-2 {
        grid-column: span 1;
        grid-row: span 1;
        border: 0;
        box-shadow: 0 4px 8px rgba(0,0,0,0.04);
    }

    .game-card.rank-3 {
        grid-column: span 2;
        grid-row: span 2;
    }

    .game-card.rank-2 .game-img,
    .game-card.rank-3 .game-img {
        object-fit: cover;
        background: #e2e8f0;
    }

    .game-info {
        padding: 0.4rem 0.35rem 0.5rem;
    }

    .game-title {
        font-size: 0.8rem;
        line-height: 1.15;
    }

    .game-card.rank-3 .game-title {
        font-size: 0.9rem;
    }
}

@media (max-width: 420px) {
    .game-grid {
        grid-auto-rows: 112px;
        gap: 0.45rem;
    }
}

/* Load More */
.load-more-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 4rem;
}

.btn-primary {
    background: var(--accent-primary);
    color: #ffffff;
    padding: 1rem 2.5rem;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 6px 15px rgba(0, 119, 182, 0.28);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 119, 182, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Game Player View */
#game-view {
    display: none; 
    flex-direction: column;
    width: 100%;
}

#game-view.active {
    display: flex;
}

.player-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: #ffffff;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-weight: 700;
    cursor: pointer;
    font-size: 1rem;
    background: #f1f5f9;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-back:hover {
    background: #e2e8f0;
    color: var(--text-primary);
}

.player-title {
    font-size: 1.25rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60vw;
    min-width: 0;
    text-align: center;
}

.toolbar-spacer {
    width: 50px;
    flex-shrink: 0;
}

.player-frame-wrapper {
    position: relative;
    width: 100%;
    height: clamp(520px, calc(100vh - 230px), 720px);
    height: clamp(520px, calc(100dvh - 230px), 720px);
    background: linear-gradient(145deg, #334d7f, #7b4b84 48%, #d44c7f);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
}

.mobile-play-back {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0px) + 4.1rem);
    left: calc(env(safe-area-inset-left, 0px) - 0.2rem);
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.16rem;
    width: 3.35rem;
    height: 2.45rem;
    border: none;
    border-radius: 0 0.85rem 0.85rem 0;
    background: #ffffff;
    color: #0f172a;
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.2);
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.mobile-play-back:hover {
    transform: translateX(2px);
    background: #ffffff;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.24);
}

.mobile-back-arrow {
    display: block;
    width: 0.75rem;
    height: 0.75rem;
    border-left: 0.26rem solid #0b8df5;
    border-bottom: 0.26rem solid #0b8df5;
    border-radius: 0.12rem;
    transform: rotate(45deg);
    filter: drop-shadow(0 0 3px rgba(11, 141, 245, 0.58));
}

.mobile-back-logo {
    display: block;
    width: 1.22rem;
    height: 1.22rem;
    flex: 0 0 auto;
}

.mobile-play-back[hidden] {
    display: none;
}

.player-loading {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 42%);
    transition: opacity 0.28s ease;
}

.player-loading-content {
    display: grid;
    justify-items: center;
    gap: 0.75rem;
    text-align: center;
}

.player-loading-image {
    width: clamp(96px, 15vw, 146px);
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 0.7rem;
    border: 2px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 14px 30px rgba(2, 6, 23, 0.35);
}

.player-loading-title {
    color: #ffffff;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    font-weight: 800;
    line-height: 1.2;
    text-shadow: 0 2px 14px rgba(15, 23, 42, 0.28);
}

.player-loading-dots {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.player-loading-dots span {
    width: 0.62rem;
    height: 0.62rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    animation: playerLoadingPulse 1s ease-in-out infinite;
}

.player-loading-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.player-loading-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@media (max-width: 768px) {
    body.is-playing .navbar {
        margin-bottom: 0.75rem;
        padding: 0.55rem 0;
    }

    body.is-playing .logo {
        font-size: 1.35rem;
    }

    body.is-playing .logo-icon {
        width: 30px;
        height: 30px;
    }

    .player-toolbar {
        border-radius: 0;
        box-shadow: none;
        border-top: 1px solid #e2e8f0;
        border-bottom: 1px solid #e2e8f0;
        margin: 0 -1rem 0.75rem;
        padding: 0.55rem 1rem;
    }

    .btn-back {
        padding: 0.45rem 0.75rem;
        font-size: 0.95rem;
    }

    .player-title {
        flex: 1;
        max-width: none;
        font-size: 1rem;
    }

    .toolbar-spacer {
        display: none;
    }

    .player-frame-wrapper {
        height: calc(100vh - 132px);
        height: calc(100dvh - 132px); 
        border-radius: 0;
        margin: 0 -1rem; /* Full bleed on mobile */
        width: calc(100% + 2rem);
    }
}

@media (max-width: 900px) {
    body.mobile-play-active {
        overflow: hidden;
    }

    body.mobile-play-active .navbar,
    body.mobile-play-active .player-toolbar,
    body.mobile-play-active .footer,
    body.mobile-play-active #game-page > .container:nth-child(2) {
        display: none;
    }

    body.mobile-play-active #game-page > .container:first-child {
        width: 100%;
        max-width: none;
        padding: 0;
    }

    body.mobile-play-active .player-frame-wrapper {
        position: fixed;
        inset: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        margin: 0;
        border-radius: 0;
        z-index: 1200;
        box-shadow: none;
    }

    body.mobile-play-active .player-frame-wrapper.is-landscape {
        display: flex;
        align-items: center;
        justify-content: center;
        background: #333333;
    }

    body.mobile-play-active .player-frame-wrapper.is-landscape .player-iframe {
        width: min(100vw, 177.78vh);
        width: min(100vw, 177.78dvh);
        height: min(56.25vw, 100vh);
        height: min(56.25vw, 100dvh);
        flex: 0 0 auto;
    }

    body.mobile-play-active .mobile-play-back {
        position: fixed;
        z-index: 1210;
    }
}

.player-iframe {
    width: 100%;
    height: 100%;
    border: none;
    opacity: 0;
    transition: opacity 0.28s ease;
}

.player-frame-wrapper.is-ready .player-iframe {
    opacity: 1;
}

.player-frame-wrapper.is-ready .player-loading {
    opacity: 0;
    pointer-events: none;
}

@keyframes playerLoadingPulse {
    0%, 80%, 100% {
        transform: scale(0.84);
        opacity: 0.55;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.game-seo-panel[hidden] {
    display: none;
}

.game-seo-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 330px);
    gap: 2rem;
    align-items: start;
    margin: 2rem 0 0;
    padding: clamp(1.25rem, 3vw, 2rem);
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    box-shadow: 0 14px 35px rgba(15, 23, 42, 0.06);
}

.game-seo-kicker {
    color: var(--accent-primary);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
    margin-bottom: 0.35rem;
}

.game-seo-panel h1 {
    color: var(--text-primary);
    font-size: clamp(1.8rem, 4vw, 2.45rem);
    line-height: 1.08;
    margin-bottom: 1rem;
}

.game-seo-description {
    color: #334155;
    font-size: 1.05rem;
    line-height: 1.75;
    max-width: 72ch;
}

.game-seo-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0 1.35rem;
}

.game-seo-tag {
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid rgba(0, 191, 255, 0.35);
    border-radius: var(--radius-full);
    color: #0369a1;
    background: #f0f9ff;
    font-size: 0.86rem;
    font-weight: 700;
}

.game-seo-questions {
    display: grid;
    gap: 1.1rem;
}

.game-seo-question h2 {
    color: var(--text-primary);
    font-size: 1.18rem;
    line-height: 1.25;
    margin-bottom: 0.35rem;
}

.game-seo-question p {
    color: #475569;
    font-size: 1rem;
    line-height: 1.7;
}

.game-seo-list {
    margin: 12px 0 0;
    padding-left: 22px;
    color: #475569;
    font-size: 1rem;
    line-height: 1.7;
}

.game-seo-list li + li {
    margin-top: 6px;
}

.game-seo-faq h2 {
    color: var(--text-primary);
    font-size: 1.18rem;
    line-height: 1.25;
    margin-bottom: 0.75rem;
}

.game-seo-faq-list {
    display: grid;
    gap: 0.85rem;
}

.game-seo-faq-item {
    padding: 0.9rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
}

.game-seo-faq-item h3 {
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.3;
    margin-bottom: 0.35rem;
}

.game-seo-faq-item p {
    color: #475569;
    font-size: 0.96rem;
    line-height: 1.65;
}

.game-seo-rich-section {
    display: grid;
    gap: 0.8rem;
    margin-top: 0.2rem;
}

.game-seo-card {
    padding: 1rem 1.05rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
}

.game-video-shell {
    width: 100%;
}

.game-video-embed {
    position: relative;
    width: 100%;
    overflow: hidden;
    border: 1px solid #dbe4ee;
    border-radius: var(--radius-md);
    background: #0f172a;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
    aspect-ratio: 16 / 9;
}

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

.game-seo-external-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #0369a1;
    font-weight: 700;
}

.game-seo-external-link:hover {
    color: #075985;
}

.game-seo-media {
    margin: 0;
    position: sticky;
    top: 6rem;
}

.game-seo-media img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: var(--radius-md);
    background: #e2e8f0;
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.12);
}

@media (max-width: 768px) {
    .game-seo-panel {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        margin-top: 1.25rem;
        border-radius: var(--radius-md);
    }

    .game-seo-panel h1 {
        font-size: 1.65rem;
    }

    .game-seo-description,
    .game-seo-question p {
        font-size: 0.98rem;
    }

    .game-seo-card {
        padding: 0.95rem;
    }

    .game-seo-media {
        position: static;
        max-width: 220px;
    }
}

/* Sections */
.section-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 3rem 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.section-title i {
    color: #ff3366; 
}

/* Layout Utilities for views */
#home-view { display: none; }
#home-view.active { display: block; }

/* 1. Sticky Bottom Banner Ad */
.ad-sticky-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: var(--ad-bg);
    border-top: 1px solid var(--ad-border);
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.ad-sticky-bottom[hidden] {
    display: none;
}

body.is-playing .ad-sticky-bottom {
    display: none;
}

.footer {
    text-align: center;
    padding: 2rem 1rem 1rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: auto;
}

.footer-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.9rem 1.5rem;
    margin-bottom: 0.9rem;
}

.footer-nav a {
    color: var(--text-primary);
    font-weight: 700;
    transition: var(--transition);
}

.footer-nav a:hover {
    color: var(--accent-primary);
}

body.static-page {
    padding-bottom: 0;
    overflow-x: clip;
}

.nav-link-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    background: #f1f5f9;
    color: var(--text-secondary);
    font-weight: 700;
    transition: var(--transition);
}

.nav-link-pill:hover {
    background: #e2e8f0;
    color: var(--text-primary);
}

.landing-page {
    flex: 1;
}

.landing-hero {
    padding: 1rem 0 3rem;
    text-align: center;
}

.landing-kicker {
    color: var(--accent-primary);
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
    margin-bottom: 0.65rem;
}

.landing-hero h1 {
    max-width: 860px;
    margin: 0 auto 1rem;
    font-size: clamp(2.35rem, 6vw, 4.7rem);
    line-height: 1;
}

.landing-lead {
    max-width: 780px;
    margin: 0 auto;
    color: var(--text-secondary);
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.65;
}

.landing-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.5rem;
}

.landing-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.guide-cta {
    min-width: 260px;
    justify-content: center;
    color: #ffffff !important;
    white-space: normal;
    text-align: center;
    font-size: 1.02rem;
    position: relative;
}

.guide-cta .ui-icon,
.guide-cta .guide-cta-text {
    display: inline-flex !important;
    align-items: center;
    visibility: visible !important;
    opacity: 1 !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

.guide-cta::before {
    content: attr(aria-label);
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    font-weight: 700;
    font-size: 1.02rem;
    line-height: 1.2;
}

.guide-cta .ui-icon,
.guide-cta .guide-cta-text {
    display: none !important;
}

.landing-band {
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    padding: 2.5rem 0;
    margin-bottom: 2.5rem;
}

.landing-copy-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2rem;
}

.landing-copy-grid h2,
.landing-faq h2,
.section-heading-row h2 {
    font-size: 1.55rem;
    line-height: 1.2;
    margin-bottom: 0.75rem;
}

.landing-copy-grid p,
.landing-faq p {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.7;
}

.browser-collections-band {
    padding-top: 2rem;
}

.browser-collection-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.25rem;
}

.browser-collection-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1.35rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
    min-height: 230px;
}

.browser-collection-card.featured {
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 18px 40px rgba(37, 99, 235, 0.12);
}

.browser-collection-card h3 {
    font-size: 1.55rem;
    line-height: 1.15;
}

.browser-collection-card p {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.65;
}

.browser-collection-card .btn-primary,
.browser-collection-card .nav-link-pill {
    margin-top: auto;
}

.collection-card-label {
    color: var(--accent-primary);
    font-size: 0.86rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0;
}

.nav-link-pill.is-disabled {
    color: #64748b;
    background: #f1f5f9;
    border-color: #e2e8f0;
    cursor: default;
    pointer-events: none;
}

.section-heading-row {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.landing-games {
    margin-bottom: 3rem;
}

.landing-game-grid {
    margin-bottom: 0;
    min-height: 0;
}

.related-card-section .game-grid {
    min-height: 0;
}

.landing-loading {
    grid-column: 1 / -1;
    padding: 2rem;
    color: var(--text-secondary);
    font-weight: 700;
    text-align: center;
}

.landing-faq {
    max-width: 900px;
}

.landing-faq-list {
    display: grid;
    gap: 1.2rem;
}

.landing-faq-list article {
    border-top: 1px solid #e2e8f0;
    padding-top: 1.2rem;
}

.landing-faq h3 {
    font-size: 1.15rem;
    margin-bottom: 0.4rem;
}

.collection-page .landing-hero {
    padding-bottom: 2.5rem;
}

.collection-game-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1.25rem;
}

.collection-game-card,
.collection-type-grid article,
.collection-entry-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.collection-game-card {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.collection-game-media {
    display: block;
    aspect-ratio: 1 / 1;
    background: #e2e8f0;
    overflow: hidden;
}

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

.collection-game-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    flex: 1;
}

.collection-game-copy h3,
.collection-type-grid h3 {
    font-size: 1.05rem;
    line-height: 1.25;
}

.collection-game-copy p,
.collection-type-grid p,
.collection-seo-copy p {
    color: var(--text-secondary);
    font-size: 0.96rem;
    font-weight: 600;
    line-height: 1.65;
}

.collection-game-copy .nav-link-pill {
    margin-top: auto;
}

.collection-section-title {
    font-size: 1.55rem;
    margin-bottom: 1.25rem;
}

.collection-type-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1rem;
}

.collection-type-grid article,
.collection-entry-card {
    padding: 1.1rem;
}

.collection-type-grid article {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-height: 230px;
}

.collection-type-grid article .nav-link-pill {
    margin-top: auto;
}

.collection-type-grid article p {
    margin-bottom: 1.1rem;
}

.collection-entry-card .nav-link-pill {
    margin-top: 1rem;
}

.tool-inline-actions {
    justify-content: flex-start;
}

.tool-inline-actions .nav-link-pill,
.tool-inline-actions .btn-primary {
    margin-top: 0;
}

.collection-seo-copy {
    display: grid;
    gap: 1.4rem;
    margin-bottom: 3rem;
}

.collection-seo-copy article {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 1.35rem;
}

.collection-seo-copy h2 {
    font-size: 1.35rem;
    margin-bottom: 0.65rem;
}

.collection-seo-copy #agw2cb {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.55rem;
    text-align: center;
}

.collection-seo-copy #agw2cb a,
.sort-solver-guide-link #eimuxc a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-full);
    background: #e0f2fe;
    color: #0369a1;
    font-weight: 800;
    box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.18);
}

.collection-seo-copy #agw2cb a:hover,
.sort-solver-guide-link #eimuxc a:hover {
    background: #0ea5e9;
    color: #ffffff;
}

.home-structured-modules {
    display: grid;
    gap: 1rem;
    margin: 1rem 0 1.5rem;
}

.home-link-module {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 1rem;
}

.home-link-module .section-heading-row {
    margin-bottom: 0.6rem;
}

.home-link-module-desc {
    color: var(--text-secondary);
    margin-bottom: 0.9rem;
}

.home-link-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.home-link-card {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    text-decoration: none;
    color: inherit;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 14px;
    padding: 0.65rem;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.home-link-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .08);
    transform: translateY(-1px);
}

.home-link-card-media {
    width: 64px;
    height: 64px;
    flex: 0 0 64px;
    border-radius: 12px;
    overflow: hidden;
    background: #e2e8f0;
}

.home-link-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.home-link-card-type {
    display: inline-block;
    font-size: .74rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #1d4ed8;
    background: #dbeafe;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    padding: 0.1rem 0.45rem;
    margin-bottom: 0.28rem;
}

.home-link-card h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.home-link-card p {
    color: var(--text-secondary);
    font-size: .88rem;
    line-height: 1.35;
}

.home-seo-panel {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin: -1rem 0 1.5rem;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
}

.home-seo-panel h2 {
    font-size: 1.35rem;
    margin-bottom: 0.75rem;
}

.home-seo-panel p {
    color: var(--text-secondary);
    font-weight: 600;
    line-height: 1.7;
    margin: 0;
}

.home-seo-panel p + p {
    margin-top: 0.8rem;
}

.internal-links-panel {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin: 0 0 2.5rem;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.internal-links-panel:empty {
    display: none;
}

.internal-links-panel h2 {
    font-size: 1.35rem;
    margin-bottom: 0.8rem;
}

.internal-links-panel p {
    color: var(--text-secondary);
    font-weight: 600;
    line-height: 1.65;
    margin-bottom: 1rem;
}

.internal-link-group + .internal-link-group {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e2e8f0;
}

.internal-link-group h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.internal-link-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.internal-link-list a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-full);
    background: #f1f5f9;
    color: var(--text-primary);
    font-weight: 700;
    transition: var(--transition);
}

.internal-link-list a:hover {
    background: #e0f2fe;
    color: #0369a1;
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem;
    }

    .navbar .container {
        gap: 0.75rem;
    }

    .navbar .nav-actions {
        gap: 0.5rem;
        flex-shrink: 0;
    }

    .navbar .nav-actions > .nav-link-pill {
        display: none;
    }

    .lang-toggle {
        padding: 0.45rem 0.7rem;
    }

    .game-grid {
        gap: 0.45rem;
    }

    .game-title {
        font-size: 0.74rem;
    }

    .player-toolbar {
        margin-left: -0.75rem;
        margin-right: -0.75rem;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .player-frame-wrapper {
        margin-left: -0.75rem;
        margin-right: -0.75rem;
        width: calc(100% + 1.5rem);
    }

    .footer-nav {
        gap: 0.65rem 1rem;
    }

    .policy-card {
        width: 100%;
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
        padding: 1.15rem 1rem 1.25rem;
        border-radius: var(--radius-md);
        overflow-x: clip;
    }

    .policy-section + .policy-section {
        margin-top: 1.45rem;
        padding-top: 1.45rem;
    }

    .policy-section h1 {
        font-size: 1.72rem;
        line-height: 1.12;
    }

    .policy-section h2 {
        font-size: 1.12rem;
        line-height: 1.28;
        margin-bottom: 0.7rem;
    }

    .policy-section p,
    .policy-list li,
    .policy-link-list span {
        font-size: 1rem;
        line-height: 1.72;
    }

    .policy-toc,
    .policy-link-list li,
    .policy-callout {
        padding-left: 0.9rem;
        padding-right: 0.9rem;
    }

    .policy-list {
        padding-left: 1.1rem;
    }

    .policy-toc ul {
        grid-template-columns: 1fr;
        gap: 0.45rem;
    }

    .policy-section,
    .policy-section p,
    .policy-list,
    .policy-toc,
    .policy-link-list,
    .policy-callout,
    .policy-figure,
    .guide-code-shell {
        width: 100%;
        max-width: 100%;
    }

    .policy-figure,
    .policy-figure-compact {
        width: min(100%, 260px);
        max-width: min(100%, 260px);
    }

    .policy-figure-tiny {
        width: min(100%, 220px);
        max-width: min(100%, 220px);
    }

    .policy-figure-wide-preview {
        width: min(100%, 220px);
        max-width: min(100%, 220px);
    }

    .policy-figure {
        margin-left: auto;
        margin-right: auto;
    }

    .policy-figure figcaption {
        font-size: 0.88rem;
        line-height: 1.55;
    }

    .policy-figure picture,
    .policy-figure img {
        width: 100%;
        max-width: 100%;
        height: auto;
    }

    .guide-image-hint {
        right: 0.55rem;
        bottom: 0.55rem;
        min-height: 28px;
        padding: 0.2rem 0.55rem;
        font-size: 0.72rem;
    }

    .guide-copy-btn {
        top: 0.75rem;
        right: 0.75rem;
        min-height: 34px;
        padding: 0.4rem 0.72rem;
        font-size: 0.8rem;
    }

    .guide-code-shell {
        margin-left: auto;
        margin-right: auto;
    }

    .guide-code-block {
        padding: 3.8rem 0.9rem 1rem;
        font-size: 0.88rem;
        line-height: 1.55;
        min-height: 320px;
        max-height: 62vh;
    }

    .logo {
        min-width: 0;
        gap: 0.4rem;
        font-size: 1.15rem;
        letter-spacing: -0.03em;
    }

    .logo span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

@media (max-width: 800px) {
    .landing-copy-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .browser-collection-grid {
        grid-template-columns: 1fr;
    }

    .browser-collection-card {
        min-height: 0;
    }

    .collection-game-grid,
    .collection-type-grid {
        grid-template-columns: 1fr;
    }

    .section-heading-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .landing-hero {
        padding-top: 0;
    }

    .landing-lead {
        font-size: 1rem;
    }
}

@media (max-width: 900px) {
    .home-link-card-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) and (orientation: landscape) {
    body.is-playing .navbar {
        display: none;
    }

    .player-toolbar {
        margin-top: 0;
    }

    .player-frame-wrapper {
        height: calc(100vh - 52px);
        height: calc(100dvh - 52px);
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 12px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9; 
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1; 
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8; 
}

/* Card Entry Animation */
@keyframes popIn {
    0% { opacity: 0; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1); }
}
.game-card {
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) backwards;
}
.game-card:nth-child(1) { animation-delay: 0.05s; }
.game-card:nth-child(2) { animation-delay: 0.1s; }
.game-card:nth-child(3) { animation-delay: 0.15s; }
.game-card:nth-child(4) { animation-delay: 0.2s; }
.game-card:nth-child(5) { animation-delay: 0.25s; }
.game-card:nth-child(6) { animation-delay: 0.3s; }
.game-card:nth-child(7) { animation-delay: 0.35s; }
.game-card:nth-child(8) { animation-delay: 0.4s; }
.game-card:nth-child(9) { animation-delay: 0.45s; }
.game-card:nth-child(n+10) { animation-delay: 0.5s; }
