/* 票通 × 乐企联用 对接指引 — 零框架，移动优先 */
:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --ink: #17233b;
  --t2: #47536b;
  --t3: #8a94a8;
  --line: #e3e8f1;
  --line-2: #cdd6e4;
  --blue: #2456e6;
  --blue-d: #1a41b0;
  --blue-bg: #eef3ff;
  --teal: #0e9384;
  --teal-bg: #e8f6f4;
  --amber: #b45309;
  --amber-bg: #fff7e8;
  --red: #d2372f;
  --red-bg: #fdeeed;
  --green: #15803d;
  --green-bg: #e9f7ee;
  --code-bg: #f0f3f9;
  --dark: #101827;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(23, 35, 59, .06), 0 6px 20px rgba(23, 35, 59, .05);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); line-height: 1.7; font-size: 15px; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
code { font-family: var(--mono); font-size: .86em; background: var(--code-bg); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; word-break: break-all; }
b { font-weight: 600; }
h3 { margin: 34px 0 12px; font-size: 18px; }
h4 { margin: 22px 0 10px; font-size: 15.5px; }
.h3-side { font-size: 12px; font-weight: 400; color: var(--t3); margin-left: 10px; }

/* ── Hero ── */
.hero { background: linear-gradient(135deg, #12275e 0%, #1a41b0 55%, #2456e6 100%); color: #fff; padding: 44px 0 34px; }
.hero-tag { font-size: 12.5px; letter-spacing: .18em; opacity: .82; margin-bottom: 10px; }
.hero h1 { font-size: 30px; line-height: 1.25; }
.hero-x { display: block; font-size: 20px; font-weight: 500; opacity: .92; margin-top: 4px; }
.hero-sub { margin-top: 14px; max-width: 640px; font-size: 14.5px; opacity: .94; }
.hero-sub b { color: #ffd77a; font-weight: 600; }
.hero-meta { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; }
.hero-meta span { font-size: 11.5px; background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.22); border-radius: 999px; padding: 3px 10px; }

/* ── 吸顶导航 ── */
.topnav { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.nav-scroll { display: flex; gap: 6px; overflow-x: auto; padding: 8px 16px; scrollbar-width: none; }
.nav-scroll::-webkit-scrollbar { display: none; }
.nav-chip { flex: 0 0 auto; font-size: 13px; color: var(--t2); text-decoration: none; padding: 6px 13px; border-radius: 999px; border: 1px solid transparent; }
.nav-chip.active { background: var(--blue-bg); color: var(--blue); border-color: #c6d6ff; font-weight: 600; }

/* ── 章节 ── */
.sec { padding: 38px 0 8px; scroll-margin-top: 64px; }
.sec h2 { font-size: 23px; display: flex; align-items: center; gap: 10px; }
.sec-no { font-family: var(--mono); font-size: 13px; color: var(--blue); background: var(--blue-bg); border-radius: 8px; padding: 3px 8px; }
.sec-lead { color: var(--t2); margin: 10px 0 18px; max-width: 720px; }
.badge { font-size: 12px; color: var(--t3); font-weight: 400; }

/* ── 表格 ── */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; min-width: 560px; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: #f8fafd; font-size: 12.5px; color: var(--t2); white-space: nowrap; position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: none; }

/* ── 通道卡片 ── */
.chan-grid { display: grid; gap: 12px; margin: 16px 0; }
.chan-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.chan-card.hot { border-color: #b8cbff; background: linear-gradient(180deg, #f6f9ff, #fff); }
.chan-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 15.5px; }
.chan-code { font-family: var(--mono); font-weight: 700; font-size: 14px; border-radius: 8px; padding: 2px 9px; }
.chan-code.c0 { background: #f1f2f6; color: var(--t2); }
.chan-code.c1 { background: var(--teal-bg); color: var(--teal); }
.chan-code.c4 { background: var(--blue-bg); color: var(--blue); }
.chan-card ul { list-style: none; }
.chan-card li { padding-left: 16px; position: relative; font-size: 13.5px; color: var(--t2); margin: 4px 0; }
.chan-card li::before { content: "·"; position: absolute; left: 4px; color: var(--blue); font-weight: 700; }

/* ── 三步卡 ── */
.step3 { display: grid; gap: 10px; margin: 14px 0; }
.step3-item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.step3-no { color: var(--blue); font-weight: 700; margin-right: 6px; }
.step3-item p { font-size: 13px; color: var(--t2); margin-top: 4px; }

/* ── 折叠 ── */
.fold { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin: 14px 0; box-shadow: var(--shadow); }
.fold > summary { cursor: pointer; padding: 13px 16px; font-weight: 600; font-size: 14px; list-style: none; }
.fold > summary::before { content: "▸"; color: var(--blue); margin-right: 8px; transition: .15s; display: inline-block; }
.fold[open] > summary::before { transform: rotate(90deg); }
.fold-body { padding: 2px 16px 16px; font-size: 13.5px; color: var(--t2); }
.fold-body > p { margin: 10px 0; }
.env-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; flex-wrap: wrap; }
.env-tag { font-size: 11px; border-radius: 6px; padding: 2px 8px; font-weight: 600; flex: 0 0 auto; }
.env-tag.test { background: var(--amber-bg); color: var(--amber); }
.env-tag.prod { background: var(--green-bg); color: var(--green); }

/* ── 分段切换 ── */
.seg { display: inline-flex; background: #e9edf5; border-radius: 12px; padding: 4px; margin: 6px 0 4px; }
.seg-btn { border: 0; background: transparent; font-family: inherit; font-size: 14px; padding: 8px 18px; border-radius: 9px; color: var(--t2); cursor: pointer; font-weight: 600; }
.seg-btn.active { background: var(--card); color: var(--blue); box-shadow: 0 1px 4px rgba(23,35,59,.12); }

/* ── 前置条件 ── */
.pre-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.pre-list { list-style: none; }
.pre-list li { padding: 7px 0 7px 26px; position: relative; font-size: 13.5px; color: var(--t2); border-bottom: 1px dashed var(--line); }
.pre-list li:last-child { border-bottom: none; }
.pre-list li::before { content: "✓"; position: absolute; left: 2px; color: var(--teal); font-weight: 700; }

/* ── 选项卡 ── */
.tabs { margin: 12px 0; }
.tab-bar { display: flex; gap: 6px; border-bottom: 2px solid var(--line); overflow-x: auto; }
.tab-btn { border: 0; background: transparent; font-family: inherit; font-size: 14px; padding: 9px 14px; color: var(--t2); cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -2px; font-weight: 600; }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-panel { padding: 14px 0; }
.hint { font-size: 13px; color: var(--t3); margin-bottom: 12px; }

/* ── 手工步骤 ── */
.man-steps { list-style: none; counter-reset: mstep; }
.man-steps li { counter-increment: mstep; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 16px 13px 52px; margin: 10px 0; position: relative; font-size: 13.5px; color: var(--t2); box-shadow: var(--shadow); }
.man-steps li b { color: var(--ink); font-size: 14px; }
.man-steps li::before { content: counter(mstep); position: absolute; left: 14px; top: 13px; width: 26px; height: 26px; border-radius: 50%; background: var(--blue); color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }

/* ── 状态机 ── */
.flow { display: flex; gap: 8px; overflow-x: auto; padding: 12px 2px 14px; scrollbar-width: thin; }
.flow-step { flex: 0 0 auto; width: 138px; background: var(--card); border: 1.5px solid var(--line-2); border-radius: 12px; padding: 10px 10px 8px; cursor: pointer; position: relative; transition: .15s; }
.flow-step:hover { border-color: var(--blue); }
.flow-step.sel { border-color: var(--blue); background: var(--blue-bg); }
.flow-step.final { border-color: var(--green); background: var(--green-bg); }
.fs-idx { font-size: 10.5px; color: var(--t3); font-family: var(--mono); }
.fs-code { font-family: var(--mono); font-size: 10.5px; color: var(--blue); word-break: break-all; line-height: 1.35; display: block; margin: 2px 0; font-weight: 600; }
.flow-step.final .fs-code { color: var(--green); }
.fs-desc { font-size: 12px; color: var(--t2); line-height: 1.4; }
.fs-actor { display: inline-block; margin-top: 5px; font-size: 10.5px; border-radius: 5px; padding: 1px 6px; background: #f1f2f6; color: var(--t2); }
.flow-step::after { content: "→"; position: absolute; right: -9px; top: 42%; color: var(--line-2); font-weight: 700; z-index: 1; }
.flow-step:last-child::after { content: ""; }
.state-detail { background: var(--dark); color: #dfe6f3; border-radius: var(--radius); padding: 14px 16px; font-size: 13.5px; margin: 4px 0 10px; }
.state-detail .sd-code { font-family: var(--mono); color: #8db4ff; font-weight: 700; }
.state-detail .sd-actor { display: inline-block; background: rgba(141,180,255,.16); color: #a9c6ff; border-radius: 6px; padding: 1px 8px; font-size: 11.5px; margin-left: 8px; }
.state-detail p { margin-top: 6px; }
.fail-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0; }
.fail-chip { border: 1px solid #f0c9c6; background: var(--red-bg); color: var(--red); font-family: var(--mono); font-size: 11px; border-radius: 999px; padding: 4px 10px; cursor: pointer; }
.fail-chip:hover { background: #fadfdd; }

/* ── FAQ ── */
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin: 8px 0; box-shadow: var(--shadow); }
.faq summary { cursor: pointer; padding: 12px 15px; font-size: 14px; font-weight: 600; list-style: none; }
.faq summary::before { content: "Q"; color: var(--blue); font-weight: 800; margin-right: 9px; }
.faq details p { padding: 0 15px 13px 36px; font-size: 13.5px; color: var(--t2); }

/* ── 提示块 ── */
.callout { border-radius: var(--radius); padding: 14px 16px; margin: 16px 0; font-size: 13.5px; }
.callout ul { margin: 6px 0 0 18px; }
.callout p { margin-top: 5px; }
.callout.warn { background: var(--amber-bg); border: 1px solid #f3ddb0; color: #6b4a10; }
.callout.warn code { background: #fff; }
.callout.tip { background: var(--teal-bg); border: 1px solid #bfe5e0; color: #0b5c52; }
.callout.tip code { background: #fff; }
.note { font-size: 12.5px; color: var(--t3); margin: 10px 0; }

/* ── 决策器 ── */
.router { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.router-form { padding: 14px 16px; display: grid; gap: 12px; }
.rf-row label:first-child { display: block; font-size: 12.5px; color: var(--t3); margin-bottom: 4px; }
.rf-row select { width: 100%; font-family: inherit; font-size: 14px; padding: 9px 10px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; color: var(--ink); }
.rf-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.rf-checks label { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--t2); }
.rf-checks input { width: 16px; height: 16px; accent-color: var(--blue); }
.router-result { border-top: 1px dashed var(--line-2); padding: 14px 16px; background: #fafbfe; }
.rr-badge { display: inline-block; font-weight: 700; font-size: 14px; border-radius: 9px; padding: 4px 12px; margin-bottom: 6px; }
.rr-badge.rpa { background: #f1f2f6; color: var(--t2); }
.rr-badge.self { background: var(--teal-bg); color: var(--teal); }
.rr-badge.union { background: var(--blue-bg); color: var(--blue); }
.rr-badge.err { background: var(--red-bg); color: var(--red); }
.router-result p { font-size: 13px; color: var(--t2); margin-top: 3px; }
.rr-warns { margin-top: 8px; }
.rr-warns li { list-style: none; font-size: 12.5px; color: var(--amber); background: var(--amber-bg); border-radius: 8px; padding: 5px 10px; margin: 5px 0; }

/* ── 规则卡 ── */
.rule-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 14px 0; }
.rule-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; font-size: 13px; box-shadow: var(--shadow); }
.rule-card p { color: var(--t2); font-size: 12.5px; margin-top: 3px; }
.pay-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 7px; }
.pay-item { font-size: 12.5px; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 6px 9px; color: var(--t2); }
.pay-item code { background: var(--blue-bg); border: none; color: var(--blue); font-weight: 700; margin-right: 5px; }

/* ── 代码示例 ── */
.ex-grid { display: grid; gap: 12px; margin: 12px 0; }
.code-card { background: var(--dark); border-radius: var(--radius); overflow: hidden; }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 9px 14px; color: #aab6cc; font-size: 12px; border-bottom: 1px solid rgba(255,255,255,.08); }
.copy-btn { border: 1px solid rgba(255,255,255,.22); background: transparent; color: #cfd9ea; font-size: 12px; border-radius: 7px; padding: 3px 10px; cursor: pointer; font-family: inherit; }
.copy-btn:hover { background: rgba(255,255,255,.09); }
.copy-btn.ok { color: #7be3a2; border-color: #3f7f58; }
.code-card pre { padding: 12px 14px; overflow-x: auto; }
.code-card code { background: none; border: none; color: #dfe6f3; font-size: 12px; line-height: 1.6; padding: 0; }

/* ── 扫码流程 ── */
.qr-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; font-size: 12.5px; color: var(--t2); box-shadow: var(--shadow); margin-bottom: 12px; }
.qr-flow > span:not(.arr) { background: var(--blue-bg); border-radius: 8px; padding: 4px 10px; }
.qr-flow .arr { color: var(--t3); background: none; padding: 0; }
.diff-list { list-style: none; margin: 10px 0; }
.diff-list li { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 13px; margin: 7px 0; font-size: 13.5px; color: var(--t2); }

/* ── 红冲路径 ── */
.red-paths { display: grid; gap: 10px; margin: 12px 0; }
.red-path { border-radius: 12px; padding: 11px 14px; font-size: 13px; }
.red-path p { margin-top: 2px; }
.red-path.ok { background: var(--green-bg); border: 1px solid #c4e6cf; color: #135c30; }
.red-path.wait { background: var(--amber-bg); border: 1px solid #f3ddb0; color: #6b4a10; }
.red-path.fail { background: var(--red-bg); border: 1px solid #f0c9c6; color: #8f2721; }

/* ── 错误速查 ── */
.err-tools { position: sticky; top: 46px; z-index: 30; background: var(--bg); padding: 6px 0 10px; }
#err-q { width: 100%; font-family: inherit; font-size: 14.5px; padding: 12px 15px; border: 1.5px solid var(--line-2); border-radius: 12px; background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
#err-q:focus { outline: none; border-color: var(--blue); }
.err-cats { display: flex; gap: 6px; overflow-x: auto; margin-top: 8px; scrollbar-width: none; }
.err-cats::-webkit-scrollbar { display: none; }
.cat-chip { flex: 0 0 auto; border: 1px solid var(--line-2); background: var(--card); color: var(--t2); font-size: 12.5px; border-radius: 999px; padding: 5px 13px; cursor: pointer; font-family: inherit; }
.cat-chip.active { background: var(--dark); color: #fff; border-color: var(--dark); }
.err-list { display: grid; gap: 8px; margin-top: 6px; }
.err-item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; box-shadow: var(--shadow); }
.err-line1 { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.err-code { font-family: var(--mono); font-weight: 700; font-size: 13px; color: var(--red); }
.err-cat { font-size: 10.5px; border-radius: 5px; padding: 1px 7px; flex: 0 0 auto; }
.err-cat.tencent { background: var(--green-bg); color: var(--green); }
.err-cat.alipay { background: var(--blue-bg); color: var(--blue); }
.err-cat.invoice { background: #efe9ff; color: #6d3ff0; }
.err-cat.common { background: #f1f2f6; color: var(--t2); }
.err-cat.state { background: var(--amber-bg); color: var(--amber); }
.err-msg { font-size: 13.5px; margin-top: 2px; }
.err-fix { font-size: 13px; color: var(--t2); margin-top: 5px; padding-left: 20px; position: relative; }
.err-fix::before { content: "↳"; position: absolute; left: 4px; color: var(--teal); font-weight: 700; }
.err-empty { text-align: center; color: var(--t3); font-size: 13.5px; padding: 26px 0; }
mark { background: #ffe89b; border-radius: 3px; padding: 0 1px; }

/* ── 检查单 ── */
.ck-actions { margin-bottom: 10px; }
.btn-ghost { border: 1px solid var(--line-2); background: var(--card); color: var(--t2); font-size: 13px; border-radius: 9px; padding: 6px 14px; cursor: pointer; font-family: inherit; }
.ck-group { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin: 10px 0; box-shadow: var(--shadow); overflow: hidden; }
.ck-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 15px; font-weight: 600; font-size: 14.5px; cursor: pointer; }
.ck-bar { height: 4px; background: var(--line); }
.ck-bar i { display: block; height: 100%; background: var(--teal); width: 0; transition: width .25s; }
.ck-count { font-size: 12px; color: var(--t3); font-weight: 400; }
.ck-items { padding: 4px 15px 10px; }
.ck-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; color: var(--t2); cursor: pointer; }
.ck-item:last-child { border-bottom: none; }
.ck-item input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--teal); flex: 0 0 auto; }
.ck-item.done { color: var(--t3); text-decoration: line-through; }

/* ── 报文验证台 ── */
.sb-form { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); display: grid; gap: 12px; }
.sb-form select { width: 100%; font-family: inherit; font-size: 14px; padding: 9px 10px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; color: var(--ink); }
.sb-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#sb-json { width: 100%; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; padding: 12px; border: 1.5px solid var(--line-2); border-radius: 12px; background: #fbfcfe; color: var(--ink); resize: vertical; }
#sb-json:focus { outline: none; border-color: var(--blue); }
#sb-json:disabled { background: #f1f2f6; color: var(--t3); }
.sb-send { border: 0; background: var(--blue); color: #fff; font-family: inherit; font-size: 15px; font-weight: 600; padding: 12px 18px; border-radius: 12px; cursor: pointer; }
.sb-send:disabled { background: var(--line-2); cursor: not-allowed; }
.sb-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-top: 12px; box-shadow: var(--shadow); }
.sb-line { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 8px; }
.sb-badge { font-size: 12px; font-weight: 600; border-radius: 8px; padding: 4px 10px; }
.sb-badge.ok { background: var(--green-bg); color: var(--green); }
.sb-badge.bad { background: var(--red-bg); color: var(--red); }
.sb-badge.none { background: #f1f2f6; color: var(--t2); }
.sb-msg { font-size: 13.5px; color: var(--t2); margin: 6px 0; }
.sb-sub { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; margin: 10px 0 6px; }
.sb-sub .copy-btn { border-color: var(--line-2); color: var(--t2); }
.sb-pre { background: var(--dark); color: #dfe6f3; border-radius: 12px; padding: 12px 14px; font-family: var(--mono); font-size: 12px; line-height: 1.6; overflow-x: auto; white-space: pre; }

/* ── 页脚 ── */
.foot { border-top: 1px solid var(--line); margin-top: 44px; padding: 22px 0 90px; font-size: 12px; color: var(--t3); }
.foot p { margin: 5px 0; }

/* ── AI 助手 ── */
.ai-fab { position: fixed; right: 16px; bottom: 18px; z-index: 90; border: 0; background: var(--blue); color: #fff; border-radius: 999px; padding: 11px 18px; font-size: 15px; font-family: inherit; font-weight: 600; cursor: pointer; box-shadow: 0 6px 22px rgba(36,86,230,.42); display: flex; align-items: center; gap: 7px; }
.ai-fab:active { transform: scale(.97); }
.ai-mask { position: fixed; inset: 0; background: rgba(16,24,39,.45); z-index: 95; }
.ai-panel { position: fixed; z-index: 100; background: var(--card); display: flex; flex-direction: column; left: 0; right: 0; bottom: 0; top: 12%; border-radius: 18px 18px 0 0; box-shadow: 0 -8px 40px rgba(16,24,39,.25); }
.ai-head { display: flex; align-items: center; gap: 9px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.ai-head b { font-size: 15px; }
.ai-sub { font-size: 11px; color: var(--t3); flex: 1; }
.ai-close { border: 0; background: #f1f2f6; color: var(--t2); width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 14px; }
.ai-msgs { flex: 1; overflow-y: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; border-radius: 14px; padding: 9px 13px; font-size: 13.8px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.msg.bot { background: #f2f5fb; color: var(--ink); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.user { background: var(--blue); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.err { background: var(--red-bg); color: var(--red); align-self: flex-start; }
.msg.bot code { background: #fff; }
.msg.bot .mchunk { display: inline; }
.msg .cursor { display: inline-block; width: 7px; height: 15px; background: var(--blue); vertical-align: text-bottom; animation: blink .8s infinite; border-radius: 2px; }
@keyframes blink { 50% { opacity: .15; } }
.ai-presets { display: flex; gap: 6px; overflow-x: auto; padding: 8px 14px; scrollbar-width: none; flex: 0 0 auto; }
.ai-presets::-webkit-scrollbar { display: none; }
.preset-chip { flex: 0 0 auto; border: 1px solid var(--line-2); background: #fff; color: var(--blue); font-size: 12.5px; border-radius: 999px; padding: 6px 12px; cursor: pointer; font-family: inherit; }
.ai-inputbar { display: flex; gap: 8px; padding: 8px 14px; border-top: 1px solid var(--line); align-items: flex-end; }
#ai-input { flex: 1; font-family: inherit; font-size: 14px; padding: 10px 13px; border: 1.5px solid var(--line-2); border-radius: 13px; resize: none; max-height: 110px; line-height: 1.5; color: var(--ink); }
#ai-input:focus { outline: none; border-color: var(--blue); }
#ai-send { border: 0; background: var(--blue); color: #fff; width: 42px; height: 42px; border-radius: 12px; font-size: 17px; cursor: pointer; flex: 0 0 auto; }
#ai-send:disabled { background: var(--line-2); cursor: not-allowed; }
.ai-disc { text-align: center; font-size: 10.5px; color: var(--t3); padding: 5px 0 9px; }

/* ── 桌面端 ── */
@media (min-width: 720px) {
  body { font-size: 15.5px; }
  .hero h1 { font-size: 40px; }
  .hero-x { display: inline; font-size: 40px; margin-left: 8px; }
  .chan-grid { grid-template-columns: 1fr 1fr 1.2fr; }
  .step3 { grid-template-columns: repeat(3, 1fr); }
  .red-paths { grid-template-columns: repeat(3, 1fr); }
  .router-form { grid-template-columns: 1fr 1fr; }
  .rf-row:last-child { grid-column: 1 / -1; }
  .ex-grid { grid-template-columns: 1fr 1fr; }
  .ai-panel { left: auto; right: 22px; bottom: 22px; top: auto; height: min(680px, 86vh); width: 420px; border-radius: 18px; }
  .ai-mask { background: transparent; pointer-events: none; }
}
