/* create.css —— 创作工坊（沿用 ws.css 的暖色设计令牌） */
/* 将旧名称映射到工作台的深浅色令牌，避免浅色模式使用白色回退文字。 */
.create-main, .create-nav {
  --ink: var(--text);
  --ink-dim: var(--text-dim);
  --ink-faint: var(--text-faint);
  --line: var(--border);
  --panel: var(--bg-soft);
  --bg-input: var(--field);
}

.create-kind {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 0 10px 10px;
}
.create-kind__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 0;
  border-radius: 11px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.08));
  background: transparent;
  color: var(--ink-dim, #b9a9a5);
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.15s;
}
.create-kind__btn.is-active {
  background: var(--soft-accent, rgba(239, 115, 101, 0.12));
  border-color: var(--accent, #ef7365);
  color: var(--ink-accent, #ffaaa0);
  font-weight: 600;
}

.create-history {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0 10px;
}
.create-history__label { font-size: 11.5px; color: var(--ink-faint, #8a7c78); padding: 2px 4px 6px; }
.create-history__list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  gap: 4px;
  align-content: start;
}
.create-history__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 9px;
  border: 0;
  background: transparent;
  color: var(--ink-dim, #b9a9a5);
  font-size: 12.5px;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.create-history__item:hover { background: var(--soft-accent, rgba(239, 115, 101, 0.1)); color: var(--ink, #f4ece9); }
.create-history__item.is-active { background: var(--soft-accent, rgba(239, 115, 101, 0.14)); }
.create-history__item img { width: 26px; height: 26px; border-radius: 6px; object-fit: cover; flex: 0 0 26px; }
.create-history__item .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.create-main { display: flex; flex-direction: column; min-width: 0; }
.create-model-note { font-size: 12px; color: var(--ink-faint, #8a7c78); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.create-body {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 16px;
  padding: 14px 16px 16px;
  min-height: 0;
  overflow: auto;
}
@media (max-width: 900px) { .create-body { grid-template-columns: 1fr; } }

.create-form-panel, .create-result-panel {
  background: var(--panel, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--line, rgba(255, 255, 255, 0.07));
  border-radius: 16px;
  padding: 16px;
  min-width: 0;
}
.create-result-panel { display: flex; flex-direction: column; gap: 12px; }

.create-refs, .create-params { display: grid; gap: 10px; margin-top: 10px; }
.create-field { display: grid; gap: 5px; }
.create-field > label { font-size: 12.5px; color: var(--ink-dim, #b9a9a5); }
.create-field .req { color: var(--accent, #ef7365); }
.create-field input[type="text"], .create-field input[type="number"], .create-field select, .create-field textarea {
  width: 100%;
  background: var(--bg-input, rgba(0, 0, 0, 0.25));
  border: 1px solid var(--line, rgba(255, 255, 255, 0.1));
  border-radius: 10px;
  color: var(--ink, #f4ece9);
  padding: 8px 10px;
  font-size: 13.5px;
  font-family: inherit;
}
.create-field textarea { min-height: 96px; resize: vertical; }
html.theme-light .create-field input, html.theme-light .create-field select, html.theme-light .create-field textarea { background: #fff; }
.create-switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.create-switch input { width: 18px; height: 18px; accent-color: var(--accent, #ef7365); }

.create-refs__slots { display: flex; flex-wrap: wrap; gap: 8px; }
.create-ref-slot {
  width: 72px; height: 72px;
  border: 1.5px dashed var(--line, rgba(255, 255, 255, 0.2));
  border-radius: 12px;
  display: grid; place-items: center;
  color: var(--ink-faint, #8a7c78);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background: var(--bg-input, rgba(0, 0, 0, 0.2));
  font-size: 20px;
}
.create-ref-slot:hover { border-color: var(--accent, #ef7365); color: var(--ink-accent, #ffaaa0); }
.create-ref-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.create-ref-slot .rm {
  position: absolute; top: 2px; right: 2px; z-index: 2;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.65); color: #fff;
  border: 0; cursor: pointer; font-size: 11px; line-height: 1;
  display: none; place-items: center;
}
.create-ref-slot.has-img .rm { display: grid; }

.create-advanced { margin-top: 12px; }
.create-advanced summary { cursor: pointer; font-size: 12.5px; color: var(--ink-faint, #8a7c78); user-select: none; }

.create-submit {
  margin-top: 16px;
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px;
  border: 0; border-radius: 12px;
  background: linear-gradient(120deg, #ef7365, #e3658e);
  color: #fff; font-size: 14.5px; font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s, opacity 0.15s;
}
.create-submit:hover:not(:disabled) { filter: brightness(1.08); }
.create-submit:disabled { opacity: 0.5; cursor: not-allowed; }
.create-msg { margin: 10px 0 0; font-size: 12.5px; color: var(--red, #ff8f8f); line-height: 1.5; }

.create-status {
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--soft-accent, rgba(239, 115, 101, 0.12));
  color: var(--ink-accent, #ffaaa0);
  font-size: 13px;
}
.create-status.is-error {
  background: color-mix(in srgb, var(--red, #f87171) 12%, transparent);
  color: var(--red, #ff8f8f);
}
.create-status.is-done {
  background: color-mix(in srgb, var(--green, #34d399) 12%, transparent);
  color: var(--green, #9be7a3);
}

.create-results { flex: 1; min-height: 200px; }
.create-results .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.create-results img, .create-results video {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.08));
  display: block;
}
.create-results .dl {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-accent, #ffaaa0);
  text-decoration: none;
}
.create-results .dl:hover { text-decoration: underline; }

/* 系列/模式两层选择器 */
.ws-top #seriesSelect { max-width: 200px; }
.ws-top #modeSelect { max-width: 220px; }

/* 空状态与生成中（创作工坊） */
.create-results { display: flex; flex-direction: column; }
.create-empty {
  flex: 1;
  min-height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: radial-gradient(ellipse at 50% 42%, var(--soft-accent), transparent 65%);
  padding: 32px 20px;
}
.create-results .create-empty__mascot, .library-empty__mascot {
  display: block; width: min(320px, 100%); height: 240px; object-fit: contain;
  border: 0; border-radius: 0; margin: 0 auto 12px;
}
.empty-eyebrow { display: block; color: var(--ink-accent); font-size: 11px; font-weight: 600; letter-spacing: 2px; margin-bottom: 10px; }
.create-empty__title { margin: 0; font-size: clamp(18px, 1.6vw, 22px); line-height: 1.5; font-weight: 650; color: var(--text); text-wrap: balance; }
.create-empty__hint { margin: 10px 0 0; font-size: 13px; line-height: 1.9; color: var(--text-dim); text-wrap: pretty; }
.create-empty__steps { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 18px; margin: 24px 0 0; padding: 0; list-style: none; counter-reset: empty-step; }
.create-empty__steps li { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-dim); counter-increment: empty-step; }
.create-empty__steps li::before { content: counter(empty-step); display: grid; place-items: center; width: 19px; height: 19px; border: 1px solid var(--border-strong); border-radius: 50%; font-size: 10px; color: var(--ink-accent); }

.create-processing {
  flex: 1;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.create-processing__ring {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid var(--line, rgba(255,255,255,0.15));
  border-top-color: var(--accent, #ef7365);
  animation: phx-spin 0.9s linear infinite;
}
@keyframes phx-spin { to { transform: rotate(360deg); } }
.create-processing__text { font-size: 13px; color: var(--ink-dim, #b9a9a5); }

/* ---------- 最近生成 ---------- */
.create-library { padding: 0 10px; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.create-library__label { font-size: 11.5px; color: var(--ink-faint, #8a7c78); padding: 2px 4px 6px; }
.create-library__grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding-bottom: 8px;
}
.create-library__item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--line, rgba(255,255,255,0.08));
  background: var(--bg-input, rgba(0,0,0,0.2));
  aspect-ratio: 1;
  transition: border-color 0.15s;
}
.create-library__item:hover { border-color: var(--accent, #ef7365); }
.create-library__item img, .create-library__item video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.create-library__item .kind-tag {
  position: absolute; bottom: 3px; left: 3px;
  font-size: 9px; padding: 1px 5px; border-radius: 4px;
  background: rgba(0,0,0,0.6); color: #fff;
}
.create-library__item .del-btn {
  position: absolute; top: 3px; right: 3px; z-index: 2;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,0,0,0.6); color: #fff; border: 0;
  font-size: 12px; line-height: 1; cursor: pointer;
  display: none; place-items: center;
}
.create-library__item:hover .del-btn { display: grid; place-items: center; }
.create-library__item .del-btn:hover { background: rgba(220,60,60,0.8); }
.create-library__empty { grid-column: 1 / -1; text-align: center; padding: 16px 4px; color: var(--ink-faint, #8a7c78); font-size: 12px; }
.create-result-panel > .create-library { flex: 0 0 auto; padding: 0; }
.create-result-panel .create-library__grid {
  flex: 0 0 auto; max-height: 124px;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
}
.create-result-panel .create-library__item:focus-within { border-color: var(--accent, #ef7365); }
.create-library__item:focus-within .del-btn { display: grid; }
.create-library__item.is-video::after {
  content: "▶"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  color: #fff; background: rgba(0,0,0,.65); border-radius: 50%;
  width: 24px; height: 24px; display: grid; place-items: center; pointer-events: none;
  font-size: 10px;
}
@media (hover: none) { .create-library__item .del-btn { display: grid; } }

/* ---------- 资料库画廊 ---------- */
.library-view { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px; }
.library-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.library-tab {
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line, rgba(255,255,255,0.1));
  background: transparent; color: var(--ink-dim, #b9a9a5);
  font-size: 13px; cursor: pointer; transition: all 0.15s;
}
.library-tab:hover { color: var(--ink, #f4ece9); }
.library-tab.is-active {
  background: var(--soft-accent, rgba(239,115,101,0.12));
  border-color: var(--accent, #ef7365); color: var(--ink-accent, #ffaaa0);
}
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.library-grid__item {
  position: relative; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line, rgba(255,255,255,0.08));
  background: var(--bg-input, rgba(0,0,0,0.2));
}
.library-grid__item:focus-within { border-color: var(--accent, #ef7365); }
.library-grid__item img, .library-grid__item video { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; cursor: pointer; }
.library-grid__open { position: relative; display: block; }
.library-grid__open.is-video::after {
  content: "▶"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  background: rgba(0,0,0,.68); color: #fff; pointer-events: none;
}
.library-grid__resume {
  width: 100%; aspect-ratio: 1; padding: 16px; background: var(--field);
  color: var(--text-dim); font-size: 13px; text-align: center;
}
.create-library__pending { display: grid; place-items: center; min-height: 70px; color: var(--text-dim); font-size: 11px; }

/* ---- 结果已清理（服务器空间策略：结果文件超保留期删除，记录保留）---- */
.create-library__purged {
  display: grid; place-items: center; min-height: 70px; padding: 0 8px;
  color: var(--text-faint); font-size: 11px; text-align: center;
}
.library-grid__purged {
  width: 100%; aspect-ratio: 1; display: grid; place-content: center; justify-items: center;
  gap: 6px; padding: 16px; box-sizing: border-box;
  border: 1px dashed var(--border-strong); border-radius: 10px;
  background: var(--field); color: var(--text-faint); font-size: 12px; text-align: center;
}
.library-grid__purged-icon { font-size: 22px; line-height: 1; opacity: .8; }
.create-purged {
  flex: 1; min-height: 360px; display: grid; place-content: center; justify-items: center;
  gap: 4px; padding: 34px 22px; text-align: center;
}
.create-purged__icon { font-size: 40px; line-height: 1; margin-bottom: 6px; opacity: .85; }
.create-purged__title { margin: 0; font-size: 17px; font-weight: 650; color: var(--text); }
.create-purged__hint { margin: 8px 0 0; max-width: 460px; font-size: 13px; line-height: 1.9; color: var(--text-dim); text-wrap: pretty; }

.library-grid__item .item-del {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(0,0,0,0.7); color: #fff; border: 0;
  font-size: 18px; line-height: 1; cursor: pointer;
  display: none; place-items: center;
}
.library-grid__item:hover .item-del,
.library-grid__item:focus-within .item-del { display: grid; }
.library-grid__item .item-del:hover { background: rgba(220,60,60,0.8); }
.library-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: min(620px, calc(100dvh - 160px)); text-align: center; padding: 36px 20px; border: 1px solid var(--border); border-radius: 20px; background: radial-gradient(ellipse at 50% 42%, var(--soft-accent), transparent 60%); }
.library-empty__title { font-size: 22px; font-weight: 650; color: var(--text); margin: 0 0 10px; line-height: 1.5; }
.library-empty__hint { font-size: 13px; line-height: 1.9; color: var(--text-dim); margin: 0 0 24px; }
.library-empty__btn { display: inline-flex; align-items: center; gap: 16px; box-shadow: var(--grad-shadow); }
.library-empty__btn:hover { filter: brightness(1.06); }
.library-empty__btn, .library-more {
  padding: 10px 24px; border-radius: 12px; border: 0;
  background: linear-gradient(120deg, #ef7365, #e3658e); color: #fff;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.library-more { display: block; margin: 20px auto 0; }
.library-more:disabled { opacity: .6; cursor: wait; }
.library-status { min-height: 1.4em; margin: 12px 0 0; text-align: center; color: var(--ink-dim, #b9a9a5); font-size: 13px; }
.library-status:empty { display: none; }
.library-top-title { font-size: 15px; font-weight: 700; color: var(--text); }
@media (max-width: 560px) {
  .create-empty { min-height: 360px; padding: 24px 12px; }
  .create-results .create-empty__mascot, .library-empty__mascot { width: 260px; max-width: 100%; height: 195px; }
  .create-empty__steps { gap: 10px; }
  .library-empty { padding: 28px 12px; }
  .library-view { padding: 12px; }
  .library-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
  .create-main .ws-top .create-model-note { flex-basis: 100%; }
}
@media (hover: none) {
  .library-grid__item .item-del { display: grid; }
}

/* ---------- 侧栏统一布局：导航撑满、用户区贴底 ---------- */
.ws-side { display: flex; flex-direction: column; }
.create-side-spacer { flex: 1 1 auto; }
.create-nav { display: grid; gap: 4px; padding: 0 10px 8px; }
.create-nav a, .create-nav .create-nav__btn {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: 10px;
  color: var(--ink-dim, #b9a9a5); text-decoration: none;
  font-size: 13.5px; cursor: pointer; border: 0; background: transparent;
  width: 100%; text-align: left;
  transition: background 0.15s, color 0.15s;
}
.create-nav .ico { width: 15px; height: 15px; flex-shrink: 0; }
.create-nav a:hover, .create-nav .create-nav__btn:hover {
  background: var(--soft-accent, rgba(239, 115, 101, 0.1));
  color: var(--ink, #f4ece9);
}
.create-nav .create-nav__btn.is-active,
.create-nav a.is-active {
  background: var(--soft-accent, rgba(239, 115, 101, 0.12));
  color: var(--ink-accent, #ffaaa0); font-weight: 600;
}
.phx-auth-entry { flex-shrink: 0; }

/* 资料库视图显示/隐藏 */
.library-view[hidden] { display: none; }
.create-body[hidden] { display: none; }

/* ---- 生成按钮上方预计费用（珊瑚色徽章） ---- */
.create-cost {
  margin: 14px auto 2px;
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 7px;
  padding: 6px 16px;
  border-radius: 999px;
  background: linear-gradient(120deg, rgba(239, 115, 101, .12), rgba(227, 101, 142, .12));
  border: 1px solid rgba(239, 115, 101, .28);
  color: var(--text-dim, #bdb0c0);
  font-size: 12.5px;
  line-height: 1.4;
  white-space: nowrap;
}
.create-cost__icon {
  width: 14px;
  height: 14px;
  fill: rgba(239, 115, 101, .85);
  flex-shrink: 0;
}
.create-cost__label { letter-spacing: .02em; }
.create-cost__value {
  color: var(--ink-accent, #ffaaa0);
  font-weight: 700;
  font-size: 14px;
}
.create-cost__unit { opacity: .75; }


/* ---------- 抠图（与创作工坊同构） ---------- */
.matting-drop {
  border: 1.5px dashed var(--line, var(--border-strong));
  border-radius: 14px; padding: 28px 16px; text-align: center;
  color: var(--ink-dim, var(--text-dim)); cursor: pointer; background: var(--bg-input, var(--field));
}
.matting-drop:hover, .matting-drop.is-over {
  border-color: var(--accent, rgba(239,115,101,.55));
  background: var(--soft-accent, rgba(239,115,101,.08));
}
.matting-compare {
  display:grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%;
}
.matting-shot {
  margin: 0; background: var(--panel, var(--bg-soft)); border: 1px solid var(--line, var(--border));
  border-radius: 14px; padding: 10px;
}
.matting-shot figcaption {
  font-size: 12px; color: var(--ink-faint, var(--text-faint)); margin-bottom: 8px;
}
.matting-shot img {
  width: 100%; max-height: 360px; object-fit: contain; border-radius: 10px;
  background: repeating-conic-gradient(#ccc 0% 25%, #eee 0% 50%) 50% / 16px 16px;
}
.matting-shot__pending {
  min-height: 180px; display:grid; place-items:center;
  color: var(--ink-faint, var(--text-faint)); font-size: 13px;
  border-radius: 10px; background: var(--bg-input, var(--field));
}
.create-result-actions { display:flex; justify-content:center; margin-top: 8px; }
@media (max-width: 700px) { .matting-compare { grid-template-columns: 1fr; } }
