body.game-mode-active {
  overflow: hidden;
  overscroll-behavior: none;
}

.game-frame > .touch-controls {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin: 0;
  padding: clamp(12px, 2.8vw, 30px);
  pointer-events: none;
}

.game-frame > .touch-controls > div {
  display: flex;
  gap: clamp(10px, 1.8vw, 20px);
}

.game-frame > .touch-controls button {
  width: clamp(52px, 8vw, 76px);
  height: clamp(52px, 8vw, 76px);
  min-width: 0;
  border: 2px solid rgba(255, 255, 255, .7);
  border-radius: 50%;
  padding: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(17, 27, 51, .78);
  box-shadow: 0 5px 14px rgba(4, 10, 24, .28), inset 0 1px 0 rgba(255, 255, 255, .2);
  font-size: clamp(22px, 3.6vw, 36px);
  font-weight: 900;
  line-height: 1;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  opacity: .82;
}

.game-frame > .touch-controls button.pressed,
.game-frame > .touch-controls button:active {
  opacity: 1;
  transform: scale(.93);
  background: rgba(239, 78, 66, .82);
}

.game-frame > .touch-controls .jump-control,
.game-frame > .touch-controls .attack-control {
  width: clamp(64px, 10vw, 92px);
  height: clamp(64px, 10vw, 92px);
  background: rgba(239, 78, 66, .64);
}

.game-frame > .touch-controls .attack-control {
  position: relative;
  overflow: hidden;
  background: conic-gradient(#9b62ff calc(var(--charge, 0) * 1turn), rgba(27, 19, 62, .76) 0);
  font-size: clamp(19px, 3vw, 30px);
}

.game-frame > .touch-controls .attack-control::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: rgba(28, 20, 55, .9);
}

.game-frame > .touch-controls .attack-control.charged {
  box-shadow: 0 0 22px rgba(183, 113, 255, .9), inset 0 1px 0 rgba(255,255,255,.3);
}

.game-frame > .touch-controls .jump-control span,
.game-frame > .touch-controls .attack-control span,
.game-frame > .touch-controls .jump-control small,
.game-frame > .touch-controls .attack-control small {
  position: relative;
  z-index: 1;
}

.game-frame > .touch-controls .jump-control small,
.game-frame > .touch-controls .attack-control small {
  display: block;
  margin-top: -8px;
  font-size: clamp(7px, 1.2vw, 11px);
  letter-spacing: .12em;
}

.game-cover:not([hidden]) ~ .touch-controls {
  opacity: 0;
  pointer-events: none;
}

.game-exit-mode {
  display: none;
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 7;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, .65);
  border-radius: 50%;
  padding: 0;
  color: #fff;
  background: rgba(17, 27, 51, .62);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
  font-size: 27px;
  line-height: 1;
  cursor: pointer;
}

.orientation-hint[hidden] {
  display: none;
}

.orientation-hint {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  color: #fff;
  background: rgba(7, 14, 31, .9);
  text-align: center;
}

.orientation-hint::before {
  content: "↻";
  font-size: 52px;
  line-height: 1;
}

.orientation-hint strong {
  font-size: clamp(20px, 4vw, 34px);
}

.orientation-hint span {
  color: rgba(255, 255, 255, .74);
  font-size: 13px;
}

.game-frame.game-expanded,
.game-frame:fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1200;
  width: 100vw;
  height: 100dvh;
  border: 0;
  border-radius: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #08101f;
  box-shadow: none;
}

.game-frame.game-expanded #jpGameCanvas,
.game-frame:fullscreen #jpGameCanvas {
  width: 100vw;
  height: auto;
  max-width: 100vw;
  max-height: 100dvh;
  aspect-ratio: 16 / 7;
  object-fit: contain;
}

.game-frame.game-expanded .game-exit-mode,
.game-frame:fullscreen .game-exit-mode {
  display: block;
}

.game-frame.game-expanded > .touch-controls,
.game-frame:fullscreen > .touch-controls {
  padding-left: max(clamp(16px, 3vw, 34px), env(safe-area-inset-left));
  padding-right: max(clamp(16px, 3vw, 34px), env(safe-area-inset-right));
  padding-bottom: max(clamp(14px, 3vw, 30px), env(safe-area-inset-bottom));
}

@media (max-width: 720px) {
  .game-frame > .touch-controls {
    display: flex;
  }
}
