* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1a1a2e;
  font-family: "Segoe UI", system-ui, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  overscroll-behavior: none;
}

body { display: flex; align-items: center; justify-content: center; }

#game-wrap {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

canvas {
  display: block;
  background: #87ceeb;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  touch-action: none;
  max-width: 100%;
  max-height: 100%;
}

#hud {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  left: calc(16px + env(safe-area-inset-left));
  right: calc(16px + env(safe-area-inset-right));
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #fff;
  font-weight: 700;
  font-size: clamp(12px, 2.4vw, 19px);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #fff;
  text-align: center;
  background: rgba(10, 10, 30, 0.75);
  padding: 24px;
}

#overlay.hidden { display: none; }
#overlay h1 { font-size: clamp(24px, 6vw, 44px); letter-spacing: 2px; }
#overlay p { font-size: clamp(13px, 3vw, 17px); opacity: 0.9; }

#start-btn {
  margin-top: 10px;
  padding: 12px 36px;
  font-size: clamp(16px, 4vw, 20px);
  font-weight: 700;
  color: #fff;
  background: #e94560;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
}
#start-btn:active { transform: scale(0.96); }

#rotate-tip {
  position: absolute;
  bottom: calc(12px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  display: none;
  pointer-events: none;
}

@media (orientation: portrait) and (max-width: 900px) {
  #rotate-tip { display: block; }
}
