/* ========== 设计变量：暖白纸感 + 陶土橙，参照 Claude 的配色 ========== */
:root {
  --bg: #FAF9F5;
  --bg-side: #F3F1EA;
  --surface: #FFFFFF;
  --surface-2: #F5F4EF;
  --text: #141413;
  --text-2: #3D3D3A;
  --text-3: #73726C;
  --text-4: #A3A198;
  --border: rgba(31, 30, 29, .12);
  --border-2: rgba(31, 30, 29, .22);
  --hover: rgba(31, 30, 29, .05);
  --active: rgba(31, 30, 29, .085);
  --accent: #D97757;
  --accent-2: #C6613F;
  --accent-soft: rgba(217, 119, 87, .12);
  --accent-text: #B5532F;
  --ok: #4E8A5B;
  --warn: #B7791F;
  --danger: #C0453A;
  --shadow: 0 .25rem 1.25rem rgba(0, 0, 0, .035), 0 0 0 .5px rgba(31, 30, 29, .14);
  --shadow-2: 0 .5rem 2rem rgba(0, 0, 0, .08), 0 0 0 .5px rgba(31, 30, 29, .16);
  --display: "Bricolage", "OPPO Sans", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  --sans: "Bricolage", "OPPO Sans", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  --heavy: 700;
  --z: 1;
  --vh: calc(100vh / var(--z));
  --vw: calc(100vw / var(--z));
  --mono: "Cascadia Mono", Consolas, "Courier New", monospace;
  --side-w: 272px;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #262624;
  --bg-side: #1F1E1D;
  --surface: #30302E;
  --surface-2: #2A2A28;
  --text: #FAF9F5;
  --text-2: #E5E4DF;
  --text-3: #A6A39A;
  --text-4: #75736C;
  --border: rgba(222, 220, 209, .13);
  --border-2: rgba(222, 220, 209, .24);
  --hover: rgba(222, 220, 209, .06);
  --active: rgba(222, 220, 209, .1);
  --accent-soft: rgba(217, 119, 87, .16);
  --accent-text: #E59475;
  --shadow: 0 .25rem 1.25rem rgba(0, 0, 0, .25), 0 0 0 .5px rgba(222, 220, 209, .16);
  --shadow-2: 0 .5rem 2rem rgba(0, 0, 0, .45), 0 0 0 .5px rgba(222, 220, 209, .2);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { zoom: var(--z); }
html, body { margin: 0; }
body { height: var(--vh); }
body {
  background: var(--bg); color: var(--text); font: 14px/1.6 var(--sans);
  display: flex; overflow: hidden; -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: rgba(217, 119, 87, .25); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--border-2); background-clip: padding-box; border: 2px solid transparent; }
.display { font-family: var(--display); }
.muted { color: var(--text-3); }
p, small, li, .desc, .sub, .per { text-wrap: pretty; }
.hide { display: none !important; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ========== 侧栏 ========== */
#side {
  width: var(--side-w); flex: none; background: var(--bg-side); border-right: .5px solid var(--border);
  display: flex; flex-direction: column; height: 100%; transition: margin-left .2s ease;
}
body.side-off #side { margin-left: calc(-1 * var(--side-w)); }
.side-top { display: flex; align-items: center; gap: 10px; padding: 14px 12px 10px 16px; }
.brand { display: flex; align-items: center; gap: 9px; font-family: var(--display); font-size: 17px; font-weight: var(--heavy); letter-spacing: .02em; flex: 1; min-width: 0; cursor: pointer; }
.brand img { width: 26px; height: 26px; border-radius: 7px; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--text-3);
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.new-btn {
  margin: 4px 12px 8px; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0;
  border-radius: 10px; background: transparent; color: var(--text); font-weight: 500; text-align: left;
}
.new-btn .plus { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.new-btn .plus svg { width: 16px; height: 16px; stroke-width: 2.2; }
.new-btn:hover { background: var(--hover); }
.nav { padding: 0 8px; display: flex; flex-direction: column; gap: 1px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 7px 10px; border-radius: 8px; color: var(--text-2); text-decoration: none;
}
.nav a:hover { background: var(--hover); color: var(--text); }
.nav a.on { background: var(--active); color: var(--text); font-weight: 500; }
.nav a .tag { margin-left: auto; font-size: 11px; color: var(--accent-text); background: var(--accent-soft); padding: 0 6px; border-radius: 6px; }
.side-sec { padding: 16px 18px 6px; font-size: 12px; color: var(--text-3); display: flex; align-items: center; }
.side-sec a { margin-left: auto; font-size: 12px; color: var(--text-3); }
.recent { flex: 1; overflow-y: auto; padding: 0 8px 8px; min-height: 60px; }
.recent a {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; color: var(--text-2); text-decoration: none;
  white-space: nowrap; overflow: hidden; font-size: 13.5px;
}
.recent a span { overflow: hidden; text-overflow: ellipsis; }
.recent a:hover { background: var(--hover); color: var(--text); }
.recent a.on { background: var(--active); color: var(--text); }
.recent a svg.i { width: 15px; height: 15px; color: var(--text-4); }
.recent .empty { padding: 6px 10px; color: var(--text-4); font-size: 13px; }

.wallet { margin: 8px 10px 6px; padding: 12px 14px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.wallet .row { display: flex; align-items: center; gap: 8px; }
.wallet .lbl { font-size: 12px; color: var(--text-3); }
.wallet .num { font-family: var(--display); font-size: 22px; font-weight: 700; line-height: 1.2; letter-spacing: .01em; }
.wallet .num small { font-family: var(--sans); font-size: 12px; font-weight: 400; color: var(--text-3); margin-left: 4px; }
.wallet .btn { margin-left: auto; }
.wallet .low { margin-top: 6px; font-size: 12px; color: var(--danger); }
.side-foot { display: flex; align-items: center; gap: 4px; padding: 6px 10px 12px 12px; }
.side-foot .who { flex: 1; display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 8px; min-width: 0; font-size: 13px; color: var(--text-2); cursor: pointer; }
.side-foot .who:hover { background: var(--hover); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--text-2); color: var(--bg); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex: none; }

/* ========== 主区 ========== */
#main { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; position: relative; }
.topbar { height: 52px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 16px; }
.topbar .title { font-size: 14.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .sp { flex: 1; }
#view { flex: 1; min-height: 0; overflow-y: auto; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 8px 32px 64px; }
.wrap.narrow { max-width: 780px; }

/* ========== 按钮/表单 ========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 9px;
  border: .5px solid var(--border-2); background: var(--surface); color: var(--text); font-weight: 500; font-size: 13.5px; white-space: nowrap;
  transition: background .12s, border-color .12s, opacity .12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-2); }
.btn svg.i { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.dark { background: var(--text); color: var(--bg); border-color: transparent; }
.btn.dark:hover { opacity: .88; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { height: 42px; padding: 0 22px; font-size: 15px; border-radius: 11px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn .cost { font-weight: 400; opacity: .8; font-size: 12px; }

.field { margin-bottom: 16px; }
.field > label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.field > label .req { color: var(--accent); }
.field > label .hint { font-weight: 400; color: var(--text-4); font-size: 12px; }
.input, .textarea, .select {
  width: 100%; border: .5px solid var(--border-2); background: var(--surface); border-radius: 10px; padding: 8px 12px; outline: none;
  transition: border-color .12s, box-shadow .12s; font-size: 14px;
}
.textarea { resize: vertical; min-height: 84px; line-height: 1.65; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: var(--text-4); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2373726C' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: .5px solid var(--border-2); background: var(--surface); border-radius: 999px; padding: 4px 12px; font-size: 13px; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 6px; line-height: 1.5;
}
.chip:hover { background: var(--surface-2); color: var(--text); }
.chip.on { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.chip svg.i { width: 15px; height: 15px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; border: .5px solid var(--border); }
.seg button { white-space: nowrap; border: 0; background: transparent; padding: 4px 12px; border-radius: 7px; font-size: 13px; color: var(--text-3); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); font-weight: 500; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 13.5px; }
.switch input { display: none; }
.switch i { width: 34px; height: 20px; border-radius: 10px; background: var(--border-2); position: relative; transition: background .15s; }
.switch i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { left: 16px; }

/* ========== 首页 ========== */
.home { max-width: 760px; margin: 0 auto; padding: calc(var(--vh) * .09) 24px 60px; }
.notice {
  margin: 0 auto 28px; display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 12px; background: var(--accent-soft);
  color: var(--accent-text); font-size: 13.5px; width: fit-content; max-width: 100%; cursor: pointer;
}
.greet { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 30px; }
.greet img { width: 34px; height: 34px; }
.greet h1 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 38px; letter-spacing: .01em; color: var(--text-2); }
.composer {
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); padding: 14px 14px 10px 18px; transition: box-shadow .15s;
}
.composer:focus-within { box-shadow: var(--shadow-2); }
.composer textarea {
  width: 100%; border: 0; outline: none; resize: none; background: transparent; font-size: 15.5px; line-height: 1.6; min-height: 52px; max-height: 260px; padding: 2px 0;
}
.composer textarea::placeholder { color: var(--text-4); }
.composer .bar { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.composer .bar .sp { flex: 1; }
.send {
  width: 34px; height: 34px; border-radius: 9px; border: 0; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center;
}
.send:hover { background: var(--accent-2); }
.send:disabled { opacity: .4; cursor: not-allowed; }
.send svg.i { stroke-width: 2.2; }
.send.stop { background: var(--text); }
.files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.file-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 6px 5px 10px; border-radius: 10px; background: var(--surface-2);
  border: .5px solid var(--border); font-size: 12.5px; max-width: 280px;
}
.file-pill b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-pill small { color: var(--text-3); flex: none; }
.file-pill button { border: 0; background: transparent; color: var(--text-3); padding: 0 2px; display: inline-flex; }
.file-pill button:hover { color: var(--danger); }
.model-pick { position: relative; }
.model-pick > button { border: 0; background: transparent; color: var(--text-3); font-size: 13px; padding: 5px 8px; border-radius: 8px; display: inline-flex; align-items: center; gap: 4px; }
.model-pick > button:hover { background: var(--hover); color: var(--text); }
.menu {
  position: absolute; z-index: 50; min-width: 240px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-2); padding: 6px; bottom: calc(100% + 6px); right: 0;
}
.menu.down { bottom: auto; top: calc(100% + 6px); }
.menu button { display: flex; width: 100%; text-align: left; gap: 10px; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; align-items: flex-start; }
.menu button:hover { background: var(--hover); }
.menu button b { display: block; font-weight: 500; font-size: 13.5px; }
.menu button small { display: block; color: var(--text-3); font-size: 12px; line-height: 1.45; }
.menu button .ck { margin-left: auto; color: var(--accent); width: 16px; }
.modes { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }
.modes .chip { padding: 6px 14px; font-size: 13.5px; }
.home h3 { font-size: 13px; font-weight: 500; color: var(--text-3); margin: 44px 0 12px; display: flex; align-items: center; }
.home h3 a { margin-left: auto; font-weight: 400; }

/* 场景卡片 */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.card {
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 14px 16px; cursor: pointer; transition: box-shadow .15s, transform .15s;
  display: flex; flex-direction: column; gap: 4px; position: relative; min-height: 92px; text-align: left; border: 0;
}
.card:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.card .ic { width: 30px; height: 30px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-text); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.card .ic svg.i { width: 17px; height: 17px; }
.card b { font-size: 14.5px; font-weight: 600; }
.card small { color: var(--text-3); font-size: 12.5px; line-height: 1.5; }
.card .badge { position: absolute; right: 12px; top: 12px; font-size: 11px; padding: 0 7px; border-radius: 6px; background: var(--accent); color: #fff; line-height: 18px; }
.card .badge.soft { background: var(--accent-soft); color: var(--accent-text); }
.card.big { padding: 18px 20px; min-height: 120px; }
.cards.three { grid-template-columns: repeat(3, 1fr); }
.cards.three .card.big { grid-column: 1 / -1; }
.card.big b { font-size: 16px; }

.page-h { display: flex; align-items: flex-end; gap: 16px; margin: 18px 0 22px; }
.page-h h1 { font-family: var(--display); font-weight: var(--heavy); font-size: 30px; margin: 0; letter-spacing: .01em; }
.page-h p { margin: 4px 0 0; color: var(--text-3); }
.page-h .sp { flex: 1; }
.cat-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }

/* ========== 写作页：左表单 右结果 ========== */
.split { display: grid; grid-template-columns: minmax(340px, 400px) 1fr; height: 100%; min-height: 0; }
.split > .form-pane { border-right: .5px solid var(--border); overflow-y: auto; padding: 20px 24px 40px; }
.split > .out-pane { overflow: hidden; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.form-pane h2 { font-family: var(--display); font-weight: var(--heavy); font-size: 24px; margin: 4px 0 4px; }
.form-pane .desc { color: var(--text-3); margin: 0 0 20px; font-size: 13.5px; }
.form-pane .actions { position: sticky; bottom: -40px; padding: 14px 0 16px; background: linear-gradient(transparent, var(--bg) 30%); display: flex; gap: 8px; align-items: center; }
.split.wide-form { grid-template-columns: minmax(360px, 440px) 1fr; }
.example-link { font-size: 12.5px; color: var(--text-3); cursor: pointer; border: 0; background: none; padding: 0; text-decoration: underline dotted; }
.example-link:hover { color: var(--accent-text); }

.out-head { display: flex; align-items: center; gap: 6px; padding: 10px 16px; border-bottom: .5px solid var(--border); flex-wrap: wrap; }
.out-head .t { font-weight: 500; color: var(--text-2); margin-right: auto; display: flex; align-items: center; gap: 8px; }
.out-body { flex: 1; overflow-y: auto; padding: 26px 40px 30px; }
.out-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-4); gap: 10px; text-align: center; padding: 30px; }
.out-empty img { width: 40px; opacity: .55; }
.out-empty .display { font-size: 20px; color: var(--text-3); }
.follow { border-top: .5px solid var(--border); padding: 12px 16px 14px; }
.follow .composer { padding: 8px 8px 8px 14px; border-radius: 14px; display: flex; align-items: flex-end; gap: 8px; }
.follow .composer textarea { min-height: 24px; font-size: 14px; }
.follow .quick { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.follow .quick .chip { font-size: 12.5px; padding: 2px 10px; }
.cost-note { font-size: 12px; color: var(--text-4); display: inline-flex; align-items: center; gap: 4px; }

/* 正文排版：文档感，层级靠「一、（一）」序号，不靠符号 */
.doc { font-family: var(--sans); font-size: 15.5px; line-height: 1.9; color: var(--text); max-width: 760px; margin: 0 auto; word-break: break-word; }
.doc h1 { font-size: 23px; text-align: center; margin: .2em 0 1.1em; font-weight: var(--heavy); line-height: 1.5; }
.doc h2 { font-size: 16.5px; margin: 1.3em 0 .35em; font-weight: 700; }
.doc h3 { font-size: 15.5px; margin: .9em 0 .25em; font-weight: 600; }
.doc p { margin: .35em 0; text-indent: 2em; }
.doc mark { background: var(--accent-soft); color: var(--accent-text); border-radius: 4px; padding: 0 2px; }
.doc table { border-collapse: collapse; margin: .9em 0; width: 100%; font-family: var(--sans); font-size: 13.5px; line-height: 1.6; }
.doc th, .doc td { border: .5px solid var(--border-2); padding: 7px 10px; text-align: left; vertical-align: top; }
.doc th { font-weight: 600; }
.doc pre.fx { font-family: var(--mono); font-size: 13.5px; background: var(--surface-2); border: .5px solid var(--border); border-radius: 8px; padding: 8px 12px; margin: .5em 0; white-space: pre-wrap; text-indent: 0; }
.doc.chat { font-family: var(--sans); font-size: 15px; line-height: 1.8; max-width: none; margin: 0; }
.doc.chat p { text-indent: 0; margin: .45em 0; }
.doc.chat h2 { font-size: 15.5px; margin: 1em 0 .3em; }
.doc.chat h3 { font-size: 15px; margin: .7em 0 .2em; }
.caret::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: 4px; animation: pulse 1s infinite; vertical-align: middle; }
@keyframes pulse { 50% { opacity: .25; transform: scale(.8); } }
.thinking { display: inline-flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 14px; }
.spark { width: 20px; height: 20px; animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .35; transform: scale(.82); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== 对话 ========== */
.chat { display: flex; flex-direction: column; height: 100%; }
.chat .msgs { flex: 1; overflow-y: auto; }
.chat .msgs-in { max-width: 780px; margin: 0 auto; padding: 20px 28px 30px; }
.msg { margin: 18px 0; }
.msg.user { display: flex; justify-content: flex-end; }
/* 宽度上限放在外层：外层宽度本身由文字撑开，气泡再取它的 85% 会让每句话最后一截都折到第二行 */
.msg.user > div { max-width: 85%; min-width: 0; }
.msg.user .bubble { background: var(--surface-2); border: .5px solid var(--border); padding: 10px 16px; border-radius: 16px; white-space: pre-wrap; word-break: break-word; font-size: 15px; }
html[data-theme="dark"] .msg.user .bubble { background: #141413; }
.msg.user .att { font-size: 12px; color: var(--text-3); margin-top: 4px; text-align: right; }
.msg .tools { display: flex; align-items: center; gap: 2px; margin-top: 6px; opacity: 0; transition: opacity .15s; }
.cost-tag { font-size: 12px; color: var(--text-3); margin-left: 8px; white-space: nowrap; }
/* 对话里的代码框：默认收起，点标题展开（几百行代码不再一行一段刷满屏） */
.codebox { border: .5px solid var(--border); border-radius: 12px; background: var(--surface-2); margin: 12px 0; overflow: hidden; }
.codebox > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 12px; font-size: 13px; color: var(--text-2); user-select: none; }
.codebox > summary::-webkit-details-marker { display: none; }
.codebox > summary > .i { width: 15px; height: 15px; transform: rotate(-90deg); transition: transform .15s; }
.codebox[open] > summary > .i { transform: none; }
.codebox > summary .sp { flex: 1; }
.codebox pre { margin: 0; padding: 12px 14px; max-height: 460px; overflow: auto; border-top: .5px solid var(--border); font: 12.5px/1.6 var(--mono); white-space: pre; tab-size: 2; }
.msg:hover .tools, .msg:last-child .tools { opacity: 1; }
.msg .tools .icon-btn { width: 28px; height: 28px; }
.msg .tools .icon-btn svg.i { width: 15px; height: 15px; }
.chat .dock { padding: 0 24px 18px; }
.chat .dock .composer { max-width: 780px; margin: 0 auto; }
.chat .tip { text-align: center; font-size: 11.5px; color: var(--text-4); margin-top: 8px; }

/* ========== PPT ========== */
.ppt-steps { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); }
.ppt-steps b { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.ppt-steps b i { width: 20px; height: 20px; border-radius: 50%; background: var(--surface-2); border: .5px solid var(--border-2); display: inline-flex; align-items: center; justify-content: center; font-style: normal; font-size: 11.5px; }
.ppt-steps b.on { color: var(--text); }
.ppt-steps b.on i { background: var(--accent); border-color: var(--accent); color: #fff; }
.ppt-steps b.done i { background: var(--text-2); border-color: var(--text-2); color: var(--bg); }
.ppt-steps .ln { width: 24px; height: 1px; background: var(--border-2); }
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-item { border: 1.5px solid transparent; border-radius: 10px; padding: 3px; cursor: pointer; background: none; text-align: center; }
.theme-item .thumb { border-radius: 7px; overflow: hidden; box-shadow: 0 0 0 .5px var(--border-2); aspect-ratio: 16/9; position: relative; }
.theme-item small { display: block; font-size: 12px; color: var(--text-3); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.theme-item.on { border-color: var(--accent); }
.theme-item.on small { color: var(--accent-text); font-weight: 500; }
.theme-item:hover .thumb { box-shadow: 0 0 0 .5px var(--border-2), 0 4px 12px rgba(0,0,0,.08); }

.outline { max-width: 820px; margin: 0 auto; padding: 24px 32px 40px; }
.ol-sec { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 12px 16px 10px; margin-bottom: 12px; }
.ol-sec .sh { display: flex; align-items: center; gap: 10px; }
.ol-sec .no { font-family: var(--display); color: var(--accent-text); font-size: 18px; font-weight: var(--heavy); width: 28px; }
.ol-sec input.st { flex: 1; border: 0; background: transparent; font-weight: 600; font-size: 15.5px; outline: none; padding: 4px 6px; border-radius: 6px; }
.ol-sec input:focus { background: var(--surface-2); }
.ol-page { display: flex; align-items: flex-start; gap: 8px; padding: 4px 0 4px 38px; position: relative; }
.ol-page::before { content: ""; position: absolute; left: 44px; top: 15px; width: 5px; height: 5px; border-radius: 50%; background: var(--text-4); }
.ol-page .pt { flex: 1; display: flex; flex-direction: column; padding-left: 14px; }
.ol-page input { border: 0; background: transparent; outline: none; padding: 2px 6px; border-radius: 6px; font-size: 14px; }
.ol-page input.pb { font-size: 12.5px; color: var(--text-3); }
.ol-page input:focus { background: var(--surface-2); }
.ol-page .ops, .ol-sec .ops { opacity: 0; display: flex; gap: 0; transition: opacity .12s; }
.ol-page:hover .ops, .ol-sec .sh:hover .ops { opacity: 1; }
.ol-page .ops .icon-btn, .ol-sec .ops .icon-btn { width: 26px; height: 26px; }
.ol-page .ops svg.i, .ol-sec .ops svg.i { width: 14px; height: 14px; }
.ol-add { border: 0; background: none; color: var(--text-3); font-size: 12.5px; padding: 4px 6px 2px 52px; display: inline-flex; gap: 4px; align-items: center; }
.ol-add:hover { color: var(--accent-text); }
.ol-title { width: 100%; border: 0; background: transparent; font-family: var(--display); font-size: 26px; font-weight: var(--heavy); outline: none; padding: 2px 6px; border-radius: 8px; margin-bottom: 2px; }
.ol-sub { width: 100%; border: 0; background: transparent; color: var(--text-3); outline: none; padding: 2px 6px; border-radius: 6px; font-size: 14.5px; margin-bottom: 18px; }
.ol-title:focus, .ol-sub:focus { background: var(--surface-2); }

.deck { display: grid; grid-template-columns: 196px 1fr 300px; height: 100%; min-height: 0; }
.deck .thumbs { overflow-y: auto; padding: 14px 12px 30px 14px; border-right: .5px solid var(--border); }
.deck .thumbs .th { display: flex; gap: 6px; margin-bottom: 10px; cursor: pointer; }
.deck .thumbs .th > span { font-size: 11.5px; color: var(--text-4); width: 16px; text-align: right; padding-top: 2px; flex: none; }
.deck .thumbs .th .sl { flex: 1; border-radius: 6px; box-shadow: 0 0 0 .5px var(--border-2); overflow: hidden; }
.deck .thumbs .th.on .sl { box-shadow: 0 0 0 2px var(--accent); }
.deck .thumbs .th.wait .sl { aspect-ratio: 16/9; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--text-4); font-size: 11px; }
.deck .stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.deck .stage .canvas { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 22px 28px; overflow: hidden; }
.deck .stage .canvas .sl { width: 100%; max-width: calc((var(--vh) - 230px) * 16 / 9); box-shadow: 0 6px 30px rgba(0,0,0,.12), 0 0 0 .5px var(--border-2); border-radius: 4px; overflow: hidden; }
.deck .notes { border-top: .5px solid var(--border); padding: 10px 20px; max-height: 120px; overflow-y: auto; font-size: 13px; color: var(--text-2); }
.deck .notes b { font-size: 12px; color: var(--text-3); font-weight: 500; margin-right: 6px; }
.deck .panel { border-left: .5px solid var(--border); overflow-y: auto; padding: 16px 16px 30px; }
.deck .panel h4 { margin: 2px 0 10px; font-size: 13px; color: var(--text-3); font-weight: 500; }
.deck .panel .grp { margin-bottom: 22px; }
.slide-form .field { margin-bottom: 10px; }
.slide-form .field > label { font-size: 12px; margin-bottom: 3px; }
.slide-form .textarea { min-height: 60px; font-size: 13px; padding: 6px 10px; }
.slide-form .input { font-size: 13px; padding: 6px 10px; }
.slide-form .sub { border-left: 2px solid var(--border); padding-left: 10px; margin-bottom: 10px; }

/* 幻灯片渲染（HTML 预览） */
.sl { position: relative; aspect-ratio: 16/9; overflow: hidden; container-type: inline-size; background: #fff; font-family: "Microsoft YaHei", "微软雅黑", "PingFang SC", sans-serif; }
.sl > * { position: absolute; }
.sl .tx { display: flex; flex-direction: column; white-space: pre-wrap; word-break: break-word; overflow: hidden; }
.sl .tx p { margin: 0; }
.sl svg { overflow: visible; }

/* ========== 作图 ========== */
.img-layout { display: grid; grid-template-columns: 380px 1fr; height: 100%; min-height: 0; }
.img-layout .form-pane { border-right: .5px solid var(--border); overflow-y: auto; padding: 20px 22px 40px; }
.img-layout .gallery { overflow-y: auto; padding: 20px 26px 40px; }
.presets { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.preset { border: .5px solid var(--border-2); background: var(--surface); border-radius: 10px; padding: 8px 10px; text-align: left; }
.preset b { display: block; font-size: 13px; font-weight: 500; }
.preset small { display: block; font-size: 11.5px; color: var(--text-3); line-height: 1.4; }
.preset.on { border-color: var(--accent); background: var(--accent-soft); }
.preset.on b { color: var(--accent-text); }
.refs { display: flex; gap: 8px; flex-wrap: wrap; }
.ref { width: 64px; height: 64px; border-radius: 9px; overflow: hidden; position: relative; box-shadow: 0 0 0 .5px var(--border-2); }
.ref img { width: 100%; height: 100%; object-fit: cover; }
.ref button { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; line-height: 18px; padding: 0; }
.ref-add { width: 64px; height: 64px; border-radius: 9px; border: 1px dashed var(--border-2); background: transparent; color: var(--text-3); display: inline-flex; align-items: center; justify-content: center; }
.ref-add:hover { border-color: var(--accent); color: var(--accent-text); }
.shots { columns: 3 260px; column-gap: 14px; }
.shot { break-inside: avoid; margin-bottom: 14px; background: var(--surface); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); position: relative; }
.shot img { width: 100%; display: block; cursor: zoom-in; }
.shot .meta { padding: 8px 12px 10px; font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 4px; }
.shot .meta span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shot .meta .icon-btn { width: 28px; height: 28px; }
.shot .meta .icon-btn svg.i { width: 15px; height: 15px; }
.shot.pending { aspect-ratio: var(--ar, 1); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--text-3); font-size: 13px; background: var(--surface-2); }
.shot.pending .bar { width: 60%; height: 3px; border-radius: 3px; background: var(--border); overflow: hidden; }
.shot.pending .bar i { display: block; height: 100%; width: 30%; background: var(--accent); animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }
.shot.err { padding: 18px; color: var(--danger); font-size: 13px; background: var(--surface); }

/* ========== 弹窗 / 提示 ========== */
.mask { position: fixed; inset: 0; background: rgba(20, 20, 19, .32); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--bg); border-radius: 18px; box-shadow: var(--shadow-2); width: 520px; max-width: 100%; max-height: calc(var(--vh) - 48px); overflow-y: auto; padding: 24px 26px 22px; animation: pop .18s ease-out; }
.modal.wide { width: 760px; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.modal h2 { font-family: var(--display); font-weight: var(--heavy); font-size: 22px; margin: 0 0 6px; }
.modal .sub { color: var(--text-3); margin: 0 0 18px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.lightbox { position: fixed; inset: 0; background: rgba(10,10,10,.86); z-index: 120; display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.lightbox img { max-width: calc(var(--vw) * .92); max-height: calc(var(--vh) * .92); border-radius: 6px; box-shadow: 0 10px 50px rgba(0,0,0,.5); }
#toasts { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 10px; font-size: 13.5px; box-shadow: 0 6px 24px rgba(0,0,0,.18); animation: pop .18s; pointer-events: auto; max-width: 560px; }
.toast.err { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

/* 充值 */
.packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; }
.pack { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 18px 18px 16px; position: relative; display: flex; flex-direction: column; gap: 4px; }
.pack.hot { box-shadow: 0 0 0 1.5px var(--accent), var(--shadow); }
.pack .nm { font-size: 13.5px; color: var(--text-2); font-weight: 500; }
.pack .pr { font-family: var(--display); font-size: 30px; font-weight: var(--heavy); }
.pack .pr small { font-size: 14px; font-family: var(--sans); font-weight: 400; margin-right: 2px; }
.pack .cr { color: var(--text-2); }
.pack .bonus { color: var(--accent-text); font-size: 12.5px; }
.pack .per { color: var(--text-4); font-size: 12px; margin-bottom: 10px; }
.pack > .btn { margin-top: auto; }
.pack .cr b { font-size: 16px; color: var(--accent-text); font-weight: 700; }
.shop-h { font-size: 15px; font-weight: 600; margin: 26px 0 12px; display: flex; align-items: baseline; gap: 10px; }
.shop-h small { font-size: 12.5px; font-weight: 400; color: var(--text-3); }
.modal .packs { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.modal.xwide { width: 920px; }
.pack .tag { position: absolute; top: -9px; right: 14px; background: var(--accent); color: #fff; font-size: 11.5px; padding: 1px 9px; border-radius: 7px; }
.price-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.price-table td, .price-table th { padding: 9px 10px; border-bottom: .5px solid var(--border); text-align: left; }
.price-table th { font-weight: 500; color: var(--text-3); font-size: 12.5px; }
.price-table td:last-child, .price-table th:last-child { text-align: right; white-space: nowrap; }
.box { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; }
.box h3 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 10px 14px; align-items: center; }
.kv > label { color: var(--text-3); font-size: 13px; }
.kv > .seg { justify-self: start; }
.steps-list { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps-list li { counter-increment: s; position: relative; padding: 0 0 14px 34px; }
.steps-list li::before { content: counter(s); position: absolute; left: 0; top: 1px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-size: 12px; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.qr { width: 150px; height: 150px; border-radius: 10px; object-fit: cover; box-shadow: 0 0 0 .5px var(--border-2); }

/* 常见问题 */
.faq details { border-bottom: .5px solid var(--border); }
.faq details:last-child { border-bottom: 0; }
.faq summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 12px 2px; cursor: pointer; font-weight: 500; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; margin-left: auto; width: 7px; height: 7px; border-right: 1.5px solid var(--text-3); border-bottom: 1.5px solid var(--text-3); transform: rotate(45deg); transition: transform .15s; margin-right: 4px; }
.faq details[open] summary::after { transform: rotate(-135deg); }
.faq summary:hover { color: var(--accent-text); }
.faq details > div { color: var(--text-3); line-height: 1.8; padding: 0 2px 14px; }

/* 历史 */
.hist-list { display: flex; flex-direction: column; gap: 2px; }
.hist-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; cursor: pointer; }
.hist-item:hover { background: var(--hover); }
.hist-item .ic { width: 34px; height: 34px; border-radius: 9px; background: var(--surface); box-shadow: var(--shadow); display: inline-flex; align-items: center; justify-content: center; color: var(--text-3); flex: none; }
.hist-item b { font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-item small { color: var(--text-4); }
.hist-item .x { margin-left: auto; opacity: 0; }
.hist-item:hover .x { opacity: 1; }

@media (max-width: 1100px) {
  .cards.three { grid-template-columns: repeat(2, 1fr); }
  .deck { grid-template-columns: 150px 1fr 260px; }
  .split, .split.wide-form { grid-template-columns: 340px 1fr; }
}
@media (max-width: 860px) {
  :root { --side-w: 240px; }
  .split, .split.wide-form, .img-layout { grid-template-columns: 1fr; height: auto; }
  .deck { grid-template-columns: 1fr; height: auto; }
  .deck .thumbs { display: flex; gap: 8px; overflow-x: auto; border-right: 0; }
  .deck .thumbs .th { width: 140px; flex: none; }
}
