/* ============ 前台布局 ============ */
.app { display: flex; min-height: 100vh; position: relative; z-index: 1; }
.view:not([hidden]) { animation: fadeUp 0.3s var(--ease) both; }

/* ---------- 侧栏 ---------- */
.rail {
  position: sticky; top: 0;
  flex: 0 0 232px; width: 232px; height: 100vh;
  display: flex; flex-direction: column;
  padding: 14px 12px 12px;
  background: var(--sidebar);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border-right: 1px solid var(--line);
  transition: width 0.3s var(--ease), flex-basis 0.3s var(--ease), padding 0.3s var(--ease);
  z-index: 20;
}
.rail.is-collapsed { flex-basis: 68px; width: 68px; padding-left: 10px; padding-right: 10px; }
.rail.is-collapsed .brand-name,
.rail.is-collapsed .nav-item span,
.rail.is-collapsed .rail-label,
.rail.is-collapsed .rail-model span:not(.dot),
.rail.is-collapsed .rail-model .pill { display: none; }
.rail.is-collapsed .rail-top { justify-content: center; padding-left: 0; padding-right: 0; }
.rail.is-collapsed .brand { display: none; }
.rail.is-collapsed #collapseBtn svg { transform: scaleX(-1); }
.rail.is-collapsed .rail-model { justify-content: center; }
.rail.is-collapsed .nav-item { justify-content: center; padding: 8px 0; }

.rail-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 16px; }
.brand { display: flex; align-items: center; gap: 9px; border-radius: 10px; }
.brand-mark {
  width: 26px; height: 26px; flex: none;
  display: grid; place-items: center;
  border-radius: 8px;
  background: linear-gradient(155deg, #232a3c 0%, #10121a 55%, #05060a 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    0 3px 10px rgba(12, 18, 38, 0.35),
    0 0 14px rgba(122, 110, 255, 0.16);
  transition: box-shadow 0.25s var(--ease), transform 0.25s var(--ease);
}
.brand-mark svg { width: 15px; height: 15px; display: block; filter: drop-shadow(0 0 6px rgba(140, 170, 255, 0.45)); }
.brand:hover .brand-mark {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1),
    0 5px 14px rgba(12, 18, 38, 0.4),
    0 0 18px rgba(140, 120, 255, 0.3);
}
.brand-name {
  display: inline-flex; align-items: baseline; gap: 3px;
  font-size: 15px; font-weight: 700; letter-spacing: -0.35px;
  white-space: nowrap;
  color: var(--text);
}
.brand-name em {
  font-style: normal;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em;
  background: linear-gradient(100deg, #6FB0FF 0%, #9A6BFF 52%, #FF8CC4 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  transform: translateY(-1px);
}
[data-theme="light"] .brand-name em {
  background-image: linear-gradient(100deg, #2F74FF 0%, #7A46FF 52%, #E8519F 100%);
}

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  height: 32px; padding: 0 9px;
  border-radius: var(--r-md);
  color: var(--text-2);
  font-size: 12.5px; font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.nav-item svg { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.is-on { background: var(--accent-soft); color: var(--accent); }

.rail-sep { height: 1px; background: var(--line-soft); margin: 12px 8px; }
.rail-label { font-size: 10.5px; font-weight: 600; letter-spacing: 0.4px; color: var(--text-3); padding: 0 9px 6px; text-transform: uppercase; }

.rail-model {
  display: flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 9px; border-radius: var(--r-md);
  font-size: 12px; color: var(--text-2);
  white-space: nowrap; overflow: hidden;
}
.rail-model:hover { background: var(--hover); color: var(--text); }
.rail-model .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent); }
.rail-model .pill { margin-left: auto; }

.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 1px; }

/* ---------- 主区 ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: flex-end; gap: 16px;
  height: 56px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--line-soft);
}
.top-right { display: flex; align-items: center; gap: 8px; }

.credits-chip {
  display: flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  font-size: 12px; font-weight: 500;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, background 0.15s;
}
.credits-chip:hover { border-color: var(--accent); }
.credits-chip .zap { width: 13px; height: 13px; fill: #f5a623; stroke: none; }
.credits-chip .plus { width: 12px; height: 12px; stroke: var(--text-3); fill: none; stroke-width: 2; }
.credits-chip.is-low { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }

.offline-bar {
  margin: 12px 24px 0; padding: 7px 12px;
  border-radius: var(--r-md);
  font-size: 11.5px; text-align: center;
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 26%, transparent);
}

/* ---------- 视图 ---------- */
.view { display: flex; flex-direction: column; padding: 26px 28px 40px; max-width: 1200px; width: 100%; margin: 0 auto; }
#view-create { padding-bottom: 210px; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.view-head h1, .view-head h2 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.4px; }
.view-head p { margin: 6px 0 0; font-size: 12px; color: var(--text-2); }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 12px; }
.section-head h2 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.2px; }
.section-head .hint { font-size: 11.5px; color: var(--text-3); }
.section-tools { display: flex; align-items: center; gap: 10px; }
.retention-hint {
  font-size: 11px;
  color: #a8691a;
  background: rgba(217, 147, 43, 0.12);
  border: 1px solid rgba(217, 147, 43, 0.3);
  padding: 2px 9px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: 1.6;
}
[data-theme="dark"] .retention-hint { color: #f0b45f; }

/* ---------- Hero ---------- */
.hero { padding-top: 34px; }
.hero h1 { margin: 0; text-align: center; font-size: 27px; font-weight: 600; letter-spacing: -0.6px; }
.hero > p { margin: 8px 0 30px; text-align: center; font-size: 12.5px; color: var(--text-2); }

/* ---------- Hero 标题：macOS 那种「流光字」----------
 * 底层是跨字渐变的彩色，上层一条高光按节奏从左扫到右；
 * 进场时从模糊里浮出来，和 Apple 的开场标题一个味道。
 */
.hero h1 {
  --hero-1: #0071e3;
  --hero-2: #7a4dff;
  --hero-3: #d6336c;
  --hero-glint: rgba(255, 255, 255, 0.66);
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
  font-size: 32px;
  letter-spacing: -1px;
  text-shadow: 0 12px 34px color-mix(in srgb, var(--hero-1) 12%, transparent);
  animation: heroIn 0.9s var(--ease) both;
}
[data-theme="dark"] .hero h1 {
  --hero-1: #6ea8ff;
  --hero-2: #b48cff;
  --hero-3: #ff7ab6;
  --hero-glint: rgba(255, 255, 255, 0.9);
  text-shadow: 0 0 34px color-mix(in srgb, var(--hero-2) 42%, transparent);
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hero h1 {
    background-image:
      linear-gradient(112deg, transparent 22%, var(--hero-glint) 50%, transparent 78%),
      linear-gradient(100deg,
        var(--text) 0%, var(--text) 16%,
        var(--hero-1) 32%, var(--hero-2) 50%, var(--hero-3) 68%,
        var(--text) 84%, var(--text) 100%);
    background-size: 55% 100%, 100% 100%;
    background-repeat: no-repeat, no-repeat;
    background-position: -50% 50%, 0 50%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: heroIn 0.9s var(--ease) both, heroSheen 8.5s cubic-bezier(0.42, 0, 0.28, 1) 0.9s infinite;
  }
}

/* 高光从左扫到右：-50% 在左侧外面，108% 扫出右侧，然后歇一会儿再来一次 */
@keyframes heroSheen {
  0%   { background-position: -50% 50%, 0 50%; }
  62%  { background-position: 108% 50%, 0 50%; }
  100% { background-position: 108% 50%, 0 50%; }
}

@keyframes heroIn {
  from { opacity: 0; transform: translateY(14px); filter: blur(12px); }
  60%  { opacity: 1; }
  to   { opacity: 1; transform: none; filter: blur(0); }
}

.hero > p { animation: heroIn 0.8s var(--ease) 0.12s both; }

.templates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.templates .tpl { animation: fadeUp 0.36s var(--ease) both; }
.templates .tpl:nth-child(1) { animation-delay: 0ms; }
.templates .tpl:nth-child(2) { animation-delay: 45ms; }
.templates .tpl:nth-child(3) { animation-delay: 90ms; }
.templates .tpl:nth-child(4) { animation-delay: 135ms; }
.templates .tpl:nth-child(5) { animation-delay: 180ms; }
.templates .tpl:nth-child(6) { animation-delay: 225ms; }

.tiers .tier { animation: fadeUp 0.36s var(--ease) both; }
.tiers .tier:nth-child(2) { animation-delay: 60ms; }
.tiers .tier:nth-child(3) { animation-delay: 120ms; }

.packs .pack { animation: fadeUp 0.36s var(--ease) both; }
.packs .pack:nth-child(2) { animation-delay: 60ms; }
.packs .pack:nth-child(3) { animation-delay: 120ms; }
.tpl-ref {
  position: absolute; left: 10px; bottom: 10px; z-index: 3;
  font-size: 10px; padding: 2px 7px; border-radius: 999px;
  color: #fff; background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(6px);
}
.tpl {
  background: color-mix(in srgb, var(--surface-solid) 74%, transparent);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-1);
  cursor: pointer;
  transition: transform 0.26s var(--ease), box-shadow 0.26s var(--ease), border-color 0.2s;
}
.tpl:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.14);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
}
.tpl-media { height: 148px; background: var(--surface-2); position: relative; overflow: hidden; }
/* 背景放同一张图的高斯模糊铺底，前景图片 contain 完整显示：竖图不会被裁，也不会有生硬的黑边 */
.tpl-media::before {
  content: ""; position: absolute; inset: -28px;
  background-image: var(--tpl-bg);
  background-size: cover;
  background-position: center;
  filter: blur(18px) saturate(1.2) brightness(0.82);
  opacity: 0.85;
  transform: scale(1.06);
}
.tpl-media img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  z-index: 1;
}
.tpl-media::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.28));
  opacity: 0.7;
  z-index: 2;
}
.tpl-body { padding: 11px 13px 12px; }
.tpl-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tpl-title { font-size: 13px; font-weight: 600; letter-spacing: -0.1px; }
.tpl-try {
  font-size: 11px; font-weight: 500; color: var(--accent);
  padding: 3px 9px; border-radius: 999px;
  background: var(--accent-soft);
}
.tpl-try:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.tpl-desc { margin: 6px 0 0; font-size: 11.5px; line-height: 1.6; color: var(--text-2); }

/* ---------- 网格作品 ---------- */
.gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.tile {
  position: absolute; top: 0; left: 0;
  border-radius: 12px;
  overflow: hidden;
  background: color-mix(in srgb, var(--surface-solid) 84%, transparent);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  cursor: pointer;
  transition: box-shadow 0.2s var(--ease);
  animation: fadeIn 0.32s var(--ease) both;
  animation-delay: var(--d, 0ms);
  will-change: transform;
}
.tile:hover { box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15); }

/* ---------- 生成中：流动极光 + 扫光 + 转圈 ---------- */
.tile.is-loading {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
  box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 18%, transparent);
}
.tile.is-loading .tile-hover { display: none; }
.tile.is-loading .tile-media { background: #0f1219; animation: genBreath 3.6s ease-in-out infinite; }
.tile.is-loading .shimmer {
  position: absolute; inset: -10%;
  display: block;
  background:
    radial-gradient(45% 45% at 22% 24%, color-mix(in srgb, var(--accent) 88%, transparent), transparent 70%),
    radial-gradient(42% 42% at 78% 28%, rgba(178, 107, 255, 0.8), transparent 70%),
    radial-gradient(55% 55% at 52% 88%, rgba(52, 211, 255, 0.66), transparent 70%),
    linear-gradient(160deg, #1b2030, #0d1017);
  background-size: 180% 180%, 180% 180%, 180% 180%, 100% 100%;
  filter: blur(7px) saturate(1.25);
  animation: genAurora 7s ease-in-out infinite alternate;
  animation-delay: var(--gen-delay, 0s);
}
.tile.is-loading .tile-media::before {
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 130px; height: 130px; margin: -65px 0 0 -65px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 68%);
  animation: genPulse 2.6s ease-in-out infinite;
}
.tile.is-loading .shimmer::after {
  content: "";
  position: absolute; inset: -30%;
  background: linear-gradient(115deg, transparent 42%, rgba(255, 255, 255, 0.26) 50%, transparent 58%);
  animation: genSweep 2.8s linear infinite;
}
.tile.is-loading .tile-media::after {
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 42px; height: 42px; margin: -21px 0 0 -21px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-top-color: rgba(255, 255, 255, 0.95);
  animation: genSpin 0.95s linear infinite;
  box-shadow: 0 0 22px rgba(255, 255, 255, 0.14);
}
.tile.is-loading .tile-model {
  color: var(--accent);
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: 0.2px;
}
.tile.is-loading .tile-model::after {
  content: "";
  animation: genDots 1.4s steps(4, end) infinite;
}
.tile.is-loading .tile-meta { background: color-mix(in srgb, var(--accent) 7%, transparent); }

.gen-bar {
  position: absolute; left: 12%; right: 12%; bottom: 16px;
  height: 3px; border-radius: 99px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}
.gen-bar::after {
  content: "";
  display: block; width: 42%; height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.95), transparent);
  animation: genBar 1.35s ease-in-out infinite;
}

@keyframes genAurora {
  0% { background-position: 0% 0%, 100% 0%, 50% 100%, 0 0; }
  50% { background-position: 30% 20%, 70% 30%, 40% 80%, 0 0; }
  100% { background-position: 60% 10%, 40% 55%, 60% 60%, 0 0; }
}
@keyframes genSweep {
  0% { transform: translateX(-45%) rotate(0.001deg); }
  100% { transform: translateX(45%) rotate(0.001deg); }
}
@keyframes genSpin { to { transform: rotate(360deg); } }
@keyframes genBar {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(320%); }
}
@keyframes genPulse {
  0%, 100% { opacity: 0.35; transform: scale(0.92); }
  50% { opacity: 0.9; transform: scale(1.08); }
}
@keyframes genBreath {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.012); }
}
@keyframes genDots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75%, 100% { content: "..."; }
}

@media (prefers-reduced-motion: reduce) {
  .tile.is-loading .tile-media,
  .tile.is-loading .shimmer,
  .tile.is-loading .shimmer::after,
  .tile.is-loading .tile-media::before,
  .tile.is-loading .tile-media::after,
  .tile.is-loading .tile-model::after,
  .gen-bar::after,
  .send.is-busy::after { animation: none; }
}
.tile-media { position: relative; aspect-ratio: 4 / 5; background: var(--surface-2); overflow: hidden; }
.tile-media img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 0.5s var(--ease);
}
.tile:hover .tile-media img { transform: scale(1.03); }
.tile-hover {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 8px;
  padding: 10px;
  background: linear-gradient(180deg, transparent 45%, rgba(0, 0, 0, 0.72));
  opacity: 0; transition: opacity 0.2s var(--ease);
}
.tile:hover .tile-hover { opacity: 1; }
.tile-prompt {
  margin: 0; color: #fff; font-size: 11px; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.tile-actions { display: flex; gap: 6px; }
.tile-btn {
  width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  color: #fff;
}
.tile-btn:hover { background: rgba(255, 255, 255, 0.34); }
.tile-btn svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tile-meta { display: flex; align-items: center; justify-content: space-between; padding: 6px 9px; }
.tile-model { font-size: 10.5px; color: var(--text-2); }
.tile-time { font-size: 10px; color: var(--text-3); }

.gallery-wrap.is-empty { display: none; }

/* ---------- 最近生成：详细列表模式 ---------- */
.seg-mini { height: 26px; padding: 2px; }
.seg-mini .seg { height: 22px; padding: 0 10px; font-size: 11.5px; border-radius: 6px; }

.gen-list { display: flex; flex-direction: column; }
.gen-day {
  display: flex; align-items: baseline; gap: 8px;
  margin: 20px 2px 10px;
  font-size: 13px; font-weight: 600; letter-spacing: -0.1px;
}
.gen-day:first-child { margin-top: 4px; }
.gen-day span { font-size: 11px; font-weight: 500; color: var(--text-3); }

.gen-row {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  padding: 14px;
  margin-bottom: 10px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-solid) 78%, transparent);
  box-shadow: var(--shadow-1);
}
.gen-media {
  position: relative;
  aspect-ratio: 4 / 3;
  max-height: 220px;
  border-radius: 12px;
  overflow: hidden;
  background: #0a0a0d;
}
/* 绝对定死图片框，再用 contain 完整显示：竖图不会被裁掉上下，横图也不会溢出 */
.gen-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  cursor: zoom-in;
}
.gen-badge {
  position: absolute; left: 8px; top: 8px;
  padding: 2px 7px; border-radius: 99px;
  background: rgba(0, 0, 0, 0.55); color: #fff;
  font-size: 10px;
  backdrop-filter: blur(6px);
}
.gen-del {
  position: absolute; right: 8px; top: 8px;
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.45); color: #fff;
  font-size: 11px; line-height: 1;
  opacity: 0; transition: opacity 0.15s, background 0.15s;
}
.gen-media:hover .gen-del { opacity: 1; }
.gen-del:hover { background: var(--danger); }

.gen-body { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.gen-prompt {
  margin: 0;
  font-size: 12.5px; line-height: 1.85;
  color: var(--text);
  white-space: pre-wrap; word-break: break-word;
}
.gen-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11px; color: var(--text-3); }
.gen-thumbs, .gen-refs { display: flex; flex-wrap: wrap; gap: 6px; }
.gen-thumbs img { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); cursor: zoom-in; }
.gen-refs img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); }
.gen-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 2px; }

.gen-row.is-pending { opacity: 1; }
.gen-row.is-pending .gen-media { background: var(--surface-2); }
.gen-pending-label { position: absolute; font-size: 12px; color: var(--text-2); }

/* 详细列表里的「生成中」：和瀑布流卡片同一套极光 / 扫光 / 转圈 / 进度条 */
.gen-media.is-loading {
  background: #0f1219;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
  box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 14%, transparent);
  animation: genBreath 3.6s ease-in-out infinite;
}
.gen-media.is-loading .shimmer {
  position: absolute; inset: -10%;
  display: block;
  background:
    radial-gradient(45% 45% at 22% 24%, color-mix(in srgb, var(--accent) 88%, transparent), transparent 70%),
    radial-gradient(42% 42% at 78% 28%, rgba(178, 107, 255, 0.8), transparent 70%),
    radial-gradient(55% 55% at 52% 88%, rgba(52, 211, 255, 0.66), transparent 70%),
    linear-gradient(160deg, #1b2030, #0d1017);
  background-size: 180% 180%, 180% 180%, 180% 180%, 100% 100%;
  filter: blur(7px) saturate(1.25);
  animation: genAurora 7s ease-in-out infinite alternate;
}
.gen-media.is-loading::before {
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 130px; height: 130px; margin: -65px 0 0 -65px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 68%);
  animation: genPulse 2.6s ease-in-out infinite;
}
.gen-media.is-loading .shimmer::after {
  content: "";
  position: absolute; inset: -30%;
  background: linear-gradient(115deg, transparent 42%, rgba(255, 255, 255, 0.26) 50%, transparent 58%);
  animation: genSweep 2.8s linear infinite;
}
.gen-media.is-loading::after {
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 42px; height: 42px; margin: -21px 0 0 -21px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-top-color: rgba(255, 255, 255, 0.95);
  animation: genSpin 0.95s linear infinite;
  box-shadow: 0 0 22px rgba(255, 255, 255, 0.14);
}
.gen-media.is-loading .gen-pending-label {
  left: 0; right: 0; bottom: 26px;
  z-index: 3;
  text-align: center;
  color: rgba(255, 255, 255, 0.92);
  font-size: 11.5px;
  letter-spacing: 0.3px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.65);
}
.gen-media.is-loading .gen-dots::after {
  display: inline-block;
  min-width: 1.1em;
  text-align: left;
  animation: genDots 1.4s steps(4, end) infinite;
}
.gen-meta .gen-live { color: var(--accent); font-weight: 500; }
.gen-meta .gen-live::after {
  display: inline-block;
  min-width: 1.1em;
  text-align: left;
  animation: genDots 1.4s steps(4, end) infinite;
}

/* ---------- 探索：瀑布流案例 ---------- */
.masonry { position: relative; width: 100%; }
.case {
  position: absolute; top: 0; left: 0;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: color-mix(in srgb, var(--surface-solid) 84%, transparent);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  cursor: pointer;
  transition: transform 0.24s var(--ease), box-shadow 0.24s var(--ease), border-color 0.2s;
  animation: fadeIn 0.32s var(--ease) both;
  animation-delay: var(--d, 0ms);
  will-change: transform;
}
.case:hover { box-shadow: 0 16px 38px rgba(0, 0, 0, 0.16); border-color: color-mix(in srgb, var(--accent) 26%, var(--line)); }
.case-media { overflow: hidden; background: var(--surface-2); }
.case-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.5s var(--ease); }
.case:hover .case-media img { transform: scale(1.03); }
.case figcaption { padding: 10px 12px 12px; }
.case-title { font-size: 12.5px; font-weight: 600; letter-spacing: -0.1px; }
.case-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.case-tag { font-size: 10px; color: var(--text-2); background: var(--surface-3); padding: 2px 7px; border-radius: 999px; }
.case-tag.is-ref { color: var(--accent); background: var(--accent-soft); }

/* ---------- 分段控件 ---------- */
.segmented {
  display: inline-flex; gap: 2px; padding: 2px;
  border-radius: var(--r-md);
  background: var(--surface-3);
  border: 1px solid var(--line-soft);
}
.seg {
  height: 26px; padding: 0 12px;
  border-radius: 7px;
  font-size: 12px; font-weight: 500;
  color: var(--text-2);
  transition: background 0.18s var(--ease), color 0.18s;
}
.seg.is-on { background: var(--surface-solid); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }

/* ---------- 参考图 ---------- */
.refs-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.ref-card { border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); aspect-ratio: 1; }
.ref-card img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- 资产：按日期分组 ---------- */
.asset-groups { display: grid; gap: 34px; margin-top: 6px; }
.asset-day h3 {
  display: flex; align-items: baseline; gap: 10px;
  margin: 0 0 12px;
  font-size: 15px; font-weight: 650; letter-spacing: -0.25px;
  color: var(--text);
}
.asset-day h3 span {
  font-size: 11px; font-weight: 400; color: var(--text-3);
  letter-spacing: 0;
}
.asset-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
}
.asset-thumb {
  position: relative;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);
  aspect-ratio: 4 / 3;
  cursor: zoom-in;
  box-shadow: var(--shadow-1);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.15s;
}
.asset-thumb img {
  position: relative;
  z-index: 1;
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  transition: transform 0.45s var(--ease);
}
/* 模糊铺底：缩略图仍按 4:3 对齐，但图片本身完整显示，竖图不被裁 */
.asset-thumb::before {
  content: "";
  position: absolute; inset: -18px;
  background-image: var(--thumb);
  background-size: cover;
  background-position: center;
  filter: blur(14px) saturate(1.15) brightness(0.88);
  opacity: 0.9;
}
.asset-thumb.is-broken::before { display: none; }
.asset-thumb:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.14);
}
.asset-thumb:hover img { transform: scale(1.04); }
.asset-thumb.is-broken { cursor: default; }
.asset-thumb.is-broken img { opacity: 0; }
.asset-thumb.is-broken::after {
  content: "链接已过期";
  position: absolute; inset: 0;
  z-index: 2;
  display: grid; place-items: center;
  font-size: 10.5px; color: var(--text-3);
  background:
    repeating-linear-gradient(135deg, rgba(120, 130, 160, 0.07) 0 8px, transparent 8px 16px),
    var(--surface-2);
}

@media (max-width: 720px) {
  .asset-row { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
  .asset-groups { gap: 24px; }
}

.field-hint { display: block; margin-top: 6px; font-size: 10.5px; color: var(--text-3); }
.field-hint.is-warn { color: var(--danger); }
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; }
.code-btn { height: 34px; padding: 0 12px; white-space: nowrap; font-size: 11.5px; }

/* ---------- 探索：搜索 / 分类 ---------- */
.explore-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 6px 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-solid);
  box-shadow: var(--shadow-1);
  min-width: 300px; flex: 0 1 420px;
}
.search-box svg { width: 14px; height: 14px; stroke: var(--text-3); fill: none; stroke-width: 1.9; stroke-linecap: round; flex: none; }
.search-box input { flex: 1; border: 0; background: transparent; color: var(--text); font-size: 12.5px; outline: none; min-width: 0; }
.search-box input::placeholder { color: var(--text-3); }
.search-box .search-go {
  height: 26px; padding: 0 12px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 11.5px; font-weight: 500;
}
.search-box .search-go:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }

.tag-row { display: flex; gap: 6px; flex-wrap: wrap; }
.tag-chip {
  height: 28px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-solid);
  color: var(--text-2);
  font-size: 11.5px;
  display: inline-flex; align-items: center; gap: 5px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.tag-chip:hover { border-color: var(--accent); color: var(--accent); }
.tag-chip.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tag-chip em { font-style: normal; font-size: 10px; opacity: 0.6; }

/* ---------- 帮助 ---------- */
.help-list { display: grid; gap: 6px; margin-top: 12px; }
.help-list details {
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: var(--surface-2);
  padding: 9px 12px;
}
.help-list summary { cursor: pointer; font-size: 12.5px; color: var(--text); list-style: none; }
.help-list summary::-webkit-details-marker { display: none; }
.help-list summary::before { content: "▸ "; color: var(--text-3); }
.help-list details[open] summary::before { content: "▾ "; }
.help-list p { margin: 8px 0 0; font-size: 11.5px; line-height: 1.75; color: var(--text-2); }

/* ---------- 反推提示词 ---------- */
.chip-ai { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.chip-ai .chip-cost {
  margin-left: 4px; padding: 0 5px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  font-size: 10px; font-variant-numeric: tabular-nums;
}
.chip-ai .spark { width: 13px; height: 13px; fill: currentColor; stroke: none; }
.chip-ai:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
/* 用 .chip.chip-ai 提高优先级，盖掉 .chip:disabled 的 0.55 透明 */
.chip.chip-ai.is-busy {
  opacity: 1;
  pointer-events: none;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 24%, transparent);
}

/* 优化中：转圈 + 文案「优化中…」 */
.chip-ai .chip-spinner {
  width: 12px; height: 12px;
  flex: none;
  border-radius: 50%;
  border: 1.6px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-top-color: var(--accent);
  animation: genSpin 0.75s linear infinite;
}
.chip-ai.is-busy #optimizeLabel { letter-spacing: 0.3px; }
.chip-ai.is-busy #optimizeLabel::after {
  display: inline-block;
  min-width: 1.15em;
  text-align: left;
  animation: genDots 1.1s steps(4, end) infinite;
}

.reverse-grid { display: grid; grid-template-columns: minmax(300px, 0.85fr) 1.15fr; gap: 16px; align-items: start; }
.rev-panel {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-solid) 78%, transparent);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  box-shadow: var(--shadow-1);
  display: flex; flex-direction: column; gap: 12px;
}
.rev-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 220px; padding: 18px;
  border-radius: 12px;
  border: 1px dashed var(--line);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12.5px;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.rev-drop svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.rev-drop em { font-style: normal; font-size: 11px; color: var(--text-3); }
.rev-drop:hover, .rev-drop.is-over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
#revPreview {
  width: 100%; max-height: 340px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  display: block;
}
.rev-actions { display: flex; gap: 8px; }
.rev-hint { margin: 0; font-size: 11px; color: var(--text-3); line-height: 1.7; }

/* 反推进行中：右侧骨架 + 转圈 */
.rev-loading { display: flex; flex-direction: column; gap: 14px; }
.rev-loading-top {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.rev-orbit {
  width: 22px; height: 22px; flex: none;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-top-color: var(--accent);
  animation: genSpin 0.9s linear infinite;
}
.rev-loading-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.rev-loading-text b { font-size: 12.5px; font-weight: 600; color: var(--text); }
.rev-loading-text span { font-size: 11px; color: var(--text-3); }
.rev-elapsed { font-size: 11.5px; color: var(--accent); font-variant-numeric: tabular-nums; flex: none; }
.rev-skel { display: flex; flex-direction: column; gap: 10px; }
.rev-skel-card {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.sk-line {
  display: block;
  height: 10px;
  border-radius: 6px;
  margin: 9px 0;
  background: linear-gradient(
    90deg,
    var(--surface-3) 25%,
    color-mix(in srgb, var(--accent) 22%, var(--surface-3)) 50%,
    var(--surface-3) 75%
  );
  background-size: 220% 100%;
  animation: skShimmer 1.6s linear infinite;
}
.sk-line:first-child { height: 12px; margin-top: 0; }
.sk-line:last-child { margin-bottom: 0; }
.rev-skel-card:nth-child(2) .sk-line { animation-delay: 0.16s; }
.rev-skel-card:nth-child(3) .sk-line { animation-delay: 0.32s; }
.rev-skel-card:nth-child(4) .sk-line { animation-delay: 0.48s; }
@keyframes skShimmer {
  from { background-position: 130% 0; }
  to { background-position: -130% 0; }
}
/* 失败态 */
.rev-loading.rev-error .rev-loading-top {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}
.rev-err-icon {
  width: 22px; height: 22px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--danger); color: #fff;
  font-size: 13px; font-weight: 700;
}
.rev-result { min-height: 280px; }
.rev-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.rev-head-title h3 { margin: 0; font-size: 13.5px; font-weight: 600; }
.rev-head-sub { font-size: 10.5px; color: var(--text-3); }
.rev-head-actions { display: flex; gap: 6px; }

.rev-card {
  border: 1px solid var(--line-soft);
  background: var(--surface-2);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.rev-card.is-main { border-color: color-mix(in srgb, var(--accent) 28%, var(--line)); background: color-mix(in srgb, var(--accent) 6%, var(--surface-2)); }
.rev-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 8px;
}
.rev-card-kind {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; color: var(--text-2);
  letter-spacing: 0.2px;
}
.rev-card-kind::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-3);
}
.rev-card.is-main .rev-card-kind { color: var(--accent); }
.rev-card.is-main .rev-card-kind::before { background: var(--accent); }
.rev-card.is-enhance .rev-card-kind { color: #b26bff; }
.rev-card.is-enhance .rev-card-kind::before { background: #b26bff; }
.rev-card-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s; }
.rev-card:hover .rev-card-actions, .rev-card:focus-within .rev-card-actions { opacity: 1; }
.rev-card-actions button {
  font-size: 10.5px; padding: 2px 8px; border-radius: 999px;
  color: var(--text-2); background: var(--surface-solid); border: 1px solid var(--line);
}
.rev-card-actions button:hover { color: var(--accent); border-color: var(--accent); }
.rev-text { margin: 0; font-size: 12.5px; line-height: 1.85; color: var(--text); white-space: pre-wrap; }

.rev-variants { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.rev-variant {
  border: 1px solid var(--line-soft);
  background: var(--surface-2);
  border-radius: 12px;
  padding: 10px 11px;
  display: flex; flex-direction: column; gap: 6px;
}
.rev-variant-head { display: flex; align-items: center; justify-content: space-between; }
.rev-variant-tag {
  font-size: 10px; font-weight: 600; color: var(--text-3);
  letter-spacing: 0.3px; text-transform: uppercase;
}
.rev-variant p { margin: 0; font-size: 11.5px; line-height: 1.75; color: var(--text-2); flex: 1; }
.rev-variant .rev-copy { font-size: 10px; }

.rev-neg {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 9px 12px;
  background: transparent;
}
.rev-neg span { font-size: 10px; color: var(--text-3); letter-spacing: 0.3px; }
.rev-neg p { margin: 4px 0 0; font-size: 11.5px; line-height: 1.7; color: var(--text-2); }

/* 通用版（元提示词） */
.rev-generic {
  border: 1px dashed color-mix(in srgb, var(--accent) 38%, var(--line));
  border-radius: 12px;
  padding: 10px 12px 9px;
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.rev-generic-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.rev-generic-tag {
  font-size: 10.5px; font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.2px;
}
.rev-generic-type {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}
.rev-generic-head .rev-card-actions { margin-left: auto; opacity: 1; }
.rev-generic p.rev-text { margin: 0; }
.rev-generic-hint { margin: 6px 0 0; font-size: 10.5px; color: var(--text-3); }

/* 历史记录 */
.rev-history { margin-top: 18px; }
.rev-history-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.rev-history-head h3 { margin: 0; font-size: 13.5px; font-weight: 600; }
.rev-history-head .rev-history-count { font-size: 11px; color: var(--text-3); margin-left: 8px; }
.rev-history-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; align-items: start; }

/* 反推历史分页：加载更多 / 到底了 */
.rev-more { grid-column: 1 / -1; display: flex; justify-content: center; padding: 14px 0 6px; }
.rev-more-end { font-size: 11px; color: var(--text-3); letter-spacing: 0.4px; }

.rev-hi {
  position: relative;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-solid) 82%, transparent);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), border-color 0.2s;
}
.rev-hi:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.14); border-color: color-mix(in srgb, var(--accent) 26%, var(--line)); }

.rev-hi-open { display: block; width: 100%; padding: 0; cursor: pointer; background: none; border: 0; text-align: left; }
.rev-hi-media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
  overflow: hidden;
}
.rev-hi-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.4s var(--ease); }
.rev-hi:hover .rev-hi-media img { transform: scale(1.04); }
.rev-hi.is-failed .rev-hi-media img { opacity: 0.45; filter: grayscale(0.6); }

.rev-hi-badge {
  position: absolute; left: 8px; top: 8px;
  font-size: 9.5px; padding: 2px 7px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.5); color: #fff;
  backdrop-filter: blur(6px);
}
.rev-hi-badge.is-ok { background: color-mix(in srgb, var(--ok) 82%, transparent); }
.rev-hi-badge.is-fail { background: color-mix(in srgb, var(--danger) 82%, transparent); }

.rev-hi-foot { display: block; padding: 9px 11px 10px; }
.rev-hi-title {
  font-size: 11.5px; color: var(--text); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 34px;
}
.rev-hi-meta { margin-top: 6px; display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--text-3); }
.rev-hi-meta .dot-sep { opacity: 0.5; }

.rev-hi-del {
  position: absolute; right: 8px; top: 8px;
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.45); color: #fff;
  font-size: 11px; line-height: 1;
  opacity: 0; transform: scale(0.9);
  transition: opacity 0.15s, transform 0.15s, background 0.15s;
  backdrop-filter: blur(6px);
}
.rev-hi:hover .rev-hi-del { opacity: 1; transform: scale(1); }
.rev-hi-del:hover { background: var(--danger); }

/* 作品卡片右上角删除 */
.tile-del {
  position: absolute; right: 8px; top: 8px; z-index: 2;
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.45); color: #fff;
  font-size: 11px; line-height: 1;
  opacity: 0; transform: scale(0.9);
  transition: opacity 0.15s, transform 0.15s, background 0.15s;
  backdrop-filter: blur(6px);
}
.tile:hover .tile-del { opacity: 1; transform: scale(1); }
.tile-del:hover { background: var(--danger); }
/* 还在生成的任务也能直接删掉（手机上没有 hover） */
.tile.is-loading .tile-del { opacity: 0.95; transform: none; }
.tile.is-loading .tile-del:hover { background: var(--danger); }

@media (max-width: 760px) {
  .rev-variants { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .reverse-grid { grid-template-columns: 1fr; }
}

/* ---------- 开发者 ---------- */
.dev-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 0.9fr); gap: 16px; align-items: start; }
.dev-card {
  padding: 18px 20px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-solid) 80%, transparent);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  box-shadow: var(--shadow-1);
}
.dev-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dev-card h3 { margin: 0 0 6px; font-size: 13.5px; font-weight: 600; }
.dev-card-head h3 { margin: 0; }
.dev-sub { margin: 0 0 14px; font-size: 11.5px; color: var(--text-3); line-height: 1.7; }
.dev-code {
  margin: 14px 0 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.9;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-all;
}
.dev-note { margin: 0; font-size: 11px; color: var(--text-3); line-height: 1.7; }

.dev-highlight {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 4px 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.dev-highlight svg {
  width: 18px; height: 18px; flex: none; margin-top: 1px;
  fill: var(--accent); stroke: none;
}
.dev-highlight b { display: block; font-size: 14px; font-weight: 700; color: var(--accent); letter-spacing: -0.1px; }
.dev-highlight span { display: block; margin-top: 2px; font-size: 11.5px; color: var(--text-2); }

.dev-warn {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 11.5px;
  line-height: 1.75;
  color: color-mix(in srgb, var(--danger) 88%, var(--text));
  background: color-mix(in srgb, var(--danger) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent);
}
.dev-warn b { color: var(--danger); font-weight: 700; }
.dev-warn u { text-decoration-color: color-mix(in srgb, var(--danger) 60%, transparent); }

.dev-keys { display: grid; gap: 8px; }
.dev-key {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: var(--surface-2);
}
.dev-key-main { flex: 1; min-width: 0; }
.dev-key-main b { display: block; font-size: 12px; font-weight: 500; }
.dev-key-main code { font-family: var(--mono); font-size: 10.5px; color: var(--text-3); }
.dev-key-main span { display: block; font-size: 10px; color: var(--text-3); margin-top: 2px; }
.dev-key .btn { flex: none; }
.dev-wide { grid-column: 1 / -1; margin-top: 16px; }
.dev-inline {
  font-family: var(--mono); font-size: 11px;
  padding: 1px 5px; border-radius: 5px;
  background: var(--surface-2); border: 1px solid var(--line-soft);
  word-break: break-all;
}

.dev-params {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin: 6px 0 14px;
}
.dev-param {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
}
.dev-param b { display: block; font-size: 11px; color: var(--text-3); font-weight: 500; margin-bottom: 4px; }
.dev-param span { font-size: 11.5px; color: var(--text); line-height: 1.7; word-break: break-all; }
.dev-param code {
  font-family: var(--mono); font-size: 10.5px;
  background: color-mix(in srgb, var(--surface-solid) 70%, transparent);
  padding: 1px 4px; border-radius: 4px;
}

.dev-models { margin: 4px 0 14px; }
.dev-table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line-soft); }
.dev-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.dev-table th {
  text-align: left; padding: 8px 10px; font-weight: 500; color: var(--text-3);
  background: var(--surface-2); border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.dev-table td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); color: var(--text-2); }
.dev-table tr:last-child td { border-bottom: 0; }
.dev-table td b { color: var(--text); font-weight: 500; }
.dev-table .yes { color: var(--ok); }
.dev-table .no { color: var(--text-3); }
.dev-table .price { font-variant-numeric: tabular-nums; text-align: right; }

.dev-examples { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dev-ex-title { font-size: 11px; color: var(--text-3); margin-bottom: 6px; }
.dev-examples .dev-code { margin: 0; height: auto; align-self: start; }

@media (max-width: 1000px) {
  .dev-examples { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .dev-grid { grid-template-columns: 1fr; }
}

/* ---------- 提示词库抽屉 ---------- */
.lib-tab {
  position: fixed;
  right: 0;
  bottom: 132px;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px 9px 10px;
  border-radius: 12px 0 0 12px;
  background: color-mix(in srgb, var(--surface-solid) 88%, transparent);
  border: 1px solid var(--line);
  border-right: 0;
  color: var(--text-2);
  font-size: 11.5px;
  box-shadow: var(--shadow-1);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  transition: color 0.15s, transform 0.15s, box-shadow 0.2s;
}
.lib-tab:hover { color: var(--accent); transform: translateX(-2px); box-shadow: 0 10px 26px rgba(0, 0, 0, 0.14); }
.lib-tab svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lib-tab.is-on { color: var(--accent); }

.lib-mask {
  position: fixed; inset: 0;
  z-index: 100;
  background: rgba(10, 12, 18, 0.16);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  animation: fadeIn 0.22s var(--ease) both;
}
[data-theme="dark"] .lib-mask { background: rgba(0, 0, 0, 0.42); }

.lib-drawer {
  position: fixed;
  top: 14px; right: 14px; bottom: 14px;
  z-index: 101;
  width: min(382px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  border-radius: 26px;
  overflow: hidden;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.66), rgba(255, 255, 255, 0.4));
  border: 1px solid rgba(255, 255, 255, 0.66);
  box-shadow:
    0 42px 90px rgba(15, 23, 42, 0.24),
    0 4px 14px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(44px) saturate(190%);
  -webkit-backdrop-filter: blur(44px) saturate(190%);
  transform: translateX(calc(100% + 28px)) scale(0.985);
  opacity: 0.4;
  transition:
    transform 0.42s cubic-bezier(0.22, 0.9, 0.26, 1),
    opacity 0.28s ease;
  will-change: transform, opacity;
}
.lib-drawer.is-open { transform: translateX(0) scale(1); opacity: 1; }

[data-theme="dark"] .lib-drawer {
  background: linear-gradient(165deg, rgba(40, 45, 58, 0.72), rgba(20, 23, 31, 0.58));
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow:
    0 42px 90px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.09);
}

.lib-head { padding: 20px 20px 12px; position: relative; }
.lib-drawer .lib-head,
.lib-drawer .lib-search {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.3s ease 0.08s, transform 0.4s cubic-bezier(0.22, 0.9, 0.28, 1) 0.08s;
}
.lib-drawer.is-open .lib-head,
.lib-drawer.is-open .lib-search { opacity: 1; transform: none; }
.lib-head h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -0.35px; }
.lib-head p { margin: 5px 0 0; font-size: 11px; color: var(--text-3); line-height: 1.6; padding-right: 34px; }
.lib-close {
  position: absolute; top: 16px; right: 14px;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  transition: background 0.15s, transform 0.15s;
}
.lib-close:hover { background: rgba(255, 255, 255, 0.85); transform: scale(1.06); }
[data-theme="dark"] .lib-close { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.14); }
.lib-close svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; }

.lib-search { padding: 4px 18px 8px; }
.lib-search input {
  width: 100%;
  padding: 9px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(14px);
  font-size: 12px;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.lib-search input::placeholder { color: var(--text-3); }
.lib-search input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
[data-theme="dark"] .lib-search input { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.12); }
[data-theme="dark"] .lib-search input:focus { background: rgba(255, 255, 255, 0.11); }

.lib-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 18px 20px; display: grid; gap: 10px; align-content: start; }
.lib-list::-webkit-scrollbar { width: 6px; }
.lib-list::-webkit-scrollbar-thumb { background: rgba(120, 130, 160, 0.28); border-radius: 99px; }

body.lib-open { overflow: hidden; }

.lib-item {
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 16px;
  padding: 11px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(16px) saturate(160%);
  display: grid;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: border-color 0.18s, transform 0.18s var(--ease), box-shadow 0.18s;
  animation: libRise 0.44s cubic-bezier(0.22, 0.9, 0.28, 1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
.lib-item:hover {
  border-color: color-mix(in srgb, var(--accent) 42%, rgba(255, 255, 255, 0.7));
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
[data-theme="dark"] .lib-item { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06); }

@keyframes libRise {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.lib-item-top { display: flex; gap: 10px; align-items: flex-start; }
.lib-thumb {
  width: 54px; height: 54px; border-radius: 12px; object-fit: cover;
  background: var(--surface-3); flex: none;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}
.lib-thumb-ph {
  width: 54px; height: 54px; border-radius: 12px; flex: none;
  display: grid; place-items: center; color: var(--text-2);
  background:
    radial-gradient(120% 120% at 20% 15%, rgba(122, 160, 255, 0.42), transparent 60%),
    radial-gradient(120% 120% at 85% 25%, rgba(190, 130, 255, 0.34), transparent 62%),
    rgba(255, 255, 255, 0.5);
  font-size: 13px; font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.7);
}
[data-theme="dark"] .lib-thumb-ph { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.1); }
.lib-body { min-width: 0; flex: 1; }
.lib-title {
  margin: 0; font-size: 12.5px; font-weight: 600; line-height: 1.4; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lib-desc {
  margin: 2px 0 0; font-size: 10.5px; line-height: 1.5; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lib-meta { margin: 4px 0 0; font-size: 10px; color: var(--text-3); display: flex; gap: 6px; flex-wrap: wrap; }
.lib-actions { display: flex; gap: 6px; }
.lib-actions .btn {
  flex: 1; padding: 5px 10px; font-size: 11px; border-radius: 9px;
  background: rgba(255, 255, 255, 0.7); border: 1px solid rgba(255, 255, 255, 0.8);
}
.lib-actions .btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 35%, transparent);
}
.lib-actions .btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.lib-actions .btn.danger { flex: none; color: #c8433b; background: rgba(255, 255, 255, 0.55); }
[data-theme="dark"] .lib-actions .btn { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.12); }
[data-theme="dark"] .lib-actions .btn.primary { background: var(--accent); border-color: transparent; }
[data-theme="dark"] .lib-actions .btn.danger { color: #ff8a80; background: rgba(255, 255, 255, 0.06); }

@media (prefers-reduced-motion: reduce) {
  .lib-drawer, .lib-item, .lib-mask { transition: none; animation: none; }
}

@media (max-width: 720px) {
  .lib-tab { bottom: 96px; padding: 8px 10px; }
  .lib-tab span { display: none; }
}

/* ---------- 提示词库（页面） ---------- */
.lib-head-tools { display: flex; align-items: center; gap: 10px; }
.lib-search-inline {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 6px 18px rgba(31, 45, 80, 0.07);
}
.lib-search-inline svg { width: 13px; height: 13px; stroke: var(--text-3); fill: none; stroke-width: 1.9; stroke-linecap: round; }
.lib-search-inline input { border: 0; outline: none; background: transparent; font-size: 12px; color: var(--text); width: 150px; }
[data-theme="dark"] .lib-search-inline { background: rgba(40, 44, 56, 0.55); border-color: rgba(255, 255, 255, 0.12); }

.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
  gap: 16px;
  margin-top: 4px;
}

.lib-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 22px;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.4));
  border: 1px solid rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  box-shadow: 0 16px 38px rgba(31, 45, 80, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: transform 0.24s var(--ease), box-shadow 0.24s var(--ease), border-color 0.2s;
}
.lib-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 26px 54px rgba(31, 45, 80, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.85);
}
[data-theme="dark"] .lib-card {
  background: linear-gradient(155deg, rgba(44, 48, 62, 0.72), rgba(24, 27, 36, 0.52));
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.lib-cover {
  position: relative;
  border-radius: 15px;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background:
    radial-gradient(120% 120% at 18% 12%, hsla(var(--h, 220), 88%, 74%, 0.6), transparent 58%),
    radial-gradient(120% 120% at 88% 18%, hsla(calc(var(--h, 220) + 46), 82%, 72%, 0.5), transparent 62%),
    linear-gradient(150deg, #eef2fb, #e6e9f4);
  display: grid;
  place-items: center;
}
.lib-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.5s var(--ease); }
.lib-card:hover .lib-cover img { transform: scale(1.04); }
.lib-cover-ph { width: 34px; height: 34px; opacity: 0.45; stroke: var(--text-2); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
[data-theme="dark"] .lib-cover { background: linear-gradient(150deg, #232838, #1a1d27); }

.lib-card-body { padding: 0 2px; flex: 1; }
.lib-card-title {
  margin: 0 0 4px;
  font-size: 13px; font-weight: 600; letter-spacing: -0.15px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lib-card-prompt {
  margin: 0;
  font-size: 11.5px; line-height: 1.65; color: var(--text-3);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 38px;
}
.lib-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.lib-chip {
  font-size: 9.5px;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.65);
}
[data-theme="dark"] .lib-chip { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.1); }

.lib-card-actions { display: flex; gap: 6px; margin-top: auto; }
.lib-card-actions .btn { flex: 1; font-size: 11px; padding: 6px 10px; border-radius: 10px; }
.lib-card-actions .btn.danger { flex: none; }

/* 左侧导航里的词库入口 */
.nav-item.nav-lib svg { stroke: var(--text-2); }
.nav-item.nav-lib.is-on {
  background: linear-gradient(120deg, rgba(122, 160, 255, 0.18), rgba(190, 130, 255, 0.14));
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(18px) saturate(170%);
}
[data-theme="dark"] .nav-item.nav-lib.is-on {
  background: linear-gradient(120deg, rgba(122, 160, 255, 0.22), rgba(190, 130, 255, 0.16));
  border-color: rgba(255, 255, 255, 0.12);
}

@media (max-width: 720px) {
  .lib-head-tools { width: 100%; }
  .lib-search-inline input { width: 100%; }
}

/* ---------- 会员页 ---------- */
.wallet {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 22px 24px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 180% at 0% 0%, var(--accent-soft), transparent 62%),
    color-mix(in srgb, var(--surface-solid) 76%, transparent);
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  box-shadow: var(--shadow-1);
  margin-bottom: 20px;
}
.wallet-label { display: block; font-size: 11.5px; color: var(--text-2); }
.wallet-main > b { display: block; font-size: 40px; font-weight: 600; letter-spacing: -1.4px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.wallet-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.wallet-sub { margin: 8px 0 0; font-size: 11.5px; color: var(--text-3); }

.wallet-breakdown { display: grid; grid-template-columns: repeat(3, minmax(104px, 1fr)); gap: 10px; }
.bd-item {
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-solid) 70%, transparent);
  border: 1px solid var(--line-soft);
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.bd-item span { font-size: 10.5px; color: var(--text-3); }
.bd-item b { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bd-item em { font-style: normal; font-size: 10px; color: var(--text-3); white-space: nowrap; }

.pricing-tabs { width: fit-content; margin-bottom: 18px; padding: 3px; }
.pricing-tabs .seg { height: 30px; padding: 0 18px; }

.pricing-panel { animation: fade 0.18s var(--ease); }
.panel-note { margin: 14px 2px 0; font-size: 11px; color: var(--text-3); line-height: 1.7; }
.panel-head-inline { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.panel-head-inline h2 { margin: 0; font-size: 13.5px; font-weight: 600; }

.tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tier {
  position: relative;
  padding: 22px 20px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-solid) 76%, transparent);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  box-shadow: var(--shadow-1);
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color 0.2s, transform 0.26s var(--ease), box-shadow 0.26s var(--ease);
}
.tier:hover { transform: translateY(-3px); box-shadow: 0 18px 44px rgba(0, 0, 0, 0.14); }
.tier.featured { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: 0 12px 34px color-mix(in srgb, var(--accent) 14%, transparent); }
.tier-badge { position: absolute; top: -9px; left: 20px; height: 18px; padding: 0 8px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 600; display: inline-flex; align-items: center; }
.tier-name { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.tier-price { margin: 6px 0 14px; }
.tier-price em { font-style: normal; font-size: 30px; font-weight: 600; letter-spacing: -0.8px; }
.tier-price span { font-size: 11.5px; color: var(--text-3); margin-left: 4px; }
.tier-list { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 9px; }
.tier-list li { font-size: 11.5px; color: var(--text-2); padding-left: 18px; position: relative; }
.tier-list li::before {
  content: "✓";
  position: absolute; left: 0; top: 0;
  font-size: 10px; line-height: 1.7;
  color: var(--accent);
}
.tier .btn { width: 100%; height: 34px; margin-top: auto; }

.packs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.pack {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 18px 20px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-solid) 76%, transparent);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  box-shadow: var(--shadow-1);
  text-align: left;
  transition: border-color 0.2s, transform 0.26s var(--ease), box-shadow 0.26s var(--ease);
}
.pack:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 18px 44px rgba(0, 0, 0, 0.14); }
.pack-name { font-size: 12px; color: var(--text-2); }
.pack-price { font-size: 26px; font-weight: 600; letter-spacing: -0.8px; font-variant-numeric: tabular-nums; }
.pack em { font-style: normal; font-size: 10.5px; color: var(--text-3); margin-top: 6px; }

/* ---------- 卡密兑换 ---------- */
.redeem-box {
  max-width: 520px;
  padding: 22px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-solid);
  box-shadow: var(--shadow-1);
}
.redeem-box h3 { margin: 0 0 4px; font-size: 14px; font-weight: 600; }
.redeem-box .sub { margin: 0 0 14px; font-size: 11.5px; color: var(--text-3); }
.redeem-row { display: flex; gap: 8px; }
.redeem-row input {
  flex: 1; height: 36px; padding: 0 12px;
  border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text);
  font-size: 13px; letter-spacing: 1.2px; font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.redeem-row input:focus { outline: none; border-color: var(--accent); background: var(--surface-solid); }
.redeem-row .btn { height: 36px; padding: 0 18px; }
.redeem-hint { margin: 12px 0 0; font-size: 10.5px; color: var(--text-3); line-height: 1.7; }

.tx-table { display: flex; flex-direction: column; border-radius: var(--r-lg); border: 1px solid var(--line); background: color-mix(in srgb, var(--surface-solid) 78%, transparent); backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%); overflow: hidden; box-shadow: var(--shadow-1); }
.tx-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px 70px 92px;
  align-items: center; gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
}
.tx-row:last-child { border-bottom: 0; }
.tx-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tx-row .tx-name { color: var(--text); }
.tx-desc { font-size: 10.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-row .tx-time { color: var(--text-3); font-size: 11px; text-align: right; }
.tx-row .tx-delta { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.tx-row .tx-delta.up { color: var(--ok); }
.tx-row .tx-delta.down { color: var(--text); }
.tx-balance { text-align: right; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------- 联系管理员 ---------- */
.contact-box {
  margin-top: 4px; padding: 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  display: flex; gap: 16px; align-items: flex-start; justify-content: space-between;
}
.contact-text { margin: 0; font-size: 12.5px; line-height: 1.9; white-space: pre-wrap; }
.contact-text.is-empty { color: var(--text-3); }
.contact-qr { width: 120px; height: 120px; border-radius: 10px; object-fit: cover; background: var(--surface-3); }
.contact-note { margin: 12px 0 0; font-size: 11px; color: var(--text-3); line-height: 1.7; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ---------- 输入条 ---------- */
.composer-wrap {
  position: fixed; left: 232px; right: 0; bottom: 0; z-index: 40;
  padding: 22px 28px 12px;
  background: linear-gradient(180deg, transparent, var(--bg) 55%);
  pointer-events: none;
  transition: left 0.3s var(--ease), transform 0.3s var(--ease), opacity 0.24s var(--ease);
}
.composer-wrap.is-hidden {
  transform: translateY(calc(100% + 16px));
  opacity: 0;
}
.rail.is-collapsed ~ .main .composer-wrap { left: 68px; }
.composer {
  pointer-events: auto;
  max-width: 860px; margin: 0 auto;
  padding: 12px 12px 9px;
  border-radius: var(--r-xl);
  background: var(--surface);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.composer:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: var(--shadow-2), 0 0 0 4px var(--accent-soft);
}

.composer-top { display: flex; gap: 10px; align-items: flex-start; }
.upload {
  width: 46px; height: 46px; flex: none;
  border-radius: var(--r-md);
  border: 1px dashed var(--line);
  background: var(--surface-2);
  color: var(--text-3);
  display: grid; place-items: center;
  transition: color 0.15s, border-color 0.15s;
}
.upload:hover { color: var(--accent); border-color: var(--accent); }
.upload.is-off { opacity: 0.4; cursor: not-allowed; }
.upload.is-off:hover { color: var(--text-3); border-color: var(--line); }
.upload svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; }

#prompt {
  flex: 1; min-height: 46px; max-height: 140px;
  padding: 13px 2px 0;
  border: 0; outline: 0; background: none; resize: none;
  font-size: 13px; line-height: 1.65;
}
#prompt::placeholder { color: var(--text-3); }

.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.bar-left { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.bar-right { display: flex; align-items: center; gap: 10px; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 26px; padding: 0 8px;
  border-radius: var(--r-sm);
  font-size: 11.5px; font-weight: 500; color: var(--text-2);
  transition: background 0.15s, color 0.15s;
}
.chip:hover { background: var(--hover); color: var(--text); }
.chip.is-off,
.chip:disabled { opacity: 0.55; cursor: not-allowed; }
.chip.is-off:hover,
.chip:disabled:hover { background: transparent; color: var(--text-2); }
.chip .caret { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 2; opacity: 0.6; }

/* 反推：目标模型选择 */
.rev-target { display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-3); flex: none; }
.rev-target select {
  height: 30px; padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  max-width: 180px;
}
.rev-target select:focus { outline: none; border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.cost { font-size: 11px; color: var(--text-3); white-space: nowrap; }

.send {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-3);
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.send svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.send.is-ready { background: var(--accent); color: #fff; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 40%, transparent); }
.send.is-ready:hover { transform: translateY(-1px); }
/* 并发占满：按钮变暗，点了会提示还差多久 */
.send.is-full { background: var(--surface-3); color: var(--text-3); opacity: 0.7; box-shadow: none; }
.send.is-full:hover { transform: none; }
.send { position: relative; }
.send.is-busy { background: color-mix(in srgb, var(--accent) 18%, var(--surface-3)); color: var(--accent); cursor: progress; }
.send.is-busy::after {
  content: "";
  position: absolute; inset: -4px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--accent);
  border-right-color: color-mix(in srgb, var(--accent) 40%, transparent);
  animation: genSpin 0.9s linear infinite;
}

.disclaimer { text-align: center; font-size: 10.5px; color: var(--text-3); margin: 8px 0 0; }

.ref-strip { display: flex; gap: 8px; padding: 8px 0 0 56px; flex-wrap: wrap; align-items: center; }
.ref-count { font-size: 10.5px; color: var(--text-3); margin-right: 2px; }
.ref-thumb { position: relative; width: 48px; height: 48px; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line); }
.ref-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ref-del {
  position: absolute; top: 2px; right: 2px;
  width: 15px; height: 15px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.6); color: #fff;
}
.ref-del svg { width: 8px; height: 8px; stroke: currentColor; stroke-width: 2.6; fill: none; stroke-linecap: round; }

/* ---------- 登录 ---------- */
.auth-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; font-size: 12.5px; color: var(--text-2); }
.auth-brand .brand-mark { width: 22px; height: 22px; border-radius: 7px; }
.auth-brand .brand-mark svg { width: 13px; height: 13px; }
.auth-brand .brand-name { font-size: 13.5px; }
.auth-brand .brand-name em { font-size: 9.5px; }
#authTabs { width: 100%; margin-bottom: 16px; }
#authTabs .seg { flex: 1; }
.field { margin-bottom: 12px; }
.auth-submit { width: 100%; height: 36px; margin-top: 6px; }
.form-error { margin: 0 0 10px; font-size: 11.5px; color: var(--danger); }
.auth-demo { margin: 14px 0 0; text-align: center; font-size: 11px; color: var(--text-3); line-height: 1.9; }
.auth-demo b { color: var(--text-2); font-weight: 500; }
.link { color: var(--accent); font-size: 11px; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- 作品详情 ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 130;
  display: grid; place-items: center;
  padding: 30px;
  background: var(--scrim);
  backdrop-filter: blur(18px) saturate(120%);
  animation: fade 0.2s var(--ease);
  overflow: hidden;
}
.lb-backdrop {
  position: absolute; inset: -60px;
  background-size: cover;
  background-position: center;
  filter: blur(70px) saturate(140%);
  opacity: 0.38;
  transform: scale(1.08);
  pointer-events: none;
}
[data-theme="light"] .lb-backdrop { opacity: 0.22; }

.lb-close {
  position: absolute; top: 20px; right: 20px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--surface-solid) 86%, transparent);
  border: 1px solid var(--line);
  color: var(--text-2);
  backdrop-filter: blur(10px);
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.lb-close:hover { color: var(--text); transform: scale(1.05); }
.lb-close svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; }

.lb-inner {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px; width: min(1120px, 100%); max-height: 88vh;
}
.lb-media { display: grid; place-items: center; min-height: 0; }
.lb-media img {
  max-width: 100%; max-height: 88vh;
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06);
  background: var(--surface-2);
}

.lb-side {
  padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
  height: fit-content; max-height: 88vh; overflow: auto;
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface-solid) 94%, transparent);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  backdrop-filter: blur(20px);
}
.lb-eyebrow {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.6px;
  text-transform: uppercase; color: var(--text-3);
}

.lb-prompt-block {
  padding: 11px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
}
.lb-prompt-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.4px;
  text-transform: uppercase; color: var(--text-3);
}
.lb-copy-inline {
  width: 22px; height: 22px; border-radius: 6px;
  display: grid; place-items: center;
  color: var(--text-3);
}
.lb-copy-inline:hover { color: var(--accent); background: var(--accent-soft); }
.lb-copy-inline svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lb-prompt { margin: 7px 0 0; font-size: 12.5px; line-height: 1.75; max-height: 148px; overflow: auto; }

.lb-meta { margin: 0; display: grid; gap: 0; }
.lb-meta > div {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 7px 1px;
  font-size: 11.5px; border-bottom: 1px solid var(--line-soft);
}
.lb-meta > div:last-child { border-bottom: 0; }
.lb-meta dt { color: var(--text-3); }
.lb-meta dd { margin: 0; color: var(--text); font-variant-numeric: tabular-nums; }

.lb-refs { display: flex; gap: 6px; flex-wrap: wrap; }
.lb-refs img {
  width: 46px; height: 46px; border-radius: 8px;
  object-fit: cover; border: 1px solid var(--line); background: var(--surface-2);
}

.lb-actions { display: grid; gap: 7px; margin-top: 2px; }
.lb-actions .btn { width: 100%; height: 33px; }
.lb-actions .btn .heart { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.8; margin-right: 6px; }
.lb-actions .btn.is-liked { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.lb-actions .btn.is-liked .heart { fill: var(--danger); stroke: var(--danger); }
.case-tag.is-like { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }

/* ---------- 浮层 ---------- */
.popover {
  position: fixed; z-index: 140;
  min-width: 200px;
  padding: 6px;
  border-radius: var(--r-lg);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  backdrop-filter: var(--glass);
  animation: pop 0.16s var(--ease);
}
.popover-head { padding: 8px 10px 6px; font-size: 11px; font-weight: 600; color: var(--text-3); }
.popover-body { display: grid; gap: 2px; max-height: 320px; overflow: auto; }

.menu .menu-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; padding: 7px 10px;
  border-radius: var(--r-sm);
  font-size: 12.5px; text-align: left; color: var(--text);
}
.menu .menu-item:hover { background: var(--hover); }
.menu .menu-item.is-on { color: var(--accent); }
.menu .menu-item .check { width: 12px; height: 12px; stroke: var(--accent); fill: none; stroke-width: 2.4; opacity: 0; }
.menu .menu-item.is-on .check { opacity: 1; }
.menu .menu-item small { color: var(--text-3); font-size: 10.5px; font-weight: 400; }
.menu .menu-label { padding: 6px 10px 4px; font-size: 10.5px; color: var(--text-3); }
.menu .menu-sep { height: 1px; background: var(--line-soft); margin: 4px 6px; }

/* 菜单本身可滚动：模型多了或屏幕矮时不会顶出屏幕 */
.popover.menu {
  max-height: min(62vh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.menu .menu-item > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* @ 引用参考图的菜单 */
.menu .menu-item.mention-item { justify-content: flex-start; gap: 10px; }
.mention-item .mention-thumb {
  width: 26px; height: 26px;
  flex: none;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.mention-item span { color: var(--text); }
.menu .menu-item.mention-add { color: var(--accent); }
.menu .menu-item.is-active { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.menu .menu-item.is-active span { color: var(--accent); }
.menu .menu-empty { padding: 8px 12px; font-size: 11.5px; color: var(--text-3); }

.notif-item { display: flex; gap: 10px; padding: 8px; border-radius: var(--r-sm); font-size: 11.5px; color: var(--text-2); align-items: center; }
.notif-item:hover { background: var(--hover); }
.notif-item img { width: 30px; height: 30px; border-radius: 6px; object-fit: cover; background: var(--surface-3); }
.notif-item b { display: block; color: var(--text); font-weight: 500; font-size: 12px; }

/* 公告列表 */
.ann-item {
  display: flex; flex-direction: column; gap: 3px;
  width: 100%; text-align: left;
  padding: 10px; border-radius: var(--r-sm);
  transition: background 0.15s;
}
.ann-item:hover { background: var(--hover); }
.ann-head { display: flex; align-items: center; gap: 6px; }
.ann-head b { font-size: 12px; font-weight: 600; color: var(--text); }
.ann-pin {
  font-size: 9px; padding: 1px 6px; border-radius: 999px;
  color: #b45309; background: rgba(245, 158, 11, 0.16);
}
.ann-body {
  font-size: 11px; line-height: 1.6; color: var(--text-3);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ann-time { font-size: 10px; color: var(--text-3); opacity: 0.8; }

/* ---------- 登录态 ---------- */
.user-chip { display: flex; align-items: center; gap: 7px; padding: 3px 9px 3px 3px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-solid); }
.user-chip:hover { border-color: var(--accent); }
.user-chip .avatar {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, #6e8bff, #b06bff);
}
.user-chip .user-name { font-size: 12px; font-weight: 500; max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .templates { grid-template-columns: repeat(2, 1fr); }
  .refs-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .rail { display: none; }
  .composer-wrap { left: 0 !important; }
  .view { padding: 18px 16px 40px; }
  #view-create { padding-bottom: 200px; }
  .topbar { padding: 0 16px; }
  .templates { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiers { grid-template-columns: 1fr; }
  .lb-inner { grid-template-columns: 1fr; max-height: 90vh; overflow: auto; }
  .view-head { flex-direction: column; align-items: flex-start; }
}


