/* M25-C：全站品牌色 token（老板 2026-10-05 拍板：按钮绿底 + 深色字，对齐达笔）。
   语义：实心按钮底/主色填充 = --brand；hover/描边/链接强调 = --brand-strong；
   渐变末端 = --brand-weak；压在绿底上的字 = --brand-ink；选中浅底 = --brand-soft。
   用法一律带兜底（例：var(--brand, #71DC68)），页面单独打开也不掉色。 */
:root {
  --brand: #71DC68;
  --brand-strong: #5BC85A;
  --brand-weak: #78FB60;
  --brand-ink: #14331B;
  --brand-soft: rgba(113, 220, 104, 0.14);
  --brand-line: #A9EFA4;   /* 浅绿描边 / 虚线框（替代原来的浅蓝描边那一档） */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #ffffff;
  color: #1f2937;
}

.container {
  max-width: 720px;
  margin: 40px auto;
  padding: 0 16px;
}

h1 { margin-bottom: 24px; }

.card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

label { font-size: 14px; color: #4b5563; }

input, textarea, select {
  background: #ffffff;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand-strong, #5BC85A);
}

button {
  background: var(--brand, #71DC68);
  color: var(--brand-ink, #14331B);
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

button:hover { background: var(--brand-strong, #5BC85A); }

label.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: #1f2937;
}
label.checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
}

pre {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  font-size: 12px;
  overflow-x: auto;
  margin: 0;
}

.hidden { display: none; }

#result-status {
  white-space: pre-wrap;
  font-size: 13px;
  color: #4b5563;
}

/* === 进度条（v2.5 批量生成） === */
#progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand, #71DC68), var(--brand-weak, #78FB60));
  width: 0;
  transition: width 0.3s ease;
  border-radius: 4px;
}

.progress-text {
  font-size: 13px;
  color: #4b5563;
  font-variant-numeric: tabular-nums;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.image-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;  /* v7.3: 让 .fav-btn 绝对定位到右上角 */
}

.image-item img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
}

.image-item a {
  text-align: center;
  background: var(--brand, #71DC68);
  color: var(--brand-ink, #14331B);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
}

.image-item a:hover { background: var(--brand-strong, #5BC85A); }

.template-desc {
  margin: -4px 0 0;
  font-size: 12px;
  color: #6b7280;
  font-style: italic;
}

.template-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  background: #ffffff;
  border: 1px dashed #e5e7eb;
  border-radius: 8px;
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ratio-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ratio-btn {
  flex: 1;
  text-align: center;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
  min-width: 80px;
  font-size: 13px;
  color: #4b5563;
  user-select: none;
}
.ratio-btn input { display: none; }
.ratio-btn:has(input:checked) {
  border-color: var(--brand-strong, #5BC85A);
  background: rgba(113,220,104,0.15);
  color: var(--brand-strong, #5BC85A);
}
.ratio-btn:hover {
  border-color: var(--brand-strong, #5BC85A);
}

/* === 烧字区 === */
.burn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.burn-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 4px;
}

.burn-actions select {
  flex: 1;
  min-width: 120px;
}

.burn-actions button {
  flex: 0 0 auto;
}

.burn-status {
  font-size: 13px;
  color: #4b5563;
  min-height: 18px;
  white-space: pre-wrap;
}

.burned-image {
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  margin-top: 4px;
}

.burned-download {
  display: inline-block;
  text-align: center;
  background: var(--brand, #71DC68);
  color: var(--brand-ink, #14331B);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  width: fit-content;
}

.burned-download:hover { background: var(--brand-strong, #5BC85A); }

/* v2.2 参考图预览 */
.reference-preview-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}
.reference-preview {
  max-width: 200px;
  max-height: 200px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
}
.btn-link {
  background: transparent;
  border: none;
  color: #ff6b6b;
  cursor: pointer;
  font-size: 13px;
  padding: 4px 8px;
}
.btn-link:hover { text-decoration: underline; }

/* === v3 成本中心 === */

.muted { color: #6b7280; font-size: 12px; }
.err { color: #dc2626; font-size: 13px; }

.cost-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 4px;
}
.cost-section-title h2 { margin: 0; }
.cost-section-title .small-btn {
  background: #e5e7eb;
  color: #4b5563;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 6px;
  font-weight: 500;
}
.cost-section-title .small-btn:hover { background: #3a414c; }

.cost-summary-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 8px 0 12px;
}
.cost-kpi {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}
.cost-kpi .kpi-label {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}
.cost-kpi .kpi-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--brand-strong, #5BC85A);
  font-variant-numeric: tabular-nums;
}
.cost-kpi .kpi-value.cny { color: #ffb84d; }
.cost-kpi .kpi-value.imgs { color: #5fd49a; }

.cost-sub {
  font-size: 13px;
  color: #4b5563;
  margin: 10px 0 4px;
  font-weight: 600;
}

.cost-row {
  display: grid;
  grid-template-columns: 90px 1fr 180px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  padding: 6px 0;
}
.cost-key {
  color: #1f2937;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cost-bar-wrap {
  background: #ffffff;
  border-radius: 4px;
  height: 10px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}
.cost-bar {
  background: linear-gradient(90deg, var(--brand, #71DC68), var(--brand-weak, #78FB60));
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}
.cost-meta {
  text-align: right;
  color: #4b5563;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

/* 排行榜 */
.lb-table {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lb-row {
  display: grid;
  grid-template-columns: 32px 1fr 1.5fr 80px;
  gap: 8px;
  align-items: center;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
}
.lb-rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  background: #e5e7eb;
  color: #4b5563;
}
.lb-rank.rank-1 { background: #ffd54a; color: #1a1a1a; }
.lb-rank.rank-2 { background: #c0c8d4; color: #1a1a1a; }
.lb-rank.rank-3 { background: #d4925a; color: #1a1a1a; }
.lb-name { color: #1f2937; font-weight: 500; }
.lb-meta { color: #6b7280; font-size: 12px; font-variant-numeric: tabular-nums; }
.lb-roi { color: #5fd49a; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

.lb-tabs {
  display: flex;
  gap: 4px;
  margin: 4px 0 8px;
  border-bottom: 1px solid #e5e7eb;
}
.lb-tab {
  background: transparent;
  color: #6b7280;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 0;
}
.lb-tab.active { color: var(--brand-strong, #5BC85A); border-bottom-color: var(--brand-strong, #5BC85A); }
.lb-tab:hover { color: #1f2937; background: transparent; }
.lb-panel { display: none; }
.lb-panel.active { display: block; }

/* 模型配置 + 商业价值 */
.mc-row, .iv-row {
  display: grid;
  grid-template-columns: 1fr 1.5fr 80px;
  gap: 8px;
  align-items: center;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 6px;
}
.mc-name, .iv-name { color: #1f2937; font-weight: 500; }
.mc-cost, .iv-val {
  display: flex;
  align-items: center;
  gap: 4px;
}
.mc-input, .iv-input {
  width: 80px;
  padding: 4px 8px;
  font-size: 13px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.mc-save, .iv-save {
  background: #e5e7eb;
  color: #4b5563;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 6px;
  font-weight: 500;
}
.mc-save:hover, .iv-save:hover { background: var(--brand-strong, #5BC85A); color: var(--brand-ink, #14331B); }
.mc-save:disabled, .iv-save:disabled { opacity: 0.6; cursor: not-allowed; }

/* 标记按钮 */
.mark-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 12px;
}
.mark-btn {
  background: #e5e7eb;
  color: #4b5563;
  border: 1px solid #3a414c;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 16px;
  cursor: pointer;
  flex: 0 0 auto;
  line-height: 1;
}
.mark-btn:hover { background: #3a414c; }
.mark-btn.active.mark-up { background: #5fd49a; border-color: #5fd49a; }
.mark-btn.active.mark-down { background: #ff6b6b; border-color: #ff6b6b; }
.mark-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.mark-status { color: #6b7280; font-size: 12px; flex: 1; }
.mark-status.mark-ok { color: #5fd49a; }
.mark-status.mark-err { color: #ff6b6b; }

/* === v7.1 图片查看器（点击放大 + 键盘切换 + 下载） === */
.image-viewer {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.image-viewer.hidden { display: none; }
.iv-image {
  max-width: 95vw;
  max-height: 88vh;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.12);
  -webkit-user-drag: true;
}
.iv-toolbar {
  position: absolute;
  top: 16px; right: 16px;
  display: flex; gap: 12px; align-items: center;
  color: #fff; font-size: 14px;
}
.iv-counter {
  background: rgba(0, 0, 0, 0.6);
  padding: 4px 12px;
  border-radius: 12px;
  font-variant-numeric: tabular-nums;
}
.iv-close, .iv-prev, .iv-next {
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.iv-close:hover, .iv-prev:hover, .iv-next:hover {
  background: rgba(0, 0, 0, 0.12);
}
.iv-prev { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); }
.iv-next { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); }
/* C66：右侧信息栏（C54 加的 .iv-info，right:12px + width:280px + z-index:2）会把「下一张」
   整块盖住 —— 36px 按钮正好落在面板底下，鼠标点不动（键盘方向键不受影响）。
   面板展开时把按钮左移一个面板宽度 + 间隔：12 + 280 + 12 = 304。
   用 :has() 跟着真实 DOM 状态走（面板显隐有三处开关，用选择器就不用改 JS）；
   窄屏断点里 .iv-narrow 会自动隐藏信息栏，所以这条天然不会误伤移动端。
   ★ 不要改成「提高 .iv-next 的 z-index」—— 按钮会浮在面板文字上，更难看。 */
#image-viewer:has(.iv-info:not([hidden])):not(.iv-narrow) .iv-next { right: 304px; }
.iv-actions {
  position: absolute;
  bottom: 24px;
  display: flex; gap: 12px;
}
.iv-download {
  background: rgba(113,220,104,0.95);
  color: var(--brand-ink, #14331B);
  padding: 10px 20px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
}
.iv-download:hover { background: rgba(113,220,104,1); }

/* === v7.3 我的图库 === */
.lib-tabs { display: flex; gap: 8px; margin: 16px 0; }
.lib-tab {
  padding: 8px 16px; border: none; background: #f3f4f6;
  border-radius: 8px; cursor: pointer; font-size: 14px;
  color: #374151; transition: background 0.15s;
}
.lib-tab:hover { background: #e5e7eb; }
.lib-tab.active { background: var(--brand, #71DC68); color: var(--brand-ink, #14331B); }
.lib-pane { display: none; }
.lib-pane.active { display: block; }
.lib-toolbar {
  display: flex; gap: 12px; margin-bottom: 16px; align-items: center;
}
.lib-toolbar select {
  padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 6px;
  background: #fff; font-size: 13px;
}
.lib-refresh-btn {
  padding: 6px 12px; border: 1px solid #d1d5db; background: #fff;
  border-radius: 6px; cursor: pointer; font-size: 13px; color: #374151;
}
.lib-refresh-btn:hover { background: #f3f4f6; }
/* v16.11: 范围切换按钮（全部/我的） */
.lib-scope-btn {
  padding: 6px 12px; border: 1px solid #d1d5db; background: #fff;
  border-radius: 6px; cursor: pointer; font-size: 13px; color: #374151;
  transition: all 0.15s;
}
.lib-scope-btn:hover { background: #f3f4f6; }
.lib-scope-btn.active { background: var(--brand, #71DC68); color: var(--brand-ink, #14331B); border-color: var(--brand-strong, #5BC85A); }
.lib-count { color: #6b7280; font-size: 13px; margin-left: auto; }
.lib-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.lib-card {
  background: #fff; border-radius: 8px; overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1); position: relative;
  transition: transform 0.15s, box-shadow 0.15s;
}
.lib-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.lib-card img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  display: block; cursor: zoom-in; background: #f3f4f6;
}
.lib-card .lib-meta { padding: 8px 12px; font-size: 13px; }
.lib-card .lib-prompt {
  color: #6b7280; font-size: 12px; max-height: 2.4em;
  overflow: hidden; text-overflow: ellipsis; line-height: 1.2;
  margin-top: 4px; word-break: break-all;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.lib-card .lib-date { color: #6b7280; font-size: 11px; }
.lib-card .lib-badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  background: var(--brand-soft, rgba(113,220,104,.14)); color: var(--brand-strong, #5BC85A); font-size: 11px; margin-right: 4px;
}
.lib-card .fav-btn {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0, 0, 0, 0.12); border: none;
  width: 32px; height: 32px; border-radius: 50%;
  cursor: pointer; font-size: 18px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: background 0.15s, transform 0.15s;
}
.lib-card .fav-btn:hover {
  background: rgba(0, 0, 0, 0.12);
  transform: scale(1.08);
}
.lib-card .fav-btn.is-fav { background: #fff8dc; }
/* v18.5: 图片唯一编号徽章（左上角，点击复制） */
.lib-card .lib-badge-id {
  position: absolute; top: 8px; left: 8px;
  background: rgba(30, 41, 59, 0.85); color: #f1f5f9;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 10px; letter-spacing: 0.2px;
  padding: 3px 8px; border-radius: 4px;
  border: none; cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: background 0.15s, transform 0.15s;
  max-width: calc(100% - 80px); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.lib-card .lib-badge-id:hover { background: rgba(30, 41, 59, 0.95); transform: scale(1.03); }
.lib-card .lib-badge-id.is-copied { background: #10b981; color: #fff; }
.lib-empty {
  padding: 40px; text-align: center; color: #6b7280;
  background: #f9fafb; border-radius: 8px; font-size: 14px;
}
.lib-empty a { color: var(--brand-strong, #5BC85A); text-decoration: underline; }
.lib-empty.hidden { display: none; }
.lib-pager {
  display: flex; gap: 8px; margin: 16px 0; justify-content: center;
  align-items: center;
}
.lib-pager button {
  padding: 6px 12px; border: 1px solid #d1d5db; background: #fff;
  color: #1f2937;
  border-radius: 6px; cursor: pointer; font-size: 13px;
}
.lib-pager button:hover:not(:disabled) { background: #f3f4f6; }
.lib-pager button:disabled { opacity: 0.4; cursor: not-allowed; }
/* === /v7.3 我的图库 === */

/* === v7.5 提示词 + 参考图 === */
.lib-image { display: block; width: 100%; }
.lib-prompt {
  padding: 6px 10px 4px;
  font-size: 12px;
  color: #374151;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.8em;
}
.lib-prompt.empty { color: #6b7280; font-style: italic; }
.lib-prompt.empty::before { content: "(无提示词)"; }
.lib-badges {
  display: flex;
  gap: 4px;
  padding: 0 10px 6px;
  flex-wrap: wrap;
  align-items: center;
}
.lib-badge-link {
  background: #fef3c7 !important;
  color: #92400e !important;
}
.lib-badge-time {
  background: #f3f4f6 !important;
  color: #6b7280 !important;
  margin-left: auto;
}
.lib-ref {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 10px;
  background: #f9fafb;
  border-top: 1px solid #f3f4f6;
}
.lib-ref-img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  cursor: zoom-in;
  border: 1px solid #e5e7eb;
}
.lib-ref-img:hover { border-color: var(--brand-strong, #5BC85A); }
.lib-ref-label {
  font-size: 11px;
  color: #6b7280;
}
/* === /v7.5 提示词 + 参考图 === */

/* === v8.2 积分体系 === */
.estimate-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #f59e0b;
  border-radius: 8px;
  margin: 16px 0;
}
.estimate-label {
  font-size: 14px;
  color: #78350f;
  font-weight: 500;
}
.estimate-points {
  font-size: 20px;
  font-weight: 700;
  color: #b45309;
  font-variant-numeric: tabular-nums;
}
#estimate-btn {
  margin-left: auto;
  padding: 6px 14px;
  background: #f59e0b;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
#estimate-btn:hover { background: #d97706; }
.lib-badge-points {
  background: #fef3c7 !important;
  color: #92400e !important;
  font-weight: 600 !important;
}
/* === /v8.2 积分体系 === */

/* === v8.3.1 顶部积分余额条 === */
.points-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px;
  background: linear-gradient(90deg, #fef3c7 0%, #fde68a 50%, #fef3c7 100%);
  border-bottom: 1px solid #f59e0b;
  font-size: 13px;
  position: sticky;
  top: 56px; /* topnav 下面 */
  z-index: 50;
}
.points-icon { font-size: 14px; }
.points-text { color: #78350f; }
.points-text strong {
  font-size: 14px;
  color: #b45309;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.points-low {
  color: #dc2626 !important;
  animation: points-pulse 1.5s infinite;
}
@keyframes points-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}
.points-bar-track {
  flex: 1;
  max-width: 300px;
  height: 6px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
  overflow: hidden;
}
.points-bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
  transition: width 0.3s;
}
.points-name {
  color: #78350f;
  font-size: 12px;
  white-space: nowrap;
}
.points-admin {
  color: var(--brand-strong, #5BC85A);
  text-decoration: none;
  font-size: 12px;
  padding: 2px 8px;
  border: 1px solid var(--brand-strong, #5BC85A);
  border-radius: 4px;
  white-space: nowrap;
}
.points-admin:hover { background: var(--brand-soft, rgba(113,220,104,.14)); }
/* === /v8.3.1 顶部积分余额条 === */

/* === v10.1 新手引导 banner === */
.onboarding-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: #fef3c7;
  border-bottom: 1px solid #f59e0b;
  color: #78350f;
  font-size: 14px;
}
.onboarding-banner.hidden { display: none; }
.onboarding-banner > span {
  flex: 0 1 auto;
}
.onboarding-banner button {
  padding: 4px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #78350f;
}
#btn-onboarding {
  background: var(--brand, #71DC68);
  color: var(--brand-ink, #14331B);
}
#btn-onboarding:hover {
  background: var(--brand-strong, #5BC85A);
}
#btn-dismiss-onboarding {
  background: transparent;
  color: #78350f;
  margin-left: auto;
  font-size: 16px;
  padding: 2px 8px;
}
#btn-dismiss-onboarding:hover {
  background: rgba(120, 53, 15, 0.1);
}
/* === /v10.1 新手引导 banner === */

/* v14.22 (CC-V1422): prompt 点击展开按钮 */
.lib-prompt-toggle {
  background: none;
  border: 1px solid var(--accent, var(--brand-strong, #5BC85A));
  color: var(--accent, var(--brand-strong, #5BC85A));
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
  margin-left: 8px;
}
.lib-prompt-toggle:hover {
  background: var(--accent, var(--brand, #71DC68));
  color: var(--brand-strong, #5BC85A);
}
.lib-prompt[data-expanded="true"] .lib-prompt-text {
  white-space: pre-wrap;
  word-break: break-word;
}

/* v18.4: 查看完整提示词按钮 */
.lib-prompt-view {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  cursor: pointer;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 6px;
  opacity: 0.8;
  transition: all 0.2s;
  display: inline-block;
  color: var(--brand-strong, #5BC85A);
  font-weight: 500;
}
.lib-prompt-view:hover {
  opacity: 1;
  background: #e5e7eb;
  border-color: var(--brand-strong, #5BC85A);
}
.lib-prompt {
  display: block;
  margin-bottom: 8px;
}
.lib-prompt-text {
  word-break: break-word;
  line-height: 1.5;
  color: #374151;
  font-size: 13px;
}

/* ====================================================================
   移动端适配 (max-width: 768px) — 任务 I
   桌面端样式不受影响（所有规则都在 @media 内）
   目标：触控 ≥44px、卡片单列、图预览上下排、汉堡菜单已由 portal.css 处理
   ==================================================================== */
@media (max-width: 768px) {
  /* 容器：缩窄边距 */
  .container {
    max-width: 100%;
    margin: 20px auto;
    padding: 0 12px;
  }
  h1 { font-size: 24px; margin-bottom: 16px; }
  h2 { font-size: 20px; }
  h3 { font-size: 18px; }

  /* 卡片：紧凑内边距 */
  .card {
    padding: 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    gap: 10px;
  }

  /* 表单控件：全宽 + 44px 触控 + iOS 16px 字号防缩放 */
  label { font-size: 13px; }
  input,
  textarea,
  select {
    font-size: 16px;
    padding: 12px;
    min-height: 44px;
    width: 100%;
  }
  textarea { min-height: 88px; }
  select { width: 100%; }
  input[type="checkbox"],
  input[type="radio"] {
    width: 18px;
    height: 18px;
    min-height: 0;
  }
  input[type="file"] { padding: 10px 8px; }

  /* 按钮：全宽 44px 触控 */
  button {
    min-height: 44px;
    padding: 12px 18px;
    font-size: 15px;
  }
  button[type="submit"] { width: 100%; }
  form > button[type="submit"],
  form > .burn-actions > button,
  #estimate-btn { width: 100%; }

  /* 复选框标签 */
  label.checkbox {
    min-height: 44px;
    padding: 8px 0;
  }

  /* 比例按钮：单列堆叠 */
  .ratio-group {
    flex-direction: column;
    gap: 8px;
  }
  .ratio-btn {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 10px;
  }

  /* 图片网格：单列 */
  .image-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .image-item a { min-height: 44px; line-height: 24px; }

  /* 烧字区：单列 + 操作上下排 */
  .burn-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .burn-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .burn-actions select {
    width: 100%;
    min-width: 0;
  }
  .burned-download {
    width: 100%;
    padding: 12px;
    min-height: 44px;
  }

  /* 参考图预览行：上下排列 */
  .reference-preview-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .reference-preview {
    max-width: 100%;
    width: 100%;
    height: auto;
    max-height: 220px;
  }

  /* 进度条 */
  .progress-bar { height: 10px; }

  /* 积分预估条：垂直堆叠 */
  .estimate-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 10px 12px;
    gap: 8px;
  }
  .estimate-points { font-size: 18px; text-align: center; }
  #estimate-btn {
    margin-left: 0;
    width: 100%;
  }

  /* 顶部积分余额条：多行 */
  .points-bar {
    flex-wrap: wrap;
    padding: 6px 10px;
    gap: 6px 10px;
    font-size: 12px;
    top: 56px;
  }
  .points-bar-track { display: none; }
  .points-name { font-size: 11px; }
  .points-admin { font-size: 11px; padding: 4px 8px; }

  /* 成本中心：单列 */
  .cost-summary-row { grid-template-columns: 1fr; }
  .cost-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 8px 0;
  }
  .cost-meta { text-align: left; }
  .cost-kpi { padding: 10px; }
  .cost-kpi .kpi-value { font-size: 18px; }

  /* 排行榜：精简列 */
  .lb-row {
    grid-template-columns: 28px 1fr 70px;
    font-size: 12px;
    gap: 6px;
    padding: 6px 8px;
  }
  .lb-row .lb-meta { display: none; }
  .lb-roi { font-size: 13px; }

  /* 模型配置 + 商业价值：折叠输入列 */
  .mc-row,
  .iv-row {
    grid-template-columns: 1fr 90px;
    gap: 6px;
    font-size: 12px;
    padding: 8px;
  }
  .mc-row > .mc-cost,
  .iv-row > .iv-val { display: none; }
  .mc-input,
  .iv-input { width: 100%; }
  .mc-save,
  .iv-save { padding: 8px; min-height: 36px; }

  /* 标记按钮：触控友好 */
  .mark-btn { min-height: 44px; padding: 6px 12px; }
  .mark-row { flex-wrap: wrap; }

  /* 图片查看器（全屏覆盖） */
  .iv-image { max-width: 100vw; max-height: 75vh; }
  .iv-prev,
  .iv-next {
    width: 48px;
    height: 48px;
    font-size: 26px;
  }
  .iv-prev { left: 8px; }
  .iv-next { right: 8px; }
  .iv-close { width: 44px; height: 44px; }
  .iv-download {
    padding: 12px 24px;
    min-height: 44px;
  }
  .iv-counter { font-size: 13px; }

  /* 我的图库：2 列网格 */
  .lib-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .lib-tabs {
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .lib-tab {
    padding: 8px 12px;
    white-space: nowrap;
    min-height: 44px;
  }
  .lib-toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .lib-count {
    width: 100%;
    margin-left: 0;
  }
  .lib-pager { flex-wrap: wrap; }
  .lib-pager button { min-height: 40px; }
  .lib-card .fav-btn {
    width: 36px;
    height: 36px;
  }

  /* 模板字段 */
  .template-fields { padding: 10px; }
  .field-row { gap: 4px; }

  /* 提示词 <pre> */
  pre {
    font-size: 11px;
    padding: 10px;
    white-space: pre-wrap;
    word-break: break-word;
  }

  /* 隐藏小工具提示节省空间 */
  .small-btn { padding: 8px 10px; min-height: 36px; }
  .lib-prompt-toggle { padding: 4px 8px; min-height: 32px; }

  /* 新手引导 banner */
  .onboarding-banner {
    flex-wrap: wrap;
    padding: 8px 10px;
    font-size: 13px;
    gap: 8px;
  }
  .onboarding-banner > span { flex: 1 1 100%; }
  #btn-dismiss-onboarding { margin-left: auto; }

  /* 容器内文字换行（防止溢出） */
  .result-meta {
    max-width: 100%;
    white-space: normal;
  }
}
/* === /移动端适配 === */

/* === v16.11 移动端补充适配 (max-width: 768px) === */
/* 注：基础容器/卡片/字号已合并到上方 @media 块，此块仅保留增量规则 */
@media (max-width: 768px) {
  /* 表格横向滚动 */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  th, td {
    white-space: nowrap;
    padding: 10px 8px;
    font-size: 13px;
  }

  /* 网格布局 */
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  /* 工具栏 */
  .toolbar, .actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* ROI 仪表板 */
  .roi-summary {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .roi-card-value {
    font-size: 22px;
  }
  .roi-charts {
    grid-template-columns: 1fr;
  }

  /* 模板画廊 */
  .tpl-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .tpl-categories {
    gap: 6px;
  }
  .tpl-cat-btn {
    padding: 8px 12px;
    font-size: 13px;
  }

  /* 电商工具 */
  .et-grid {
    grid-template-columns: 1fr !important;
  }

  /* 弹窗 */
  .modal, .tpl-modal {
    padding: 12px;
  }
  .modal-content, .tpl-modal-content {
    padding: 20px;
    max-width: 100%;
  }
}

/* 超小屏幕 (max-width: 480px) */
@media (max-width: 480px) {
  .container {
    padding: 0 8px;
  }
  .card {
    padding: 12px;
  }
  .roi-summary {
    grid-template-columns: 1fr;
  }
  .lib-grid {
    grid-template-columns: 1fr !important;
  }
}
