:root {
  color-scheme: light;
  --ink: #292837;
  --muted: #7b7288;
  --line: #eceaf1;
  --line-strong: #ded9e8;
  --purple: #8a58dd;
  --purple-deep: #7342c5;
  --purple-soft: #f2ecfc;
  --pink: #e992c9;
  --surface: #ffffff;
  --canvas: #f8f7fb;
  --sidebar: 164px;
  --config: 440px;
  --radius: 12px;
  font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-synthesis: none;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--canvas);
}

.workspace.single-panel { grid-template-columns: minmax(0, 1fr); }
.workspace.single-panel .result-panel { grid-column: 1; }
#result-content { flex:1; min-height:0; display:flex; flex-direction:column; overflow-y:auto; }
.product-slot-grid.single-slot { grid-template-columns:minmax(0,1fr); }
.upload-count { position:absolute; top:7px; left:7px; z-index:2; padding:3px 7px; border-radius:5px; background:#fffffff0; color:#7045b3; font-size:12px; }
.file-info strong, .file-info span, .file-info small { display:block; overflow:hidden; text-overflow:ellipsis; }
.config-code { max-height:360px; padding:16px; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere; border:1px solid var(--line); border-radius:9px; background:#faf9fc; color:#554b63; font:14px/1.7 ui-monospace,monospace; }
.task-head strong, .task-head small { display:block; }
.task-head small { margin-top:3px; color:var(--muted); font-size:13px; }
.asset-filters { flex-wrap:wrap; margin:22px 0; }
.sidebar-status { display:flex; align-items:center; gap:7px; color:#66566f; font-size:13px; }
.sidebar-status i { width:6px; height:6px; border-radius:50%; background:#69b29a; }
.upload-zone.target-upload:not(.is-filled) { display:grid; grid-template-columns:42px minmax(0,1fr); gap:4px 14px; align-content:center; align-items:center; padding:18px 20px; text-align:left; }
.target-upload:not(.is-filled)>.upload-icon { grid-column:1; grid-row:1/5; }
.target-upload:not(.is-filled)>.upload-title { grid-column:2; font-size:15px; line-height:1.6; }
.target-upload:not(.is-filled)>.upload-hint { grid-column:2; font-size:13px; line-height:1.6; }
.target-upload:not(.is-filled)>.upload-actions { grid-column:2; display:flex; flex-direction:row; gap:7px; justify-content:flex-start; }
.target-upload .upload-actions button { min-width:48px; white-space:nowrap; }
.empty-decoration { position:absolute; display:grid; place-items:center; width:36px; height:36px; border:1px solid #e9def7; border-radius:10px; background:#fff; color:#9464d0; box-shadow:0 6px 16px #9567db12; }
.empty-decoration.one { left:24px; top:36px; transform:rotate(-12deg); }
.empty-decoration.two { right:16px; bottom:20px; transform:rotate(10deg); }

* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; }
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button, a, label.upload-zone { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button { color: inherit; }
button:disabled { cursor: not-allowed; opacity: .5; }
button, input, textarea, select { outline: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, .upload-zone:focus-visible, summary:focus-visible {
  outline: 3px solid #b49ae7;
  outline-offset: 3px;
}
button svg, a svg, .tool-icon svg, .upload-icon svg { display: block; }
a { color: var(--purple-deep); text-decoration: none; }
button { border: 0; background: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, p { margin: 0; }
svg { flex-shrink: 0; }
.hidden, [hidden] { display: none !important; }
.muted { color: var(--muted); }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.studio-shell {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  grid-template-rows: 70px minmax(0, 1fr);
  overflow: hidden;
}
.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 42px;
  padding: 0 28px 0 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-mark {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(142deg, #b584f0, #8754da);
  color: white;
  box-shadow: 0 4px 10px #9567db20;
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-copy { display: flex; flex-direction: column; }
.brand-copy strong { font-size: 19px; line-height: 1.35; letter-spacing: -.5px; }
.brand-copy span { margin-top: 2px; color: #aba5b7; font-size: 11px; letter-spacing: 1.7px; }
.primary-nav { display: flex; align-self: stretch; align-items: stretch; gap: 30px; }
.nav-button {
  position: relative;
  padding: 0 2px;
  color: #7c7888;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  transition: color .18s;
}
.nav-button:hover { color: var(--purple); }
.nav-button.is-active { color: var(--purple); font-weight: 600; }
.nav-button.is-active::after {
  content: '';
  position: absolute;
  height: 3px;
  width: 24px;
  border-radius: 4px 4px 0 0;
  background: var(--purple);
  left: calc(50% - 12px);
  bottom: 0;
}
.account-actions { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.preview-badge {
  border: 1px solid #e6dbf7;
  border-radius: 5px;
  color: #9461d7;
  padding: 3px 9px;
  font-size: 13px;
  white-space: nowrap;
  background: #fcfaff;
}
.help-button { display: inline-flex; align-items: center; gap: 6px; color: #837f91; font-size: 14px; padding: 5px 0; }
.help-button svg { width: 16px; height: 16px; }
.help-button:hover { color: var(--purple); }

.tool-sidebar {
  grid-column: 1;
  grid-row: 2;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 25px 12px 16px;
  border-right: 1px solid var(--line);
  background: #fcfbfe;
}
.sidebar-heading { color: #aaa5b5; font-size: 12px; padding: 0 14px; margin-bottom: 13px; letter-spacing: 1px; }
.tool-nav { display: flex; flex-direction: column; gap: 7px; }
.tool-link {
  display: flex;
  gap: 11px;
  align-items: center;
  text-align: left;
  width: 100%;
  min-height: 58px;
  padding: 11px 13px;
  border-radius: 9px;
  color: #847d94;
  transition: background .16s, color .16s;
}
.tool-link:hover { color: var(--purple); background: #f6f2fc; }
.tool-link.is-active { background: #eee6fa; color: var(--purple-deep); }
.tool-icon { flex: 0 0 21px; display: grid; place-items: center; }
.tool-icon svg { width: 21px; height: 21px; }
.tool-copy { display: flex; flex-direction: column; gap: 2px; }
.tool-copy strong { font-size: 14px; font-weight: 500; line-height: 1.4; }
.tool-copy small { font-size: 11px; color: #b0a8bd; line-height: 1.4; }
.tool-link.is-active .tool-copy strong { font-weight: 600; }
.tool-link.is-active .tool-copy small { color: #a483cd; }
.sidebar-footer { margin-top: auto; padding: 19px 13px 3px; font-size: 12px; color: #b2acbe; line-height: 1.8; }
.sidebar-footer strong { color: #928b9f; font-weight: 500; }
.sidebar-footer svg { width: 15px; height: 15px; display: inline-block; vertical-align: -3px; margin-right: 4px; }

.workspace {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--config) minmax(0, 1fr);
}
.config-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: white; border-right: 1px solid var(--line); }
.panel-header { padding: 26px 27px 21px; border-bottom: 1px solid #f0eef5; flex-shrink: 0; }
.eyebrow { color: #a398b3; font-size: 11px; letter-spacing: 1.8px; margin-bottom: 6px; }
.panel-header h1 { font-size: 24px; letter-spacing: -.4px; line-height: 1.4; font-weight: 600; }
.panel-header h1 svg { width: 21px; height: 21px; display: inline-block; vertical-align: -2px; margin-left: 6px; color: var(--purple); }
.panel-description { margin-top: 7px; color: #9992a6; font-size: 13px; }
.parameter-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 0 27px 22px; scrollbar-width: thin; scrollbar-color: #e3ddeb transparent; }
.parameter-scroll::-webkit-scrollbar { width: 5px; }
.parameter-scroll::-webkit-scrollbar-thumb { background: #e3ddeb; border-radius: 4px; }
.form-section { padding-top: 22px; }
.section-heading { display: flex; gap: 7px; align-items: center; margin: 0 0 12px; min-height: 20px; }
.section-heading h2, .section-heading h3 { font-size: 14px; font-weight: 600; }
.section-heading > span:last-child:not(.step-chip) { margin-left: auto; color: #aba3b6; font-size: 12px; font-weight: 400; }
.step-chip { width: 18px; height: 18px; border-radius: 5px; background: var(--purple-soft); color: #9a76ce; font-size: 12px; display: inline-grid; place-items: center; font-weight: 600; }
.optional-badge { background: #f6f4f8; padding: 1px 6px; border-radius: 4px; color: #b0a8bb; font-size: 11px; font-weight: 400; }
.source-tabs { background: #f6f4f9; border-radius: 7px; padding: 3px; display: flex; margin-bottom: 13px; }
.source-tabs button { flex: 1; color: #a097af; padding: 6px 8px; border-radius: 5px; font-size: 12px; }
.source-tabs button.is-active { background: white; color: var(--purple-deep); box-shadow: 0 1px 4px #3f205b08; font-weight: 500; }
.product-slot-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.upload-zone {
  position: relative;
  min-width: 0;
  min-height: 153px;
  border: 1px dashed #ded6e9;
  border-radius: 9px;
  background: #fcfaff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 13px 7px 11px;
  text-align: center;
  transition: border-color .18s, background .18s, box-shadow .18s;
  cursor: pointer;
  overflow: hidden;
}
.upload-zone:hover, .upload-zone.is-dragging { border-color: #a37ce0; background: #f7f1ff; }
.upload-zone.is-dragging { box-shadow: 0 0 0 3px #a37ce017; }
.upload-icon { width: 31px; height: 31px; display: grid; place-items: center; color: #b7a5ce; margin-bottom: 9px; }
.upload-icon svg { width: 30px; height: 30px; stroke-width: 1.4; }
.upload-title { font-size: 13px; font-weight: 500; color: #786886; line-height: 1.7; }
.upload-hint { margin-top: 4px; color: #b4a9bf; font-size: 11px; line-height: 1.65; }
.upload-actions { display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: 11px; }
.upload-actions button { padding: 3px 8px; font-size: 11px; border: 1px solid #e7ddf4; border-radius: 4px; color: #a083c3; background: white; line-height: 1.6; }
.upload-actions button:hover { border-color: #ba9be2; color: var(--purple); }
.role-note { display: flex; gap: 6px; margin-top: 10px; color: #b0a7bc; font-size: 11px; line-height: 1.7; }
.role-note svg { width: 13px; height: 13px; margin-top: 2px; color: #b4a4ca; }
.target-upload { min-height: 139px; background: #fdfcfe; flex-direction: row; gap: 17px; }
.target-upload .upload-icon { margin: 0; width: 42px; height: 42px; background: #f4eefc; border-radius: 10px; }
.target-upload .upload-icon svg { width: 24px; height: 24px; }
.target-upload .upload-title, .target-upload .upload-hint { text-align: left; }
.target-upload .upload-actions { justify-content: flex-start; margin-top: 9px; }
.target-upload > .upload-actions { flex-direction: column; }
.upload-zone.is-filled { padding: 0; border-style: solid; background: #faf8fc; }
.uploaded-thumb { width: 100%; height: 100%; position: absolute; inset: 0; }
.uploaded-thumb img { width: 100%; height: 100%; object-fit: contain; }
.is-filled .upload-title, .is-filled .upload-icon, .is-filled .upload-hint, .is-filled .upload-actions { display: none; }
.remove-image { position: absolute; z-index: 2; right: 5px; top: 5px; width: 21px; height: 21px; display: grid; place-items: center; background: #ffffffec; border: 1px solid #e9e4f1; border-radius: 50%; color: #8d7d9f; }
.remove-image svg { width: 12px; height: 12px; }
.remove-image:hover { color: #c35578; background: white; }
.file-info { position: absolute; z-index: 1; bottom: 0; left: 0; right: 0; padding: 5px 7px; background: #ffffffed; color: #897a9c; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-top: 1px solid #eee8f5; }
.setting-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 13px; }
.setting-grid label { color: #9790a2; font-size: 12px; display: flex; flex-direction: column; gap: 6px; }
select, textarea, input[type='text'], input[type='number'] { width: 100%; border: 1px solid #e8e3ef; border-radius: 7px; background: #fff; color: #6f657d; transition: border-color .16s, box-shadow .16s; }
select { min-height: 36px; padding: 7px 29px 7px 10px; font-size: 13px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 14 14' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m4 5.5 3 3 3-3' stroke='%23b4aabe' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
select:hover, textarea:hover { border-color: #cfc1e2; }
textarea { resize: vertical; min-height: 82px; padding: 11px 12px; font-size: 13px; line-height: 1.8; }
textarea::placeholder { color: #b8afc4; }
input[type='text'], input[type='number'] { min-height: 36px; padding: 7px 10px; }
.segmented { display: flex; gap: 6px; }
.segmented button { flex: 1; min-height: 32px; border: 1px solid #e8e3ef; border-radius: 6px; color: #a498b2; font-size: 12px; background: white; }
.segmented button:hover { border-color: #c5a9e7; color: var(--purple); }
.segmented button.is-active { border-color: #c8b1eb; background: #f6f0ff; color: var(--purple); font-weight: 500; }
.advanced-panel { margin-top: 17px; border-top: 1px solid #f0ecf5; padding-top: 14px; }
.advanced-panel summary { cursor: pointer; color: #a195ad; font-size: 12px; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.advanced-panel summary::after { content: '+'; font-size: 17px; color: #b7a8c7; }
.advanced-panel[open] summary::after { content: '−'; }
.advanced-panel > :not(summary) { margin-top: 12px; }
.advanced-panel p { font-size: 12px; color: #a89db3; }
.form-error { color: #bb5871; font-size: 12px; margin-top: 12px; padding: 8px 10px; border: 1px solid #f1dce2; border-radius: 6px; background: #fff8fa; }
.generate-bar { flex-shrink: 0; background: white; padding: 17px 27px 20px; border-top: 1px solid var(--line); box-shadow: 0 -4px 10px #3c145803; }
.generation-summary { display: flex; justify-content: space-between; color: #ada3b8; font-size: 12px; margin-bottom: 11px; }
.generation-summary strong { font-weight: 500; color: #8f7ea6; }
.generate-button { width: 100%; min-height: 43px; display: flex; align-items: center; justify-content: center; gap: 7px; color: white; font-weight: 500; font-size: 14px; border-radius: 8px; background: linear-gradient(100deg, #8751d1, #8146ca); box-shadow: 0 4px 12px #9365d926; transition: filter .18s, transform .18s; }
.generate-button svg { width: 16px; height: 16px; }
.generate-button:hover:not(:disabled) { filter: brightness(1.04); transform: translateY(-1px); }
.generate-button:active:not(:disabled) { transform: translateY(0); }

.result-panel { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 26px 31px 24px; background: var(--canvas); overflow: hidden; }
.result-toolbar { display: flex; gap: 15px; justify-content: space-between; align-items: center; flex-shrink: 0; min-height: 36px; margin-bottom: 16px; }
.result-title { display: flex; align-items: center; gap: 9px; }
.result-title h2 { font-size: 17px; font-weight: 600; }
.result-title > span, .result-title p { color: #b1a7bf; font-size: 12px; }
.result-title svg { width: 17px; height: 17px; color: #9e8cb6; }
.result-actions { display: flex; align-items: center; gap: 7px; }
.secondary-button { display: inline-flex; justify-content: center; align-items: center; gap: 6px; min-height: 29px; padding: 5px 10px; border: 1px solid #e5dfed; background: white; color: #9b8cab; font-size: 12px; border-radius: 6px; white-space: nowrap; transition: color .18s, border-color .18s; }
.secondary-button svg { width: 13px; height: 13px; }
.secondary-button:hover:not(:disabled) { border-color: #c6a7e9; color: var(--purple); }
.icon-button { width: 29px; height: 29px; display: grid; place-items: center; border: 1px solid #e5dfed; background: white; border-radius: 6px; color: #b5a9c4; }
.icon-button svg { width: 14px; height: 14px; }
.icon-button:hover:not(:disabled) { color: var(--purple); border-color: #c6a7e9; }
.pill { display: inline-flex; align-items: center; min-height: 20px; padding: 2px 7px; border-radius: 5px; background: #efe7fa; color: #a17bcf; font-size: 11px; white-space: nowrap; }
.result-empty {
  flex: 1;
  min-height: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 1px solid #eeeaf5;
  border-radius: 13px;
  background: radial-gradient(ellipse at 50% 44%, #f3eefb 0%, #faf8fd 42%, #fff 78%);
  padding: 38px 25px 50px;
  text-align: center;
  overflow: hidden;
}
.empty-visual { position: relative; width: 210px; height: 180px; display: grid; place-items: center; margin-bottom: 21px; isolation: isolate; }
.empty-visual::before { content: ''; position: absolute; width: 160px; height: 160px; border-radius: 50%; background: #eee5fb55; inset: 10px 25px; z-index: -2; }
.empty-orbit { position: absolute; inset: 22px 3px; border: 1px dashed #daccf0; border-radius: 50%; transform: rotate(-21deg); opacity: .7; z-index: -1; }
.empty-orbit::before, .empty-orbit::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #cbb4eb; position: absolute; top: 13px; left: 33px; box-shadow: 0 0 0 5px #f7f2fc; }
.empty-orbit::after { top: auto; left: auto; bottom: 11px; right: 35px; width: 4px; height: 4px; background: #e7badc; }
.empty-icon { width: 105px; height: 125px; display: grid; place-items: center; color: #b194d9; border: 1px solid #eee6f8; background: linear-gradient(155deg, #fff, #f5edfc); border-radius: 11px; box-shadow: 0 10px 30px #8855c512; transform: rotate(-5deg); position: relative; }
.empty-icon::before, .empty-icon::after { content: ''; position: absolute; inset: 9px -16px 9px 12px; border: 1px solid #ece3f7; background: #ffffffa6; border-radius: 10px; z-index: -1; transform: rotate(10deg); }
.empty-icon::after { inset: 16px 8px 16px -16px; transform: rotate(-11deg); z-index: -2; background: #f7effc; }
.empty-icon > svg { width: 73px; height: 92px; stroke-width: 1; }
.empty-visual > svg { width: 190px; height: 175px; }
.result-empty h2 { font-size: 18px; font-weight: 500; color: #8c7c9e; letter-spacing: .2px; }
.result-empty > p { font-size: 13px; color: #b1a2c0; margin-top: 9px; max-width: 350px; line-height: 1.9; }
.empty-features { display: flex; gap: 16px; align-items: center; justify-content: center; margin-top: 24px; color: #b4a3c5; font-size: 11px; flex-wrap: wrap; }
.empty-features span { display: inline-flex; gap: 5px; align-items: center; }
.empty-features svg { width: 12px; height: 12px; }
.empty-features span + span { padding-left: 16px; border-left: 1px solid #e8dff1; }
.preview-notice { flex-shrink: 0; padding: 10px 0 0; color: #b8adbf; font-size: 11px; text-align: center; line-height: 1.7; }
.preview-notice svg { width: 11px; height: 11px; display: inline-block; vertical-align: -2px; margin-right: 3px; }

.task-board { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 13px; padding-right: 3px; scrollbar-width: thin; scrollbar-color: #e0d7ec transparent; }
.task-card { padding: 16px; border: 1px solid #e8e1f1; border-radius: 10px; background: white; }
.task-head { display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.task-head h3 { font-size: 14px; font-weight: 500; }
.task-head p { color: #ac9cbb; font-size: 11px; margin-top: 3px; }
.task-status { font-size: 11px; color: #ab83d7; background: #f4ecff; border-radius: 5px; padding: 3px 8px; white-space: nowrap; }
.task-status.is-complete { background: #eef7f2; color: #6aa489; }
.task-status.is-error { background: #fff0f4; color: #c6778e; }
.task-reference-strip { display: flex; gap: 6px; padding: 12px 0; }
.task-reference-strip img { width: 42px; height: 50px; object-fit: contain; border: 1px solid #ede5f4; border-radius: 5px; background: #faf7fd; }
.task-reference-strip span { font-size: 11px; color: #b3a3c2; align-self: center; margin-left: 5px; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px 13px; font-size: 11px; color: #ad9bbb; }
.task-actions { display: flex; gap: 6px; justify-content: flex-end; padding-top: 12px; }
.task-card progress { width: 100%; height: 4px; appearance: none; border: 0; display: block; margin: 13px 0 5px; border-radius: 4px; overflow: hidden; }
.task-card progress::-webkit-progress-bar { background: #f1eaf9; }
.task-card progress::-webkit-progress-value { background: #b991ec; }
.task-card progress::-moz-progress-bar { background: #b991ec; }
.result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; min-height: 0; align-content: start; }
.result-panel > .result-grid { flex: 1; overflow-y: auto; padding-right: 3px; }
.task-card .result-grid { margin-top: 13px; }
.result-card { min-width: 0; border: 1px solid #e8e1ef; background: white; border-radius: 9px; overflow: hidden; }
.result-thumb { position: relative; width: 100%; aspect-ratio: 3 / 4; background: #f4eff9; overflow: hidden; }
.result-thumb img { width: 100%; height: 100%; object-fit: cover; }
.result-thumb .pill { position: absolute; top: 9px; left: 9px; background: #ffffffdb; color: #a286ba; }
.result-card-info { padding: 10px 11px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.result-card-info h3 { font-size: 12px; font-weight: 500; }
.result-card-info p { font-size: 11px; color: #b7a7c5; margin-top: 2px; }
.result-card-info button { flex-shrink: 0; }
.module-home { flex: 1; overflow-y: auto; padding-top: 10px; }
.module-home > h2 { font-size: 23px; font-weight: 500; color: #756087; margin-bottom: 8px; }
.module-home > p { font-size: 13px; color: #ad9fba; margin-bottom: 23px; }
.feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.feature-card { border: 1px solid #e6dcef; padding: 22px; border-radius: 11px; background: white; text-align: left; }
.feature-card:hover { border-color: #cbb0ea; box-shadow: 0 6px 19px #845cb509; }
.feature-card svg { width: 30px; height: 30px; color: #b68ce5; margin-bottom: 15px; }
.feature-card h3 { font-size: 15px; font-weight: 500; color: #887399; }
.feature-card p { font-size: 12px; color: #b3a3c0; margin-top: 6px; line-height: 1.8; }

.toast { position: fixed; z-index: 50; left: 50%; bottom: 30px; transform: translate(-50%, 10px); max-width: calc(100vw - 32px); padding: 10px 19px; border: 1px solid #e8dff2; border-radius: 8px; color: #857090; background: #fffffff5; box-shadow: 0 8px 30px #6441851a; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.modal-backdrop { position: fixed; z-index: 30; inset: 0; background: #3220424d; backdrop-filter: blur(3px); display: flex; justify-content: center; align-items: center; padding: 24px; }
.modal { width: min(680px, 100%); max-height: calc(100dvh - 48px); padding: 24px; background: white; border: 1px solid #ece3f7; border-radius: 15px; box-shadow: 0 20px 80px #30144520; overflow: auto; }
.modal-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.modal-heading h2 { font-size: 19px; font-weight: 500; color: #756183; }
.modal-heading p { font-size: 13px; color: #ac9ab8; }
.modal-close { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 7px; color: #9a84ab; background: #f7f1fc; font-size: 21px; }
.modal-close svg { width: 16px; height: 16px; }
.gallery-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.gallery-item { border: 1px solid #e8e0f2; padding: 0; border-radius: 9px; overflow: hidden; text-align: left; background: #fcf9ff; }
.gallery-item img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.gallery-item span { display: block; padding: 8px 10px; color: #9a81aa; font-size: 12px; }
.gallery-item:hover { border-color: #b386de; box-shadow: 0 4px 14px #9066bc14; }
.modal > p, .modal > ul { color: #a18aaa; font-size: 14px; line-height: 1.9; }

/* Small interface copy stays legible against the pale workspace surfaces. */
.nav-button, .help-button, .sidebar-heading, .tool-copy small,
.tool-link.is-active .tool-copy small, .sidebar-footer,
.eyebrow, .panel-description, .section-heading > span:last-child:not(.step-chip),
.optional-badge, .source-tabs button, .upload-title, .upload-hint,
.upload-actions button, .role-note, .file-info, .setting-grid label,
.segmented button, .advanced-panel summary, .advanced-panel p,
.generation-summary, .generation-summary strong,
.result-title > span, .result-title p, .secondary-button, .pill,
.result-empty h2, .result-empty > p, .empty-features, .preview-notice,
.task-head p, .task-meta, .task-reference-strip span,
.result-card-info p, .module-home > p, .feature-card p,
.modal-heading p, .gallery-item span, .modal > p, .modal > ul {
  color: #776984;
}
textarea::placeholder { color: #81728e; }
.nav-button.is-active, .tool-link.is-active, .source-tabs button.is-active,
.segmented button.is-active { color: var(--purple-deep); }
.task-status { color: #7a4fa9; }
.task-status.is-complete { color: #3d7560; }
.task-status.is-error { color: #9a4263; }

@media (min-width: 1600px) {
  :root { --sidebar: 180px; --config: 464px; }
  .topbar { gap: 65px; padding-left: 26px; }
  .primary-nav { gap: 36px; }
  .parameter-scroll { padding-left: 30px; padding-right: 30px; }
  .panel-header, .generate-bar { padding-left: 30px; padding-right: 30px; }
  .result-panel { padding-left: 39px; padding-right: 39px; }
  .result-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .empty-visual { transform: scale(1.13); margin-bottom: 37px; }
}
@media (max-width: 1279px) {
  :root { --sidebar: 148px; --config: 390px; }
  .topbar { gap: 30px; padding-right: 20px; }
  .primary-nav { gap: 23px; }
  .tool-sidebar { padding-left: 9px; padding-right: 9px; }
  .tool-link { gap: 9px; padding-left: 11px; padding-right: 10px; }
  .panel-header, .generate-bar { padding-left: 22px; padding-right: 22px; }
  .parameter-scroll { padding-left: 22px; padding-right: 22px; }
  .result-panel { padding-left: 23px; padding-right: 23px; }
  .product-slot-grid { gap: 7px; }
  .upload-zone { min-height: 148px; }
  .upload-actions { gap: 3px; }
  .upload-actions button { padding: 3px 6px; }
}
@media (max-width: 1099px) {
  :root { --sidebar: 72px; --config: 366px; }
  .brand-copy span { display: none; }
  .brand-copy strong { font-size: 17px; }
  .brand-mark { width: 31px; height: 31px; border-radius: 9px; }
  .topbar { gap: 28px; padding-left: 18px; }
  .primary-nav { gap: 20px; }
  .nav-button { font-size: 14px; }
  .account-actions { gap: 9px; }
  .sidebar-heading { font-size: 11px; padding: 0; text-align: center; letter-spacing: 0; }
  .tool-sidebar { padding: 22px 8px 14px; }
  .tool-link { min-height: 58px; flex-direction: column; gap: 5px; padding: 10px 2px; }
  .tool-copy strong { font-size: 10px; }
  .tool-copy small, .sidebar-footer { display: none; }
  .tool-nav { gap: 7px; }
  .panel-header, .generate-bar { padding-left: 20px; padding-right: 20px; }
  .parameter-scroll { padding-left: 20px; padding-right: 20px; }
  .result-panel { padding-left: 18px; padding-right: 18px; }
  .result-toolbar { align-items: flex-start; }
  .result-actions { gap: 4px; }
  .result-title { gap: 6px; }
  .result-title > span { display: none; }
  .result-title h2 { font-size: 16px; }
  .result-actions .secondary-button { padding: 5px 7px; font-size: 11px; }
}
@media (max-width: 859px) {
  .studio-shell { grid-template-columns: 1fr; grid-template-rows: 64px 60px minmax(0, 1fr); }
  .topbar { padding: 0 17px; gap: 22px; }
  .primary-nav { gap: 17px; }
  .account-actions .preview-badge { padding: 2px 6px; font-size: 11px; }
  .help-button { font-size: 0; gap: 0; }
  .help-button svg { width: 17px; height: 17px; }
  .tool-sidebar { grid-column: 1; grid-row: 2; padding: 7px 14px; border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; overflow-x: auto; }
  .sidebar-heading { display: none; }
  .tool-nav { flex-direction: row; align-items: center; gap: 5px; width: 100%; }
  .tool-link { width: auto; flex: 1; flex-direction: row; min-height: 39px; padding: 7px 10px; gap: 7px; justify-content: center; white-space: nowrap; }
  .tool-icon { flex-basis: 17px; }
  .tool-icon svg { width: 17px; height: 17px; }
  .tool-copy strong { font-size: 12px; }
  .workspace { grid-column: 1; grid-row: 3; grid-template-columns: minmax(320px, 45%) minmax(0, 1fr); }
  .result-panel { padding: 22px 16px 17px; }
  .result-toolbar { margin-bottom: 12px; }
  .result-actions .secondary-button svg { display: none; }
  .result-actions .icon-button { display: none; }
  .result-empty { padding: 30px 15px; }
  .empty-visual { transform: scale(.85); margin-bottom: 4px; }
  .result-empty h2 { font-size: 16px; }
  .result-empty > p { font-size: 12px; }
  .empty-features { gap: 8px; }
  .empty-features span + span { border: 0; padding: 0; }
  .result-grid, .feature-grid { grid-template-columns: 1fr; }
}
@media (max-width: 639px) {
  .studio-shell { height: auto; min-height: 100dvh; display: block; overflow: visible; }
  .topbar { min-height: 61px; gap: 14px; flex-wrap: wrap; padding: 12px 17px 0; position: sticky; top: 0; }
  .brand { gap: 8px; }
  .brand-copy strong { font-size: 17px; }
  .brand-mark { width: 30px; height: 30px; }
  .account-actions { order: 1; }
  .primary-nav { order: 2; flex-basis: 100%; height: 42px; justify-content: flex-start; gap: 26px; overflow-x: auto; }
  .nav-button { font-size: 13px; }
  .tool-sidebar { padding: 8px 12px; }
  .tool-nav { gap: 5px; }
  .tool-link { padding: 8px; flex-direction: column; gap: 4px; min-width: 63px; border-radius: 7px; }
  .tool-copy strong { font-size: 11px; }
  .tool-icon svg { width: 19px; height: 19px; }
  .workspace { display: flex; flex-direction: column; }
  .config-panel { border-right: 0; }
  .panel-header { padding: 24px 22px 20px; }
  .panel-header h1 { font-size: 23px; }
  .parameter-scroll { overflow: visible; padding: 0 22px 22px; }
  .form-section { padding-top: 22px; }
  .product-slot-grid { gap: 9px; }
  .upload-zone { min-height: 155px; }
  .target-upload { min-height: 132px; }
  .upload-actions button { padding: 3px 7px; }
  .generate-bar { padding: 15px 22px 20px; }
  .generate-button { min-height: 45px; }
  .result-panel { min-height: 505px; padding: 24px 18px 20px; border-top: 1px solid var(--line); overflow: visible; }
  .result-toolbar { margin-bottom: 15px; }
  .result-title h2 { font-size: 17px; }
  .result-title > span { display: inline; }
  .result-actions .icon-button { display: grid; }
  .result-actions .secondary-button svg { display: block; }
  .result-empty { min-height: 390px; padding: 28px 18px 38px; }
  .empty-visual { transform: none; margin-bottom: 15px; }
  .result-empty h2 { font-size: 18px; }
  .result-empty > p { font-size: 13px; }
  .result-grid, .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-board { overflow: visible; }
  .task-card { padding: 13px; }
  .feature-card { padding: 17px; }
  .modal-backdrop { padding: 16px; }
  .modal { padding: 19px; max-height: calc(100dvh - 32px); }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
}
@media (max-width: 359px) {
  .account-actions { gap: 7px; }
  .preview-badge { display: none; }
  .panel-header, .generate-bar { padding-left: 16px; padding-right: 16px; }
  .parameter-scroll { padding-left: 16px; padding-right: 16px; }
  .product-slot-grid { gap: 6px; }
  .upload-title { font-size: 12px; }
  .upload-actions button { padding: 3px 5px; font-size: 10px; }
  .empty-features { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (max-width: 1099px) {
  .help-button { font-size:12px; width:auto; min-width:48px; padding:4px 6px; }
}
@media (max-width: 639px) {
  #result-content { flex:0 1 auto; overflow:visible; }
}

/* Member account and the live service state. */
.brand-mark { position: relative; font-size: 25px; line-height: 1; font-weight: 700; }
.brand-mark > span { position: absolute; right: 4px; top: 3px; font-size: 12px; color: #f9e0f3; }
.brand-copy small { margin-top: 3px; font-size: 11px; letter-spacing: 1px; color: #81728e; }
.account-actions { gap: 13px; flex-shrink: 0; }
.account-guest, .account-member { display: flex; align-items: center; gap: 8px; }
.account-button { min-height: 29px; padding: 5px 8px; border-radius: 6px; color: #796789; font-size: 13px; white-space: nowrap; }
.account-button:hover { background: #f5eefc; color: #7342c5; }
.account-button.is-primary { color: white; background: #8751d1; padding: 5px 13px; }
.account-button.is-primary:hover { background: #7944c4; }
.account-name { color: #776984; font-size: 13px; max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.credit-badge { display: inline-flex; align-items: center; gap: 3px; color: #7c559f; background: #f6effd; padding: 4px 8px; border-radius: 6px; font-size: 12px; white-space: nowrap; }
.credit-badge strong { font-size: 13px; font-weight: 600; }
.service-status { display: inline-flex; align-items: center; gap: 6px; color: #85788e; font-size: 12px; white-space: nowrap; }
.service-status i { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: #b09bca; }
.service-status[data-status='ready'] i, .service-status[data-status='online'] i,
.service-status[data-status='ok'] i { background: #5f9e84; }
.service-status[data-status='error'] i, .service-status[data-status='offline'] i { background: #c7768d; }
.service-status[data-status='error'], .service-status[data-status='offline'] { color: #a04b68; }
.provider-status { padding: 7px 9px; background: #f8f5fb; border-radius: 6px; color: #776984; font-size: 12px; line-height: 1.8; }
.provider-status.is-error { background: #fff3f6; color: #a04b68; }
.sidebar-footer { padding: 14px 0 0; }
.sidebar-caption { padding: 0 13px 12px; color: #8c7d9b; font-size: 11px; line-height: 1.8; }
.sidebar-footer .tool-link { min-height: 37px; font-size: 12px; gap: 8px; padding: 8px 10px; }
.sidebar-footer .tool-link .tool-icon { flex-basis: 16px; }
.sidebar-footer .tool-link svg { width: 16px; height: 16px; }
.sidebar-footer .tool-link .pill { margin-left: auto; padding: 1px 5px; font-size: 10px; }
.classic-link { display: flex; justify-content: space-between; align-items: center; margin: 12px 11px 0; padding-top: 12px; border-top: 1px solid #ece6f3; font-size: 11px; color: #8c76a2; }
.classic-link:hover { color: var(--purple-deep); }
.field-label { display: block; color: #776984; font-size: 12px; margin: 12px 0 7px; }
.section-heading h2 { display: flex; align-items: center; gap: 7px; }
.upload-title { word-break: keep-all; }
.setting-grid { margin-top: 13px; }
.batch-entry { margin: 0 0 20px; padding: 19px; border: 1px solid #e7dbf5; border-radius: 10px; background: linear-gradient(140deg, #fcfaff, #f6f0fc); }
.batch-entry h2 { font-size: 16px; color: #685276; margin-top: 12px; font-weight: 500; }
.batch-entry p { font-size: 13px; color: #86708f; line-height: 1.9; margin: 8px 0 14px; }
.batch-entry .secondary-button { min-height: 33px; color: var(--purple-deep); font-size: 13px; }
.batch-entry .pill { color: #8656b8; }
.generation-summary small { color: #776984; font-size: 12px; }
.result-title { flex-wrap: wrap; }
.result-actions .pill { min-height: 17px; padding: 1px 5px; font-size: 10px; }

/* Authentication dialogs reuse the existing modal and focus handling. */
.auth-form { width: min(365px, 100%); margin: 0 auto; }
.modal:has(.auth-form) { width: min(430px, 100%); padding: 26px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 4px; border-radius: 8px; background: #f5f0fa; margin-bottom: 17px; }
.auth-tabs button { min-height: 34px; color: #8a759d; border-radius: 5px; font-size: 14px; }
.auth-tabs button.is-active { background: white; color: var(--purple-deep); font-weight: 500; box-shadow: 0 2px 6px #76579609; }
.auth-description { color: #84718d; font-size: 13px; line-height: 1.8; margin-bottom: 19px; }
.auth-form label { display: flex; flex-direction: column; gap: 7px; color: #74617f; font-size: 13px; margin-top: 13px; }
.auth-form input { width: 100%; min-height: 40px; padding: 10px 12px; border: 1px solid #e5daef; border-radius: 7px; color: #51405c; background: white; font-size: 14px; }
.auth-form input::placeholder { color: #8a7a96; }
.auth-form input:hover { border-color: #c8b4dd; }
.auth-form .generate-button { margin-top: 22px; }
.auth-footnote { text-align: center; color: #8a7895; font-size: 12px; margin-top: 15px; line-height: 1.8; }
.auth-form .form-error { margin-top: 15px; }
.history-empty { border: 1px solid #ebe3f2; border-radius: 10px; background: white; padding: 40px 20px; text-align: center; color: #8b739e; }
.history-empty p { font-size: 13px; margin-top: 8px; }
.task-status.is-running { background: #f3eafd; color: #8553b4; }
.task-status.is-failed { background: #fff0f4; color: #9a4263; }
.task-status.is-completed { background: #edf6f0; color: #3d7560; }
.result-card-info { flex-wrap: wrap; gap: 6px; }
.result-card-info > strong { flex-basis: 100%; font-size: 12px; font-weight: 500; color: #74617f; }
.result-card-info .secondary-button { min-height: 26px; padding: 4px 6px; font-size: 11px; }
.result-thumb img { object-fit: contain; }
.task-card > p.muted { margin-top: 10px; font-size: 12px; color: #776984; }
.result-thumb button { position: absolute; bottom: 10px; right: 10px; background: #fffffff0; }

@media (max-width: 1399px) {
  .topbar { gap: 26px; padding-left: 20px; padding-right: 20px; }
  .primary-nav { gap: 22px; }
  .account-actions { gap: 9px; }
  .service-status { font-size: 11px; }
  .brand-copy strong { font-size: 18px; }
}
@media (max-width: 1199px) {
  .topbar { gap: 20px; }
  .primary-nav { gap: 19px; }
  .brand-copy small, .service-status { display: none; }
  .help-button { padding: 5px; min-width: 26px; }
  .help-button span { display: none; }
  .account-member { gap: 5px; }
  .account-name { max-width: 65px; }
}
@media (max-width: 859px) {
  .studio-shell { grid-template-rows: 104px 60px minmax(0, 1fr); }
  .topbar { padding: 10px 17px 0; gap: 6px 15px; flex-wrap: wrap; align-content: flex-start; }
  .primary-nav { order: 2; flex-basis: 100%; height: 41px; gap: 24px; overflow-x: auto; }
  .account-actions { order: 1; gap: 6px; }
  .nav-button { font-size: 13px; }
  .help-button { font-size: 13px; width: 26px; min-width: 26px; }
}
@media (max-width: 639px) {
  .topbar { padding-top: 11px; }
  .primary-nav { height: 42px; gap: 22px; }
  .account-button { font-size: 12px; padding-left: 6px; padding-right: 6px; }
  .account-button.is-primary { padding-left: 10px; padding-right: 10px; }
  .credit-badge { font-size: 11px; padding: 3px 6px; }
  .credit-badge strong { font-size: 12px; }
  .account-name { display: none; }
  .account-actions { gap: 3px; }
  .auth-form input { font-size: 18px; }
  .batch-entry { padding: 17px; }
}
@media (max-width: 359px) {
  .topbar { padding-left: 14px; padding-right: 14px; gap: 7px; }
  .brand { gap: 6px; }
  .brand-copy strong { font-size: 16px; }
  .brand-mark { width: 27px; height: 27px; font-size: 22px; }
  .account-actions .help-button { display: none; }
}

/* Grid originals and their generated slices share one horizontal result row. */
.task-card:has(.task-result-row) { min-width: 0; max-width: 100%; }
.task-result-row {
  --slice-thumb-height: 240px;
  grid-column: 1 / -1;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 8px;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #d8c6ef transparent;
  -webkit-overflow-scrolling: touch;
}
.task-card > .task-result-row { margin-top: 13px; }
.task-result-row::-webkit-scrollbar { height: 6px; }
.task-result-row::-webkit-scrollbar-thumb { background: #d8c6ef; border-radius: 6px; }
.task-result-row::-webkit-scrollbar-track { background: transparent; }
.task-result-row > .result-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-self: stretch;
}
.task-result-row > .grid-source-card { flex: 0 0 clamp(220px, 26%, 300px); }
.task-result-row > .slice-result-card { flex: 1 0 144px; max-width: 240px; }
.task-result-row .result-thumb { height: var(--slice-thumb-height); aspect-ratio: auto; flex: 0 0 auto; }
.task-result-row .result-thumb img { width: 100%; height: 100%; object-fit: contain; }
.task-result-row .result-card-info {
  flex: 1;
  justify-content: flex-start;
  align-content: flex-start;
  align-items: flex-start;
}
.task-result-row .result-card-info > small,
.task-result-row .result-card-info > .image-meta { flex-basis: 100%; overflow-wrap: anywhere; }
.task-result-row .result-card-info .secondary-button { min-height: 30px; }

@media (min-width: 1600px) {
  .task-result-row { --slice-thumb-height: 260px; }
}
@media (max-width: 639px) {
  .task-result-row { --slice-thumb-height: 230px; gap: 10px; scroll-snap-type: x proximity; }
  .task-result-row > .grid-source-card { flex-basis: 190px; }
  .task-result-row > .slice-result-card { flex: 0 0 172px; max-width: none; }
  .task-result-row > .result-card { scroll-snap-align: start; }
}

/* Pagination counts complete generation tasks, not images or slice cards. */
.task-pagination {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  margin-top: 14px;
  padding: 12px 4px 2px;
  border-top: 1px solid var(--line);
}
.task-pagination button {
  min-width: 72px;
  min-height: 32px;
  padding: 6px 12px;
  border: 1px solid #e5dfed;
  border-radius: 7px;
  color: #776984;
  background: white;
  font: inherit;
  line-height: 1.4;
  white-space: nowrap;
}
.task-pagination button:hover:not(:disabled) { color: var(--purple-deep); border-color: #c6a7e9; background: #fcf9ff; }
.task-pagination button:disabled { color: #a89ab5; background: #fcfafe; border-color: #ece5f2; }
.task-pagination .page-status,
.task-pagination > span { display: inline-flex; align-items: center; justify-content: center; min-height: 32px; padding: 0 6px; color: #776984; white-space: nowrap; }
@media (max-width: 639px) {
  .task-pagination { flex-wrap: wrap; gap: 8px; padding-top: 12px; padding-bottom: 4px; }
}

/* Explicit replica scope control; existing tools and result layouts are unchanged. */
.replica-options { margin: 0 27px 24px; padding: 16px; border: 1px solid #e5daf4; border-radius: 10px; background: #fbf8ff; min-width: 0; }
.replica-options[hidden] { display: none; }
.replica-options h2 { margin: 0 0 12px; font-size: inherit; color: #41304f; }
.replica-option-label { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; line-height: 1.65; color: #4f326a; font-weight: 600; }
.replica-option-label input { flex: 0 0 auto; width: 18px; height: 18px; margin: 4px 0 0; accent-color: var(--purple-deep); }
.replica-option-label input:focus-visible { outline: 2px solid var(--purple-deep); outline-offset: 3px; }
.replica-option-label span { min-width: 0; overflow-wrap: anywhere; }
.replica-options small { display: block; margin: 6px 0 0 28px; color: #8a58b1; }
.replica-options p { margin: 10px 0 0; line-height: 1.7; color: #776984; overflow-wrap: anywhere; }
@media (max-width: 639px) { .replica-options { margin: 0 18px 20px; padding: 14px; } }
