:root {
  --bg: #f5f7fc;
  --card: #ffffff;
  --ink: #1f2430;
  --ink-2: #4b5364;
  --muted: #8a93a5;
  --line: #e8eaf1;
  --accent: #5b6cf0;
  --accent-dark: #4557d8;
  --accent-soft: #eef0ff;
  --green: #2f9e6b;
  --green-soft: #eaf7f0;
  --orange: #d9822b;
  --orange-soft: #fff4e6;
  --red: #d94f4f;
  --red-soft: #fdeeee;
  --shadow: 0 10px 34px rgba(41, 51, 92, .08);
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.7 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  min-height: 100vh;
}
.bg-glow {
  position: fixed; inset: 0 0 auto 0; height: 420px; pointer-events: none; z-index: 0;
  background: radial-gradient(720px 260px at 18% -6%, rgba(91,108,240,.15), transparent 70%),
              radial-gradient(620px 240px at 86% 2%, rgba(74,190,160,.12), transparent 70%);
}
.wrap { width: min(1080px, calc(100% - 40px)); margin: 0 auto; position: relative; z-index: 1; }
.narrow { width: min(720px, calc(100% - 40px)); }

.topbar { border-bottom: 1px solid var(--line); background: rgba(255,255,255,.78); backdrop-filter: blur(8px); }
.topbar-in { height: 66px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 18px; font-weight: 700; letter-spacing: .3px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; display: inline-grid; place-items: center;
  background: linear-gradient(135deg, #6b7bff, #4b5be0); color: #fff; font-size: 19px; font-weight: 800;
  box-shadow: 0 5px 14px rgba(91,108,240,.32);
}
.pill { background: var(--accent-soft); color: var(--accent-dark); border-radius: 999px; padding: 6px 14px; font-size: 12.5px; font-weight: 600; }

.hero { padding: 44px 0 28px; }
.hero h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.25; margin: 0 0 10px; letter-spacing: -.5px; }
.hero p { color: var(--muted); margin: 0; font-size: 15px; }

.demo-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--orange-soft); border: 1px solid #f2d9b5; color: #8a5a1c;
  border-radius: 12px; padding: 11px 16px; margin: 0 0 18px; font-size: 13px;
}
.demo-banner b { color: #a4610f; }
.demo-banner span { flex: 1; min-width: 240px; }
.demo-banner a { color: #a4610f; font-weight: 700; white-space: nowrap; }
.demo-outbox { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin: -8px 0 20px; font-size: 13px; }
.demo-outbox .ob-row { display: flex; gap: 12px; align-items: center; padding: 7px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.demo-outbox .ob-row:last-child { border-bottom: 0; }
.demo-outbox .ob-sub { flex: 1; min-width: 200px; color: var(--ink-2); word-break: break-all; }
.demo-outbox a { color: var(--accent); font-weight: 600; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.card-head h2 { font-size: 17px; margin: 0; flex: 1; font-weight: 700; }
.step { width: 26px; height: 26px; flex: none; border-radius: 8px; background: var(--accent-soft); color: var(--accent-dark); display: inline-grid; place-items: center; font-size: 12px; font-weight: 800; }

.examples { margin: -4px 0 14px; }
.examples-title { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.examples-title span { font-weight: 400; color: #a4abbb; margin-left: 6px; }
.examples-list { display: grid; gap: 7px; }
.example-item {
  display: flex; align-items: flex-start; gap: 9px; width: 100%; text-align: left;
  border: 1px solid var(--line); background: #fbfcff; border-radius: 10px;
  padding: 9px 11px; cursor: pointer; font-family: inherit; font-size: 13px;
  color: var(--ink-2); line-height: 1.55;
  transition: border-color .15s, background .15s, transform .15s;
}
.example-item:hover { border-color: var(--accent); background: #f7f8ff; transform: translateX(2px); }
.example-item.active { border-color: var(--accent); background: var(--accent-soft); }
.example-no {
  flex: none; width: 19px; height: 19px; border-radius: 6px; margin-top: 1px;
  background: var(--accent-soft); color: var(--accent-dark);
  display: inline-grid; place-items: center; font-size: 11px; font-weight: 800;
}
.example-item.active .example-no { background: var(--accent); color: #fff; }
.example-text {
  flex: 1; min-width: 0; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; word-break: break-word;
}

textarea, input[type=email] {
  width: 100%; border: 1px solid var(--line); background: #fbfcff; color: var(--ink);
  border-radius: 11px; padding: 13px 14px; font: inherit; outline: none; transition: border-color .18s, box-shadow .18s;
}
textarea { min-height: 152px; resize: vertical; line-height: 1.7; }
textarea:focus, input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(91,108,240,.10); background: #fff; }
.counter { text-align: right; color: var(--muted); font-size: 12px; margin: 4px 2px 14px; }
.field { display: block; margin: 0 0 18px; }
.field > span { display: block; font-size: 13px; color: var(--ink-2); font-weight: 600; margin-bottom: 7px; }

.btn-primary {
  width: 100%; border: 0; border-radius: 11px; padding: 13px 18px; cursor: pointer;
  background: linear-gradient(135deg, #6b7bff, #4b5be0); color: #fff;
  font-family: inherit; font-size: 15px; font-weight: 600;
  box-shadow: 0 8px 20px rgba(91,108,240,.25); transition: transform .15s, box-shadow .15s, opacity .15s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(91,108,240,.32); }
.btn-primary:disabled { opacity: .6; cursor: wait; transform: none; }
.btn-ghost { border: 1px solid var(--line); background: #fff; color: var(--ink-2); border-radius: 9px; padding: 8px 14px; cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost.small { padding: 5px 12px; font-size: 12px; }
.btn-demo { border: 1px dashed #d9a45c; background: var(--orange-soft); color: #9a6115; border-radius: 9px; padding: 8px 14px; cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600; }
.as-link { display: inline-block; text-decoration: none; margin-top: 8px; }
.hint { color: var(--muted); font-size: 12.5px; margin: 12px 0 0; }
.msg { margin-top: 14px; padding: 11px 14px; border-radius: 10px; font-size: 13.5px; }
.msg.ok { background: var(--green-soft); color: #22714e; border: 1px solid #c8ead8; }
.msg.err { background: var(--red-soft); color: #a53b3b; border: 1px solid #f5cccc; }

.flow { list-style: none; margin: 0; padding: 0; counter-reset: flow; }
.flow li { position: relative; padding: 0 0 18px 38px; margin-bottom: 16px; border-bottom: 1px dashed var(--line); }
.flow li:last-child { border-bottom: 0; margin-bottom: 6px; padding-bottom: 0; }
.flow li::before {
  counter-increment: flow; content: counter(flow);
  position: absolute; left: 0; top: 0; width: 25px; height: 25px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-dark); display: grid; place-items: center;
  font-size: 12px; font-weight: 800;
}
.flow b { display: block; font-size: 14.5px; margin-bottom: 3px; }
.flow span { color: var(--muted); font-size: 13px; }
.flow .mail { display: inline; color: var(--accent-dark); font-weight: 700; }

.result-card { background: linear-gradient(180deg, #fdfdff, #fff); }
.result-main { font-size: 14px; }
.result-code { display: inline-block; background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; padding: 3px 10px; border-radius: 7px; font-size: 13px; }
.result-status { margin: 14px 0 6px; font-weight: 600; }
.result-answer { background: var(--green-soft); border-left: 4px solid var(--green); border-radius: 8px; padding: 13px 15px; white-space: pre-wrap; word-break: break-word; margin-top: 12px; color: #206044; }
.dev-link { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 12.5px; color: var(--muted); word-break: break-all; }
.dev-link a { color: var(--accent); font-weight: 600; }

.list-card { margin-top: 20px; }
.qlist { display: grid; gap: 12px; }
.qitem { border: 1px solid var(--line); border-radius: 12px; padding: 15px 17px; background: #fcfdff; }
.qtop { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.qcode { font-size: 12px; font-weight: 800; color: var(--accent-dark); letter-spacing: .5px; }
.qtime { margin-left: auto; color: var(--muted); font-size: 12px; }
.chip { font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 3px 10px; }
.chip.waiting { background: var(--accent-soft); color: var(--accent-dark); }
.chip.answered { background: var(--green-soft); color: #22714e; }
.chip.pending { background: var(--orange-soft); color: #a4610f; }
.qtext { white-space: pre-wrap; word-break: break-word; color: var(--ink); }
.qanswer { margin-top: 10px; background: var(--green-soft); border-left: 3px solid var(--green); border-radius: 8px; padding: 10px 13px; white-space: pre-wrap; word-break: break-word; color: #206044; font-size: 14px; }
.qwaiting { margin-top: 10px; color: var(--muted); font-size: 13px; }
.qwaiting.err { color: #a53b3b; font-weight: 600; }
.mail-warn { margin-top: 10px; padding: 9px 12px; border-radius: 8px; font-size: 12.5px; line-height: 1.65; background: var(--orange-soft); color: #a4610f; border: 1px solid #f3d6a8; word-break: break-word; }
.empty { color: var(--muted); text-align: center; padding: 26px 10px; font-size: 14px; }
.lookup-box { background: var(--accent-soft); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-size: 13px; color: var(--accent-dark); }

.footer { text-align: center; color: var(--muted); font-size: 12.5px; padding: 30px 0 40px; }

/* 支付弹窗 */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-mask { position: absolute; inset: 0; background: rgba(23, 28, 45, .48); backdrop-filter: blur(3px); }
.modal-panel {
  position: relative; width: min(400px, 100%); background: #fff; border-radius: 18px;
  box-shadow: 0 24px 70px rgba(20,26,55,.28); padding: 26px; text-align: center;
  max-height: calc(100vh - 40px); overflow: auto;
}
.modal-x { position: absolute; right: 14px; top: 10px; border: 0; background: none; font-size: 26px; color: var(--muted); cursor: pointer; line-height: 1; }
.modal-panel .card-head { justify-content: center; }
.modal-panel .card-head h2 { flex: none; font-size: 17px; }
.pay-sub { color: var(--muted); font-size: 13px; margin: -6px 0 12px; }
.pay-amount { font-size: 30px; font-weight: 800; color: var(--ink); letter-spacing: -.5px; margin-bottom: 14px; }
.pay-qr { display: flex; justify-content: center; min-height: 220px; align-items: center; }
.pay-qr img, .pay-qr canvas { display: block; }
.pay-status { margin: 12px 0 4px; font-size: 14px; color: var(--ink-2); font-weight: 600; }
.pay-status.ok { color: var(--green); }
.pay-status.err { color: var(--red); }
.warn { background: var(--orange-soft); color: #8a5a1c; border: 1px solid #f2d9b5; border-radius: 9px; padding: 10px 12px; font-size: 12.5px; text-align: left; margin: 12px 0; }
.pay-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 18px 0 6px; }
.pay-note { color: var(--muted); font-size: 12px; margin: 8px 0 0; }

/* 作答页 */
.answer-card { margin-top: 40px; padding: 28px; }
.loading { color: var(--muted); padding: 30px 0; text-align: center; }
.qmeta { color: var(--muted); font-size: 12.5px; margin-bottom: 8px; }
.qmeta b { color: var(--accent-dark); }
.question-box { background: #f6f7fb; border-left: 4px solid var(--accent); border-radius: 8px; padding: 16px 18px; white-space: pre-wrap; word-break: break-word; margin-bottom: 22px; }
.done-icon { width: 52px; height: 52px; margin: 6px auto 12px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 28px; display: grid; place-items: center; }
#done h3 { text-align: center; margin: 0 0 6px; font-size: 19px; }
#done > p { text-align: center; color: var(--muted); font-size: 13.5px; margin: 0 0 18px; }
.answer-preview { background: var(--green-soft); border-radius: 10px; padding: 14px 16px; white-space: pre-wrap; word-break: break-word; color: #206044; margin-bottom: 18px; }
.done-meta { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.done-meta .as-link { margin-top: 0; color: var(--accent); font-weight: 600; }
.done-meta .as-link:hover { text-decoration: underline; }

@media (max-width: 780px) {
  .grid { grid-template-columns: 1fr; }
  .hero { padding: 30px 0 22px; }
  .card { padding: 20px; }
  .topbar-in { height: 58px; }
  .pill { font-size: 11px; padding: 5px 10px; }
}
