.rujing-page {
  contain: strict;
  isolation: isolate;
  overflow: hidden;
  background: #01040a;
}

.rujing-starfield,
.rujing-whiteout {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.rujing-starfield {
  z-index: 0;
  display: block;
  background: #01040a;
}

.rujing-whiteout {
  z-index: 2;
  inset: -12%;
  width: 124%;
  height: 124%;
  opacity: 0;
  visibility: hidden;
  background:
    radial-gradient(
      ellipse at 50% 50%,
      #fff 0 20%,
      rgba(246, 251, 255, 0.995) 42%,
      rgba(230, 242, 252, 0.97) 68%,
      rgba(255, 255, 255, 1) 100%
    );
  filter: blur(3px);
  transform: scale(0.2);
  transform-origin: 50% 50%;
  will-change: opacity, transform;
}

body:has(.rujing-page.is-visible) .global-restart-control,
body:has(.rujing-page.is-visible) .copyright-mark {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body:has(.rujing-page.is-visible:not(.is-debugging)) .custom-fuchen-cursor,
body:has(.rujing-page.is-visible:not(.is-debugging)) .cursor-particle-canvas,
body:has(.rujing-page.is-visible:not(.is-debugging)) .cursor-debug-panel {
  opacity: 0 !important;
  visibility: hidden !important;
}

.rujing-debug-panel {
  position: absolute;
  z-index: 12;
  top: 24px;
  right: 24px;
  width: 310px;
  max-height: calc(100% - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  padding: 18px 18px 16px;
  border: 1px solid rgba(161, 191, 209, 0.22);
  color: rgba(224, 235, 240, 0.86);
  background: rgba(2, 9, 16, 0.86);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(14px);
  font: 12px/1.4 "Noto Serif SC", "Source Han Serif SC", "Songti SC", STSong, serif;
  pointer-events: auto;
}

.rujing-debug-panel[hidden] {
  display: none;
}

.rujing-debug-panel h2 {
  margin: 0 0 13px;
  color: rgba(219, 188, 128, 0.9);
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.18em;
}

.rujing-debug-panel__status {
  margin: -5px 0 13px;
  color: rgba(143, 205, 230, 0.76);
  font-size: 11px;
  line-height: 1.55;
  letter-spacing: 0.08em;
}

.rujing-debug-panel__controls {
  display: grid;
  gap: 9px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 5px;
  scrollbar-width: thin;
  scrollbar-color: rgba(106, 176, 206, 0.4) transparent;
}

.rujing-debug-panel label {
  display: grid;
  grid-template-columns: 1fr 64px;
  gap: 4px 10px;
  align-items: center;
}

.rujing-debug-panel label span {
  letter-spacing: 0.08em;
}

.rujing-debug-panel output {
  color: rgba(232, 201, 139, 0.9);
  text-align: right;
}

.rujing-debug-panel input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  margin: 0;
  accent-color: #6daccb;
}

.rujing-debug-panel label.is-toggle {
  grid-template-columns: 1fr auto auto;
}

.rujing-debug-panel label.is-toggle input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: #6daccb;
}

.rujing-debug-panel__actions {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.rujing-debug-panel button {
  width: 100%;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid rgba(204, 168, 102, 0.34);
  color: rgba(225, 198, 146, 0.9);
  background: rgba(10, 20, 29, 0.76);
  font: inherit;
  letter-spacing: 0.18em;
  cursor: pointer;
}

.rujing-debug-panel button.is-primary {
  border-color: rgba(105, 180, 211, 0.56);
  color: rgba(173, 225, 242, 0.96);
  background: rgba(20, 54, 70, 0.72);
}

.rujing-debug-panel button:hover,
.rujing-debug-panel button:focus-visible {
  border-color: rgba(131, 199, 224, 0.72);
  color: rgba(220, 240, 247, 0.98);
  outline: none;
}

@media (pointer: coarse), (hover: none) {
  .rujing-debug-panel {
    width: 270px;
    transform: scale(0.78);
    transform-origin: top right;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rujing-whiteout {
    filter: none;
  }
}
