.bgm-cards {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  will-change: transform;
}
.bgm-card {
  position: absolute;
  width: 74px;
  aspect-ratio: 5 / 7;
  border: 1.5px solid rgba(46, 218, 179, 0.22);
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 38%, rgba(160, 232, 96, 0.16) 0 14px, transparent 15px),
    rgba(46, 218, 179, 0.04);
  opacity: 0.8;
  animation: bgm-drift 22s ease-in-out infinite alternate;
}
.bgm-card::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(160, 232, 96, 0.35);
}
.bgm-card-1 { left: 6%;  top: 18%; --r: -14deg; animation-duration: 24s; }
.bgm-card-2 { left: 88%; top: 12%; --r: 11deg;  animation-duration: 28s; animation-delay: -6s;  width: 62px; }
.bgm-card-3 { left: 3%;  top: 62%; --r: 8deg;   animation-duration: 26s; animation-delay: -11s; width: 86px; }
.bgm-card-4 { left: 92%; top: 56%; --r: -9deg;  animation-duration: 30s; animation-delay: -3s; }
.bgm-card-5 { left: 14%; top: 88%; --r: 16deg;  animation-duration: 23s; animation-delay: -15s; width: 58px; }
.bgm-card-6 { left: 80%; top: 86%; --r: -17deg; animation-duration: 27s; animation-delay: -9s; width: 80px; }
@keyframes bgm-drift {
  from { transform: translate3d(0, 0, 0) rotate(var(--r, 0deg)); }
  to   { transform: translate3d(14px, -34px, 0) rotate(calc(var(--r, 0deg) + 9deg)); }
}

.sgd-js .sgd-stop.is-right .sgd-text { transform: translate(-26px, 14px) rotate(-1.2deg); }
.sgd-js .sgd-stop.is-left  .sgd-text { transform: translate(26px, 14px) rotate(1.2deg); }
.sgd-js .sgd-stop.is-in .sgd-text {
  transform: none;
  transition: opacity 0.6s ease, transform 0.7s cubic-bezier(0.2, 0.75, 0.25, 1);
}

.sgd-stop.is-reached .sgd-node { animation: bgm-reach 1s ease-out 1; }
@keyframes bgm-reach {
  0%   { box-shadow: 0 0 0 7px #e3efe8, 0 0 0 7px rgba(46, 218, 179, 0.55); }
  100% { box-shadow: 0 0 0 7px #e3efe8, 0 0 0 30px rgba(46, 218, 179, 0); }
}
body.bg-nexus .sgd-stop.is-reached .sgd-node { animation-name: bgm-reach-dark; }
@keyframes bgm-reach-dark {
  0%   { box-shadow: 0 0 0 7px rgba(46, 218, 179, 0.18), 0 0 0 7px rgba(160, 232, 96, 0.6); }
  100% { box-shadow: 0 0 0 7px rgba(46, 218, 179, 0.18), 0 0 0 30px rgba(160, 232, 96, 0); }
}

.sgd-stop.is-right:hover .sgd-node,
.sgd-stop.is-left:hover .sgd-node {
  transform: translate(-50%, -50%) perspective(420px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) scale(1.12);
}

.bg-handoff { position: relative; }
.bg-handoff::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 38%;
  width: min(520px, 90%);
  aspect-ratio: 2 / 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(46, 218, 179, 0.16), transparent);
  pointer-events: none;
  animation: bgm-glow 5s ease-in-out infinite alternate;
}
.bg-handoff > * { position: relative; }
.bg-handoff-cue { animation: bgm-bob 1.6s ease-in-out infinite; }
@keyframes bgm-glow { from { opacity: 0.45; } to { opacity: 1; } }
@keyframes bgm-bob  { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(9px); } }

.board-game-page button.large,
.board-game-page #startBtn {
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.board-game-page button.large:hover:not(:disabled),
.board-game-page #startBtn:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.3), 0 0 18px rgba(160, 232, 96, 0.25);
  filter: brightness(1.06);
}
.board-game-page button.large:active:not(:disabled),
.board-game-page #startBtn:active:not(:disabled) { transform: translateY(-1px) scale(0.99); }

@media (prefers-reduced-motion: reduce) {
  .bgm-card, .bg-handoff::before, .bg-handoff-cue,
  .sgd-stop.is-reached .sgd-node { animation: none; }
  .sgd-js .sgd-stop.is-right .sgd-text,
  .sgd-js .sgd-stop.is-left .sgd-text { transform: translateY(14px); }
  .board-game-page button.large, .board-game-page #startBtn { transition: none; }
  .board-game-page button.large:hover:not(:disabled),
  .board-game-page #startBtn:hover:not(:disabled) { transform: none; }
}
@media print { .bgm-cards { display: none; } }

.bg-online-wrap { position: relative; display: block; }
.bg-online-wrap > button { width: 100%; }
.bg-online-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translate(-50%, 4px);
  width: max-content;
  max-width: min(320px, 90vw);
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  background: #0e242e;
  border: 1px solid #49c5b6;
  color: #dbe9ee;
  font-size: 0.85rem;
  line-height: 1.45;
  text-align: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 5;
}
.bg-online-tip:empty { display: none; }
.bg-online-tip.is-on { opacity: 1; transform: translate(-50%, 0); }

.bg-handoff.bg-physical { max-width: 60rem; margin-bottom: 4rem; }
.bg-physical .bg-handoff-lead a { color: var(--nx-lime, #a0e860); text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.bg-physical-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.bg-physical-grid img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--nx-line, #24596b);
}
@media (max-width: 575.98px) {
  .bg-physical-grid { grid-template-columns: 1fr; }
}
