:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: #ffffff;
  --surface-muted: #f1f3f6;
  --line: rgba(30, 33, 39, 0.11);
  --line-strong: rgba(30, 33, 39, 0.18);
  --text: #17181c;
  --muted: #69707d;
  --soft: #8d95a3;
  --blue: #0a84ff;
  --blue-dark: #0066d6;
  --green: #2f9b65;
  --amber: #b77819;
  --rose: #c94f64;
  --shadow: 0 20px 54px rgba(19, 26, 37, 0.12);
  --shadow-soft: 0 12px 28px rgba(19, 26, 37, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.is-hidden {
  display: none !important;
}

body.free-prompt-board #workflow-feedback,
body.free-prompt-board #inspiration-drawer,
body.free-prompt-board #template-section,
body.free-prompt-board #play-section,
body.free-prompt-board .platform-field,
body.free-prompt-board #platform-card,
body.free-prompt-board .board-helper-fields,
body.free-prompt-board .assist-drawer,
body.free-prompt-board #compose-prompt {
  display: none !important;
}

body.free-prompt-board .board-output-fields {
  grid-template-columns: minmax(0, 1fr);
}

body.free-prompt-board #prompt {
  min-height: 240px;
}

body.image-edit-mode #board-section,
body.image-edit-mode #inspiration-drawer,
body.image-edit-mode #template-section,
body.image-edit-mode #play-section,
body.image-edit-mode .platform-field,
body.image-edit-mode #platform-card,
body.image-edit-mode .board-helper-fields,
body.image-edit-mode .assist-drawer {
  display: none !important;
}

body.image-edit-mode .board-output-fields {
  grid-template-columns: minmax(0, 1fr);
}

html {
  min-width: 320px;
  height: 100%;
}

body {
  margin: 0;
  height: 100%;
  min-height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(180deg, #fbfbfd 0%, var(--bg) 48%, #eceff3 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  letter-spacing: 0;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1600px, calc(100% - 32px));
  height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  padding: 18px 0 24px;
  overflow: hidden;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(22px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  width: 156px;
  height: 42px;
  object-fit: contain;
  object-position: left center;
  flex: 0 0 auto;
  border-radius: 6px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 21px;
  line-height: 1.12;
  font-weight: 760;
}

.brand p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.top-actions,
.tool-buttons,
.prompt-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button,
.ghost-button,
.danger-action,
.secondary-action,
.primary-action,
.generate-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--text);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.icon-button {
  width: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #30343b;
}

.icon-button span {
  display: block;
  font-size: 17px;
  line-height: 1;
}

.ghost-button,
.danger-action,
.secondary-action,
.primary-action {
  padding: 0 12px;
  font-size: 13px;
  font-weight: 650;
}

.ghost-button {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.66);
}

.ghost-button.active {
  border-color: rgba(10, 132, 255, 0.36);
  background: rgba(10, 132, 255, 0.1);
  color: var(--blue);
}

#toggle-library {
  padding: 0 10px;
  font-size: 12px;
}

.danger-action {
  color: #b4233a;
  border-color: rgba(180, 35, 58, 0.26);
  background: rgba(180, 35, 58, 0.08);
}

.danger-action:disabled {
  cursor: not-allowed;
  color: var(--muted);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.5);
}

.secondary-action {
  color: var(--blue);
  border-color: rgba(10, 132, 255, 0.28);
  background: rgba(10, 132, 255, 0.08);
}

.primary-action,
.generate-button {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  box-shadow: 0 10px 20px rgba(10, 132, 255, 0.2);
}

button:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.primary-action:hover,
.generate-button:hover {
  background: var(--blue-dark);
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.status-strip div {
  min-height: 62px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.66);
  backdrop-filter: blur(18px);
}

.status-strip span {
  color: var(--muted);
  font-size: 12px;
}

.status-strip strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.retention-notice {
  margin: -2px 0 12px;
  border: 1px solid rgba(183, 120, 25, 0.24);
  border-radius: 8px;
  padding: 9px 12px;
  background: rgba(183, 120, 25, 0.08);
  color: #7a4c08;
  font-size: 13px;
  line-height: 1.45;
}

.workbench {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.results-workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.panel,
.stage-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(24px);
}

.panel {
  padding: 14px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.stage-panel {
  min-width: 0;
  padding: 12px;
}

.library-panel {
  overflow: visible;
}

.library-panel.is-collapsed .panel-head {
  margin-bottom: 0;
}

.library-body {
  display: grid;
}

.library-head {
  align-items: center;
  min-height: 50px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.library-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.library-title span {
  min-width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(18, 22, 29, 0.06);
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.library-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  max-width: 100%;
}

.library-actions .ghost-button,
.library-actions .danger-action {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.panel-head,
.stage-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.panel-head.compact {
  margin: 18px 0 10px;
}

h2 {
  font-size: 15px;
  line-height: 1.2;
  font-weight: 760;
}

h3 {
  margin: 0;
  color: #424852;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 760;
}

.field-group {
  margin-bottom: 14px;
}

.studio-section {
  margin-bottom: 14px;
}

.image-edit-panel .field-group:last-child {
  margin-bottom: 0;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.section-title span,
#batch-count {
  min-width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(10, 132, 255, 0.1);
  color: var(--blue);
  font-size: 12px;
  font-weight: 760;
}

.workflow-feedback {
  display: grid;
  gap: 4px;
  margin: -2px 0 14px;
  border: 1px solid rgba(10, 132, 255, 0.18);
  border-radius: 8px;
  padding: 10px 11px;
  background: rgba(10, 132, 255, 0.06);
}

.workflow-feedback strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.25;
}

.workflow-feedback span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.workflow-feedback.pulse {
  border-color: rgba(10, 132, 255, 0.38);
  background: rgba(10, 132, 255, 0.1);
}

.settings-drawer {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
}

.settings-drawer summary {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 11px;
  color: #424852;
  cursor: pointer;
  font-size: 12px;
  font-weight: 760;
  list-style: none;
}

.settings-drawer summary::-webkit-details-marker {
  display: none;
}

.settings-drawer summary::after {
  content: "展开";
  color: var(--blue);
  font-size: 12px;
  font-weight: 720;
}

.settings-drawer[open] summary {
  border-bottom: 1px solid var(--line);
}

.settings-drawer[open] summary::after {
  content: "收起";
}

.drawer-content {
  padding: 12px 11px 2px;
}

.drawer-content > .field-group:last-child {
  margin-bottom: 10px;
}

.inspiration-drawer .drawer-content {
  padding-bottom: 10px;
}

.inspiration-drawer .studio-section {
  margin-bottom: 10px;
}

.field-grid,
.dimension-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

label,
.label-row label {
  display: block;
  margin-bottom: 7px;
  color: #424852;
  font-size: 12px;
  font-weight: 720;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.label-row strong {
  color: var(--blue);
  font-size: 12px;
}

textarea,
select,
input[type="number"],
input[type="text"],
input[type="url"],
input[type="password"],
input[type="search"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

textarea {
  min-height: 104px;
  resize: vertical;
  padding: 11px;
  line-height: 1.5;
  font-size: 13px;
}

.optimized-block textarea {
  min-height: 82px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.64);
}

select,
input[type="number"],
input[type="text"],
input[type="url"],
input[type="password"],
input[type="search"] {
  height: 40px;
  padding: 0 10px;
  font-size: 13px;
}

select:disabled {
  opacity: 1;
  cursor: not-allowed;
  color: var(--text);
  border-color: rgba(18, 22, 29, 0.08);
  background: rgba(18, 22, 29, 0.04);
}

.custom-style-input {
  margin-top: 8px;
}

textarea:focus,
select:focus,
input:focus {
  border-color: rgba(10, 132, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.12);
}

.segmented,
.quality-row,
.view-switcher {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: rgba(235, 238, 243, 0.76);
}

.segmented {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.segmented.triple {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.quality-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.view-switcher {
  width: min(310px, 100%);
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.template-grid,
.chip-grid,
.batch-grid,
.checkbox-grid {
  display: grid;
  gap: 7px;
}

.template-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.template-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.template-grid button {
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--text);
  text-align: left;
}

.template-grid.compact button {
  min-height: 62px;
}

.template-grid button.active {
  border-color: rgba(10, 132, 255, 0.38);
  background: rgba(10, 132, 255, 0.08);
}

.template-grid strong,
.template-grid span {
  display: block;
  min-width: 0;
}

.template-grid strong {
  margin-bottom: 4px;
  font-size: 13px;
}

.template-grid span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.chip-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.image-intent-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.image-preserve-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.play-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.play-grid button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.play-grid button.active {
  border-color: rgba(10, 132, 255, 0.35);
  background: rgba(10, 132, 255, 0.08);
}

.chip-grid button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.chip-grid button.active {
  border-color: rgba(10, 132, 255, 0.35);
  background: rgba(10, 132, 255, 0.08);
  color: var(--text);
}

.platform-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3px;
  margin: -2px 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(18, 22, 29, 0.025);
}

.platform-card strong {
  color: #424852;
  font-size: 12px;
}

.platform-card span,
.platform-card em {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  font-style: normal;
}

.inline-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  margin-top: 8px;
}

.batch-grid,
.checkbox-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.batch-grid label,
.checkbox-grid label {
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 8px;
  background: rgba(255, 255, 255, 0.5);
  color: #424852;
  font-size: 12px;
  font-weight: 650;
}

.batch-grid input,
.checkbox-grid input {
  accent-color: var(--blue);
}

.segmented button,
.quality-row button,
.view-switcher button,
.ratio-grid button {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.segmented button.active,
.quality-row button.active,
.view-switcher button.active,
.ratio-grid button.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 5px 14px rgba(19, 26, 37, 0.08);
}

.upload-group {
  display: none;
}

.upload-group.visible {
  display: block;
}

.upload-group.required .upload-zone {
  border-color: rgba(10, 132, 255, 0.58);
  background: rgba(10, 132, 255, 0.1);
}

.upload-group.has-reference .upload-zone {
  border-style: solid;
  border-color: rgba(47, 155, 101, 0.35);
  background: rgba(47, 155, 101, 0.08);
}

.upload-group.reference-confirmed .upload-zone {
  border-color: rgba(10, 132, 255, 0.72);
  background: rgba(10, 132, 255, 0.12);
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.12);
}

.upload-group.is-dragover .upload-zone {
  border-color: rgba(10, 132, 255, 0.78);
  background: rgba(10, 132, 255, 0.15);
  box-shadow: inset 0 0 0 1px rgba(10, 132, 255, 0.22);
}

.upload-zone {
  min-height: 74px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin: 0;
  border: 1px dashed rgba(10, 132, 255, 0.38);
  border-radius: 8px;
  padding: 10px;
  background: rgba(10, 132, 255, 0.06);
  cursor: pointer;
}

.reference-gallery {
  grid-row: auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
  overflow: visible;
}

.reference-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  overflow: visible;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
}

.upload-zone .reference-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  grid-row: auto;
  border-radius: 8px;
}

.reference-thumb-remove {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  display: grid;
  place-items: center;
  padding: 0;
  background: rgba(20, 24, 33, 0.86);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  font-weight: 760;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.2);
}

.reference-thumb-remove:hover {
  background: #111827;
}

.upload-zone img {
  width: 54px;
  height: 54px;
  grid-row: span 2;
  border-radius: 8px;
  object-fit: cover;
}

.upload-zone span {
  color: var(--blue);
  font-size: 13px;
  font-weight: 720;
}

.upload-group.is-dragover .upload-zone span {
  color: #006fd6;
}

.upload-zone em {
  display: block;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  font-style: normal;
}

.upload-zone img[hidden] + span {
  grid-column: 1 / -1;
}

.upload-zone img[hidden] + span + em {
  grid-column: 1 / -1;
}

.upload-group.has-multiple-reference .upload-zone span,
.upload-group.has-multiple-reference .upload-zone em {
  grid-column: 1 / -1;
}

.upload-group.has-multiple-reference .reference-gallery {
  grid-column: 1 / -1;
}

#reference-upload {
  display: none;
}

.prompt-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 8px;
}

.prompt-actions button {
  flex: 1 1 92px;
  min-width: 0;
}

.ratio-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.ratio-grid button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.56);
}

input[type="range"] {
  width: 100%;
  height: 24px;
  accent-color: var(--blue);
}

.generate-button {
  width: 100%;
  min-height: 44px;
  position: sticky;
  bottom: 0;
  z-index: 4;
  font-size: 14px;
  font-weight: 760;
}

.stage-toolbar {
  margin-bottom: 12px;
}

.stage-title {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

.stage-title h2 {
  margin: 0;
}

.stage-title > span {
  flex-basis: 100%;
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.stage-actions {
  min-width: 0;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.preview-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 280px);
  gap: 12px;
  align-items: stretch;
}

.preview-layout.is-canvas-mode {
  grid-template-columns: minmax(0, 1fr);
}

.preview-layout.is-canvas-mode .result-side {
  display: none;
}

.canvas-shell {
  --preview-max-height: min(520px, 64vh);
  min-height: 500px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(30, 33, 39, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(30, 33, 39, 0.045) 1px, transparent 1px),
    #edf0f4;
  background-size: 32px 32px;
}

.preview-context {
  min-width: min(360px, 100%);
  max-width: min(560px, 100%);
  display: flex;
  flex: 1 1 360px;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  background: rgba(18, 22, 29, 0.035);
}

.preview-context[hidden] {
  display: none;
}

.preview-context div {
  min-width: 0;
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 8px;
}

.preview-context span {
  flex: 0 0 auto;
  color: var(--green);
  font-size: 12px;
  font-weight: 760;
}

.preview-context strong,
.preview-context p {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-context strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 760;
}

.preview-context p {
  flex: 1 1 100%;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.preview-context em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  white-space: nowrap;
}

.image-frame {
  --preview-ratio: 1;
  width: min(var(--preview-frame-width, 500px), 100%);
  aspect-ratio: var(--preview-aspect-ratio, 1 / 1);
  position: relative;
  max-height: var(--preview-max-height);
  border-radius: 8px;
  overflow: hidden;
  background: #dde2e9;
  box-shadow: var(--shadow);
  transition: width 0.22s ease, aspect-ratio 0.22s ease;
}

.image-frame.is-wide {
  width: min(var(--preview-frame-width, 640px), 100%);
}

.image-frame.is-portrait {
  width: min(var(--preview-frame-width, 360px), 100%);
}

.image-frame.is-canvas-mode {
  width: 100%;
  height: min(680px, calc(100vh - 220px));
  min-height: 520px;
  max-height: none;
  aspect-ratio: auto;
  background: #eef1f5;
}

.image-frame.is-canvas-mode .image-meta {
  display: none;
}

.image-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  color: transparent;
  font-size: 0;
  background: #dde2e9;
}

.infinite-canvas {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: auto;
  background:
    linear-gradient(rgba(30, 33, 39, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 33, 39, 0.045) 1px, transparent 1px),
    #f4f6f9;
  background-size: 32px 32px;
}

.infinite-canvas.is-dragover {
  outline: 2px solid rgba(10, 132, 255, 0.42);
  outline-offset: -2px;
}

.canvas-toolstrip {
  position: sticky;
  left: 12px;
  top: 12px;
  z-index: 12;
  width: fit-content;
  max-width: calc(100% - 24px);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 26px rgba(18, 22, 29, 0.12);
  backdrop-filter: blur(16px);
}

.canvas-toolstrip button {
  min-height: 28px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.canvas-toolstrip button.active {
  border-color: rgba(10, 132, 255, 0.34);
  background: rgba(10, 132, 255, 0.1);
  color: var(--blue);
}

.canvas-toolstrip .canvas-primary-action {
  border-color: rgba(10, 132, 255, 0.28);
  background: var(--blue);
  color: #fff;
}

.canvas-toolstrip .canvas-primary-action:disabled {
  border-color: transparent;
  background: rgba(124, 132, 146, 0.16);
  color: var(--muted);
  cursor: not-allowed;
}

.infinite-canvas-surface {
  position: relative;
  width: 2400px;
  height: 1600px;
  margin-top: -50px;
}

.infinite-canvas.empty .infinite-canvas-surface::before {
  content: "拖入图片到画布";
  position: absolute;
  left: 50%;
  top: 50%;
  color: var(--muted);
  font-size: 13px;
  transform: translate(-50%, -50%);
}

.canvas-node {
  position: absolute;
  left: 0;
  top: 0;
  width: 220px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  box-shadow: 0 10px 26px rgba(18, 22, 29, 0.1);
  cursor: grab;
  contain: layout paint;
  user-select: none;
  touch-action: none;
  will-change: transform;
}

.canvas-node.is-dragging {
  z-index: 8;
  cursor: grabbing;
  box-shadow: 0 16px 36px rgba(18, 22, 29, 0.18);
}

.canvas-node.is-active {
  border-color: rgba(10, 132, 255, 0.48);
  box-shadow: 0 12px 30px rgba(10, 132, 255, 0.16);
}

.canvas-node-layer-controls {
  position: absolute;
  left: 6px;
  top: 6px;
  z-index: 3;
  display: inline-flex;
  gap: 4px;
  opacity: 0;
  transform: translateY(-2px);
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}

.canvas-node-layer-controls button,
.canvas-node-remove {
  position: absolute;
  z-index: 3;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background: rgba(18, 22, 29, 0.82);
  color: #fff;
  font-size: 16px;
  font-weight: 760;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(18, 22, 29, 0.18);
  cursor: pointer;
}

.canvas-node-layer-controls button {
  position: static;
  font-size: 12px;
  transform: none;
}

.canvas-node-layer-controls button:hover {
  background: rgba(10, 132, 255, 0.92);
}

.canvas-node-remove {
  right: 6px;
  top: 6px;
  font-size: 16px;
  opacity: 0;
  transform: scale(0.92);
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease, background 140ms ease;
}

.canvas-node:hover .canvas-node-layer-controls,
.canvas-node.is-active .canvas-node-layer-controls,
.canvas-node-layer-controls:focus-within {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.canvas-node:hover .canvas-node-remove,
.canvas-node.is-active .canvas-node-remove,
.canvas-node-remove:focus-visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.canvas-node-remove:hover {
  background: rgba(220, 38, 38, 0.92);
}

.canvas-node img {
  width: 100%;
  height: auto;
  max-height: 320px;
  display: block;
  border-radius: 6px;
  object-fit: contain;
  background: #dde2e9;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.canvas-draw-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.canvas-draw-layer path {
  fill: none;
  stroke: #f04457;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.infinite-canvas.is-brush .canvas-draw-layer,
.infinite-canvas.is-text .canvas-draw-layer {
  pointer-events: auto;
  cursor: crosshair;
}

.canvas-text {
  position: absolute;
  z-index: 6;
  min-width: 120px;
  max-width: 320px;
  border: 1px solid rgba(10, 132, 255, 0.16);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  box-shadow: 0 10px 24px rgba(18, 22, 29, 0.08);
  cursor: grab;
  font-size: 15px;
  line-height: 1.35;
  outline: none;
  white-space: pre-wrap;
  user-select: none;
  touch-action: none;
}

.canvas-text.is-active {
  border-color: rgba(10, 132, 255, 0.5);
  box-shadow: 0 12px 30px rgba(10, 132, 255, 0.14);
}

.canvas-text.is-dragging {
  cursor: grabbing;
}

.canvas-text.is-editing {
  cursor: text;
  user-select: text;
  background: rgba(255, 255, 255, 0.94);
}

.canvas-text.is-empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}

.preview-nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: rgba(18, 22, 29, 0.82);
  font-size: 28px;
  font-weight: 680;
  line-height: 1;
  transform: translateY(-50%);
  box-shadow: 0 10px 26px rgba(18, 22, 29, 0.16);
  backdrop-filter: blur(18px) saturate(1.18);
  transition: opacity 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.preview-nav:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.9);
  color: var(--blue);
  box-shadow: 0 14px 32px rgba(18, 22, 29, 0.18);
  transform: translateY(-50%);
}

.preview-nav:active,
.preview-nav:focus-visible {
  transform: translateY(-50%);
}

.preview-nav:disabled {
  opacity: 0.32;
  cursor: default;
  box-shadow: none;
  transform: translateY(-50%);
}

.preview-prev {
  left: 12px;
}

.preview-next {
  right: 12px;
}

.preview-group-label {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  border-radius: 8px;
  padding: 5px 8px;
  background: rgba(18, 22, 29, 0.58);
  color: #fff;
  font-size: 12px;
  font-weight: 760;
  backdrop-filter: blur(16px);
}

.empty-preview {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 22px;
  color: var(--muted);
  text-align: center;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.62), rgba(239, 243, 248, 0.72)),
    #eef1f5;
}

.empty-preview strong {
  color: var(--text);
  font-size: 18px;
}

.empty-preview span {
  font-size: 13px;
}

.image-meta {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  padding: 9px 10px;
  background: rgba(18, 22, 29, 0.58);
  color: #fff;
  backdrop-filter: blur(18px);
}

.image-meta span,
.image-meta strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.edit-modal[hidden] {
  display: none !important;
}

.edit-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}

.edit-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 16, 0.58);
  backdrop-filter: blur(16px);
}

.edit-dialog {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100vw - 40px));
  max-height: min(820px, calc(100vh - 40px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 8px;
  background: rgba(250, 251, 253, 0.96);
  box-shadow: 0 28px 80px rgba(4, 8, 14, 0.28);
  overflow: hidden;
}

.edit-head {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.edit-head h2,
.edit-head p {
  margin: 0;
}

.edit-head h2 {
  font-size: 18px;
}

.edit-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.icon-button {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}

.edit-body {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
  padding: 14px;
}

.edit-preview {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(30, 33, 39, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(30, 33, 39, 0.05) 1px, transparent 1px),
    #eef1f5;
  background-size: 48px 48px;
  overflow: hidden;
}

.edit-image-wrap {
  position: relative;
  display: inline-grid;
  place-items: center;
  max-width: 100%;
  max-height: calc(100vh - 170px);
}

.edit-preview img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 170px);
  object-fit: contain;
}

#edit-draw-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

#edit-draw-canvas.is-disabled {
  pointer-events: none;
  cursor: default;
}

.edit-tools {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto minmax(180px, 1fr) auto;
  gap: 10px;
}

.brush-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.brush-tools .active {
  border-color: rgba(10, 132, 255, 0.42);
  background: rgba(10, 132, 255, 0.1);
  color: var(--blue);
}

.edit-tools label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.edit-tools textarea {
  width: 100%;
  min-width: 0;
  min-height: 220px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  color: var(--text);
  line-height: 1.58;
}

.edit-actions {
  display: grid;
  gap: 8px;
}

.edit-actions button {
  width: 100%;
  justify-content: center;
}

.result-side {
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  align-content: stretch;
  align-self: stretch;
  height: min(538px, calc(64vh + 36px));
}

.batch-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-self: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.64);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(20px);
}

.side-canvas {
  min-height: 34px;
  width: auto;
  max-width: 120px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  cursor: pointer;
  color: var(--text);
  font-size: 12px;
  font-weight: 760;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 8px 18px rgba(19, 26, 37, 0.06);
  backdrop-filter: blur(18px);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.side-canvas:hover,
.side-canvas:focus-visible {
  border-color: rgba(10, 132, 255, 0.34);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 24px rgba(10, 132, 255, 0.12);
}

.side-canvas:active,
.side-canvas.is-pressed {
  transform: translateY(1px) scale(0.99);
}

.batch-panel {
  min-height: 0;
  align-content: stretch;
  gap: 10px;
}

.batch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.batch-head h3 {
  font-size: 13px;
  line-height: 1.2;
  font-weight: 760;
}

.batch-head span {
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(10, 132, 255, 0.1);
  color: var(--blue);
  font-size: 12px;
  font-weight: 760;
}

.batch-list {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  align-self: stretch;
  gap: 9px;
  min-height: 0;
  max-height: none;
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.batch-list.empty {
  min-height: 118px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.42);
  font-size: 13px;
}

.batch-list.empty::before {
  content: "暂无批次";
}

.batch-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.66);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.batch-card.is-active {
  border-color: rgba(10, 132, 255, 0.46);
  background: rgba(10, 132, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(10, 132, 255, 0.08);
}

.batch-card.is-failed {
  border-color: rgba(201, 79, 100, 0.35);
}

.batch-card.is-done {
  border-color: rgba(38, 153, 105, 0.28);
}

.batch-card-head,
.batch-stats,
.batch-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.batch-card-head {
  justify-content: space-between;
}

.batch-title {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.batch-title em {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px;
}

.batch-card-head strong,
.batch-actions span,
.batch-stats span,
.batch-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-card-head strong {
  font-size: 12px;
  font-weight: 760;
}

.batch-actions span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 760;
}

.batch-card.is-failed .batch-actions span {
  color: var(--rose);
}

.batch-card.is-done .batch-actions span {
  color: var(--green);
}

.batch-note-button,
.batch-delete-button,
.batch-expand-toggle {
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 7px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.batch-delete-button {
  color: #b4233a;
  border-color: rgba(180, 35, 58, 0.24);
  background: rgba(180, 35, 58, 0.07);
}

.batch-prompt {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
}

.batch-card.is-expanded .batch-prompt {
  display: block;
  max-height: 128px;
  overflow: auto;
}

.batch-note {
  min-width: 0;
  overflow: hidden;
  border-radius: 7px;
  padding: 5px 7px;
  background: rgba(10, 132, 255, 0.08);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-stats {
  flex-wrap: wrap;
}

.batch-stats span {
  border-radius: 999px;
  padding: 3px 7px;
  background: rgba(18, 22, 29, 0.06);
  font-size: 12px;
  color: var(--muted);
}

.batch-stats span[data-batch-runtime] {
  background: rgba(10, 132, 255, 0.08);
  color: var(--blue);
  font-weight: 760;
}

.batch-items {
  display: grid;
  gap: 5px;
}

.batch-card:not(.is-expanded) .batch-items {
  display: none;
}

.batch-item {
  justify-content: space-between;
  border-radius: 6px;
  padding: 5px 7px;
  background: rgba(18, 22, 29, 0.04);
}

.batch-item strong,
.batch-item span {
  font-size: 11px;
}

.batch-item strong {
  color: var(--muted);
  font-weight: 720;
}

.batch-item span {
  color: var(--text);
  text-align: right;
}

.batch-item.is-failed span {
  color: var(--rose);
}

.batch-item.is-done span {
  color: var(--green);
}

.variant-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 10px;
  margin-top: 0;
}

.variant-strip.empty,
.asset-list.empty,
.queue-list.empty {
  min-height: 96px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.42);
  font-size: 13px;
}

.variant-strip.empty::before {
  content: "暂无变体";
}

.asset-list.empty::before {
  content: "暂无作品";
}

.queue-list.empty::before {
  content: "暂无任务";
}

.variant-card {
  position: relative;
  min-width: 0;
  aspect-ratio: 1 / 1;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  background: #fff;
}

.variant-card.active {
  border-color: var(--blue);
}

.variant-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  color: transparent;
  font-size: 0;
}

.variant-card span {
  position: absolute;
  left: 8px;
  bottom: 8px;
  min-width: 30px;
  border-radius: 6px;
  padding: 4px 6px;
  background: rgba(18, 22, 29, 0.62);
  color: #fff;
  font-size: 11px;
  font-weight: 760;
}

.search-box {
  margin-bottom: 10px;
}

.library-retention {
  margin: 0 0 10px;
  color: #7a4c08;
  font-size: 12px;
  line-height: 1.45;
}

.asset-list {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.asset-item {
  position: relative;
  width: 100%;
  min-height: 70px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.48);
  color: var(--text);
  text-align: left;
}

.asset-item.active {
  border-color: rgba(10, 132, 255, 0.35);
  background: rgba(10, 132, 255, 0.08);
}

.library-panel.is-selecting .asset-item {
  border-color: var(--line);
}

.library-panel.is-selecting .asset-item.active {
  border-color: rgba(10, 132, 255, 0.18);
}

.asset-item.is-selected {
  border-color: rgba(180, 35, 58, 0.48);
  background: rgba(180, 35, 58, 0.08);
  box-shadow: inset 0 0 0 1px rgba(180, 35, 58, 0.12);
}

.asset-item img {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
  color: transparent;
  font-size: 0;
}

.asset-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  display: none;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
}

.library-panel.is-selecting .asset-check {
  display: block;
}

.asset-item.is-selected .asset-check {
  border-color: #b4233a;
  background: #b4233a;
}

.asset-item.is-selected .asset-check::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 3px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.asset-item span {
  min-width: 0;
}

.asset-item strong,
.asset-item em,
.asset-item small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-item strong {
  margin-bottom: 4px;
  font-size: 13px;
}

.asset-item em {
  margin-bottom: 2px;
  color: var(--text);
  font-size: 12px;
  font-style: normal;
  font-weight: 720;
}

.asset-item small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.queue-panel {
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.queue-panel .panel-head.compact {
  align-items: flex-start;
  flex-wrap: wrap;
}

.queue-title,
.queue-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.queue-title {
  min-width: 110px;
}

.queue-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.queue-actions .ghost-button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.panel-head.compact span {
  min-width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(10, 132, 255, 0.1);
  color: var(--blue);
  font-size: 12px;
  font-weight: 760;
}

.queue-list {
  display: grid;
  gap: 9px;
}

.queue-list.is-limited .queue-item:nth-of-type(n+6) {
  display: none;
}

.queue-more-button {
  width: 100%;
  min-height: 32px;
  margin-top: 9px;
  font-size: 12px;
}

.queue-item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.56);
}

.queue-item.done progress::-webkit-progress-value {
  background: var(--green);
}

.queue-item.failed {
  border-color: rgba(201, 79, 100, 0.35);
}

.queue-item.failed span {
  color: var(--rose);
}

.queue-item.failed progress::-webkit-progress-value {
  background: var(--rose);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
}

#status-api.ok {
  color: var(--green);
}

.queue-item-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.queue-item strong,
.queue-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.queue-item span {
  color: var(--muted);
}

.queue-item-actions {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.queue-note-button,
.queue-retry-button {
  flex: 0 0 auto;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 7px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.queue-retry-button {
  display: none;
  border-color: rgba(10, 132, 255, 0.28);
  color: var(--blue);
}

.queue-item.failed .queue-retry-button {
  display: inline-flex;
  align-items: center;
}

.queue-note {
  min-width: 0;
  overflow: hidden;
  border-radius: 7px;
  padding: 5px 7px;
  background: rgba(18, 22, 29, 0.04);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-runtime {
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
  line-height: 1;
}

.queue-item.done .queue-runtime {
  color: var(--green);
}

.queue-item.failed .queue-runtime {
  color: var(--rose);
}

progress {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #e2e6ec;
}

progress::-webkit-progress-bar {
  background: #e2e6ec;
  border-radius: 999px;
}

progress::-webkit-progress-value {
  background: var(--blue);
  border-radius: 999px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 20;
  max-width: calc(100% - 32px);
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 8px;
  padding: 10px 14px;
  background: rgba(22, 25, 31, 0.82);
  color: #fff;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  font-size: 13px;
}

.toast.error {
  background: rgba(125, 30, 48, 0.88);
}

@media (max-width: 1240px) {
  .workbench {
    grid-template-columns: 330px minmax(0, 1fr);
  }

  .asset-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  body {
    height: auto;
    overflow: auto;
  }

  .app-shell {
    width: min(100% - 20px, 780px);
    height: auto;
    min-height: 100vh;
    overflow: visible;
    padding-top: 10px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workbench {
    min-height: auto;
    grid-template-columns: minmax(0, 1fr);
  }

  .results-workspace {
    overflow: visible;
  }

  .panel,
  .stage-panel {
    max-height: none;
    overflow: visible;
  }

  .canvas-shell {
    min-height: 520px;
    padding: 16px;
  }

  .preview-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .result-side {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    align-content: start;
    height: auto;
  }

  .batch-panel {
    min-height: 180px;
    max-height: min(58vh, 480px);
  }

  .batch-list {
    max-height: none;
  }

  .edit-modal {
    padding: 12px;
  }

  .edit-dialog {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }

  .edit-body {
    grid-template-columns: minmax(0, 1fr);
    overflow: auto;
  }

  .edit-preview {
    min-height: 320px;
  }

  .edit-preview img {
    max-height: 54vh;
  }

  .asset-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .status-strip,
  .field-grid,
  .dimension-row,
  .asset-list,
  .template-grid,
  .template-grid.compact {
    grid-template-columns: minmax(0, 1fr);
  }

  .ratio-grid,
  .chip-grid,
  .play-grid,
  .batch-grid,
  .checkbox-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stage-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .stage-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .stage-actions .side-canvas {
    max-width: 120px;
    flex: 0 0 auto;
  }

  .preview-context {
    min-width: 0;
    flex-basis: 100%;
  }

  .preview-context em {
    justify-self: start;
  }

  .view-switcher {
    width: 100%;
  }

  .tool-buttons {
    justify-content: flex-end;
  }

  .canvas-shell {
    min-height: 380px;
  }

  .variant-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-side {
    grid-template-columns: minmax(0, 1fr);
  }

  .batch-list {
    max-height: 300px;
  }

  .image-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}


body.auth-locked .app-shell { display: none; }
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at top left, rgba(45, 132, 255, .14), transparent 34%), #f6f7fb;
}
.auth-card {
  width: min(420px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255,255,255,.9);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}
.auth-logo { width: 190px; height: 54px; object-fit: contain; object-position: left center; margin-bottom: 18px; }
.auth-card h1 { font-size: 28px; margin-bottom: 8px; }
.auth-card p { color: var(--muted); line-height: 1.6; margin-bottom: 20px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 4px; border-radius: 14px; background: #eef1f6; margin-bottom: 18px; }
.auth-tabs button { border: 0; border-radius: 11px; padding: 10px; background: transparent; font-weight: 700; cursor: pointer; }
.auth-tabs button.active { background: #fff; box-shadow: 0 4px 18px rgba(20,28,40,.08); }
.auth-form { display: grid; gap: 14px; }
.auth-form label { display: grid; gap: 7px; font-weight: 650; color: var(--text); }
.auth-form input { height: 42px; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; font: inherit; }
.auth-form.is-hidden, .is-hidden { display: none !important; }
#auth-message { display: block; min-height: 20px; margin-top: 12px; color: #d33; font-style: normal; }
.quota-pill { min-height: 36px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 999px; background: #eef6ff; color: #0a64d8; font-weight: 750; border: 1px solid #cfe3ff; }
.admin-modal { position: fixed; inset: 0; z-index: 1000; background: rgba(13, 18, 28, .42); padding: 24px; overflow: auto; }
.admin-card { max-width: 1120px; margin: 40px auto; background: #fff; border-radius: 22px; box-shadow: var(--shadow-soft); padding: 22px; }
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.admin-head strong { display:block; font-size: 22px; }
.admin-head span { color: var(--muted); font-size: 13px; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.admin-list { display: grid; gap: 10px; max-height: 62vh; overflow: auto; }
.admin-item { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: #fafbfe; display: grid; gap: 8px; }
.admin-item header { display:flex; justify-content:space-between; gap: 10px; align-items:center; }
.admin-item small { color: var(--muted); }
.admin-actions { display:flex; gap: 8px; flex-wrap: wrap; }
.admin-actions input { width: 86px; height: 34px; border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; }
@media (max-width: 860px) { .admin-grid { grid-template-columns: 1fr; } .top-actions { flex-wrap: wrap; justify-content: flex-end; } }


#main-preview { cursor: zoom-in; }
.lightbox-modal { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: 24px; }
.lightbox-modal[hidden] { display: none !important; }
.lightbox-backdrop { position: absolute; inset: 0; background: rgba(8, 12, 20, .78); backdrop-filter: blur(10px); }
.lightbox-dialog { position: relative; width: min(96vw, 1280px); height: min(92vh, 960px); display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 12px; }
.lightbox-dialog img { width: 100%; height: 100%; min-height: 0; object-fit: contain; border-radius: 18px; background: rgba(255,255,255,.08); box-shadow: 0 28px 90px rgba(0,0,0,.35); }
.lightbox-close { position: absolute; right: -10px; top: -10px; z-index: 2; width: 42px; height: 42px; border: 0; border-radius: 50%; background: #fff; color: #111; font-size: 28px; line-height: 1; cursor: pointer; box-shadow: 0 10px 30px rgba(0,0,0,.28); }
.lightbox-caption { display: flex; align-items: center; gap: 12px; color: #fff; justify-content: center; flex-wrap: wrap; }
.lightbox-caption span { color: rgba(255,255,255,.74); }
.lightbox-caption a { color: #fff; text-decoration: underline; }
