:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #07131f;
  color: #f8fbff;
  touch-action: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  min-height: 100svh;
  background: #07131f;
}

button {
  border: 0;
  color: #06101b;
  font: inherit;
  font-weight: 850;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

#game-shell {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100svh;
  overflow: hidden;
  background: #07131f;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.hud,
.top-actions,
.touch-controls,
.message {
  position: fixed;
  z-index: 3;
  user-select: none;
}

.hud {
  top: max(10px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  display: flex;
  gap: 8px;
  align-items: center;
}

.hud-item {
  min-width: 78px;
  padding: 7px 9px;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 8px;
  background: rgb(5 12 20 / 62%);
  box-shadow: 0 8px 24px rgb(0 0 0 / 22%);
  backdrop-filter: blur(12px);
}

.hud-item span {
  display: block;
  color: #b8d8e8;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hud-item strong {
  display: block;
  color: #fff46e;
  font-size: 19px;
  line-height: 1.05;
}

.top-actions {
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  display: flex;
  gap: 8px;
}

.top-actions button,
.message button,
.touch {
  border: 3px solid #122033;
  border-radius: 6px;
  background: #f4c84a;
  box-shadow: inset -4px -4px 0 rgb(88 67 18 / 26%), 0 6px 0 rgb(0 0 0 / 24%);
}

.top-actions button {
  width: 42px;
  height: 42px;
}

.message {
  inset: 0;
  display: grid;
  place-content: center;
  gap: 10px;
  padding: 18px;
  text-align: center;
  background: linear-gradient(rgb(0 11 28 / 32%), rgb(0 11 28 / 44%));
}

.message.hidden {
  pointer-events: none;
  opacity: 0;
}

.message h1 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(42px, 11vw, 92px);
  line-height: 0.88;
  letter-spacing: 0;
  text-shadow: 0 6px 0 #064ea4, 0 14px 30px rgb(0 0 0 / 38%);
}

.message p {
  margin: 0;
  color: #dbf7ff;
  font-size: clamp(15px, 3vw, 22px);
  font-weight: 750;
}

.message button {
  justify-self: center;
  min-width: 128px;
  min-height: 48px;
  margin-top: 10px;
  padding: 0 24px;
  font-size: 19px;
}

.touch-controls {
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  left: max(14px, env(safe-area-inset-left));
  display: flex;
  justify-content: space-between;
  align-items: end;
  pointer-events: none;
}

.pad {
  display: flex;
  gap: 10px;
  position: relative;
}

.pad .touch {
  background: #172235;
  color: #f8fafc;
  border-color: #0a101b;
  box-shadow: inset -4px -4px 0 rgb(0 0 0 / 32%), 0 6px 0 rgb(0 0 0 / 24%);
}

.pad::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20px;
  height: 20px;
  transform: translate(-50%, -50%);
  border-radius: 4px;
  background: #172235;
  border: 3px solid #0a101b;
  pointer-events: none;
}

.action-pad {
  display: grid;
  grid-template-columns: auto auto;
  gap: 10px;
  align-items: end;
}

.touch {
  width: clamp(62px, 17vw, 86px);
  height: clamp(58px, 15vw, 78px);
  pointer-events: auto;
  font-size: clamp(30px, 8vw, 44px);
  opacity: 0.9;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

.jump {
  width: clamp(78px, 21vw, 104px);
  height: clamp(78px, 21vw, 104px);
  border-radius: 50%;
  background: #26b9ef;
  color: white;
  text-shadow: 0 2px 0 rgb(0 44 91 / 55%);
}

.spin {
  width: clamp(58px, 15vw, 82px);
  height: clamp(58px, 15vw, 82px);
  border-radius: 50%;
  align-self: center;
  background: #f04f78;
  color: white;
  text-shadow: 0 2px 0 rgb(80 10 28 / 55%);
}

@media (pointer: fine) and (min-width: 900px) {
  .touch-controls {
    opacity: 0.25;
  }
}

@media (max-width: 720px) and (orientation: portrait) {
  .hud-item {
    min-width: 64px;
  }

  .hud-item strong {
    font-size: 16px;
  }

  .top-actions button {
    width: 38px;
    height: 38px;
  }
}
