:root {
  color-scheme: light;
  --ink: #172d26;
  --text: #23352d;
  --muted: #596960;
  --line: #d7ded7;
  --surface: #fff;
  --wash: #f2f5f0;
  --accent: #215941;
  --focus: #368963;
  font:
    15px/1.55 Inter,
    'PingFang SC',
    'Microsoft YaHei',
    system-ui,
    sans-serif;
  color: var(--text);
  background: #f6f7f3;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
select,
summary {
  cursor: pointer;
}
button,
select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
button {
  padding: 7px 13px;
  font-weight: 550;
}
button:not(:disabled):hover {
  background: var(--wash);
  border-color: #99afa0;
}
button:disabled {
  color: #89948c;
  cursor: default;
  background: #f5f6f3;
}
button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
button.primary:hover:not(:disabled) {
  background: #174733;
}
button.primary:disabled {
  background: #dee7df;
  border-color: #dee7df;
  color: #647268;
}
button:focus-visible,
select:focus-visible,
textarea:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
h3 {
  line-height: 1.35;
}
h1 {
  font-size: 21px;
}
h2 {
  font-size: 19px;
}
h3 {
  font-size: 16px;
}
small,
.muted {
  font-size: 13px;
  color: var(--muted);
}
label {
  font-weight: 600;
}
select,
input,
textarea {
  padding: 7px 10px;
}
textarea {
  resize: vertical;
}
header,
.brand,
nav,
.inline,
.heading,
.actions,
.compose-actions,
.history-row,
.footer,
.model-line,
.strip {
  display: flex;
  align-items: center;
  gap: 10px;
}
.heading,
.footer,
.compose-actions,
.history-row {
  justify-content: space-between;
}
.heading {
  gap: 12px;
}
.inline,
.brand {
  min-width: 0;
}
.brand h1 {
  overflow-wrap: anywhere;
}
.slash {
  color: #acb7ac;
}
header {
  justify-content: space-between;
  min-height: 66px;
  padding: 10px max(2.6vw, 18px);
  background: #fff;
  border-bottom: 1px solid var(--line);
}
nav {
  flex: none;
}
nav button,
#history,
.material .heading button,
.panel .heading > button {
  font-size: 13px;
}
#history {
  border-color: transparent;
  color: var(--muted);
  font-size: 16px;
}
main {
  max-width: 1550px;
  margin: 20px auto;
  padding: 0 max(2.6vw, 18px) 32px;
}
.sources > h2 {
  margin: 0 0 12px;
}
#slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
}
.material,
.panel,
.ghost-ref {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.material {
  padding: 14px 16px;
}
.material .heading button {
  padding: 3px 10px;
}
.strip {
  margin: 9px 0 5px;
  gap: 6px;
  min-height: 42px;
}
.thumb {
  position: relative;
  display: grid;
  place-items: center;
  width: 43px;
  height: 53px;
  border-radius: 5px;
  overflow: hidden;
  padding: 0;
  background: #f2f3ef;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.thumb span {
  position: absolute;
  inset: auto 0 0;
  background: #fffffff0;
  font-size: 9px;
  font-weight: 500;
  line-height: 1.2;
}
.thumb.blank {
  border: 1px dashed #a5b9aa;
  color: var(--accent);
  font-size: 24px;
  font-weight: 400;
}
.strip small {
  margin-left: 6px;
}
.desk {
  display: grid;
  grid-template-columns: minmax(235px, 28.7%) minmax(0, 1fr);
  gap: 16px;
  margin-top: 17px;
  align-items: start;
}
.panel {
  padding: 20px;
  min-width: 0;
}
aside.panel {
  min-height: 425px;
}
aside h3 {
  margin: 23px 0 10px;
}
.gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.placeholder {
  grid-column: 1/-1;
  text-align: center;
  background: #f4f6f2;
  border-radius: 7px;
  color: var(--muted);
  padding: 26px 8px;
  font-size: 13px;
}
.gallery-card {
  padding: 4px 4px 7px;
  text-align: left;
  min-width: 0;
}
.gallery-preview {
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  height: 84px;
  background: #f4f6f2;
  border-radius: 4px;
  overflow: hidden;
}
.gallery-preview img {
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.gallery-card strong,
.gallery-card > small {
  display: block;
  margin: 3px 5px 0;
}
.gallery-card strong {
  font-size: 14px;
}
.gallery-card > small {
  font-size: 11px;
}
.rule {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 19px;
}
.segments {
  display: flex;
  gap: 5px;
}
.segments button,
#original {
  padding: 5px 10px;
  font-size: 13px;
}
button[aria-pressed='true'] {
  color: var(--accent);
  border-color: var(--accent);
  background: #edf4ee;
}
.segments button[aria-pressed='true'] {
  background: var(--accent);
  color: white;
}
.pose {
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 6px 2px 8px;
  position: relative;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
}
.pose img {
  width: 58px;
  height: 64px;
}
.pose[aria-pressed='true']::after {
  content: '✓';
  position: absolute;
  top: 5px;
  right: 5px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 11px;
  width: 16px;
  line-height: 16px;
}
#pose-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 15px;
}
#ghost-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
  margin: 16px 0 22px;
}
.ghost-ref {
  padding: 12px;
  background: #f7f9f5;
}
.ghost-ref strong {
  font-size: 15px;
}
.views span {
  background: #eaf2eb;
  padding: 5px 15px;
  border-radius: 5px;
  color: var(--accent);
}
.model-line {
  margin: 17px 0;
  gap: 16px;
  font-size: 14px;
}
.footer {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.footer small {
  color: var(--accent);
}
#setup-status {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}
#setup-status:empty {
  display: none;
}
#viewer {
  background: #f1f3ed;
  min-height: 210px;
  height: clamp(225px, 33vh, 435px);
  display: flex;
  align-items: stretch;
  justify-content: center;
  border-radius: 8px;
  overflow: hidden;
}
.empty {
  align-self: center;
  text-align: center;
  color: var(--muted);
  padding: 20px;
}
.empty span {
  display: block;
  font-size: 26px;
  color: #9cac9e;
}
.empty strong {
  display: block;
  margin: 5px;
}
.empty small {
  display: block;
}
.photo {
  flex: 1;
  min-width: 0;
  position: relative;
  border: 0;
  border-radius: 0;
  padding: 4px;
  background: transparent;
}
.photo + .photo {
  border-left: 1px solid var(--line);
}
.photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.photo span {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 8px;
  background: #fffffff0;
  font-size: 12px;
  border-radius: 6px;
}
.history-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  min-height: 57px;
}
.history-row > button {
  flex: none;
  font-size: 13px;
}
#versions {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  align-items: center;
}
#versions button {
  font-size: 13px;
  padding: 4px 10px;
}
#versions button[aria-pressed='true'] {
  border-color: var(--accent);
  background: #eaf2eb;
  color: var(--accent);
}
.chat {
  padding-top: 16px;
}
.chat .heading {
  margin-bottom: 8px;
}
#target {
  color: var(--accent);
  font-weight: 600;
}
#messages {
  max-height: 225px;
  overflow: auto;
  scrollbar-width: thin;
}
.turn {
  padding: 4px 0 9px;
  font-size: 14px;
}
.turn p {
  margin: 4px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.turn .user {
  color: var(--ink);
  font-weight: 550;
}
.turn small {
  color: var(--muted);
}
#job:empty,
#attachments:empty {
  display: none;
}
#job {
  margin: 6px 0 10px;
  background: #f0f4ed;
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 14px;
}
#job.error {
  background: #fbede8;
  color: #863e2e;
}
#job button {
  margin-left: 8px;
  font-size: 13px;
}
.composer {
  border: 1px solid #bcc9bd;
  border-radius: 10px;
  padding: 8px 10px;
}
.composer:focus-within {
  border-color: var(--accent);
}
.composer textarea {
  border: 0;
  padding: 4px;
  min-height: 50px;
}
.composer textarea:focus {
  outline: none;
}
.compose-actions {
  margin-top: 4px;
}
.compose-actions button {
  font-size: 13px;
}
.compose-actions .primary {
  min-width: 75px;
}
#attach {
  border: 0;
}
#attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 5px;
}
#attachments button {
  font-size: 12px;
}
details {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}
#instruction {
  white-space: pre-wrap;
  padding: 10px;
  background: var(--wash);
  border-radius: 6px;
  color: var(--text);
}
dialog {
  width: min(430px, 92vw);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  color: var(--text);
}
dialog::backdrop {
  background: #15201966;
}
.actions {
  justify-content: flex-end;
  margin-top: 18px;
}
#tasks {
  max-height: 48vh;
  overflow: auto;
  margin-top: 12px;
}
#tasks button {
  display: block;
  width: 100%;
  text-align: left;
  margin-bottom: 6px;
}
#zoom {
  width: fit-content;
  max-width: 94vw;
  max-height: 94vh;
  text-align: right;
  padding: 12px;
}
#zoom img {
  display: block;
  max-width: 88vw;
  max-height: 78vh;
  object-fit: contain;
  margin-top: 6px;
}
#notice {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 90vw;
  background: #25392d;
  border-radius: 8px;
  color: #fff;
  padding: 10px 18px;
  z-index: 5;
}

#viewer .photo {
  margin: 0;
}
#edit-model,
#compare,
#download {
  font-size: 13px;
  max-width: 100%;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.composer textarea {
  width: 100%;
}
.history-row .inline {
  flex-wrap: wrap;
}
#mat-role {
  margin: 9px 0 13px;
  color: var(--muted);
  font-size: 14px;
}
.material-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 9px 0;
}
.material-row .thumb {
  width: 56px;
  height: 65px;
  flex: none;
}
.material-row button,
.material-row select {
  padding: 3px 7px;
  font-size: 13px;
}
.mat-info {
  min-width: 0;
}
.mat-info > small {
  display: block;
  overflow-wrap: anywhere;
  margin-bottom: 5px;
}
#material-list {
  max-height: 45vh;
  overflow: auto;
}
dialog input {
  width: 100%;
  margin: 6px 0;
}
dialog h2 {
  margin-bottom: 6px;
}
.actions {
  flex-wrap: wrap;
}
.gallery-card[aria-pressed='true'],
.pose[aria-pressed='true'] {
  box-shadow: inset 0 0 0 1px var(--accent);
}
#messages:empty {
  display: none;
}
.studio {
  min-height: 425px;
}
#details summary {
  width: fit-content;
}
button.primary {
  white-space: nowrap;
}
@media (min-width: 1500px) {
  .pose img {
    width: 68px;
    height: 75px;
  }
  .gallery-preview {
    height: 110px;
  }
}
@media (max-width: 960px) {
  .desk {
    grid-template-columns: minmax(200px, 25%) minmax(0, 1fr);
  }
  .panel {
    padding: 14px;
  }
  #slots {
    gap: 8px;
  }
  .material {
    padding: 10px;
  }
  .pose {
    font-size: 13px;
  }
  .gallery-preview {
    height: 64px;
  }
}
@media (max-width: 720px) {
  header {
    flex-wrap: wrap;
  }
  header,
  .brand,
  nav {
    gap: 5px;
  }
  main {
    padding: 0 10px;
  }
  .desk {
    grid-template-columns: 1fr;
  }
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  }
  aside.panel {
    min-height: 0;
  }
  #slots {
    grid-template-columns: 1fr;
  }
  .material .strip {
    float: left;
    margin: 4px 12px 0 0;
    min-height: 32px;
  }
  .material .thumb {
    width: 34px;
    height: 38px;
  }
  .material > small {
    display: inline-block;
    margin: 13px 0;
  }
  .rule,
  .footer,
  .compose-actions,
  .heading {
    flex-wrap: wrap;
  }
  #pose-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .segments {
    flex-wrap: wrap;
  }
  .footer small {
    max-width: 100%;
  }
  #ghost-inputs {
    gap: 6px;
  }
  .gallery-card {
    max-width: 160px;
  }
  .studio {
    min-height: 0;
  }
  .compose-actions .inline {
    flex-wrap: wrap;
  }
  .material {
    overflow: hidden;
  }
  #preview-actions {
    flex-wrap: wrap;
  }
}
