/* =====================================================================
   云绘 AI · 图像工坊 —— 前台样式
   白色科技风 / 毛玻璃 / 轻量渐变
   ===================================================================== */

:root {
  --ink: #0b1220;
  --ink-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: rgba(15, 23, 42, .08);
  --line-2: rgba(99, 102, 241, .18);
  --glass: rgba(255, 255, 255, .72);
  --glass-soft: rgba(255, 255, 255, .55);
  --brand: #4f46e5;
  --brand-2: #2563eb;
  --brand-3: #06b6d4;
  --grad: linear-gradient(135deg, #6366f1 0%, #3b82f6 52%, #22d3ee 100%);
  --grad-soft: linear-gradient(135deg, rgba(99, 102, 241, .12), rgba(34, 211, 238, .12));
  --ok: #0ea5a4;
  --warn: #f59e0b;
  --danger: #e11d48;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 24px 60px -34px rgba(30, 64, 175, .38), 0 2px 8px rgba(15, 23, 42, .04);
  --shadow-sm: 0 8px 22px -14px rgba(30, 64, 175, .35);
  --font: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: #f7f9ff;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, p, ul, li { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }

/* ---------------------------------------------------------------------
   背景
   --------------------------------------------------------------------- */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(1200px 620px at 12% -8%, #eef2ff 0%, rgba(238, 242, 255, 0) 62%),
    radial-gradient(900px 520px at 88% 2%, #e6f7ff 0%, rgba(230, 247, 255, 0) 60%),
    radial-gradient(900px 700px at 50% 110%, #f5f0ff 0%, rgba(245, 240, 255, 0) 65%),
    #f8fafe;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .55;
  animation: float 16s ease-in-out infinite;
}
.orb-1 { width: 520px; height: 520px; left: -120px; top: -140px; background: radial-gradient(circle at 30% 30%, rgba(99, 102, 241, .5), transparent 70%); }
.orb-2 { width: 460px; height: 460px; right: -100px; top: 40px; background: radial-gradient(circle at 60% 40%, rgba(34, 211, 238, .45), transparent 70%); animation-delay: -5s; }
.orb-3 { width: 420px; height: 420px; left: 38%; bottom: -180px; background: radial-gradient(circle at 50% 50%, rgba(168, 85, 247, .32), transparent 70%); animation-delay: -9s; }

.grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(15, 23, 42, .045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, .045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(900px 560px at 50% 0%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(900px 560px at 50% 0%, #000 0%, transparent 78%);
  opacity: .7;
}

@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(24px, -18px, 0) scale(1.05); }
}

/* ---------------------------------------------------------------------
   通用
   --------------------------------------------------------------------- */
.glass {
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, .85);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.ico { width: 16px; height: 16px; flex: none; }

.wrap {
  position: relative;
  z-index: 1;
  max-width: 1300px;
  margin: 0 auto;
  padding: 22px 26px 40px;
}

/* 顶栏 */
.topbar {
  position: sticky;
  top: 14px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1250px;
  margin: 16px auto 0;
  padding: 10px 16px;
  border-radius: 18px;
}

.brand { display: flex; align-items: center; gap: 11px; }
.brand .logo { width: 38px; height: 38px; display: block; filter: drop-shadow(0 8px 16px rgba(79, 70, 229, .28)); }
.brand .logo svg { width: 100%; height: 100%; }
.brand-text { display: flex; align-items: baseline; gap: 8px; }
.brand-text strong { font-size: 17px; letter-spacing: .3px; }
.brand-text em { font-style: normal; font-size: 12px; color: var(--muted); letter-spacing: .5px; }

.top-actions { display: flex; align-items: center; gap: 9px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .7);
  color: var(--ink-2);
  font-size: 12.5px;
  transition: .18s ease;
}
.chip:hover { border-color: var(--line-2); background: #fff; transform: translateY(-1px); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(14, 165, 164, .14); }
.chip b { font-size: 13px; color: var(--brand); font-variant-numeric: tabular-nums; }
.chip-ghost { background: rgba(255, 255, 255, .5); }

.btn-key {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 15px;
  border: none;
  border-radius: 11px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  background: var(--grad);
  box-shadow: 0 10px 22px -12px rgba(59, 130, 246, .9);
  transition: .2s ease;
}
.btn-key:hover { transform: translateY(-1px); box-shadow: 0 14px 26px -12px rgba(59, 130, 246, .95); }
.btn-key .ico { width: 15px; height: 15px; }

/* 头图 */
.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding: 34px 6px 20px;
  animation: fadeUp .6s ease both;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: .8px;
  color: var(--brand);
  background: rgba(99, 102, 241, .08);
  border: 1px solid rgba(99, 102, 241, .16);
  padding: 6px 12px;
  border-radius: 999px;
}
.eyebrow i { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px rgba(99, 102, 241, .16); }

.hero h1 {
  margin-top: 14px;
  font-size: clamp(26px, 3vw, 40px);
  line-height: 1.22;
  letter-spacing: -.6px;
  font-weight: 800;
  background: linear-gradient(120deg, #0f172a 0%, #1e3a8a 45%, #0e7490 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .sub { margin-top: 10px; font-size: 13.5px; color: var(--muted); max-width: 640px; line-height: 1.7; }

.hero-stats { display: flex; gap: 10px; flex: none; }
.stat {
  min-width: 92px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .68);
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.stat b { display: block; font-size: 19px; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.stat span { font-size: 11px; color: var(--faint); }

/* 公告 */
.notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  margin: 4px 0 16px;
  font-size: 12.5px;
  color: var(--ink-2);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  background: linear-gradient(90deg, rgba(224, 242, 254, .8), rgba(238, 242, 255, .72));
}
.notice .ico { width: 15px; height: 15px; color: var(--brand-2); }
.notice-x { margin-left: auto; border: none; background: transparent; color: var(--faint); font-size: 16px; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.notice-x:hover { background: rgba(15, 23, 42, .05); color: var(--ink); }

/* ---------------------------------------------------------------------
   工作区
   --------------------------------------------------------------------- */
.workspace {
  display: grid;
  grid-template-columns: 424px minmax(0, 1fr);
  gap: 20px;
  /* 两栏等高：右侧画布撑满整行，避免 PC 端画布下方空出一大块 */
  align-items: stretch;
  animation: fadeUp .7s .05s ease both;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.panel-head h2 { font-size: 15px; font-weight: 700; letter-spacing: .2px; }
.panel-head .hint { font-size: 11.5px; color: var(--faint); }

.composer {
  position: sticky;
  top: 78px;
  /* 左栏按内容高度走（吸顶），不跟着画布拉长，避免底部留白 */
  align-self: start;
  padding: 18px 18px 16px;
}

/* 表单 */
.field { margin-bottom: 15px; }
.label-note {
  font-style: normal;
  font-weight: 400;
  font-size: 10.5px;
  color: var(--faint);
  margin-left: 5px;
}

.label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 8px;
  letter-spacing: .2px;
}
.label .counter { font-weight: 400; font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.label .counter b { color: var(--brand); font-weight: 600; }
.label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.label-row .label { margin: 0; }
.label-row .hint {
  font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums;
  /* 显示原始模型名时可能很长，超长省略而不是把标题挤走 */
  max-width: 62%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.textarea-box { position: relative; }
textarea#prompt {
  width: 100%;
  min-height: 104px;
  resize: vertical;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .82);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink);
  outline: none;
  transition: .2s ease;
}
textarea#prompt::placeholder { color: #a8b3c7; }
textarea#prompt:focus {
  border-color: rgba(99, 102, 241, .5);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, .1);
}
.clear-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 7px;
  background: rgba(15, 23, 42, .04);
  color: var(--faint);
  font-size: 14px;
  line-height: 1;
  opacity: 0;
  transition: .18s;
}
textarea#prompt:not(:placeholder-shown) ~ .clear-btn { opacity: 1; }
.clear-btn:hover { background: rgba(225, 29, 72, .1); color: var(--danger); }

.ideas { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.ideas button {
  border: 1px dashed var(--line);
  background: rgba(255, 255, 255, .6);
  color: var(--muted);
  font-size: 11.5px;
  padding: 5px 10px;
  border-radius: 999px;
  transition: .18s ease;
}
.ideas button:hover { border-style: solid; border-color: rgba(99, 102, 241, .4); color: var(--brand); background: rgba(238, 242, 255, .9); }

/* 尺寸 */
.size-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.size-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 9px 4px 7px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .66);
  transition: .18s ease;
}
.size-tile:hover { border-color: rgba(99, 102, 241, .35); background: #fff; transform: translateY(-1px); }
.size-tile.is-active {
  border-color: transparent;
  background: linear-gradient(180deg, rgba(99, 102, 241, .12), rgba(34, 211, 238, .1));
  box-shadow: inset 0 0 0 1.5px rgba(99, 102, 241, .55), 0 8px 18px -14px rgba(79, 70, 229, .8);
}
.ratio-box {
  position: relative;
  height: 30px;
  width: auto;
  aspect-ratio: 1 / 1;
  border-radius: 5px;
  border: 1.5px solid #c7d2e8;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
  transition: .18s ease;
}
.ratio-box i {
  position: absolute;
  inset: 0;
  background: linear-gradient(140deg, #eef2ff, #f8fbff);
}
.size-tile.is-active .ratio-box { border-color: var(--brand); box-shadow: 0 2px 8px -2px rgba(79, 70, 229, .4); }
.size-tile.is-active .ratio-box i { background: var(--grad); opacity: .85; }
.size-meta { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.size-meta b { font-size: 10.5px; color: var(--ink-2); font-weight: 600; }
.size-meta em { font-style: normal; font-size: 9.5px; color: var(--faint); letter-spacing: -.1px; }
.size-tile.is-active .size-meta b { color: var(--brand); }

/* 画质方案 */
.model-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.model-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 11px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .66);
  text-align: left;
  transition: .18s ease;
}
.model-tile:hover { border-color: rgba(99, 102, 241, .35); background: #fff; transform: translateY(-1px); }
.model-tile .m-top { display: flex; align-items: flex-start; gap: 5px; min-width: 0; padding-right: 20px; }
.model-tile b { font-size: 12.5px; font-weight: 700; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
/* 显示原始模型名时字号收一档，常见 ID 能单行放下 */
.model-tile.is-raw b { font-size: 11.5px; letter-spacing: -.015em; }
.model-tile em { font-style: normal; font-size: 10.5px; color: var(--faint); line-height: 1.45; }
.model-tile .tag {
  font-style: normal;
  font-size: 9.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(99, 102, 241, .1);
  color: var(--brand);
  letter-spacing: .2px;
  flex: none;
  white-space: nowrap;
  margin-top: 1px;
}
.model-tile.is-active {
  border-color: transparent;
  background: linear-gradient(180deg, rgba(99, 102, 241, .1), rgba(34, 211, 238, .08));
  box-shadow: inset 0 0 0 1.5px rgba(99, 102, 241, .55), 0 8px 18px -14px rgba(79, 70, 229, .8);
}
.model-tile .m-check {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1.5px solid #cbd5e1;
  transition: .18s ease;
}
.model-tile.is-active .m-check { border-color: transparent; background: var(--grad); box-shadow: 0 0 0 2px rgba(99, 102, 241, .14); }
.model-tile.is-active .m-check::after {
  content: "";
  position: absolute;
  left: 3.6px;
  top: 1.4px;
  width: 4px;
  height: 7px;
  border: 1.6px solid #fff;
  border-top: 0;
  border-left: 0;
  transform: rotate(42deg);
}
.model-tile.is-active b { color: var(--brand); }

/* 分段 */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.segment {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 11px;
  background: rgba(15, 23, 42, .04);
  border: 1px solid rgba(255, 255, 255, .8);
}
.segment button {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: 8px;
  padding: 6px 4px;
  font-size: 11.5px;
  color: var(--muted);
  transition: .18s ease;
  white-space: nowrap;
}
.segment button:hover { color: var(--ink); }
.segment button.is-active {
  background: #fff;
  color: var(--brand);
  font-weight: 600;
  box-shadow: 0 4px 12px -8px rgba(15, 23, 42, .5);
}

/* 主按钮 */
.generate {
  position: relative;
  width: 100%;
  height: 50px;
  border: none;
  border-radius: 14px;
  color: #fff;
  background: var(--grad);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  overflow: hidden;
  box-shadow: 0 18px 34px -18px rgba(59, 130, 246, .95);
  transition: .2s ease;
}
.generate .g-glow {
  position: absolute;
  inset: -60% -20%;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .55) 48%, transparent 62%);
  transform: translateX(-60%);
  animation: sheen 4.5s ease-in-out infinite;
}
.generate .g-label { display: inline-flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 700; letter-spacing: .6px; position: relative; z-index: 1; }
.generate .g-sub { position: relative; z-index: 1; font-size: 11px; opacity: .78; }
.generate:hover { transform: translateY(-1px); box-shadow: 0 22px 40px -18px rgba(59, 130, 246, 1); }
.generate:active { transform: translateY(0) scale(.995); }
.generate[disabled] { opacity: .62; cursor: not-allowed; transform: none; box-shadow: none; }
.generate.small { height: 44px; border-radius: 12px; }
.generate.small .g-sub { display: none; }

@keyframes sheen {
  0%, 55% { transform: translateX(-70%); }
  85%, 100% { transform: translateX(70%); }
}

.tip { margin-top: 9px; font-size: 10.5px; color: var(--faint); line-height: 1.6; text-align: center; }

/* ---------------------------------------------------------------------
   画布
   --------------------------------------------------------------------- */
.stage {
  padding: 16px 18px 18px;
  min-height: 560px;
  display: flex;
  flex-direction: column;
  /* 高度由工作区行高决定，与左侧「创作设置」底部对齐 */
  height: 100%;
}
.stage-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.stage-title { display: flex; align-items: center; gap: 9px; }
.stage-title h2 { font-size: 15px; font-weight: 700; }
.status-pill {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(99, 102, 241, .1);
  color: var(--brand);
  border: 1px solid rgba(99, 102, 241, .16);
}
.status-pill.ok { background: rgba(14, 165, 164, .1); color: #0f766e; border-color: rgba(14, 165, 164, .18); }
.status-pill.bad { background: rgba(225, 29, 72, .08); color: #be123c; border-color: rgba(225, 29, 72, .16); }
.stage-tools { display: flex; gap: 7px; }

.mini {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .8);
  color: var(--ink-2);
  font-size: 11.5px;
  padding: 6px 11px;
  border-radius: 9px;
  transition: .18s ease;
}
.mini:hover { border-color: rgba(99, 102, 241, .4); color: var(--brand); background: #fff; }
.mini.primary { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 8px 18px -12px rgba(59, 130, 246, .9); }
.mini.primary:hover { color: #fff; }
.mini.danger { color: var(--danger); }
.mini.danger:hover { border-color: rgba(225, 29, 72, .4); background: rgba(255, 241, 244, .9); color: var(--danger); }

.stage-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* 空状态 */
.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px 20px; }
.empty-art { width: 186px; margin-bottom: 8px; opacity: .95; }
.empty-art svg { width: 100%; height: auto; }
.empty h3 { font-size: 15px; margin-bottom: 6px; }
.empty p { font-size: 12.5px; color: var(--muted); max-width: 380px; line-height: 1.75; }
.empty-chips { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin-top: 14px; }
.empty-chips span {
  font-size: 11px;
  color: var(--muted);
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .8);
  border: 1px solid var(--line);
}

/* 生成中 */
.running { flex: 1; display: flex; flex-direction: column; gap: 14px; padding-top: 4px; }
.run-card {
  border-radius: 16px;
  padding: 15px 16px;
  background: linear-gradient(160deg, rgba(238, 242, 255, .85), rgba(236, 254, 255, .7));
  border: 1px solid rgba(99, 102, 241, .16);
}
.run-top { display: flex; align-items: center; gap: 11px; }
.run-top div { display: flex; flex-direction: column; gap: 2px; }
.run-top b { font-size: 13.5px; }
.run-top em { font-style: normal; font-size: 11px; color: var(--muted); }
.run-pct { margin-left: auto; font-size: 17px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid rgba(99, 102, 241, .2);
  border-top-color: var(--brand);
  animation: spin .9s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.bar { margin: 12px 0 12px; height: 6px; border-radius: 99px; background: rgba(15, 23, 42, .06); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--grad); transition: width .5s cubic-bezier(.4, 0, .2, 1); position: relative; }
.bar span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .6), transparent);
  animation: slide 1.6s linear infinite;
}
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.steps { display: flex; gap: 6px; flex-wrap: wrap; }
.steps li {
  font-size: 11px;
  color: var(--faint);
  padding: 4px 9px;
  border-radius: 7px;
  background: rgba(255, 255, 255, .6);
  position: relative;
}
.steps li.on { color: var(--brand); background: #fff; box-shadow: 0 2px 6px -3px rgba(99, 102, 241, .6); }
.steps li.done { color: #0f766e; }
.run-foot { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.run-foot .run-tip { margin: 0; flex: 1 1 160px; font-size: 11px; color: var(--faint); }
/* 生图不可撤销：只作提示，不提供取消入口 */
.run-lock {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, .08);
  background: rgba(148, 163, 184, .1);
  font-size: 11px;
  letter-spacing: .01em;
  color: #64748b;
  white-space: nowrap;
}
.run-lock i {
  width: 6px; height: 6px; border-radius: 50%;
  background: #94a3b8;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, .18);
}

.skeleton-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; flex: 1; }
.skeleton-grid.single { grid-template-columns: 1fr; }
.sk {
  border-radius: 16px;
  min-height: 220px;
  background: linear-gradient(110deg, #f2f5fd 8%, #fbfdff 18%, #f2f5fd 33%);
  background-size: 220% 100%;
  animation: shimmer 1.5s linear infinite;
  border: 1px solid rgba(255, 255, 255, .9);
}
@keyframes shimmer { to { background-position: -220% 0; } }

/* 结果 */
.results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; flex: 1; align-content: safe center; }
.results.single { grid-template-columns: 1fr; }
.res-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(180deg, #fff, #fbfcff);
  border: 1px solid rgba(226, 232, 240, .9);
  box-shadow: 0 10px 26px -20px rgba(15, 23, 42, .5);
  animation: fadeUp .5s ease both;
  display: flex;
  flex-direction: column;
}
.res-media {
  position: relative;
  display: grid;
  place-items: center;
  padding: 8px;
  background:
    linear-gradient(45deg, rgba(241, 245, 249, .9) 25%, transparent 25%, transparent 75%, rgba(241, 245, 249, .9) 75%) 0 0/16px 16px,
    linear-gradient(45deg, rgba(241, 245, 249, .9) 25%, transparent 25%, transparent 75%, rgba(241, 245, 249, .9) 75%) 8px 8px/16px 16px,
    #fff;
  min-height: 180px;
  cursor: zoom-in;
}
.res-media img { width: 100%; height: auto; max-height: 480px; object-fit: contain; border-radius: 10px; }
.res-badge {
  position: absolute;
  left: 12px;
  top: 12px;
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, .9);
  color: var(--ink-2);
  letter-spacing: .2px;
}
.res-hover {
  position: absolute;
  inset: auto 8px 8px 8px;
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  opacity: 0;
  transform: translateY(6px);
  transition: .22s ease;
}
.res-media:hover .res-hover { opacity: 1; transform: none; }
.res-hover .mini { background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); }
.res-meta { display: flex; align-items: center; gap: 8px; padding: 9px 12px 11px; border-top: 1px solid rgba(226, 232, 240, .7); flex-wrap: wrap; }
.res-meta .m { font-size: 11px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.res-meta .m b { color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.res-meta .sep { width: 3px; height: 3px; border-radius: 50%; background: #cbd5e1; }
.res-meta .dl { margin-left: auto; }

/* 失败 */
.fail { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 30px; }
.fail-ico {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(225, 29, 72, .08);
  color: var(--danger);
  font-size: 20px;
  font-weight: 700;
  border: 1px solid rgba(225, 29, 72, .18);
}
.fail h3 { font-size: 15px; }
.fail p { font-size: 12.5px; color: var(--muted); max-width: 420px; line-height: 1.7; }

/* ---------------------------------------------------------------------
   历史
   --------------------------------------------------------------------- */
.history { margin-top: 20px; padding: 18px; animation: fadeUp .8s .1s ease both; }
.hist-tools { display: flex; align-items: center; gap: 9px; }
.hist-count { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.hist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 11px; }
.hist-empty {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 12.5px;
  color: var(--faint);
  padding: 34px 10px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .45);
}
.hist-card {
  position: relative;
  border-radius: 13px;
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, .9);
  background: #fff;
  cursor: zoom-in;
  transition: .2s ease;
}
.hist-card:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -20px rgba(15, 23, 42, .55); }
.hist-card img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.hist-card .hc-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 7px 9px; }
.hist-card .hc-foot span { font-size: 10.5px; color: var(--faint); }
.hist-card .hc-left { font-size: 10px; padding: 2px 6px; border-radius: 5px; background: rgba(14, 165, 164, .08); color: #0f766e; }
.hist-card .hc-left.soon { background: rgba(245, 158, 11, .12); color: #b45309; }

/* ---------------------------------------------------------------------
   页脚
   --------------------------------------------------------------------- */
.foot {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 26px 10px 6px;
  font-size: 11.5px;
  color: var(--faint);
}
.dot-sep { width: 3px; height: 3px; border-radius: 50%; background: #cbd5e1; }

/* ---------------------------------------------------------------------
   弹窗
   --------------------------------------------------------------------- */
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-mask { position: absolute; inset: 0; background: rgba(15, 23, 42, .28); backdrop-filter: blur(6px); }
.modal-card {
  position: relative;
  width: min(520px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: 22px;
  border-radius: 22px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 40px 80px -40px rgba(15, 23, 42, .5);
  animation: pop .3s cubic-bezier(.2, .9, .3, 1.2) both;
}
.modal-card.narrow { width: min(400px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-x {
  position: absolute;
  right: 14px;
  top: 12px;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 8px;
  background: rgba(15, 23, 42, .04);
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}
.modal-x:hover { background: rgba(15, 23, 42, .08); color: var(--ink); }
.modal-head { display: flex; align-items: center; gap: 11px; margin-bottom: 16px; }
.modal-ico {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--grad-soft);
  border: 1px solid rgba(99, 102, 241, .16);
  color: var(--brand);
  font-size: 15px;
}
.modal-ico svg { width: 19px; height: 19px; }
.modal-head h3 { font-size: 15.5px; }
.modal-head p { font-size: 11.5px; color: var(--faint); margin-top: 2px; }

.key-intro p { font-size: 12.5px; color: var(--muted); line-height: 1.75; }
.key-intro ul { margin: 9px 0 14px; display: grid; gap: 5px; }
.key-intro li { font-size: 11.5px; color: var(--muted); padding-left: 15px; position: relative; }
.key-intro li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 6px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--grad);
}

.input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #fff;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: .18s ease;
}
.input:focus { border-color: rgba(99, 102, 241, .5); box-shadow: 0 0 0 4px rgba(99, 102, 241, .1); }
.inline { display: flex; gap: 8px; }
.inline .input { flex: 1; }
.inline .mini { height: 40px; padding: 0 14px; }

.or { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--faint); font-size: 11px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.keycard {
  border-radius: 16px;
  padding: 14px;
  background: linear-gradient(155deg, rgba(238, 242, 255, .95), rgba(240, 253, 255, .8));
  border: 1px solid rgba(99, 102, 241, .16);
}
.keycard-top { display: flex; align-items: center; justify-content: space-between; }
.kc-label { font-size: 11px; color: var(--muted); letter-spacing: .4px; }
.kc-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, .16);
  color: var(--muted);
}
.kc-badge.on { background: rgba(14, 165, 164, .12); color: #0f766e; }
.kc-badge.warn { background: rgba(245, 158, 11, .14); color: #b45309; }
.keycard-value { display: flex; align-items: center; gap: 10px; margin: 9px 0 12px; }
.keycard-value code {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  letter-spacing: .6px;
  color: var(--ink);
  word-break: break-all;
}
.keycard-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keycard-stats > div {
  background: rgba(255, 255, 255, .8);
  border-radius: 10px;
  padding: 8px 10px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, .95);
}
.keycard-stats b { display: block; font-size: 14px; font-variant-numeric: tabular-nums; letter-spacing: -.2px; }
.keycard-stats span { font-size: 10px; color: var(--faint); }

.redeem-box { margin-top: 16px; }
.redeem-box .hint { margin-top: 7px; font-size: 10.5px; color: var(--faint); line-height: 1.6; }
.key-actions { display: flex; gap: 8px; margin-top: 16px; }
.key-actions .mini { flex: 1; }

/* 大图 */
.lightbox { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 22px; }
.lightbox[hidden] { display: none; }
.lb-mask { position: absolute; inset: 0; background: rgba(9, 14, 26, .72); backdrop-filter: blur(10px); }
.lb-body {
  position: relative;
  width: min(1080px, 100%);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: pop .28s ease both;
}
.lb-img-wrap { flex: 1; display: grid; place-items: center; min-height: 0; }
.lb-img-wrap img { max-width: 100%; max-height: 74vh; border-radius: 12px; box-shadow: 0 30px 70px -30px rgba(0, 0, 0, .8); }
.lb-x {
  position: absolute;
  right: 0;
  top: -38px;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-size: 18px;
  line-height: 1;
}
.lb-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 13px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .16); color: #e2e8f0; }
.lb-info { font-size: 11.5px; letter-spacing: .2px; }
.lb-actions { display: flex; gap: 8px; }
.lb-actions .mini { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .2); color: #fff; }
.lb-actions .mini.primary { background: var(--grad); border-color: transparent; color: #fff; }

/* Toast */
.toast-wrap { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  font-size: 12.5px;
  padding: 9px 16px;
  border-radius: 11px;
  background: rgba(15, 23, 42, .88);
  color: #fff;
  box-shadow: 0 14px 30px -14px rgba(15, 23, 42, .7);
  animation: toastIn .25s ease both;
  max-width: 80vw;
}
.toast.ok { background: rgba(13, 148, 136, .95); }
.toast.bad { background: rgba(190, 18, 60, .95); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------------
   响应式
   --------------------------------------------------------------------- */
@media (max-width: 1120px) {
  .workspace { grid-template-columns: 1fr; }
  .composer { position: static; }
  .hero { flex-direction: column; align-items: flex-start; gap: 16px; }
  /* 窄屏副标题已写明「N 个可用模型」，不再重复一张孤立的小卡 */
  .hero-stats { display: none; }
}

@media (max-width: 760px) {
  .wrap { padding: 14px 14px 30px; }
  .stage { min-height: 420px; padding: 14px 14px 16px; }
  .topbar { margin: 10px 10px 0; padding: 8px 10px; border-radius: 15px; }
  .brand-text em { display: none; }
  .hide-sm { display: none; }
  .hero { padding: 22px 4px 14px; }
  .hero h1 { font-size: 26px; }
  .results, .skeleton-grid { grid-template-columns: 1fr; }
  .size-grid { grid-template-columns: repeat(3, 1fr); }
  .model-grid { grid-template-columns: 1fr; }
  .chip .chip-label { display: none; }
  .modal-card { padding: 18px; border-radius: 18px; }
  .hist-grid { grid-template-columns: repeat(2, 1fr); }
  .lb-actions .mini { padding: 6px 9px; }
  .foot { font-size: 10.5px; gap: 7px; }
}
