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

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100svh;
  overflow: hidden;
  touch-action: none;
  background:
    radial-gradient(circle at 70% 20%, rgba(42, 202, 147, 0.18), transparent 26rem),
    radial-gradient(circle at 20% 80%, rgba(245, 199, 75, 0.12), transparent 24rem),
    #090a0e;
}

.shell {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.game-wrap {
  position: relative;
  width: min(100%, 1180px);
  aspect-ratio: 16 / 9;
  max-height: calc(100svh - 36px);
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #11131b;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.hud {
  position: absolute;
  inset: 16px 16px auto 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
  color: #fff8df;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85);
  font-size: 14px;
}

.hud strong,
.hud span {
  display: block;
}

.hud strong {
  font-size: 16px;
  letter-spacing: 0;
}

.hud span,
#hint {
  color: rgba(255, 248, 223, 0.78);
}

#hint {
  text-align: right;
}

#start {
  position: absolute;
  left: 50%;
  bottom: 36px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #0d0e12;
  background: #f5c74b;
  border-radius: 6px;
  font: inherit;
  font-weight: 800;
  padding: 12px 22px;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.38);
}

#start:hover {
  background: #ffe17c;
}

.playing #start {
  display: none;
}

.touch-controls {
  position: absolute;
  inset: auto 18px 18px 18px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
}

.pad {
  display: flex;
  gap: 12px;
}

.touch-controls button {
  width: 56px;
  height: 56px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(9, 10, 14, 0.58);
  color: #fff8df;
  font-size: 24px;
  font-weight: 900;
  pointer-events: auto;
  touch-action: none;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.34);
}

.touch-controls button:active,
.touch-controls button.active {
  background: #f5c74b;
  color: #090a0e;
  transform: translateY(1px);
}

@media (max-width: 720px) {
  body {
    overflow: auto;
  }

  .shell {
    min-height: 100svh;
    align-content: start;
    padding: 8px;
  }

  .game-wrap {
    width: 100%;
    max-height: none;
    margin-top: max(8px, env(safe-area-inset-top));
  }

  .hud {
    inset: 10px 10px auto 10px;
    flex-direction: column;
    font-size: 12px;
    gap: 4px;
  }

  #hint {
    text-align: left;
  }

  #start {
    bottom: 84px;
  }

  .touch-controls {
    inset: auto 12px 12px 12px;
  }

  .touch-controls button {
    width: 52px;
    height: 52px;
  }
}

@media (hover: hover) and (pointer: fine) {
  .touch-controls {
    opacity: 0.24;
    transition: opacity 160ms ease;
  }

  .touch-controls:hover {
    opacity: 1;
  }
}
