/* ============================================================
   伶汐IMAGE · 全局样式
   视觉基调：暖白纸感 + 薄荷苔绿 + 杏橙暖光，圆润有机、轻盈浮动
   ============================================================ */

:root {
  --paper: #fbf8f1;
  --paper-2: #f4f1e7;
  --ink: #17302a;
  --ink-soft: #33493f;
  --muted: #7e8f86;
  --line: rgba(23, 48, 42, 0.09);
  --line-strong: rgba(23, 48, 42, 0.16);

  --brand: #12745c;
  --brand-deep: #0b5344;
  --mint: #cdeedd;
  --sage: #e3eddb;
  --apricot: #ffd9b0;
  --coral: #f0803f;
  --coral-deep: #e06a2a;

  --white: #ffffff;
  --danger: #c9483c;

  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;

  --shadow-sm: 0 1px 2px rgba(23, 48, 42, 0.05), 0 4px 12px rgba(23, 48, 42, 0.04);
  --shadow-md: 0 2px 6px rgba(23, 48, 42, 0.05), 0 14px 34px -12px rgba(23, 48, 42, 0.16);
  --shadow-lift: 0 4px 10px rgba(23, 48, 42, 0.06), 0 26px 48px -20px rgba(23, 48, 42, 0.28);

  --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei",
    -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 0.68, 0.3, 1);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }

/* ---------- 背景：柔和光斑 + 纸纹 ---------- */
.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.aurora i {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.6;
  animation: drift 26s var(--ease) infinite alternate;
}
.aurora i:nth-child(1) { width: 46vw; height: 46vw; left: -10vw; top: -14vw; background: radial-gradient(circle at 35% 35%, #b9e9d2, transparent 68%); }
.aurora i:nth-child(2) { width: 40vw; height: 40vw; right: -8vw; top: 6vh; background: radial-gradient(circle at 60% 40%, #ffe0bf, transparent 70%); animation-delay: -6s; }
.aurora i:nth-child(3) { width: 38vw; height: 38vw; left: 28vw; bottom: -18vw; background: radial-gradient(circle at 50% 50%, #dcecd2, transparent 72%); animation-delay: -13s; }
.aurora i:nth-child(4) { width: 24vw; height: 24vw; right: 22vw; bottom: 4vh; background: radial-gradient(circle at 50% 50%, #ffefd6, transparent 70%); animation-delay: -19s; }

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(4vw, -3vh, 0) scale(1.12); }
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.045'/%3E%3C/svg%3E");
}

/* ---------- 顶部品牌栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px clamp(18px, 4vw, 46px);
  background: linear-gradient(to bottom, rgba(251, 248, 241, 0.94), rgba(251, 248, 241, 0.68) 68%, rgba(251, 248, 241, 0));
  backdrop-filter: blur(8px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 17px;
}
.brand .mark {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: linear-gradient(145deg, #1a8a6c, #0d5b49);
  display: grid;
  place-items: center;
  box-shadow: 0 6px 14px -6px rgba(18, 116, 92, 0.7);
}
.brand .mark svg { width: 17px; height: 17px; }
.brand em {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.14em;
}

.topbar .spacer { flex: 1; }

.quota-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  color: var(--ink-soft);
  white-space: nowrap;
}
.quota-pill b { font-weight: 600; color: var(--brand-deep); font-variant-numeric: tabular-nums; }
.quota-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.quota-pill.vip { border-color: rgba(224, 106, 42, 0.28); background: linear-gradient(120deg, #fff6ec, #ffe9d6); color: #97501f; }
.quota-pill.vip .dot { background: var(--coral); }
.quota-pill.empty b { color: var(--danger); }

.user-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 34px;
  padding: 0 6px 0 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
}
.user-chip .avatar {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--mint), var(--apricot));
  color: var(--brand-deep);
  font-weight: 600;
  font-size: 12px;
}
.user-chip .name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .caret { color: var(--muted); margin-right: 6px; font-size: 10px; }
.user-chip .menu {
  position: absolute;
  right: 0;
  top: 44px;
  min-width: 168px;
  padding: 8px;
  border-radius: 16px;
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  display: none;
  z-index: 50;
}
.user-chip.open .menu { display: block; animation: pop 0.18s var(--ease); }
.user-chip .menu button {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 9px 10px; border-radius: 10px;
  font-size: 13px; color: var(--ink-soft); text-align: left;
}
.user-chip .menu button:hover { background: var(--paper-2); }
.user-chip .menu .hint { padding: 8px 10px 4px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); margin-top: 4px; }

@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---------- 主内容 ---------- */
.shell {
  position: relative;
  z-index: 2;
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px clamp(18px, 4vw, 46px) 300px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 20px 0 18px;
}
.eyebrow {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; letter-spacing: 0.18em; color: var(--muted);
  text-transform: uppercase;
}
.eyebrow::before { content: ""; width: 16px; height: 1px; background: var(--line-strong); }
.section-head h1 {
  margin: 8px 0 0;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.section-head h1 span { color: var(--brand); font-variant-numeric: tabular-nums; }
.autosave {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted);
  transition: color 0.3s;
}
.autosave::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--brand); opacity: 0.5;
  transition: all 0.3s;
}
.autosave.saved { color: var(--brand); }
.autosave.saved::before { opacity: 1; box-shadow: 0 0 0 3px rgba(18, 116, 92, 0.12); }

/* ---------- 作品网格 ---------- */
.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
}

.card {
  position: relative;
  border-radius: var(--radius-md);
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease), border-color 0.3s;
  animation: rise 0.5s var(--ease) both;
}
.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lift);
  border-color: rgba(18, 116, 92, 0.18);
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.card .thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  background: linear-gradient(150deg, #eef6ee, #f7f1e6);
  overflow: hidden;
}
.card .thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.65s var(--ease);
}
.card:hover .thumb img { transform: scale(1.045); }
.card .thumb.clickable { cursor: zoom-in; }

.card .body { padding: 8px 9px 9px; }
.card .prompt {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 35px;
}
.card .meta {
  display: flex; align-items: center; gap: 4px;
  margin-top: 6px;
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card .meta .sep { opacity: 0.5; }
.card .meta .model { color: #4c6357; }
.card .actions {
  display: flex; gap: 2px;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px dashed var(--line);
}
.card .actions button {
  width: 26px; height: 26px;
  border-radius: 8px;
  display: grid; place-items: center;
  color: var(--muted);
  transition: all 0.2s;
}
.card .actions button:hover { background: var(--paper-2); color: var(--brand-deep); }
.card .actions button.danger:hover { background: #fdeceb; color: var(--danger); }
.card .actions .grow { flex: 1; }
.card .actions svg { width: 12.5px; height: 12.5px; }

.badge-demo {
  position: absolute; top: 6px; left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 9px;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  color: var(--muted);
  backdrop-filter: blur(4px);
}
.badge-model {
  position: absolute; top: 6px; right: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 9px;
  background: rgba(11, 83, 68, 0.78);
  color: #eafaf2;
  letter-spacing: 0.03em;
  backdrop-filter: blur(4px);
}

/* 生成中 */
.card.is-processing .thumb::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.75) 45%, transparent 70%);
  animation: shimmer 1.7s infinite linear;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.card.is-processing .spinner-wrap {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  gap: 10px;
}
.progress-ring { width: 34px; height: 34px; transform: rotate(-90deg); }
.progress-ring circle { fill: none; stroke-width: 3; }
.progress-ring .track { stroke: rgba(18, 116, 92, 0.2); }
.progress-ring .bar {
  stroke: #12745c;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s var(--ease);
}
.progress-text {
  position: absolute; bottom: 10px; left: 0; right: 0;
  text-align: center; font-size: 9.5px; color: var(--brand-deep);
  letter-spacing: 0.03em;
}
.card.is-failed .thumb { background: repeating-linear-gradient(135deg, #fdf3f1, #fdf3f1 10px, #fbe9e6 10px, #fbe9e6 20px); }
.card.is-failed .fail-note {
  position: absolute; inset: 0;
  display: grid; place-content: center; gap: 6px; text-align: center;
  padding: 20px;
  font-size: 12.5px; color: #a8463a;
}
.card.is-failed .fail-note small { color: var(--muted); font-size: 11px; }

/* 空状态 */
.empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  gap: 14px;
  padding: 64px 20px 40px;
  text-align: center;
}
.empty svg { width: 108px; height: 108px; opacity: 0.9; }
.empty h3 { margin: 0; font-size: 16px; font-weight: 600; }
.empty p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.7; max-width: 320px; }

.load-more {
  display: flex; justify-content: center;
  margin: 26px 0 0;
}
.load-more[hidden] { display: none; }
.load-more button {
  height: 38px; padding: 0 20px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.8);
  font-size: 13px; color: var(--ink-soft);
  transition: all 0.25s;
}
.load-more button:hover { background: var(--white); box-shadow: var(--shadow-sm); }

/* ---------- 底部创作面板 ---------- */
.composer-dock {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 25;
  padding: 0 clamp(14px, 4vw, 46px) clamp(14px, 2.4vh, 26px);
  background: linear-gradient(to top, rgba(251, 248, 241, 0.98) 38%, rgba(251, 248, 241, 0.86) 70%, rgba(251, 248, 241, 0));
  pointer-events: none;
}
.composer {
  pointer-events: auto;
  position: relative;
  max-width: 816px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(23, 48, 42, 0.1);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px -12px rgba(23, 48, 42, 0.2), 0 30px 70px -40px rgba(23, 48, 42, 0.4);
  backdrop-filter: blur(18px) saturate(1.15);
  padding: 14px 16px 14px;
  transition: box-shadow 0.4s var(--ease), border-color 0.3s;
}

/* 顶部拖动握把：上下拖动调整输入区高度 */
.composer .grip {
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 46px;
  height: 8px;
  display: grid;
  place-items: center;
  cursor: ns-resize;
  touch-action: none;
  border-radius: 999px;
  z-index: 3;
}
.composer .grip::before {
  content: "";
  width: 34px;
  height: 3px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background 0.2s, width 0.2s;
}
.composer .grip:hover::before,
.composer .grip.dragging::before {
  background: rgba(18, 116, 92, 0.55);
  width: 44px;
}
body.is-guest .composer .grip { display: none; }
.composer:focus-within {
  border-color: rgba(18, 116, 92, 0.28);
  box-shadow: 0 12px 34px -12px rgba(23, 48, 42, 0.24), 0 34px 80px -40px rgba(18, 116, 92, 0.42);
}

.composer .prompt-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.composer .ref-btn {
  position: relative;
  flex: 0 0 auto;
  width: 38px; height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  display: grid; place-items: center;
  transition: all 0.22s;
  margin-top: 2px;
}
.composer .ref-btn:hover { background: var(--white); border-color: var(--line-strong); }
.composer .ref-btn.active { background: var(--mint); border-color: rgba(18, 116, 92, 0.3); color: var(--brand-deep); }
.composer .ref-btn svg { width: 17px; height: 17px; }

.composer textarea {
  flex: 1;
  min-height: 62px;
  max-height: 46vh;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  padding: 8px 4px;
  font-size: 14.5px;
  line-height: 1.72;
  color: var(--ink);
}
.composer textarea::placeholder { color: #a4b1a9; }

/* 参考图预览条（上传后显示在输入框上方） */
.ref-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 2px 10px;
}
.ref-strip[hidden] { display: none; }
.ref-item {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper-2);
  box-shadow: 0 2px 8px -3px rgba(23, 48, 42, 0.25);
  animation: pop 0.2s var(--ease);
  cursor: zoom-in;
  transition: transform 0.2s var(--ease), box-shadow 0.2s;
}
.ref-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px -6px rgba(23, 48, 42, 0.42);
}
.ref-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ref-item .x {
  position: absolute;
  top: 2px; right: 2px;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: rgba(23, 48, 42, 0.66);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.18s, background 0.18s;
}
.ref-item:hover .x,
.ref-item:focus-within .x { opacity: 1; }
.ref-item .x:hover { background: rgba(201, 72, 60, 0.92); }
.ref-item.uploading { cursor: default; }
/* 触屏没有 hover，删除按钮常驻 */
@media (hover: none) {
  .ref-item .x { opacity: 1; }
}
.ref-item.uploading { display: grid; place-items: center; }
.mini-spin {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(18, 116, 92, 0.22);
  border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
}
.ref-count {
  position: absolute;
  top: -5px; right: -5px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 2px 6px -2px rgba(224, 106, 42, 0.9);
}

.controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid rgba(23, 48, 42, 0.06);
}

.field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 6px 0 10px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--paper);
  transition: border-color 0.2s, background 0.2s;
}
.field:hover { background: var(--white); }
.field:focus-within { border-color: rgba(18, 116, 92, 0.35); background: var(--white); }
.field label { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.field select {
  appearance: none;
  border: none;
  background: transparent;
  outline: none;
  font-size: 12.5px;
  color: var(--ink);
  padding-right: 16px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%237e8f86' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0 center;
  max-width: 210px;
  text-overflow: ellipsis;
}
.field.model-field { min-width: 0; }
.field.model-field select { font-size: 12px; letter-spacing: -0.01em; max-width: 210px; }

.controls .grow { flex: 1 1 0; min-width: 0; }

.quota-note {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quota-note.warn { color: var(--danger); }

.btn-generate {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 18px;
  border-radius: 13px;
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  background: linear-gradient(118deg, #f79a54 0%, #ef7c3c 46%, #e4682c 100%);
  box-shadow: 0 8px 20px -8px rgba(224, 106, 42, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition: transform 0.2s var(--ease), box-shadow 0.3s, filter 0.2s;
  overflow: hidden;
  flex: 0 0 auto;
}
.btn-generate::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.28) 50%, transparent 68%);
  transform: translateX(-120%);
  transition: transform 0.7s var(--ease);
}
.btn-generate:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 26px -8px rgba(224, 106, 42, 0.8); }
.btn-generate:hover::after { transform: translateX(120%); }
.btn-generate:active:not(:disabled) { transform: translateY(0); }
.btn-generate:disabled { cursor: not-allowed; filter: grayscale(0.35) opacity(0.6); box-shadow: none; }
.btn-generate svg { width: 16px; height: 16px; }
.btn-generate .spin { display: none; }
.btn-generate.loading .spin { display: block; animation: spin 0.9s linear infinite; }
.btn-generate.loading .ico-spark { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 提示条 ---------- */
.toast-stack {
  position: fixed;
  top: 62px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: grid;
  gap: 8px;
  width: min(92vw, 400px);
  pointer-events: none;
}
.toast {
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  line-height: 1.5;
  background: rgba(23, 48, 42, 0.92);
  color: #f3fbf7;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.28s var(--ease);
  text-align: center;
  backdrop-filter: blur(6px);
}
.toast.err { background: rgba(150, 52, 41, 0.95); }
.toast.ok { background: rgba(11, 83, 68, 0.95); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- 大图预览 ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  place-items: center;
  padding: 4vh 4vw;
  background: rgba(18, 34, 29, 0.62);
  backdrop-filter: blur(10px);
}
.lightbox.open { display: grid; animation: fade 0.24s var(--ease); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.lightbox > div { display: grid; justify-items: center; }
.lightbox img {
  display: block;
  max-width: 100%;
  max-height: 74vh;
  border-radius: 20px;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.6);
}
.lightbox .lb-info {
  margin-top: 16px;
  color: #eaf5ef;
  font-size: 13px;
  line-height: 1.7;
  max-width: 640px;
  text-align: center;
  opacity: 0.85;
}
.lightbox .lb-close {
  position: absolute; top: 22px; right: 26px;
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  display: grid; place-items: center;
}
.lightbox .lb-close:hover { background: rgba(255, 255, 255, 0.26); }

/* ============================================================
   登录 / 注册页
   ============================================================ */
.auth-page {
  position: relative;
  z-index: 2;
  min-height: 100%;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(20px, 5vw, 80px);
  align-items: center;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(28px, 6vh, 64px) clamp(20px, 4vw, 46px);
}

.auth-brand .logo {
  display: inline-flex; align-items: center; gap: 11px;
  font-size: 15px; letter-spacing: 0.06em; color: var(--ink-soft);
}
.auth-brand .logo .mark {
  width: 34px; height: 34px; border-radius: 12px;
  background: linear-gradient(145deg, #1a8a6c, #0d5b49);
  display: grid; place-items: center;
  box-shadow: 0 8px 18px -8px rgba(18, 116, 92, 0.8);
}
.auth-brand h1 {
  margin: 30px 0 0;
  font-size: clamp(34px, 5.2vw, 54px);
  line-height: 1.18;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.auth-brand h1 .grad {
  background: linear-gradient(104deg, #0d5b49 10%, #17927a 55%, #e5834a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-brand p {
  margin: 18px 0 0;
  max-width: 400px;
  font-size: 14.5px;
  line-height: 1.85;
  color: #5d6f66;
}
.auth-brand .feats {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 24px;
}
.auth-brand .feats span {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--brand-deep);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(18, 116, 92, 0.14);
}
.auth-brand .art {
  margin-top: 34px;
  width: min(100%, 470px);
  opacity: 0.95;
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin-left: auto;
  padding: 30px 30px 26px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 20px 50px -26px rgba(23, 48, 42, 0.35), 0 2px 10px rgba(23, 48, 42, 0.04);
  backdrop-filter: blur(20px) saturate(1.2);
}
.auth-card::before {
  content: "";
  position: absolute; inset: -1px;
  border-radius: 29px;
  padding: 1px;
  background: linear-gradient(150deg, rgba(18, 116, 92, 0.28), rgba(255, 217, 176, 0.5), rgba(18, 116, 92, 0.1));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.tabs {
  position: relative;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(244, 241, 231, 0.9);
  margin-bottom: 24px;
}
.tabs .ink {
  position: absolute;
  left: 4px; top: 4px; bottom: 4px;
  width: calc(50% - 4px);
  border-radius: 11px;
  background: var(--white);
  box-shadow: 0 2px 8px rgba(23, 48, 42, 0.08);
  transition: transform 0.32s var(--ease);
}
.tabs button {
  position: relative;
  flex: 1;
  height: 36px;
  font-size: 13.5px;
  color: var(--muted);
  border-radius: 11px;
  transition: color 0.25s;
  z-index: 1;
}
.tabs button.on { color: var(--ink); font-weight: 500; }

.auth-card h2 {
  margin: 0 0 4px;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.auth-card .sub {
  margin: 0 0 22px;
  font-size: 13px;
  color: var(--muted);
}

.fld { margin-bottom: 14px; }
.fld label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 7px;
  letter-spacing: 0.02em;
}
.fld .box {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 46px;
  padding: 0 14px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: rgba(251, 248, 241, 0.7);
  transition: all 0.22s;
}
.fld .box:focus-within {
  border-color: rgba(18, 116, 92, 0.42);
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(18, 116, 92, 0.07);
}
.fld .box svg { width: 16px; height: 16px; color: var(--muted); flex: 0 0 auto; }
.fld input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  min-width: 0;
}
.fld input::placeholder { color: #a9b5ad; }
.fld .eye { color: var(--muted); display: grid; place-items: center; }

.auth-msg {
  min-height: 20px;
  font-size: 12.5px;
  color: var(--danger);
  margin: -2px 0 10px;
  line-height: 1.5;
}

.btn-primary {
  width: 100%;
  height: 48px;
  border-radius: 14px;
  color: #fff;
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  background: linear-gradient(118deg, #17866c 0%, #0f6b56 55%, #0b5344 100%);
  box-shadow: 0 12px 26px -12px rgba(11, 83, 68, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  transition: transform 0.2s var(--ease), box-shadow 0.25s;
  display: grid; place-items: center;
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 16px 30px -12px rgba(11, 83, 68, 0.95); }
.btn-primary:disabled { filter: opacity(0.65); cursor: not-allowed; }

.auth-foot {
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
  text-align: center;
}
.auth-foot b { color: var(--brand-deep); font-weight: 500; }

.fade-swap { animation: fadeSwap 0.4s var(--ease); }
@keyframes fadeSwap { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.field-hide { display: none !important; }

@media (max-width: 860px) {
  .auth-page { grid-template-columns: 1fr; gap: 28px; }
  .auth-brand .art { display: none; }
  .auth-card { margin: 0 auto; }
  .auth-brand h1 { font-size: 32px; }
  .auth-brand p { max-width: none; }
}

@media (max-width: 560px) {
  .shell { padding-bottom: 320px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
  .card .body { padding: 7px 8px 8px; }
  .card .prompt { font-size: 10.5px; min-height: 31px; -webkit-line-clamp: 2; }
  .card .meta { font-size: 9.5px; gap: 3px; }
  .card .meta .t, .card .meta .sep { display: none; }
  .card .actions button { width: 24px; height: 24px; }
  .card .actions svg { width: 11.5px; height: 11.5px; }
  .composer { padding: 12px 12px; border-radius: 22px; }
  .composer .ref-btn { width: 34px; height: 34px; }
  .ref-item { width: 46px; height: 46px; border-radius: 10px; }
  .ref-strip { gap: 6px; padding-bottom: 8px; }
  .controls { gap: 7px; }
  .field { height: 33px; padding: 0 6px 0 9px; }
  .field label { display: none; }
  .field select { font-size: 12.5px; max-width: 132px; }
  .field.model-field { flex: 1 1 100%; }
  .field.model-field select { max-width: none; width: 100%; }
  .quota-note { display: none; }
  .btn-generate { height: 38px; padding: 0 15px; font-size: 13px; }
  .topbar { padding: 12px 16px; gap: 10px; }
  .brand em { display: none; }
  .user-chip .name { display: none; }
}

/* ============================================================
   游客态（未登录首页）
   ============================================================ */
.guest-actions { display: flex; align-items: center; gap: 8px; }
.guest-actions[hidden] { display: none; }

.btn-ghost,
.btn-mini {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 17px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: transform 0.2s var(--ease), box-shadow 0.25s, background 0.2s;
}
.btn-ghost {
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line-strong);
}
.btn-ghost:hover { background: var(--white); box-shadow: var(--shadow-sm); }
.btn-mini {
  color: #fff;
  background: linear-gradient(118deg, #17866c 0%, #0f6b56 60%, #0b5344 100%);
  box-shadow: 0 8px 18px -10px rgba(11, 83, 68, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.btn-mini:hover { transform: translateY(-1px); box-shadow: 0 12px 22px -10px rgba(11, 83, 68, 0.9); }

body.is-guest .autosave { visibility: hidden; }

.empty.guest { padding: 34px 20px 26px; }
.empty.guest h3 { font-size: 17px; }
.guest-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 8px;
}
.cta-primary,
.cta-ghost {
  display: inline-flex;
  align-items: center;
  height: 42px;
  padding: 0 22px;
  border-radius: 14px;
  font-size: 14px;
  transition: transform 0.2s var(--ease), box-shadow 0.25s;
}
.cta-primary {
  color: #fff;
  background: linear-gradient(118deg, #17866c 0%, #0f6b56 58%, #0b5344 100%);
  box-shadow: 0 12px 26px -12px rgba(11, 83, 68, 0.9);
}
.cta-primary:hover { transform: translateY(-1px); box-shadow: 0 16px 30px -12px rgba(11, 83, 68, 0.95); }
.cta-ghost {
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line-strong);
}
.cta-ghost:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }

/* 未登录时创作面板锁定为引导态 */
.composer.locked textarea,
.composer.locked textarea:disabled {
  color: #9aa8a0;
  cursor: not-allowed;
}
.composer.locked .field { opacity: 0.55; }
.composer.locked .field select { cursor: not-allowed; }
.composer.locked .ref-btn { opacity: 0.5; cursor: not-allowed; }
.composer.locked .quota-note { color: var(--muted); }

@media (max-width: 560px) {
  .btn-ghost, .btn-mini { height: 31px; padding: 0 13px; font-size: 12.5px; }
  .guest-cta { gap: 8px; }
  .cta-primary, .cta-ghost { height: 38px; padding: 0 16px; font-size: 13px; }
}
