:root {
  --bg: #07261c;
  --shore: #2e7d32;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  /* respect the iPhone notch / home indicator */
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 3vh, 24px);
  height: 100%;
  width: 100%;
}

#game {
  display: block;
  background: #0a3d62;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  /* Scale to fit while keeping the 432:528 aspect ratio */
  width: min(92vw, calc((100vh - 220px) * 0.818));
  max-width: 432px;
  height: auto;
  touch-action: none;
}

/* ---------- On-screen controls ---------- */
#controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.dpad-mid {
  display: flex;
  gap: 8px;
}

.dpad {
  width: 64px;
  height: 64px;
  border: none;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: background 0.08s, transform 0.08s;
}

.dpad:active {
  background: rgba(255, 255, 255, 0.32);
  transform: scale(0.94);
}

#mute {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 10px);
  right: calc(env(safe-area-inset-right) + 10px);
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  font-size: 20px;
  line-height: 1;
}

/* Hide the on-screen D-pad on devices with a fine pointer (desktop) */
@media (hover: hover) and (pointer: fine) {
  #controls {
    opacity: 0.45;
  }
}
