/* =============================================================
   GAME: Maze Chase
   ============================================================= */
.board-mazechase { display: flex; flex-direction: column; align-items: center; gap: 12px; outline: none; }
.mc-stage { position: relative; touch-action: none; }
.mc-canvas {
  display: block; width: min(calc(100vw - 60px), 440px, calc((100vh - 230px) * 19 / 21)); min-width: 240px; aspect-ratio: 19 / 21;
  border-radius: 12px; background: #07061a;
  box-shadow: 0 0 0 2px #ffd23f, 0 0 26px rgba(255, 210, 63, .35);
}
.board-mazechase:focus-visible .mc-canvas { box-shadow: 0 0 0 3px #fff, 0 0 26px rgba(255, 210, 63, .5); }
.mc-msg {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: max-content; max-width: 82%;
  padding: 10px 16px; border-radius: 12px; background: rgba(7, 6, 26, .86); color: #fff3cf; font-weight: 700; text-align: center;
  box-shadow: 0 0 0 1px rgba(255, 210, 63, .55); pointer-events: none;
}
.mc-msg[hidden] { display: none; }
.mc-num { color: #ffe27a; font-variant-numeric: tabular-nums; }
.mc-lives { color: #c8ff3a; letter-spacing: 2px; text-shadow: 0 0 8px rgba(200, 255, 58, .6); }

/* on-screen pad: phones and tablets only */
.mc-pad { display: none; grid-template-columns: repeat(3, 64px); grid-template-rows: repeat(3, 46px); gap: 4px 8px; touch-action: none; }
.mc-key {
  display: grid; place-items: center; border: 0; border-radius: 14px; cursor: pointer; color: #ffe27a;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px rgba(255, 210, 63, .45), 0 4px 0 rgba(0, 0, 0, .35);
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.mc-key svg { width: 26px; height: 26px; fill: currentColor; }
.mc-key:active { background: #3d3410; transform: translateY(2px); box-shadow: inset 0 0 0 1px #ffd23f, 0 2px 0 rgba(0, 0, 0, .35); }
.mc-key-up { grid-area: 1 / 2; }
.mc-key-left { grid-area: 2 / 1; }
.mc-key-pause { grid-area: 2 / 2; color: var(--ink); border-radius: 50%; width: 42px; height: 42px; justify-self: center; align-self: center; }
.mc-key-pause svg { width: 20px; height: 20px; }
.mc-key-right { grid-area: 2 / 3; }
.mc-key-down { grid-area: 3 / 2; }
@media (pointer: coarse) {
  .mc-pad { display: grid; }
  .board-mazechase { gap: 8px; }
  .mc-canvas { width: min(calc(100vw - 60px), 440px, calc((100vh - 400px) * 19 / 21)); }
}

/* caught: a short shake + red flash of the frame (off when motion is reduced) */
.mc-hit { animation: mcShake .42s cubic-bezier(.36, .07, .19, .97); }
.mc-hit .mc-canvas { box-shadow: 0 0 0 2px #ff4b5c, 0 0 30px rgba(255, 75, 92, .55); transition: box-shadow .3s; }
@keyframes mcShake { 15%, 55% { translate: -5px 0; } 35%, 75% { translate: 5px 0; } 90% { translate: -2px 0; } }
@media (prefers-reduced-motion: reduce) { .mc-hit { animation: none; } }
