.game-page { padding-bottom: 28px; }
.game-shell {
  background: #11162b;
  color: #fff;
  border-radius: 24px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.game-toolbar {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.hud {
  display: grid;
  grid-template-columns: repeat(5, minmax(90px,1fr));
  gap: 10px;
  width: 100%;
  margin-bottom: 14px;
}
.hud-item {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  padding: 10px 12px;
}
.hud-label { display: block; color: #aeb7d3; font-size: .78rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.hud-value { display: block; font-size: 1.15rem; font-weight: 900; margin-top: 2px; }
.canvas-wrap {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  background: #080c1b;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  touch-action: none;
}
#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  background: #080c1b;
}
.game-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(6,9,20,.72);
  padding: 24px;
  text-align: center;
}
.overlay-card {
  width: min(100%, 470px);
  background: rgba(17,22,43,.96);
  border: 1px solid rgba(255,255,255,.14);
  padding: 26px;
  border-radius: 18px;
}
.overlay-card h2 { margin: 0 0 8px; font-size: clamp(1.8rem,4vw,2.6rem); }
.overlay-card p { color: #c7cee2; }
.game-controls { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 16px; }
.game-controls .btn { min-width: 116px; }
.game-controls .btn-secondary { background: #222944; color: #fff; border-color: #3c466b; }
.mobile-controls {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 18px auto 0;
  max-width: 520px;
}
.mobile-controls button {
  min-height: 54px;
  border: 1px solid #414a6d;
  border-radius: 14px;
  background: #222944;
  color: #fff;
  font-size: 1.35rem;
  font-weight: 900;
}
.game-message { min-height: 24px; color: #c7cee2; text-align: center; margin-top: 12px; }
.status-pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 6px 10px; background: rgba(108,99,255,.18); border: 1px solid rgba(108,99,255,.4); font-size: .85rem; font-weight: 800; }
.game-article { margin-top: 42px; }
.game-article-grid { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 28px; align-items: start; }
.toc { position: sticky; top: 96px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.toc h2 { font-size: 1.05rem; margin-top: 0; }
.toc ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.ad-space { min-height: 180px; }
.faq details { border-top: 1px solid var(--line); padding: 15px 0; }
.faq summary { cursor: pointer; font-weight: 800; }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.score-pop {
  position: absolute;
  color: #fff;
  font-weight: 900;
  pointer-events: none;
  animation: scoreFloat .7s ease-out forwards;
}
@keyframes scoreFloat { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-28px); } }
@media (max-width: 900px) {
  .game-article-grid { grid-template-columns: 1fr; }
  .toc { position: static; order: -1; }
}
@media (max-width: 720px) {
  .hud { grid-template-columns: repeat(2,1fr); }
  .hud-item:last-child { grid-column: 1 / -1; }
  .mobile-controls { display: grid; }
  .game-shell { padding: 12px; border-radius: 18px; }
}

/* Shared PlayPick game hub */
.game-stage-section { padding-top: 18px; }
.dom-game {
  min-height: 600px;
  padding: clamp(18px, 4vw, 38px);
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #080c1b, #151d3c);
  color: #fff;
}
.dom-game[hidden] { display: none !important; }
.mode-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}
.mode-controls button,
.surface-action {
  min-height: 44px;
  border: 1px solid #414a6d;
  border-radius: 12px;
  background: #222944;
  color: #fff;
  padding: 9px 14px;
  font-weight: 800;
}
.universal-mobile-controls { grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); }
.surface-help { max-width: 620px; margin: 20px auto 0; text-align: center; color: #c7cee2; }
.game-ad-safe-zone {
  padding-top: 160px;
  display: flex;
  justify-content: center;
}
.ad-banner-slot,
.article-ad-slot {
  width: min(100%, 728px);
  min-height: 90px;
  border: 1px dashed #b9c2d2;
  border-radius: 12px;
  background: #f2f4f8;
  display: grid;
  place-content: center;
  text-align: center;
  color: #687386;
  padding: 12px;
}
.article-ad-slot { margin: 48px auto; min-height: 100px; }
.ad-label { display: block; text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; font-weight: 800; }
.ad-size-note { display: block; margin-top: 4px; font-size: .8rem; }

/* Number Merge */
.merge-board { width: min(100%, 520px); display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; background: #262b45; padding: 12px; border-radius: 18px; }
.merge-tile { aspect-ratio: 1; display: grid; place-items: center; border-radius: 12px; font-size: clamp(1.4rem, 5vw, 2.6rem); font-weight: 900; color: #fff; background: #4f587a; }
.merge-tile.is-empty { background: rgba(255,255,255,.07); }
.tile-2 { background:#536dfe; }.tile-4 { background:#3949ab; }.tile-8 { background:#8e24aa; }.tile-16 { background:#d81b60; }.tile-32 { background:#e53935; }.tile-64 { background:#fb8c00; }.tile-128 { background:#fdd835; color:#1a1a1a; }.tile-256 { background:#7cb342; }.tile-512 { background:#00acc1; }.tile-1024 { background:#00897b; }.tile-2048 { background:#ffd54f; color:#1a1a1a; box-shadow:0 0 28px rgba(255,213,79,.35); }

/* Memory Match */
.memory-board { width: min(100%, 620px); display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.memory-card { aspect-ratio: 1; border: 1px solid #485171; border-radius: 14px; background: #252c4c; color: #fff; font-size: clamp(1.5rem, 5vw, 2.7rem); font-weight: 900; }
.memory-card.is-open { background: #6c63ff; transform: translateY(-2px); }
.memory-card.is-matched { background: #08775b; opacity: .75; }

/* Reaction Time */
.reaction-panel { width: min(100%, 760px); min-height: 360px; border: 0; border-radius: 24px; color: #fff; display: grid; place-content: center; gap: 10px; padding: 28px; text-align: center; }
.reaction-panel strong { font-size: clamp(2rem, 7vw, 4.2rem); }
.reaction-panel span { font-size: 1.05rem; }
.reaction-panel.is-waiting { background:#b53b4b; }.reaction-panel.is-ready { background:#168d62; }.reaction-panel.is-early { background:#8d3651; }.reaction-panel.is-result { background:#334c8c; }

/* Number Rush */
.number-rush-board { width: min(100%, 620px); display:grid; grid-template-columns:repeat(5,1fr); gap:9px; }
.number-rush-cell { aspect-ratio:1; border:1px solid #47506f; border-radius:12px; background:#252c4c; color:#fff; font-weight:900; font-size:clamp(1rem,4vw,1.5rem); }
.number-rush-cell.is-done { background:#08775b; opacity:.5; }

/* Color Reflex */
.color-reflex { width:min(100%,760px); text-align:center; }
.color-rule { color:#c7cee2; }
.color-word { font-size:clamp(3.2rem,12vw,7rem); font-weight:950; letter-spacing:.05em; margin:28px 0; }
.color-options { display:grid; grid-template-columns:repeat(2,1fr); gap:12px; }
.color-options button { min-height:64px; border:3px solid var(--option-color); border-radius:14px; background:#1f2642; color:#fff; font-weight:900; }

/* Minesweeper */
.mine-toolbar { width:min(100%,540px); display:flex; justify-content:flex-end; margin-bottom:12px; }
.surface-action.is-active { background:#6c63ff; }
.mine-board { width:min(100%,540px); display:grid; grid-template-columns:repeat(9,1fr); gap:4px; }
.mine-cell { aspect-ratio:1; border:1px solid #485171; border-radius:6px; background:#303858; color:#fff; font-weight:900; font-size:clamp(.75rem,2.5vw,1.1rem); }
.mine-cell.is-revealed { background:#e8ebf2; color:#172033; }.mine-cell.is-flagged { background:#f4b740; color:#222; }.mine-cell.is-mine { background:#e25555; color:#fff; }

/* Sliding Puzzle */
.slide-board { width:min(100%,520px); display:grid; grid-template-columns:repeat(4,1fr); gap:9px; background:#202742; padding:12px; border-radius:18px; }
.slide-tile { aspect-ratio:1; border:0; border-radius:12px; background:#6c63ff; color:#fff; font-size:clamp(1.4rem,5vw,2.3rem); font-weight:900; }
.slide-tile.is-blank { background:rgba(255,255,255,.05); }

/* Quick Math */
.math-game { width:min(100%,700px); text-align:center; }
.math-question { font-size:clamp(3rem,11vw,6.5rem); font-weight:950; margin-bottom:30px; }
.math-options { display:grid; grid-template-columns:repeat(2,1fr); gap:12px; }
.math-options button { min-height:72px; border:1px solid #4a5478; border-radius:14px; background:#252c4c; color:#fff; font-size:1.45rem; font-weight:900; }

/* Pattern Recall */
.pattern-board { width:min(100%,560px); display:grid; grid-template-columns:repeat(2,1fr); gap:16px; }
.pattern-pad { aspect-ratio:1; border:4px solid rgba(255,255,255,.22); border-radius:24px; opacity:.64; transition:transform .12s ease, opacity .12s ease, filter .12s ease; }
.pattern-pad.is-active { opacity:1; transform:scale(.96); filter:brightness(1.55); }
.pad-0 { background:#ef5350; }.pad-1 { background:#42a5f5; }.pad-2 { background:#f4b740; }.pad-3 { background:#26a69a; }

/* Connect Four */
.connect-controls { width:min(100%,620px); display:grid; grid-template-columns:repeat(7,1fr); gap:6px; margin-bottom:8px; }
.connect-controls button { min-height:42px; border:0; border-radius:9px; background:#303858; color:#fff; font-weight:900; }
.connect-board { width:min(100%,620px); display:grid; grid-template-columns:repeat(7,1fr); gap:7px; background:#244c9a; padding:12px; border-radius:18px; }
.connect-cell { aspect-ratio:1; border-radius:50%; background:#10152a; box-shadow:inset 0 4px 10px rgba(0,0,0,.35); }
.connect-cell.is-player { background:#20c997; }.connect-cell.is-cpu { background:#b67cff; }

@media (max-width: 720px) {
  .dom-game { min-height: 480px; padding: 14px; }
  .game-ad-safe-zone { padding-top: 150px; }
  .ad-banner-slot { min-height: 100px; }
  .color-options, .math-options { grid-template-columns:1fr 1fr; }
  .mine-board { gap:2px; }
}
