:root {
  color-scheme: light;
  --ink: #14233a;
  --muted: #6a7688;
  --line: #dce6e4;
  --soft: #f3f8f7;
  --green: #0fa979;
  --green-dark: #07835e;
  --blue: #2e92d6;
  --danger: #c94755;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: radial-gradient(circle at 90% 5%, #e2f7f1 0, transparent 31rem), #fbfcfd; }
button, input, select, textarea { font: inherit; }
.shell { width: min(1420px, calc(100% - 40px)); margin: 0 auto; }
.login-view { min-height: 100vh; display: grid; place-content: center; justify-items: center; text-align: center; }
.brand-mark { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 17px; color: white; font-size: 28px; font-weight: 800; background: linear-gradient(135deg, var(--green), var(--blue)); box-shadow: 0 14px 35px #0fa97938; }
.eyebrow { margin: 16px 0 4px; color: var(--green-dark); font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(28px, 4vw, 42px); }
.lead { margin: 10px 0 26px; color: var(--muted); }
.login-card { width: min(420px, calc(100vw - 32px)); padding: 26px; text-align: left; background: #ffffffee; border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 24px 70px #20324a18; }
.auth-switch { display: grid; grid-template-columns: 1fr 1fr; width: min(420px, calc(100vw - 32px)); margin-bottom: 10px; padding: 5px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.auth-switch button { color: var(--muted); background: transparent; }
.auth-switch button.active { color: var(--green-dark); background: #e7f8f2; }
label { display: grid; gap: 8px; color: #556275; font-size: 14px; font-weight: 650; }
label + label { margin-top: 16px; }
input, select, textarea { width: 100%; border: 1px solid #d6e0e2; border-radius: 12px; padding: 12px 14px; color: var(--ink); background: #fbfdfd; outline: none; transition: border-color .15s, box-shadow .15s; }
input, select { min-height: 46px; }
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px #0fa97918; }
button { min-height: 44px; border: 0; border-radius: 12px; padding: 10px 18px; font-weight: 750; cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
.primary { width: 100%; margin-top: 22px; color: white; background: linear-gradient(100deg, var(--green), var(--blue)); box-shadow: 0 12px 28px #0fa97926; }
.secondary { width: 100%; margin: 12px 0 4px; color: var(--green-dark); background: #e7f8f2; border: 1px solid #bce8d9; }
.ghost { color: var(--ink); background: white; border: 1px solid var(--line); }
.status { min-height: 20px; margin: 8px 0; color: var(--muted); font-size: 13px; }
.status.error { color: var(--danger); }
.studio-view { padding: 24px 0 50px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 10px 4px 24px; }
.topbar .eyebrow { margin: 0 0 2px; }
.topbar h1 { font-size: 26px; }
.top-actions { display: flex; align-items: center; gap: 14px; }
.online-dot { color: var(--green-dark); font-size: 13px; }
.workspace { display: grid; grid-template-columns: minmax(540px, .95fr) minmax(480px, 1.05fr); gap: 24px; align-items: start; }
.panel { padding: 26px; background: #ffffffed; border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 20px 55px #20324a0d; }
.section-title { display: flex; align-items: center; gap: 13px; margin-bottom: 20px; }
.section-title > span { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border-radius: 11px; color: var(--green-dark); background: #e5f7f1; font-weight: 800; }
.section-title h2 { margin: 0 0 2px; font-size: 19px; }
.section-title p { margin: 0; color: var(--muted); font-size: 13px; }
.two-column, .parameter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.two-column label + label, .parameter-grid label + label { margin-top: 0; }
.resolution-picker { display: grid; grid-template-columns: minmax(220px, 1fr) auto; gap: 14px; align-items: end; margin-bottom: 16px; }
.resolution-picker p { margin: 0 0 13px; color: var(--muted); font-size: 12px; }
.divider { height: 1px; margin: 26px 0; background: var(--line); }
details { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); }
summary { cursor: pointer; font-weight: 700; }
.detail-field { margin-top: 14px; }
.negative-prompt-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.negative-prompt-toolbar label { min-width: 0; }
.negative-prompt-toolbar .compact { flex: 0 0 auto; min-height: 36px; padding: 6px 12px; }
.negative-prompt-toolbar + textarea { margin-top: 8px; }
.generate { margin-top: 24px; min-height: 52px; font-size: 17px; }
.preview-panel { position: sticky; top: 20px; }
.queue-card { display: flex; align-items: center; justify-content: space-between; gap: 15px; min-height: 60px; padding: 14px 16px; border-radius: 14px; background: var(--soft); border-left: 4px solid var(--green); }
.queue-card > div { display: grid; gap: 4px; }
.queue-card span { color: var(--muted); font-size: 13px; }
.task-queue { margin-top: 12px; }
.preview { display: grid; min-height: 610px; place-items: center; overflow: hidden; border-radius: 18px; border: 1px dashed #cbd9da; background: linear-gradient(140deg, #f8fbfb, #edf7f5); }
.preview img { display: block; max-width: 100%; max-height: 74vh; object-fit: contain; }
.placeholder { display: grid; justify-items: center; gap: 10px; color: var(--muted); text-align: center; }
.placeholder b { font-size: 46px; color: var(--green); }
.metadata { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip { padding: 8px 10px; border-radius: 10px; color: #35465a; background: var(--soft); font-size: 13px; }
.main-nav { display: flex; align-items: center; gap: 6px; padding: 5px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.nav-button { min-height: 38px; color: var(--muted); background: transparent; }
.nav-button.active { color: var(--green-dark); background: #e7f8f2; }
.danger-link { min-height: 36px; color: var(--danger); background: white; border: 1px solid #efc7cc; }
.history-panel { margin-bottom: 24px; }
.segmented { display: flex; gap: 8px; margin-bottom: 16px; }
.history-tab { color: var(--muted); background: var(--soft); border: 1px solid var(--line); }
.history-tab.active { color: var(--green-dark); background: #e7f8f2; border-color: #a8dfcd; }
.history-grid { display: grid; grid-template-columns: repeat(auto-fill, 128px); justify-content: start; gap: 12px; min-height: 120px; }
.history-card { width: 128px; min-width: 0; padding: 7px; overflow: hidden; text-align: left; color: var(--ink); background: white; border: 2px solid transparent; border-radius: 13px; box-shadow: 0 5px 18px #20324a10; }
.history-card:hover, .history-card.selected { border-color: var(--green); }
.history-card img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 9px; }
.history-card span { display: block; margin-top: 7px; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.35; white-space: pre-line; }
.history-footer { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 16px; color: var(--muted); }
.history-footer .compact { width: auto; min-height: 42px; margin: 0; }
.edit-workspace { grid-template-columns: minmax(520px, 1fr) minmax(520px, 1fr); }
.source-empty { display: grid; min-height: 300px; place-items: center; border: 1px dashed #cbd9da; border-radius: 16px; color: var(--muted); background: var(--soft); }
.mask-stage { position: relative; width: fit-content; max-width: 100%; margin: 0 auto; overflow: hidden; border-radius: 16px; }
.mask-stage img { display: block; max-width: 100%; max-height: 70vh; object-fit: contain; }
.mask-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.face-repair-panel { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(130px, .45fr) minmax(220px, .8fr) auto; gap: 10px; align-items: end; margin: 12px 0; padding: 14px; border: 1px solid #cde5dc; border-radius: 14px; background: #f4fbf8; }
.face-repair-panel > div { align-self: center; }
.face-repair-panel > div span { display: block; margin-top: 3px; color: var(--muted); font-size: .85rem; }
.face-repair-panel > .status { grid-column: 1 / -1; margin: 0; }
.mask-tools { display: flex; align-items: end; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.mask-tools .tool { color: var(--muted); background: var(--soft); border: 1px solid var(--line); }
.mask-tools .tool.active { color: var(--green-dark); border-color: #a8dfcd; background: #e7f8f2; }
.mask-tools label { flex: 1 1 200px; }

@media (max-width: 720px) {
  .face-repair-panel { grid-template-columns: 1fr 1fr; }
  .face-repair-panel > div, .face-repair-panel > label:last-of-type, .face-repair-panel > .status { grid-column: 1 / -1; }
}
.hint { margin: 8px 0 14px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.compact-grid { margin-top: 16px; }
.multi-slots { display: grid; gap: 16px; }
.multi-slot { padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--soft); }
.multi-slot h3 { margin: 0 0 14px; color: var(--green-dark); }
.multi-slot label + label { margin-top: 12px; }
.compact-advanced { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.compact-advanced summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.compact-advanced[open] { max-height: 132px; overflow: auto; }
.compact-advanced label { margin-top: 10px; }
.comparison { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.comparison figure { min-width: 0; margin: 0; }
.comparison figcaption { margin-bottom: 8px; color: var(--muted); font-size: 13px; font-weight: 700; }
.comparison img, .preview.small img { display: block; width: 100%; max-height: 72vh; object-fit: contain; border-radius: 16px; background: var(--soft); }
.preview.small { min-height: 360px; }
.request-panel { width: min(760px, 100%); margin: 0 auto; }
.request-result { display: grid; gap: 7px; margin-top: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; color: var(--muted); background: var(--soft); }
.request-result strong { color: var(--ink); }
@media (max-width: 1000px) { .workspace { grid-template-columns: 1fr; } .preview-panel { position: static; } .preview { min-height: 440px; } }
@media (max-width: 900px) { .comparison { grid-template-columns: 1fr; } }
@media (max-width: 620px) { .shell { width: min(100% - 20px, 1420px); } .studio-view { padding-top: 10px; } .topbar { align-items: flex-start; flex-wrap: wrap; } .main-nav { order: 3; width: 100%; } .nav-button { flex: 1; } .online-dot { display: none; } .panel { padding: 18px; border-radius: 18px; } .two-column, .parameter-grid { grid-template-columns: 1fr; } .resolution-picker { grid-template-columns: 1fr; gap: 4px; } .resolution-picker p { margin: 0; } .preview { min-height: 360px; } .history-grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); } .history-card { width: auto; } .history-footer { align-items: stretch; flex-direction: column; } }
