*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #071512;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#game-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 30%, #12352f 0%, transparent 50%),
    linear-gradient(180deg, #0a221f 0%, #071512 55%, #05100e 100%);
}

#game-stage {
  position: relative;
  width: min(100vw, calc(100vh * var(--gw, 960) / var(--gh, 540)));
  height: min(100vh, calc(100vw * var(--gh, 540) / var(--gw, 960)));
  line-height: 0;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  background: #0a1a18;
  cursor: pointer;
}

.touch-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 14px 14px;
  pointer-events: none;
  z-index: 4;
}

.touch-controls[hidden] {
  display: none !important;
}

.touch-btn {
  pointer-events: auto;
  width: 68px;
  height: 68px;
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(8, 22, 20, 0.42);
  color: #f4f7f6;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.touch-btn svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.touch-btn:active {
  transform: scale(0.94);
  background: rgba(255, 255, 255, 0.16);
}

#btn-jump {
  color: #b8e8ff;
  border-color: rgba(143, 214, 255, 0.42);
}

#btn-duck {
  color: #ffd4a8;
  border-color: rgba(255, 190, 120, 0.4);
}

@media (pointer: fine) and (hover: hover) {
  body:not(.is-portrait) .touch-controls {
    display: none !important;
  }
}

body.is-portrait #game-stage {
  width: min(100vw, calc(100dvh * var(--gw, 540) / var(--gh, 960)));
  height: min(100dvh, calc(100vw * var(--gh, 960) / var(--gw, 540)));
}

body.is-portrait .touch-controls {
  display: flex !important;
  padding: 0 18px 20px;
}

body.is-portrait .touch-controls[hidden] {
  display: none !important;
}

body.is-portrait.is-playing .touch-controls {
  display: flex !important;
}

body.is-portrait .touch-btn {
  width: 72px;
  height: 72px;
}

@media (orientation: landscape) and (max-height: 520px) {
  .touch-controls {
    padding: 0 12px 10px;
  }

  .touch-btn {
    width: 54px;
    height: 54px;
  }

  .touch-btn svg {
    width: 22px;
    height: 22px;
  }
}
