:root {
  color-scheme: light;
  --ink: #211a2d;
  --muted: #6f667a;
  --line: #e9e2ef;
  --purple: #6d3ce7;
  --purple-dark: #4f23bc;
  --wash: #f8f5fc;
  --white: #fff;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; background: #fcfbfe; color: var(--ink); }
button, textarea, input { font: inherit; }
button { min-height: 44px; cursor: pointer; }
.muted { color: var(--muted); font-size: 14px; line-height: 1.65; }

.topbar { min-height: 64px; padding: 10px max(20px, calc((100vw - 1180px) / 2)); display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px); }
.brand { color: var(--ink); font-weight: 760; text-decoration: none; }
.test-badge { padding: 6px 10px; border-radius: 999px; background: #eee7ff; color: var(--purple-dark); font-size: 12px; }
.quiet-button { border: 1px solid var(--line); border-radius: 12px; padding: 0 15px; background: var(--white); color: var(--ink); }
.topbar .quiet-button { margin-left: auto; }

.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 40px 0 96px; }
.hero { max-width: 760px; margin-bottom: 34px; }
.eyebrow { margin: 0 0 10px; color: var(--purple); font-size: 13px; font-weight: 760; letter-spacing: .08em; text-transform: uppercase; }
.hero h1 { margin: 0; font-size: clamp(38px, 5vw, 60px); line-height: 1.06; letter-spacing: -.04em; }
.hero > p:last-child { max-width: 660px; margin: 18px 0 0; color: var(--muted); font-size: 17px; line-height: 1.75; }

.gate-card { max-width: 560px; margin: 60px auto; padding: 36px; border: 1px solid var(--line); border-radius: 22px; background: var(--white); box-shadow: 0 18px 60px rgba(50,27,81,.06); text-align: center; }
.gate-card h1 { margin: 0 0 12px; font-size: 36px; }
.gate-card p { color: var(--muted); line-height: 1.7; }
.link-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; text-decoration: none; }

.subscription-card, .composer-card, .projects-card, .flow-panel, .progress { border: 1px solid var(--line); border-radius: 22px; background: var(--white); box-shadow: 0 18px 60px rgba(50,27,81,.06); }
.subscription-card { padding: 24px 28px; margin-bottom: 24px; }
.subscription-card h2 { margin: 0; font-size: 24px; }
.sub-status { display: grid; gap: 10px; }
.sub-tier { display: inline-block; width: fit-content; padding: 6px 14px; border-radius: 999px; background: var(--purple); color: #fff; font-weight: 760; }
.quota-bar { width: min(420px, 100%); height: 10px; border-radius: 999px; background: var(--wash); overflow: hidden; border: 1px solid var(--line); }
.quota-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--purple), #9068f0); }
.sub-quota p { margin: 8px 0 0; }
.plan-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.plan-grid article { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--wash); }
.plan-grid h3, .plan-grid p { margin: 0 0 9px; }
.plan-grid strong { font-size: 22px; }
.plan-grid small { display: block; color: var(--muted); line-height: 1.6; margin-bottom: 12px; }
.refund-copy { color: var(--muted); line-height: 1.6; margin: 16px 0 0; font-size: 13px; }
.buy-button { min-height: 40px; }

.composer-card { padding: 28px; margin-bottom: 24px; }
.message { display: flex; gap: 12px; margin-bottom: 24px; }
.avatar { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 13px; background: var(--purple); color: #fff; font-weight: 800; }
.message p { margin: 7px 0 0; color: var(--muted); line-height: 1.65; }
label { display: block; margin-bottom: 10px; font-weight: 700; }
textarea { width: 100%; min-height: 150px; resize: vertical; border: 1px solid var(--line); border-radius: 16px; padding: 16px; color: var(--ink); background: #fdfcff; line-height: 1.7; outline: 0; }
.composer-card input[type="text"] { width: 100%; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fdfcff; outline: 0; }
textarea:focus, input:focus { border-color: var(--purple); box-shadow: 0 0 0 4px rgba(109,60,231,.12); }
.composer-meta { min-height: 30px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.primary-button { border: 0; border-radius: 13px; padding: 0 22px; background: var(--purple); color: #fff; font-weight: 760; }
.primary-button:hover { background: var(--purple-dark); }
.primary-button:disabled { cursor: not-allowed; opacity: .45; }
.text-button { border: 0; background: transparent; color: var(--purple-dark); padding: 0 12px; }
.notice { margin: 16px 0; padding: 12px 14px; border-radius: 12px; background: #fff3d8; color: #76510a; line-height: 1.6; }

.projects-card { padding: 24px 28px; }
.projects-card h2 { margin: 0 0 16px; font-size: 24px; }
.project-list { display: grid; gap: 10px; }
.project-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--wash); color: var(--ink); }
.project-row:hover { border-color: var(--purple); background: #f2edff; }
.project-row span { color: var(--muted); font-size: 13px; }

.back-button { margin-bottom: 14px; padding-left: 0; }
.project-head h1 { margin: 0 0 6px; font-size: clamp(28px, 4vw, 40px); letter-spacing: -.03em; }
.project-head p { margin: 0 0 8px; }

.workspace { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; margin-top: 26px; align-items: start; }
.progress { padding: 20px; position: sticky; top: 84px; }
.progress ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.progress li { min-height: 48px; padding: 8px 10px; display: flex; align-items: center; gap: 10px; border-radius: 12px; color: var(--muted); }
.progress li span { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--wash); font-size: 13px; }
.progress li.active { background: #f2edff; color: var(--purple-dark); font-weight: 700; }
.progress li.active span { background: var(--purple); color: var(--white); }
.progress li.done { color: var(--ink); }
.progress li.done span { background: #e4f5e9; color: #1d7a3d; }
.privacy-note { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.privacy-note p { color: var(--muted); font-size: 13px; line-height: 1.65; }

.stage-stack { display: grid; gap: 20px; min-width: 0; }
.flow-panel { min-width: 0; padding: 28px; }
.stage-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.stage-heading h2 { margin: 0; font-size: 27px; }
.stage-heading h3 { margin: 0; font-size: 20px; }
.stage-heading p:last-child { margin: 9px 0 0; color: var(--muted); line-height: 1.65; }
.confirm-badge { flex: 0 0 auto; padding: 7px 14px; border-radius: 999px; background: #e4f5e9; color: #1d7a3d; font-weight: 760; font-size: 13px; }

.chat-log { display: grid; gap: 12px; max-height: 420px; overflow-y: auto; padding: 4px 2px 12px; margin-bottom: 18px; }
.chat-item { display: flex; gap: 10px; align-items: flex-start; }
.chat-item p { margin: 0; padding: 12px 16px; border-radius: 16px; line-height: 1.65; max-width: 85%; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-item.assistant p { background: linear-gradient(145deg, #f2edff, #faf8ff); border-bottom-left-radius: 6px; }
.chat-item.user { justify-content: flex-end; }
.chat-item.user p { background: var(--purple); color: #fff; border-bottom-right-radius: 6px; }

.document-sheet { display: grid; gap: 16px; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: #fdfcff; }
.document-sheet label { margin: 0; }
.document-sheet input, .document-sheet textarea { width: 100%; margin-top: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; color: var(--ink); background: #fff; line-height: 1.6; outline: 0; }
.document-sheet textarea { min-height: 84px; resize: vertical; }
.locked { background: var(--wash) !important; color: var(--muted); }
.document-actions { justify-content: space-between; }

.outline-editor { display: grid; gap: 14px; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: #fdfcff; }
.outline-item { display: grid; gap: 8px; }
.outline-item-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.outline-no { color: var(--purple); font-weight: 800; }
.outline-source { margin-left: auto; padding: 4px 10px; border-radius: 999px; background: #eee7ff; color: var(--purple-dark); font-size: 12px; }
.outline-item textarea { min-height: 58px; border-radius: 12px; padding: 10px 14px; background: #fff; }

.task-list { display: grid; gap: 10px; margin-top: 18px; }
.task-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--wash); }
.task-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.task-status { padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 760; }
.status-active { background: #e8f0fe; color: #1a56b8; }
.status-done { background: #e4f5e9; color: #1d7a3d; }
.status-interrupted { background: #fff3d8; color: #76510a; }
.status-failed { background: #fde8e8; color: #b0393e; }
.task-error { width: 100%; margin: 0; font-size: 13px; }

.result-card { margin-top: 20px; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: #fdfcff; }
.article-body { margin: 12px 0 0; padding: 18px; border-radius: 14px; background: #fff; border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; line-height: 1.85; max-height: 560px; overflow-y: auto; }

@media (max-width: 760px) {
  .topbar { padding: 10px 16px; }
  .brand { max-width: 154px; font-size: 14px; }
  .test-badge { display: none; }
  .shell { width: calc(100% - 32px); padding: 26px 0 72px; }
  .hero h1 { font-size: 38px; }
  .hero > p:last-child { font-size: 16px; }
  .workspace { grid-template-columns: 1fr; margin-top: 20px; }
  .progress { position: static; overflow-x: auto; padding: 12px; }
  .progress ol { grid-template-columns: repeat(4, minmax(112px, 1fr)); }
  .privacy-note { display: none; }
  .subscription-card, .composer-card, .projects-card, .flow-panel { padding: 20px 16px; }
  .stage-heading { flex-direction: column; gap: 10px; }
  .document-sheet, .outline-editor, .result-card { padding: 16px 12px; }
  textarea { min-height: 130px; }
  .actions { flex-direction: column; align-items: stretch; }
  .actions button { width: 100%; }
  .plan-grid { grid-template-columns: 1fr; }
  .chat-item p { max-width: 92%; }
  .gate-card { margin: 30px auto; padding: 24px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
