/* =============================================================
   GAME: Space Rocks
   ============================================================= */
.board-spacerocks { display: flex; flex-direction: column; align-items: center; gap: 12px; outline: none; }
.sr-stage { position: relative; touch-action: none; }
.sr-canvas {
  display: block; width: min(calc(100vw - 60px), 560px, calc(100vh - 230px)); min-width: 240px; aspect-ratio: 1;
  border-radius: 12px; background: #04030c;
  box-shadow: 0 0 0 2px #c77dff, 0 0 26px rgba(199, 125, 255, .4);
}
.board-spacerocks:focus-visible .sr-canvas { box-shadow: 0 0 0 3px #fff, 0 0 26px rgba(199, 125, 255, .55); }
.sr-msg {
  position: absolute; left: 50%; top: 62%; transform: translate(-50%, -50%); width: max-content; max-width: 84%;
  padding: 10px 16px; border-radius: 12px; background: rgba(4, 3, 12, .86); color: #f1e6ff; font-weight: 700; text-align: center;
  box-shadow: 0 0 0 1px rgba(199, 125, 255, .6); pointer-events: none;
}
.sr-msg[hidden] { display: none; }
.sr-num { color: #dcb8ff; font-variant-numeric: tabular-nums; }
.sr-lives { color: #fff; letter-spacing: 2px; text-shadow: 0 0 8px rgba(255, 255, 255, .6); }

/* touch controls: virtual stick on the left, buttons on the right (phones and tablets only) */
.sr-pad { display: none; width: min(100%, 400px); align-items: center; justify-content: space-between; gap: 12px; touch-action: none; user-select: none; -webkit-user-select: none; }
.sr-stick {
  position: relative; width: 116px; height: 116px; flex: none; border-radius: 50%; touch-action: none;
  background: radial-gradient(circle, rgba(199, 125, 255, .14) 0 38%, rgba(199, 125, 255, .05) 39% 100%);
  box-shadow: inset 0 0 0 2px rgba(199, 125, 255, .55), 0 0 18px rgba(199, 125, 255, .2);
}
.sr-stick.thrust { box-shadow: inset 0 0 0 2px #ff8a3d, 0 0 22px rgba(255, 138, 61, .45); }
.sr-knob {
  position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 35% 35%, #fff, #c77dff 55%, #6a2ab0); box-shadow: 0 0 14px rgba(199, 125, 255, .7);
}
.sr-btns { display: grid; grid-template-columns: 54px 84px; grid-template-rows: 50px 50px; gap: 8px 10px; align-items: center; }
.sr-key {
  display: grid; place-items: center; border: 0; border-radius: 14px; cursor: pointer; color: #dcb8ff; height: 50px;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px rgba(199, 125, 255, .5), 0 4px 0 rgba(0, 0, 0, .35);
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.sr-key svg { width: 24px; height: 24px; fill: currentColor; }
.sr-key.down { background: #2a1446; transform: translateY(2px); box-shadow: inset 0 0 0 1px #c77dff, 0 2px 0 rgba(0, 0, 0, .35); }
.sr-key-hyper { grid-area: 1 / 1; }
.sr-key-pause { grid-area: 2 / 1; color: var(--ink); }
.sr-key-pause svg { width: 20px; height: 20px; }
.sr-key-fire {
  grid-area: 1 / 2 / 3 / 3; height: 84px; width: 84px; border-radius: 50%; color: #ff8ae6;
  box-shadow: inset 0 0 0 2px rgba(255, 106, 213, .65), 0 0 18px rgba(255, 106, 213, .25), 0 4px 0 rgba(0, 0, 0, .35);
}
.sr-key-fire svg { width: 34px; height: 34px; }
@media (pointer: coarse) {
  .sr-pad { display: flex; }
  .board-spacerocks { gap: 10px; }
  .sr-canvas { width: min(calc(100vw - 60px), 560px, calc(100vh - 360px)); }
}

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