/*
 * x.defou.ai 样式，沿用得否设计规范（wangdefou.com/DESIGN.md）：
 * 暖白纸面、墨黑文字、唯一强调色苹果红，结构靠字号和细线。
 * 微信绿只用在来源标识上，帮读者一眼认出公众号链接。
 */
:root {
  color-scheme: light;
  --paper: #f6f3ee;
  --paper-2: #eee9e1;
  --card: #fffdf9;
  --ink: #17140f;
  --ink-2: #3b352d;
  --muted: #6f675c;
  --line: #e1d9cd;
  --line-strong: #cfc5b6;
  --accent: #b4321f;
  --accent-deep: #8f2717;
  --accent-soft: #f4e3dc;
  --wx: #07a35a;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, monospace;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --shadow: 0 18px 40px -24px rgba(23, 20, 15, .25);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  display: flex; flex-direction: column; min-height: 100dvh;
  background: var(--paper); color: var(--ink); font-size: 15px; line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent); color: #fff; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---- Top bar ------------------------------------------------------------ */
.bar { border-bottom: 1px solid var(--line); }
.bar-inner {
  display: flex; align-items: center; justify-content: space-between;
  width: min(100% - 40px, 720px); height: 64px; margin: 0 auto;
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.brand svg { width: 26px; height: 26px; stroke-width: 1.8; color: var(--accent); }
.brand-tag { color: var(--muted); font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: .04em; }
.bar-links a {
  display: inline-flex; align-items: center; gap: 4px; padding: 7px 14px;
  border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ink-2); font-size: 14px;
  transition: border-color .2s var(--ease), color .2s var(--ease);
}
.bar-links a:hover { border-color: var(--ink); color: var(--ink); }

/* ---- Main --------------------------------------------------------------- */
main { flex: 1; width: min(100% - 40px, 720px); margin: 0 auto; padding: 28px 0 40px; }
main.empty { display: flex; flex-direction: column; justify-content: center; padding-bottom: 12vh; }

.hero { margin-bottom: 32px; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; margin: 0; color: var(--ink-2); font-size: 14px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.hero h1 {
  margin: 18px 0 0; font-size: clamp(30px, 6.4vw, 52px); font-weight: 800;
  line-height: 1.16; letter-spacing: -.02em;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.lead { margin: 18px 0 0; max-width: 32em; color: var(--ink-2); font-size: clamp(15px, 1.6vw, 17px); line-height: 1.8; }
main:not(.empty) .hero { display: none; }

.composer {
  display: flex; align-items: center; gap: 6px; padding: 6px;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 999px; box-shadow: var(--shadow);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.composer:focus-within { border-color: var(--ink); box-shadow: var(--shadow), 0 0 0 4px var(--accent-soft); }
main:not(.empty) .composer { position: sticky; top: 12px; z-index: 2; }
.composer input {
  flex: 1; min-width: 0; padding: 12px 14px 12px 18px; border: 0; outline: 0;
  background: transparent; color: var(--ink); font: inherit; font-size: 16px;
}
.composer input::placeholder { color: var(--muted); }
.composer button {
  display: inline-flex; align-items: center; gap: 6px; min-height: 46px; padding: 0 22px;
  border: 0; border-radius: 999px; background: var(--accent); color: #fff;
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background-color .2s var(--ease), transform .1s;
}
.composer button:hover { background: var(--accent-deep); }
.composer button:active { transform: scale(.97); }
.composer button:disabled { opacity: .5; cursor: progress; }
.composer button svg { width: 18px; height: 18px; }

.error { margin: 12px 18px 0; color: var(--accent); font-size: 14px; }
.error:empty { display: none; }

.sources { display: flex; gap: 10px; margin: 20px 0 0; padding: 0; list-style: none; }
.sources li {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--card);
  color: var(--ink-2); font-size: 13px;
}
main:not(.empty) .sources { display: none; }

.note { margin: 16px 0 0; color: var(--muted); font-family: var(--mono); font-size: 12px; }

.badge {
  display: inline-grid; place-items: center; width: 22px; height: 22px; flex: none;
  border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 1;
}
.badge.x { background: var(--ink); color: var(--paper); }
.badge.wx { background: var(--wx); color: #fff; }

/* ---- Job list: rows separated by space, no rules (DESIGN.md) ----------- */
.jobs { display: grid; gap: 4px; margin: 28px 0 0; padding: 0; list-style: none; }
.job {
  display: flex; align-items: center; gap: 14px; padding: 12px 2px;
  animation: enter .3s var(--ease);
}
.job > .badge { width: 34px; height: 34px; font-size: 14px; }
.job .body { flex: 1; min-width: 0; }
.job .title {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 16px; font-weight: 600; transition: color .2s var(--ease);
}
.job .title:hover { color: var(--accent); }
.job .meta {
  display: flex; align-items: center; gap: 6px; margin: 3px 0 0;
  color: var(--muted); font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere;
}
.job.failed .meta { color: var(--accent); }
.job.queued .title, .job.running .title { color: var(--muted); font-weight: 500; }

.download, .retry {
  display: inline-flex; align-items: center; gap: 5px; flex: none; min-height: 36px; padding: 0 14px;
  border-radius: 999px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.download { border: 0; background: var(--ink); color: var(--paper); }
.download:hover { background: var(--accent); transform: translateY(-1px); }
.retry { border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); }
.retry:hover { border-color: var(--ink); }
.download svg { width: 16px; height: 16px; }

.spinner {
  width: 12px; height: 12px; flex: none; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite;
}

/* ---- Footer ------------------------------------------------------------- */
.foot {
  display: flex; justify-content: center; gap: 8px; flex-wrap: wrap;
  padding: 18px 16px max(20px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px;
}
.foot a { color: var(--ink-2); font-weight: 600; transition: color .2s var(--ease); }
.foot a:hover { color: var(--accent); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
@media (max-width: 480px) {
  .composer button .label { display: none; }
  .composer button { padding: 0 15px; }
  .composer input { padding: 11px 8px 11px 14px; }
  .hero h1 { font-size: clamp(26px, 8vw, 34px); }
}
