:root {
  color-scheme: dark;
  --ink: #f5ecdf;
  --muted: #c3b5aa;
  --gold: #e7c99e;
  --border: #53434b;
  --panel: #211b22;
  --base: #161318;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--base);
  color: var(--ink);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; background: radial-gradient(ellipse at 82% 18%, #31252f 0%, transparent 52%); }
h1, h2, p { margin: 0; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button[disabled], select[disabled] { cursor: default; opacity: .68; }
a { color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: .22rem; }
.topbar { width: min(100% - 3.2rem, 72rem); margin-inline: auto; padding: 1.3rem 0; border-bottom: 1px solid var(--border); }
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--ink); font-family: Georgia, serif; font-size: .96rem; letter-spacing: .23em; text-decoration: none; }
.brand-mark { display: inline-block; width: .8rem; height: .8rem; border: 1px solid var(--gold); transform: rotate(45deg); }
.studio { width: min(100% - 3.2rem, 72rem); margin-inline: auto; display: grid; grid-template-columns: minmax(0, 1.13fr) minmax(0, .87fr); column-gap: clamp(2rem, 7vw, 6.5rem); align-items: start; padding: clamp(2.75rem, 7vw, 6rem) 0 3rem; }
h1 { font-family: "Songti SC", "Noto Serif SC", SimSun, serif; font-weight: 600; font-size: clamp(2.2rem, 4.7vw, 4rem); letter-spacing: -.05em; line-height: 1.2; }
.intro { max-width: 32rem; color: var(--muted); line-height: 1.7; margin-block: .8rem 1.9rem; }
.uploads { margin: 0; padding: 0; border: 0; min-width: 0; }
.uploads legend, .field label { padding: 0; display: block; font-weight: 600; font-size: .99rem; }
.upload-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .72rem; margin-top: .65rem; }
.upload-card { min-width: 0; border: 1px solid var(--border); background: var(--panel); border-radius: .6rem; padding: .7rem; }
.card-title { display: flex; justify-content: space-between; align-items: baseline; gap: .35rem; margin-bottom: .5rem; }
.card-title label { color: var(--ink); font-weight: 600; font-size: .9rem; }
.card-title a { font-size: .75rem; white-space: nowrap; text-underline-offset: .25rem; }
.picture-slot { position: relative; display: block; height: clamp(7rem, 17vw, 11.5rem); background: #130f16; border-radius: .34rem; overflow: hidden; cursor: pointer; }
.picture-slot img { display: block; width: 100%; height: 100%; object-fit: contain; }
.face-slot img { object-fit: cover; object-position: center 48%; }
.image-badge { position: absolute; bottom: .3rem; left: .34rem; background: #161318e0; color: #fff5e6; padding: .1rem .34rem; border-radius: .16rem; font-size: .7rem; }
.hint { color: var(--muted); line-height: 1.55; font-size: .78rem; }
.upload-card .hint { min-height: 2.45em; margin-block: .48rem; }
.file-picker { position: relative; display: grid; place-items: center; min-height: 2.35rem; border: 1px solid var(--border); border-radius: .32rem; color: var(--gold); font-size: .85rem; cursor: pointer; }
.file-picker:hover, .file-picker:focus-within { border-color: var(--gold); }
.file-picker input { cursor: pointer; opacity: 0; position: absolute; inset: 0; width: 100%; height: 100%; }
.upload-note { margin-top: .55rem; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .72rem; margin-top: 1.25rem; }
.field { min-width: 0; }
.field input, .field select { width: 100%; min-height: 2.7rem; margin-block: .4rem .32rem; padding: .45rem .6rem; background: var(--panel); color: var(--ink); border: 1px solid var(--border); border-radius: .4rem; }
.field input::placeholder { color: #a29393; }
.primary { width: 100%; min-height: 2.85rem; margin-top: 1.45rem; border: 0; border-radius: .4rem; color: #251710; background: var(--gold); font-weight: 700; }
.primary:hover:not(:disabled) { background: #f8ddb6; }
.transmission { margin-top: .5rem; }
.status { margin-top: .67rem; line-height: 1.5; font-size: .85rem; color: var(--gold); }
.status[data-error] { color: #ffb9ae; }
.preview { min-width: 0; }
.preview-header { min-height: 2.2rem; display: flex; align-items: baseline; justify-content: space-between; gap: .45rem; }
.preview-header h2 { font-family: "Songti SC", SimSun, serif; font-size: 1.28rem; font-weight: 600; }
.download { font-size: .9rem; text-underline-offset: .26rem; }
.portrait-frame { position: relative; display: grid; place-items: center; aspect-ratio: 2 / 3; width: 100%; max-width: 30rem; border: 1px solid var(--border); padding: .43rem; background: #1e181f; border-radius: .6rem; }
.portrait-frame img { width: 100%; height: 100%; object-fit: contain; border-radius: .3rem; display: block; }
.preview-placeholder { align-self: stretch; width: 100%; display: grid; place-items: center; line-height: 1.5; font-size: .87rem; color: var(--muted); background: radial-gradient(ellipse at 55% 42%, #3a2d38, #1e181f 65%); }
#preview-note { margin-top: .5rem; }
@media (max-width: 50rem) {
  .studio { grid-template-columns: minmax(0, 1fr); row-gap: 2.5rem; max-width: 32rem; }
  .picture-slot { height: clamp(8.2rem, 33vw, 11rem); }
}
@media (max-width: 24rem) {
  .topbar, .studio { width: calc(100% - 1.4rem); }
  .studio { padding-top: 1.9rem; }
  .upload-card { padding: .45rem; }
  .picture-slot { height: 7.35rem; }
}
