:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #101315;
  color: #f7f3e8;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 10%, rgba(78, 138, 157, 0.28), transparent 36rem),
    linear-gradient(180deg, #172024, #0f1113 74%);
}

.game-shell {
  position: relative;
  width: min(100vw, 1280px);
  aspect-ratio: 16 / 9;
  max-height: 100vh;
  overflow: hidden;
  background: #141a1f;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
}

.hud {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  pointer-events: none;
}

.hud > div,
.hud button {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(16, 23, 24, 0.74);
  color: #fff8df;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(8px);
}

.hud > div {
  display: grid;
  align-content: center;
  gap: 1px;
  min-width: 84px;
  padding: 7px 9px;
}

.label {
  color: #d2e0d2;
  font-size: 10px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hud strong {
  font-size: 18px;
  line-height: 1;
}

.hud button {
  margin-left: auto;
  padding: 0 12px;
  border-radius: 6px;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  pointer-events: auto;
}

.hud button:hover {
  background: rgba(36, 55, 49, 0.88);
}

.help {
  position: absolute;
  left: 16px;
  bottom: 12px;
  margin: 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: 13px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.72);
  pointer-events: none;
}

.mobile-controls {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: none;
}

.mobile-controls button {
  width: min(62vw, 300px);
  height: 76px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: rgba(13, 20, 22, 0.82);
  color: #fffbe8;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.34);
  font: 850 18px/1 Inter, system-ui, sans-serif;
  touch-action: none;
}

@media (max-width: 760px) and (orientation: portrait), (pointer: coarse) and (orientation: portrait) {
  body {
    align-items: center;
  }

  .game-shell {
    width: min(100vw, calc(100vh * 9 / 16));
    height: min(100vh, calc(100vw * 16 / 9));
    aspect-ratio: 9 / 16;
    max-height: 100vh;
    border: 0;
  }

  .mobile-controls {
    display: block;
  }

  .help {
    display: none;
  }
}
