/* =============================================================
   GAME: Road Crossing
   ============================================================= */
.board-roadcrossing { display: flex; flex-direction: column; align-items: center; gap: 10px; outline: none; max-width: 100%; }
.rc-stage { position: relative; touch-action: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.rc-canvas {
  display: block; width: 360px; height: 520px; border-radius: 14px; background: #0b1020;
  box-shadow: 0 0 0 2px #ffe14d, 0 0 26px rgba(255, 225, 77, .32);
}
.board-roadcrossing:focus-visible .rc-canvas { box-shadow: 0 0 0 3px #fff, 0 0 26px rgba(255, 225, 77, .5); }
.rc-msg {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); width: max-content; max-width: 86%;
  padding: 10px 16px; border-radius: 12px; background: rgba(12, 10, 30, .84); color: #fff8d6; font-weight: 700; text-align: center;
  box-shadow: 0 0 0 1px rgba(255, 225, 77, .55); pointer-events: none;
}
.rc-msg[hidden] { display: none; }
.rc-pop {
  position: absolute; left: 0; right: 0; top: 22%; text-align: center; pointer-events: none; opacity: 0;
  font: 800 1.6rem var(--font-head, system-ui); color: #fff; text-shadow: 0 0 14px #ffe14d, 0 0 30px #ffb800;
}
.rc-pop.show { animation: rcPop 1s ease-out forwards; }
@keyframes rcPop { 0% { opacity: 0; transform: scale(.6); } 15% { opacity: 1; transform: scale(1.1); } 70% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-12px); } }
@media (prefers-reduced-motion: reduce) { .rc-pop.show { animation: rcFade 1s linear forwards; } }
@keyframes rcFade { 0%, 75% { opacity: 1; } 100% { opacity: 0; } }
.rc-num { color: #ffe14d; font-variant-numeric: tabular-nums; }

/* on-screen pad: phones and tablets only */
.rc-pad { display: none; grid-template-columns: repeat(2, 1fr) 48px repeat(2, 1fr); gap: 8px; align-items: center; width: min(100%, 400px); touch-action: none; }
.rc-key {
  display: grid; place-items: center; height: 56px; border: 0; border-radius: 14px; cursor: pointer; color: #ffe14d;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px rgba(255, 225, 77, .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;
}
.rc-key svg { width: 26px; height: 26px; fill: currentColor; }
.rc-key-up { color: #fff3a6; background: #2a2614; }
.rc-key-pause { width: 48px; height: 48px; color: var(--ink); border-radius: 50%; }
.rc-key-pause svg { width: 20px; height: 20px; }
.rc-key:active { background: #3a3414; transform: translateY(2px); box-shadow: inset 0 0 0 1px #ffe14d, 0 2px 0 rgba(0, 0, 0, .35); }
@media (pointer: coarse) { .rc-pad { display: grid; } .board-roadcrossing { gap: 8px; } }

/* crash: a short shake + red frame (off when motion is reduced) */
.rc-crash .rc-canvas { box-shadow: 0 0 0 2px #ff3d5e, 0 0 30px rgba(255, 61, 94, .55); transition: box-shadow .3s; }
.rc-crash { animation: rcShake .4s cubic-bezier(.36, .07, .19, .97); }
@keyframes rcShake { 15%, 55% { translate: -5px 0; } 35%, 75% { translate: 5px 0; } 90% { translate: -2px 0; } }
@media (prefers-reduced-motion: reduce) { .rc-crash { animation: none; } }
