/* ============================================================
   AI 绘图模块
   ============================================================ */

.img-studio { height: 100%; min-width: 0; max-width: 100%; display: flex; flex-direction: column; padding: var(--sp-5); gap: var(--sp-4); overflow: hidden; }

/* ---------- 顶部 Tab ---------- */
.img-tabs { display: flex; gap: var(--sp-2); }
.img-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: var(--r-full);
  font-size: var(--fs-sm); color: var(--tx-2);
  border: 1px solid var(--line-1); background: var(--bg-glass);
  transition: all var(--t-fast) var(--ease); cursor: pointer;
}
.img-tab:hover { color: var(--tx-1); border-color: var(--line-2); }
.img-tab.active {
  color: var(--tx-on-neon); background: var(--grad-brand);
  border-color: transparent; box-shadow: var(--glow-brand);
}

/* ---------- 创作布局 ---------- */
.img-create { flex: 1; min-width: 0; max-width: 100%; display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: var(--sp-4); overflow: hidden; }
.img-panel { position: relative; z-index: 2; padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); overflow-y: auto; }
.img-label { font-size: var(--fs-xs); color: var(--tx-3); font-weight: 600; letter-spacing: 0.04em; }
.img-label.mine-label { margin: var(--sp-2) 0 0; }

.img-prompt { resize: vertical; min-height: 88px; max-height: min(44vh, 420px); overflow-y: auto; line-height: 1.6; }

/* 模型选择 */
.img-models { display: flex; flex-direction: column; gap: var(--sp-2); }
.img-model-picker { position: relative; }
.img-model-selected { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: 11px 13px; border: 1px solid var(--line-2); border-radius: var(--r-md); color: var(--tx-1); background: var(--bg-glass); text-align: left; cursor: pointer; }
.img-model-selected-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.img-model-selected-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); }
.img-model-selected-copy small, .img-model-selected-arrow { color: var(--tx-3); font-size: var(--fs-xs); }
.img-model-menu { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; right: 0; max-height: min(390px, 55vh); overflow: hidden; border: 1px solid var(--line-2); border-radius: var(--r-lg); background: var(--bg-2); box-shadow: var(--shadow-2); }
.img-model-groups { display: flex; flex-wrap: wrap; gap: 6px; overflow-x: hidden; padding: 8px; border-bottom: 1px solid var(--line-1); scrollbar-width: none; }
.img-model-groups::-webkit-scrollbar { display: none; }
.img-model-group { flex: none; padding: 6px 10px; border-radius: var(--r-full); color: var(--tx-3); background: transparent; font-size: var(--fs-xs); cursor: pointer; }
.img-model-group.active { color: var(--neon-cyan); background: rgba(0,229,255,.1); }
.img-model-options { max-height: 310px; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.img-model {
  text-align: left; padding: 10px 12px; border-radius: var(--r-md);
  border: 1px solid var(--line-1); background: var(--bg-glass);
  display: flex; flex-direction: column; gap: 4px;
  transition: all var(--t-fast) var(--ease); cursor: pointer;
}
.img-model:hover { border-color: var(--line-2); }
.img-model.active { border-color: var(--neon-cyan); box-shadow: 0 0 0 1px var(--neon-cyan) inset; }
.img-model.disabled { opacity: 0.55; cursor: not-allowed; }
.img-model-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.img-model-name { font-size: var(--fs-sm); font-weight: 600; color: var(--tx-1); }
.img-model-desc { font-size: var(--fs-xs); color: var(--tx-3); line-height: 1.5; }
.img-model-flag { font-size: var(--fs-xs); color: var(--neon-violet); }

/* 尺寸 / 排序 pill */
.img-sizes { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.img-size {
  padding: 6px 12px; border-radius: var(--r-full);
  font-size: var(--fs-xs); color: var(--tx-2);
  border: 1px solid var(--line-1); background: var(--bg-glass);
  transition: all var(--t-fast) var(--ease); cursor: pointer;
}
.img-size:hover { color: var(--tx-1); border-color: var(--line-2); }
.img-size.active { color: var(--tx-on-neon); background: var(--grad-brand); border-color: transparent; }
.img-sort { padding: 0 var(--sp-1); display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.img-square-filter { width: auto; min-width: 132px; min-height: 32px; padding: 5px 30px 5px 10px; font-size: var(--fs-xs); }

/* 底部：配额 + 生成按钮 */
.img-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--sp-3); padding-top: var(--sp-2); }
.img-quota { font-size: var(--fs-xs); display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.img-quota-ok { color: var(--neon-cyan); }
.img-quota-out { color: var(--warn, #ff9a5c); }
.img-quota-tip { color: var(--tx-3); }
.img-gen { width: 100%; justify-content: center; padding: 12px; font-size: var(--fs-md); }

/* ---------- 右侧：当前结果 + 我的作品 ---------- */
.img-right { min-width: 0; max-width: 100%; display: flex; flex-direction: column; gap: var(--sp-3); overflow-y: auto; padding-right: 2px; }
.img-current { padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); min-height: 240px; }
.img-current-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-2); padding: var(--sp-5) 0; text-align: center; }
.img-current-preview { border-radius: var(--r-md); overflow: hidden; cursor: zoom-in; background: var(--bg-glass); display: flex; justify-content: center; }
.img-current-preview img { max-width: 100%; max-height: 46vh; display: block; object-fit: contain; }
.img-current-prompt { font-size: var(--fs-sm); color: var(--tx-1); line-height: 1.6; word-break: break-all; }
.img-current-sub { font-size: var(--fs-xs); color: var(--tx-3); margin-top: 2px; }
.img-current-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.img-current-actions .btn { display: inline-flex; align-items: center; gap: 5px; }
.img-current-actions .danger { color: var(--danger, #ff5d73); }

/* 生成中动画 */
.img-spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 3px solid var(--line-1); border-top-color: var(--neon-cyan);
  animation: imgSpin 0.9s linear infinite;
}
@keyframes imgSpin { to { transform: rotate(360deg); } }

/* 作品网格（我的 + 广场） */
.img-mine { min-width: 0; max-width: 100%; padding-bottom: var(--sp-3); }
.img-mine-tools { display: grid; grid-template-columns: minmax(130px, .65fr) minmax(180px, 1fr) auto; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.img-mine-model, .img-mine-search { min-width: 0; width: 100%; }
.img-mine-more { display: flex; margin: var(--sp-3) auto 0; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--sp-3); }
.img-cell {
  position: relative; border-radius: var(--r-md); overflow: hidden;
  border: 1px solid var(--line-1); background: var(--bg-glass);
  transition: transform var(--t-fast) var(--ease), border-color var(--t-fast);
}
.img-cell:hover { transform: translateY(-2px); border-color: var(--line-2); }
.img-cell > img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; cursor: zoom-in; }
.img-cell-pending { min-height: 220px; }
.img-pending-body { height: 100%; min-height: 220px; padding: var(--sp-3); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-2); text-align: center; color: var(--tx-2); }
.img-pending-body .img-spinner { width: 34px; height: 34px; }
.img-pending-body span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--tx-3); font-size: var(--fs-xs); }
/* 我的作品卡片底栏：两行排版（上行 时间+已分享标签；下行 统计+分享/删除），手机端不挤压 */
.img-cell-bar {
  display: flex; flex-direction: column; gap: 4px;
  padding: 6px 8px; font-size: var(--fs-xs); color: var(--tx-3);
}
.img-cell-bar-top { display: flex; align-items: center; gap: var(--sp-2); min-height: 18px; }
.img-cell-time { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.img-cell-pub { display: inline-flex; align-items: center; gap: 3px; color: var(--neon-cyan); flex: none; }
.img-cell-bar-acts { display: flex; align-items: center; gap: 6px; }
.img-cell-stats { display: inline-flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.img-cell-stats .i { flex: none; }
.img-cell-actions { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; flex: none; }
.img-cell-share, .img-cell-collect { flex: none; }
.img-cell-collect.collected { color: var(--neon-cyan); border-color: var(--neon-cyan); background: color-mix(in srgb, var(--neon-cyan) 12%, transparent); }
.img-cell-del { opacity: 0; transition: opacity var(--t-fast); flex: none; }
.img-cell:hover .img-cell-del { opacity: 1; }

/* 广场卡片 */
.img-grid.square { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.square-cell > img { aspect-ratio: 3 / 4; }
.img-square-meta { padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.img-square-prompt {
  font-size: var(--fs-xs); color: var(--tx-2); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* 广场卡片底栏：作者行（头像+昵称）与互动行（喜欢/收藏/评论均分）上下两行，手机端不别扭 */
.img-square-foot { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.img-square-author { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--tx-3); min-width: 0; }
.img-avatar {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
  object-fit: cover; border: 1px solid var(--line-1); overflow: hidden;
}
.img-author-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.img-like {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: var(--r-full);
  font-size: var(--fs-xs); color: var(--tx-3);
  border: 1px solid var(--line-1); background: transparent;
  transition: all var(--t-fast) var(--ease); cursor: pointer;
}
.img-like:hover { color: var(--neon-violet); border-color: var(--neon-violet); }
.img-like.liked { color: var(--neon-violet); border-color: var(--neon-violet); background: color-mix(in srgb, var(--neon-violet) 12%, transparent); }

/* 广场面板 */
.img-square { flex: 1; display: flex; flex-direction: column; gap: var(--sp-3); overflow: hidden; }
.img-square-list { flex: 1; overflow-y: auto; padding-bottom: var(--sp-3); }

/* 灯箱 */
.img-lightbox { display: flex; flex-direction: column; gap: var(--sp-3); padding: 2px; }
.img-lightbox > img { max-width: 100%; max-height: 70vh; object-fit: contain; border-radius: calc(var(--r-md) + 2px); margin: 0 auto; display: block; background: color-mix(in srgb, var(--bg-glass) 82%, #000); border: 1px solid var(--line-1); box-shadow: 0 18px 50px rgba(0, 0, 0, .22); }
.img-lightbox-meta { font-size: var(--fs-sm); line-height: 1.6; color: var(--tx-2); text-align: center; }
.img-lightbox-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.img-lightbox-actions .btn { min-height: 36px; }
.img-lightbox-task { padding: 7px 10px; border-radius: var(--r-md); background: var(--bg-glass); border: 1px solid var(--line-1); font-size: var(--fs-xs); color: var(--tx-3); text-align: center; font-family: ui-monospace, Consolas, monospace; word-break: break-all; }
.img-lightbox-refs { display: flex; flex-direction: column; gap: 7px; padding: 10px 12px; border-radius: var(--r-md); background: var(--bg-glass); border: 1px solid var(--line-1); }
.img-lightbox-refs .img-ref-img { width: 64px; height: 64px; }
.img-ref-original { display: flex; align-items: center; justify-content: center; min-height: 180px; max-height: 82vh; overflow: auto; border-radius: var(--r-md); background: color-mix(in srgb, var(--bg-glass) 80%, #000); }
.img-ref-original img { width: auto; height: auto; max-width: 100%; max-height: 82vh; object-fit: contain; display: block; }
.img-viewer { min-width: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.img-viewer-stage { height: min(70vh, 720px); min-height: 280px; overflow: auto; display: flex; align-items: flex-start; justify-content: center; padding: var(--sp-3); border: 1px solid var(--line-1); border-radius: var(--r-md); background: color-mix(in srgb, var(--bg-glass) 80%, #000); }
.img-viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; transform-origin: top center; transition: transform var(--t-fast) var(--ease); }
.img-viewer-controls { display: flex; align-items: center; justify-content: center; gap: var(--sp-2); flex-wrap: wrap; }
.img-viewer-controls .btn-icon { width: 38px; height: 38px; }
.img-viewer-scale { min-width: 58px; color: var(--tx-2); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; text-align: center; }

@media (max-width: 900px) {
  .img-create { grid-template-columns: 1fr; overflow-y: auto; }
  .img-right { overflow: visible; }
  .img-model-menu { max-width: 100%; }
  /* 手机端无 hover：删除按钮常显，避免找不到入口 */
  .img-cell-del { opacity: 1; }
  .img-lightbox-actions { display: grid; grid-template-columns: 1fr; }
  .img-lightbox-actions .btn { width: 100%; min-width: 0; white-space: normal; }
}
.img-ref-library { display: flex; flex-direction: column; gap: 12px; }
.img-ref-library-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line-1); }
.img-ref-library-tab { padding: 8px 12px; color: var(--tx-3); background: transparent; border: 0; border-bottom: 2px solid transparent; cursor: pointer; }
.img-ref-library-tab.active { color: var(--neon-cyan); border-bottom-color: var(--neon-cyan); }
.img-ref-library-content { min-height: 180px; max-height: 52vh; overflow-y: auto; }
.img-ref-library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.img-ref-library-item { min-width: 0; display: flex; flex-direction: column; gap: 6px; padding: 6px; text-align: left; color: var(--tx-2); border: 1px solid var(--line-1); border-radius: var(--r-md); background: var(--bg-glass); cursor: pointer; }
.img-ref-library-item { position: relative; }
.img-ref-library-item:hover, .img-ref-library-item.selected { border-color: var(--neon-cyan); box-shadow: 0 0 0 2px var(--neon-cyan), 0 0 18px color-mix(in srgb, var(--neon-cyan) 45%, transparent); }
.img-ref-library-item.selected { outline: 2px solid var(--neon-violet); outline-offset: 2px; }
.img-ref-library-check { display: none; position: absolute; z-index: 1; top: 10px; right: 10px; width: 24px; height: 24px; align-items: center; justify-content: center; border-radius: 50%; color: #07111d; background: var(--neon-cyan); font-weight: 800; box-shadow: 0 0 0 3px rgba(7, 17, 29, .82); }
.img-ref-library-item.selected .img-ref-library-check { display: inline-flex; }
.img-ref-library-more { display: flex; margin: 12px auto 0; }
.img-ref-library-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: calc(var(--r-md) - 2px); }
.img-ref-library-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-xs); }
.img-common-phrases { display: flex; flex-direction: column; gap: 12px; }
.img-common-phrase-add { display: flex; gap: 8px; }
.img-common-phrase-add .input { flex: 1; min-width: 0; }
.img-common-phrases-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; }
.img-common-phrase-row { display: flex; align-items: center; gap: 8px; }
.img-common-phrase { flex: 1; min-width: 0; padding: 9px 10px; border: 1px solid var(--line-1); border-radius: var(--r-md); background: var(--bg-glass); color: var(--tx-2); text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.img-common-phrase:hover { border-color: var(--neon-cyan); color: var(--tx-1); }

/* ---- 任务7：模型自定义参数 ---- */
.img-params { display: flex; flex-direction: column; gap: 10px; }

/* ---- 任务4：尺寸行容器（脚本 ui 接管尺寸时整行隐藏） ---- */
.img-size-row { display: flex; flex-direction: column; gap: var(--sp-3); }

/* ---- 任务4：参考图上传条（缩略图 56px 圆角、横向滚动、删除角标；移动端不溢出） ---- */
.img-ref-bar { display: flex; gap: 8px; overflow-x: auto; padding: 6px 2px; max-width: 100%; }
.img-ref-item { position: relative; flex: 0 0 auto; width: 56px; height: 56px; }
.img-ref-img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; display: block; }
.img-ref-img[role="button"] { cursor: zoom-in; border: 1px solid var(--line-1); transition: transform var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast); }
.img-ref-img[role="button"]:hover, .img-ref-img[role="button"]:focus-visible { transform: translateY(-2px); border-color: var(--neon-cyan); box-shadow: 0 8px 20px rgba(0, 0, 0, .2); outline: none; }
.img-ref-del {
  position: absolute; top: -6px; right: -6px;
  width: 18px; height: 18px; border-radius: 50%; border: none;
  background: rgba(0, 0, 0, .7); color: #fff; font-size: 12px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0;
}
.img-ref-add {
  flex: 0 0 auto; width: 56px; height: 56px; border-radius: 8px;
  border: 1px dashed var(--border, #334); background: transparent; color: inherit;
  font-size: 20px; line-height: 1; cursor: pointer; opacity: .8;
}
.img-ref-add:hover { opacity: 1; }
.img-ref-library-btn { display: inline-flex; align-items: center; justify-content: center; }
.img-ref-library-btn .i { width: 20px; height: 20px; }
.img-ref-add.is-dragover { opacity: 1; color: var(--neon-cyan); border-color: var(--neon-cyan); background: color-mix(in srgb, var(--neon-cyan) 12%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--neon-cyan) 12%, transparent); }
.img-param-row { display: flex; align-items: center; gap: 10px; }
.img-param-label { flex: none; width: 64px; font-size: var(--fs-sm); color: var(--tx-2); }
.img-param-input { flex: 1; min-width: 0; }
.img-tasks { display: flex; flex-direction: column; gap: 8px; }
.img-task-empty { padding: 12px; border: 1px dashed var(--line-1); border-radius: var(--r-md); color: var(--tx-3); font-size: var(--fs-xs); text-align: center; }
.img-task-card { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line-1); border-radius: var(--r-md); background: var(--bg-glass); color: var(--tx-1); text-align: left; cursor: pointer; }
.img-task-card:hover { border-color: var(--line-2); }
.img-task-card-state { flex: none; padding: 3px 8px; border-radius: var(--r-full); font-size: var(--fs-xs); color: var(--warning); background: color-mix(in srgb, var(--warning) 12%, transparent); }
.img-task-card.is-failed .img-task-card-state { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.img-task-card-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.img-task-card-prompt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); }
.img-task-card-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--tx-3); font-size: var(--fs-xs); }
.img-task-card-open { flex: none; color: var(--tx-3); }
.img-task-detail { display: flex; flex-direction: column; gap: 12px; }
.img-task-status { align-self: flex-start; padding: 4px 10px; border-radius: var(--r-full); color: var(--warning); background: color-mix(in srgb, var(--warning) 12%, transparent); font-size: var(--fs-xs); font-weight: 700; }
.img-task-status.is-failed { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.img-task-status.is-success { color: var(--success); background: color-mix(in srgb, var(--success) 12%, transparent); }
.img-task-detail-prompt { padding: 10px 12px; border: 1px solid var(--line-1); border-radius: var(--r-md); background: var(--bg-glass); color: var(--tx-1); line-height: 1.6; word-break: break-word; }
.img-task-detail-meta, .img-task-message { color: var(--tx-2); font-size: var(--fs-sm); }

/* ============================================================
   任务1：提示词区置顶 + 绘图设置折叠（移动端默认收起，首屏即可输入与生成）
   ============================================================ */
.img-prompt-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.img-prompt-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.img-setup-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.img-assist-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 12px; border-radius: var(--r-full);
  font-size: var(--fs-xs); color: var(--neon-violet);
  border: 1px solid color-mix(in srgb, var(--neon-violet) 45%, transparent);
  background: color-mix(in srgb, var(--neon-violet) 8%, transparent);
  transition: all var(--t-fast) var(--ease); cursor: pointer;
}
.img-assist-btn:hover { background: color-mix(in srgb, var(--neon-violet) 16%, transparent); border-color: var(--neon-violet); }
.img-assist-btn .i { color: inherit; }

/* 设置折叠开关：桌面端隐藏（设置区恒展开），移动端显示 */
.img-setup-toggle {
  display: none; align-items: center; justify-content: space-between; gap: var(--sp-2);
  width: 100%; padding: 9px 12px; border-radius: var(--r-md);
  font-size: var(--fs-sm); font-weight: 600; color: var(--tx-2);
  border: 1px solid var(--line-1); background: var(--bg-glass);
  cursor: pointer; transition: all var(--t-fast) var(--ease);
}
.img-setup-toggle:hover { color: var(--tx-1); border-color: var(--line-2); }
.img-setup-toggle .img-setup-arrow { transition: transform var(--t-fast) var(--ease); }
.img-setup-toggle[aria-expanded="true"] .img-setup-arrow { transform: rotate(90deg); }
.img-setup { display: flex; flex-direction: column; gap: var(--sp-3); }
/* closed 收起仅在移动端生效（桌面端开关隐藏、设置区恒展开，防窗口缩放后无开关可开） */

/* 任务4：生成中「关闭网页不影响生成」提示 */
.img-gen-tip { display: inline-flex; align-items: center; gap: 5px; color: var(--neon-cyan); font-size: var(--fs-xs); }

/* ============================================================
   任务2：广场卡片（模型徽标 / 参考图标 / 喜欢收藏评论）+ 详情弹窗 + 评论区
   ============================================================ */
.img-square-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.img-tag-type {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: var(--r-full);
  font-size: var(--fs-xs); color: var(--success);
  background: color-mix(in srgb, var(--success) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
}
.img-share-type-row { display: flex; flex-direction: column; gap: 7px; padding-bottom: var(--sp-2); }
.img-share-type { width: 100%; }

@media (max-width: 480px) {
  .img-studio { padding: var(--sp-3); }
  .img-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; padding-bottom: 2px; }
  .img-tab { min-width: 0; padding: 7px 4px; justify-content: center; font-size: var(--fs-xs); }
  .img-sort { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0; }
  .img-sort .img-size { min-width: 0; }
  .img-square-filter { width: 100%; min-width: 0; }
  .img-grid.square { grid-template-columns: minmax(0, 1fr); }
  .img-share-opts { min-width: 0; }
  .img-collected-views { width: 100%; }
  .img-collected-view { min-width: 0; flex: 1; }
}
.img-tag-model {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: var(--r-full);
  font-size: var(--fs-xs); color: var(--neon-cyan);
  background: color-mix(in srgb, var(--neon-cyan) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--neon-cyan) 30%, transparent);
  max-width: 100%;
}
.img-tag-model span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.img-tag-ref {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: var(--r-full);
  font-size: var(--fs-xs); color: var(--neon-violet);
  background: color-mix(in srgb, var(--neon-violet) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--neon-violet) 30%, transparent);
}
.img-square-acts { display: flex; align-items: center; gap: 6px; }
.img-square-acts .img-like { flex: 1 1 0; min-width: 0; justify-content: center; padding: 4px 6px; }
.img-square-acts .img-like span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.img-collect:hover, .img-collect.liked { color: var(--neon-cyan); border-color: var(--neon-cyan); background: color-mix(in srgb, var(--neon-cyan) 12%, transparent); }
.img-collected-views { display: inline-flex; align-self: flex-start; gap: 4px; padding: 4px; border: 1px solid var(--line-1); border-radius: var(--r-md); background: var(--bg-glass); }
.img-collected-view { min-height: 34px; padding: 6px 14px; border-radius: calc(var(--r-md) - 2px); color: var(--tx-3); font-size: var(--fs-sm); cursor: pointer; }
.img-collected-view.active { color: var(--tx-1); background: var(--bg-3); box-shadow: var(--shadow-1); }
.img-model-group-empty { padding: 28px 16px; color: var(--tx-3); font-size: var(--fs-sm); text-align: center; }
.img-square-prompt.muted { color: var(--tx-3); font-style: italic; }

/* 收藏夹中已下架（取消分享 / 被限制）的作品 */
.img-cell.offline { opacity: 0.72; }
.img-cell-offline {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  padding: 3px 10px; border-radius: var(--r-full);
  font-size: var(--fs-xs); color: #fff;
  background: rgba(0, 0, 0, 0.62); backdrop-filter: blur(4px);
}

/* 详情弹窗：左图右栏（移动端上下堆叠） */
.img-detail { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .9fr); gap: var(--sp-4); align-items: start; }
.img-detail-view { display: flex; align-items: center; justify-content: center; min-height: 320px; background: color-mix(in srgb, var(--bg-glass) 82%, #000); border: 1px solid var(--line-1); border-radius: calc(var(--r-md) + 2px); overflow: hidden; box-shadow: 0 18px 50px rgba(0, 0, 0, .2); }
.img-detail-view img { width: 100%; max-height: 66vh; object-fit: contain; display: block; }
.img-detail-view img[role="button"] { cursor: zoom-in; }
.img-detail-view img[role="button"]:focus-visible { outline: 2px solid var(--neon-cyan); outline-offset: -3px; }
.img-detail-side { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; max-height: 66vh; overflow-y: auto; padding: 2px 6px 2px 2px; }
.img-detail-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); flex-wrap: wrap; }
.img-detail-time { font-size: var(--fs-xs); line-height: 1.5; color: var(--tx-3); }
.img-detail-prompt {
  font-size: var(--fs-sm); color: var(--tx-1); line-height: 1.7; word-break: break-all;
  padding: 12px 14px; border-radius: var(--r-md);
  background: var(--bg-glass); border: 1px solid var(--line-1);
  max-height: 130px; overflow-y: auto;
}
.img-detail-refs .img-ref-img { width: 64px; height: 64px; cursor: zoom-in; }
.img-square-more { display: flex; margin: var(--sp-4) auto var(--sp-2); }
.img-detail-acts { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.img-detail-cmts { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); color: var(--tx-3); padding: 4px 6px; }
.img-remix { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; }

/* 评论区 */
.img-cmt-zone { display: flex; flex-direction: column; gap: var(--sp-2); }
.img-cmts { display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow-y: auto; }
.img-cmt-empty { padding: 8px 0; }
.img-cmt { padding: 8px 10px; border-radius: var(--r-md); background: var(--bg-glass); border: 1px solid var(--line-1); }
.img-cmt-head { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.img-cmt-author { font-size: var(--fs-xs); font-weight: 600; color: var(--tx-2); }
.img-cmt-time { font-size: var(--fs-xs); color: var(--tx-3); margin-left: auto; }
.img-cmt-del { flex: none; opacity: 0.6; }
.img-cmt-del:hover { opacity: 1; color: var(--danger, #ff5d73); }
.img-cmt-body { font-size: var(--fs-sm); color: var(--tx-1); line-height: 1.6; word-break: break-all; }
.img-cmt-editor { display: flex; gap: var(--sp-2); align-items: flex-end; }
.img-cmt-input { flex: 1; resize: none; min-height: 52px; }
.img-cmt-send { flex: none; display: inline-flex; align-items: center; gap: 5px; }

/* 分享选项弹窗 */
.img-share-opts { display: flex; flex-direction: column; gap: var(--sp-3); }
.img-share-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: 10px 12px; border-radius: var(--r-md);
  border: 1px solid var(--line-1); background: var(--bg-glass); cursor: pointer;
  transition: border-color var(--t-fast) var(--ease);
}
.img-share-row:hover { border-color: var(--line-2); }
.img-share-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--neon-cyan); flex: none; }
.img-share-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.img-share-label { font-size: var(--fs-sm); font-weight: 600; color: var(--tx-1); }
.img-share-quick { display: flex; gap: var(--sp-2); justify-content: flex-end; }

/* ============================================================
   任务6：辅助创作提示词面板
   ============================================================ */
.img-assist { display: flex; flex-direction: column; gap: var(--sp-3); }
.img-assist-lock { display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); padding: var(--sp-4) 0; text-align: center; }
.img-assist-lock .empty-art { color: var(--neon-violet); }
.img-assist-search { width: 100%; }
.img-assist-body { display: flex; flex-direction: column; gap: var(--sp-3); max-height: 52vh; overflow-y: auto; padding-right: 2px; }
.img-assist-group { display: flex; flex-direction: column; gap: 6px; }
.img-assist-cat {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--fs-xs); font-weight: 700; color: var(--neon-cyan);
  letter-spacing: 0.04em; position: sticky; top: 0;
  padding: 4px 0; background: var(--bg-1, rgba(10, 14, 26, 0.92)); backdrop-filter: blur(6px); z-index: 1;
}
.img-assist-words { display: flex; flex-wrap: wrap; gap: 6px; }
.img-assist-word {
  padding: 5px 12px; border-radius: var(--r-full);
  font-size: var(--fs-xs); color: var(--tx-2);
  border: 1px solid var(--line-1); background: var(--bg-glass);
  cursor: pointer; transition: all var(--t-fast) var(--ease);
}
.img-assist-word:hover {
  color: var(--tx-on-neon); background: var(--grad-brand);
  border-color: transparent; transform: translateY(-1px);
}
.img-assist-word:active { transform: translateY(0) scale(0.96); }

/* ============================================================
   移动端适配（≤900px）：提示词 + 生成按钮首屏可达，设置折叠，我的作品自然下排
   ============================================================ */
@media (max-width: 900px) {
  .img-studio { padding: var(--sp-3); gap: var(--sp-3); overflow-x: hidden; }
  .img-tabs { overflow-x: auto; }
  .img-tab { flex: 1; justify-content: center; white-space: nowrap; }
  .img-create { grid-template-columns: minmax(0, 1fr); overflow-x: hidden; overflow-y: auto; }
  /* 创作卡不再内部滚动，整页统一滚动，避免「窗口套窗口」的挤压感 */
  .img-panel { overflow: visible; flex: none; gap: var(--sp-3); }
  .img-prompt { min-height: 96px; }
  .img-setup-toggle { display: flex; }
  .img-setup.closed { display: none; }
  .img-right { overflow: visible; min-width: 0; max-width: 100%; }
  .img-current { min-height: 200px; }
  .img-foot { margin-top: 0; }
  .img-mine { overflow-x: visible; }
  .img-mine-tools { grid-template-columns: minmax(110px, .75fr) minmax(140px, 1fr) auto; min-width: 0; }
  .img-mine > .img-grid { grid-auto-flow: row; grid-template-rows: none; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; min-width: 0; }
  .img-detail-side { max-height: none; overflow-y: visible; padding-right: 2px; }
  /* 详情弹窗上下堆叠 */
  .img-detail { grid-template-columns: 1fr; }
  .img-detail-view img { max-height: 44vh; }
  .img-viewer-stage { height: min(62vh, 560px); min-height: 220px; padding: var(--sp-2); }
  .img-remix { margin-left: 0; width: 100%; justify-content: center; }
  .img-cmt-editor { flex-direction: column; align-items: stretch; }
  .img-cmt-send { width: 100%; justify-content: center; }
  .img-assist-body { max-height: 46vh; }
}

@media (min-width: 481px) and (max-width: 900px) {
  .img-grid.square { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}

@media (max-width: 560px) {
  .img-mine { overflow-x: visible; }
  .img-mine > .img-grid { grid-auto-flow: row; grid-auto-columns: auto; grid-template-rows: none; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; min-width: 0; }
  .img-mine-tools { grid-template-columns: 1fr 1fr; }
  .img-mine-tools .btn { grid-column: 1 / -1; justify-content: center; }
  .img-detail-view { min-height: 220px; }
}
