/* 快捷图片：场景卡片墙 + 配置生图页 */
body.quick-image-open .main {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.web-shell.quick-image-open .main {
  padding: 0;
  overflow: hidden;
}

/* 网页端左侧悬浮栏（left 16px + 宽 72px）会盖住卡片。与其它页 main 的 104px 左内边距对齐。 */
@media (min-width: 721px) {
  body.web-shell.quick-image-open .main {
    padding-left: 104px;
  }
}

body.quick-image-open .web-banner-stack:not(:has(> :not([hidden]))) {
  display: none;
}

#view-quick-image.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  animation: none;
}

.qi-page {
  flex: 1;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  background:
    radial-gradient(900px 420px at 12% 0%, color-mix(in srgb, var(--qi-tone, #a78bfa) 16%, transparent), transparent 55%),
    radial-gradient(700px 380px at 88% 8%, rgba(59, 130, 246, 0.08), transparent 50%),
    var(--bg-0, #16130f);
  color: var(--text, #f3eee6);
}

.qi-gallery {
  --qi-tone: #a78bfa;
}

.qi-hero {
  flex: 0 0 auto;
  padding: 20px 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid var(--border-soft, #2a241c);
  background: color-mix(in srgb, var(--bg-1, #1e1a15) 88%, transparent);
}

.qi-hero-main {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  align-items: flex-end;
  justify-content: space-between;
}

.qi-hero-toggle {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--border-soft, #2a241c);
  border-radius: 12px;
  background: var(--bg-2, #262119);
  color: var(--text-mute, #a89a88);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
}

.qi-hero-toggle-chev {
  font-size: 14px;
  line-height: 1;
  color: var(--qi-tone, #a78bfa);
}

.qi-hero.is-collapsed .qi-hero-main {
  display: none;
}

.qi-hero.is-collapsed {
  padding-top: 10px;
  padding-bottom: 10px;
}

.qi-hero.is-collapsed .qi-hero-toggle {
  background: color-mix(in srgb, var(--qi-tone, #a78bfa) 14%, var(--bg-2, #262119));
  border-color: color-mix(in srgb, var(--qi-tone, #a78bfa) 28%, var(--border-soft));
  color: var(--text, #f3eee6);
}

.qi-hero-text h1 {
  margin: 6px 0 4px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.qi-hero-text p,
.qi-detail-title-wrap p {
  margin: 0;
  max-width: 52ch;
  color: var(--text-mute, #a89a88);
  font-size: 13px;
  line-height: 1.55;
}

.qi-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: color-mix(in srgb, var(--qi-tone, #a78bfa) 90%, #fff);
  background: color-mix(in srgb, var(--qi-tone, #a78bfa) 22%, transparent);
  border: 1px solid color-mix(in srgb, var(--qi-tone, #a78bfa) 35%, transparent);
}

.qi-hero-tools {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: max-content;
  max-width: 100%;
  margin-left: auto;
}

.qi-hero-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.qi-search {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 180px;
  height: 34px;
  box-sizing: border-box;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-soft, #2a241c);
  background: transparent;
  color: var(--text-mute, #a89a88);
}

.qi-search-ico {
  flex: 0 0 auto;
  font-size: 14px;
  line-height: 1;
}

.qi-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text, #f3eee6);
  font: inherit;
  font-size: 12.5px;
}

.qi-search input::placeholder {
  color: var(--text-mute, #a89a88);
}

.qi-search:focus-within {
  border-color: color-mix(in srgb, var(--qi-tone, #a78bfa) 55%, var(--border));
  color: var(--text, #f3eee6);
}

.qi-hist-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  margin: 0;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--qi-tone, #a78bfa) 42%, var(--border, #3a3127));
  background: color-mix(in srgb, var(--qi-tone, #a78bfa) 18%, var(--bg-2, #262119));
  color: var(--text, #f3eee6);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}

.qi-hist-btn:hover {
  background: color-mix(in srgb, var(--qi-tone, #a78bfa) 32%, var(--bg-2, #262119));
}

.qi-hist-btn-n {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--qi-tone, #a78bfa) 72%, #1a140f);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

.qi-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 6px;
  width: max-content;
  max-width: 100%;
}

.qi-tab {
  border: 1px solid var(--border-soft, #2a241c);
  background: transparent;
  color: var(--text-mute, #a89a88);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
}

.qi-tab:hover {
  color: var(--text, #f3eee6);
  border-color: var(--border, #3a3127);
}

.qi-tab.is-on {
  color: #fff;
  background: color-mix(in srgb, var(--qi-tone, #a78bfa) 55%, #1e1a15);
  border-color: color-mix(in srgb, var(--qi-tone, #a78bfa) 45%, transparent);
}

.qi-gallery-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px 24px 28px;
}

.qi-section + .qi-section {
  margin-top: 28px;
}

.qi-section-head h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.qi-section-head p {
  margin: 0 0 14px;
  color: var(--text-mute, #a89a88);
  font-size: 13px;
}

.qi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.qi-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 14px 12px;
  border-radius: 14px;
  border: 1px solid var(--border-soft, #2a241c);
  background: color-mix(in srgb, var(--bg-1, #1e1a15) 92%, transparent);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.qi-card:hover {
  border-color: color-mix(in srgb, var(--qi-tone, #a78bfa) 45%, var(--border));
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
}

.qi-card-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.qi-card-ico {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: color-mix(in srgb, var(--qi-tone, #a78bfa) 18%, var(--bg-2));
  border: 1px solid color-mix(in srgb, var(--qi-tone, #a78bfa) 28%, transparent);
}

.qi-card-head {
  flex: 1;
  min-width: 0;
}

.qi-card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

/* 标签占卡片全宽：横向排布，不够再换行（避免挤在图标旁竖排） */
.qi-card-tags {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  width: 100%;
  min-width: 0;
}

.qi-tag {
  display: inline-flex;
  flex: 0 0 auto;
  max-width: 100%;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 6px;
  color: var(--text-mute, #a89a88);
  background: var(--bg-2, #262119);
  border: 1px solid var(--border-soft, #2a241c);
  white-space: nowrap;
  box-sizing: border-box;
}

.qi-fav {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-mute, #a89a88);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.qi-fav.is-on,
.qi-fav:hover {
  color: #fbbf24;
}

.qi-card-desc {
  margin: 0;
  flex: 1;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-mute, #a89a88);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.qi-card-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}

.qi-btn-go {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  color: #111;
  background: linear-gradient(135deg, #86efac, #4ade80);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.qi-btn-go:hover {
  filter: brightness(1.05);
}

.qi-link {
  border: none;
  background: transparent;
  color: #93c5fd;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}

.qi-link:hover {
  color: #bfdbfe;
  text-decoration: underline;
}

.qi-empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--text-mute, #a89a88);
}

/* —— 详情配置页 —— */
.qi-detail-head {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px 10px;
  border-bottom: 1px solid var(--border-soft, #2a241c);
  background: color-mix(in srgb, var(--bg-1, #1e1a15) 90%, transparent);
}

.qi-detail-head-main {
  min-width: 0;
  flex: 1;
}

.qi-back {
  border: none;
  background: transparent;
  color: var(--text-mute, #a89a88);
  cursor: pointer;
  padding: 0;
  margin-bottom: 8px;
  font-size: 13px;
}

.qi-back:hover {
  color: var(--text, #f3eee6);
}

.qi-detail-title-wrap h1 {
  margin: 6px 0 4px;
  font-size: 24px;
}

.qi-detail-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(300px, 400px) minmax(0, 1fr);
  gap: 16px;
  padding: 16px 20px 20px;
  box-sizing: border-box;
}

.qi-config,
.qi-preview-col,
.qi-hist {
  min-height: 0;
  min-width: 0;
  border: 1px solid var(--border, #3a3127);
  border-radius: 14px;
  background: rgba(30, 26, 21, 0.92);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.qi-config {
  overflow: auto;
  padding: 14px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.qi-preview-col {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.qi-hist {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  overflow: hidden;
}

.qi-gallery-body > .qi-hist {
  margin-top: 22px;
  max-height: 360px;
}

.qi-hist-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
}

.qi-hist-head-acts {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.qi-hist-head .qi-block-title {
  margin-bottom: 0;
}

.qi-hist-hint {
  font-size: 11px;
  color: var(--text-mute, #a89a88);
  line-height: 1.4;
  flex: 0 0 auto;
}

.qi-hist-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}

.qi-hist-empty {
  padding: 18px 10px;
  text-align: center;
  font-size: 12px;
  color: var(--text-mute, #a89a88);
  line-height: 1.5;
}

.qi-hist-item {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 0;
  border-radius: 10px;
  border: 1px solid var(--border-soft, #2a241c);
  background: var(--bg-1, #1c1814);
  overflow: hidden;
}

.qi-hist-item.is-on {
  border-color: color-mix(in srgb, var(--qi-tone, #a78bfa) 65%, var(--border-soft, #2a241c));
  background: color-mix(in srgb, var(--qi-tone, #a78bfa) 12%, transparent);
}

.qi-hist-item.is-running {
  border-color: color-mix(in srgb, #60a5fa 45%, var(--border-soft, #2a241c));
}

.qi-hist-item.is-error {
  border-color: color-mix(in srgb, #fb7185 40%, var(--border-soft, #2a241c));
}

.qi-hist-main {
  appearance: none;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.qi-hist-thumb {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-2, #262119);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.qi-hist-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.qi-hist-ph {
  font-size: 11px;
  color: var(--text-mute, #a89a88);
}

.qi-hist-spin {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, #60a5fa 35%, transparent);
  border-top-color: #60a5fa;
  animation: qi-spin 0.8s linear infinite;
}

.qi-hist-thumb.is-busy::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
}

.qi-hist-meta {
  min-width: 0;
  flex: 1;
}

.qi-hist-title {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text, #f3eee6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qi-hist-sub {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-mute, #a89a88);
}

.qi-hist-st {
  color: var(--text-mute, #a89a88);
}

.qi-hist-item.is-running .qi-hist-st {
  color: #60a5fa;
}

.qi-hist-item.is-done .qi-hist-st {
  color: #34d399;
}

.qi-hist-item.is-error .qi-hist-st {
  color: #fb7185;
}

.qi-hist-msg,
.qi-hist-err {
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.qi-hist-msg {
  color: #93c5fd;
}

.qi-hist-err {
  color: #fb7185;
}

.qi-hist-del {
  appearance: none;
  flex: 0 0 28px;
  width: 28px;
  margin: 0;
  border: 0;
  border-left: 1px solid var(--border-soft, #2a241c);
  background: transparent;
  color: var(--text-mute, #a89a88);
  font-size: 16px;
  cursor: pointer;
}

.qi-hist-del:hover {
  color: #fb7185;
  background: color-mix(in srgb, #fb7185 12%, transparent);
}

.qi-modal-layer {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
}

.qi-modal-mask {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.58);
  cursor: pointer;
}

.qi-modal {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(78vh, 720px);
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  border: 1px solid var(--border, #3a3127);
  background: var(--bg-1, #1e1a15);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.48);
  overflow: hidden;
}

.qi-modal .qi-hist {
  flex: 1;
  min-height: 0;
  max-height: min(78vh, 720px);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.qi-modal-x {
  appearance: none;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-mute, #a89a88);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.qi-modal-x:hover {
  color: var(--text, #f3eee6);
  background: color-mix(in srgb, #fff 8%, transparent);
}

.qi-block-title {
  font-size: 13px;
  font-weight: 650;
  margin-bottom: 8px;
  color: var(--text, #f3eee6);
}

.qi-hint {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-mute, #a89a88);
  line-height: 1.45;
}

.qi-ups {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.qi-up {
  position: relative;
  min-height: 132px;
  border-radius: 12px;
  border: 1.5px dashed color-mix(in srgb, var(--qi-tone, #a78bfa) 40%, var(--border));
  background: color-mix(in srgb, var(--qi-tone, #a78bfa) 8%, var(--bg-2));
  overflow: hidden;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.qi-up:hover {
  border-color: color-mix(in srgb, var(--qi-tone, #a78bfa) 65%, var(--border));
}

.qi-up.is-dragover {
  border-style: solid;
  border-color: color-mix(in srgb, var(--qi-tone, #a78bfa) 80%, #fff);
  background: color-mix(in srgb, var(--qi-tone, #a78bfa) 22%, var(--bg-2));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--qi-tone, #a78bfa) 28%, transparent);
}

.qi-up.has-file {
  border-style: solid;
}

/* 铺满整格：点击走原生选文件，勿用 display:none / hidden */
.qi-up-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  margin: 0;
  padding: 0;
  border: 0;
  cursor: pointer;
  z-index: 2;
  font-size: 0;
}

.qi-up-body {
  position: relative;
  z-index: 1;
  min-height: 132px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  pointer-events: none;
  box-sizing: border-box;
}

.qi-up.has-file .qi-up-body {
  padding: 0;
}

.qi-up-ico {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 18px;
  color: #fff;
  background: color-mix(in srgb, var(--qi-tone, #a78bfa) 70%, #312e81);
  margin-bottom: 4px;
}

.qi-up-label {
  font-size: 12px;
  font-weight: 650;
}

.qi-up-label em {
  font-style: normal;
  color: var(--text-mute, #a89a88);
  font-weight: 500;
}

.qi-up-hint {
  font-size: 11px;
  color: var(--text-mute, #a89a88);
}

.qi-up-preview {
  width: 100%;
  height: 100%;
  min-height: 132px;
  object-fit: cover;
  display: block;
}

.qi-up-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 4px 8px;
  font-size: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qi-up-rm {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
  z-index: 3;
}

.qi-styles {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(140px, 1fr);
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.qi-style {
  text-align: left;
  border: 1px solid var(--border-soft, #2a241c);
  background: var(--bg-2, #262119);
  color: var(--text, #f3eee6);
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 72px;
}

.qi-style strong {
  font-size: 12px;
}

.qi-style span {
  font-size: 11px;
  color: var(--text-mute, #a89a88);
  line-height: 1.4;
}

.qi-style.is-on,
.qi-style:hover {
  border-color: color-mix(in srgb, var(--qi-tone, #a78bfa) 55%, var(--border));
  background: color-mix(in srgb, var(--qi-tone, #a78bfa) 14%, var(--bg-2));
}

.qi-select {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border, #3a3127);
  background: var(--bg-2, #262119);
  color: var(--text, #f3eee6);
}

.qi-block-sub {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-mute, #a89a88);
}

.qi-block-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.qi-block-title-row > span {
  min-width: 0;
}

.qi-autoconfig-block {
  padding-top: 2px;
}

.qi-autoconfig-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.qi-autoconfig-btn {
  appearance: none;
  margin: 0;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--qi-tone, #a78bfa) 55%, var(--border-soft, #2a241c));
  background: color-mix(in srgb, var(--qi-tone, #a78bfa) 16%, var(--bg-1, #1c1814));
  color: var(--text, #f3eee6);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.qi-autoconfig-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--qi-tone, #a78bfa) 26%, var(--bg-1, #1c1814));
}

.qi-autoconfig-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.qi-autoconfig-need {
  font-size: 11.5px;
  color: var(--text-mute, #a89a88);
}

.qi-autoconfig-mini {
  flex: 0 0 auto;
  font-size: 12px;
  white-space: nowrap;
}

.qi-autoconfig-mini:disabled {
  opacity: 0.6;
  cursor: wait;
  pointer-events: none;
}

.qi-ecom-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.qi-ecom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.qi-ecom-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  font-size: 12px;
  color: var(--text-mute, #a89a88);
}

.qi-ecom-field-wide {
  grid-column: 1 / -1;
}

.qi-input,
.qi-textarea {
  width: 100%;
  box-sizing: border-box;
  border-radius: 8px;
  border: 1px solid var(--border-soft, #2a241c);
  background: var(--bg-1, #1c1814);
  color: var(--text, #f3eee6);
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.4;
  resize: vertical;
}

.qi-input:focus,
.qi-textarea:focus,
.qi-select:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--qi-tone, #a78bfa) 55%, var(--border-soft, #2a241c));
}

.qi-ecom-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.qi-ecom-lab {
  font-size: 12px;
  color: var(--text-mute, #a89a88);
}

.qi-ecom-lab em {
  margin-left: 6px;
  font-style: normal;
  opacity: 0.75;
  font-size: 11px;
}

.qi-ecom-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.qi-ecom-chip {
  appearance: none;
  margin: 0;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-soft, #2a241c);
  background: var(--bg-1, #1c1814);
  color: var(--text-mute, #a89a88);
  font-size: 11.5px;
  cursor: pointer;
}

.qi-ecom-chip.is-on {
  border-color: color-mix(in srgb, var(--qi-tone, #a78bfa) 70%, var(--border-soft, #2a241c));
  background: color-mix(in srgb, var(--qi-tone, #a78bfa) 16%, transparent);
  color: var(--text, #f3eee6);
}

.qi-ecom-structs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.qi-ecom-struct {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 7px 8px;
  border-radius: 8px;
  border: 1px solid var(--border-soft, #2a241c);
  background: var(--bg-1, #1c1814);
  cursor: pointer;
}

.qi-ecom-struct input {
  margin-top: 2px;
}

.qi-ecom-struct span {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.qi-ecom-struct b {
  font-size: 12px;
  font-weight: 650;
  color: var(--text, #f3eee6);
}

.qi-ecom-struct em {
  font-style: normal;
  font-size: 11px;
  color: var(--text-mute, #a89a88);
  line-height: 1.35;
}

.qi-ecom-struct.is-on {
  border-color: color-mix(in srgb, var(--qi-tone, #a78bfa) 65%, var(--border-soft, #2a241c));
  background: color-mix(in srgb, var(--qi-tone, #a78bfa) 12%, transparent);
}

.qi-batch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.qi-batch-chip {
  appearance: none;
  margin: 0;
  min-width: 52px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-soft, #2a241c);
  background: var(--bg-1, #1c1814);
  color: var(--text-mute, #a89a88);
  font-size: 12px;
  cursor: pointer;
}

.qi-batch-chip.is-on {
  border-color: color-mix(in srgb, var(--qi-tone, #a78bfa) 70%, var(--border-soft, #2a241c));
  background: color-mix(in srgb, var(--qi-tone, #a78bfa) 18%, transparent);
  color: var(--text, #f3eee6);
  font-weight: 650;
}

.qi-batch-chip:hover {
  border-color: color-mix(in srgb, var(--qi-tone, #a78bfa) 55%, transparent);
  color: var(--text, #f3eee6);
}

.qi-preview-count {
  margin-left: 6px;
  font-style: normal;
  font-weight: 600;
  color: color-mix(in srgb, var(--qi-tone, #a78bfa) 80%, #fff);
  font-size: 12px;
}

.qi-gen {
  margin-top: auto;
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--qi-tone, #a78bfa) 85%, #6366f1),
    color-mix(in srgb, var(--qi-tone, #a78bfa) 55%, #4f46e5));
  box-shadow: 0 10px 22px color-mix(in srgb, var(--qi-tone, #a78bfa) 28%, transparent);
}

.qi-gen:hover:not(:disabled) {
  filter: brightness(1.06);
}

.qi-gen:disabled {
  opacity: 0.65;
  cursor: wait;
}

.qi-preview {
  flex: 1;
  min-height: 0;
  border-radius: 12px;
  border: 1px solid var(--border-soft, #2a241c);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent),
    var(--bg-2, #262119);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.qi-preview-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  padding: 6px 10px;
  font-size: 11.5px;
  color: #dbeafe;
  background: color-mix(in srgb, #2563eb 72%, rgba(0, 0, 0, 0.55));
  text-align: center;
  pointer-events: none;
}

.qi-preview-empty,
.qi-preview-busy {
  text-align: center;
  padding: 24px;
}

.qi-spark {
  font-size: 36px;
  color: color-mix(in srgb, var(--qi-tone, #a78bfa) 70%, #fff);
  margin-bottom: 10px;
  opacity: 0.7;
}

.qi-preview-title {
  font-size: 15px;
  font-weight: 650;
  margin-bottom: 6px;
}

.qi-preview-sub {
  font-size: 12px;
  color: var(--text-mute, #a89a88);
  max-width: 36ch;
  margin: 0 auto;
  line-height: 1.5;
}

.qi-spin {
  width: 36px;
  height: 36px;
  margin: 0 auto 12px;
  border-radius: 999px;
  border: 3px solid color-mix(in srgb, var(--qi-tone, #a78bfa) 25%, transparent);
  border-top-color: var(--qi-tone, #a78bfa);
  animation: qi-spin 0.8s linear infinite;
}

@keyframes qi-spin {
  to { transform: rotate(360deg); }
}

.qi-result-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 12px 56px;
  box-sizing: border-box;
  min-height: 0;
}

.qi-result {
  max-width: 100%;
  max-height: calc(100% - 120px);
  object-fit: contain;
  border-radius: 8px;
}

.qi-result-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 100%;
  flex: 0 0 auto;
}

.qi-result-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border-soft, #2a241c);
  background: var(--bg-1, #1c1814);
  overflow: hidden;
  cursor: pointer;
}

.qi-result-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.qi-result-thumb span {
  position: absolute;
  right: 4px;
  bottom: 3px;
  min-width: 16px;
  padding: 0 4px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
}

.qi-result-thumb.is-on {
  border-color: color-mix(in srgb, var(--qi-tone, #a78bfa) 75%, #fff);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--qi-tone, #a78bfa) 45%, transparent);
}

.qi-result-acts {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
}

@media (max-width: 1280px) {
  .qi-detail-body {
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  }
}

@media (max-width: 1200px) {
  .qi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .qi-detail-body {
    grid-template-columns: minmax(280px, 1fr) minmax(0, 1.2fr);
  }
}

@media (max-width: 900px) {
  .qi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .qi-detail-body {
    grid-template-columns: 1fr;
    display: flex;
    flex-direction: column;
    overflow: visible;
    height: auto;
    min-height: 0;
  }
  .qi-config,
  .qi-preview-col,
  .qi-hist {
    overflow: visible;
    height: auto;
    max-height: none;
    width: 100%;
    box-sizing: border-box;
  }
  .qi-hist {
    max-height: 320px;
    overflow: hidden;
  }
  .qi-preview {
    min-height: 240px;
    flex: none;
  }
  .qi-ups {
    grid-template-columns: 1fr;
  }
  .qi-gen {
    margin-top: 4px;
  }
}

@media (max-width: 560px) {
  .qi-grid {
    grid-template-columns: 1fr;
  }
  .qi-ups {
    grid-template-columns: 1fr;
  }
  .qi-hero,
  .qi-gallery-body,
  .qi-detail-head,
  .qi-detail-body {
    padding-left: 14px;
    padding-right: 14px;
  }
}

/* 手机端 / 窄屏：顶部介绍/搜索/分类可收起，腾出列表空间 */
body.m-shell .qi-hero-toggle {
  display: flex;
}

@media (max-width: 820px) {
  .qi-hero-toggle {
    display: flex;
  }
}

/* —— 手机壳：详情参数页改为文档流，避免上传区与预览叠层 —— */
body.m-shell #view-quick-image.active {
  display: block !important;
  height: auto !important;
  min-height: 100%;
  overflow: visible !important;
}

body.m-shell #view-quick-image .qi-page {
  height: auto !important;
  min-height: 100%;
  overflow: visible;
}

body.m-shell #view-quick-image .qi-detail-head {
  padding: 12px 14px 10px;
}

body.m-shell #view-quick-image .qi-detail-title-wrap h1 {
  font-size: 20px;
  line-height: 1.3;
}

body.m-shell #view-quick-image .qi-detail-body {
  display: flex !important;
  flex-direction: column;
  grid-template-columns: 1fr !important;
  gap: 12px;
  height: auto !important;
  min-height: 0;
  overflow: visible !important;
  padding: 12px 12px calc(28px + env(safe-area-inset-bottom, 0px));
}

body.m-shell #view-quick-image .qi-config,
body.m-shell #view-quick-image .qi-preview-col,
body.m-shell #view-quick-image .qi-hist {
  width: 100%;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  padding: 12px;
  box-sizing: border-box;
}

body.m-shell #view-quick-image .qi-hist {
  max-height: 300px !important;
  overflow: hidden !important;
}

body.m-shell #view-quick-image .qi-block {
  min-width: 0;
}

body.m-shell #view-quick-image .qi-ups {
  grid-template-columns: 1fr !important;
  gap: 10px;
}

body.m-shell #view-quick-image .qi-up {
  min-height: 148px;
  isolation: isolate;
}

body.m-shell #view-quick-image .qi-up-body,
body.m-shell #view-quick-image .qi-up-preview {
  min-height: 148px;
}

body.m-shell #view-quick-image .qi-styles {
  display: grid;
  grid-auto-flow: row;
  grid-template-columns: 1fr 1fr;
  grid-auto-columns: unset;
  overflow: visible;
  gap: 8px;
}

body.m-shell #view-quick-image .qi-style {
  min-width: 0;
  min-height: 68px;
}

body.m-shell #view-quick-image .qi-preview {
  min-height: 220px !important;
  flex: none !important;
  width: 100%;
}

body.m-shell #view-quick-image .qi-preview-empty,
body.m-shell #view-quick-image .qi-preview-busy {
  padding: 20px 16px;
}

body.m-shell #view-quick-image .qi-gen {
  position: sticky;
  bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  z-index: 6;
  margin-top: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
