* {
  -webkit-tap-highlight-color: transparent;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  background: #f2f2f2;
  margin: 0;
  padding: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  font-family: 'Inter', system-ui, sans-serif;
  overscroll-behavior: none;
}
.phone {
  width: 100%;
  height: 100%;
  background: #fff;
  border-radius: 0;
  box-shadow: none;
  border: none;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.phone-inner {
  position: absolute;
  inset: 0;
  background: #000;
  border-radius: 0;
  overflow: hidden;
}
.screen {
  width: 100%;
  height: 100%;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.status-bar {
  padding: 8px 24px 8px;
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 500;
}
.status-icons {
  display: flex;
  gap: 6px;
  font-size: 12px;
}
.page {
  flex: 1;
  padding: 0;
  display: none;
  flex-direction: column;
}
.page.active {
  display: flex;
}
#home-page {
  padding: 8px 24px;
}
.top-banner {
  width: 100%;
  height: 155px;
  background: #f8f9fa;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  gap: 6px;
}
.banner-avatar {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 3px solid #fff;
  overflow: hidden;
  cursor: pointer;
}
.banner-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#banner-avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e9ecef;
  color: #adb5bd;
}
.banner-username {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}
.hidden {
  display: none !important;
}
.row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}
.grid4 {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 12px;
}
.grid4 button {
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  color: #000;                /* 修复 iOS 蓝色图标 */
}
.icon-box {
  width: 100%;
  aspect-ratio: 1/1;
  border-radius: 16px;
  border: 1px solid #eee;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.grid4 span {
  font-size: 12px;
  margin-top: 6px;
  font-weight: 500;
}
.pic-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.pic-box {
  width: 100%;
  aspect-ratio: 1/1;
  border-radius: 16px;
  border: 1px solid #eee;
  background: #f9f9f9;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.pic-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #999;
  font-size: 12px;
  gap: 6px;
}
.placeholder i {
  font-size: 24px;
}
.custom-text {
  margin-top: 8px;
  font-size: 15px;
  font-weight: 500;
  color: #333;
  position: relative;
}
.custom-text::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: #e0e0e0;
  border-radius: 1px;
}
.custom-text.italic {
  font-style: italic;
}
.bottom-nav {
  margin-top: auto;
  border-radius: 35px;
  border: 1px solid #eee;
  padding: 20px 30px;
  display: flex;
  justify-content: space-around;
}
.nav-btn {
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: #999;
}
.nav-btn.active {
  color: #000;
}
.nav-icon {
  width: 45px;
  height: 45px;
  border-radius: 12px;
  border: 1px solid #eee;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========= 聊天页面样式 ========= */
#chat-page {
  height: 100%;
  overflow: hidden;
}
#chat-views-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  font-weight: 600;
  background: #fff;
  flex-shrink: 0;
}
.back-btn, .header-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  width: 40px;
  color: #000;                /* 修复 iOS 蓝色图标 */
}
.conversation-list {
  flex: 1;
  overflow-y: auto;
}
.conversation-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 0.5px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.2s;
  position: relative;
}
.conversation-item:active {
  background: #f5f5f5;
}
.conv-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #e5e5ea;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  color: #8e8e93;
  font-size: 24px;
}
.conv-info {
  flex: 1;
}
.conv-name {
  font-size: 16px;
  font-weight: 500;
}
.conv-last-msg {
  font-size: 13px;
  color: #8e8e93;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.conv-time {
  font-size: 11px;
  color: #c6c6c8;
}
.conv-delete {
  background: none;
  border: none;
  font-size: 18px;
  color: #ff3b30;
  cursor: pointer;
  padding: 8px;
  margin-left: 8px;
  opacity: 0;
  transition: opacity 0.2s;
}
.conversation-item:hover .conv-delete,
.conversation-item:active .conv-delete {
  opacity: 1;
}
.chat-view {
  display: none;
  flex-direction: column;
  flex: 1;
  height: 100%;
  overflow: hidden;
}
.chat-view.active-view {
  display: flex;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}
.chat-input-area {
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 8px 12px;
  gap: 8px;
  border-top: 1px solid #eee;
  background: #fff;
  flex-shrink: 0;
}
.input-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  color: #555;                /* 已经有颜色，无需修改 */
}
#chat-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 8px 12px;
  outline: none;
  font-size: 14px;
  resize: none;
  max-height: 100px;
  font-family: inherit;
}
#send-btn {
  background: #007aff;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 40px;
  color: white;
  font-size: 18px;
  cursor: pointer;
}
/* 底部 TabBar - 整体圆角悬浮卡片 */
.wechat-tabbar {
  background: #ffffff;
  border-radius: 30px;
  margin: 0 16px 16px 16px;
  padding: 8px 16px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* 单个 tab 按钮（无文字） */
.tab-btn {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8e8e93;
  font-size: 24px;
  padding: 10px 0;
  border-radius: 40px;
  transition: all 0.2s ease;
  cursor: pointer;
}

/* 激活状态 - 颜色变深 */
.tab-btn.active {
  color: #4a4a4a;
}

/* 点击反馈 */
.tab-btn:active {
  transform: scale(0.92);
  opacity: 0.7;
}
.emoji-panel {
  background: #fff;
  border-top: 1px solid #eee;
  padding: 12px;
  display: none;
  justify-content: center;
  flex-wrap: wrap;
}
.emoji-panel.show {
  display: flex;
}
.emoji-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}
.emoji {
  font-size: 28px;
  cursor: pointer;
  padding: 8px;
  transition: transform 0.1s;
}
.emoji:active {
  transform: scale(1.2);
}
.contacts-list, .discover-list {
  flex: 1;
  padding: 12px;
}
.contact-item, .discover-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 0.5px solid #f0f0f0;
}
.contact-item i, .discover-item i {
  width: 28px;
  font-size: 20px;
  color: #555;                /* 已有颜色 */
}
.me-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  background: #f8f8f8;
  margin-bottom: 16px;
}
.me-avatar {
  margin-bottom: 12px;
}
.me-name {
  font-size: 18px;
  font-weight: 600;
}
.me-desc {
  font-size: 12px;
  color: #8e8e93;
  margin-top: 4px;
}
.me-options {
  padding: 0 16px;
}
.me-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 0.5px solid #f0f0f0;
}
.me-option i {
  width: 28px;
  font-size: 20px;
  color: #555;                /* 已有颜色 */
}

/* ========= 设置页面样式 ========= */
.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  font-weight: 600;
}
.settings-list {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.setting-item span:first-child {
  font-weight: 500;
  width: 80px;
}
/* 修复设置页箭头图标颜色 */
.setting-item .fa-chevron-right {
  color: #999;
}
#settings-nickname {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 20px;
  outline: none;
}
.danger-btn {
  background: #ff3b30;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 30px;
  cursor: pointer;
  width: 100%;
}

/* ========= 朋友圈样式 ========= */
#moments-page {
  background: #f5f5f5;
  position: relative;
  overflow: hidden;
  height: 100%;
}
.moments-cover {
  position: relative;
  width: 100%;
  height: 200px;
  background-color: #ccc;
  overflow: hidden;
  cursor: pointer;
}
.moments-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cover-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(to top, rgba(0,0,0,0.3), transparent);
  pointer-events: none;
}
.cover-back-btn, .cover-camera-btn {
  position: absolute;
  top: 12px;
  background: rgba(0,0,0,0.5);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
  z-index: 5;
}
.cover-back-btn {
  left: 12px;
}
.cover-camera-btn {
  right: 12px;
}
.cover-back-btn:active, .cover-camera-btn:active {
  background: rgba(0,0,0,0.7);
}
.moments-profile {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 0 16px 12px;
  margin-top: -30px;
  position: relative;
  z-index: 2;
}
.profile-avatar {
  position: relative;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  margin-left: 12px;
  cursor: pointer;
}
.profile-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.avatar-edit-btn {
  display: none !important;
}
.profile-info {
  text-align: right;
  margin-right: 8px;
  margin-bottom: 8px;
}
.profile-nickname {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  cursor: pointer;
}
.profile-signature {
  font-size: 12px;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 1px 1px rgba(0,0,0,0.2);
  margin-top: 4px;
  cursor: pointer;
}
.moments-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #f5f5f5;
  padding: 12px;
}
.moment-item {
  display: flex;
  gap: 12px;
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.moment-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
}
.moment-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.moment-content {
  flex: 1;
}
.moment-name {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 6px;
  color: #333;
}
.moment-text {
  font-size: 14px;
  color: #111;
  margin-bottom: 8px;
  line-height: 1.4;
}
.moment-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

/* ===== 卡片与便签融合样式 ===== */
.text-card {
  background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
  border-radius: 12px 0 0 12px;
  border-right: none;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100px;
  height: 100px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  transition: transform 0.1s;
  flex-shrink: 0;
}
.text-card:active {
  transform: scale(0.96);
}
.text-card-icon {
  font-size: 32px;
  margin-bottom: 8px;
}
.text-card-title {
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  word-break: break-word;
}
.moment-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #8e8e93;
  font-size: 12px;
}
.moment-like-btn {
  background: none;
  border: none;
  font-size: 14px;
  color: #8e8e93;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}
.moment-like-btn i.fa-heart {
  color: #ff3b30;
}
#publish-cards-preview .text-card {
  width: 80px;
  height: 80px;
  background: #f0f0f0;
}
.data-action-btn {
  background: #758291;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
}

/* ========= 通用弹窗样式 ========= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s;
}
.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}
.modal-container {
  background: rgba(255, 255, 255, 0.95);
  width: 85%;
  max-width: 320px;
  border-radius: 28px;
  padding: 20px 20px 24px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
  transform: scale(0.96);
  transition: transform 0.2s cubic-bezier(0.2,0.9,0.4,1.1);
  position: relative;
}
.modal-overlay.show .modal-container {
  transform: scale(1);
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  color: #666;
  transition: background 0.2s;
}
.modal-close:hover {
  background: rgba(0,0,0,0.1);
}
.modal-title {
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 16px;
  padding-right: 24px;
}
.modal-content {
  margin-bottom: 24px;
  font-size: 14px;
  color: #333;
  line-height: 1.4;
}
.modal-input, .modal-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  transition: border 0.2s;
  background: #fff;
}
.modal-input:focus, .modal-textarea:focus {
  border-color: #758291;
}
.modal-textarea {
  resize: vertical;
  min-height: 80px;
}
.modal-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.modal-btn {
  flex: 1;
  padding: 10px;
  border-radius: 40px;
  border: none;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}
.modal-btn.confirm {
  background: #758291;
  color: white;
}
.modal-btn.cancel {
  background: #e5e5ea;
  color: #333;
}
.modal-btn:active {
  opacity: 0.7;
}

/* ========= 添加好友页面样式 ========= */
#new-friend-page {
  background: #f8f8f8;
}
.friend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #eee;
}
.friend-header .back-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
}
.save-btn {
  background: #758291;
  color: white;
  border: none;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
}
.friend-form {
  padding: 20px 16px;
}
.form-item {
  margin-bottom: 20px;
}
.form-item label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: #333;
}
.form-item .required {
  color: #ff3b30;
}
.form-item input, .form-item textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 12px;
  font-size: 14px;
  outline: none;
  transition: border 0.2s;
  font-family: inherit;
  background: #fff;
}
.form-item input:focus, .form-item textarea:focus {
  border-color: #758291;
}
.avatar-item .avatar-picker {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.avatar-picker img, .avatar-picker .avatar-placeholder {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  object-fit: cover;
  background: #e9ecef;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: #adb5bd;
}
.avatar-picker img {
  display: none;
}
.upload-btn {
  background: #f0f0f0;
  border: none;
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 14px;
  cursor: pointer;
}
.status-message {
  margin-top: 12px;
  font-size: 12px;
  color: #666;
  text-align: center;
}
#api-temperature {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: #e2edf6;
  border-radius: 3px;
  outline: none;
}
#api-temperature::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #758291;
  cursor: pointer;
}
#temp-value {
  font-weight: 500;
  color: #1b0606;
}
#api-key, #api-base-url {
  border-radius: 20px;
  padding: 10px 16px;
  margin-bottom: 4px;
}
#api-model-select, #api-model-custom {
  border-radius: 20px;
  padding: 10px 16px;
}
#api-settings-page input,
#api-settings-page select,
#api-settings-page textarea {
  border-color: #f0f1f1ed;
}
#api-settings-page input:focus,
#api-settings-page select:focus,
#api-settings-page textarea:focus {
  border-color: #ebebeb;
  box-shadow: 0 0 0 2px rgba(117, 130, 145, 0.2);
  outline: none;
}

/* ========= 面具页面样式 ========= */
#mask-page {
  background: #f8f8f8;
}
.mask-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #eee;
}
.mask-header .back-btn, .mask-header .header-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  width: 40px;
}
.mask-list {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.mask-item {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.mask-info {
  flex: 1;
}
.mask-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  color: #333;
}
.mask-desc {
  font-size: 13px;
  color: #666;
  line-height: 1.4;
}
.mask-delete {
  background: none;
  border: none;
  font-size: 20px;
  color: #ff3b30;
  cursor: pointer;
  padding: 8px;
  margin-left: 8px;
}
.empty-mask {
  text-align: center;
  color: #999;
  padding: 40px;
  font-size: 14px;
}
.mask-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #e5e5ea;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  overflow: hidden;
  flex-shrink: 0;
}
.mask-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mask-default-avatar {
  font-size: 32px;
  color: #8e8e93;
}
.mask-persona {
  font-size: 13px;
  color: #666;
  margin-top: 4px;
  line-height: 1.4;
}
.mask-info {
  flex: 1;
}

/* ========= 加号扩展面板 ========= */
.plus-panel {
  position: absolute;
  bottom: 70px;
  left: 12px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: none;
  flex-direction: column;
  padding: 8px;
  z-index: 10;
  width: 120px;
}
.plus-panel.show {
  display: flex;
}
.panel-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  padding: 10px 12px;
  width: 100%;
  text-align: left;
  font-size: 14px;
  cursor: pointer;
  border-radius: 12px;
}
.panel-item i {
  width: 24px;
  font-size: 18px;
  color: #555;
}
.panel-item:active {
  background: #f0f0f0;
}
#magic-btn {
  color: #e6cb1d;
}
#plus-panel {
  display: none;
}
#plus-panel.show {
  display: flex;
}

/* ========= 聊天设置页面样式 ========= */
.chat-settings-list {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-settings-item {
  background: #fff;
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background 0.2s;
}
.chat-settings-item:active {
  background: #f5f5f5;
}
.item-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #758291;
}
.item-info {
  flex: 1;
}
.item-title {
  font-size: 16px;
  font-weight: 500;
  color: #333;
}
.item-sub {
  font-size: 12px;
  color: #8e8e93;
  margin-top: 2px;
}
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: #758291;
}
input:checked + .slider:before {
  transform: translateX(20px);
}

/* ========= 终极稳定版消息布局（气泡+头像） ========= */
.message-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
}
.message-wrapper.user {
  flex-direction: row-reverse;
}
.message-wrapper.bot {
  flex-direction: row;
}
.message-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: #e5e5ea;
  display: flex;
  align-items: center;
  justify-content: center;
}
.message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.default-avatar {
  font-size: 28px;
  color: #8e8e93;
  line-height: 1;
}
.message-bubble {
  max-width: 70%;
}
.message {
  padding: 10px 14px;
  border-radius: 20px;
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
  white-space: normal;
}
.user-message {
  background-color: #2c2c2e;
  color: white;
  border-bottom-right-radius: 4px;
}
.bot-message {
  background-color: #ffffff;
  color: #111;
  border: 0.5px solid #e5e5ea;
  border-bottom-left-radius: 4px;
}
.message-image {
  max-width: 100%;
  max-height: 200px;
  border-radius: 12px;
  margin-top: 4px;
  display: block;
}
.message-time {
  font-size: 10px;
  color: #999;
  margin-top: 6px;
  text-align: right;
  line-height: 1.2;
}
.chat-messages {
  gap: 12px;
}

/* ========= 世界书模块样式（毛玻璃版） ========= */
#world-page {
  background: #f8f8f8;
}
.world-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #eee;
}
.world-header .back-btn,
.world-header .header-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  width: 40px;
}
.world-list {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.world-item {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(8px);
  border-radius: 24px;
  padding: 18px 16px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.02);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.5);
}
.world-item:active {
  background: rgba(255, 255, 255, 0.9);
  transform: scale(0.98);
}
.world-item-title {
  font-size: 17px;
  font-weight: 600;
  color: #1f2d3d;
  margin-bottom: 6px;
}
.world-item-title::before {
  display: none;
}
.world-item-category {
  font-size: 12px;
  color: #5b6778;
  background: rgba(0, 0, 0, 0.04);
  padding: 2px 10px;
  border-radius: 30px;
  display: inline-block;
  margin-bottom: 8px;
}
.world-item-preview {
  font-size: 13px;
  color: #2c3e50;
  line-height: 1.4;
  margin-top: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  opacity: 0.8;
}
.empty-world {
  text-align: center;
  padding: 60px 20px;
  color: #8e8e93;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(4px);
  border-radius: 32px;
  margin-top: 40px;
}
.world-main {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.world-entry-card {
  background: #fff;
  border-radius: 20px;
  padding: 24px 20px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  cursor: pointer;
  transition: 0.2s;
}
.world-entry-card:active {
  background: #f5f5f5;
  transform: scale(0.98);
}
.world-entry-card i {
  font-size: 48px;
  color: #758291;
  margin-bottom: 12px;
}
.world-entry-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: #333;
}
.world-entry-card p {
  font-size: 13px;
  color: #8e8e93;
}
.role-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 20px;
  font-size: 14px;
  background: #fff;
  margin-bottom: 12px;
}
.world-detail-content {
  max-height: 60vh;
  overflow-y: auto;
}
.world-detail-title {
  font-weight: 600;
  font-size: 18px;
  margin-bottom: 12px;
  color: #333;
}
.world-detail-text {
  font-size: 14px;
  line-height: 1.5;
  color: #444;
  white-space: pre-wrap;
}
.world-item-category i {
  color: #758291;
  font-size: 13px;
  vertical-align: middle;
  margin-right: 2px;
}

/* ========= 朋友圈评论样式 ========= */
.moment-comments {
  margin-top: 8px;
  padding: 8px 0;
  border-top: 0.5px solid #eee;
}
.comment-item {
  font-size: 13px;
  color: #333;
  padding: 2px 0;
}
.comment-name {
  font-weight: 600;
  color: #758291;
}
.moment-actions {
  display: flex;
  gap: 16px;
}
.moment-comment-btn {
  background: none;
  border: none;
  font-size: 14px;
  color: #8e8e93;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ========= 文字卡片包装器 ========= */
.text-card-wrapper {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-bottom: 4px;
}

/* ========= 便签风格右侧展开面板（完整融合版） ========= */
.text-card-expand {
  max-width: 0;
  overflow: hidden;
  background: #fef9e7;
  border-radius: 0 12px 12px 0;
  height: 100px;
  padding: 0;
  margin-left: 0;
  font-size: 13px;
  color: #3a3a3a;
  line-height: 1.5;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.04);
  border-left: none;
  transition: max-width 0.3s ease, padding 0.3s ease;
  white-space: normal;
  word-break: break-word;
  position: relative;
  overflow-y: auto;
  scrollbar-width: thin;
}

.text-card-expand::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 0 0 3px 0;
  background: var(--bar-color, #e6cba0);
}

.text-card-expand.open {
  max-width: 240px;
  min-width: 80px;
  padding: 14px 12px;
  margin-left: 0;
}

.expand-note {
  position: absolute;
  bottom: 4px;
  right: 8px;
  font-size: 9px;
  font-style: italic;
  color: #999;
  letter-spacing: 0.3px;
  pointer-events: none;
}

/* 卡片内图标与提示 */
.text-card .card-icon {
  font-size: 28px;
  color: #b0b8c1;
  margin-bottom: 4px;
  transition: transform 0.2s;
}
.text-card:active .card-icon {
  transform: scale(1.15) rotate(-5deg);
}
.text-card .card-hint {
  font-size: 11px;
  color: #b0b8c1;
  font-weight: 400;
  text-align: center;
}
/* ========= 心声弹窗样式（文艺日记风） ========= */
.heart-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2100;
}

.heart-modal-content {
  width: 85%;
  max-width: 340px;
  background: #fef9ef;  /* 米白纸张底色 */
  border-radius: 28px;
  padding: 24px 24px 28px;
  box-shadow: 0 20px 35px -12px rgba(0, 0, 0, 0.2), 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease;
  position: relative;
}

/* 昵称区域（无右侧按钮） */
.heart-header-area {
  display: flex;
  justify-content: center;
  align-items: baseline;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e6dfd1;
}

.heart-role-name {
  font-size: 18px;
  font-weight: 600;
  color: #2c2c2c;
  letter-spacing: 0.5px;
  text-align: center;
}

/* 底部按钮区域 */
.heart-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

.heart-history-btn {
  background: none;
  border: none;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #b0a28a;
  cursor: pointer;
  padding: 6px 12px;
  transition: color 0.2s;
  border-radius: 20px;
}

.heart-history-btn:hover,
.heart-history-btn:active {
  color: #7f6e5a;
  background: rgba(0,0,0,0.03);
}

/* 主体内容区 */
.heart-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 8px;
}

/* 心声字段 */
.heart-field {
  line-height: 1.5;
}

.heart-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #b0a28a;
  margin-bottom: 6px;
}

.heart-text {
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
  color: #3a352c;
  word-break: break-word;
  white-space: pre-wrap;
}

/* 心声下方的英文装饰 */
.heart-english-note {
  font-size: 10px;
  font-style: italic;
  color: #c9bcab;
  text-align: right;
  margin-top: 8px;
  letter-spacing: 0.3px;
}

/* 状态字段 */
.heart-status {
  font-size: 13px;
  font-weight: 400;
  font-style: italic;
  color: #7f6e5a;
}

/* 位置字段 */
.heart-location {
  font-size: 13px;
  font-weight: 400;
  color: #7f6e5a;
  font-style: italic;
}

.heart-locate-link {
  font-size: 12px;
  font-weight: 500;
  color: #9b7b5c;
  text-decoration: underline;
  cursor: pointer;
  margin-left: 4px;
}

.heart-locate-link:active {
  color: #7f5e3c;
}

/* 底部不需要按钮，留空或可放额外装饰 */
.heart-footer {
  display: none;
}
