/* gz-game-layout.css — Poki-aligned GAME page layer (layout goal 2026-12-02). Pure CSS wrapper around the untouched game canvas.
   Structure (injected by gz-game-layout.js):
     body.gz-pk-game
       ├─ aside.gz-pk-side   (fixed left rail: logo, search, 5 recommended 1:1 icons)  ≥1031px
       ├─ main.gz-pk-stage   (margin-left = rail width on desktop; fills 100dvh)
       │    ├─ .gz-pk-canvas-wrap  display:grid;place-items:center; height:calc(100dvh - titlebar) → the GAME canvas/GameDiv is moved here (never modified)
       │    └─ .gz-pk-titlebar    (icon + title + category + actions)
       ├─ .gz-pk-below       (horizontal shelf of ≥10 recommended cards + 300px ad slot on the right)
       └─ existing SEO/ad blocks remain below
   The game canvas keeps its own size; the wrapper only centers it inside the remaining viewport. */
:root{--pk-rail-w:168px;--pk-title-h:56px;--pk-gap:14px;--pk-radius:14px;--pk-bg:#0f1220;--pk-card:#171a2e;--pk-ink:#f3f4f8;--pk-muted:#a9adc4;--pk-accent:#4ecdc4}
html:has(body.gz-pk-game),body.gz-pk-game{min-height:100%!important;overflow-x:hidden!important;background:var(--pk-bg)}
body.gz-pk-game{margin:0;padding:0!important;display:block!important;position:static!important;height:auto!important;min-height:100dvh!important}
/* Hide the legacy splash once the layout owns the page (the canvas is already loaded by then). */
body.gz-pk-game #gz-splash{display:none!important}
/* Side rail */
.gz-pk-side{position:fixed;left:0;top:0;bottom:0;width:var(--pk-rail-w);z-index:950;display:flex;flex-direction:column;align-items:center;gap:14px;padding:14px 10px;background:rgba(15,18,32,.96);border-right:1px solid rgba(255,255,255,.07);color:var(--pk-ink);overflow:hidden auto;scrollbar-width:none}
.gz-pk-side::-webkit-scrollbar{display:none}
.gz-pk-side .pk-logo{display:flex;flex-direction:column;align-items:center;justify-content:center;width:64px;height:64px;border-radius:16px;background:var(--pk-accent);color:#06131a;font:800 15px/1 system-ui,sans-serif;text-decoration:none;letter-spacing:-.02em;gap:2px}
.gz-pk-side .pk-logo b{font-size:17px}
.gz-pk-side .pk-search{width:40px;height:40px;border-radius:50%;background:rgba(255,255,255,.1);display:flex;align-items:center;justify-content:center;color:var(--pk-ink);text-decoration:none;font-size:18px}
.gz-pk-side .pk-rail{display:flex;flex-direction:column;gap:10px}
.gz-pk-side .pk-rail a{width:64px;height:64px;border-radius:14px;overflow:hidden;display:block;position:relative;background:#1b2037 center/cover no-repeat;border:1px solid rgba(255,255,255,.06);transition:transform .15s ease}
.gz-pk-side .pk-rail a:hover{transform:scale(1.06)}
.gz-pk-side .pk-rail a img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
/* Stage */
.gz-pk-stage{display:flex;flex-direction:column;min-height:100dvh;margin-left:0}
@media (min-width:1031px){.gz-pk-stage{margin-left:var(--pk-rail-w)}}
.gz-pk-canvas-wrap{display:grid;place-items:center;grid-template-rows:minmax(0,1fr);grid-template-columns:minmax(0,1fr);height:calc(100dvh - var(--pk-title-h));width:100%;overflow:hidden;background:#070a14;position:relative;contain:layout}
/* Grid items must not grow the implicit track: lock them to the track and center. */
.gz-pk-canvas-wrap > *{min-height:0!important;min-width:0!important;align-self:center!important;justify-self:center!important}
/* The game element inside the wrap: keep its own aspect/size but never exceed the wrap. */
.gz-pk-canvas-wrap > #GameDiv,.gz-pk-canvas-wrap > canvas,.gz-pk-canvas-wrap > .game-root,.gz-pk-canvas-wrap > #Cocos2dGameContainer{position:relative!important;inset:auto!important;left:auto!important;top:auto!important;margin:0!important;max-width:100%!important;max-height:100%!important}
/* Override the earlier publish-time canvas flow rule (100vw/100vh) — inside the wrap the box is bound by the wrap, not the viewport. */
.gz-pk-canvas-wrap > canvas{width:auto!important;height:100%!important}
/* landscape canvas (plain <canvas>): largest 16:9 inside the wrap */
.gz-pk-canvas-wrap[data-orient="landscape"] > canvas{aspect-ratio:16/9;height:100%!important;width:auto!important;max-width:100%!important}
@media (max-aspect-ratio:16/9){.gz-pk-canvas-wrap[data-orient="landscape"] > canvas{width:100%!important;height:auto!important}}
/* Portrait canvas (plain <canvas>): largest 9:16 inside the wrap */
.gz-pk-canvas-wrap[data-orient="portrait"] > canvas{aspect-ratio:9/16;height:100%!important;width:auto!important;max-width:100%!important}
@media (max-aspect-ratio:9/16){.gz-pk-canvas-wrap[data-orient="portrait"] > canvas{width:100%!important;height:auto!important}}
@media (max-width:1030px){.gz-pk-canvas-wrap[data-orient="portrait"] > canvas,.gz-pk-canvas-wrap[data-orient="portrait"] > #GameDiv{height:min(100%,calc(100vw * 16 / 9))!important}}
/* Cocos GameDiv writes inline width/height = viewport (cc_exact_fit_screen); override so it letterboxes inside the wrap and let its inner canvas fill the div. */
.gz-pk-canvas-wrap > #GameDiv{display:flex!important;align-items:center!important;justify-content:center!important;overflow:hidden!important;height:100%!important;max-height:100%!important}
/* Cocos GameDiv: box = wrap height, width = aspect (overrides inline width/height). Inner canvas fills the box with object-fit:contain. */
.gz-pk-canvas-wrap[data-orient="landscape"] > #GameDiv{aspect-ratio:16/9;height:100%!important;width:auto!important;max-width:100%!important}
.gz-pk-canvas-wrap[data-orient="portrait"] > #GameDiv{aspect-ratio:9/16;height:100%!important;width:auto!important;max-width:100%!important}
.gz-pk-canvas-wrap > #GameDiv > #Cocos3dGameContainer,.gz-pk-canvas-wrap > #GameDiv > div{width:100%!important;height:100%!important}
.gz-pk-canvas-wrap > #GameDiv > canvas,.gz-pk-canvas-wrap > #GameDiv > div > canvas{width:100%!important;height:100%!important;max-width:100%!important;max-height:100%!important;object-fit:contain}
/* Title bar under the canvas */
.gz-pk-titlebar{display:flex;align-items:center;gap:12px;min-height:var(--pk-title-h);padding:8px 16px;background:#12151f;color:var(--pk-ink);font:600 14px/1.2 system-ui,-apple-system,"PingFang SC",sans-serif;border-top:1px solid rgba(255,255,255,.06)}
.gz-pk-titlebar .pk-icon{width:36px;height:36px;border-radius:9px;background:#1b2037 center/cover no-repeat;flex:0 0 auto;display:flex;align-items:center;justify-content:center;font-size:20px}
.gz-pk-titlebar .pk-name{font-weight:800;font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.gz-pk-titlebar .pk-cat{color:var(--pk-muted);font-size:12px;margin-left:8px;white-space:nowrap}
.gz-pk-titlebar .pk-cat a{color:var(--pk-muted);text-decoration:none}
.gz-pk-titlebar .pk-cat a:hover{color:var(--pk-accent)}
.gz-pk-titlebar .pk-actions{margin-left:auto;display:flex;gap:8px;align-items:center}
.gz-pk-titlebar .pk-actions button,.gz-pk-titlebar .pk-actions a{height:36px;min-width:36px;padding:0 12px;border:0;border-radius:9px;background:rgba(255,255,255,.08);color:var(--pk-ink);font:700 13px/1 system-ui,sans-serif;cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;gap:6px}
.gz-pk-titlebar .pk-actions button:hover,.gz-pk-titlebar .pk-actions a:hover{background:rgba(255,255,255,.14)}
/* Below: recommendation shelf + right ad */
.gz-pk-below{display:grid;grid-template-columns:1fr;gap:16px;padding:16px;max-width:1280px;margin:0 auto;width:100%;color:var(--pk-ink);font-family:system-ui,-apple-system,"PingFang SC",sans-serif;box-sizing:border-box}
@media (min-width:1031px){.gz-pk-below{grid-template-columns:minmax(0,1fr) 300px}}
.gz-pk-below .pk-shelf-h{display:flex;align-items:center;justify-content:space-between;margin:0 0 10px}
.gz-pk-below .pk-shelf-h h2{margin:0;font-size:18px;font-weight:800}
.gz-pk-below .pk-shelf-h a{font-size:13px;color:var(--pk-muted);text-decoration:none;font-weight:600}
.gz-pk-below .pk-track{display:flex;gap:var(--pk-gap);overflow-x:auto;scroll-snap-type:x mandatory;padding:4px 2px 10px;overscroll-behavior-x:contain;scrollbar-width:thin}
.gz-pk-below .pk-track>*{scroll-snap-align:start;flex:0 0 auto}
.gz-pk-below .pk-ad-slot{min-height:250px;border-radius:var(--pk-radius);display:flex;align-items:flex-start;justify-content:center}
/* Reuse the home card atoms (.pk-card/.pk-art/.pk-play/.pk-badge/.pk-title) from gz-layout.css; both are linked on game pages. */
.gz-pk-below .pk-card{--pk-card-w:110px}
@media (max-width:660px){.gz-pk-below{padding:12px}.gz-pk-below .pk-card{--pk-card-w:96px}}
/* Existing ad blocks injected earlier stay (they keep their own slots). Ensure they sit below the new shelf. */
body.gz-pk-game #gz-ad-below-game-wrap,body.gz-pk-game #gz-ad-bottom{clear:both}
@media (prefers-reduced-motion:reduce){.gz-pk-side .pk-rail a,.pk-card{transition:none}}
