:root {
  font-family: Inter, "Microsoft YaHei", sans-serif;
  color: #253449;
  background: #eaece9;
  font-size: 13px;
  --line: #dce1df;
  --muted: #77827f;
  --ink: #203b39;
  --accent: #266b5d;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: inherit;
  padding: 7px 11px;
  cursor: pointer;
}
button:hover {
  background: #eef5f1;
  border-color: #aabeb4;
}
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid #4b9880;
  outline-offset: 2px;
}
.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.primary:hover {
  background: #20594e;
}
input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: inherit;
  padding: 7px;
  min-width: 0;
}
header {
  flex-shrink: 0;
  background: #172e2c;
  color: #eaf0e9;
}
.header-main {
  min-height: 76px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 14px 23px;
  gap: 14px 24px;
}
.configuration-controls {
  position: relative;
  display: flex;
  gap: 8px;
  max-width: 100%;
}
#configuration {
  width: 350px;
  max-width: 100%;
  background: #f5f6ec;
  color: #203b39;
  border-color: #a6b8a7;
  font-weight: 600;
}
.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}
.header-actions button,
#check-results {
  background: #29413c;
  border-color: #486057;
  color: #eaf0e9;
}
.header-actions .primary {
  background: #ecd18b;
  color: #24342d;
  border-color: #ecd18b;
}
#reset-configuration {
  border-color: #a99266;
  color: #f3d698;
}
.issues-control {
  flex-shrink: 0;
}
#check-results {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 100%;
  min-width: 60px;
}
#check-results[data-state="issues"] {
  color: #ffb5a5;
  border-color: #b67768;
}
#check-results[data-state="clear"] {
  color: #b5d8bd;
}
#issue-count {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
#issues {
  position: absolute;
  z-index: 20;
  top: calc(100% + 10px);
  left: 0;
  width: 480px;
  max-width: calc(100vw - 32px);
  padding: 16px;
  border: 1px solid #ccd8cf;
  border-radius: 9px;
  background: #fdfdf9;
  color: var(--ink);
  box-shadow: 0 12px 40px #172e2c33;
}
.issues-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
#issues-title {
  margin: 0;
  font-size: 14px;
}
#close-issues {
  padding: 0 5px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}
.issues-hint {
  margin: 10px 0 14px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}
#issue-list {
  max-height: min(55vh, 480px);
  overflow: auto;
}
.issue-group + .issue-group {
  margin-top: 8px;
  border-top: 1px solid var(--line);
}
.issue-group > summary {
  padding: 10px 0;
  color: var(--ink);
  font-size: 12px;
  overflow-wrap: anywhere;
}
#issues .issue {
  display: block;
  width: 100%;
  margin-bottom: 6px;
  padding: 10px;
  text-align: left;
  font-size: 11px;
  line-height: 1.6;
  border-color: var(--line);
  background: #fff;
  color: #9c513a;
  overflow-wrap: anywhere;
}
#issues .issue:hover {
  background: #f3f5ef;
  border-color: #b6c8bb;
}
.issue strong,
.issue span {
  display: block;
}
.check-failure {
  padding: 10px;
  border: 1px solid #e2b6a8;
  border-radius: 5px;
  color: #9c513a;
  background: #fff3ed;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.workspace {
  display: grid;
  grid-template-columns: clamp(260px, var(--sidebar-width, 340px), calc(100% - 366px)) 6px minmax(360px, 1fr);
  flex: 1;
  min-height: 0;
}
aside {
  background: #f7f8f4;
  min-height: 0;
  overflow: auto;
}
#editor-sidebar {
  display: grid;
  grid-template-rows: minmax(0, 45fr) minmax(0, 55fr);
  min-width: 0;
  overflow: hidden;
}
#sidebar-resize {
  cursor: col-resize;
  touch-action: none;
  background: var(--line);
  outline: none;
}
#sidebar-resize:hover,
#sidebar-resize:focus-visible,
.resizing-sidebar #sidebar-resize {
  background: #4b9880;
}
.resizing-sidebar,
.resizing-sidebar * {
  cursor: col-resize !important;
  user-select: none;
}
.library {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  padding: 14px 14px 0;
}
.eyebrow {
  color: #8a9790;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.7px;
  margin-bottom: 14px;
}
h2 {
  font-size: 14px;
  margin: 0;
}
#search {
  width: 100%;
  flex-shrink: 0;
  margin-bottom: 12px;
}
#catalog {
  overflow: auto;
  min-height: 0;
  flex: 1;
  margin: 0 -7px;
  padding: 0 7px;
}
.entry {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border-color: transparent;
  border-radius: 4px;
  padding: 9px 7px;
  border-bottom: 1px solid #e7eae3;
}
.entry span {
  display: block;
  line-height: 1.4;
}
.entry small {
  display: block;
  margin-top: 5px;
  font-size: 10px;
  color: #8a948d;
  word-break: break-all;
}
.entry:hover {
  background: #e6eee5;
}
.xml-row {
  display: flex;
  align-items: center;
}
.xml-toggle,
.xml-leaf {
  flex: 0 0 20px;
  width: 20px;
}
.xml-toggle {
  border-color: transparent;
  background: transparent;
  padding: 4px 0;
  line-height: 18px;
  color: #4f6457;
}
.xml-entry {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  padding: 4px 5px;
  line-height: 18px;
  border-color: transparent;
  background: transparent;
  text-align: left;
}
.xml-entry span,
.xml-entry small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.xml-entry span {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  line-height: 1.5;
}
.xml-entry small {
  flex-shrink: 0;
  max-width: 55%;
  font-size: 10px;
  color: #8a948d;
}
.xml-entry[aria-current="true"] {
  background: #dfece4;
  border-color: #d1e1d6;
  color: #1f5c47;
}
.xml-children {
  margin-left: 10px;
  padding-left: 4px;
  border-left: 1px solid var(--line);
}
summary {
  padding: 10px 0;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: #4f6457;
}
.file-folder > summary {
  padding: 8px 5px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-folder > summary:hover {
  background: #e6eee5;
}
.file-folder > .file-tree {
  margin-left: 10px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}
.file-entry {
  padding: 7px 6px;
  border-bottom: 0;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-entry[aria-current="true"] {
  background: #dfece4;
  color: #1f5c47;
  font-weight: 600;
}
main {
  display: flex;
  flex-direction: column;
  overflow: auto;
  min-height: 0;
  min-width: 0;
}
.document-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px 13px;
  background: #fdfdf9;
  gap: 10px;
}
.document-bar h1 {
  font-size: 18px;
  margin: 0;
  font-weight: 650;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.spacer {
  flex: 1;
}
.stage {
  position: relative;
  background: #263a39;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.canvas-wrap {
  position: relative;
  height: clamp(240px, 50vh, 600px);
  width: 100%;
  overflow: hidden;
  background: repeating-conic-gradient(#344646 0 25%, #304242 0 50%) 0/18px 18px;
}
.stage > .canvas-wrap {
  flex: 1;
  min-width: 0;
  height: auto;
  min-height: 240px;
}
#outfit-panel {
  position: absolute;
  z-index: 1;
  top: 48px;
  bottom: 42px;
  left: 10px;
  width: 190px;
  max-width: 35%;
  background: #101314ee;
  color: #e0e4e3;
  border: 1px solid #ffffff1a;
  border-radius: 6px;
  box-shadow: 0 4px 16px #0004;
  overflow: hidden;
}
#outfit-panel h2 {
  margin: 0;
  padding: 14px 12px;
  font-size: 12px;
  color: inherit;
}
#outfit-slots {
  position: absolute;
  inset: 42px 8px 8px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: #5f6764 transparent;
}
.outfit-slot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 4px;
  border-bottom: 1px solid #ffffff12;
}
.outfit-slot-label {
  display: grid;
  gap: 4px;
  flex: 1;
  min-width: 0;
  font-size: 12px;
}
.outfit-slot-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.outfit-slot-name {
  color: #9fa9a5;
  font-size: 11px;
}
.remove-outfit {
  padding: 2px 6px;
  font-size: 16px;
  color: #bfc8c4;
  background: transparent;
  border-color: transparent;
}
.remove-outfit:hover {
  color: #fff;
  background: #ffffff18;
  border-color: #ffffff24;
}
canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}
.canvas-wrap canvas {
  position: absolute;
  inset: 0;
}
.canvas-wrap canvas + canvas {
  touch-action: none;
  user-select: none;
  outline: none;
}
.canvas-wrap:focus-within {
  outline: 1px solid #8ca398;
  outline-offset: -1px;
}
.canvas-info,
.canvas-help {
  position: absolute;
  left: 10px;
  max-width: calc(100% - 20px);
  padding: 4px 7px;
  border-radius: 3px;
  color: #dae3df;
  background: #172523df;
  font-size: 11px;
  line-height: 16px;
  pointer-events: none;
  user-select: none;
}
.canvas-info {
  top: 10px;
}
.canvas-info:empty {
  display: none;
}
.canvas-help {
  bottom: 10px;
  font-size: 10px;
  opacity: 0;
  transition: opacity 120ms;
}
.canvas-wrap:hover .canvas-help,
.canvas-wrap:focus-within .canvas-help {
  opacity: 1;
}
#loading {
  position: absolute;
  inset: 0;
  background: #263a39;
  display: grid;
  place-items: center;
  color: #becfc2;
}
#media {
  color: #b6c9be;
  text-align: center;
}
#media p {
  font-size: 12px;
}
#media:empty,
#file-media:empty {
  display: none;
}
audio {
  margin-top: 12px;
  max-width: 100%;
}
.view-controls,
.outfit-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: #f8f9f5;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}
.view-controls label,
.outfit-controls label {
  display: flex;
  align-items: center;
  gap: 6px;
}
#snap {
  width: 48px;
  padding: 4px;
}
.view-controls button {
  font-size: 11px;
  padding: 5px 8px;
}
.playback-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}
.playback-controls button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 30px;
  padding: 5px;
}
.playback-controls svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.playback-toggle .pause-icon,
.playback-toggle[data-playing="true"] .play-icon {
  display: none;
}
.playback-toggle[data-playing="true"] .pause-icon {
  display: initial;
}
.outfit-controls select {
  padding: 4px;
}
.view-option {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}
.view-option > span {
  flex-shrink: 0;
}
.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #e6ebe7;
}
.button-group button {
  padding: 5px 9px;
  border-color: transparent;
  border-radius: 4px;
  background: transparent;
  white-space: nowrap;
}
.button-group button:hover {
  background: #dce5de;
}
.button-group button[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
}
.outfit-controls input {
  accent-color: var(--accent);
}
#editing-help {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 22px;
  background: #f8f9f5;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  line-height: 18px;
  white-space: nowrap;
  color: #7e8d80;
}
#editing-help strong {
  flex-shrink: 0;
  color: #4c6255;
}
#editing-help span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
h3 {
  font-size: 12px;
  margin: 5px 0 12px;
  color: #4c6255;
}
.properties {
  border-top: 1px solid var(--line);
  min-height: 0;
  overflow: auto;
  padding: 16px;
}
#node-location {
  margin-bottom: 12px;
  overflow-x: auto;
  font-size: 11px;
  color: #66776b;
}
#node-location ol {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  white-space: nowrap;
}
#node-location li {
  display: flex;
  align-items: center;
  gap: 6px;
}
#node-location li + li::before {
  content: "›";
  color: #8b978e;
}
#node-location button,
#node-location span {
  padding: 2px 4px;
  border: 0;
  background: transparent;
}
#node-location button:hover {
  color: var(--accent);
  text-decoration: underline;
}
#node-location [aria-current] {
  color: #4c6255;
  font-weight: 600;
}
#inspector > label {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin-bottom: 9px;
  font-size: 11px;
  color: #66776b;
  overflow-wrap: anywhere;
}
#inspector input,
#inspector select {
  font-size: 12px;
  width: 100%;
  padding: 6px;
}
.input-with-unit {
  position: relative;
  min-width: 0;
}
#inspector .input-with-unit input {
  padding-right: 3em;
}
.input-unit {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
}
#inspector h3 {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.hint,
.empty {
  color: #8b978e;
  font-size: 11px;
  line-height: 1.8;
}
.reference {
  display: block;
  width: 100%;
  font-size: 10px;
  text-align: left;
  word-break: break-all;
  margin: 5px 0;
}
footer {
  height: 31px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 15px;
  font-size: 10px;
  background: #f5f7f1;
  border-top: 1px solid var(--line);
  color: #6c7a6e;
}
.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #58876a;
}
#status {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.footer-label {
  margin-left: auto;
  white-space: nowrap;
  color: #99a398;
}
dialog {
  border: 1px solid #ccd5c8;
  border-radius: 10px;
  padding: 25px;
  min-width: 360px;
  max-width: 90vw;
  box-shadow: 0 20px 80px #172e2c44;
}
dialog::backdrop {
  background: #102b2955;
}
dialog h2 {
  margin-bottom: 20px;
}
dialog label {
  display: grid;
  gap: 6px;
  margin: 12px 0;
}
dialog input {
  min-width: 300px;
}
.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}
#file-browser {
  width: 1180px;
  height: 85vh;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  min-width: 0;
  padding: 0;
  overflow: hidden;
  background: #fdfdf9;
  color: var(--ink);
}
#file-browser[open] {
  display: flex;
  flex-direction: column;
}
#file-browser [hidden] {
  display: none;
}
.file-browser-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
#file-browser h2,
#file-browser label {
  margin: 0;
}
#file-browser label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
#file-browser input {
  min-width: 0;
}
#file-search {
  flex: 1;
  width: 180px;
}
#close-files {
  margin-left: auto;
  font-size: 18px;
  padding: 3px 9px;
}
.file-browser-body {
  display: grid;
  grid-template-columns: minmax(200px, 28%) minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}
#file-catalog {
  border-right: 1px solid var(--line);
  padding: 12px;
}
.file-preview {
  overflow: auto;
  min-width: 0;
}
.file-preview-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}
#file-path {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  flex: 1;
}
.file-stage {
  background: #263a39;
  color: #b6c9be;
}
#file-media {
  overflow: auto;
  padding: 16px;
}
.file-text {
  margin: 0;
  max-height: 50vh;
  overflow: auto;
  white-space: pre;
  font:
    12px/1.6 Consolas,
    monospace;
  text-align: left;
}
#file-frame-controls input {
  width: 64px;
}
#file-references {
  padding: 16px;
}
@media (max-width: 1150px) {
  .header-main {
    gap: 15px;
    padding: 14px;
  }
}
@media (max-width: 650px) {
  body {
    height: auto;
    min-height: 100vh;
  }
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  #editor-sidebar {
    height: 70vh;
  }
  #sidebar-resize {
    display: none;
  }
  main {
    grid-column: 1/-1;
    min-height: 650px;
  }
  .footer-label {
    display: none;
  }
}
/* 保持预览区各部分的高度，画布不能覆盖标题和控件。 */
main > * {
  flex-shrink: 0;
}
.canvas-wrap {
  flex-shrink: 0;
}
