:root {
  color-scheme: light;
  --paper: #f6f6f3;
  --white: #fff;
  --ink: #191c23;
  --muted: #585c65;
  --line: #dfe0da;
  --accent: #bd481f;
  --accent-dark: #963616;
  --wash: #fdf1eb;
  font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  font-size: 16px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--paper); }
button, input, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
button, input, select, textarea, summary, a { outline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); }
a { color: inherit; }
h1, h2, p { margin: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 68px; padding: .7rem max(1.5rem, calc((100vw - 1450px) / 2)); border-bottom: 1px solid var(--line); background: #fff; }
.brand { display: inline-flex; gap: .65rem; align-items: center; white-space: nowrap; text-decoration: none; font-size: 1.15rem; font-weight: 800; }
.brand-icon { display: grid; place-items: center; width: 36px; height: 36px; color: #fff; border-radius: 10px; background: var(--ink); font-size: 1.25rem; }
.brand small { margin-left: .5rem; color: var(--muted); font: 700 .66rem system-ui, sans-serif; letter-spacing: .13em; }
.top-actions { display: flex; align-items: center; gap: 1.3rem; color: var(--muted); font-size: .875rem; white-space: nowrap; }
.top-actions a, .workspace-footer a { text-decoration: none; }
.top-actions a:hover, .workspace-footer a:hover { text-decoration: underline; }
.auth-main { display: grid; justify-items: center; align-items: start; padding: clamp(2rem, 8vh, 6rem) 1rem 3rem; }
.auth-card { width: min(100%, 430px); padding: clamp(1.4rem, 4vw, 2.15rem); border: 1px solid var(--line); background: var(--white); border-radius: 16px; }
.auth-card h1 { font-size: clamp(1.5rem, 4vw, 1.9rem); letter-spacing: -.045em; }
.auth-intro, .auth-help { color: var(--muted); line-height: 1.65; }
.auth-intro { margin: .45rem 0 1.5rem; font-size: .9rem; }
.auth-card form { display: grid; gap: .4rem; }
.auth-card label { font-weight: 650; font-size: .88rem; }
.auth-card form > label:not(:first-child) { margin-top: .7rem; }
.auth-card input.otp-input { font-variant-numeric: tabular-nums; letter-spacing: .12em; }
.auth-card .generate { margin-top: 1rem; }
.auth-links { display: flex; justify-content: space-between; gap: .75rem; }
.auth-links button:disabled { cursor: default; color: var(--muted); }
.auth-status:not(:empty) { margin-top: .9rem; color: var(--accent-dark); font-size: .85rem; }
.auth-help { font-size: .8rem; border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 1.2rem; }
#signed-in-name { max-width: 13ch; text-overflow: ellipsis; overflow: hidden; }
@media (max-width: 600px) { .top-actions #signed-in-name, .topbar:has(#logout) .brand small { display: none; } }
.layout { width: min(calc(100% - 3rem), 1450px); margin: 1.4rem auto 3rem; display: grid; grid-template-columns: minmax(300px, 378px) minmax(0, 1fr); gap: clamp(1.25rem, 3vw, 3rem); align-items: start; }
.controls { min-width: 0; padding: 1.2rem; background: var(--white); border: 1px solid var(--line); border-radius: 16px; }
.side-heading, .section-label, .below-input, .workspace-heading, .billing-heading, .canvas-footer, .quote { display: flex; justify-content: space-between; align-items: center; gap: .6rem; }
.side-heading { padding: .12rem 0 1rem; }
.side-heading h1 { font-size: 1.33rem; letter-spacing: -.03em; }
.side-heading>span, .dimension-pill { color: var(--muted); background: #f1f1ed; border: 1px solid #e5e5df; padding: .28rem .53rem; border-radius: 6px; font-size: .75rem; white-space: nowrap; }
.section { margin: 0 0 1rem; }
fieldset { border: 0; padding: 0; min-width: 0; }
legend, .section-label { padding: 0; margin-bottom: .44rem; font-size: .92rem; font-weight: 700; }
.section-label h2 { font-size: inherit; }
.models { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.models label { cursor: pointer; position: relative; }
.models input { position: absolute; opacity: 0; }
.models span { display: grid; gap: .23rem; padding: .64rem .7rem; border: 1px solid var(--line); border-radius: 9px; }
.models strong { font: 750 1rem system-ui, sans-serif; }
.models small { font-size: .77rem; color: var(--muted); }
.models input:checked + span { border-color: var(--accent); background: var(--wash); color: var(--accent-dark); }
.models input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }
.hint { font-size: .79rem; color: var(--muted); line-height: 1.6; }
.model-section .hint { margin-top: .42rem; }
.meta, .below-input { font-size: .75rem; color: var(--muted); font-weight: 400; }
.below-input { margin-top: .26rem; }
.text-action { background: transparent; border: 0; padding: .18rem .06rem; color: var(--accent-dark); font-size: .81rem; }
.text-action:hover { text-decoration: underline; }
textarea, select, input:not([type=checkbox], [type=radio], [type=file]) { background: #fbfbfa; border: 1px solid var(--line); border-radius: 8px; width: 100%; padding: .61rem .62rem; color: var(--ink); font-size: .875rem; }
textarea { resize: vertical; display: block; line-height: 1.55; }
select { appearance: none; padding-right: 1.65rem; background-image: linear-gradient(45deg, transparent 50%, #5d6268 50%), linear-gradient(135deg, #5d6268 50%, transparent 50%); background-position: calc(100% - 13px) 50%, calc(100% - 8px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.fields { display: grid; gap: .7rem; }
.fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fields label { display: grid; align-content: start; gap: .31rem; min-width: 0; font-size: .84rem; color: var(--muted); }
.fields .wide { grid-column: 1/-1; }
.fields .checkbox { display: flex; align-items: center; }
.checkbox input { accent-color: var(--accent); }
.fields input[type=file] { font: inherit; width: 100%; }
.ratio-group { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .57rem; }
.ratio-group button { padding: .23rem .44rem; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 6px; font: 650 .73rem system-ui, sans-serif; }
.ratio-group button[aria-pressed=true] { color: var(--accent-dark); border-color: var(--accent); background: var(--wash); }
.custom-fields { margin-top: .55rem; }
.drop-zone { cursor: pointer; display: flex; justify-content: center; align-items: center; gap: .61rem; border: 1px dashed #bfc1bb; border-radius: 9px; background: #fafaf8; min-height: 55px; font-size: .87rem; padding: .42rem; }
.drop-zone small { display: inline-block; margin-left: .28rem; color: var(--muted); font-size: .74rem; }
.drop-zone:hover, .drop-zone.dragging, .drop-zone:has(+ input:focus-visible) { border-color: var(--accent); background: var(--wash); }
.upload-icon { font-size: 1.3rem; color: var(--accent-dark); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.reference-list { display: flex; flex-wrap: wrap; gap: .35rem; }
.ref { position: relative; margin-top: .4rem; }
.ref img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; display: block; }
.ref button { position: absolute; top: -3px; right: -3px; width: 20px; height: 20px; border: 1px solid white; border-radius: 50%; color: white; background: #222; line-height: 1; padding: 0; }
.advanced { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
summary { list-style: none; }
summary::-webkit-details-marker { display: none; }
.advanced>summary { display: flex; align-items: center; justify-content: space-between; min-height: 43px; font-size: .9rem; font-weight: 700; }
.chevron { width: 8px; height: 8px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; display: inline-block; transform: rotate(45deg); margin-right: .26rem; }
details[open]>summary .chevron { transform: rotate(225deg); }
.advanced-body { margin-bottom: .9rem; }
.nested { border: 1px solid var(--line); border-radius: 8px; }
.nested summary { padding: .6rem; font-size: .83rem; }
.nested-body { padding: .2rem .6rem .7rem; }
.submit-area { display: grid; gap: .53rem; }
.quote { font-size: .86rem; color: var(--muted); }
.quote strong { color: var(--ink); font-size: 1rem; font-variant-numeric: tabular-nums; }
.generate { background: var(--accent); border: 1px solid var(--accent); color: white; border-radius: 8px; min-height: 43px; padding: .55rem .9rem; font-weight: 750; }
.generate:hover { background: var(--accent-dark); }
.generate:disabled { cursor: wait; opacity: .66; }
.notice { color: #9c3119; overflow-wrap: anywhere; }
.workspace { min-width: 0; }
.workspace-heading { margin: .1rem 0 .75rem; }
.kicker { color: var(--accent-dark); font: 800 .71rem system-ui, sans-serif; letter-spacing: .15em; margin-bottom: .19rem; }
.workspace-heading h2 { font-size: clamp(1.45rem, 2.6vw, 2.3rem); letter-spacing: -.05em; }
.canvas { aspect-ratio: 16 / 9; position: relative; isolation: isolate; display: grid; place-items: center; background: radial-gradient(ellipse at center, #2c333b, #141820); border: 1px solid #2a2e34; border-radius: 14px; overflow: hidden; }
.canvas-media { width: 100%; height: 100%; min-height: 0; position: absolute; inset: 0; }
.canvas-media img { width: 100%; height: 100%; display: block; object-fit: contain; }
.canvas-media .sample-image { object-fit: cover; }
.sample-caption { position: absolute; inset: auto 0 0; padding: 3rem 1.5rem 1.25rem; color: #fff; display: grid; gap: .25rem; background: linear-gradient(transparent, #10141cbf); }
.sample-caption span { font-size: .75rem; }
.sample-caption strong { font-size: 1.36rem; }
.canvas-status { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: .6rem; padding: 1rem; color: white; background: #15182054; font-size: .9rem; }
.spinner { display: inline-block; width: 1rem; height: 1rem; border: 2px solid #ffffff66; border-top-color: white; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.canvas-footer { min-height: 41px; font-size: .84rem; color: var(--muted); }
.download { color: var(--accent-dark); padding: .3rem .1rem; }
.gallery { display: flex; gap: .5rem; padding: .6rem 0 0; flex-wrap: wrap; }
.gallery button { background: #fff; border: 1px solid var(--line); padding: 2px; border-radius: 6px; }
.gallery button[aria-pressed=true] { border-color: var(--accent); }
.gallery img { display: block; width: 65px; height: 45px; object-fit: cover; border-radius: 4px; }
.billing { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.05rem; }
.billing h2 { font-size: 1rem; }
.billing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: .9rem 0 .55rem; }
.billing-grid>div { display: grid; gap: .23rem; align-content: start; min-width: 0; }
.billing-grid>div + div { padding-left: 1rem; border-left: 1px solid var(--line); }
.billing-grid span, .billing-grid small { color: var(--muted); font-size: .84rem; }
.billing-grid strong { font-size: clamp(1.12rem, 2.6vw, 1.85rem); font-weight: 750; letter-spacing: -.04em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.billing .meta { margin-top: .35rem; }
.workspace-footer { display: flex; flex-wrap: wrap; gap: .5rem 1rem; padding: .75rem 0; color: var(--muted); font-size: .75rem; }
@media (max-width: 820px) {
  .layout { width: min(calc(100% - 1.6rem), 590px); grid-template-columns: 1fr; gap: 1.1rem; margin-top: .8rem; }
  .topbar { padding-inline: .8rem; }
  .top-actions { gap: .65rem; }
}
@media (max-width: 430px) {
  .brand small { display: none; }
  .top-actions { font-size: .77rem; }
  .controls { padding: .85rem; }
  .drop-zone small { margin-left: 0; display: block; }
}
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
