/* FurrChat v15 - 去AI味重制版 */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #c9935a;
  --primary-dark: #a87a48;
  --primary-light: #e2c5a3;
  --bg-dark: #141210;
  --bg-warm: #1e1a16;
  --bg-card: rgba(201, 147, 90, 0.06);
  --bg-glass: rgba(201, 147, 90, 0.04);
  --text-primary: #e8ddd0;
  --text-secondary: rgba(232, 221, 208, 0.55);
  --text-muted: rgba(232, 221, 208, 0.3);
  --border: rgba(201, 147, 90, 0.1);
  --border-solid: #2a2420;
  --success: #7ec850;
  --danger: #d94a3a;
}

body {
  font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', -apple-system, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.page {
  display: none;
  height: 100vh;
  flex-direction: column;
}

.page.active {
  display: flex;
}

#page-msg.active {
  flex-direction: row;
  padding: 0 0 72px;
  overflow: hidden;
}

/* ==================== 页面头部 ==================== */
.page-header {
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--border-solid);
  background: linear-gradient(180deg, rgba(201,147,90,0.06) 0%, transparent 100%);
}

.header-left h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.header-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.header-actions {
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.icon-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* ==================== 标签页 ==================== */
.tabs {
  display: flex;
  padding: 12px 20px 0;
  gap: 0;
  border-bottom: 1px solid var(--border-solid);
  background: rgba(201,147,90,0.03);
}

.tab {
  flex: 1;
  padding: 10px 0;
  border: none;
  border-radius: 0;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  background: none;
  color: var(--text-muted);
  transition: color 0.15s;
  position: relative;
}

.tab.active {
  color: var(--primary);
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
}

.tab:hover:not(.active) {
  color: var(--text-secondary);
}

/* ==================== 官方预设页 ==================== */
.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: -8px 0 10px;
  font-weight: 400;
}

.preset-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 20px 100px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}
.preset-list::-webkit-scrollbar { width: 0; }

/* 精选大卡片 */
.preset-featured {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0;
  margin: 8px 0;
}

.preset-featured-avatar {
  font-size: 56px;
  line-height: 1;
  margin-bottom: 14px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

.preset-featured-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  background: rgba(201,147,90,0.2);
  color: #c9935a;
  border: 1px solid rgba(201,147,90,0.3);
  margin-bottom: 10px;
}

.preset-featured-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 10px;
}

.preset-featured-bio {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 18px;
  max-width: 300px;
}

.preset-featured-btn {
  display: inline-block;
  padding: 8px 28px;
  border-radius: 24px;
  font-size: 14px;
  background: linear-gradient(135deg, #c9935a, #a67c52);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(201,147,90,0.3);
}
.preset-featured-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(201,147,90,0.4);
}

/* ==================== 角色列表 ==================== */
.char-grid {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px 100px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  -webkit-overflow-scrolling: touch;
}

.char-grid::-webkit-scrollbar { width: 0; }

.char-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  text-align: left;
  border: none;
  position: relative;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.char-card:hover {
  background: rgba(201,147,90,0.1);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(201,147,90,0.12);
}

.char-card:active {
  transform: translateY(0) scale(0.99);
}

.bottom-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(245,158,11,0.15);
}

.char-card:hover {
  background: var(--bg-card);
}

.char-card .ca-wrap {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--bg-warm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid rgba(201,147,90,0.18);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.char-card:hover .ca-wrap {
  border-color: rgba(201,147,90,0.4);
  box-shadow: 0 2px 12px rgba(201,147,90,0.2);
}

.char-card .ca-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.char-card .ca-wrap span {
  font-size: 28px;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4));
}

.char-card .ca-info {
  flex: 1;
  min-width: 0;
}

.char-card .ca-info h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.char-card .ca-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.ca-tag {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(201,147,90,0.12);
  border: 1px solid rgba(201,147,90,0.2);
  border-radius: 20px;
  font-size: 11px;
  color: var(--primary);
  margin-top: 4px;
  font-weight: 500;
}

.ca-del {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: rgba(217, 74, 58, 0.12);
  color: var(--danger);
  font-size: 14px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.ca-del:hover {
  background: rgba(217, 74, 58, 0.25);
}

.char-card:hover .ca-del {
  display: flex;
}

/* 公共角色标签 */
.pub-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  background: var(--primary);
  border-radius: 6px;
  font-size: 11px;
  color: var(--bg-dark);
  font-weight: 600;
}

/* 空状态 */
.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty p {
  font-size: 15px;
  margin-bottom: 8px;
}

.empty s {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
}

/* ==================== 浮动按钮 ==================== */
.fab {
  position: fixed;
  bottom: 96px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  border: none;
  background: linear-gradient(135deg, #c9935a, #b8824a);
  color: #141210;
  font-size: 26px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: transform 0.15s, opacity 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 16px rgba(201,147,90,0.35);
}

.fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(201,147,90,0.45);
}

.fab:active {
  transform: scale(0.95);
}

.fab:hover {
  transform: scale(1.05);
}

.fab:active {
  transform: scale(0.95);
}

/* ==================== 聊天页 ==================== */
#page-chat {
  background: var(--bg-dark);
}

.chat-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
  border-bottom: 1px solid var(--border-solid);
}

.back-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.15s;
}

.back-btn:hover {
  background: var(--bg-card);
}

.cht-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cht-av {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg-warm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.cht-av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cht-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.del-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  transition: background 0.15s;
}

.del-btn:hover {
  background: var(--bg-card);
  color: var(--danger);
}

/* 消息区域 */
.cht-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cht-msgs::-webkit-scrollbar { width: 0; }

.msg {
  max-width: 82%;
  animation: msgIn 0.2s ease;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-ai {
  align-self: flex-start;
}

.msg-user {
  align-self: flex-end;
}

.mb {
  padding: 12px 16px;
  border-radius: 16px;
  line-height: 1.65;
  font-size: 14px;
  word-break: break-word;
}

.msg-ai .mb {
  background: var(--bg-warm);
  border: 1px solid var(--border-solid);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.msg-user .mb {
  background: var(--primary);
  color: var(--bg-dark);
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

/* 消息背景图 */
.cht-msgs.has-bg {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background-position 0.1s, background-size 0.1s;
}

/* 背景调整按钮 */
#bg-adjust-btn {
  position: absolute;
  bottom: 70px;
  right: 14px;
  z-index: 20;
  background: rgba(20,18,16,0.72);
  color: #c9935a;
  border: 1px solid rgba(201,147,90,0.5);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.2s;
}
#bg-adjust-btn:hover { background: rgba(201,147,90,0.3); }

/* 沉浸式背景编辑模式 */
#chat-modal.bg-immersive .modal-header,
#chat-modal.bg-immersive #char-info-affection,
#chat-modal.bg-immersive #branch-container,
#chat-modal.bg-immersive .cht-input-bar { display: none !important; }

#chat-modal.bg-immersive .modal-content { overflow: hidden; }
#chat-modal.bg-immersive #chat-messages {
  cursor: grab;
  overflow: hidden;
  padding: 0;
  gap: 0;
}
#chat-modal.bg-immersive #chat-messages > * { display: none !important; }
#chat-modal.bg-immersive #chat-messages:active { cursor: grabbing; }
#chat-modal.bg-immersive #chat-messages .msg-ai .mb,
#chat-modal.bg-immersive #chat-messages .msg-user .mb { display: none !important; }

/* 沉浸式编辑工具栏 - 底部浮动 */
#bg-edit-toolbar {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: none;
  background: rgba(20,18,16,0.92);
  border: 1px solid rgba(201,147,90,0.5);
  border-radius: 28px;
  padding: 8px 18px;
  gap: 12px;
  align-items: center;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
#bg-edit-toolbar.active { display: flex; }

#bg-edit-toolbar button {
  padding: 6px 16px;
  border-radius: 18px;
  font-size: 13px;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
#bg-edit-toolbar #bg-edit-reset {
  background: rgba(255,255,255,0.1);
  color: #ccc;
  font-size: 15px;
}
#bg-edit-toolbar #bg-edit-save {
  background: linear-gradient(135deg,#c9935a,#a67c52);
  color: #fff;
  font-weight: 600;
  padding: 8px 24px;
  font-size: 14px;
}

#bg-edit-toolbar #bg-edit-zoom-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.2);
  outline: none;
  cursor: pointer;
}
#bg-edit-toolbar #bg-edit-zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #c9935a;
  cursor: pointer;
  border: 2px solid #fff;
}
#bg-edit-toolbar #bg-zoom-val {
  color: #e8c97a;
  font-size: 14px;
  font-weight: 600;
  min-width: 42px;
  text-align: center;
}

/* 编辑模式下的消息气泡透明 */
.cht-msgs.has-bg .msg-ai .mb {
  background: rgba(20, 18, 16, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* 打字指示器 */
.typing-indicator {
  display: flex;
  gap: 5px;
  padding: 4px 0;
}

.typing-indicator span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing 1.2s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.9); }
  30% { opacity: 1; transform: scale(1); }
}

/* ==================== 风格选择器 ==================== */
  display: flex;
  padding: 12px 16px;
  gap: 10px;
  background: var(--bg-dark);
  align-items: flex-end;
  border-top: 1px solid var(--border-solid);
}

.voice-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
  flex-shrink: 0;
}

.voice-btn:hover {
  color: var(--primary);
}

.voice-btn.recording {
  color: var(--danger);
}

#cht-input {
  flex: 1;
  background: var(--bg-warm);
  border: 1px solid var(--border-solid);
  border-radius: 14px;
  padding: 10px 16px;
  color: var(--text-primary);
  font-size: 14px;
  resize: none;
  outline: none;
  min-height: 40px;
  max-height: 120px;
  transition: border-color 0.15s;
  font-family: inherit;
  line-height: 1.5;
}

#cht-input:focus {
  border-color: var(--primary);
}

#cht-input::placeholder {
  color: var(--text-muted);
}

#cht-send {
  padding: 10px 20px;
  background: var(--primary);
  border: none;
  border-radius: 14px;
  color: var(--bg-dark);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

#cht-send:hover {
  opacity: 0.85;
}

#cht-send:active {
  opacity: 0.7;
}

/* ==================== 我的页面 ==================== */
#page-me {
  background: var(--bg-dark);
}

.me-card {
  margin: 20px 20px 16px;
  padding: 32px 20px 24px;
  background: var(--bg-warm);
  border-radius: 16px;
  text-align: center;
  border: 1px solid var(--border-solid);
}

.me-av {
  font-size: 56px;
  margin-bottom: 12px;
}

.me-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.me-edit-btn {
  margin-top: 8px;
  padding: 4px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--primary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.me-edit-btn:hover {
  background: rgba(201,147,90,0.12);
  border-color: var(--primary);
}

.me-email {
  font-size: 13px;
  color: var(--text-muted);
}

/* 资产行 */
.asset-row {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin: 16px 0;
}

.asset-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 20px;
  background: var(--bg-card);
  border-radius: 12px;
  border: none;
  min-width: 100px;
}

.asset-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.asset-val {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

.recharge-btn {
  margin: 4px 16px 0;
  padding: 12px;
  background: var(--primary);
  border: none;
  border-radius: 12px;
  color: var(--bg-dark);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.recharge-btn:hover { opacity: 0.85; }
.recharge-btn:active { opacity: 0.7; }

.btn-submit {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  border: none;
  border-radius: 12px;
  color: var(--bg-dark);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  text-align: center;
  text-decoration: none;
  display: block;
  box-sizing: border-box;
}
.btn-submit:hover { opacity: 0.85; }
.btn-submit:active { opacity: 0.7; }

.me-arrow {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 16px;
}

/* 菜单 */
.me-menu {
  margin: 0 20px;
}

.me-item {
  padding: 16px;
  background: none;
  border-radius: 12px;
  margin-bottom: 2px;
  cursor: pointer;
  transition: background 0.15s;
  border: none;
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.me-item:hover {
  background: var(--bg-card);
}

.me-item:active {
  background: rgba(201, 147, 90, 0.1);
}

/* ==================== 底部导航 ==================== */
.nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 72px;
  background: rgba(20,18,16,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  border-top: 1px solid var(--border-solid);
  z-index: 999;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav.hide {
  display: none;
}

.nav-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 36px;
  border-radius: 0;
  transition: color 0.15s;
  position: relative;
}

.nav-btn span {
  font-size: 11px;
  font-weight: 500;
}

.nav-btn.active {
  color: var(--primary);
}

.nav-btn:hover:not(.active) {
  color: var(--text-secondary);
}

/* ==================== 弹窗 ==================== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(14, 12, 10, 0.8);
  z-index: 1000;
  align-items: flex-end;
  justify-content: center;
  animation: modalBg 0.15s ease;
}

@keyframes modalBg {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal.active {
  display: flex;
}

.modal-box {
  background: var(--bg-warm);
  border-radius: 20px 20px 0 0;
  padding: 24px 20px;
  max-width: 480px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  border: 1px solid var(--border-solid);
  border-bottom: none;
  animation: modalSlide 0.2s ease;
  position: relative;
}

@keyframes modalSlide {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.modal-close {
  float: right;
  background: var(--bg-card);
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  margin: -4px -4px 0 0;
}

.modal-close:hover {
  background: rgba(217, 74, 58, 0.12);
  color: var(--danger);
}

/* ==================== 聊天模态框（全屏） ==================== */
#chat-modal.modal {
  background: rgba(14, 12, 10, 0.85);
}
#chat-modal .modal-content {
  background: var(--bg-dark);
  box-shadow: -2px 0 20px rgba(0,0,0,0.3);
  border-radius: 24px 24px 0 0;
  overflow: visible;
}
#chat-modal #chat-header:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-solid);
}
#chat-messages {
  background: linear-gradient(180deg, var(--bg-warm) 0%, rgba(20,18,16,0.95) 100%);
  padding: 16px 12px !important;
}
/* 系统消息（分隔线） */
#chat-messages .msg-divider {
  text-align: center;
  color: var(--text-muted);
  font-size: 11px;
  padding: 8px 0;
  background: transparent !important;
}

/* 消息中的角色头像 */
#chat-messages .msg-avatar {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  margin-right: 10px;
  align-self: flex-start;
  margin-top: 2px;
}
#chat-messages .msg-avatar-img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent, #c9935a);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
#chat-messages .msg-avatar-emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(201,147,90,0.15);
  font-size: 17px;
  border: 2px solid rgba(201,147,90,0.3);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
/* AI 消息横向布局：头像 + 气泡 */
#chat-messages .msg-ai {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  max-width: 88%;
  background: transparent;
  padding: 4px 0;
  gap: 0;
  animation: msgSlideIn 0.25s ease;
}
#chat-messages .msg-ai .mb {
  background: linear-gradient(135deg, rgba(30,26,22,0.95), rgba(40,34,28,0.95));
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 18px;
  border-bottom-left-radius: 6px;
  padding: 10px 14px;
  line-height: 1.65;
  font-size: 14px;
  word-break: break-word;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
/* 用户消息 */
#chat-messages .msg-user {
  background: linear-gradient(135deg, var(--accent), #b8824a);
  color: var(--bg-dark);
  align-self: flex-end;
  border-radius: 18px;
  border-bottom-right-radius: 6px;
  padding: 10px 14px;
  max-width: 80%;
  line-height: 1.65;
  font-size: 14px;
  word-break: break-word;
  box-shadow: 0 2px 8px rgba(201,147,90,0.2);
  animation: msgSlideIn 0.25s ease;
  font-weight: 500;
}
@keyframes msgSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== 对话分支 ==================== */
#branch-container {
  display: none;
  border-top: 1px solid var(--border-solid);
  padding: 10px 14px 12px;
  background: rgba(30,26,22,0.95);
}
.branch-title {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-align: center;
  letter-spacing: 2px;
  text-transform: uppercase;
}
#branch-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.branch-btn {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(201,147,90,0.25);
  border-radius: 12px;
  background: rgba(201,147,90,0.06);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  font-family: inherit;
}
.branch-btn:hover {
  background: rgba(201,147,90,0.12);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateX(4px);
}
.branch-btn:active {
  transform: scale(0.98);
}

/* ==================== 聊天操作栏 ==================== */
.actions-bar {
  display: flex;
  gap: 6px;
  padding: 6px 12px;
  border-top: 1px solid var(--border-solid);
  background: var(--bg-dark);
  justify-content: center;
  flex-wrap: wrap;
}
.actions-bar .style-btn {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  font-weight: 500;
  font-family: inherit;
}
.actions-bar .style-btn.active {
  background: rgba(201,147,90,0.12);
  border-color: var(--primary);
  color: var(--primary);
}
.actions-bar .style-btn:hover:not(.active) {
  border-color: var(--text-muted);
  color: var(--text-secondary);
}

/* ==================== 成就徽章 ==================== */
#badges-modal.modal {
  align-items: center !important;
  justify-content: center !important;
}
#badges-modal .modal-box {
  max-height: 78vh;
  padding: 20px 16px 24px;
  border-radius: 20px;
  animation: modalScale 0.25s ease;
  max-width: 400px;
  width: 90%;
}
#badges-modal #badges-container {
  min-height: 200px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 8px 0 4px;
}
@keyframes modalScale {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes badgeFadeIn {
  from { opacity: 0; transform: translateY(8px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
/* 单个徽章卡片 */
.badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 14px 6px 10px;
  border-radius: 14px;
  gap: 6px;
  transition: all 0.25s;
  position: relative;
  min-height: 110px;
  justify-content: flex-start;
  cursor: default;
}
.badge-item.earned {
  background: linear-gradient(180deg, rgba(201,147,90,0.12) 0%, rgba(201,147,90,0.04) 100%);
  border: 1px solid rgba(201,147,90,0.3);
}
.badge-item.earned:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(201,147,90,0.2);
  border-color: rgba(201,147,90,0.5);
}
.badge-item.locked {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  opacity: 0.55;
}
.badge-item.locked:hover {
  opacity: 0.75;
  background: rgba(255,255,255,0.04);
}
/* 徽章图标 - 圆形容器 */
.badge-icon {
  width: 48px;
  height: 48px;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  transition: transform 0.3s, box-shadow 0.3s;
  position: relative;
}
.badge-item.earned:hover .badge-icon {
  transform: scale(1.1) rotate(-5deg);
}
/* 已获得 - 金色渐变 */
.badge-item.earned .badge-icon {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 3px 10px rgba(245, 158, 11, 0.3);
}
/* 锁定 - 灰色 */
.badge-item.locked .badge-icon {
  background: rgba(255,255,255,0.08);
  border: 1.5px solid rgba(255,255,255,0.12);
}
/* 锁定图标上加锁头标记 */
.badge-item.locked .badge-icon::after {
  content: '🔒';
  position: absolute;
  bottom: -4px;
  right: -4px;
  font-size: 10px;
  filter: none;
}
/* 徽章名 */
.badge-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}
.badge-item.locked .badge-name {
  color: var(--text-secondary);
}
/* 解锁条件描述 */
.badge-desc {
  font-size: 9px;
  color: var(--text-muted);
  line-height: 1.3;
  max-width: 100%;
  word-break: break-all;
}
.badge-item.earned .badge-desc {
  color: rgba(245, 158, 11, 0.7);
}
.badge-item.earned .badge-desc::before {
  content: '✓ ';
}
/* 已获得徽章额外点缀 */
.badge-item.earned::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 16px;
  height: 16px;
  background: radial-gradient(circle at 30% 30%, #fbbf24, #d97706);
  border-radius: 50%;
  opacity: 0.7;
  box-shadow: 0 1px 4px rgba(245,158,11,0.4);
}

/* ==================== 表单 ==================== */
.form-scroll {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-scroll label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-scroll input[type="text"],
.form-scroll textarea,
.form-scroll select {
  background: var(--bg-dark);
  border: 1px solid var(--border-solid);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}

.form-scroll input[type="text"]:focus,
.form-scroll textarea:focus,
.form-scroll select:focus {
  border-color: var(--primary);
}

.form-scroll textarea {
  resize: vertical;
  min-height: 80px;
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.upload-area {
  border: 1px dashed var(--border-solid);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s;
  color: var(--text-muted);
  font-size: 13px;
}

.upload-area:hover {
  border-color: var(--primary);
  color: var(--text-secondary);
}

.upload-area img {
  max-width: 80px;
  max-height: 80px;
  border-radius: 10px;
  object-fit: cover;
}

.btn-submit {
  padding: 12px;
  background: var(--primary);
  border: none;
  border-radius: 12px;
  color: var(--bg-dark);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  margin-top: 4px;
}

.btn-submit:hover { opacity: 0.85; }
.btn-submit:active { opacity: 0.7; }

/* 搜索 */
.search-wrap {
  margin: 0 24px 12px;
  position: relative;
}

.search-wrap input {
  width: 100%;
  padding: 10px 14px 10px 36px;
  background: var(--bg-warm);
  border: 1px solid var(--border-solid);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.search-wrap input:focus {
  border-color: var(--primary);
}

.search-wrap::before {
  content: '🔍';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  pointer-events: none;
}

/* 充值 */
.recharge-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recharge-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--bg-dark);
  border: 1px solid var(--border-solid);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.recharge-card:hover {
  border-color: var(--primary);
}

.recharge-card .rc-info h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.recharge-card .rc-info p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.recharge-card .rc-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-warm);
  border: 1px solid var(--border-solid);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.2s ease;
  z-index: 2000;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==================== 对话设置弹窗 ==================== */
#modal-chat-settings .modal-box {
  max-width: 420px;
  border-radius: 16px;
}

.settings-group {
  margin-bottom: 18px;
  padding: 14px 16px;
  background: var(--bg-warm, rgba(26,22,18,0.6));
  border-radius: 12px;
  border: 1px solid var(--border-solid, rgba(201,147,90,0.1));
}

.settings-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, #a09080);
  margin-bottom: 10px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* Select 下拉框 */
.settings-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-page, #1a1612);
  border: 1px solid var(--border-solid, rgba(201,147,90,0.15));
  border-radius: 10px;
  color: var(--text-primary, #e8ddd0);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: auto;
  -webkit-appearance: auto;
}
.settings-select:focus {
  border-color: var(--primary, #c9935a);
  box-shadow: 0 0 0 3px rgba(201,147,90,0.12);
}

/* Range 滑块容器 */
.settings-range-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Range 滑块 - 自定义样式 */
input[type="range"].settings-range {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  background: linear-gradient(to right, var(--primary, #c9935a) var(--pct, 50%), rgba(201,147,90,0.15) var(--pct, 50%));
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  margin: 0;
  transition: background 0.15s;
}
input[type="range"].settings-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary, #c9935a);
  border: 3px solid var(--bg-page, #1a1612);
  box-shadow: 0 2px 8px rgba(201,147,90,0.25);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
input[type="range"].settings-range::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 12px rgba(201,147,90,0.35);
}
input[type="range"].settings-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary, #c9935a);
  border: 3px solid var(--bg-page, #1a1612);
  box-shadow: 0 2px 8px rgba(201,147,90,0.25);
  cursor: pointer;
}

/* Range 数值 */
.settings-range-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary, #c9935a);
  min-width: 40px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* 小说模式复选框 */
.settings-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.settings-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary, #c9935a);
  margin-top: 2px;
  cursor: pointer;
  flex-shrink: 0;
}
.settings-check label {
  font-size: 13px;
  color: var(--text-primary, #e8ddd0);
  line-height: 1.5;
  cursor: pointer;
  user-select: none;
}

/* 模态框底部按钮 */
.settings-footer {
  display: flex;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border-solid, rgba(201,147,90,0.1));
}

/* 通用 action btn (已经在别处定义过, 这里补充) */
.action-btn {
  flex: 1;
  padding: 11px 16px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}
.action-btn.primary {
  background: linear-gradient(135deg, var(--primary, #c9935a), #b07d44);
  color: #fff;
  box-shadow: 0 2px 8px rgba(201,147,90,0.2);
}
.action-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(201,147,90,0.3);
}
.action-btn.secondary {
  background: rgba(201,147,90,0.08);
  color: var(--text-secondary, #a09080);
}
.action-btn.secondary:hover {
  background: rgba(201,147,90,0.14);
  color: var(--text-primary, #e8ddd0);
}

/* ==================== 登录弹窗 ==================== */
.login-modal-bg {
  background: rgba(10, 8, 6, 0.85) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.login-modal-box {
  max-width: 380px;
  width: calc(100% - 40px);
  background: var(--bg-warm);
  border: 1px solid var(--border-solid);
  border-radius: 20px;
  padding: 0 0 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: loginSlideUp 0.25s ease;
}

@keyframes loginSlideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* 品牌区 */
.login-brand {
  background: linear-gradient(135deg, rgba(201,147,90,0.18), rgba(201,147,90,0.06));
  padding: 28px 20px 20px;
  text-align: center;
  border-bottom: 1px solid var(--border-solid);
}

.login-brand-icon {
  font-size: 44px;
  line-height: 1;
  margin-bottom: 8px;
  filter: drop-shadow(0 2px 8px rgba(201,147,90,0.3));
}

.login-brand-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 4px;
  letter-spacing: 0.5px;
}

.login-brand-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

/* 消息提示 */
.login-msg {
  font-size: 13px;
  color: var(--danger);
  min-height: 18px;
  padding: 8px 20px 0;
  text-align: center;
}

/* 表单区 */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 20px 0;
}

/* 输入框包裹 */
.login-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-dark);
  border: 1.5px solid var(--border-solid);
  border-radius: 12px;
  padding: 0 14px;
  height: 46px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(201,147,90,0.12);
}

.login-input-icon {
  font-size: 15px;
  margin-right: 10px;
  flex-shrink: 0;
  line-height: 1;
}

.login-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  width: 100%;
}

.login-input::placeholder {
  color: var(--text-muted);
}

/* 验证码行 */
.login-code-row {
  display: flex;
  gap: 8px;
}

.login-input-code {
  flex: 1;
}

.login-code-btn {
  height: 46px;
  padding: 0 14px;
  background: rgba(201,147,90,0.1);
  border: 1.5px solid var(--primary);
  border-radius: 12px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, opacity 0.15s;
  flex-shrink: 0;
  font-family: inherit;
}

.login-code-btn:hover {
  background: rgba(201,147,90,0.22);
}

.login-code-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* 提交按钮 */
.login-submit-btn {
  height: 46px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #c9935a, #b8824a);
  color: #141210;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  font-family: inherit;
  letter-spacing: 4px;
  margin-top: 4px;
}

.login-submit-btn:hover {
  opacity: 0.88;
}

.login-submit-btn:active {
  transform: scale(0.98);
}

/* 底部协议 */
.login-footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 14px 20px 0;
}

.login-link {
  color: var(--primary);
  text-decoration: none;
  margin: 0 2px;
}

.login-link:hover {
  text-decoration: underline;
}


/* AI 消息字数标签 */
.msg-char-count {
  display: block;
  text-align: right;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  opacity: 0.7;
}

/* === Markdown 渲染样式（AI 消息）=== */
.msg-ai .mb h1,.msg-ai .mb h2,.msg-ai .mb h3,
.msg-ai .mb h4,.msg-ai .mb h5,.msg-ai .mb h6 {
  color: var(--primary);
  margin: 8px 0 6px;
  font-weight: 700;
  line-height: 1.35;
}
.msg-ai .mb h1 { font-size: 1.35em; }
.msg-ai .mb h2 { font-size: 1.2em; }
.msg-ai .mb h3 { font-size: 1.08em; }

.msg-ai .mb p { margin: 6px 0; line-height: 1.7; }

.msg-ai .mb strong { color: var(--primary); font-weight: 700; }
.msg-ai .mb em { color: #fbbf24; font-style: italic; }

.msg-ai .mb blockquote {
  margin: 8px 0;
  padding: 6px 14px;
  border-left: 3px solid var(--primary);
  background: rgba(212,165,116,0.08);
  border-radius: 0 8px 8px 0;
  color: var(--text-muted);
}

.msg-ai .mb code {
  background: rgba(255,255,255,0.08);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 0.92em;
  color: #f472b6;
}

.msg-ai .mb pre {
  background: rgba(0,0,0,0.35);
  padding: 12px 16px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 8px 0;
  border: 1px solid rgba(255,255,255,0.06);
}
.msg-ai .mb pre code {
  background: none;
  padding: 0;
  color: #e2e8f0;
}

.msg-ai .mb ul,.msg-ai .mb ol {
  margin: 6px 0;
  padding-left: 22px;
}
.msg-ai .mb li { margin: 3px 0; line-height: 1.65; }

.msg-ai .mb table {
  border-collapse: collapse;
  margin: 8px 0;
  width: 100%;
  font-size: 0.92em;
}
.msg-ai .mb th,.msg-ai .mb td {
  border: 1px solid rgba(255,255,255,0.1);
  padding: 5px 10px;
  text-align: left;
}
.msg-ai .mb th {
  background: rgba(212,165,116,0.12);
  color: var(--primary);
  font-weight: 600;
}
.msg-ai .mb hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin: 10px 0;
}

/* 回复格式中的括号标签高亮 */
.msg-ai .mb .format-label {
  color: var(--primary);
  font-weight: 600;
}

/* 确认弹窗按钮 */
.cf-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 18px;
}

.cf-btns button {
  padding: 10px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.15s;
  min-width: 90px;
}

.cf-btns button:active {
  transform: scale(0.97);
}

.cf-cancel {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text-main);
}

.cf-cancel:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.2);
}

.cf-ok {
  background: var(--primary);
  border: 1px solid var(--primary);
  color: var(--bg-dark);
  font-weight: 600;
}

.cf-ok:hover {
  opacity: 0.9;
}

/* ==================== 颜色选择器 ==================== */
.color-picker-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.color-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.color-dot {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.color-dot:hover {
  border-color: rgba(255,255,255,0.2);
}

.color-dot.active {
  border-color: var(--primary);
}

.color-dot[data-color=""]::after {
  content: '\2715';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 12px;
  color: rgba(255,255,255,0.5);
}

input[type="color"] {
  width: 30px;
  height: 30px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  border-radius: 6px;
  overflow: hidden;
}

input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch {
  border: 2px solid var(--border-solid);
  border-radius: 6px;
}

/* ==================== 积分不足 ==================== */
.insufficient-card {
  text-align: center;
  padding: 20px;
}

.insufficient-card p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* ==================== 响应式 ==================== */
@media (max-width: 480px) {
  .page-header h2 {
    font-size: 20px;
  }

  .char-grid {
    gap: 2px;
  }

  .login-modal-box .modal-title {
    font-size: 18px;
  }

  .modal-box {
    padding: 20px 16px;
  }
}

/* 确认弹窗居中覆盖 */
.modal-center .modal {
  align-items: center;
}

.modal-center .modal-box {
  border-radius: 16px;
  border-bottom: 1px solid var(--border-solid);
  max-width: 340px;
}

/* 预览消息区域在主页面 */
.preview-msgs {
  padding: 12px 16px;
  max-height: 300px;
  overflow-y: auto;
  background: var(--bg-dark);
  border-radius: 10px;
  border: 1px solid var(--border-solid);
}

/* 角色卡操作按钮组 */
.ca-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: none;
  gap: 4px;
}

.char-card:hover .ca-actions {
  display: flex;
}

.ca-edit {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: rgba(201, 147, 90, 0.12);
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.ca-edit:hover {
  background: rgba(201, 147, 90, 0.25);
}

/* 故事线管理区 */
.storyline-item {
  background: var(--bg-dark);
  border: 1px solid var(--border-solid);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.storyline-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.storyline-item-header input {
  flex: 1;
}

.storyline-del {
  background: rgba(217, 74, 58, 0.12);
  border: none;
  border-radius: 6px;
  color: var(--danger);
  font-size: 13px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}

.storyline-del:hover {
  background: rgba(217, 74, 58, 0.25);
}

/* 故事线选择弹窗选项 */
.storyline-option {
  padding: 14px 16px;
  background: var(--bg-dark);
  border: 2px solid var(--border-solid);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s;
  text-align: left;
}

.storyline-option:hover {
  border-color: var(--primary);
}

.storyline-option-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.storyline-option-hint {
  font-size: 12px;
  color: var(--text-muted);
}

/* === 分隔线（AI 记忆清除标记）=== */
.msg-divider {
  text-align: center;
  margin: 18px 0;
  color: var(--text-muted);
  font-size: 12px;
  opacity: 0.8;
}
.msg-divider span {
  background: rgba(255,255,255,0.06);
  padding: 4px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
}

/* === 小说模式开关 === */
.cs-toggle-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  margin-top: 12px;
}
.cs-toggle-slider {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--border-solid);
  border-radius: 12px;
  transition: background 0.2s;
  flex-shrink: 0;
}
.cs-toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--text-primary);
  border-radius: 50%;
  transition: transform 0.2s;
}
.cs-toggle-label input:checked + .cs-toggle-slider {
  background: var(--primary);
}
.cs-toggle-label input:checked + .cs-toggle-slider::after {
  transform: translateX(20px);
}
.cs-toggle-text {
  display: flex;
  flex-direction: column;
  font-size: 14px;
  color: var(--text-primary);
}

/* 小按钮 */
.btn-sm {
  padding: 4px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-sm:hover {
  background: rgba(201, 147, 90, 0.15);
}


/* ===== 故事线面板（聊天界面右上角）===== */
.storyline-panel {
  display: none;
  position: absolute;
  top: 56px;
  right: 12px;
  width: 260px;
  background: var(--bg-warm);
  border: 1px solid var(--border-solid);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  z-index: 1001;
  overflow: hidden;
  animation: panelIn 0.15s ease;
}

.storyline-panel.active {
  display: block;
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.storyline-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-solid);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.storyline-panel-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.storyline-panel-close:hover {
  color: var(--text-primary);
}

.storyline-panel-list {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 280px;
  overflow-y: auto;
}

.storyline-panel-item {
  padding: 10px 14px;
  border-radius: 10px;
  background: none;
  border: 1px solid transparent;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.storyline-panel-item:hover {
  background: rgba(201,147,90,0.1);
  border-color: var(--border);
}
.storyline-panel-item.active {
  background: rgba(201,147,90,0.15);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

/* ==================== 手机端适配 ==================== */
@media (max-width: 480px) {
  #chat-modal.modal { padding-left: 0; padding-right: 0; }
  #chat-modal .modal-content { max-width: 100%; border-radius: 0; margin: 0; }
  #chat-messages { padding: 10px 10px !important; }
  #chat-messages .msg-ai .mb { padding: 8px 10px; font-size: 14px; }
  #chat-messages .msg-user { padding: 8px 10px; font-size: 14px; }
  #chat-messages .msg-avatar,
  #chat-messages .msg-avatar-img { width: 28px; height: 28px; }
  #chat-messages .msg-avatar-emoji { width: 28px; height: 28px; font-size: 14px; }
  #chat-input { font-size: 16px !important; }
  #chat-modal #chat-header:first-child { padding: 10px 10px 8px; }
  #chat-title { font-size: 15px !important; }
  .branch-btn { padding: 12px 14px; }
}

/* ==================== 数据统计 ==================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 12px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  transition: transform 0.2s, box-shadow 0.2s;
  min-height: 90px;
  justify-content: center;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}
.stat-card.clickable {
  cursor: pointer;
  background: linear-gradient(135deg, rgba(201,147,90,0.12), rgba(201,147,90,0.06));
  border-color: rgba(201,147,90,0.3);
}
.stat-card.clickable:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(201,147,90,0.2);
}
.stat-card-icon {
  font-size: 20px;
  line-height: 1;
  margin-bottom: 2px;
}
.stat-card-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.stat-card-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.2;
}
.stat-card.clickable .stat-card-value {
  font-size: 13px;
  color: var(--primary);
}
/* 最爱角色 Top3 */
.fav-section {
  padding: 0 12px 16px;
}
.fav-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  padding: 0 4px;
}
.fav-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 6px;
  gap: 10px;
  transition: background 0.2s;
}
.fav-item:last-child {
  margin-bottom: 0;
}
.fav-item:hover {
  background: rgba(201,147,90,0.08);
}
.fav-rank {
  font-size: 18px;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}
.fav-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-warm);
}
.fav-info {
  flex: 1;
  min-width: 0;
}
.fav-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fav-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.empty-fav {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 13px;
}
/* 排行榜列表 */
.ranking-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.ranking-rank {
  font-size: 16px;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
  font-weight: 600;
  color: var(--text-secondary);
}
.ranking-name {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ranking-count {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ==================== 聊天输入栏 ==================== */
.cht-input-bar {
  display: flex;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  align-items: center;
  gap: 8px;
  background: var(--bg-warm);
}
.cht-input-field {
  flex: 1;
  padding: 10px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-dark);
  color: var(--text-primary);
  font-size: 14px;
  resize: none;
  outline: none;
  min-height: 40px;
  max-height: 120px;
  font-family: inherit;
  line-height: 1.5;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.cht-input-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(201,147,90,0.08);
}
.cht-input-field::placeholder {
  color: var(--text-muted);
}
.cht-send-btn {
  background: var(--primary);
  color: var(--bg-dark);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.15s;
}
.cht-send-btn:hover {
  opacity: 0.85;
  transform: scale(1.05);
}
.cht-send-btn:active {
  transform: scale(0.95);
}


/* ===== 公共聊天室 ===== */
.chat-sidebar {
  width: 160px;
  min-width: 160px;
  background: var(--bg-dark);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-sidebar-header {
  padding: 10px 12px;
  font-size: 12px;
  font-weight: bold;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}
.chat-sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}
.chat-sidebar-list .online-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-secondary);
}
.chat-sidebar-list .online-item .online-av {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
}
.chat-sidebar-list .online-item .online-av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.chat-sidebar-list .online-item .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2ecc71;
  flex-shrink: 0;
}
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-main-header {
  padding: 10px 14px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: bold;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-main-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-warm);
}
.chat-main-msgs .pub-msg {
  display: flex;
  gap: 8px;
  animation: fadeIn 0.2s ease;
}
.chat-main-msgs .pub-msg .pub-av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  overflow: hidden;
}
.chat-main-msgs .pub-msg .pub-av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.chat-main-msgs .pub-msg .pub-body {
  flex: 1;
  min-width: 0;
}
.chat-main-msgs .pub-msg .pub-name {
  font-size: 11px;
  color: var(--primary);
  font-weight: bold;
  margin-bottom: 2px;
}
.chat-main-msgs .pub-msg .pub-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
  word-wrap: break-word;
}
.chat-main-msgs .pub-msg .pub-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}
/* 群聊复用 pub-msg 样式 */
.gc-msgs .pub-msg {
  display: flex;
  gap: 8px;
  animation: fadeIn 0.2s ease;
}
.gc-msgs .pub-msg .pub-av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  overflow: hidden;
}
.gc-msgs .pub-msg .pub-av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gc-msgs .pub-msg .pub-body {
  flex: 1;
  min-width: 0;
}
.gc-msgs .pub-msg .pub-name {
  font-size: 11px;
  color: var(--primary);
  font-weight: bold;
  margin-bottom: 2px;
}
.gc-msgs .pub-msg .pub-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
  word-wrap: break-word;
}
.chat-main-input {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-warm);
  border-top: 1px solid var(--border-solid);
  min-height: 52px;
  flex-shrink: 0;
}
.chat-main-input textarea {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 14px;
  resize: none;
  outline: none;
  min-height: 36px;
  max-height: 100px;
}
.chat-main-input textarea:focus {
  border-color: var(--primary);
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}


/* ===== 群聊页 ===== */
#page-gc .gc-main {
  padding-bottom: 72px;
}
.gc-sidebar {
  width: 180px;
  min-width: 180px;
  background: var(--bg-dark);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.gc-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.gc-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin: 0 10px 8px;
  cursor: pointer;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: all 0.2s;
  position: relative;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.gc-list-item:hover {
  background: rgba(201,147,90,0.1);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(201,147,90,0.12);
}
.gc-list-item:active {
  transform: translateY(0) scale(0.99);
}
.gc-list-item.gc-list-active {
  background: linear-gradient(135deg, rgba(255,215,0,0.08), rgba(201,147,90,0.14));
  border-color: rgba(201,147,90,0.3);
  box-shadow: 0 2px 10px rgba(201,147,90,0.15);
}
.gc-list-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  color: #fff;
}
.gc-list-info { flex: 1; min-width: 0; }
.gc-list-name {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gc-list-chars {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.gc-del {
  position: absolute;
  top: 6px;
  right: 6px;
  display: none;
  z-index: 2;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: none;
  background: rgba(217, 74, 58, 0.12);
  color: var(--danger);
  font-size: 13px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  line-height: 1;
}
.gc-del:hover {
  background: rgba(217, 74, 58, 0.25);
}
.gc-list-item:hover .gc-del {
  display: flex;
}
.gc-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.gc-main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: bold;
  color: var(--text-primary);
}
/* ===== 创建群聊 - 角色选择优化 ===== */
#gc-sel-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 12px;
}
.gc-sel-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  user-select: none;
  position: relative;
  cursor: grab;
}
.gc-sel-active:active {
  cursor: grabbing;
}
.gc-sel-item:hover {
  border-color: var(--primary);
  background: rgba(201,147,90,0.06);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.gc-sel-item:active {
  transform: scale(0.95);
}
.gc-sel-active {
  background: linear-gradient(135deg, rgba(255,215,0,0.12), rgba(201,147,90,0.18)) !important;
  border-color: #c9935a !important;
  color: #c9935a !important;
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(201,147,90,0.3), 0 2px 8px rgba(201,147,90,0.15);
}
.gc-sel-active::after {
  content: '✓';
  font-size: 10px;
  color: #c9935a;
  font-weight: bold;
  margin-left: 2px;
}
.gc-order-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #c9935a;
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  margin-left: 2px;
  line-height: 1;
  animation: gcPopIn 0.25s ease;
}
@keyframes gcPopIn {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}
.gc-char-av {
  font-size: 16px;
  line-height: 1;
}
.gc-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.gc-input {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-dark);
  border-top: 1px solid var(--border);
}
.gc-input textarea {
  flex: 1;
}

/* ===== 异次元店铺 ===== */
.shop-content {
  max-width: 720px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
}
.shop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.shop-header h2 {
  margin: 0;
  font-size: 22px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.shop-balance {
  font-size: 15px;
  color: #667eea;
  font-weight: 600;
}
.shop-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.shop-tab {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}
.shop-tab:hover, .shop-tab.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border-color: transparent;
}
.shop-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.shop-item-card {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: transform 0.2s;
}
.shop-item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.15);
}
.shop-item-icon {
  font-size: 36px;
}
.shop-item-info {
  text-align: center;
  width: 100%;
}
.shop-item-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}
.shop-item-desc {
  font-size: 12px;
  color: #999;
  margin-bottom: 6px;
  min-height: 32px;
}
.shop-item-price {
  font-size: 14px;
  font-weight: 700;
  color: #f59e0b;
}
.shop-buy-btn {
  width: 100%;
  padding: 8px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.shop-buy-btn:hover {
  opacity: 0.85;
}
.shop-loading, .shop-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: #999;
  font-size: 14px;
}
.shop-footer {
  margin-top: 16px;
  text-align: center;
}
.shop-footer button {
  padding: 8px 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}
.shop-footer button:hover {
  background: var(--bg-dark);
}
.shop-mypurchases {
  max-height: 60vh;
  overflow-y: auto;
  padding: 16px 0;
}
.shop-mypurchases h3 {
  margin: 0 0 12px;
  font-size: 16px;
}
.shop-mypurchase-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--bg-dark);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 14px;
}

/* 导出按钮 */
#export-chat-btn {
    background: linear-gradient(135deg, #27ae60, #2ecc71) !important;
    color: #fff !important;
    border: none !important;
    font-size: 15px !important;
    padding: 6px 10px !important;
    border-radius: 8px !important;
    cursor: pointer;
    white-space: nowrap;
}
#export-chat-btn:hover {
    opacity: 0.88;
    transform: scale(1.05);
}

.regen-btn{background:none;border:none;color:#888;cursor:pointer;font-size:12px;margin-left:8px;position:absolute;right:8px;bottom:8px;}.regen-btn:hover{color:#4a9eff;}
