@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700;900&display=swap');

:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --surface2: #1a1a28;
  --border: #252540;
  --text: #f0e6ff;
  --text2: #8a80a6;
  --accent: #c44dff;
  --accent2: #ff6b9d;
  --gold: #ffb347;
  --green: #4ade80;
  --danger: #f87171;
  --radius: 14px;
  --radius-sm: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.7;
  overflow-x: hidden;
}

/* ===== 导航栏 ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  cursor: pointer;
  text-decoration: none;
}
.nav-tabs { display: flex; gap: 4px; }
.nav-tab {
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text2);
  font-size: 14px;
  font-weight: 500;
  border: none;
  background: none;
  transition: all 0.2s;
  font-family: inherit;
}
.nav-tab:hover { color: var(--text); background: var(--surface2); }
.nav-tab.active { color: #fff; background: var(--surface2); }

.header-right { display: flex; align-items: center; gap: 12px; }

.btn {
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 4px 20px rgba(196,77,255,0.3);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 30px rgba(196,77,255,0.45);
}
.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--accent); color: #fff; }
.btn-sm { padding: 6px 16px; font-size: 13px; }

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-credits { color: var(--gold); font-weight: 700; font-size: 14px; }

/* ===== 导航栏统计 ===== */
.hero-stats-nav {
  display: flex;
  gap: 16px;
  margin-left: 12px;
  flex-shrink: 0;
}
.hs-item {
  font-size: 12px;
  color: var(--text2);
  white-space: nowrap;
  padding: 4px 12px;
  border-radius: 8px;
  background: var(--surface2);
}
.hs-item b {
  font-size: 15px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero {
  padding: 16px 16px 12px;
  position: relative;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(196,77,255,0.04), transparent);
}
.hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.hero-left { flex-shrink: 0; }
.hero-left h1 {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.5px;
  line-height: 1.3;
  margin: 0;
}
.hero-left h1 .grad {
  background: linear-gradient(135deg, var(--accent), var(--accent2), #ff8c5a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-left p {
  font-size: 12px;
  color: var(--text2);
  margin-top: 2px;
}
.hero-stats {
  display: flex;
  gap: 20px;
  flex-shrink: 0;
}
.hero-stat { text-align: center; }
.hero-stat-num {
  font-size: 20px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-stat-label { font-size: 11px; color: var(--text2); }
.hero-search {
  display: flex;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: visible;
}
.hero-search > div { position: relative; flex: 1; }
.hero-search input {
  width: 200px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 13px;
  outline: none;
  font-family: inherit;
}
.hero-search button {
  padding: 8px 14px;
  background: var(--surface2);
  color: var(--text);
  border: none;
  border-left: 1px solid var(--border);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
}
.hero-search button:hover { background: var(--accent); color: #fff; }
.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  flex: 1;
  justify-content: center;
  align-items: center;
  min-width: 200px;
}
.hero-tag {
  padding: 5px 16px;
  border-radius: 14px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  position: relative;
  transform: rotate(0deg) scale(1);
}
.hero-tag:nth-child(3n) { transform: rotate(-2deg); font-size: 13px; }
.hero-tag:nth-child(5n+1) { transform: rotate(1.5deg); font-size: 11px; }
.hero-tag:nth-child(7n) { transform: rotate(-1deg); margin-top: -4px; }
.hero-tag:nth-child(4n+2) { margin-top: 3px; }
.hero-tag:hover {
  transform: scale(1.25) rotate(0deg) !important;
  border-color: var(--accent);
  color: #fff;
  background: linear-gradient(135deg, rgba(196,77,255,0.3), rgba(255,107,157,0.2));
  box-shadow: 0 4px 16px rgba(196,77,255,0.25);
  z-index: 2;
}
.hero-tag.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border-color: var(--accent);
  transform: scale(1.1) !important;
  box-shadow: 0 4px 12px rgba(196,77,255,0.3);
}
.hero-tag .tag-fire {
  font-size: 10px;
  margin-left: 2px;
}
.hero-stat-label { font-size: 13px; color: var(--text2); margin-top: 2px; }

/* ===== 内容区 ===== */
.page { display: none; }
.page.active { display: block; }

.section {
  width: 100%;
  margin: 0 auto;
  padding: 0 12px 32px;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.section-header h2 { font-size: 20px; font-weight: 700; }

.search-box {
  display: flex;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  max-width: 320px;
  flex: 1;
}
.search-box input {
  flex: 1;
  padding: 10px 12px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
.search-box button {
  padding: 10px 20px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.sort-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 4px;
  border: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}
.sort-tab {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text2);
  border: none;
  background: none;
  font-family: inherit;
  white-space: nowrap;
}
.sort-tab.active { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; font-weight: 600; }

/* ===== 角色网格 ===== */
.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 12px;
}
.char-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.char-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 6px 20px rgba(196,77,255,0.12);
}
.char-card-img-wrap { overflow: hidden; position: relative; }
.char-card-img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  display: block;
  background: var(--surface2);
  transition: transform 0.3s;
}
.char-card:hover .char-card-img { transform: scale(1.04); }
.char-card-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  z-index: 2;
}
.badge-official { background: rgba(196,77,255,0.8); color: #fff; }
.badge-hot { background: rgba(255,107,157,0.8); color: #fff; }
.char-card-info { padding: 10px 12px; }
.char-card-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.char-card-tags {
  display: flex;
  gap: 3px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.char-card-tag {
  font-size: 10px;
  padding: 2px 7px;
  background: var(--surface2);
  border-radius: 3px;
  color: var(--text2);
}
.char-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text2);
}
.char-card-pop { color: var(--accent2); font-weight: 600; }

/* ===== 加载 ===== */
.loading-state {
  text-align: center;
  padding: 80px 20px;
}
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-state p { color: var(--text2); font-size: 15px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text2); font-size: 15px; }

/* ===== 按钮旋转小圈 ===== */
.btn-spin {
  display: inline-block;
  width: 10px; height: 10px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 2px;
}

.load-more {
  text-align: center;
  padding: 24px;
}

/* ===== 打字指示器 ===== */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
}
.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text2);
  animation: typingBounce 1.4s infinite ease-in-out;
}
.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-8px); }
}

/* ===== VIP卡片 ===== */
.vip-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
}
.stat-item { text-align: center; }
.stat-value { font-size: 22px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text2); margin-top: 4px; }

.vip-upgrade-card {
  background: linear-gradient(135deg, var(--surface), var(--surface2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  transition: all 0.2s;
}
.vip-upgrade-card:hover { border-color: var(--accent); }

/* ===== VIP徽章 ===== */
.vip-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}
.vip-0 { color: var(--text2); background: var(--surface2); }
.vip-1 { color: #f0c060; background: rgba(240,192,96,0.15); }
.vip-2 { color: #c44dff; background: rgba(196,77,255,0.15); }

/* ===== 消息渐入 ===== */
.msg-fade-in {
  animation: msgFadeIn 0.25s ease-out;
}
@keyframes msgFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-page { max-width: 100%; margin: 0 auto; padding: 12px 16px; height: calc(100vh - 64px); display: flex; flex-direction: column; }
.chat-layout {
  display: grid;
  grid-template-columns: 260px 1fr 280px;
  gap: 12px;
  flex: 1;
  min-height: 0;
}
.chat-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.chat-sidebar-rec {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.sidebar-header {
  padding: 16px;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
}
.chat-char-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border);
}
.chat-char-item:hover { background: var(--surface2); }
.chat-char-item.active { background: var(--surface2); border-left: 3px solid var(--accent); }
.chat-char-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--border);
  flex-shrink: 0;
}
.chat-char-name { font-size: 13px; }

/* ===== 推荐角色侧边栏 ===== */
.rec-header {
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.rec-list { overflow-y: auto; flex: 1; }
.rec-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.rec-item:hover { background: var(--surface2); }
.rec-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--border);
  flex-shrink: 0;
}
.rec-info { min-width: 0; flex: 1; }
.rec-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-desc { font-size: 11px; color: var(--text2); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.chat-top {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
}
.chat-top-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
}
.chat-top-name { font-weight: 600; font-size: 15px; }
.chat-top-del { display: none; }  /* 桌面端隐藏 */
.chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}
.msg {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.7;
  word-break: break-word;
  white-space: pre-wrap;
}
.msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), #9b3dff);
  color: #fff;
  border-radius: 12px 12px 0 12px;
}
.msg-ai {
  align-self: flex-start;
  background: var(--surface2);
  border-radius: 12px 12px 12px 0;
}
.msg-streaming { opacity: 0.9; }
.chat-status-bar {
  display: flex;
}
.st-badge {
  padding: 5px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  background: linear-gradient(135deg, rgba(196,77,255,0.12), rgba(255,107,157,0.08));
  border: 1px solid rgba(196,77,255,0.2);
  color: var(--accent2);
  white-space: nowrap;
}
.chat-input {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
}
.chat-input textarea {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  min-height: 44px;
  max-height: 120px;
}
.chat-input textarea:focus { border-color: var(--accent); }
.chat-input button {
  padding: 0 24px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}
.chat-input button:hover { box-shadow: 0 4px 20px rgba(196,77,255,0.3); }
.chat-input button:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  font-size: 15px;
}

/* ===== 用户中心 ===== */
.user-center { width: 100%; margin: 0 auto; padding: 20px 16px; }
.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
}
.profile-card h3 { font-size: 18px; font-weight: 600; margin-bottom: 20px; }
.profile-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.profile-row:last-child { border-bottom: none; }
.profile-label { color: var(--text2); }
.profile-value { font-weight: 600; }

.recharge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.recharge-card {
  background: linear-gradient(135deg, var(--surface), var(--surface2));
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.recharge-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(196,77,255,0.2);
}
.recharge-credits {
  font-size: 24px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold), #ff8c5a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.rc-num {
  font-size: 16px;
  font-weight: 800;
  color: var(--gold);
  line-height: 1.3;
}
.rc-price { font-size: 13px; color: var(--text2); margin-top: 4px; }
.rc-bonus { font-size: 11px; color: var(--green); margin-top: 2px; }

/* 隐藏数字输入框上下箭头 */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

/* ===== 一键签到按钮 ===== */
.header-checkin {
  display: flex; align-items: center; justify-content: center;
  padding: 4px 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255,179,71,0.15), rgba(255,140,90,0.1));
  cursor: pointer;
  font-size: 12px; font-weight: 600;
  color: var(--gold);
  transition: all 0.2s;
  flex-shrink: 0;
  white-space: nowrap;
}
.header-checkin:hover { background: linear-gradient(135deg, rgba(255,179,71,0.3), rgba(255,140,90,0.2)); }
.header-checkin.checked { background: rgba(74,222,128,0.12); color: var(--green); cursor: default; pointer-events: none; }

/* ===== 搜索历史 ===== */
.search-history {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  z-index: 50;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.search-history-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.12s;
}
.search-history-item:last-child { border-bottom: none; }
.search-history-item:hover { background: var(--surface2); }
.search-history-item .sh-time { font-size: 10px; color: var(--text2); }
.search-history-clear {
  padding: 8px 14px;
  text-align: center;
  font-size: 11px;
  color: var(--text2);
  cursor: pointer;
  border-top: 1px solid var(--border);
}
.search-history-clear:hover { color: var(--danger); }
.recharge-bonus { font-size: 12px; color: var(--green); margin-top: 4px; }
.recharge-hint { margin-top: 14px; font-size: 12px; color: var(--text2); }

.order-table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 14px; }
.order-table th { text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--border); color: var(--text2); font-weight: 500; }
.order-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.status-pending { color: var(--gold); }
.status-paid { color: var(--green); }

/* ===== 弹窗 ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  width: 400px;
  max-width: 92vw;
}
.modal h2 {
  font-size: 22px;
  text-align: center;
  margin-bottom: 24px;
  font-weight: 700;
}
.form-group { margin-bottom: 14px; }
.form-group input,
.sec-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.form-group input:focus,
.sec-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(196,77,255,0.15);
}
.form-select {
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  outline: none;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(196,77,255,0.15);
}
.form-row { display: flex; gap: 12px; }
.form-row .form-group { margin-bottom: 0; }
.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 6px;
  font-weight: 500;
}
.form-error { color: var(--danger); font-size: 13px; text-align: center; margin-bottom: 12px; min-height: 20px; }
.form-switch { text-align: center; margin-top: 18px; font-size: 14px; color: var(--text2); }
.form-switch a { color: var(--accent); cursor: pointer; font-weight: 600; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 300;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  animation: slideIn 0.3s ease;
}
.toast-success { background: rgba(74,222,128,0.9); color: #fff; }
.toast-error { background: rgba(248,113,113,0.9); color: #fff; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: none; opacity: 1; } }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  /* 导航栏 */
  .header { height: auto; padding: 4px 8px; flex-wrap: wrap; gap: 4px; min-height: auto; }
  .logo { font-size: 16px; flex-shrink: 0; }
  .hero-stats-nav { display: none; }
  /* ★ 导航标签独占第二行 */
  .nav-tabs { width: 100%; order: 3; overflow-x: auto; justify-content: flex-start; gap: 8px; -webkit-overflow-scrolling: touch; padding: 2px 0; }
  .nav-tab { padding: 4px 10px; font-size: 12px; white-space: nowrap; flex-shrink: 0; }
  .header-right { margin-left: auto; flex-shrink: 0; min-width: 0; }

  /* 标题栏 */
  .hero { padding: 12px 10px 10px; }
  .hero-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .hero-left h1 { font-size: 20px; }
  .hero-left p { font-size: 11px; }
  .hero-search { width: 100%; }
  .hero-search input { flex: 1; width: auto; }
  .hero-tags { gap: 4px 6px; }
  .hero-tag { padding: 3px 10px; font-size: 11px; }
  .hero-tag:nth-child(3n),
  .hero-tag:nth-child(5n+1),
  .hero-tag:nth-child(7n) { transform: none !important; }

  /* 角色广场 */
  .section { padding: 0 8px 24px; }
  .section-header { margin-bottom: 10px; }
  .section-header h2 { font-size: 16px; }
  .char-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
  .char-card-info { padding: 8px 10px; }
  .char-card-name { font-size: 12px; }
  .char-card-meta { font-size: 10px; }

  /* 聊天 */
  .chat-page { padding: 8px; height: calc(100vh - 56px); }
  .chat-layout { display: flex; flex-direction: column; height: 100%; }
  .chat-main { flex: 1; min-height: 0; display: flex; flex-direction: column; }

  /* ★ 侧栏改为横向头像滚动条 */
  .chat-sidebar {
    max-height: 60px; min-height: 60px;
    overflow-x: auto; overflow-y: hidden;
    flex-direction: row; flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-radius: 8px 8px 0 0;
    padding: 2px 6px; gap: 8px;
    align-items: center;
  }
  .chat-sidebar::-webkit-scrollbar { display: none; }
  .sidebar-header { display: none; }
  /* ★ 角色列表容器也设为横向 */
  #chat-char-list {
    display: flex; flex-direction: row; gap: 10px;
    align-items: center; min-width: min-content;
  }
  .chat-char-item {
    position: relative; flex-shrink: 0; gap: 0; padding: 0;
    border-radius: 50%; border: 2px solid transparent;
    transition: border-color 0.2s;
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
  }
  .chat-char-item.active { border-color: var(--accent); background: transparent; }
  .chat-char-item.pinned { border-color: var(--gold); }
  .chat-char-main { padding: 0; flex: none; width: 100%; height: 100%; }
  .chat-char-avatar { width: 100%; height: 100%; border-radius: 50%; margin: 0; }
  .chat-char-initial { width: 100% !important; height: 100% !important; }
  .chat-char-name { display: none; }
  .chat-pin-icon { display: none; }
  /* ★ 删除按钮浮在头像右上角 */
  .chat-char-actions {
    position: absolute; top: -3px; right: -3px; z-index: 2;
    width: 18px; height: 18px; border-radius: 50%;
    background: rgba(248,113,113,0.92); color: #fff;
    font-size: 9px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; line-height: 1;
  }
  .chat-char-actions .chat-action-btn:first-child { display: none; }
  .chat-char-actions .chat-action-btn {
    width: 100%; height: 100%; padding: 0; border: none; background: none;
    color: inherit; font-size: inherit; line-height: 1;
    display: flex; align-items: center; justify-content: center;
  }
  .chat-char-actions .chat-action-btn:hover { background: none; }
  /* ★ 手机端：侧栏不显示删除，改为顶部栏显示 */
  .chat-char-actions { display: none !important; }
  .chat-top-del {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 50%;
    background: rgba(248,113,113,0.15); color: rgba(248,113,113,0.85);
    border: none; cursor: pointer; font-size: 12px; line-height: 1;
    flex-shrink: 0; margin-left: 4px;
  }
  .chat-sidebar-rec { display: none; }
  /* ★ 侧栏空状态 */
  .chat-sidebar .empty-state { display: none; }

  /* ★ 消息区撑满 */
  .chat-msgs { padding: 10px 12px; gap: 8px; flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .chat-top { padding: 8px 12px; flex-shrink: 0; min-height: 44px; }
  .chat-input { padding: 8px 12px; gap: 6px; flex-shrink: 0; }
  .chat-status-bar { padding: 6px 12px; gap: 4px; flex-shrink: 0; }
  /* ★ 按钮触摸优化 */
  .hist-action-btn, .msg-actions button { padding: 8px 14px !important; font-size: 13px !important; min-height: 36px; }
  .st-badge { font-size: 11px; padding: 3px 8px; }

  /* 个人中心 */
  .user-center { padding: 12px 8px; }
  .user-center > div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .profile-card { padding: 16px; margin-bottom: 12px; }
  .profile-card h3 { font-size: 15px; margin-bottom: 12px; }
  .profile-row { flex-direction: column; gap: 2px; }
  .profile-label { width: auto; font-size: 11px; }
  .profile-value { font-size: 13px; }
  .recharge-grid { grid-template-columns: 1fr 1fr !important; gap: 8px; }
  .recharge-card { padding: 12px 8px; }
  .rc-num { font-size: 14px; }
  .rc-price { font-size: 11px; }
  .vip-upgrade-card { padding: 12px; }
  .order-table { font-size: 10px; }
  .order-table th, .order-table td { padding: 6px 4px; }

  /* 消息 */
  .msg { max-width: 95%; padding: 10px 14px; font-size: 13px; }
  .msg-ai { font-size: 13px; }

  /* 表单两栏变单栏 */
  .form-row { flex-direction: column; gap: 0; }
  .form-row .form-group { margin-bottom: 14px; }
}

@media (min-width: 769px) {
.chat-char-item{display:flex;align-items:center;justify-content:space-between;padding:0;overflow:hidden}
.chat-char-main{display:flex;align-items:center;gap:10px;flex:1;padding:10px 14px;cursor:pointer;min-width:0}
.chat-char-item:hover{background:var(--surface2)}
.chat-char-item.active{background:var(--surface2);border-left:3px solid var(--accent)}
.chat-char-item.pinned .chat-char-name{color:var(--accent)}
.chat-pin-icon{font-size:10px;flex-shrink:0}
.chat-char-actions{display:flex;gap:2px;padding-right:6px;flex-shrink:0}
.chat-action-btn{background:none;border:none;color:var(--text2);cursor:pointer;font-size:14px;padding:4px;border-radius:4px;line-height:1;transition:all .2s}
.chat-action-btn:hover{background:var(--border);color:var(--text)}
}
.chat-del-btn:hover{color:var(--danger)}
