html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0b0820;
  color: #fff;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}
#app, #app canvas { position: fixed; inset: 0; display: block; }
#topbar {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: 16px;
  display: flex;
  gap: 8px;
  z-index: 5;
}
.btn {
  font: 700 15px/1 inherit;
  font-family: inherit;
  color: #fff;
  background: rgba(30, 34, 90, 0.85);
  border: 2px solid rgba(160, 180, 255, 0.6);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.btn:hover { background: rgba(60, 70, 160, 0.9); }
.btn.primary { background: #e0306f; border-color: #ffb3cf; }
.btn.primary:hover { background: #ff4f8c; }
.btn:disabled { opacity: 0.5; cursor: default; }
#hint {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border-radius: 14px;
  background: rgba(12, 14, 46, 0.72);
  font-size: 16px;
  line-height: 1.5;
  text-align: center;
  white-space: pre-line;
  pointer-events: none;
  z-index: 4;
}
#hint:empty { display: none; }
#hint .first { color: #ffd23f; font-weight: 800; }
#loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  justify-content: center;
  background: #0b0820;
  z-index: 10;
  transition: opacity 0.4s;
}
#loading.done { opacity: 0; pointer-events: none; }
.spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 6px solid rgba(255, 255, 255, 0.15);
  border-top-color: #ff4fa3;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 520px) {
  .btn { padding: 8px 12px; font-size: 13px; }
  #hint { font-size: 13px; }
}
