:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --bg2: #ffffff;
  --bg3: #f0f1f4;
  --line: #e2e4ea;
  --text: #1a1a1a;
  --muted: #6b7280;
  --accent: #7c3aed;
  --accent2: #ec4899;
  --ok: #34d399;
  --err: #f87171;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0,0,0,.1);
  --grad: linear-gradient(135deg, #7c3aed, #ec4899);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* ---------- 顶栏 ---------- */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.logo {
  font-size: 20px; font-weight: 800; cursor: pointer; white-space: nowrap;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
#userbox { display: flex; align-items: center; gap: 10px; font-size: 14px; white-space: nowrap; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; background: rgba(255,255,255,.94); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 0; color: var(--muted); font-size: 11px;
}
.tabbar a span { font-size: 20px; line-height: 1; }
.tabbar a.active { color: var(--accent); }
.tabbar a.active span { transform: scale(1.1); }
main { max-width: 720px; margin: 0 auto; padding: 16px 14px calc(80px + env(safe-area-inset-bottom)); }

/* 聊天全屏时隐藏底部导航 */
body.no-header .tabbar { display: none; }
body.no-header header { display: none; }
body.no-header main { padding: 0; max-width: none; }
body.no-header .chat-wrap { height: 100vh; gap: 0; }
body.no-header .chat-main { border-radius: 0; border: 0; }
body.no-header .chat-drawer { top: 0; height: 100vh; }

/* ---------- 用户菜单 ---------- */
.user-menu { position: relative; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 16px; font-weight: 700;
  border: none; display: flex; align-items: center; justify-content: center;
}
.user-avatar:hover { opacity: .9; }
.user-dropdown {
  position: absolute; right: 0; top: 44px; z-index: 100; min-width: 180px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); overflow: hidden;
}
.user-dropdown .ud-head {
  padding: 10px 14px; font-weight: 700; font-size: 13px; color: var(--muted);
  border-bottom: 1px solid var(--line); background: var(--bg3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-dropdown .ud-item {
  padding: 11px 14px; font-size: 14px; cursor: pointer; display: flex; align-items: center; gap: 8px;
}
.user-dropdown .ud-item:hover { background: var(--bg3); }
.user-dropdown .ud-item.danger { color: var(--err); }

/* ---------- 资料 / 反馈 ---------- */
.profile-item {
  display: flex; justify-content: space-between; padding: 10px 12px;
  background: var(--bg3); border-radius: 10px; margin-bottom: 8px; font-size: 14px;
}
.profile-item .p-label { color: var(--muted); }

/* ---------- 通用 ---------- */
.hidden { display: none !important; }
.btn {
  background: var(--accent); color: #fff; border: none;
  padding: 9px 18px; border-radius: 10px; font-size: 14px; font-weight: 600;
  transition: opacity .15s;
}
.btn:hover { opacity: .9; }
.btn.gray { background: var(--bg3); color: var(--text); }
.btn.danger { background: var(--err); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.muted { color: var(--muted); font-size: 13px; }
.err-text { color: var(--err); font-size: 13px; margin-top: 8px; min-height: 18px; }
.title { font-size: 22px; font-weight: 700; margin-bottom: 18px; }
.tag { color: var(--accent); font-size: 12px; }

/* ---------- 登录 ---------- */
.auth-wrap { max-width: 380px; margin: 10vh auto 0; }
.auth-card {
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow);
}
.auth-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.auth-tabs button {
  flex: 1; background: var(--bg3); color: var(--muted); border: none;
  padding: 9px; border-radius: 10px; font-size: 14px;
}
.auth-tabs button.active { background: var(--accent); color: #fff; }
/* ---------- 输入框统一白底黑字 ---------- */
input, textarea, select {
  background: #fff !important;
  color: #222 !important;
}
input[type="checkbox"], input[type="radio"], input[type="range"] {
  background: initial !important;
  color: initial !important;
}
input::placeholder, textarea::placeholder {
  color: #9aa0ac !important;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent) !important;
}
/* 修复浏览器自动填充导致的白底白字 */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill {
  -webkit-text-fill-color: #222 !important;
  -webkit-box-shadow: 0 0 0 1000px #fff inset !important;
  box-shadow: 0 0 0 1000px #fff inset !important;
  caret-color: #222;
}

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px;
}
.field textarea { resize: vertical; min-height: 80px; }

/* ---------- 探索页 ---------- */
.explore-head { margin-bottom: 16px; }
.explore-head .title { font-size: 26px; font-weight: 800; margin-bottom: 12px; }
.cats { display: flex; gap: 8px; margin-top: 12px; overflow-x: auto; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cat {
  flex-shrink: 0; padding: 7px 16px; border-radius: 999px; font-size: 13px;
  background: var(--bg3); color: var(--text); border: 1px solid var(--line);
}
.cat.on { background: var(--grad); color: #fff; border-color: transparent; font-weight: 600; }

.hot-list { margin-bottom: 18px; }
.hot-title { font-size: 14px; font-weight: 700; color: var(--accent2); margin-bottom: 10px; }
.hot-item {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 12px;
  margin-bottom: 8px; cursor: pointer;
}
.hot-item:hover { border-color: var(--accent); }
.hot-rank {
  width: 24px; text-align: center; font-weight: 800; font-size: 16px;
  color: var(--muted);
}
.hot-item:nth-child(2) .hot-rank { color: #f5b50a; }
.hot-item:nth-child(3) .hot-rank { color: #9aa0ac; }
.hot-item:nth-child(4) .hot-rank { color: #b45309; }
.hot-cover {
  width: 44px; height: 56px; border-radius: 8px; background: var(--bg3);
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0;
}
.hot-info { min-width: 0; }
.hot-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hot-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- 竖版封面卡片 ---------- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.vcard {
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: transform .15s, box-shadow .15s;
}
.vcard:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.vcard-cover {
  position: relative; aspect-ratio: 3/4; background: linear-gradient(160deg, #2a3040, #171a23);
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
}
.vcard-fallback { font-size: 56px; opacity: .85; }
.vcard-type {
  position: absolute; top: 8px; left: 8px; font-size: 11px; padding: 2px 8px;
  border-radius: 999px; background: rgba(0,0,0,.45); color: #fff;
}
.vcard-rating {
  position: absolute; bottom: 8px; right: 8px; font-size: 11px; padding: 2px 8px;
  border-radius: 999px; background: rgba(0,0,0,.5); color: #f5b50a;
}
.vcard-chat {
  position: absolute; left: 8px; bottom: 8px; border: none;
  background: var(--grad); color: #fff; font-size: 12px; font-weight: 600;
  padding: 5px 12px; border-radius: 999px; cursor: pointer;
}
.vcard-chat:hover { opacity: .9; }
.vcard-info { padding: 10px 12px; }
.vcard-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vcard-tag { font-size: 12px; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 我的页 ---------- */
.me-page { }
.me-head {
  display: flex; align-items: center; gap: 14px; padding: 18px 16px;
  background: var(--grad); border-radius: var(--radius); color: #fff;
  margin-bottom: 16px;
}
.me-avatar {
  width: 56px; height: 56px; border-radius: 50%; background: rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 800;
  flex-shrink: 0;
}
.me-info { flex: 1; min-width: 0; }
.me-name { font-size: 18px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-points { font-size: 13px; opacity: .9; margin-top: 4px; }
.me-head .btn { background: #fff; color: var(--accent); border: none; font-weight: 700; }
.me-head .btn:disabled { opacity: .7; }
.me-stats {
  display: flex; background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 16px; padding: 14px 0;
}
.stat { flex: 1; text-align: center; }
.stat b { display: block; font-size: 20px; color: var(--accent); }
.stat span { font-size: 12px; color: var(--muted); }
.me-menu {
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.me-item {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  font-size: 15px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.me-item:last-child { border-bottom: none; }
.me-item:hover { background: var(--bg3); }
.me-item span { font-size: 18px; }
.me-item em { margin-left: auto; color: var(--muted); font-style: normal; }
.me-item.danger { color: var(--err); }

/* ---------- 游戏卡开场界面 ---------- */
.game-page { padding-bottom: 30px; }
.game-tagline {
  background: var(--bg3); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; font-size: 14px; line-height: 1.7; margin-bottom: 18px; color: var(--text);
}
.idn-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.idn-card {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; cursor: pointer; transition: border-color .15s, transform .15s;
}
.idn-card:hover { transform: translateY(-2px); }
.idn-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.idn-avatar {
  width: 48px; height: 48px; border-radius: 12px; background: var(--bg3);
  display: flex; align-items: center; justify-content: center; font-size: 26px; margin-bottom: 8px;
}
.idn-card.on .idn-avatar { background: var(--grad); }
.idn-name { font-size: 15px; font-weight: 700; }
.idn-desc { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.game-start { margin-top: 20px; }
.game-start .btn { width: 100%; padding: 14px; font-size: 16px; }
.btn.pulse { animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .6; } }

/* ---------- 角色卡片 ---------- */
.searchbar {
  display: flex; gap: 10px; margin-bottom: 20px;
}
.searchbar input {
  flex: 1;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 14px;
}
.card {
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 10px; transition: transform .15s, border-color .15s;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card-head { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 46px; height: 46px; border-radius: 12px; background: var(--bg3);
  display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0;
}
.card-name { font-weight: 700; font-size: 15px; }
.card-tag { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-desc {
  font-size: 13px; color: var(--muted); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-actions { display: flex; gap: 8px; margin-top: auto; }
.card-actions .btn { flex: 1; font-size: 13px; padding: 8px; }
.badge-mine { font-size: 11px; color: var(--accent2); border: 1px solid var(--accent2); border-radius: 6px; padding: 1px 6px; }
.badge-game { font-size: 11px; color: #059669; border: 1px solid #059669; border-radius: 6px; padding: 1px 6px; margin-left: 4px; }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-card {
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius);
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; padding: 24px; box-shadow: var(--shadow);
}
.modal-card h3 { margin-bottom: 18px; }

/* ---------- 聊天 ---------- */
.chat-wrap {
  display: flex; gap: 14px;
  height: calc(100vh - 120px);
  --chat-font-size: 15px;
  --bubble-radius: 10px;
  --chat-alpha: 0.55;
  --bubble-bg: #ffffff;
  --bubble-text: #222222;
  --user-bubble-bg: #95ec69;
  --user-bubble-text: #222222;
}
.chat-main {
  flex: 1; min-width: 0;
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; overflow: hidden;
}
/* 顶部工具栏（灰底黑字，紧凑，不随消息滚动） */
.chat-toolbar {
  flex-shrink: 0;
  background: #e8eaed; color: #222;
  padding: 7px 12px; border-bottom: 1px solid #d4d6db;
  display: flex; flex-direction: column; gap: 5px;
}
.toolbar-row1 { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.chat-toolbar .back {
  justify-self: start; font-size: 20px; color: #444; padding: 0 6px; border-radius: 6px;
  text-decoration: none; line-height: 1;
}
.chat-toolbar .back:hover { color: #000; background: #d4d6db; }
.chat-toolbar .t-role { justify-self: center; text-align: center; cursor: pointer; max-width: 60%; }
.chat-toolbar .t-role:hover .rname { color: #111; }
.chat-toolbar .rname { font-weight: 700; font-size: 15px; color: #222; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toolbar-row2 { display: flex; justify-content: center; align-items: center; gap: 8px; }
.chat-toolbar .t-model { display: flex; align-items: center; gap: 6px; }
.chat-toolbar .t-model > span { font-size: 12px; color: #555; white-space: nowrap; }
#chat-model {
  background: #fff; color: #222;
  border: 1px solid #c9ccd2; border-radius: 8px; padding: 5px 10px;
  font-size: 13px; max-width: 300px; width: 300px;
}
#chat-model:focus { outline: none; border-color: var(--accent); }
.icon-btn {
  background: #fff; color: #222; border: 1px solid #c9ccd2;
  border-radius: 8px; width: 30px; height: 30px; font-size: 15px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { border-color: var(--accent); }

/* 微信式对话区 */
.msgs {
  flex: 1; overflow-y: auto; padding: 18px 16px;
  display: flex; flex-direction: column; gap: 16px;
  background: rgba(255,255,255,var(--chat-alpha));
}
.msgs .day-divider {
  align-self: center; background: rgba(0,0,0,.06); color: #555;
  font-size: 12px; padding: 2px 12px; border-radius: 999px;
}
.msg { display: flex; gap: 10px; max-width: 78%; align-items: flex-start; }
.msg .avatar {
  width: 38px; height: 38px; border-radius: 8px; background: var(--bg3);
  display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0;
}
.msg .bubble-col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.msg .bubble {
  background: var(--bubble-bg); color: var(--bubble-text); border: 1px solid var(--bubble-border, #e5e7eb);
  padding: 10px 14px; border-radius: var(--bubble-radius);
  font-size: var(--chat-font-size); line-height: 1.65; white-space: pre-wrap; word-break: break-word;
  border-top-left-radius: 2px;
}
.msg .bubble-time { font-size: 11px; color: var(--muted); padding-left: 2px; }
.hot-word { font-weight: 700; text-shadow: 0 0 6px currentColor; }

/* 游戏消息结构化展示 */
.bubble.gm { width: 100%; max-width: 100%; }
.gm-sug { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.gm-opt {
  text-align: left; background: var(--bg3); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
  font-size: 13px; line-height: 1.6; cursor: pointer;
}
.gm-opt:hover { border-color: var(--accent); background: var(--bg2); }
.gm-fold { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg3); overflow: hidden; }
.gm-fold summary {
  padding: 9px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
  color: var(--accent); list-style: none;
}
.gm-fold summary::before { content: '▸ '; color: var(--muted); }
.gm-fold[open] summary::before { content: '▾ '; }
.gm-fold-body { padding: 0 12px 10px; font-size: 13px; line-height: 1.7; color: var(--text); }
.gm-meta { margin-top: 10px; font-size: 12px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 8px; }
.cost-tip { align-self: center; font-size: 11px; color: var(--muted); background: rgba(0,0,0,.04); padding: 3px 12px; border-radius: 999px; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg.user .bubble { background: var(--user-bubble-bg); color: var(--user-bubble-text); border-color: transparent; border-top-left-radius: var(--bubble-radius); border-top-right-radius: 2px; }
.msg.assistant .bubble { border-top-right-radius: var(--bubble-radius); }
.msg .bubble.typing { color: var(--muted); }
.msg.user .bubble-time { text-align: right; }

.chat-input {
  background: #e8eaed; border-top: 1px solid #d4d6db;
  padding: 6px 10px; display: flex; gap: 8px;
  align-items: flex-end; flex-shrink: 0;
}
.chat-input textarea {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 12px; font-size: 15px;
  line-height: 1.6; resize: none; overflow-y: auto;
  min-height: 36px; max-height: 100px;
}
.chat-input textarea:focus { outline: none; border-color: var(--accent); }
.chat-input .send { height: 36px; padding: 0 18px; font-size: 14px; border-radius: 9px; }

/* 聊天设置抽屉 */
.chat-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 300px; z-index: 90;
  background: var(--bg2); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; box-shadow: -10px 0 30px rgba(0,0,0,.3);
}
.drawer-head {
  padding: 16px 18px; border-bottom: 1px solid var(--line);
  font-size: 15px; font-weight: 700; display: flex; align-items: center; justify-content: space-between;
}
.drawer-body { padding: 18px; overflow-y: auto; }
.set-group { margin-bottom: 20px; }
.set-title { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.set-row {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  background: var(--bg3); border-radius: 10px; margin-bottom: 8px;
  font-size: 14px; cursor: pointer;
}
.set-row input[type="checkbox"] { accent-color: var(--accent); }
.set-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.set-row .set-name { color: var(--muted); font-size: 13px; width: 90px; }
.fs-btn {
  flex: 1; background: var(--bg3); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 0; font-size: 14px; cursor: pointer;
}
.fs-btn.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.empty { color: var(--muted); text-align: center; margin: 40px auto; font-size: 14px; }

/* ---------- 设置 ---------- */
.settings-note { background: var(--bg3); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; font-size: 13px; color: var(--muted); margin-bottom: 18px; line-height: 1.7; }
.provider-card {
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 14px; position: relative;
}
.provider-card.active { border-color: var(--accent); }
.provider-card .p-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.model-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.model-dot.green { background: #34d399; box-shadow: 0 0 6px #34d399; }
.model-dot.yellow { background: #f5b50a; box-shadow: 0 0 6px #f5b50a; }
.model-dot.gray { background: #6b7280; }
.provider-card .p-head .radio { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.provider-card .p-del { margin-left: auto; color: var(--muted); font-size: 14px; }
.provider-card .p-del:hover { color: var(--err); }
.p-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.p-grid .field.full { grid-column: 1 / -1; }

/* ---------- 角色卡片（封面版） ---------- */
.cover-card { padding: 0; overflow: hidden; cursor: pointer; }
.cc-cover {
  height: 150px; background: linear-gradient(135deg, #2a3040, #171a23);
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center; position: relative;
}
.cc-fallback { font-size: 54px; opacity: .85; }
.cc-cover .badge-mine { position: absolute; top: 10px; right: 10px; }
.cc-info { padding: 14px 16px 4px; }
.cc-name { font-weight: 700; font-size: 16px; }
.cc-tag { font-size: 12px; color: var(--muted); margin-top: 3px; }
.cc-stats { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 13px; }
.star-y { color: #f5b50a; letter-spacing: 1px; }

/* ---------- 角色详情页 ---------- */
.rd-page { padding-bottom: 90px; }
.rd-cover {
  height: 220px; border-radius: var(--radius); overflow: hidden; position: relative;
  background: linear-gradient(135deg, #2a3040, #171a23);
  background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center;
}
.rd-cover-fallback { font-size: 90px; opacity: .85; }
.rd-back {
  position: absolute; top: 14px; left: 14px; background: rgba(0,0,0,.45); color: #fff;
  border: none; border-radius: 10px; padding: 8px 14px; font-size: 15px; cursor: pointer;
}
.rd-back:hover { background: rgba(0,0,0,.7); }
.rd-body { max-width: 780px; margin: 0 auto; padding: 20px 4px; }
.rd-head { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.rd-avatar { width: 76px; height: 76px; font-size: 40px; border-radius: 18px; }
.rd-name { font-size: 22px; font-weight: 700; }
.rd-rate { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.rd-rate-big { font-size: 20px; }
.rd-section { margin-bottom: 24px; }
.rd-label { font-size: 13px; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.rd-content {
  background: var(--bg3); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; font-size: 14px; line-height: 1.7; white-space: pre-wrap;
}
/* 底部固定开始对话 */
.rd-bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 52px; z-index: 61;
  background: rgba(255,255,255,.94); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 12px 20px; display: flex; gap: 10px;
  max-width: 100%; justify-content: center;
}
.rd-bottom-bar .btn { max-width: 520px; }
.rd-input-bar input {
  flex: 1; max-width: 520px; min-width: 0; padding: 10px 14px; font-size: 14px;
  background: var(--bg3); border: 1px solid var(--line); border-radius: 20px; color: var(--text);
}
.rd-input-bar input:focus { outline: none; border-color: var(--accent); }
.rd-input-bar .btn { padding: 10px 18px; border-radius: 20px; }
.rd-input-bar .btn.gray { flex-shrink: 0; }

/* ---------- 评论区 ---------- */
.rd-comment-box {
  background: var(--bg3); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; margin-bottom: 18px;
}
.rc-stars { display: flex; align-items: center; gap: 2px; margin-bottom: 10px; }
.rc-stars span[data-v] { font-size: 26px; color: #3a4050; cursor: pointer; transition: transform .1s; }
.rc-stars span[data-v]:hover { transform: scale(1.15); }
.rc-stars span[data-v].on { color: #f5b50a; }
.rc-stars .muted { margin-left: 10px; font-size: 12px; }
.rd-comment-box textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: 14px; resize: vertical; margin-bottom: 10px;
}
.review-item {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 12px;
}
.review-head { display: flex; align-items: center; gap: 10px; font-size: 13px; flex-wrap: wrap; }
.review-head .star-y { font-size: 13px; }
.review-head .badge-mine { font-size: 10px; padding: 0 5px; }
.review-content { margin-top: 8px; font-size: 14px; line-height: 1.7; white-space: pre-wrap; }
.like-btn {
  margin-left: auto; background: var(--bg3); color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer;
}
.like-btn.on { color: #f5b50a; border-color: #f5b50a; }
.like-num { margin-left: auto; font-size: 12px; color: var(--muted); }

/* ---------- 封面选择 ---------- */
.cover-pick { display: flex; gap: 14px; align-items: flex-start; }
.cover-preview {
  width: 140px; height: 84px; border-radius: 10px; border: 1px dashed var(--line);
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center; color: var(--muted);
  font-size: 12px; flex-shrink: 0; background-color: var(--bg);
}
.cover-pick-btns { display: flex; flex-direction: column; gap: 8px; }

/* ---------- 对话存档 ---------- */
.arc-item {
  display: flex; gap: 14px; align-items: center; background: var(--bg2);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px;
}
.arc-avatar {
  width: 46px; height: 46px; border-radius: 12px; background: var(--bg3); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.arc-main { flex: 1; min-width: 0; }
.arc-title { font-size: 14px; margin-bottom: 4px; }
.arc-preview {
  font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; margin-bottom: 4px;
}
.arc-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn.sm { font-size: 12px; padding: 6px 10px; border-radius: 8px; }
.idn-editor-head { display: flex; align-items: center; justify-content: space-between; margin: 8px 0; }
.idn-editor-head label { font-size: 13px; color: var(--muted); margin: 0; }
.idn-editor {
  background: var(--bg3); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; margin-bottom: 10px;
}
.idn-e-row { display: flex; gap: 8px; margin-bottom: 8px; }
.idn-e-row input { flex: 1; }
.idn-e-desc { margin-bottom: 8px; }
.idn-editor textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; resize: vertical; margin-bottom: 6px;
}

@media (max-width: 760px) {
  header { padding: 10px 14px; }
  nav a { display: none; }
  .chat-wrap { height: auto; }
  .msg { max-width: 95%; }
  .p-grid { grid-template-columns: 1fr; }
  .chat-toolbar .t-model > span { display: none; }
  #chat-model { width: 100%; max-width: none; }
  .chat-drawer { width: 85%; }
  .arc-item { flex-wrap: wrap; }
  .arc-actions { width: 100%; justify-content: flex-end; }
}

/* ---------- 创作分类 / 提示词工作台 ---------- */
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.page-head .back {
  font-size: 22px; color: var(--muted); text-decoration: none; padding: 2px 6px; border-radius: 8px;
}
.page-head .back:hover { background: var(--bg2); color: var(--text); }
.create-cats { display: flex; flex-direction: column; gap: 10px; }
.create-cat {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; cursor: pointer;
  transition: transform .12s, border-color .12s;
}
.create-cat:hover { transform: translateY(-1px); border-color: var(--accent); }
.create-cat .cc-icon {
  width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 24px; background: var(--grad); color: #fff; flex-shrink: 0;
}
.create-cat .cc-txt { flex: 1; min-width: 0; }
.create-cat .cc-name { font-weight: 700; font-size: 15px; }
.create-cat .cc-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.create-cat em { color: var(--muted); font-style: normal; }
.create-cat.prompt .cc-icon { background: linear-gradient(135deg, #8b5cf6, #6366f1); }
.create-custom { width: 100%; padding: 12px; font-size: 15px; }
.section-card {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; margin-bottom: 16px;
}
.sc-title { font-weight: 700; font-size: 15px; margin-bottom: 12px; }
.pg-result { margin-top: 14px; }
.prompt-card {
  background: var(--bg3); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; margin-bottom: 10px;
}
.pc-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pc-title { font-weight: 700; font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-meta { font-size: 12px; color: var(--muted); margin: 4px 0; }
.pc-preview { font-size: 13px; color: var(--muted); margin: 6px 0; }
.pc-btns { display: flex; gap: 8px; justify-content: flex-end; }
.pc-details { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.pc-details summary { cursor: pointer; color: var(--accent); }
.pc-pre {
  background: var(--bg3); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px; font-size: 12px; white-space: pre-wrap; margin-top: 8px; color: var(--text);
}
.model-pick-row { display: flex; gap: 8px; align-items: center; }
.model-pick-row select { flex: 1; }
.model-legend { font-size: 12px; margin-top: 6px; }

/* ---------- 图片头像 / 图片生成 ---------- */
.avatar { overflow: hidden; }
.avatar img, .arc-avatar img, .idn-avatar img, .rd-avatar img {
  width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block;
}
.fb-img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.fb-emoji { display: flex; align-items: center; justify-content: center; font-size: 22px; }
.hot-cover .fb-emoji { font-size: 18px; }
.img-gen-wrap { display: flex; flex-direction: column; gap: 10px; }
.img-result-box { text-align: center; }
.img-result-box img { max-width: 100%; max-height: 46vh; border-radius: 12px; border: 1px solid var(--line); }
.img-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.img-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.img-item { background: var(--bg3); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.img-item img { width: 100%; height: 150px; object-fit: cover; display: block; }
.img-item .img-meta { padding: 8px; font-size: 12px; color: var(--muted); }
.img-item .img-acts { display: flex; gap: 6px; padding: 0 8px 10px; flex-wrap: wrap; }
.img-item .img-acts .btn { flex: 1; font-size: 12px; padding: 7px 4px; }
.prompt-pick-row { display: flex; gap: 8px; align-items: center; }
.prompt-pick-row select { flex: 1; }
.card-preview { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-top: 10px; font-size: 13px; }
.cp-row { display: flex; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.cp-row:last-child { border-bottom: none; }
.cp-row span { color: var(--muted); flex-shrink: 0; width: 56px; }
.cp-row b, .cp-row div { flex: 1; word-break: break-word; }



