.move-mode-moved {
  translate: var(--move-x, 0) var(--move-y, 0);
  transition: translate 80ms ease-out;
}

.move-mode-selected {
  z-index: 9980 !important;
  border-radius: 0.35rem;
  outline: 3px solid #7c3aed !important;
  outline-offset: 4px;
  box-shadow: 0 0 0 8px rgba(124, 58, 237, 0.14);
}

html.move-mode-active body,
html.move-mode-active body *:not(.move-mode-controls):not(.move-mode-controls *) {
  cursor: crosshair !important;
}

.move-mode-controls {
  position: fixed;
  z-index: 10020;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  width: min(17rem, calc(100vw - 2rem));
  padding: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 1rem;
  background: rgba(21, 18, 30, 0.92);
  color: #fff;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.3);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  animation: move-mode-arrive 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.move-mode-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.move-mode-topline strong {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.move-mode-apply {
  padding: 0.38rem 0.62rem;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #16121f;
  font: 750 0.72rem/1 system-ui, sans-serif;
  cursor: pointer;
}

.move-mode-status {
  min-height: 2.4em;
  margin: 0.65rem 0 0.75rem;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.76rem;
  line-height: 1.35;
}

.move-mode-joystick {
  display: grid;
  grid-template-columns: repeat(3, 2.6rem);
  grid-template-rows: repeat(3, 2.6rem);
  justify-content: center;
  gap: 0.28rem;
  touch-action: none;
  user-select: none;
}

.move-mode-joystick button {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0.72rem;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font: 800 0.85rem/1 system-ui, sans-serif;
  cursor: pointer;
}

.move-mode-joystick button:hover,
.move-mode-joystick button:focus-visible {
  border-color: rgba(255, 255, 255, 0.56);
  background: rgba(255, 255, 255, 0.2);
  outline: none;
}

.move-mode-joystick button:active {
  transform: scale(0.92);
}

.move-mode-up { grid-area: 1 / 2; }
.move-mode-left { grid-area: 2 / 1; }
.move-mode-reset { grid-area: 2 / 2; color: #a78bfa !important; }
.move-mode-right { grid-area: 2 / 3; }
.move-mode-down { grid-area: 3 / 2; }

.move-mode-tip {
  display: block;
  margin-top: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.65rem;
  text-align: center;
}

.move-mode-exit {
  position: relative;
  margin-top: 0.7rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 0.65rem;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.7rem;
  font-weight: 650;
  text-align: center;
}

.move-mode-exit-progress {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #7c3aed, #ec4899);
  transform: scaleX(0);
  transform-origin: left;
}

.move-mode-exit-label {
  position: relative;
  z-index: 1;
  display: block;
  padding: 0.62rem 0.75rem;
}

.move-mode-controls.is-restoring .move-mode-exit-progress {
  animation: move-mode-restore 900ms linear forwards;
}

@keyframes move-mode-arrive {
  from { opacity: 0; transform: translateY(0.75rem) scale(0.96); }
}

@keyframes move-mode-restore {
  to { transform: scaleX(1); }
}

@media (prefers-reduced-motion: reduce) {
  .move-mode-controls { animation: none; }
  .move-mode-moved { transition: none; }
  .move-mode-controls.is-restoring .move-mode-exit-progress {
    animation: none;
    transform: scaleX(1);
    transition: transform 900ms linear;
  }
}
