/* =======================================================
   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; }
