/* Game-specific refinements keep the other pages' approved themes intact. */
.games-page { --extra-ink: #e9f6fc; --extra-surface: rgba(108, 171, 203, .15); --extra-border: rgba(160, 213, 240, .35); --game-piece-edge: rgba(228, 247, 255, .65); --game-bird: #ffd166; }
:root[data-theme="light"] .games-page { --extra-ink: #193e58; --extra-surface: rgba(92, 149, 180, .16); --extra-border: rgba(44, 104, 140, .36); --game-piece-edge: #345b75; --game-bird: #c17a10; }
:root[data-theme="light"] .games-page .tile:not(.tile-0) { color: #173d55; text-shadow: none; }
.games-page .board-2048 { grid-template-rows: repeat(4, minmax(0, 1fr)); }
.games-page .tile { min-width: 0; min-height: 0; }
.games-page .memory-toolbar, .games-page .breaker-stats { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; width: min(420px, 100%); color: var(--extra-ink); font-size: 13px; }
.games-page .memory-toolbar label { display: flex; gap: 8px; align-items: center; }
.games-page .memory-toolbar select { min-height: 40px; max-width: 100%; padding: 6px 10px; border: 1px solid var(--extra-border); border-radius: 12px; color: var(--extra-ink); background: var(--game-canvas); font: inherit; }
.games-page .memory-toolbar option { color: var(--extra-ink); background: var(--game-canvas); }
.games-page .memory-board { width: min(420px, 100%); display: grid; gap: 10px; }
.games-page .memory-card { display: grid; place-items: center; min-width: 0; min-height: 48px; aspect-ratio: 1.25; padding: 0; border: 1px solid var(--extra-border); border-radius: 14px; color: var(--extra-ink); background: var(--extra-surface); font-size: clamp(24px, 4vw, 34px); cursor: pointer; transition: background .15s, border-color .15s; }
.games-page .memory-card.revealed { color: var(--game-snake); background: var(--game-canvas); border-color: var(--game-snake); }
.games-page .memory-card.matched { background: rgba(50, 154, 132, .16); opacity: 1; cursor: default; }
.games-page .memory-card:not(:disabled):hover { border-color: var(--game-snake); }
.games-page #breakerCanvas { touch-action: none; cursor: ew-resize; }
.games-page #memoryPanel .game-message { min-width: 0; }
.games-page .game-item { min-height: 48px; }
@media (prefers-reduced-motion: reduce) { .games-page .memory-card { transition: none; } }

@media (max-width: 820px) {
    /* Put settings into a real layout row, so they cannot cover game controls. */
    .games-page .unified-nav.site-nav { position: relative; inset: auto; width: calc(100% - 20px); min-height: 48px; margin: 10px auto 0; padding: 0 8px; gap: 4px; border-radius: 17px; flex-wrap: nowrap; }
    .games-page .unified-nav .profile-brand, .games-page .unified-nav .profile-location { display: none; }
    .games-page .unified-nav .profile-nav-links { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); min-width: 0; width: auto; height: 48px; flex: 1; gap: 0; margin: 0; }
    .games-page .unified-nav .nav-link { width: auto; min-width: 0; padding: 0; justify-content: center; }
    .games-page .unified-nav .nav-link i { font-size: 17px; }
    .games-page .unified-nav .nav-link span { display: none; }
    .games-page .unified-nav .nav-controls { position: static; inset: auto; width: auto; padding: 0; gap: 4px; border: 0; background: none; }
    .games-page .unified-nav .icon-toggle { width: 30px; height: 32px; }
    .games-page .unified-nav .lang-menu { display: block; }
    .games-page .unified-nav .lang-panel { top: calc(100% + 8px); bottom: auto; }
    .games-page .games-main { width: calc(100% - 20px); min-height: 0; padding: 12px 0 calc(24px + env(safe-area-inset-bottom)); }
    .games-page .games-list { display: flex; grid-template-columns: none; max-height: none; gap: 4px; padding: 8px; overflow-x: auto; scrollbar-width: thin; scroll-snap-type: x proximity; }
    .games-page .game-item { flex: 0 0 auto; min-width: max-content; min-height: 42px; gap: 7px; padding: 0 12px; border-radius: 10px; font-size: 13px; white-space: nowrap; overflow-wrap: normal; scroll-snap-align: start; }
    .games-page .game-panel { padding: 12px; }
    .games-page .game-panel.active { gap: 10px; }
    .games-page .game-head { width: 100%; gap: 8px; flex-wrap: nowrap; }
    .games-page .game-head h1 { font-size: 22px; margin-bottom: 4px; }
    .games-page .game-head p { font-size: 12px; line-height: 1.5; }
    .games-page .game-head strong { flex: 0 0 auto; font-size: 12px; }
    .games-page .game-message { min-width: 0; max-width: 100%; padding: 7px 12px; font-size: 13px; }
    .games-page .game-actions { gap: 8px; }
    .games-page .game-actions .btn { padding: 8px 14px; }
    .games-page .game-panel canvas { max-width: 100%; height: auto; }
    .games-page #snakeCanvas { width: min(280px, 100%, max(180px, calc(100dvh - 370px))); }
    .games-page #flappyCanvas { width: min(300px, 100%, max(180px, calc((100dvh - 300px) * .857))); }
    .games-page .tetris-stage { display: flex; width: 100%; justify-content: center; align-items: flex-start; gap: 10px; }
    .games-page #tetrisCanvas { width: clamp(108px, calc((100dvh - 420px) * .6), 190px); max-width: calc(100% - 74px); }
    .games-page .tetris-next { flex: 0 0 64px; font-size: 12px; }
    .games-page #tetrisNextCanvas { width: 64px; height: auto; max-width: 64px; }
    .games-page .mobile-gamepad { width: 140px; grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(3, 44px); gap: 4px; }
    .games-page .mobile-gamepad button { width: 44px; height: 44px; }
    .games-page #tetrisPanel .mobile-gamepad { width: 188px; grid-template-columns: repeat(4, 44px); grid-template-rows: 44px; grid-template-areas: "left up right down"; }
    .games-page #tetrisPanel [data-control="up"] { grid-area: up; }
    .games-page #tetrisPanel [data-control="left"] { grid-area: left; }
    .games-page #tetrisPanel [data-control="right"] { grid-area: right; }
    .games-page #tetrisPanel [data-control="down"] { grid-area: down; }
    .games-page #tetrisPanel [data-control="action"] { display: none; }
    .games-page .mobile-gamepad.flight-controls { width: 140px; grid-template-columns: 140px; grid-template-rows: 44px; }
    .games-page .flight-controls [data-control="action"] { width: 140px; }
    .games-page .mobile-gamepad.paddle-controls { width: 140px; grid-template-columns: repeat(3, 44px); grid-template-rows: 44px; }
    .games-page .paddle-controls [data-control="left"] { grid-area: 1 / 1; }
    .games-page .paddle-controls [data-control="action"] { grid-area: 1 / 2; }
    .games-page .paddle-controls [data-control="right"] { grid-area: 1 / 3; }
    .games-page .memory-board { gap: 8px; }
    .games-page .memory-card { aspect-ratio: 1.35; }
}
