* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}
input,
textarea,
[contenteditable="true"] {
  user-select: text;
  -webkit-user-select: text;
}
img,
canvas {
  -webkit-user-drag: none;
}
body,
body * {
  cursor: inherit;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: #ffe6d2;
  font:
    11px SimSun,
    "Noto Serif CJK SC",
    serif;
}
button,
input {
  font: inherit;
  color: inherit;
  border-radius: 0;
}
#viewport {
  position: absolute;
  inset: 0 0 28px;
  overflow: hidden;
}
#stage {
  position: absolute;
  width: 640px;
  height: 480px;
  transform-origin: top left;
}
section,
form {
  margin: 0;
}
#startup-scene,
#selection-scene,
#world-scene,
#selection-frame {
  position: absolute;
  inset: 0;
  width: 640px;
  height: 480px;
  pointer-events: none;
}
[hidden] {
  display: none !important;
}
button {
  border: 0;
  padding: 0;
  background-color: transparent;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  text-shadow: 1px 1px #000;
}
button:disabled {
  opacity: 0.55;
}
button:focus-visible {
  outline: 1px solid #d7c291;
  outline-offset: 1px;
}
#login-art {
  position: absolute;
  left: 195px;
  top: 264px;
  width: 250px;
  height: 216px;
  pointer-events: none;
}
#login {
  transform: translateY(var(--login-slide, 0px));
}
#account-label,
#password-label {
  position: absolute;
  left: 227px;
  width: 65px;
  line-height: 16px;
}
#account-label {
  top: 314px;
}
#password-label {
  top: 336px;
}
input {
  position: absolute;
  left: 295px;
  width: 120px;
  height: 16px;
  border: 0;
  outline: none;
  padding: 0 2px;
  background: transparent;
  caret-color: #ffe6d2;
}
input:focus {
  box-shadow: inset 0 -1px #877b60;
}
#account {
  top: 314px;
}
#password {
  top: 336px;
}
#connect {
  position: absolute;
  left: 323.5px;
  top: 359px;
  width: 70px;
  height: 19px;
}
#login-exit {
  position: absolute;
  left: 285.5px;
  top: 444px;
  width: 70px;
  height: 20px;
}
.server-group {
  position: absolute;
  left: 285px;
  width: 70px;
  height: 16px;
  font-size: 10px;
  line-height: 14px;
  white-space: nowrap;
  overflow: hidden;
}
.server-channel {
  position: absolute;
  left: 365px;
  width: 134px;
  height: 20px;
  font-size: 10px;
  line-height: 12px;
  padding-bottom: 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.capacity {
  position: absolute;
  left: 18px;
  top: 14px;
  width: 100px;
  height: 3px;
  pointer-events: none;
}
.server-channel[aria-pressed="true"],
.server-group[aria-pressed="true"] {
  filter: brightness(1.25);
}
#character-list {
  position: absolute;
  left: 210px;
  top: 155px;
  width: 220px;
}
#stage:has(.projected-character) #character-list {
  left: 0;
  top: 0;
  width: 640px;
}
.character.projected-character {
  position: absolute;
  transform: translateX(-50%);
  width: max-content;
  max-width: 150px;
  min-height: 24px;
  margin: 0;
  padding: 0;
  line-height: 12px;
  color: #b4c8ff;
  font-weight: bold;
  font-size: 10px;
}
.character.projected-character small {
  font-size: 9px;
  color: #fff;
  font-weight: normal;
}
#stage[data-phase="characters"] #selection-scene {
  pointer-events: auto;
}
#stage[data-phase="selected"] #world-scene {
  pointer-events: auto;
}
.character {
  display: block;
  width: 220px;
  min-height: 48px;
  margin: 12px 0;
  padding: 5px;
  line-height: 18px;
}
.character[aria-pressed="true"] {
  color: #ffdc75;
  filter: brightness(1.25);
}
.character small {
  display: block;
  font-size: 11px;
}
#enter-world {
  position: absolute;
  left: calc(var(--selection-right, 640px) - 199px - var(--side-x, -200px));
  top: calc(var(--selection-side-y, 116px) + 32px);
  width: 70px;
  height: 19px;
}
.management-art {
  position: absolute;
  pointer-events: none;
}
#new-frame {
  left: 221px;
  top: calc(var(--selection-top, 0px) + var(--new-top, -100px));
  width: 199px;
  height: 109px;
}
#delete-frame {
  left: calc(var(--selection-left, 0px) + var(--side-x, -200px));
  top: var(--selection-side-y, 116px);
  width: 205px;
  height: 88px;
}
#ok-frame {
  left: calc(var(--selection-right, 640px) - 206px - var(--side-x, -200px));
  top: var(--selection-side-y, 116px);
  width: 205px;
  height: 88px;
}
#new-character {
  position: absolute;
  left: 286px;
  top: calc(var(--selection-top, 0px) + var(--new-top, -100px) + 75px);
  width: 70px;
  height: 25px;
}
#delete-character {
  position: absolute;
  left: calc(var(--selection-left, 0px) + var(--side-x, -200px) + 128px);
  top: calc(var(--selection-side-y, 116px) + 32px);
  width: 70px;
  height: 19px;
}
.management-modal {
  position: absolute;
  inset: 0;
  z-index: 5;
}
#creation {
  position: absolute;
  left: 214px;
  top: 11px;
  width: 213px;
  height: 375px;
}
#create-top {
  left: 0;
  top: 0;
  width: 213px;
  height: 256px;
}
#create-bottom {
  left: 0;
  top: 256px;
  width: 213px;
  height: 119px;
}
#creation-portrait {
  position: absolute;
  left: 71px;
  top: 90px;
  width: 74px;
  height: 79px;
  pointer-events: none;
}
#new-name {
  left: 71px;
  top: 180px;
  width: 73px;
  height: 16px;
}
#new-class {
  position: absolute;
  left: 71px;
  top: 200px;
  height: 16px;
  line-height: 16px;
  white-space: nowrap;
  width: 76px;
  overflow: hidden;
  font-size: 9px;
}
#class-left,
#class-right {
  position: absolute;
  top: 196px;
  width: 20px;
  height: 19px;
}
#class-left {
  left: 149px;
}
#class-right {
  left: 170px;
}
#create-cancel,
#create-ok {
  position: absolute;
  top: 349px;
  width: 72px;
  height: 21px;
}
#create-cancel {
  left: 21px;
}
#create-ok {
  left: 121.5px;
}
#management-dialog {
  position: absolute;
  left: 213px;
  top: 60px;
  width: 213px;
  height: 64px;
}
#dialog-art {
  position: absolute;
  inset: 0;
  width: 213px;
  height: 64px;
  pointer-events: none;
}
#dialog-text {
  position: absolute;
  left: 0;
  top: 8px;
  width: 213px;
  margin: 0;
  text-align: center;
  line-height: 12px;
  white-space: pre-line;
  font-size: 10px;
}
#personal-code {
  left: 30px;
  top: 38px;
  width: 76px;
  height: 16px;
}
#dialog-ok,
#dialog-cancel {
  position: absolute;
  top: 38px;
  width: 40px;
  height: 21px;
}
#dialog-ok {
  left: 110.5px;
}
#dialog-cancel {
  left: 160.5px;
}
#management-dialog:has(#personal-code[hidden]) #dialog-ok {
  left: 72px;
  width: 70px;
}
#message {
  position: absolute;
  left: 110px;
  top: 95px;
  width: 420px;
  text-align: center;
  white-space: pre-line;
  line-height: 18px;
}
#development-note {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 28px;
  text-align: center;
  line-height: 28px;
  color: #a79d8d;
  background: #141311;
  font: 12px/28px sans-serif;
}
/* Owner-requested credit strip uses physical CSS pixels, outside scene scaling. */
#startup-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28px;
  padding: 0 12px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  pointer-events: none;
  color: rgb(80% 70% 60%);
  background: #141311;
  font:
    clamp(11px, 1vw, 16px)/1.4 SimSun,
    "宋体",
    serif;
  white-space: nowrap;
}
#rebuild-version {
  justify-self: start;
}
#original-copyright {
  justify-self: center;
}
#startup-footer::after {
  content: "";
}

/* Primary51691c: disconnected dialog113 uses a70px original OK hit box. */
#management-modal[data-disconnect="true"] #management-dialog #dialog-ok {
  left: 71px;
  width: 70px;
}

/* Primary51f6f4..51f776: original256/128/256 tiles at X0/256/384,Y100. */
#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: #000;
}
#loading-screen[hidden] {
  display: none;
}
.loading-art {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(100vw, calc(100vh * 4 / 3));
  aspect-ratio: 4 / 3;
}
.loading-art img {
  position: absolute;
  top: 20.8333333333%;
  width: 40%;
  height: 53.3333333333%;
  image-rendering: pixelated;
}
.loading-art img:nth-child(1) {
  left: 0;
}
.loading-art img:nth-child(2) {
  left: 40%;
  width: 20%;
}
.loading-art img:nth-child(3) {
  left: 60%;
}
#loading-error {
  position: absolute;
  left: 5%;
  right: 5%;
  bottom: 8%;
  text-align: center;
  color: #ffe6d2;
}

/* Original Webzenlogo256x195; owner requests viewport centering/no upscale. */
#loading-screen {
  --startup-logo-width: min(256px, calc(100vw - 32px), calc(max(64px, 100vh - 200px) * 256 / 195));
}
.loading-logo {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: var(--startup-logo-width);
  aspect-ratio: 256 / 195;
}
.loading-logo img {
  display: block;
  width: 100%;
  height: auto;
}
.startup-progress {
  display: none;
  position: absolute;
  left: 50%;
  top: calc(50% + var(--startup-logo-width) * 195 / 512 + 16px);
  transform: translateX(-50%);
  width: min(360px, calc(100vw - 32px));
  text-align: center;
  color: #ddd;
  font:
    14px/1.5 Arial,
    sans-serif;
}
#loading-screen[data-stage="startup"] .startup-progress {
  display: block;
}
.startup-progress p {
  margin: 0 0 8px;
}
#startup-progress-label::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border: 2px solid #444;
  border-top-color: #bda36e;
  border-radius: 50%;
  animation: startup-spin 1s linear infinite;
}
@keyframes startup-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  #startup-progress-label::before {
    animation: none;
  }
}
.startup-progress progress {
  display: block;
  width: min(220px, 100%);
  height: 6px;
  margin: 0 auto 12px;
  accent-color: #bda36e;
}
.startup-progress small {
  display: block;
  color: #999;
  font-size: 12px;
}
#loading-screen[data-stage="startup"][data-error="true"] .startup-progress {
  display: none;
}
#loading-screen .loading-logo {
  display: none;
}
#loading-screen[data-stage="startup"] .loading-logo {
  display: block;
}
#loading-screen[data-stage="startup"] .loading-art {
  display: none;
}
/* Owner-requested diagnostics;physical CSS pixels outside the classic scene/UI. */
#performance-toggle {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 10000;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #ffffff70;
  background: #0009;
  color: white;
  font: bold 17px/1 sans-serif;
  cursor: pointer;
}
#performance-toggle[aria-expanded="true"] {
  background: #222e;
  border-color: white;
}
#performance-panel {
  position: fixed;
  top: 42px;
  right: 8px;
  z-index: 10000;
  width: min(288px, calc(100vw - 16px));
  max-height: calc(100vh - 50px);
  overflow: auto;
  padding: 8px;
  color: white;
  background: #000b;
  border: 1px solid #ffffff40;
  border-radius: 6px;
  font: 10px/1.35 monospace;
}
#performance-panel[hidden] {
  display: none;
}
#performance-panel pre {
  margin: 0 0 6px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  user-select: text;
  -webkit-user-select: text;
}
#performance-panel button {
  padding: 3px 8px;
  background: #333;
  color: white;
  border: 1px solid #888;
  border-radius: 3px;
  cursor: pointer;
}

#performance-panel label {
  display: block;
  font: inherit;
}
#performance-panel select {
  font: inherit;
  color: white;
  background: #222;
  max-width: 100%;
}
#performance-panel small {
  display: block;
  font-size: 10px;
  opacity: 0.8;
  margin-top: 3px;
}
