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

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

body {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 12%, #0b3855 0%, #051a2b 45%, #01070d 100%);
}

#stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 20px 60px rgba(0, 40, 70, 0.8));
}

canvas {
  display: block;
  border-radius: 6px;
  cursor: default;
  touch-action: none;
}

body.online-page #stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: none;
}

body.online-page canvas {
  border-radius: 0;
}

body.online-page {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  margin: 0;
}

#fsToggle {
  display: none;
  position: fixed;
  top: max(6px, env(safe-area-inset-top));
  left: max(0px, env(safe-area-inset-left));
  z-index: 70;
  width: 120px;
  min-height: 40px;
  padding: 0 10px;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  border: 1px solid rgba(126, 240, 255, 0.42);
  border-left: 0;
  border-radius: 0 999px 999px 0;
  background: rgba(4, 25, 39, 0.72);
  box-shadow: 0 4px 20px rgba(0, 8, 16, 0.38);
  color: rgba(220, 250, 255, 0.9);
  font: 700 13px/1 "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  touch-action: manipulation;
  transform: translateX(calc(-100% + 30px));
  transition: transform 0.22s ease, background 0.2s ease, opacity 0.2s ease;
  opacity: 0.72;
}

#fsToggle.is-open {
  transform: translateX(0);
  opacity: 1;
}

.fs-label {
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  white-space: nowrap;
  transition: max-width 0.2s ease, opacity 0.16s ease;
}

#fsToggle.is-open .fs-label {
  max-width: 90px;
  opacity: 1;
}

.fs-glyph {
  flex: none;
  width: 18px;
  font-size: 17px;
  line-height: 1;
  text-align: center;
}

#fsToggle.is-active {
  border-color: rgba(126, 240, 255, 0.72);
  background: rgba(16, 68, 92, 0.86);
  color: #ffffff;
}

@media (pointer: coarse), (max-height: 600px) {
  body.online-page #fsToggle {
    display: flex;
  }
}

#rotateHint {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 90;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 24px;
  text-align: center;
  color: #eafcff;
  background:
    radial-gradient(circle at 50% 36%, rgba(17, 78, 108, 0.98), rgba(2, 15, 27, 0.99) 72%);
}

.rotate-mark {
  width: 74px;
  height: 74px;
  margin-bottom: 8px;
  border: 2px solid rgba(126, 240, 255, 0.55);
  border-radius: 50%;
  color: #8feaff;
  font-size: 51px;
  line-height: 70px;
  box-shadow: 0 0 30px rgba(59, 202, 235, 0.2), inset 0 0 24px rgba(59, 202, 235, 0.12);
}

.rotate-title {
  font-size: 25px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.rotate-sub {
  max-width: 280px;
  color: rgba(185, 231, 247, 0.72);
  font-size: 14px;
  line-height: 1.7;
}

#rotateDismiss {
  margin-top: 15px;
  padding: 10px 20px;
  border: 1px solid rgba(126, 240, 255, 0.42);
  border-radius: 999px;
  background: rgba(8, 38, 56, 0.78);
  color: #c9f7ff;
  font: 600 13px/1.2 "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

@media (orientation: portrait) and (max-width: 900px) {
  body.online-page #rotateHint {
    display: flex;
  }

  body.online-page.rotate-dismissed #rotateHint {
    display: none;
  }
}

#errbox {
  display: none;
  position: fixed;
  left: 8px;
  bottom: 8px;
  right: 8px;
  max-height: 40%;
  overflow: auto;
  padding: 10px 14px;
  background: rgba(120, 10, 30, 0.92);
  border: 1px solid #ff7a90;
  border-radius: 8px;
  color: #ffe1e6;
  font: 12px/1.5 ui-monospace, Consolas, monospace;
  white-space: pre-wrap;
  z-index: 99;
}
