:root {
  color-scheme: dark;
  background: #090c17;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  touch-action: none;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #090c17;
}

body {
  display: grid;
  place-items: center;
  -webkit-user-select: none;
  user-select: none;
}

#stage {
  position: relative;
  width: min(100vw, 62.5vh);
  width: min(100vw, 62.5dvh);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #101525;
  box-shadow: 0 0 48px #0008;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  background: #101525;
  image-rendering: pixelated;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.demo-badge {
  position: absolute;
  z-index: 2;
  top: max(10px, env(safe-area-inset-top));
  right: 10px;
  padding: 5px 9px;
  border: 1px solid #f4c44e66;
  border-radius: 999px;
  background: #111827bb;
  color: #f5d77a;
  font-size: 11px;
  letter-spacing: .04em;
  pointer-events: none;
  backdrop-filter: blur(8px);
}

#toast {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  max-width: calc(100% - 36px);
  padding: 9px 14px;
  border: 1px solid #ffffff1a;
  border-radius: 9px;
  background: #111827ed;
  color: #f8fafc;
  font-size: 13px;
  text-align: center;
  opacity: 0;
  transition: opacity .16s ease, transform .16s ease;
  pointer-events: none;
}

#toast.visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

#boot-error {
  position: absolute;
  z-index: 5;
  inset: auto 16px 18px;
  padding: 12px 14px;
  border: 1px solid #ef444466;
  border-radius: 10px;
  background: #3b1118f2;
  color: #fee2e2;
  font-size: 13px;
  text-align: center;
}

@media (orientation: landscape) and (max-height: 520px) {
  #stage { width: min(100vw, 62.5vh); width: min(100vw, 62.5dvh); }
  .demo-badge { top: 6px; right: 6px; font-size: 10px; }
}
