:root {
  --bg: #f7f2ed;
  --bg-2: #f1e9e3;
  --surface: #fffcf9;
  --surface-2: #faf5f1;
  --ink: #2d2433;
  --ink-2: #4b4052;
  --muted: #877b8c;
  --line: #ebe1da;
  --accent: #8d67ad;
  --accent-ink: #ffffff;
  --accent-soft: #f1e8f7;
  --rose: #d9889a;
  --rose-soft: #fbecef;
  --ok: #4f9a7a;
  --danger: #c4566a;
  --bubble-user: linear-gradient(135deg, #9a73bb, #c98aa9);
  --shadow: 0 1px 2px rgba(60, 40, 70, .05), 0 8px 28px rgba(60, 40, 70, .07);
  --shadow-lg: 0 20px 60px rgba(50, 30, 60, .18);
  --radius: 20px;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #18141d; --bg-2: #1e1925; --surface: #231e2a; --surface-2: #2a2432;
    --ink: #f2ecf6; --ink-2: #d6cddd; --muted: #a197ab; --line: #372f40;
    --accent: #b896d6; --accent-ink: #1b1520; --accent-soft: #2f2640;
    --rose: #e29aab; --rose-soft: #3a2630; --danger: #e27b8e;
    --bubble-user: linear-gradient(135deg, #7d5b9c, #a8687f);
    --shadow: 0 1px 2px rgba(0,0,0,.25), 0 8px 28px rgba(0,0,0,.25);
    --shadow-lg: 0 20px 60px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  background-image:
    radial-gradient(900px 500px at 100% -10%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%),
    radial-gradient(700px 400px at -10% 110%, color-mix(in srgb, var(--rose) 10%, transparent), transparent 70%);
  background-attachment: fixed;
  color: var(--ink);
  font: 15px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.3; margin: 0; letter-spacing: .01em; }
p { margin: 0; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ---------- 顶部导航 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--serif); font-size: 18px; font-weight: 600; }
.brand-mark { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-size: 19px; background: linear-gradient(135deg, #b58bc9, #e59aa8); box-shadow: 0 4px 12px rgba(181, 139, 201, .35); }
.nav { display: flex; gap: 4px; margin: 0 auto; }
.nav a { display: flex; align-items: center; gap: 7px; padding: 8px 16px; border-radius: 999px; color: var(--ink-2); text-decoration: none; font-size: 14.5px; transition: background .15s, color .15s; }
.nav a:hover { background: var(--surface-2); }
.nav a.active { background: var(--ink); color: var(--bg); }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }

.tabbar { display: none; }

.page { max-width: 1120px; margin: 0 auto; padding: 36px clamp(16px, 4vw, 40px) 80px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 11px 22px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font-weight: 500; font-size: 14.5px;
  text-decoration: none; transition: transform .12s, box-shadow .15s, background .15s, opacity .15s;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 30%, transparent);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.soft { background: var(--accent-soft); color: var(--accent); box-shadow: none; }
.btn.line { background: transparent; color: var(--ink-2); border: 1px solid var(--line); box-shadow: none; }
.btn.line:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger); color: #fff; box-shadow: none; }
.btn.big { padding: 14px 28px; font-size: 16px; }
.btn.full { width: 100%; }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; border: 0; background: transparent; color: var(--ink-2); display: inline-grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.file-label { position: relative; overflow: hidden; }
.file-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- 首页 ---------- */
.hero {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; align-items: center;
  padding: clamp(28px, 5vw, 52px);
  border-radius: 28px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-soft) 90%, var(--surface)), color-mix(in srgb, var(--rose-soft) 80%, var(--surface)));
  border: 1px solid var(--line);
}
.eyebrow { font-size: 12px; letter-spacing: .2em; color: var(--accent); font-weight: 600; text-transform: uppercase; margin-bottom: 10px; }
.hero h1 { font-size: clamp(28px, 4.2vw, 44px); margin-bottom: 12px; }
.hero p { color: var(--ink-2); font-size: 16px; margin-bottom: 26px; max-width: 30em; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-art { position: relative; height: 220px; }
.hero-art .bubble-deco { position: absolute; padding: 12px 16px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); font-size: 14px; color: var(--ink-2); max-width: 230px; animation: float 6s ease-in-out infinite; }
.hero-art .bubble-deco.b1 { top: 6px; left: 0; border-bottom-left-radius: 6px; }
.hero-art .bubble-deco.b2 { top: 86px; right: 0; border-bottom-right-radius: 6px; background: var(--bubble-user); color: #fff; animation-delay: -2s; }
.hero-art .bubble-deco.b3 { bottom: 4px; left: 30px; border-bottom-left-radius: 6px; animation-delay: -4s; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 44px 0 18px; }
.section-head h2 { font-size: 22px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.char-card {
  position: relative; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 12px;
  padding: 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.char-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.char-card h3 { font-size: 18px; }
.char-card .desc { color: var(--muted); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.char-card .go { margin-top: auto; display: flex; align-items: center; justify-content: space-between; color: var(--accent); font-size: 14px; font-weight: 500; }
.char-card .edit { position: absolute; top: 14px; right: 14px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 12px; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.add-card { display: grid; place-items: center; align-content: center; gap: 8px; min-height: 200px; border: 1.5px dashed var(--line); background: transparent; box-shadow: none; color: var(--muted); text-align: center; }
.add-card:hover { color: var(--accent); background: var(--surface); }
.add-card .icon { width: 26px; height: 26px; }

.avatar { flex: none; width: 52px; height: 52px; border-radius: 17px; display: grid; place-items: center; color: #fff; font-family: var(--serif); font-size: 22px; font-weight: 600; text-shadow: 0 1px 2px rgba(0,0,0,.15); }
.avatar.sm { width: 36px; height: 36px; border-radius: 12px; font-size: 16px; }
.avatar.xs { width: 30px; height: 30px; border-radius: 10px; font-size: 14px; }
.g0 { background: linear-gradient(135deg, #a98bd1, #e3a0b7); }
.g1 { background: linear-gradient(135deg, #6fae9b, #a9cf9c); }
.g2 { background: linear-gradient(135deg, #e3a56f, #e78f9b); }
.g3 { background: linear-gradient(135deg, #6f8fd0, #a38bd6); }
.g4 { background: linear-gradient(135deg, #c27ba0, #e7b38f); }
.g5 { background: linear-gradient(135deg, #5e9bb5, #8fcfc4); }

.note { margin-top: 48px; padding: 16px 20px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 13px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- 聊天 ---------- */
.chat-page { display: grid; grid-template-columns: 280px 1fr; height: calc(100dvh - 67px); max-width: 1280px; margin: 0 auto; }
.chat-side { border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.chat-side .btn { margin-bottom: 12px; }
.side-title { font-size: 12px; color: var(--muted); letter-spacing: .1em; margin: 8px 8px 4px; }
.session { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px; border-radius: 14px; border: 0; background: transparent; cursor: pointer; }
.session:hover { background: var(--surface-2); }
.session.active { background: var(--surface); box-shadow: var(--shadow); }
.session .meta { min-width: 0; flex: 1; }
.session b { display: flex; justify-content: space-between; font-weight: 500; font-size: 14px; }
.session b small { color: var(--muted); font-weight: 400; font-size: 11.5px; }
.session span { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.chat-head h2 { font-size: 17px; }
.chat-head .who { flex: 1; min-width: 0; }
.model-chip { display: flex; align-items: center; gap: 6px; max-width: 100%; font-size: 12.5px; color: var(--muted); background: none; border: 0; padding: 0; cursor: pointer; white-space: nowrap; }
.model-chip .txt { overflow: hidden; text-overflow: ellipsis; }
.model-chip:hover { color: var(--accent); }
.mobile-only { display: none; }

.messages { flex: 1; overflow-y: auto; padding: 28px clamp(16px, 4vw, 48px) 12px; display: flex; flex-direction: column; gap: 18px; scroll-behavior: smooth; }
.msg { display: flex; gap: 12px; max-width: 760px; width: 100%; }
.msg.user { flex-direction: row-reverse; margin-left: auto; }
.msg .body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.msg.user .body { align-items: flex-end; }
.bubble { padding: 12px 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); white-space: pre-wrap; word-break: break-word; font-size: 15.5px; line-height: 1.85; }
.msg:not(.user) .bubble { border-top-left-radius: 6px; }
.msg.user .bubble { background: var(--bubble-user); color: #fff; border: 0; border-top-right-radius: 6px; }
.bubble em { font-style: normal; color: var(--muted); }
.msg.user .bubble em { color: rgba(255,255,255,.8); }
.bubble.typing::after { content: "▍"; color: var(--accent); animation: blink 1s steps(2) infinite; margin-left: 2px; }
.dots { display: inline-flex; gap: 4px; padding: 4px 0; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: bounce 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 50% { opacity: 0; } }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
.msg-actions { display: flex; gap: 2px; }
.msg-actions button { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--muted); font-size: 12.5px; padding: 4px 8px; border-radius: 8px; cursor: pointer; }
.msg-actions button:hover { background: var(--surface-2); color: var(--accent); }
.msg-actions .icon { width: 14px; height: 14px; }

.composer { padding: 10px clamp(12px, 4vw, 48px) 18px; }
.composer form { max-width: 760px; margin: 0 auto; display: flex; align-items: flex-end; gap: 10px; padding: 8px 8px 8px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); transition: border-color .15s; }
.composer form:focus-within { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.composer textarea { flex: 1; border: 0; background: none; resize: none; outline: none; padding: 9px 0; max-height: 180px; line-height: 1.6; font-size: 15.5px; }
.composer .btn { width: 44px; height: 44px; padding: 0; flex: none; }
.composer .hint { max-width: 760px; margin: 8px auto 0; text-align: center; font-size: 12px; color: var(--muted); }
.send-stop { background: var(--ink) !important; color: var(--bg) !important; }

.picker-empty { max-width: 860px; margin: 0 auto; padding: 48px 20px; text-align: center; }
.picker-empty h1 { font-size: 28px; margin-bottom: 8px; }
.picker-empty .grid { margin-top: 28px; text-align: left; }

/* ---------- 商店 / 更多 ---------- */
.page-head { margin-bottom: 28px; }
.page-head h1 { font-size: 32px; margin-bottom: 6px; }
.page-head p { color: var(--muted); }
.seg { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); gap: 2px; margin-bottom: 24px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 7px 16px; border-radius: 999px; cursor: pointer; color: var(--ink-2); font-size: 14px; }
.seg button.active { background: var(--accent); color: var(--accent-ink); }
.product { display: flex; flex-direction: column; gap: 10px; padding: 0; overflow: hidden; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.product .art { height: 150px; display: grid; place-items: center; font-family: var(--serif); font-size: 54px; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.15); }
.product .info { padding: 4px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.product .info p { color: var(--muted); font-size: 14px; flex: 1; }
.product .row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.product .row b { color: var(--ink); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.panel h2 { font-size: 19px; margin-bottom: 10px; }
.panel p + p { margin-top: 10px; }
.panel p { color: var(--ink-2); }
.more-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.more-grid .wide { grid-column: 1 / -1; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.stat-row { display: flex; gap: 24px; margin: 6px 0 4px; }
.stat-row b { font-family: var(--serif); font-size: 26px; display: block; }
.stat-row span { color: var(--muted); font-size: 13px; }
.shop-section + .shop-section { margin-top: 16px; }
.shop-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.shop-heading h2 { margin: 0; }
.shop-heading button, .shop-actions { flex-shrink: 0; }
.shop-list { list-style: none; padding: 0; margin: 0; }
.shop-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.shop-item:last-child { padding-bottom: 0; }
.shop-name { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.shop-name small { display: block; color: var(--muted); font-weight: 400; }
.shop-actions { display: flex; align-items: center; gap: 6px; }
.shop-actions .btn { padding: 6px 10px; }
.shop-error { margin-bottom: 16px; }

/* ---------- 弹窗 ---------- */
.shade { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(30, 20, 35, .42); backdrop-filter: blur(6px); animation: fade .18s ease-out; }
.modal { width: min(480px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--surface); border-radius: 26px; box-shadow: var(--shadow-lg); padding: 28px; position: relative; animation: pop .22s cubic-bezier(.2,.9,.3,1.2); }
.modal.wide { width: min(620px, 100%); }
.modal h1 { font-size: 23px; margin-bottom: 10px; padding-right: 36px; }
.modal > p { color: var(--ink-2); margin-bottom: 14px; }
.modal .x { position: absolute; top: 18px; right: 18px; }
.modal .btn-row { margin-top: 20px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.97); } }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.field small { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.field input, .field select, .field textarea { width: 100%; padding: 11px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 400; outline: none; transition: border-color .15s, background .15s; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); background: var(--surface); }
.field textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
details.more { margin-bottom: 16px; border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; }
details.more summary { cursor: pointer; padding: 12px 0; color: var(--muted); font-size: 14px; }
details.more[open] summary { margin-bottom: 4px; }
.label { font-size: 14px; font-weight: 500; color: var(--ink-2); margin: 0 0 8px; }
.options { display: grid; gap: 8px; margin-bottom: 18px; }
.options.three { grid-template-columns: repeat(3, 1fr); }
.opt { display: flex; align-items: center; gap: 10px; text-align: left; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.opt:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.opt.on { border-color: var(--accent); background: var(--accent-soft); }
.opt b { font-weight: 500; display: block; font-size: 14.5px; }
.opt small { color: var(--muted); font-size: 12.5px; display: block; }
.options.three .opt { justify-content: center; text-align: center; flex-direction: column; gap: 0; padding: 10px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); cursor: pointer; margin: 4px 0 18px; font-size: 14.5px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin-top: 3px; flex: none; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* 入站 */
.gate { text-align: left; }
.gate .brand-mark { width: 52px; height: 52px; border-radius: 16px; font-size: 28px; margin-bottom: 16px; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.fine { font-size: 12.5px; color: var(--muted); margin-top: 14px; text-align: center; }

.pick-list { display: grid; gap: 8px; }
.pick { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; text-align: left; }
.pick:hover { border-color: var(--accent); }
.pick small { display: block; color: var(--muted); font-size: 12.5px; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 80; background: var(--ink); color: var(--bg); padding: 11px 20px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow-lg); max-width: calc(100% - 32px); animation: pop .2s; }

/* ---------- 手机 ---------- */
@media (max-width: 820px) {
  .topbar { padding: 12px 16px; gap: 12px; }
  .nav { display: none; }
  .topbar .status { margin-left: auto; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; justify-content: space-around; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 14px; font-size: 11.5px; color: var(--muted); text-decoration: none; border-radius: 12px; }
  .tabbar a.active { color: var(--accent); }
  .tabbar .icon { width: 22px; height: 22px; }
  .page { padding: 20px 16px 110px; }
  .hero { grid-template-columns: 1fr; padding: 26px 22px; }
  .hero-art { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .char-card { padding: 16px; }
  .char-card .desc { display: none; }
  .chat-page { grid-template-columns: 1fr; height: calc(100dvh - 63px - 64px - env(safe-area-inset-bottom)); }
  .chat-side { display: none; }
  .mobile-only { display: inline-grid; }
  .chat-head { padding: 10px 12px; }
  .messages { padding: 18px 12px 8px; }
  .msg .avatar.sm { display: none; }
  .msg { max-width: 100%; }
  .msg:not(.user) { padding-right: 24px; }
  .msg.user { padding-left: 32px; }
  .composer { padding: 6px 10px 10px; }
  .composer .hint { display: none; }
  .modal { padding: 22px; border-radius: 22px; }
  .shade { align-items: end; padding: 0; }
  .shade .modal { width: 100%; border-bottom-left-radius: 0; border-bottom-right-radius: 0; max-height: 92dvh; }
  .toast { bottom: 90px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* =========================================================
   v0.3：立绘角色卡 / 开场选择 / 手机竖屏优化
   ========================================================= */
html { -webkit-text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
button, a, label, .char-card { touch-action: manipulation; }

/* 立绘角色卡 */
.grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.char-card { padding: 0; gap: 0; overflow: hidden; }
.char-card .cover { position: relative; aspect-ratio: 3 / 4; overflow: hidden; background: var(--surface-2); }
.cover-img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s ease; }
.char-card:hover .cover-img { transform: scale(1.04); }
.cover-fallback { display: grid; place-items: center; color: #fff; font-family: var(--serif); font-size: 72px; }
.cover::after { content: ""; position: absolute; inset: 45% 0 0; background: linear-gradient(transparent, rgba(16, 10, 20, .82)); pointer-events: none; }
.cover-text { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 14px 16px; color: #fff; }
.cover-text h3 { font-size: 22px; text-shadow: 0 2px 10px rgba(0,0,0,.4); margin-bottom: 6px; }
.cover-text .tag { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.22); color: #fff; backdrop-filter: blur(6px); }
.char-card .edit { position: absolute; top: 10px; right: 10px; z-index: 2; background: rgba(20, 12, 24, .35); color: #fff; backdrop-filter: blur(8px); }
.char-card .edit:hover { background: rgba(20, 12, 24, .6); color: #fff; }
.intro { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; line-height: 1.6; }
.intro p { display: flex; gap: 8px; color: var(--ink-2); }
.intro p span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.intro b { flex: none; font-size: 11px; font-weight: 600; line-height: 1; padding: 5px 7px; margin-top: 1px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); height: fit-content; }
.intro p + p b { background: var(--rose-soft); color: var(--rose); }
.scene-count { margin-top: 2px; font-size: 12px; color: var(--muted); }
.add-card { min-height: 260px; }

.avatar-img { object-fit: cover; object-position: 50% 38%; padding: 0; }

/* 首页立绘扇形 */
.hero-art { height: 280px; }
.hero-art .fan { position: absolute; top: 10px; left: 50%; width: 150px; aspect-ratio: 3/4; border-radius: 18px; object-fit: cover; box-shadow: var(--shadow-lg); border: 3px solid var(--surface); transform-origin: 50% 120%; transition: transform .3s; }
.hero-art .f0 { transform: translateX(-50%) rotate(-14deg) translateX(-40px); }
.hero-art .f1 { transform: translateX(-50%) translateY(-6px); z-index: 1; }
.hero-art .f2 { transform: translateX(-50%) rotate(14deg) translateX(40px); }
.hero:hover .f0 { transform: translateX(-50%) rotate(-18deg) translateX(-56px); }
.hero:hover .f2 { transform: translateX(-50%) rotate(18deg) translateX(56px); }

/* 开场选择 */
.scene-hero { position: relative; margin: -28px -28px 18px; height: 210px; overflow: hidden; border-radius: 26px 26px 0 0; }
.scene-hero .cover-img { object-position: 50% 30%; }
.scene-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 30%, rgba(16,10,20,.85)); }
.scene-hero-text { position: absolute; left: 24px; right: 24px; bottom: 18px; z-index: 1; color: #fff; }
.scene-hero-text h1 { font-size: 26px; margin: 0 0 4px; padding: 0; }
.scene-hero-text p { font-size: 13.5px; opacity: .9; }
.modal:has(.scene-hero) .x { z-index: 3; background: rgba(20,12,24,.35); color: #fff; }
.opt.scene { justify-content: space-between; padding: 14px 16px; }
.opt.scene > span { min-width: 0; }
.opt.scene small { margin-top: 2px; line-height: 1.5; }
.opt.scene small.you { color: var(--rose); }
.opt.scene .icon { color: var(--accent); }

/* 商店 */
.product img.art { width: 100%; height: auto; aspect-ratio: 3/4; object-fit: cover; display: block; }
.product .dl { font-size: 12.5px; color: var(--muted); text-align: center; text-decoration: none; }
.product .dl:hover { color: var(--accent); }

/* ---------- 手机竖屏 ---------- */
@media (max-width: 820px) {
  body { font-size: 15.5px; }
  /* iOS 输入框字号小于 16px 会自动放大页面 */
  input, select, textarea, .field input, .field select, .field textarea, .composer textarea { font-size: 16px !important; }
  .topbar { padding: calc(10px + env(safe-area-inset-top)) 16px 10px; }
  .brand { font-size: 17px; }
  .brand-mark { width: 32px; height: 32px; }
  .status { padding: 6px 10px; font-size: 12px; }

  .page { padding: 16px 14px calc(96px + env(safe-area-inset-bottom)); }
  .hero { padding: 22px 20px; border-radius: 22px; }
  .hero h1 { font-size: 26px; }
  .hero p { font-size: 14.5px; margin-bottom: 18px; }
  .hero .btn.big { width: 100%; }
  .section-head { margin: 28px 2px 14px; }
  .section-head h2 { font-size: 19px; }

  .grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .char-card { border-radius: 18px; }
  .char-card:hover { transform: none; }
  .cover-text { padding: 10px 12px; }
  .cover-text h3 { font-size: 18px; margin-bottom: 4px; }
  .cover-text .tags { gap: 4px; }
  .cover-text .tag { font-size: 10.5px; padding: 1px 7px; }
  .cover-text .tag:nth-child(3) { display: none; }
  .char-card .edit { width: 34px; height: 34px; top: 8px; right: 8px; }
  .intro { padding: 10px 12px 12px; font-size: 12.5px; gap: 5px; }
  .intro b { font-size: 10px; padding: 4px 5px; }
  .add-card { min-height: 180px; }

  .tabbar a { min-width: 64px; padding: 6px 10px; }

  /* 聊天：全屏，隐藏顶部和底部导航，像聊天 App 一样 */
  body.in-chat .topbar, body.in-chat .tabbar { display: none; }
  body.in-chat .chat-page { height: 100dvh; }
  .chat-head { padding: calc(8px + env(safe-area-inset-top)) 8px 8px; gap: 8px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); }
  .chat-head .icon-btn { width: 42px; height: 42px; }
  .chat-head h2 { font-size: 16px; }
  .chat-head .avatar { width: 36px; height: 36px; }
  .model-chip { font-size: 11.5px; }
  .messages { padding: 14px 12px 6px; gap: 14px; }
  .bubble { font-size: 16px; line-height: 1.8; padding: 11px 14px; }
  .msg .avatar.sm { display: none; }
  .msg-actions button { padding: 6px 10px; font-size: 13px; }
  .composer { padding: 6px 10px calc(10px + env(safe-area-inset-bottom)); }
  .composer form { padding: 5px 5px 5px 16px; border-radius: 26px; }
  .composer .btn { width: 42px; height: 42px; }

  /* 弹窗：底部抽屉 */
  .shade .modal { padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); }
  .shade .modal::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: -10px auto 14px; }
  .scene-hero { margin: -26px -18px 16px; height: 190px; border-radius: 22px 22px 0 0; }
  .shade .modal:has(.scene-hero)::before { position: absolute; left: 50%; margin-left: -20px; top: 18px; z-index: 3; background: rgba(255,255,255,.6); }
  .options.three .opt { padding: 12px 6px; }
  .btn-row .btn { flex: 1 1 auto; }

  .page-head h1 { font-size: 26px; }
  .seg { width: 100%; justify-content: space-between; }
  .seg button { flex: 1; padding: 8px 6px; }
  .product .info { padding: 4px 12px 14px; }
  .product .info p { font-size: 12.5px; }
  .product .btn { padding: 10px 8px; font-size: 13.5px; }
  .more-grid { grid-template-columns: 1fr; }
  .panel { padding: 20px; }
  .note { margin-top: 28px; }
}
@media (max-width: 360px) {
  .grid { gap: 8px; }
  .intro p:last-of-type { display: none; }
}
@media (hover: none) {
  .btn:hover { transform: none; }
  .char-card:hover .cover-img { transform: none; }
}

/* =========================================================
   v0.4：更简约
   ========================================================= */
.brand-mark { background: var(--accent); box-shadow: none; }
.brand-mark .icon { width: 19px; height: 19px; fill: #fff; stroke: none; }
.gate .brand-mark .icon { width: 28px; height: 28px; }
.hero { display: block; padding: 28px 32px; border-radius: 24px; background: var(--surface); }
.hero h1 { font-size: clamp(24px, 3vw, 32px); margin-bottom: 6px; }
.hero p { font-size: 15px; margin-bottom: 0; color: var(--muted); }
.hero-actions:not(:empty) { margin-top: 18px; }
.hero-actions:empty { display: none; }
.section-head { margin: 32px 0 14px; }
.note { background: transparent; border: 0; padding: 8px 2px; }
body { background-image: none; }
@media (max-width: 820px) {
  .hero { padding: 20px; }
  .hero h1 { font-size: 22px; }
  .hero .btn { width: 100%; }
}

/* =========================================================
   v0.6：Petal · 淡粉色、极简
   ========================================================= */
:root {
  --bg: #fdf7f8; --bg-2: #fbeff2; --surface: #ffffff; --surface-2: #fdf4f6;
  --ink: #3b2a31; --ink-2: #5c4952; --muted: #9b8790; --line: #f3e1e6;
  --accent: #d96a87; --accent-ink: #ffffff; --accent-soft: #fde9ee;
  --rose: #d96a87; --rose-soft: #fdeef2;
  --bubble-user: #fbdde5; --bubble-user-ink: #3b2a31;
  --shadow: 0 1px 2px rgba(120, 60, 80, .04), 0 6px 20px rgba(120, 60, 80, .05);
  --shadow-lg: 0 18px 50px rgba(120, 60, 80, .14);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1518; --bg-2: #221a1e; --surface: #271e23; --surface-2: #2e242a;
    --ink: #f6ecf0; --ink-2: #dccdd3; --muted: #a8949d; --line: #3a2d33;
    --accent: #f0a3b6; --accent-ink: #2a161d; --accent-soft: #3a2730;
    --rose: #f0a3b6; --rose-soft: #3a2630;
    --bubble-user: #4a2f3a; --bubble-user-ink: #f6ecf0;
  }
}
body { background: var(--bg); }

/* 标志：只用文字 */
.brand { font-family: Georgia, "Times New Roman", var(--serif); font-size: 22px; font-weight: 600; letter-spacing: .02em; color: var(--accent); gap: 0; }
.brand-label { margin-inline-start: .6em; color: var(--ink-2); font: 600 12px var(--sans); white-space: nowrap; }

/* 导航：纯文字 */
.nav a { padding: 8px 18px; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.tabbar a { flex-direction: row; font-size: 15px; padding: 12px 18px; }
.tabbar a.active { color: var(--accent); font-weight: 600; }

/* 按钮更平 */
.btn { box-shadow: none; }
.btn:hover { transform: none; filter: brightness(1.04); }

/* 自己的消息：淡粉底 + 深色字，更好读 */
.msg.user .bubble { background: var(--bubble-user); color: var(--bubble-user-ink); }
.msg.user .bubble em { color: var(--muted); }
.bubble { box-shadow: none; }

/* 首页更干净 */
.hero { border: 0; box-shadow: none; background: transparent; padding: 8px 2px 0; }
.char-card { box-shadow: none; }
.char-card:hover { box-shadow: var(--shadow); }
.add-card b { font-size: 15px; font-weight: 500; }
.opt.scene { padding: 14px 16px; }
.composer form { box-shadow: none; }

@media (max-width: 820px) {
  .hero { padding: 4px 2px 0; }
  .tabbar { padding: 4px 8px calc(4px + env(safe-area-inset-bottom)); }
}

/* 没有封面时的占位色：统一粉色系 */
.g0 { background: linear-gradient(135deg, #f4b6c4, #e8899f); }
.g1 { background: linear-gradient(135deg, #f7c9c0, #e9a093); }
.g2 { background: linear-gradient(135deg, #e9bcd6, #cf8fb3); }
.g3 { background: linear-gradient(135deg, #f6d3da, #e3a3b2); }
.g4 { background: linear-gradient(135deg, #f1b9b0, #dd8a8e); }
.g5 { background: linear-gradient(135deg, #dcc0e0, #c497bd); }

/* =========================================================
   v0.7：淡粉色背景 + 登录页
   ========================================================= */
:root { --bg: #fdf0ec; --bg-2: #f9e1e8; --surface: #ffffff; --surface-2: #fff6f8; --line: #f4d9e1; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #1c1518; --bg-2: #221a1e; --surface: #271e23; --surface-2: #2e242a; --line: #3a2d33; }
}
.char-card, .add-card { background: var(--surface); }
.add-card { border-color: #efc9d4; }
.hero h1 { color: var(--ink); }

/* 登录 / 注册 */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); }
.auth-card { width: min(420px, 100%); background: var(--surface); border-radius: 26px; padding: 32px 26px 26px; }
.auth .brand { display: block; text-align: center; font-size: 34px; }
.auth-sub { text-align: center; margin: 2px 0 22px; }
.auth-notice { margin-bottom: 20px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); color: var(--ink-2); font-size: 14px; }
.auth-notice p + p { margin-top: 6px; }
.auth-tabs { display: flex; width: 100%; margin-bottom: 20px; }
.auth-tabs button { flex: 1; }
.auth-error { color: var(--danger); min-height: 1.4em; font-size: 14px; margin: 2px 0 10px; }
@media (max-width: 820px) {
  .auth { align-items: start; padding-top: calc(40px + env(safe-area-inset-top)); }
  .auth-card { padding: 28px 20px 22px; }
}
