:root {
  color-scheme: dark;
  background: #03070b;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  --touch-control-space: 0px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  overscroll-behavior: none;
  touch-action: none;
}

body {
  min-height: 100dvh;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 110%, rgba(39, 71, 65, 0.5), transparent 36%),
    linear-gradient(180deg, #08111e 0%, #020507 100%);
}

.game-shell {
  position: relative;
  width: min(100vw, calc((100svh - var(--touch-control-space)) * 1.7778), 1280px);
  width: min(100vw, calc((100dvh - var(--touch-control-space)) * 1.7778), 1280px);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid #203948;
  box-shadow: 0 18px 80px rgba(0, 0, 0, 0.7);
  background: #03070b;
}

#game {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: crosshair;
  touch-action: none;
}

.player-name-input {
  position: absolute;
  z-index: 4;
  top: 33.85%;
  left: 58.1%;
  display: none;
  width: 19.8%;
  height: 5.15%;
  min-width: 0;
  padding: 0 1.15%;
  color: #fff2b7;
  text-transform: uppercase;
  background: transparent;
  border: 0;
  outline: 0;
  caret-color: #fff2b7;
  font: 800 clamp(0.78rem, 1.65vw, 1.75rem) "Courier New", monospace;
  letter-spacing: 0.01em;
}

.game-shell.is-title .player-name-input {
  display: block;
}

.game-shell.is-demo .player-name-input {
  display: none;
}

.touch-controls {
  display: none;
  width: min(100vw, calc((100svh - var(--touch-control-space)) * 1.7778), 1280px);
  width: min(100vw, calc((100dvh - var(--touch-control-space)) * 1.7778), 1280px);
  justify-content: space-between;
  gap: 18px;
  padding: 8px max(14px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  pointer-events: none;
}

.touch-left,
.touch-right {
  display: flex;
  gap: 8px;
}

.touch-controls button {
  pointer-events: auto;
  width: clamp(38px, 10.5vw, 48px);
  height: clamp(38px, 10.5vw, 48px);
  border: 2px solid rgba(194, 218, 218, 0.34);
  background: rgba(8, 18, 25, 0.62);
  color: #e8f0df;
  font-size: clamp(18px, 5vw, 22px);
  font-weight: 800;
  line-height: 1;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.3);
  touch-action: none;
}

.touch-controls button:active {
  transform: translateY(2px);
  background: rgba(36, 61, 61, 0.78);
}

@media (hover: none), (pointer: coarse), (max-width: 900px) {
  :root {
    --touch-control-space: clamp(54px, 15svh, 72px);
    --touch-control-space: clamp(54px, 15dvh, 72px);
  }

  .touch-controls {
    display: flex;
  }
}
