/* =======================================================
   TAPYGAMES — Poki-inspired Design  v3
   Background: dark #0e1420 (different from Poki teal)
   ======================================================= */

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* --- Variables --- */
:root {
    --bg:           #0e1420;
    --bg-2:         #111827;
    --bg-card:      #161e2e;
    --bg-hover:     #1c2840;
    --header-bg:    #0c1220;
    --accent:       #06c9b0;
    --accent-hover: #04a890;
    --accent-glow:  rgba(6,201,176,.30);
    --text:         #f0f4ff;
    --text-dim:     #9aa8bf;
    --text-muted:   #55647a;
    --border:       rgba(255,255,255,.08);
    --radius:       14px;
    --radius-sm:    10px;
    --header-h:     66px;
    --container:    1300px;
    --shadow:       0 6px 24px rgba(0,0,0,.5);
    --card-shadow:  0 2px 10px rgba(0,0,0,.45);
}

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a  { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 3px; }

/* =======================================================
   HEADER
   ======================================================= */
.site-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-h);
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    z-index: 200;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.header-inner {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 14px;
    max-width: var(--container);
    height: 100%;
    margin: 0 auto;
    padding: 0 20px;
}

.header-logo {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 8px;
    font-size: 21px;
    font-weight: 900;
    color: var(--accent);
    letter-spacing: -.4px;
    white-space: nowrap;
    -ms-flex-negative: 0;
    flex-shrink: 0;
    transition: opacity .2s;
}
.header-logo:hover { opacity: .85; }
.header-logo .logo-icon { font-size: 24px; }

/* Category nav — scrollable row of pill buttons */
.header-cat-nav {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 6px;
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 6px 0;
}
.header-cat-nav::-webkit-scrollbar { display: none; }

.header-cat-btn {
    display: -webkit-inline-box;
    display: -ms-inline-flexbox;
    display: inline-flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 5px;
    height: 36px;
    padding: 0 13px;
    border-radius: 50px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    -ms-flex-negative: 0;
    flex-shrink: 0;
    cursor: pointer;
    text-decoration: none;
    transition: background .18s, border-color .18s, color .18s;
}
.header-cat-btn:hover,
.header-cat-btn.active {
    background: rgba(6,201,176,.12);
    border-color: var(--accent);
    color: var(--accent);
}
.header-cat-btn .cat-emoji { font-size: 15px; line-height: 1; }
.header-cat-btn .cat-label { font-size: 12px; }

/* Action icons */
.header-actions {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 6px;
    -ms-flex-negative: 0;
    flex-shrink: 0;
}

.header-icon-btn {
    width: 38px;
    height: 38px;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    color: var(--text-dim);
    text-decoration: none;
    transition: background .18s, border-color .18s, color .18s;
}
.header-icon-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent);
}

/* =======================================================
   PAGE LAYOUT
   ======================================================= */
.site-wrapper {
    padding-top: var(--header-h);
    min-height: 100vh;
    width: 100%;
}

.main-content {
    max-width: var(--container);
    margin-left: auto;
    margin-right: auto;
    padding: 28px 20px 48px;
    width: 100%;
}

/* =======================================================
   HERO MOSAIC  (Poki-style featured games wall)
   6 columns × auto rows. All cells stay square via aspect-ratio.
   3 large anchors explicitly pinned to cols 1-2.
   ======================================================= */
.hero-mosaic {
    display: -ms-grid;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-bottom: 36px;
    overflow: hidden;
    border-radius: var(--radius);
}

.mosaic-item {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-card);
    display: block;
    cursor: pointer;
    aspect-ratio: 1 / 1;   /* keeps every cell perfectly square — no cropping */
    transition: transform .22s cubic-bezier(.34,1.56,.64,1), filter .22s;
    text-decoration: none;
}
.mosaic-item:hover {
    transform: scale(1.04);
    filter: brightness(1.08);
    z-index: 2;
    position: relative;
}
.mosaic-item img {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    -o-object-fit: cover;
    object-fit: cover;
    transition: transform .3s;
    display: block;
}
.mosaic-item:hover img { transform: scale(1.06); }

.mosaic-item.mosaic-large {
    grid-column: span 2;
    grid-row: span 2;
}
.mosaic-item.mosaic-tall  { grid-row: span 2; }
.mosaic-item.mosaic-wide  { grid-column: span 2; }

/* Play overlay */
.mosaic-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.3);
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s;
}
.mosaic-item:hover .mosaic-overlay { opacity: 1; }

.mosaic-play-btn {
    width: 54px;
    height: 54px;
    background: var(--accent);
    border-radius: 50%;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    color: #000;
    font-size: 22px;
    box-shadow: 0 4px 20px rgba(6,201,176,.5);
    transform: scale(.8);
    transition: transform .2s;
}
.mosaic-item:hover .mosaic-play-btn { transform: scale(1); }

/* Caption on large item */
.mosaic-caption {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 44px 14px 14px;
    background: -webkit-gradient(linear, left bottom, left top, from(rgba(0,0,0,.88)), to(transparent));
    background: linear-gradient(to top, rgba(0,0,0,.88) 0%, transparent 100%);
    pointer-events: none;
}
.mosaic-badge {
    display: inline-block;
    background: var(--accent);
    color: #000;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .6px;
    padding: 3px 8px;
    border-radius: 4px;
    margin-bottom: 6px;
}
.mosaic-title {
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
}

/* =======================================================
   GAME SECTIONS  (horizontal scroll rows — Poki style)
   ======================================================= */
.game-section {
    margin-bottom: 36px;
    width: 100%;
}

.section-header {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    margin-bottom: 14px;
}

.section-title {
    font-size: 19px;
    font-weight: 800;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 8px;
    color: var(--text);
}
.section-title .icon { font-size: 20px; line-height: 1; }

.see-all {
    display: -webkit-inline-box;
    display: -ms-inline-flexbox;
    display: inline-flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 3px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dim);
    padding: 5px 13px;
    border-radius: 50px;
    border: 1.5px solid var(--border);
    background: var(--bg-card);
    white-space: nowrap;
    text-decoration: none;
    transition: border-color .18s, color .18s, background .18s;
}
.see-all svg { width: 12px; height: 12px; }
.see-all:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(6,201,176,.08);
}

/* Horizontal scroll row */
.section-row {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: horizontal;
    -webkit-box-direction: normal;
    -ms-flex-direction: row;
    flex-direction: row;
    -ms-flex-wrap: nowrap;
    flex-wrap: nowrap;
    gap: 12px;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 6px;
    padding-top: 2px;
    scroll-snap-type: x mandatory;
}
.section-row::-webkit-scrollbar { display: none; }

/* =======================================================
   GAME CARDS
   ======================================================= */
.game-card {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
    cursor: pointer;
    display: block;
    text-decoration: none;
    box-shadow: var(--card-shadow);
    transition: transform .22s cubic-bezier(.34,1.56,.64,1), box-shadow .22s;
}
.game-card:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: var(--shadow), 0 0 0 2px var(--accent-glow), 0 0 22px var(--accent-glow);
    z-index: 5;
    position: relative;
}

/* Cards IN a horizontal section-row: fixed 160×160 */
.section-row .game-card {
    width: 160px;
    height: 160px;
    min-width: 160px;
    -ms-flex-negative: 0;
    flex-shrink: 0;
    scroll-snap-align: start;
}

/* Cards IN a grid (category/search pages): fill column, always square */
.games-grid .game-card {
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
}

/* Thumbnail image */
.game-card .thumb {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    -o-object-fit: cover;
    object-fit: cover;
    transition: transform .3s;
    display: block;
}
.game-card:hover .thumb { transform: scale(1.07); }

/* Play button overlay */
.card-hover-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.32);
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s;
}
.game-card:hover .card-hover-overlay { opacity: 1; }

.card-play-btn {
    width: 46px;
    height: 46px;
    background: var(--accent);
    border-radius: 50%;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    color: #000;
    font-size: 18px;
    box-shadow: 0 4px 18px rgba(6,201,176,.55);
    transform: scale(.8);
    transition: transform .2s;
}
.game-card:hover .card-play-btn { transform: scale(1); }

/* Title bar at bottom of card */
.card-footer {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 28px 9px 8px;
    background: -webkit-gradient(linear, left bottom, left top, from(rgba(0,0,0,.88)), to(transparent));
    background: linear-gradient(to top, rgba(0,0,0,.88) 0%, transparent 100%);
    pointer-events: none;
}
.card-title {
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.card-plays {
    font-size: 10px;
    color: rgba(255,255,255,.5);
    margin-top: 2px;
}

/* Badges */
.card-badge {
    position: absolute;
    top: 7px; left: 7px;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .4px;
    padding: 3px 7px;
    border-radius: 4px;
    z-index: 2;
    line-height: 1.4;
}
.badge-hot      { background: #ef4444; color: #fff; }
.badge-new      { background: #22c55e; color: #fff; }
.badge-featured { background: var(--accent); color: #000; }

/* =======================================================
   GAMES GRID (category / search pages)
   ======================================================= */
.games-grid {
    display: -ms-grid;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
    width: 100%;
}

/* =======================================================
   CATEGORY CHIPS STRIP
   ======================================================= */
.category-strip {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: horizontal;
    -webkit-box-direction: normal;
    -ms-flex-direction: row;
    flex-direction: row;
    -ms-flex-wrap: nowrap;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 6px;
    margin-bottom: 22px;
}
.category-strip::-webkit-scrollbar { display: none; }

.cat-chip {
    display: -webkit-inline-box;
    display: -ms-inline-flexbox;
    display: inline-flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 6px;
    padding: 7px 15px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    color: var(--text-dim);
    white-space: nowrap;
    -ms-flex-negative: 0;
    flex-shrink: 0;
    text-decoration: none;
    transition: background .18s, border-color .18s, color .18s;
}
.cat-chip:hover, .cat-chip.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(6,201,176,.08);
}

/* =======================================================
   SEARCH PAGE
   ======================================================= */
.search-hero {
    background: -webkit-gradient(linear, left top, right bottom, from(var(--bg-2)), to(var(--bg-card)));
    background: linear-gradient(135deg, var(--bg-2), var(--bg-card));
    border-radius: var(--radius);
    padding: 32px;
    margin-bottom: 26px;
    border: 1px solid var(--border);
}
.search-hero h1 { font-size: 21px; font-weight: 800; margin-bottom: 14px; }
.search-hero form {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    gap: 8px;
}
.search-hero input {
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    height: 46px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    padding: 0 18px;
    outline: none;
    transition: border-color .2s;
}
.search-hero input:focus { border-color: var(--accent); }
.search-hero button {
    height: 46px;
    padding: 0 24px;
    background: var(--accent);
    color: #000;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-sm);
    transition: background .15s;
}
.search-hero button:hover { background: var(--accent-hover); }
.search-result-info { color: var(--text-dim); font-size: 14px; margin-bottom: 18px; }
.search-result-info strong { color: var(--accent); }

/* =======================================================
   CATEGORY PAGE HEADER
   ======================================================= */
.cat-page-header {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 22px;
}
.cat-page-icon { font-size: 46px; }
.cat-page-name { font-size: 24px; font-weight: 900; margin-bottom: 4px; }
.cat-page-desc { color: var(--text-dim); font-size: 14px; }
.cat-page-count {
    margin-left: auto;
    text-align: right;
    font-size: 13px;
    color: var(--text-muted);
}
.cat-page-count strong {
    display: block;
    font-size: 26px;
    font-weight: 900;
    color: var(--accent);
}

/* =======================================================
   GAME PAGE — PLAYER
   ======================================================= */
.game-page-wrap {
    padding-top: var(--header-h);
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    min-height: 100vh;
}

.game-topbar {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    height: 50px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
    gap: 10px;
    -ms-flex-negative: 0;
    flex-shrink: 0;
}
.game-topbar .back-btn {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 5px;
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    transition: background .15s;
    text-decoration: none;
}
.game-topbar .back-btn:hover { background: var(--bg-hover); color: var(--text); }
.game-topbar-title {
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fullscreen-btn {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 5px;
    background: var(--accent);
    color: #000;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 13px;
    border-radius: var(--radius-sm);
    border: none;
    transition: background .15s;
    cursor: pointer;
}
.fullscreen-btn:hover { background: var(--accent-hover); }

.game-frame-wrap {
    position: relative;
    width: 100%;
    height: calc(100vh - var(--header-h) - 50px);
    min-height: 400px;
    background: #000;
}
.game-frame-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.game-loading {
    position: absolute;
    inset: 0;
    background: #000;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    gap: 16px;
    z-index: 10;
    transition: opacity .4s;
}
.game-loading.hidden { opacity: 0; pointer-events: none; }

.loading-spinner {
    width: 46px;
    height: 46px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    -webkit-animation: spin .8s linear infinite;
    animation: spin .8s linear infinite;
}
@-webkit-keyframes spin { to { transform: rotate(360deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: var(--text-dim); font-size: 14px; }

/* Game info below player */
.game-info-section {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    gap: 28px;
    padding: 28px;
    max-width: var(--container);
    margin: 0 auto;
    width: 100%;
}
.game-info-main { -webkit-box-flex: 1; -ms-flex: 1; flex: 1; min-width: 0; }
.game-info-sidebar { width: 300px; -ms-flex-negative: 0; flex-shrink: 0; }
.game-info-title { font-size: 24px; font-weight: 900; margin-bottom: 10px; }
.game-meta {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
}
.game-meta-item {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--text-dim);
}
.game-meta-item strong { color: var(--text); }
.cat-tag {
    display: -webkit-inline-box;
    display: -ms-inline-flexbox;
    display: inline-flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 5px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
}
.cat-tag:hover { border-color: var(--accent); color: var(--accent); }
.game-description {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-dim);
    margin-bottom: 18px;
}
.game-tags {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    gap: 6px;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
}
.game-tag {
    font-size: 11px;
    font-weight: 600;
    background: var(--bg-hover);
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: 12px;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.game-tag:hover { background: rgba(6,201,176,.1); color: var(--accent); }

.related-title {
    font-size: 14px;
    font-weight: 800;
    margin-bottom: 12px;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 6px;
}
.related-grid {
    display: -ms-grid;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.related-grid .game-card {
    aspect-ratio: 1/1;
    width: 100%;
}

/* =======================================================
   PAGINATION
   ======================================================= */
.pagination {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    gap: 5px;
    margin: 22px 0 8px;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
}
.page-btn {
    display: -webkit-inline-box;
    display: -ms-inline-flexbox;
    display: inline-flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--border);
    text-decoration: none;
    transition: background .15s, color .15s;
}
.page-btn:hover { background: var(--bg-hover); color: var(--text); }
.page-btn.active { background: var(--accent); color: #000; border-color: var(--accent); }
.page-btn.disabled { opacity: .4; pointer-events: none; }

/* =======================================================
   EMPTY STATE
   ======================================================= */
.empty-state {
    text-align: center;
    padding: 64px 20px;
    color: var(--text-muted);
}
.empty-icon { font-size: 60px; margin-bottom: 16px; }
.empty-state h3 { font-size: 17px; font-weight: 700; color: var(--text-dim); margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

/* =======================================================
   SKELETON
   ======================================================= */
@-webkit-keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton {
    background: -webkit-gradient(linear, left center, right center, color-stop(25%, var(--bg-card)), color-stop(50%, var(--bg-hover)), color-stop(75%, var(--bg-card)));
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    -webkit-animation: shimmer 1.4s infinite;
    animation: shimmer 1.4s infinite;
    border-radius: var(--radius);
}

/* =======================================================
   AD SLOTS
   ======================================================= */
.ad-slot {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 11px;
    margin: 16px 0;
    min-height: 90px;
    overflow: hidden;
}

/* =======================================================
   FOOTER — Poki multi-column style
   ======================================================= */
.site-footer {
    background: var(--header-bg);
    border-top: 1px solid var(--border);
    padding: 44px 20px 28px;
    width: 100%;
}

.footer-inner {
    max-width: var(--container);
    margin: 0 auto;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    gap: 40px;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    -webkit-box-align: start;
    -ms-flex-align: start;
    align-items: flex-start;
}

.footer-brand {
    -webkit-box-flex: 0;
    -ms-flex: 0 0 200px;
    flex: 0 0 200px;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    gap: 11px;
}

.footer-logo {
    font-size: 21px;
    font-weight: 900;
    color: var(--accent);
    letter-spacing: -.4px;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.footer-tagline { font-size: 13px; color: var(--text-muted); }

.footer-social {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    gap: 9px;
    margin-top: 2px;
}
.footer-social a {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    color: var(--text-dim);
    font-size: 15px;
    text-decoration: none;
    transition: background .15s, border-color .15s;
}
.footer-social a:hover { background: var(--bg-hover); border-color: var(--accent); color: var(--accent); }

.footer-cols {
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    gap: 28px;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
}

.footer-col { min-width: 130px; }
.footer-col h4 {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    margin-bottom: 13px;
}
.footer-col ul {
    list-style: none;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    gap: 9px;
}
.footer-col ul li a {
    font-size: 13px;
    color: var(--text-dim);
    text-decoration: none;
    transition: color .15s;
}
.footer-col ul li a:hover { color: var(--accent); }

.footer-bottom {
    max-width: var(--container);
    margin: 26px auto 0;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    gap: 14px;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
}
.footer-bottom p { font-size: 12px; color: var(--text-muted); }
.footer-lang {
    display: -webkit-inline-box;
    display: -ms-inline-flexbox;
    display: inline-flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-dim);
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 5px 12px;
    border-radius: 20px;
}

/* =======================================================
   MOBILE BOTTOM NAV
   ======================================================= */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 60px;
    background: var(--header-bg);
    border-top: 1px solid var(--border);
    z-index: 200;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.mobile-nav-inner {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    height: 100%;
    max-width: var(--container);
    margin: 0 auto;
}

.mobile-nav-item {
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    gap: 2px;
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    text-decoration: none;
    transition: color .15s;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}
.mobile-nav-item .nav-icon { font-size: 22px; line-height: 1; }
.mobile-nav-item:hover, .mobile-nav-item.active { color: var(--accent); }

/* Mobile category drawer */
.mobile-cat-menu {
    position: fixed;
    bottom: -100%; left: 0; right: 0;
    background: var(--bg-2);
    border-top: 1px solid var(--border);
    border-radius: 18px 18px 0 0;
    z-index: 300;
    padding: 0 0 68px;
    transition: bottom .3s cubic-bezier(.4,0,.2,1);
    max-height: 70vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.mobile-cat-menu.open { bottom: 0; }

.mobile-cat-header {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    padding: 16px 20px 12px;
    font-size: 15px;
    font-weight: 800;
    border-bottom: 1px solid var(--border);
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    background: var(--bg-2);
}
.mobile-cat-header button {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s;
}
.mobile-cat-header button:hover { background: var(--bg-hover); }

.mobile-cat-grid {
    display: -ms-grid;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 14px;
}
.mobile-cat-item {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    color: var(--text-dim);
    text-decoration: none;
    transition: background .15s, color .15s;
}
.mobile-cat-item span:first-child { font-size: 24px; }
.mobile-cat-item:hover { background: var(--bg-hover); color: var(--accent); }

.mobile-cat-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 299;
}

/* =======================================================
   RESPONSIVE — TABLET  (≤1100px)
   ======================================================= */
@media (max-width: 1100px) {
    .hero-mosaic {
        grid-template-columns: repeat(6, 1fr);
        /* no grid-auto-rows — aspect-ratio keeps cells square */
    }
    /* Hide the 3rd block (items 19-20) */
    .hero-mosaic .mosaic-item:nth-child(n+19) { display: none; }
    .section-row .game-card { width: 145px; height: 145px; min-width: 145px; }
}

@media (max-width: 860px) {
    .game-info-section { -webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; flex-direction: column; }
    .game-info-sidebar { width: 100%; }
    .related-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
    .hero-mosaic {
        grid-template-columns: repeat(6, 1fr);
        /* no grid-auto-rows — aspect-ratio keeps cells square */
    }
    /* Show only first block on small tablets */
    .hero-mosaic .mosaic-item:nth-child(n+10) { display: none; }
}

/* =======================================================
   RESPONSIVE — MOBILE  (≤768px)
   ======================================================= */
@media (max-width: 768px) {
    :root { --header-h: 60px; }

    .main-content { padding: 16px 12px 80px; }

    /* Hide text labels in category nav, show emoji only */
    .header-cat-btn .cat-label { display: none; }
    .header-cat-btn { padding: 0 10px; min-width: 36px; height: 34px; }

    /* Hero mosaic — mobile: 3 cols, 1 large item only */
    .hero-mosaic {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        /* no grid-auto-rows — aspect-ratio keeps cells square */
    }
    /* Override explicit inline grid-row so only col-span stays on mobile */
    .hero-mosaic .mosaic-large {
        grid-column: span 2 !important;
        grid-row: auto !important;
    }
    /* Show only first 7 items (1 large + 6 small) */
    .hero-mosaic .mosaic-item:nth-child(n+8) { display: none; }

    /* Section row cards — 3 visible at a time */
    .section-row .game-card {
        width: calc((100vw - 48px) / 3);
        height: calc((100vw - 48px) / 3);
        min-width: 96px;
    }

    .section-title { font-size: 16px; }

    /* Games grid */
    .games-grid { grid-template-columns: repeat(3, 1fr); gap: 7px; }

    /* Show mobile nav */
    .mobile-nav { display: block; }
    .site-footer { padding-bottom: 80px; }

    /* Footer: stack */
    .footer-inner { -webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; flex-direction: column; gap: 26px; }
    .footer-brand { -webkit-box-flex: 0; -ms-flex: none; flex: none; }

    /* Category page */
    .cat-page-header { -ms-flex-wrap: wrap; flex-wrap: wrap; }
    .cat-page-count { margin-left: 0; }

    /* Game page */
    .game-info-section { padding: 14px; }
    .game-frame-wrap { height: 56vw; min-height: 240px; }
    .game-topbar { height: 44px; }
    .game-frame-wrap { height: calc(56vw); }
}

@media (max-width: 480px) {
    .header-inner { padding: 0 10px; gap: 8px; }
    .hero-mosaic {
        gap: 5px;
        /* no grid-auto-rows — aspect-ratio keeps cells square */
    }
    .games-grid { grid-template-columns: repeat(3, 1fr); gap: 5px; }
    .section-row .game-card {
        width: calc((100vw - 40px) / 3);
        height: calc((100vw - 40px) / 3);
    }
    .footer-cols { -webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; flex-direction: column; gap: 18px; }
}

/* =======================================================
   UTILITIES
   ======================================================= */
.mb-0  { margin-bottom: 0 !important; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.text-accent { color: var(--accent); }
.text-muted  { color: var(--text-muted); }
.font-bold   { font-weight: 700; }
.font-black  { font-weight: 900; }


/* =======================================================
   GAME PAGE v2 — BIGGER, FULL-WIDTH PLAYER
   ======================================================= */

body.game-body { overflow-x: hidden; }

.gp-wrap { padding-top: var(--header-h); background: var(--bg); }

/* ── Topbar ── */
.gp-topbar {
    display: flex;
    align-items: center;
    height: 44px;
    padding: 0 16px;
    gap: 12px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
}
.gp-back {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background .15s, color .15s;
}
.gp-back:hover { background: var(--bg-hover); color: var(--text); }
.gp-breadcrumb {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 7px;
    justify-content: center;
    min-width: 0;
}
.gp-cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    color: var(--text-dim);
    white-space: nowrap;
    flex-shrink: 0;
    transition: border-color .15s, color .15s;
}
.gp-cat-chip:hover { border-color: var(--accent); color: var(--accent); }
.gp-sep  { color: var(--text-muted); font-size: 13px; }
.gp-bc-title {
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gp-fs-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--accent);
    color: #000;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background .15s;
}
.gp-fs-btn:hover { background: var(--accent-hover); }

/* ── Ad strips ── */
.gp-ad-strip {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    min-height: 90px;
    overflow: hidden;
}
.gp-ad-strip:empty { display: none; }

/* ── Player wrap ── */
.gp-player-wrap {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    background: #000;
}

/* ── 3-column grid ──
   Sidebars: clamp so they're bigger but don't crush the game on small screens
   Game center: fills remaining space
   ─────────────────────────────────────────────────────── */
.gp-columns {
    display: grid;
    grid-template-columns: clamp(220px, 28vw, 360px) 1fr clamp(220px, 28vw, 360px);
    height: 380px;
}

/* ── Sidebars ── */
.gp-side {
    background: var(--bg);
    overflow: hidden;
}
.gp-side-left  { border-right: 1px solid var(--border); }
.gp-side-right { border-left:  1px solid var(--border); }

.gp-side-ad {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}
.gp-side-ad:empty { display: none; }

/* 3×3 game grid inside each sidebar */
.gp-side-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 4px;
}

/* ── Sidebar game card ── */
.gp-sc {
    display: block;
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 7px;
    overflow: hidden;
    text-decoration: none;
    background: var(--bg-card);
}
.gp-sc img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .2s;
}
.gp-sc:hover img { transform: scale(1.08); }
.gp-sc-ov {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .18s;
}
.gp-sc:hover .gp-sc-ov { opacity: 1; }
.gp-sc-play {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #000;
    font-weight: 900;
}

/* ── Center iframe ── */
.gp-center {
    position: relative;
    background: #000;
    min-width: 0;
}
.gp-center iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}
.gp-loading {
    position: absolute;
    inset: 0;
    background: #0c1220;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 10;
    transition: opacity .4s;
}
.gp-loading.hidden { opacity: 0; pointer-events: none; }
.gp-loading p { color: var(--text-dim); font-size: 13px; }
.gp-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

/* ── Info bar: thumb | [title + fullscreen] / [cat + plays] ── */
.gp-infobar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--header-bg);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.gp-infobar-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}
.gp-infobar-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
/* Title + fullscreen on same line */
.gp-infobar-row1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.gp-infobar-title {
    font-size: 15px;
    font-weight: 900;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}
/* Category + plays on second line */
.gp-infobar-row2 {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.gp-infobar-cat {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-dim);
    text-decoration: none;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2px 9px;
    transition: color .15s, border-color .15s;
}
.gp-infobar-cat:hover { color: var(--accent); border-color: var(--accent); }
.gp-infobar-plays { font-size: 11px; color: var(--text-muted); }

/* ── Content below ── */
.gp-content {
    max-width: var(--container);
    margin: 0 auto;
    padding: 28px 24px 60px;
    width: 100%;
}

/* More category games */
.gp-more-section { margin-bottom: 36px; }
.gp-section-title {
    font-size: 16px;
    font-weight: 800;
    margin: 0 0 14px;
}
.gp-more-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

/* Game detail block */
.gp-detail {
    display: flex;
    gap: 22px;
    align-items: flex-start;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 24px;
}
.gp-detail-thumb {
    width: 130px;
    height: 130px;
    border-radius: 14px;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,.5);
}
.gp-detail-body { flex: 1; min-width: 0; }
.gp-detail-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 7px;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.gp-detail-breadcrumb a { color: var(--accent); text-decoration: none; }
.gp-detail-title {
    font-size: 22px;
    font-weight: 900;
    margin: 0 0 12px;
    line-height: 1.2;
}
.gp-detail-desc {
    font-size: 14px;
    line-height: 1.75;
    color: var(--text-dim);
    margin-bottom: 14px;
}
.gp-detail-tags { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Responsive ── */
@media (max-width: 900px) {
    .gp-columns { grid-template-columns: clamp(160px, 25vw, 280px) 1fr clamp(160px, 25vw, 280px); }
}
@media (max-width: 640px) {
    .gp-columns { grid-template-columns: 1fr; height: auto; }
    .gp-side { display: none; }
    .gp-center { aspect-ratio: 16/9; min-height: 220px; }
    .gp-infobar { padding: 8px 12px; }
    .gp-content { padding: 16px 12px 60px; }
    .gp-detail { flex-direction: column; }
    .gp-detail-thumb { width: 80px; height: 80px; }
}

/* =======================================================
   POKI-STYLE GAME PAGE  (pk-* namespace)
   Replaces gp-* on game.php
   ======================================================= */

/* ── Page wrapper ── */
.pk-page {
    padding-top: var(--header-h);
    background: var(--bg);
    min-height: 100vh;
}

/* ── Three-column layout ──
   Left sidebar | center col | right sidebar
   Left/right are fixed-width thumbnail strips;
   center stretches to fill remaining space.
   ─────────────────────────────────────────── */
.pk-layout {
    display: grid;
    grid-template-columns: 296px 1fr 296px;
    align-items: start;
    max-width: 1800px;
    margin: 0 auto;
    gap: 0;
}

/* ── Sidebars ── */
.pk-sidebar {
    position: sticky;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-hover) transparent;
    background: var(--bg);
    /* 2-per-row grid */
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-content: start;
}
.pk-sidebar-left  { border-right: 1px solid var(--border); }
.pk-sidebar-right { border-left:  1px solid var(--border); }

.pk-sidebar::-webkit-scrollbar { width: 4px; }
.pk-sidebar::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 2px; }

/* Sidebar ad slot — spans both columns */
.pk-side-ad {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}
.pk-side-ad:empty { display: none; }

/* Individual sidebar game card */
.pk-side-card {
    display: block;
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    text-decoration: none;
    background: var(--bg-card);
    overflow: hidden;
    border-bottom: 2px solid var(--bg);
    border-right: 1px solid var(--bg);
    flex-shrink: 0;
}
.pk-side-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .22s;
}
.pk-side-card:hover img { transform: scale(1.07); }

.pk-side-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .18s;
}
.pk-side-card:hover .pk-side-overlay { opacity: 1; }

.pk-side-play {
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
}

.pk-side-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,.85) 0%, transparent 100%);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 14px 6px 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transition: opacity .18s;
}
.pk-side-card:hover .pk-side-title { opacity: 1; }

/* ── Center column ── */
.pk-center-col {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ── Ad strips ── */
.pk-ad-strip {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 90px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}
.pk-ad-strip:empty { display: none; }

/* ── Game player ── */
.pk-player {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}
.pk-player iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Loading overlay */
.pk-loading {
    position: absolute;
    inset: 0;
    background: #0c1220;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    z-index: 10;
    transition: opacity .4s;
}
.pk-loading.hidden { opacity: 0; pointer-events: none; }
.pk-loading p { color: var(--text-dim); font-size: 13px; }
.pk-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

/* Fullscreen corner button on the player */
.pk-fs-overlay {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 20;
    width: 34px;
    height: 34px;
    background: rgba(0,0,0,.65);
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    opacity: 0;
    transition: opacity .2s, background .15s;
}
.pk-player:hover .pk-fs-overlay { opacity: 1; }
.pk-fs-overlay:hover { background: rgba(0,0,0,.85); }

/* ── Info bar ── */
.pk-infobar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.pk-infobar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}
.pk-game-thumb {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}
.pk-game-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.pk-game-title {
    font-size: 16px;
    font-weight: 800;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}
.pk-game-dev {
    font-size: 12px;
    color: var(--text-dim);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color .15s;
}
.pk-game-dev:hover { color: var(--accent); }

/* Action buttons row */
.pk-infobar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.pk-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border-radius: 24px;
    border: 1.5px solid var(--border);
    background: transparent;
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
    white-space: nowrap;
}
.pk-action-btn:hover {
    border-color: rgba(255,255,255,.25);
    color: var(--text);
}
.pk-action-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
}
.pk-like-btn.active svg,
.pk-dislike-btn.active svg { stroke: #000; }

.pk-fs-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    background: var(--accent);
    color: #000;
    font-size: 13px;
    font-weight: 700;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
}
.pk-fs-btn:hover { background: var(--accent-hover); }

/* ── Description / details accordion ── */
.pk-details {
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}
.pk-details-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
    transition: background .15s;
}
.pk-details-header:hover { background: var(--bg-hover); }
.pk-details-title {
    font-size: 14px;
    font-weight: 800;
    margin: 0;
}
.pk-details-arrow {
    color: var(--text-dim);
    flex-shrink: 0;
    transition: transform .22s;
}

.pk-details-body {
    display: none;
    padding: 0 16px 20px;
    flex-direction: column;
    gap: 16px;
}
.pk-details-body.open { display: flex; }

.pk-desc-text {
    font-size: 14px;
    line-height: 1.75;
    color: var(--text-dim);
}

/* Metadata grid */
.pk-meta-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.pk-meta-item {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 13px;
}
.pk-meta-label {
    width: 90px;
    flex-shrink: 0;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: .06em;
}
.pk-meta-value {
    color: var(--text-dim);
    font-weight: 500;
}
.pk-meta-link {
    color: var(--accent);
    text-decoration: none;
}
.pk-meta-link:hover { text-decoration: underline; }
.pk-meta-tags { align-items: flex-start; }

.pk-tags-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.pk-tag {
    display: inline-block;
    padding: 3px 10px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dim);
    text-decoration: none;
    transition: border-color .15s, color .15s;
}
.pk-tag:hover { border-color: var(--accent); color: var(--accent); }

/* ── More games section ── */
.pk-more-section {
    padding: 20px 16px 24px;
    border-bottom: 1px solid var(--border);
}
.pk-more-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.pk-more-title {
    font-size: 15px;
    font-weight: 800;
    margin: 0;
}
.pk-more-title a {
    color: var(--accent);
    text-decoration: none;
}
.pk-more-title a:hover { text-decoration: underline; }
.pk-see-all {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    flex-shrink: 0;
    transition: opacity .15s;
}
.pk-see-all:hover { opacity: .75; }

/* Games grid inside the more-section (reuse existing game-card styles) */
.pk-games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

/* =======================================================
   POKI-STYLE RESPONSIVE
   ======================================================= */

/* Large screens: wider sidebars (still 2-per-row) */
@media (min-width: 1600px) {
    .pk-layout { grid-template-columns: 360px 1fr 360px; }
}

/* Medium-large: default 296px sidebars hold fine down to ~1200px */
@media (max-width: 1300px) {
    .pk-layout { grid-template-columns: 240px 1fr 240px; }
}

/* Medium: sidebars go single-column at 120px each */
@media (max-width: 1000px) {
    .pk-layout { grid-template-columns: 120px 1fr 120px; }
    .pk-sidebar { grid-template-columns: 1fr; }
}

/* Tablet: hide left sidebar, keep right (single-column) */
@media (max-width: 760px) {
    .pk-layout { grid-template-columns: 1fr 120px; }
    .pk-sidebar-left { display: none; }
    .pk-sidebar { grid-template-columns: 1fr; }
    .pk-games-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}

/* Mobile: stack everything, hide both sidebars */
@media (max-width: 560px) {
    .pk-layout { grid-template-columns: 1fr; }
    .pk-sidebar { display: none; }
    .pk-player { aspect-ratio: 16 / 9; }
    .pk-infobar { padding: 8px 12px; gap: 8px; }
    .pk-game-title { font-size: 14px; }
    .pk-fs-btn { padding: 7px 12px; font-size: 12px; }
    .pk-action-btn { padding: 6px 10px; }
    .pk-games-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; }
    .pk-more-section { padding: 14px 12px 18px; }
    .pk-details-header { padding: 12px; }
    .pk-details-body { padding: 0 12px 16px; }
}
