/* ==========================================================================
   APIX RUN — mini-game page
   ========================================================================== */
.game-section { padding: 10px 0 70px; }
.game {
  position: relative; width: 100%; max-width: 1120px; margin: 0 auto; aspect-ratio: 16 / 9;
  border-radius: 24px; overflow: hidden; background: #05040c; border: 1px solid var(--line-2);
  box-shadow: 0 40px 120px -40px rgba(168, 85, 247, .6), 0 0 0 1px rgba(34, 227, 255, .08);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; outline: none;
}
.game:focus-visible { box-shadow: 0 0 0 3px var(--cyan); }
.game canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.game:fullscreen { max-width: none; border-radius: 0; border: 0; aspect-ratio: auto; width: 100vw; height: 100vh; }

/* overlays */
.g-overlay {
  position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; text-align: center; padding: 18px;
  background: radial-gradient(70% 70% at 50% 50%, rgba(5, 4, 12, .55), rgba(5, 4, 12, .85));
  opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s;
}
.g-overlay.show { opacity: 1; visibility: visible; }
.g-panel { max-width: 560px; }
.g-title { font-family: var(--font-display); font-size: clamp(40px, 8vw, 92px); line-height: .9; text-transform: uppercase; margin: 0 0 10px; }
.g-sub { color: var(--muted); font-size: clamp(14px, 1.6vw, 18px); margin: 0 0 22px; }
.g-keys { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 18px; margin: 20px 0 0; font-family: var(--font-ui); font-size: 13px; letter-spacing: .08em; color: var(--muted); }
.g-keys span { display: inline-flex; align-items: center; gap: 7px; }
kbd {
  display: inline-block; min-width: 26px; padding: 3px 7px; border-radius: 7px; background: rgba(255, 255, 255, .08); border: 1px solid var(--line-2);
  border-bottom-width: 3px; font-family: var(--font-ui); font-weight: 700; font-size: 12px; color: var(--text);
}
.g-best { margin-top: 14px; font-family: var(--font-ui); font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.g-best b { color: var(--lime); }
.g-score { font-family: var(--font-display); font-size: clamp(38px, 7vw, 76px); line-height: 1; margin: 4px 0 6px; }
.g-stats { display: flex; justify-content: center; gap: 22px; font-family: var(--font-ui); font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-bottom: 20px; }
.g-stats b { color: var(--text); }
.g-newbest {
  display: inline-block; padding: 6px 14px; border-radius: 999px; background: var(--lime); color: #0b0918; margin-bottom: 10px;
  font-family: var(--font-ui); font-weight: 700; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; animation: pop .5s var(--ease);
}
@keyframes pop { 0% { transform: scale(.4); } 70% { transform: scale(1.12); } 100% { transform: none; } }
.g-panel .cta-row { justify-content: center; }
.g-keys .g-touch-only { display: none; }
.is-touch .g-keys .g-touch-only { display: inline-flex; }
.is-touch .g-keys .g-key-only { display: none; }

/* corner buttons */
.g-corner { position: absolute; z-index: 4; top: 12px; right: 12px; display: flex; gap: 8px; }
.g-icon {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; cursor: pointer;
  background: rgba(5, 4, 12, .55); border: 1px solid var(--line-2); color: var(--text); backdrop-filter: blur(6px); transition: background .2s;
}
.g-icon:hover { background: rgba(168, 85, 247, .5); }
.g-icon svg { width: 18px; height: 18px; }
.g-icon .off { display: none; }
.g-icon.muted .on { display: none; }
.g-icon.muted .off { display: block; }

/* touch controls */
.g-touch { position: absolute; inset: auto 0 0 0; z-index: 2; display: none; justify-content: space-between; align-items: flex-end; padding: 14px; pointer-events: none; }
.is-touch.playing .g-touch { display: flex; }
.g-btn {
  pointer-events: auto; border-radius: 50%; display: grid; place-items: center; cursor: pointer; touch-action: none;
  background: rgba(255, 255, 255, .08); border: 2px solid rgba(255, 255, 255, .28); color: #fff; backdrop-filter: blur(4px);
  font-family: var(--font-ui); font-weight: 700; font-size: 12px; letter-spacing: .1em;
}
.g-btn.down { background: rgba(34, 227, 255, .35); border-color: var(--cyan); }
.g-btn-slide { width: 78px; height: 78px; }
.g-right { display: flex; gap: 12px; align-items: flex-end; }
.g-btn-build { width: 66px; height: 66px; border-color: rgba(198, 255, 61, .6); }
.g-btn-jump { width: 92px; height: 92px; border-color: rgba(255, 46, 136, .7); }

.g-rotate { display: none; margin-top: 14px; font-size: 13px; color: var(--muted); }
@media (orientation: portrait) and (max-width: 700px) { .is-touch .g-rotate { display: block; } }

.game-legend { max-width: 1120px; margin: 26px auto 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.legend-item { padding: 18px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); }
.legend-item h4 { font-size: 15px; text-transform: uppercase; margin: 8px 0 6px; }
.legend-item p { margin: 0; font-size: 14px; color: var(--muted); }
@media (max-width: 900px) { .game-legend { grid-template-columns: 1fr 1fr; } .g-keys { font-size: 11.5px; } }
@media (max-width: 600px) {
  .game { border-radius: 16px; }
  .g-overlay { padding: 10px; }
  .g-sub { margin-bottom: 12px; }
  .g-keys { margin-top: 10px; }
  .g-panel .btn { padding: 11px 18px; font-size: 12.5px; }
  .g-btn-slide { width: 62px; height: 62px; } .g-btn-build { width: 54px; height: 54px; } .g-btn-jump { width: 72px; height: 72px; }
}

