/* Games hub + game pages. Modern dark-glass stage on a light page. Art is drawn in code. */
:root { --g-ink: #121826; --g-muted: #5b6577; --g-line: #e4e8f0; --g-bg: #f6f7fb; --g-accent: var(--color-primary, #5C8374); }
body[data-page_type="games"], body[data-page_type="game"] { background: var(--g-bg); }
.games-page { max-width: 1000px; margin: 0 auto; padding: 96px 16px 56px; color: var(--g-ink); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.6; }
.games-page h1 { font-size: clamp(1.7rem, 4vw + .6rem, 2.6rem); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 10px; }
.games-page h2 { font-size: 1.25rem; letter-spacing: -.01em; margin: 36px 0 10px; }
.games-intro { font-size: 1.05rem; color: var(--g-muted); max-width: 66ch; margin: 0 0 8px; text-align: left; }
.games-note { margin-top: 28px; color: var(--g-muted); }
.games-draft { background: #fff3cd; border: 1px solid #e0c36a; padding: 6px 12px; border-radius: 999px; display: inline-block; font-size: .85rem; }
.games-page a { color: var(--g-accent); }

/* Cards */
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; margin: 24px 0; }
.games-card { display: flex; flex-direction: column; background: #fff; border-radius: 18px; overflow: hidden; text-decoration: none; color: inherit; box-shadow: 0 1px 2px rgba(18,24,38,.06), 0 8px 24px rgba(18,24,38,.07); transition: transform .2s ease, box-shadow .2s ease; }
.games-card:hover, .games-card:focus-visible { transform: translateY(-4px); box-shadow: 0 2px 4px rgba(18,24,38,.08), 0 16px 36px rgba(18,24,38,.14); outline: none; }
.games-card:focus-visible { box-shadow: 0 0 0 3px var(--g-accent), 0 16px 36px rgba(18,24,38,.14); }
.games-thumb-wrap { position: relative; display: block; overflow: hidden; background: #0f1420; }
.games-thumb { width: 100%; aspect-ratio: 8 / 5; display: block; transition: transform .35s ease; }
.games-card:hover .games-thumb { transform: scale(1.05); }
.games-kind { position: absolute; top: 10px; left: 10px; background: rgba(15,20,32,.62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); color: #fff; font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; }
.games-card-body { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 18px; flex: 1; }
.games-card-title { font-weight: 700; font-size: 1.15rem; letter-spacing: -.01em; }
.games-card-desc { font-size: .93rem; color: var(--g-muted); flex: 1; }
.games-play-btn { align-self: flex-start; margin-top: 10px; background: var(--g-ink); color: #fff; padding: 0 18px; border-radius: 999px; font-weight: 600; font-size: .92rem; min-height: 44px; display: inline-flex; align-items: center; gap: 8px; transition: background .2s ease; }
.games-card:hover .games-play-btn { background: var(--g-accent); }

/* Game stage */
.game-stage { background: radial-gradient(120% 90% at 50% 0%, #1b2440 0%, #0d1220 70%); border-radius: 24px; padding: 12px; margin: 22px auto; max-width: 540px; box-shadow: 0 24px 60px rgba(13,18,32,.35), inset 0 1px 0 rgba(255,255,255,.06); }
.game-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 2px 2px 12px; color: #e8ecf6; font-size: .9rem; }
.game-bar button { min-height: 44px; min-width: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.07); color: #e8ecf6; font: inherit; font-weight: 600; cursor: pointer; transition: background .15s ease, border-color .15s ease; }
.game-bar button:hover { background: rgba(255,255,255,.14); }
.game-bar button:focus-visible { outline: 3px solid #7aa7ff; outline-offset: 2px; }
.game-bar button[aria-pressed="true"] { background: #e8ecf6; color: #0d1220; }
.game-score { margin-left: auto; color: #a9b3cb; }
.game-score b { color: #fff; font-variant-numeric: tabular-nums; }
.game-canvas-wrap { width: 100%; position: relative; touch-action: none; border-radius: 16px; overflow: hidden; }
.game-canvas-wrap canvas { display: block; width: 100%; height: auto; touch-action: none; -webkit-user-select: none; user-select: none; }
.game-stage:fullscreen { max-width: none; border-radius: 0; display: flex; flex-direction: column; justify-content: center; }
.game-stage:fullscreen .game-canvas-wrap { max-height: calc(100vh - 90px); display: flex; justify-content: center; }
.game-stage:fullscreen canvas { width: auto; max-width: 100%; max-height: calc(100vh - 90px); }

/* Text blocks */
.games-text { background: #fff; border-radius: 18px; padding: 8px 24px 20px; margin: 18px 0; box-shadow: 0 1px 2px rgba(18,24,38,.05); }
.games-text, .games-text li { text-align: left; }
.games-text ol, .games-text ul { padding-left: 1.3rem; }
.games-text li { margin-bottom: 8px; }
.games-text .games-grid { margin-bottom: 8px; }
.games-related { list-style: disc; }

/* Ad slot: reserved space, away from controls */
.games-ad { width: 100%; min-height: 250px; margin: 32px auto; display: flex; justify-content: center; align-items: center; overflow: hidden; }

@media (max-width: 480px) { .games-text { padding: 4px 16px 16px; } .game-score { margin-left: 0; width: 100%; } .game-stage { padding: 8px; border-radius: 20px; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

.games-page { text-align: left; }
.games-page h1, .games-page h2 { text-align: left; }
.games-page .games-card { color: var(--g-ink); }
.games-page .games-card .games-card-desc { color: var(--g-muted); }
.games-page .games-card .games-play-btn { color: #fff; }

/* Top ad sits above the page title with its height reserved */
.games-top-ad { min-height: 120px; display: flex; justify-content: center; align-items: flex-start; margin: -12px 0 12px; }
.games-top-ad .top-ad, .games-top-ad .mobile-top-ad { margin-bottom: 0; }
/* Mobile sticky ad: reserve room so it never hides the footer; slide away while a game is on screen */
.sticky-ad-bottom { transition: transform .2s ease; }
.sticky-ad-bottom.games-sticky-hidden { transform: translateY(100%); pointer-events: none; }
@media (max-width: 768px) { .games-top-ad { min-height: 82px; } body[data-page_type="games"], body[data-page_type="game"] { padding-bottom: 58px; } }

.game-stage:fullscreen canvas { width: auto !important; }
.game-canvas-wrap { min-height: 200px; }
