@font-face {
  font-family: "Command";
  src: url("assets/menu/fonts/Staatliches-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  color-scheme: dark;
  background: #020407;
  font-family: "Command", Impact, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 30%, #122436 0, #060b11 42%, #010204 100%);
}

body {
  display: grid;
  place-items: center;
}

#game-shell {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  aspect-ratio: 16 / 9;
  box-shadow: 0 0 0 2px #47535b, 0 24px 80px #000;
  background: #05080c;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: auto;
  cursor: crosshair;
  outline: none;
}

#loading {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 10px 18px;
  color: #e7d5ad;
  background: #07111be6;
  border: 2px solid #8a7755;
  letter-spacing: .08em;
  font-size: clamp(15px, 2vw, 24px);
  pointer-events: none;
}

#loading.hidden { display: none; }

.mobile-gate,
#mobile-controls {
  display: none;
}

html.touch-game,
html.touch-game body {
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

html.touch-game.browser-chrome-scroll,
html.touch-game.browser-chrome-scroll body {
  height: auto;
  min-height: calc(100vh + 180px);
  min-height: calc(100lvh + 180px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
}

html.touch-game.browser-chrome-scroll body {
  display: block;
  padding-bottom: 180px;
  scrollbar-width: none;
}

html.touch-game.browser-chrome-scroll body::-webkit-scrollbar {
  display: none;
}

html.touch-game.browser-chrome-scroll #game-shell {
  position: sticky;
  top: 0;
  margin: 0 auto;
}

html.touch-game.browser-chrome-scroll:not(.browser-chrome-ready),
html.touch-game.browser-chrome-scroll:not(.browser-chrome-ready) body,
html.touch-game.browser-chrome-scroll:not(.browser-chrome-ready) #game-shell,
html.touch-game.browser-chrome-scroll:not(.browser-chrome-ready) .chrome-helper {
  touch-action: pan-y;
}

html.touch-game.browser-chrome-scroll.browser-chrome-ready #game-shell {
  touch-action: none;
}

html.touch-game #game {
  cursor: default;
}

html.touch-game .mobile-gate {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding:
    max(18px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
  color: #d9edf7;
  background: #02070dd9;
  text-align: center;
}

#mobile-launch-button {
  min-width: min(72vw, 340px);
  padding: 18px 28px 15px;
  border: 3px solid #b7dcff99;
  border-radius: 12px;
  color: #eaf7ff;
  background: #15324a99;
  box-shadow: 0 0 28px #9ed9ff24, inset 0 0 16px #d9f2ff18;
  font: 700 clamp(22px, 6vw, 36px) "Command", Impact, sans-serif;
  letter-spacing: .06em;
  touch-action: manipulation;
}

#mobile-launch-button small,
#rotate-device small {
  display: block;
  margin-top: 7px;
  color: #b7d4e5;
  font: 700 clamp(11px, 2.5vw, 15px) "Trebuchet MS", Arial, sans-serif;
  letter-spacing: .1em;
}

#rotate-device {
  gap: 10px;
  align-content: center;
  font: 700 clamp(20px, 6vw, 34px) "Command", Impact, sans-serif;
  letter-spacing: .06em;
}

.chrome-helper {
  gap: 9px;
  align-content: center;
  font: 700 clamp(22px, 6vw, 36px) "Command", Impact, sans-serif;
  letter-spacing: .07em;
}

.swipe-up {
  position: relative;
  width: 82px;
  height: 126px;
  margin-bottom: 6px;
}

.swipe-up::before,
.swipe-up::after {
  content: "";
  position: absolute;
  left: 50%;
  border: solid #b7dcffb8;
  border-width: 0 6px 6px 0;
  padding: 15px;
  transform: translateX(-50%) rotate(-135deg);
}

.swipe-up::before { top: 4px; }
.swipe-up::after { top: 31px; opacity: .58; }

.swipe-up span {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 42px;
  height: 62px;
  border: 4px solid #b7dcff9c;
  border-radius: 22px 22px 10px 10px;
  transform: translateX(-50%);
  box-shadow: 0 0 20px #8ed7ff24;
}

.rotate-phone {
  width: 76px;
  height: 132px;
  margin-bottom: 12px;
  border: 5px solid #b7dcffbb;
  border-radius: 13px;
  box-shadow: 0 0 24px #8ed7ff33;
  animation: rotate-phone 1.8s ease-in-out infinite;
}

@keyframes rotate-phone {
  0%, 25% { transform: rotate(0); }
  70%, 100% { transform: rotate(90deg); }
}

html.touch-game #mobile-controls.mobile-controls-active {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: block;
  pointer-events: none;
}

.touch-control {
  position: absolute;
  display: block;
  width: clamp(58px, 10.8vw, 92px);
  aspect-ratio: 1;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  opacity: .68;
  pointer-events: auto;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  filter: drop-shadow(0 0 8px #8ed7ff1f);
}

.touch-control img {
  display: block;
  width: 70%;
  height: 70%;
  margin: 15%;
  pointer-events: none;
}

.touch-control.is-pressed {
  opacity: .95;
  transform: scale(.94);
  filter: drop-shadow(0 0 11px #bceaff70);
}

.jump-control {
  left: calc(max(10px, env(safe-area-inset-left)) + 3.2%);
  bottom: calc(max(10px, env(safe-area-inset-bottom)) + clamp(104px, 21vh, 148px));
}

.jump-control img { transform: rotate(-90deg); }

.fire-control {
  left: calc(max(8px, env(safe-area-inset-left)) + 1.8%);
  bottom: calc(max(5px, env(safe-area-inset-bottom)) + 1.4%);
  width: clamp(88px, 15.5vw, 132px);
  opacity: .54;
}

.left-control {
  right: calc(max(8px, env(safe-area-inset-right)) + clamp(86px, 13.5vw, 118px));
  bottom: calc(max(5px, env(safe-area-inset-bottom)) + 2.2%);
}

.left-control img { transform: rotate(180deg); }

.right-control {
  right: calc(max(8px, env(safe-area-inset-right)) + 1.6%);
  bottom: calc(max(5px, env(safe-area-inset-bottom)) + 2.2%);
}

.pause-control {
  top: calc(max(8px, env(safe-area-inset-top)) + 7.5%);
  right: calc(max(8px, env(safe-area-inset-right)) + 1.5%);
  width: clamp(44px, 7vw, 62px);
  opacity: .58;
}

@media (orientation: portrait) {
  html.touch-game #game-shell {
    width: 100vw;
    max-width: none;
  }
}

@media (max-aspect-ratio: 4 / 3) {
  #game-shell { width: 100vw; }
}
