/* ==========================================================================
   AI 形象工坊 —— 渐变绿主题（结构遵循腾讯 TDesign 规范，主色替换为品牌渐变绿）
   ========================================================================== */
:root {
  /* 品牌色 —— 渐变绿 */
  --brand: #12b76a;
  --brand-2: #4ade80;
  --brand-hover: #0ea45f;
  --brand-active: #0a8b50;
  --brand-light: #eafaf1;
  --brand-focus: #b7ebcd;

  /* 渐变 */
  --grad: linear-gradient(135deg, #0eb767 0%, #46d97f 100%);
  --grad-hover: linear-gradient(135deg, #0aa85f 0%, #38cf72 100%);

  /* 功能色 */
  --success: #2ba471;
  --error: #d54941;

  /* 文字 */
  --text-1: rgba(0, 0, 0, 0.9);
  --text-2: rgba(0, 0, 0, 0.6);
  --text-3: rgba(0, 0, 0, 0.4);
  --text-4: rgba(0, 0, 0, 0.26);
  --text-anti: #ffffff;

  /* 背景 */
  --bg-page: #f4f8f5;
  --bg-container: #ffffff;
  --bg-secondary: #f4f8f5;

  /* 边框 */
  --border-1: #e7e7e7;
  --border-2: #dcdcdc;

  /* 圆角 */
  --r-s: 3px;
  --r: 6px;
  --r-l: 9px;
  --r-xl: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

/* hidden 属性必须真的能隐藏元素。
   浏览器默认的 [hidden]{display:none} 来自 UA 样式表，作者写的
   .head-name{display:inline-flex} / .results{display:flex} 这类规则
   优先级更高、会把它整个盖掉，导致 el.hidden = true 完全失效
   （表现：页头右侧的编辑图标在初始状态就露出来）。 */
[hidden] { display: none !important; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-page);
  color: var(--text-1);
  font-size: 14px;
  line-height: 1.5;
  max-width: 480px;
  margin: 0 auto;
  /* 底部预留吸底操作栏的高度，避免最后一张卡片被遮住 */
  padding: 0 16px calc(112px + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}

/* ---------------- 页头 ---------------- */
.page-head { padding: 20px 0 16px; }
.head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
/* 页头右上角：当前称呼 + 修改入口（字号比大标题小） */
.head-name {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 46%;
  padding: 4px 8px;
  border: 1px solid var(--border-1);
  border-radius: var(--r-s);
  background: var(--bg-container);
  color: var(--text-2);
  font-size: 13px;
  line-height: 18px;
  cursor: pointer;
}
/* 同上：悬停只在有鼠标时生效，避免触屏点完页头称呼后绿边一直挂着 */
@media (hover: hover) and (pointer: fine) {
  .head-name:hover { border-color: var(--brand); color: var(--brand); }
}
.head-name:active { border-color: var(--brand); color: var(--brand); }
.head-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.head-name-edit { width: 16px; height: 16px; flex: none; }
.page-head h1 {
  font-size: 20px;
  font-weight: 700;
  line-height: 28px;
  color: var(--brand);
  background: linear-gradient(120deg, #0a9e58 0%, #2fc46c 55%, #4ade80 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.page-head p {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-2);
}

/* ---------------- 卡片 ---------------- */
.td-card {
  background: var(--bg-container);
  border: 1px solid var(--border-1);
  border-radius: var(--r-xl);
  padding: 16px;
  margin-bottom: 12px;
}
.td-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.td-card-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  color: var(--text-1);
}
.td-count {
  display: inline-block;
  min-width: 20px;
  padding: 0 8px;
  margin-left: 4px;
  border-radius: var(--r-s);
  background: var(--grad);
  color: var(--text-anti);
  font-size: 12px;
  font-weight: 500;
  line-height: 20px;
  text-align: center;
}
.td-hint {
  margin: 16px 0;
  padding: 8px 12px;
  border-radius: var(--r);
  background: var(--brand-light);
  color: #0a8b50;
  font-size: 12px;
  line-height: 1.5;
}

/* ---------------- 列表行 ---------------- */
.td-row { display: flex; align-items: center; gap: 12px; }
.td-thumb {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  border-radius: var(--r);
  background: var(--bg-secondary);
  border: 1px solid var(--border-1);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.td-thumb img { width: 100%; height: 100%; object-fit: cover; }
.td-thumb.has-img img { display: none; }
.td-thumb.has-img { cursor: zoom-in; }
.td-row-main { flex: 1; min-width: 0; }
.td-row-title { font-size: 15px; font-weight: 600; color: var(--text-1); }
.td-row-desc {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.4;
}

/* ---------------- 按钮 ---------------- */
.td-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid var(--border-2);
  background: var(--bg-container);
  color: var(--text-1);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  padding: 0 16px;
  height: 40px;
  border-radius: var(--r);
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s, border-color .2s, color .2s;
}
.td-btn-s { height: 32px; padding: 0 12px; font-size: 13px; }
.td-btn-block { display: flex; width: 100%; }
.td-btn-primary {
  background: var(--grad);
  border-color: transparent;
  color: var(--text-anti);
  font-size: 16px;
  font-weight: 600;
  height: 48px;
  box-shadow: 0 4px 12px rgba(18, 183, 106, .26);
  transition: filter .2s, box-shadow .2s;
}
/* 主按钮同理：避免触屏点完「开始更换」后一直停在变暗的悬停态 */
@media (hover: hover) and (pointer: fine) {
  .td-btn-primary:hover:not(:disabled) { filter: brightness(.95); box-shadow: 0 6px 16px rgba(18, 183, 106, .32); }
}
.td-btn-primary:active:not(:disabled) { filter: brightness(.88); box-shadow: 0 2px 8px rgba(18, 183, 106, .22); }
.td-btn-primary:disabled {
  background: var(--brand-light);
  border-color: var(--brand-focus);
  color: #7fc4a2;
  box-shadow: none;
  cursor: default;
}
.td-btn-ghost { background: var(--bg-container); color: var(--text-1); }
/* 悬停反馈只在「真有鼠标」的设备上生效。
   触屏上 :hover 会「粘」在最后点过的元素上 —— 点完「上传」选完照片后，
   按钮会一直挂着绿色描边，看起来像还选中着。按下瞬间给绿边表示"正在点"，松手即恢复。 */
@media (hover: hover) and (pointer: fine) {
  .td-btn-ghost:not(:disabled):hover { border-color: var(--brand); color: var(--brand); }
}
.td-btn-ghost:not(:disabled):active { border-color: var(--brand); color: var(--brand); }
.td-btn-ghost:disabled { color: var(--text-4); border-color: var(--border-1); }

/* ---------------- 吸底操作栏 ---------------- */
.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: rgba(244, 248, 245, .94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-1);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.bottom-bar-inner { max-width: 480px; margin: 0 auto; }
.bottom-status {
  margin: 0 0 8px;
  text-align: center;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-2);
}
.bottom-status:empty { display: none; }

/* ---------------- 待试清单（纵向行 + 分段选择类型）---------------- */
.pick-list { display: flex; flex-direction: column; }
.p-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border-1);
}
.p-row:first-child { border-top: 0; padding-top: 0; }
.p-thumb {
  cursor: zoom-in;
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  border-radius: var(--r);
  background-color: var(--bg-secondary);
  background-size: cover;
  background-position: center;
  border: 1px solid var(--border-1);
}
.p-main { flex: 1; min-width: 0; }
.p-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.p-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.p-del {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border-2);
  background: var(--bg-container);
  color: var(--text-2);
  font-size: 13px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}
.p-seg { display: flex; gap: 8px; margin-top: 8px; }
.p-seg-btn {
  flex: 1 1 0;
  height: 32px;
  padding: 0 4px;
  border: 1px solid var(--border-1);
  border-radius: var(--r);
  background: var(--bg-container);
  color: var(--text-2);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
/* 悬停反馈只给「真有鼠标」的设备（hover:hover），并且用中性底色而不是品牌绿描边。
   原因：触屏上 :hover 会「粘」在最后点过的元素上 —— 点一下选中、再点一下取消后，
   按钮仍显示绿色描边，看起来像还选着。用绿色描边本身也容易和 .on 的选中态混淆。 */
@media (hover: hover) and (pointer: fine) {
  .p-seg-btn:not(.on):hover { background: var(--bg-secondary); }
}
/* 鼠标/触摸点击后不要留下焦点框（键盘导航仍保留，保证可访问性） */
.p-seg-btn:focus:not(:focus-visible) { outline: none; }
.p-seg-btn.on {
  background: var(--grad);
  border-color: transparent;
  color: var(--text-anti);
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(18, 183, 106, .28);
}

/* ---------------- 结果（置顶卡片）---------------- */
.r-empty {
  padding: 28px 12px;
  border-radius: var(--r-l);
  background: var(--bg-secondary);
  text-align: center;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-3);
}
.results {
  position: relative;
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.results::-webkit-scrollbar { display: none; }
.result-item {
  flex: 0 0 100%;
  scroll-snap-align: center;
}
.r-shot { display: flex; align-items: center; justify-content: center; }
.r-figure { position: relative; display: inline-block; max-width: 100%; isolation: isolate; }
.r-img {
  display: block;
  max-width: 100%;
  max-height: 62vh;
  border-radius: var(--r-l);
  cursor: zoom-in;
}
/* 左上角：在「原参考图」和「生成效果」之间切换 */
.r-swap {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .82);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: rgba(0, 0, 0, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
}
.r-swap:hover { background: rgba(255, 255, 255, .96); color: rgba(0, 0, 0, .8); }
.r-swap svg { width: 19px; height: 18px; }
.r-swap.on {
  background: var(--brand);
  color: var(--text-anti);
  box-shadow: 0 1px 6px rgba(18, 183, 106, .35);
}
/* 右上角：下载。无底色纯图标，黑/白 50% —— 由 JS 采样图片明暗后决定用哪个 */
.r-dl {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .82);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: rgba(0, 0, 0, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
}
.r-dl:hover { background: rgba(255, 255, 255, .96); color: rgba(0, 0, 0, .8); }
.r-dl svg { width: 20px; height: 20px; }
/* 右下角：删掉这张效果（**只删本地画面**，服务端归档里仍保留全部记录，
   管理员在「生成记录」里依然看得到，所以这张图不会被真正丢掉） */
.r-del {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .82);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: rgba(0, 0, 0, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
}
.r-del svg { width: 19px; height: 19px; }
/* 触屏上 :hover 会粘住，所以红色只在真有鼠标悬停 / 按下时出现 */
@media (hover: hover) and (pointer: fine) {
  .r-del:hover { background: rgba(255, 255, 255, .96); color: var(--error); }
}
.r-del:active {
  background: var(--error);
  color: #fff;
}
/* 切换后提示当前看的是哪张 */
.r-badge {
  position: absolute;
  top: 48px;
  left: 12px;
  padding: 4px 8px;
  border-radius: var(--r-s);
  background: rgba(0, 0, 0, .58);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  white-space: nowrap;
}
/* 结果卡右上角：最近一张的实际输出尺寸与耗时（用来确认画质档位生效了） */
.r-meta {
  font-size: 12px;
  line-height: 18px;
  color: var(--text-3);
  white-space: nowrap;
  text-align: right;
}
.r-ph {
  width: 100%;
  padding: 56px 12px;
  border-radius: var(--r-l);
  background: var(--bg-secondary);
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
}
.r-ph.bad { color: var(--error); }
/* ---------------- 滑动点 ---------------- */
/* ---------------- 效果缩略图条（点小图切上方大图）---------------- */
.thumbs {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  padding: 4px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.thumbs::-webkit-scrollbar { display: none; }
.thumb {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: var(--r);
  background-color: var(--bg-secondary);
  background-size: cover;
  background-position: center;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
.thumb.on {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(18, 183, 106, .2);
}

/* ---------------- 分享 ---------------- */
.qr-box { display: flex; justify-content: center; align-items: center; min-height: 172px; }
.qr-box img, .qr-box canvas {
  display: block;
  border-radius: var(--r);
  border: 4px solid var(--bg-secondary);
}
.share-url {
  margin: 12px 0 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-2);
  word-break: break-all;
}
.share-tip {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.6;
  text-align: center;
}

/* ---------------- 访客留名（仅外部访客首次可见）---------------- */
.name-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.name-title { font-size: 15px; font-weight: 600; color: var(--text-1); }
.name-row { display: flex; gap: 8px; margin-top: 12px; }
.name-row input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-1);
  border-radius: var(--r);
  background: var(--bg-secondary);
  color: var(--text-1);
  font-family: inherit;
  font-size: 14px;
  outline: none;
}
.name-row input:focus { border-color: var(--brand); background: var(--bg-container); }
/* 保存按钮与输入框严格等高 */
.name-row .td-btn { height: 36px; font-size: 14px; }
.name-skip {
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-3);
  font-family: inherit;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------------- 访问管理（仅本机可见）---------------- */
.admin-badge {
  font-size: 11px;
  line-height: 18px;
  padding: 0 8px;
  border-radius: var(--r-s);
  background: var(--brand-light);
  color: var(--brand);
}

/* ---------------- 阿里云可用额度（只在本机显示） ---------------- */
.quota-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.quota-amount {
  font-size: 28px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}
.quota-currency {
  font-size: 13px;
  color: var(--text-3);
}
.quota-sub {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-3);
}
.quota-refresh {
  flex: 0 0 auto;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--border-1);
  border-radius: var(--r);
  background: var(--bg-container);
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.quota-refresh:hover { border-color: var(--brand); color: var(--brand-active); }
.quota-refresh:disabled { opacity: .5; cursor: default; }
.quota-err { color: var(--error); }

.sw-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--r-l);
  background: var(--bg-secondary);
}
.sw-main { flex: 1; min-width: 0; }
.sw-title { font-size: 14px; font-weight: 500; color: var(--text-1); }
.sw-desc { margin-top: 4px; font-size: 12px; color: var(--text-3); }

.sw {
  position: relative;
  flex: 0 0 48px;
  width: 48px;
  height: 28px;
  border: 0;
  padding: 0;
  border-radius: 14px;
  background: #d0d0d0;
  cursor: pointer;
  transition: background .2s, box-shadow .2s;
}
.sw[aria-checked="true"] {
  background: var(--grad);
  box-shadow: 0 2px 8px rgba(18, 183, 106, .3);
}
.sw-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .2s;
}
.sw[aria-checked="true"] .sw-knob { transform: translateX(20px); }

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 8px;
}
.admin-title { font-size: 14px; font-weight: 500; color: var(--text-1); }

.vlist { display: flex; flex-direction: column; }
.v-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--border-1);
}
.v-item:first-child { border-top: 0; }
.v-icon {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: var(--r-l);
  background: var(--brand-light);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
}
.v-icon svg { width: 18px; height: 18px; }
.v-item.is-blocked .v-icon { background: rgba(213, 73, 65, .1); color: var(--error); }
.v-main { flex: 1; min-width: 0; }
.v-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v-meta {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v-time { margin-top: 4px; font-size: 11px; color: var(--text-4); }
.v-block {
  flex: 0 0 auto;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  background: var(--bg-container);
  color: var(--text-2);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.v-block:hover { border-color: var(--error); color: var(--error); }
.v-item.is-blocked .v-block:hover { border-color: var(--brand); color: var(--brand); }

.v-empty {
  padding: 16px 0 8px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}

.admin-tip {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-1);
  font-size: 11px;
  line-height: 1.7;
  color: var(--text-3);
}

/* ---------------- 全屏查看（点击效果图）---------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, .93);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px;
  text-align: center;
}
.lightbox img {
  display: block;
  width: 100%;
  max-width: 640px;
  height: auto;
  margin: 0 auto;
  border-radius: var(--r);
}
.lightbox-close {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: 12px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .3); }

/* ---------------- 生成记录（仅本机可见）---------------- */
.rgrid {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.rgrid::-webkit-scrollbar { display: none; }
.rg-item {
  flex: 0 0 72px;
  width: 72px;
  cursor: pointer;
}
.rg-img {
  width: 72px;
  height: 72px;
  border-radius: var(--r);
  background-color: var(--bg-secondary);
  background-size: cover;
  background-position: center top;
  border: 1px solid var(--border-1);
}
.rg-who {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-3);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rg-empty {
  padding: 16px 0 8px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}

/* ---------------- 生成中的视觉反馈 ---------------- */

/* 小转圈：状态行和结果占位共用 */
@keyframes td-spin {
  to { transform: rotate(360deg); }
}
.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  vertical-align: -2px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: td-spin .8s linear infinite;
}

/* 结果占位：生成中时轻轻呼吸 */
@keyframes td-breath {
  0%, 100% { opacity: .55; }
  50%      { opacity: 1; }
}
.r-ph.busy {
  animation: td-breath 1.8s ease-in-out infinite;
}

/* 页头称呼的占位态（用户点了「跳过」时显示「昵称」） */
.head-name-text.is-placeholder { color: var(--text-3); }

/* 本地记录清理入口 */
.local-clear { margin: 16px 0 8px; text-align: center; }
.local-clear button {
  padding: 4px 8px;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  color: var(--text-3);
  text-decoration: underline;
  cursor: pointer;
}
.local-clear button:hover { color: var(--text-2); }

/* 尊重系统「减少动态效果」偏好 */
@media (prefers-reduced-motion: reduce) {
  .spinner,
  .r-ph.busy {
    animation: none;
  }
}

/* ---------------- 生成模式切换（换装 / 换姿势 / 换脸）---------------- */
.mode-seg {
  display: flex;
  gap: 4px;
  margin: 16px 0 0;
  padding: 4px;
  border-radius: 8px;
  background: #eef1ef;
}
.mode-btn {
  flex: 1;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  cursor: pointer;
}
.mode-btn.on {
  background: var(--brand);
  color: var(--text-anti);
  font-weight: 500;
}

/* 输出画质：左侧标签 + 右侧下拉框（每档的耗时直接写在选项文字里） */
.opt-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 0;
}
.opt-line-label {
  flex: 0 0 auto;
  font-size: 13px;
  color: var(--text-2);
}
.opt-select {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--border-1);
  border-radius: var(--r);
  background-color: var(--bg-container);
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398a2b3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px 16px;
  color: var(--text-1);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.opt-select:focus { border-color: var(--brand); outline: none; }

/* 「换效果」：与画质下拉同一行的小按钮，用来重抽一次随机种子 */
.reseed-btn {
  flex: 0 0 auto;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-1);
  border-radius: var(--r);
  background: var(--bg-container);
  color: var(--text-2);
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.reseed-btn:hover { border-color: var(--brand); color: var(--brand-active); }
.reseed-btn:active { background: var(--bg-secondary); }
