/* ===========================
   work-chat.css (已优化版本)
   
   优化记录：
   - 移除了所有与 .page-transition, .transition-circle, .transition-particles 相关的CSS规则。
     这部分动画功能现已由 `background-animation.js` 中的 Canvas 引擎接管。
=========================== */

/* ===========================
   基础样式和重置
=========================== */
:root {
  --primary-color: #49a0ff;
  --primary-dark: #2977c9;
  --primary-light: #a9d4ff;
  --secondary-color: #7e4dff;
  --accent-color: #ff6b9d;
  --bg-dark: #0a0a1a;
  --bg-medium: #1a1a2e;
  --bg-light: #2a2a3e;
  --text-light: #ffffff;
  --text-gray: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.5);
  --danger-color: #ff6b6b;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 5px 20px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.25);
  --ai-msg-bg: rgba(73, 160, 255, 0.15);
  --user-msg-bg: rgba(126, 77, 255, 0.15);
  --transition-speed: 0.3s;
  --border-radius: 12px;
  --panel-width: 320px;
}

* { 
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', 'Noto Sans', Arial, sans-serif;
}

body, html {
  height: 100%;
  background: var(--bg-dark);
  color: var(--text-light);
  overflow: hidden;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb {
  background: rgba(73, 160, 255, 0.5);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(73, 160, 255, 0.8);
}

button {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  outline: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

textarea, input {
  outline: none;
  font-size: 16px;
}

/* ===========================
 背景样式 - Canvas接管动态部分
=========================== */
.chat-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -10;
    overflow: hidden;
    pointer-events: none;
}

.bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    z-index: -14;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.bg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    z-index: -13;
    pointer-events: none;
}

/* 新增：Canvas容器样式 */
#dynamicBackgroundCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -12;
    pointer-events: none;
}

/* 确保其他主容器不会覆盖背景 */
.page-container {
    position: relative;
    z-index: 1;
    background-color: transparent !important; /* 移除任何背景色 */
}

.chat-container, .chat-history {
    background-color: transparent !important;
}

/* 清除主页面的所有背景色 */
body, html, main {
    background-color: transparent !important;
}

/* ===========================
   布局容器
=========================== */
.page-container {
  display: flex;
  flex-direction: column;
  height: 100%; /* <-- 将 vh 改为 % */
  position: relative;
  overflow: hidden;
}

/* ===========================
   顶部导航栏
=========================== */
.chat-header {
  height: 60px;
  background: rgba(26, 26, 46, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 10;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
}

.header-title {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.header-title h1 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-light);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.ai-status {
  display: flex;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-gray);
  margin-top: 3px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: #4ade80;
  border-radius: 50%;
  margin-right: 6px;
  position: relative;
}

.status-dot::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  width: 12px;
  height: 12px;
  background-color: rgba(74, 222, 128, 0.3);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse-status-dot { /* 重命名以避免冲突 */
  0% {
    transform: scale(1);
    opacity: 1;
  }
  70% {
    transform: scale(1.5);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 0;
  }
}
.status-dot::after {
    animation-name: pulse-status-dot;
}


.nav-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(73, 160, 255, 0.1);
  color: var(--text-light);
  font-size: 1.2rem;
  margin: 0 6px;
  position: relative;
  transition: all 0.2s ease;
}

.nav-button:hover {
  background: rgba(73, 160, 255, 0.2);
  transform: translateY(-2px);
}

.nav-button:active {
  transform: translateY(0);
}

.instances-count {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--accent-color);
  color: white;
  font-size: 0.7rem;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===========================
   新增：导航侧边栏样式
=========================== */

.nav-sidebar {
  left: 0;
  transform: translateX(-100%);
  border-right: 1px solid rgba(73, 160, 255, 0.2);
  z-index: 101;
}

.nav-sidebar.show {
  transform: translateX(0);
}

.nav-sidebar .panel-content {
  padding-top: 10px;
  padding-bottom: 10px;
}

.nav-sidebar-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-sidebar-link {
  display: block;
  padding: 15px 25px;
  color: var(--text-gray);
  text-decoration: none;
  font-size: 1rem;
  transition: background-color 0.2s ease, color 0.2s ease, padding-left 0.2s ease;
  border-left: 3px solid transparent;
}

.nav-sidebar-link i {
  margin-right: 15px;
  width: 20px;
  text-align: center;
  color: var(--primary-light);
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.nav-sidebar-link:hover {
  background-color: rgba(73, 160, 255, 0.1);
  color: var(--text-light);
  border-left-color: var(--primary-color);
  padding-left: 22px;
}

.nav-sidebar-link:hover i {
    opacity: 1;
}

.nav-sidebar-link.active {
  background-color: rgba(73, 160, 255, 0.15);
  color: var(--text-light);
  font-weight: 500;
  border-left-color: var(--primary-color);
}

/* ===========================
   聊天区域
=========================== */
.chat-container {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.chat-history {
  height: 100%;
  overflow-y: auto;
  padding: 20px 16px 30px;
  scroll-behavior: smooth;
}

.welcome-message {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 30px 0;
}

.welcome-banner {
    background: linear-gradient(135deg, rgba(73, 160, 255, 0.15), rgba(126, 77, 255, 0.15));
    border-radius: 16px;
    padding: 20px;
    max-width: 90%;
    width: auto;
    display: flex;
    align-items: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(73, 160, 255, 0.2);
    backdrop-filter: blur(8px);
    animation: fadeInUp 0.5s ease-out forwards;
}

.mascot-container {
  flex-shrink: 0;
  margin-right: 20px;
}

.mascot-image {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(73, 160, 255, 0.5);
  box-shadow: 0 0 15px rgba(73, 160, 255, 0.3);
}

.welcome-content h2 {
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--primary-light);
}

.welcome-content p {
  color: var(--text-gray);
  font-size: 0.9rem;
  line-height: 1.4;
}

.message {
    display: flex;
    margin-bottom: 20px;
    position: relative;
    max-width: 85%;
    animation: fadeInMessage 0.3s ease-out forwards;
    width: 100%;
}

.message.user {
    margin-left: auto;
    flex-direction: row-reverse;
}

.message-sender {
    font-size: 0.8rem;
    margin-bottom: 4px;
    color: var(--primary-light);
}

.user .message-sender {
    text-align: right;
    color: var(--secondary-color);
}


@keyframes fadeInMessage {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin: 0 12px;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}


.user .message-avatar {
  background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
}

.message-content-wrapper {
    flex: 1;
    max-width: calc(100% - 64px);
    display: flex;
    flex-direction: column;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    line-height: 1.5;
    word-wrap: break-word;
    max-width: 33vw;
    display: inline-block;
}

.user .message-bubble {
    /* background: var(--user-msg-bg); */ /* [修改] 把这一行注释掉或直接删除 */
    border: 1px solid rgba(0, 0, 0, 0.6);
    border-top-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    margin-left: auto;
}

.ai .message-bubble {
  /* background: var(--ai-msg-bg); */ /* [修改] 把这一行注释掉或直接删除 */
  border: 1px solid rgba(0, 0, 0, 0.6);
  border-top-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  margin-right: auto;
}

.message-text {
  font-size: 0.95rem;
  color: var(--text-light);
  overflow-wrap: break-word;
  word-break: break-word;
  white-space: pre-wrap;
  width: 100% !important;
  display: block !important;
}

.message-text code {
  background: rgba(0, 0, 0, 0.2);
  padding: 2px 4px;
  border-radius: 4px;
  font-family: 'Consolas', 'Courier New', monospace;
}

.message-text pre {
  background: rgba(15, 20, 30, 0.8);
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap ;
  word-wrap: break-word;
  word-break: break-word;
  display: block ;
  width: 100% ;
  box-sizing: border-box ;
  overflow-x: auto ;
  float: none ;
  clear: both ;
  position: relative ;
}


.message-text pre code {
  white-space: pre-wrap ;
  background: transparent;
  padding: 0;
  color: #e0e0e0;
  font-size: 0.9rem;
  line-height: 1.5;
}

.message-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
  display: flex;
  align-items: center;
}

.user .message-time {
  justify-content: flex-end;
}

.message-time .credits {
  margin-left: 6px;
  background: rgba(73, 160, 255, 0.2);
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 0.65rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.ai .message-content.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}


/* ===========================
   输入区域
=========================== */
.input-area {
  padding: 16px;
  background: rgba(26, 26, 46, 0.8);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  z-index: 10;
}

.input-container {
  display: flex;
  align-items: flex-end;
  background: rgba(42, 42, 62, 0.8);
  border-radius: 24px;
  padding: 10px 16px;
  border: 1px solid rgba(73, 160, 255, 0.3);
  transition: all 0.3s ease;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}

.input-container:focus-within {
  border-color: rgba(73, 160, 255, 0.6);
  box-shadow: 0 0 20px rgba(73, 160, 255, 0.2);
}

#chatInput {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-light);
  padding: 8px 0;
  resize: none;
  max-height: 120px;
  overflow-y: auto;
  line-height: 1.5;
}

#chatInput::placeholder {
  color: var(--text-muted);
}

.input-tools {
  display: flex;
  align-items: center;
  margin: 0 10px;
}

.tool-btn {
  color: var(--text-muted);
  font-size: 1.1rem;
  padding: 6px;
  border-radius: 50%;
  transition: all 0.2s ease;
  margin-left: 8px;
}

.tool-btn:hover {
  color: var(--primary-light);
  background: rgba(73, 160, 255, 0.1);
}

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(73, 160, 255, 0.4);
}

.send-btn:disabled {
  background: rgba(73, 160, 255, 0.3);
}

/* ===========================
   状态栏
=========================== */
.status-bar {
  height: 30px;
  background: rgba(10, 10, 26, 0.8);
  color: var(--text-muted);
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.status-right {
  display: flex;
  gap: 12px;
}

.memory-indicator {
  color: var(--text-muted);
}

/* ===========================
   侧边栏面板
=========================== */
.side-panel {
  position: fixed;
  top: 0;
  height: 100%;
  width: var(--panel-width);
  background: rgba(26, 26, 46, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
  z-index: 100;
  transition: transform 0.3s ease-in-out;
  display: flex;
  flex-direction: column;
}

.instances-panel {
  left: 0;
  transform: translateX(-100%);
  border-right: 1px solid rgba(73, 160, 255, 0.2);
}

.controls-panel {
  right: 0;
  transform: translateX(100%);
  border-left: 1px solid rgba(73, 160, 255, 0.2);
}

.side-panel.show {
  transform: translateX(0);
}

.panel-header {
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary-light);
  display: flex;
  align-items: center;
}

.panel-header h3 i {
  margin-right: 8px;
}

.close-panel-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.close-panel-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.panel-search {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.search-container {
  position: relative;
  width: 100%;
}

.search-container input {
  width: 100%;
  padding: 8px 12px;
  padding-right: 36px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  color: var(--text-light);
  transition: all 0.2s ease;
}

.search-container input:focus {
  border-color: var(--primary-color);
  background: rgba(255, 255, 255, 0.15);
}

.search-container i {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.panel-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 聊天实例列表 */
.instances-list {
  display: flex;
  flex-direction: column;
}

.instance-item {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.instance-item:hover {
  background: rgba(73, 160, 255, 0.1);
}

.instance-item.active {
  background: rgba(73, 160, 255, 0.15);
  border-left: 3px solid var(--primary-color);
}

.instance-content {
  flex: 1;
  overflow: hidden;
}

.instance-title {
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.instance-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.instance-actions {
  display: flex;
  align-items: center;
}

.instance-action-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.instance-action-btn:hover {
  background: var(--danger-color);
  color: white;
}

.no-instances {
  padding: 20px;
  text-align: center;
  color: var(--text-gray);
}

/* 控制面板样式 */
.controls-content {
  padding: 0 16px;
}

.control-group {
  margin-bottom: 24px;
  animation: fadeIn 0.3s ease-out;
}

.control-title {
  font-size: 1rem;
  margin-bottom: 10px;
  color: var(--primary-light);
  display: flex;
  align-items: center;
}

.control-title i {
  margin-right: 8px;
  font-size: 0.9rem;
}

.control-item {
  position: relative;
}

.styled-select {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-light);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.95rem;
  appearance: none;
  cursor: pointer;
}

.styled-select:focus {
  border-color: var(--primary-color);
}

.control-item::after {
  content: '\f107';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.custom-model-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-light);
  border: 1px solid var(--primary-color);
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 8px;
}

.toggle-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: .4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--primary-color);
}

input:focus + .toggle-slider {
    box-shadow: 0 0 1px var(--primary-color);
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

#streamingStatus {
    color: var(--text-light);
    font-size: 0.9rem;
}


.full-btn {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-light);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.full-btn i {
  margin-right: 8px;
}

.full-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.primary-btn {
  background: rgba(73, 160, 255, 0.2);
  color: var(--primary-light);
  border: 1px solid rgba(73, 160, 255, 0.3);
}

.primary-btn:hover {
  background: rgba(73, 160, 255, 0.3);
}

.danger-btn {
  background: rgba(255, 107, 107, 0.2);
  color: var(--danger-color);
  border: 1px solid rgba(255, 107, 107, 0.3);
}

.danger-btn:hover {
  background: rgba(255, 107, 107, 0.3);
}

.bg-preview-container {
  margin-bottom: 10px;
}

.bg-preview {
  width: 100%;
  height: 100px;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background: var(--bg-medium);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.bg-btns {
  display: flex;
  gap: 8px;
}

.bg-btn {
  flex: 1;
  padding: 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-light);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  cursor: pointer;
}

.bg-btn i {
  margin-right: 6px;
}

.bg-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.action-btn {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.action-btn i {
  margin-right: 8px;
}

.create-btn {
  background: rgba(73, 160, 255, 0.2);
  color: var(--primary-light);
  border: 1px solid rgba(73, 160, 255, 0.3);
}

.create-btn:hover {
  background: rgba(73, 160, 255, 0.3);
}

/* ===========================
 简洁科技风悬浮菜单
=========================== */
.bubble-menu {
    position: absolute;
    background: rgba(26, 32, 48, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    display: flex;
    padding: 4px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3), 0 0 3px rgba(73, 160, 255, 0.3);
    border: 1px solid rgba(73, 160, 255, 0.2);
    z-index: 50;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: all 0.25s ease-out;
}

.bubble-menu::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, 
        rgba(73, 160, 255, 0.2) 0%, 
        rgba(73, 160, 255, 0) 50%, 
        rgba(126, 87, 255, 0.1) 100%);
    z-index: -1;
    opacity: 0.6;
}

.bubble-menu.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    animation: simpleMenuPop 0.25s ease-out forwards;
}

@keyframes simpleMenuPop {
    0% { opacity: 0; transform: translateY(5px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.menu-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.15s ease;
    margin: 0 2px;
    position: relative;
    background: rgba(255, 255, 255, 0.05);
}

.menu-btn i {
    font-size: 0.9rem;
}

.menu-btn:hover {
    color: #ffffff;
    background: rgba(73, 160, 255, 0.2);
}

.menu-btn:active {
    transform: scale(0.9);
}

.menu-btn[data-action="edit"]:hover {
    background: rgba(73, 160, 255, 0.2);
}

.menu-btn[data-action="copy"]:hover {
    background: rgba(126, 87, 255, 0.2);
}

.menu-btn[data-action="refresh"]:hover {
    background: rgba(73, 205, 255, 0.2);
}

.menu-btn[data-action="delete"]:hover {
    background: rgba(255, 107, 107, 0.2);
}

.menu-btn::before {
    content: attr(title);
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    opacity: 0;
    color: white;
    font-size: 0.65rem;
    transition: all 0.2s ease;
    pointer-events: none;
    white-space: nowrap;
    background: rgba(0, 0, 0, 0.7);
    padding: 2px 6px;
    border-radius: 4px;
    visibility: hidden;
}

.menu-btn:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    visibility: visible;
}

.menu-btn + .menu-btn {
    position: relative;
}

.menu-btn + .menu-btn::after {
    content: '';
    position: absolute;
    left: -2px;
    top: 25%;
    height: 50%;
    width: 1px;
    background: rgba(255, 255, 255, 0.1);
}


.message-bubble {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.message-bubble:hover {
    box-shadow: 0 4px 15px rgba(73, 160, 255, 0.25);
}

.ai .message-bubble:hover {
    border: 1px solid rgba(73, 160, 255, 0.5);
}

.user .message-bubble:hover {
    border: 1px solid rgba(126, 77, 255, 0.5);
}

.message-bubble:active {
    transform: scale(0.98);
}

.message-bubble::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 70%);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.message-bubble:hover::after {
    opacity: 1;
}

.thinking-bubble {
  padding: 12px ;
  display: flex ;
  align-items: center ;
  justify-content: center ;
  border-radius: 18px ;
  width: 60px ;
  height: 60px ;
  min-width: 50px;
  min-height: 50px;
}


.bg-preview-container-global {
  border: 1px solid rgba(100, 110, 130, 0.3);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  padding-top: 26.25%;
  height: 0;
}

#globalBgPreview {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
}

#globalBgPreview.no-global-bg {
    background-image: none !important;
    background: linear-gradient(135deg, #121224, #1e2950) !important;
}

.bg-btns-global {
  gap: 10px;
}

.bg-btns-global label.modal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* ===========================
   HTML/CSS 沙箱样式
=========================== */
.sandbox-container {
  margin: 10px 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(73, 160, 255, 0.2);
  background-color: rgba(0, 0, 0, 0.1);
}

.sandbox-iframe {
  width: 100%;
  border: none;
  display: block;
  min-height: 50px;
  background-color: transparent;
}

/* ===========================
   模态框
=========================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 90%;
  max-width: 500px;
  /* 新增：设置一个固定的屏幕高度百分比，例如75% */
  height: 75vh; 
  /* 新增：但是不超过一个具体像素值，防止在大屏幕上过高 */
  max-height: 600px; 
  background: linear-gradient(135deg, rgba(42, 42, 62, 0.95), rgba(26, 26, 46, 0.95));
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(73, 160, 255, 0.3);
  overflow: hidden;
  transform: translateY(20px);
  transition: transform 0.3s ease;
  /* 新增：将它设置为flex布局，方向为垂直 */
  display: flex;
  flex-direction: column;
}


.modal.show .modal-content {
  transform: translateY(0);
}

.modal-header {
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  color: var(--primary-light);
  font-size: 1.2rem;
  font-weight: 600;
  display: flex;
  align-items: center;
}

.modal-header h3 i {
  margin-right: 8px;
}

.close-modal-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.close-modal-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.modal-body {
  padding: 20px 16px;
  /* 新增：让内容区占据所有剩余空间 */
  flex-grow: 1; 
  /* 新增：当内容超出时，显示垂直滚动条 */
  overflow-y: auto; 
  /* 新增：设置一个最大高度，这里我们用vh单位，表示视口高度的60% */
  max-height: 60vh; 
}


.modal-desc {
  color: var(--text-gray);
  margin-bottom: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
}

#aiSettingsTextarea {
  width: 100%;
  min-height: 200px;
  background: rgba(15, 20, 30, 0.8);
  color: var(--text-light);
  border: 1px solid rgba(73, 160, 255, 0.3);
  border-radius: 8px;
  padding: 12px;
  resize: vertical;
  font-size: 0.95rem;
  line-height: 1.5;
}

.modal-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.modal-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
}

.modal-btn i {
  margin-right: 6px;
}

.cancel-btn {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-light);
}

.cancel-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.save-btn {
  background: rgba(73, 160, 255, 0.2);
  color: var(--primary-light);
  border: 1px solid rgba(73, 160, 255, 0.3);
}

.save-btn:hover {
  background: rgba(73, 160, 255, 0.3);
}

.work-info {
  display: flex;
  align-items: center;
  background: rgba(15, 20, 30, 0.5);
  border-radius: 12px;
  padding: 12px;
  margin-top: 16px;
  border: 1px solid rgba(73, 160, 255, 0.2);
}

.work-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: hidden;
  margin-right: 16px;
  flex-shrink: 0;
  border: 2px solid rgba(73, 160, 255, 0.5);
}

.work-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.work-details h4 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--text-light);
}

.work-details p {
  font-size: 0.85rem;
  color: var(--text-gray);
  line-height: 1.4;
}

/* ===========================
   高级设定模态框样式
=========================== */
.modal.modal-advanced .modal-content {
  max-width: 900px;
  width: 90%;
  max-height: 85vh;
  background: linear-gradient(145deg, #11131a, #0a0c10);
  border: 1px solid rgba(100, 110, 130, 0.3);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4),
              0 10px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

.modal.modal-advanced .modal-header {
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(100, 110, 130, 0.2);
  padding: 18px 25px;
}

.modal.modal-advanced .modal-header h3 {
  color: #e0e5f0;
  font-size: 1.3rem;
}

.modal.modal-advanced .modal-header .close-modal-btn {
  color: #9098a8;
}

.modal.modal-advanced .modal-header .close-modal-btn:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.modal.modal-advanced .modal-body {
  padding: 25px 30px;
  flex-grow: 1;
  overflow-y: auto;
  color: #c0c8d8;
}

.modal.modal-advanced .modal-body .modal-desc {
  color: #9098a8;
  margin-bottom: 20px;
}

.modal.modal-advanced .modal-body > div[style*="height: 200px"] {
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(100, 110, 130, 0.4);
  color: #707888;
  min-height: 300px;
  height: auto !important;
  flex-grow: 1;
}

.modal.modal-advanced .modal-footer {
  background: rgba(0, 0, 0, 0.1);
  border-top: 1px solid rgba(100, 110, 130, 0.2);
  padding: 15px 25px;
}

/* ===========================
   高级设定 - 气泡样式控件
=========================== */
.advanced-setting-group {
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(100, 110, 130, 0.2);
}

.advanced-setting-group:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.advanced-setting-group h4 {
  font-size: 1.1rem;
  color: #b0b8c8;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
}

.advanced-setting-group h4 i {
  margin-right: 10px;
  color: #606878;
  width: 20px;
  text-align: center;
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.setting-item label {
  color: #a0a8b8;
  font-size: 0.9rem;
  margin-right: 15px;
  flex-shrink: 0;
}

.setting-item input[type="color"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 40px;
  height: 30px;
  background-color: transparent;
  border: 1px solid rgba(100, 110, 130, 0.5);
  border-radius: 5px;
  cursor: pointer;
  padding: 0;
}
.setting-item input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
.setting-item input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}
.setting-item input[type="color"]::-moz-color-swatch {
 border: none;
 border-radius: 4px;
}
.setting-item input[type="color"]::-moz-focus-inner {
 border: 0;
 padding: 0;
}

.slider-item {
}

.setting-item input[type="range"] {
  flex-grow: 1;
  height: 6px;
  cursor: pointer;
  appearance: none;
  width: auto;
  background: rgba(100, 110, 130, 0.3);
  border-radius: 3px;
  outline: none;
  margin: 0 10px;
}

.setting-item input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  background: #808898;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s ease-in-out;
}
.setting-item input[type="range"]:active::-webkit-slider-thumb {
  background: #a0a8b8;
}

.setting-item input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #808898;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease-in-out;
}
.setting-item input[type="range"]:active::-moz-range-thumb {
   background: #a0a8b8;
}

.opacity-value {
  color: #c0c8d8;
  font-size: 0.9rem;
  min-width: 30px;
  text-align: right;
  font-family: monospace;
}

/* ===========================
   高级设定 - 全局应用复选框
=========================== */
.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.global-apply-setting {
  display: flex;
  align-items: center;
  gap: 8px;
}

.global-apply-setting input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

.global-apply-setting label {
  color: #a0a8b8;
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}

.tooltip-icon {
  color: #707888;
  cursor: help;
  font-size: 0.9rem;
  position: relative;
}

/* ===========================
   辅助类
=========================== */
.hidden {
  display: none !important;
}

/* ===========================
   动画和过渡效果
=========================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse-main { /* 重命名以避免冲突 */
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 0.8; }
}
.pulse { /* 如果有地方使用 pulse 类，可以这样保留 */
    animation-name: pulse-main;
}


/* 加载动画样式 */
.loading-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 1s infinite linear;
    margin: 0 auto;
    display: block;
}

.loading-spinner::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(73, 160, 255, 0.2);
    opacity: 0;
    animation: pulse-spinner 1.5s infinite; /* 重命名 */
}

@keyframes pulse-spinner { /* 重命名 */
    0% { transform: scale(0.8); opacity: 0.8; }
    50% { transform: scale(1.2); opacity: 0; }
    100% { transform: scale(0.8); opacity: 0; }
}

/* 实例分组标题 */
.instances-group-header {
    padding: 8px 15px 4px;
    margin-top: 10px;
    position: relative;
}

.group-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    opacity: 0.7;
}

.group-divider {
    height: 1px;
    background: var(--border-color);
    margin: 5px 0;
    opacity: 0.5;
}

/* 不同作品的聊天实例样式 */
.instance-item.different-work {
    position: relative;
    border-left: 3px solid var(--accent-color);
    opacity: 0.85;
}

.instance-item.different-work:hover {
    opacity: 1;
    background: rgba(var(--primary-color-rgb), 0.1);
}

.instance-item.different-work .instance-title::before {
    content: "🔀";
    margin-right: 5px;
    font-size: 12px;
}
/* 作品详情悬浮窗样式 */
.work-detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.work-detail-overlay.show {
    opacity: 1;
    visibility: visible;
    animation: fadeIn 0.3s ease forwards;
}

.work-detail-container {
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    background-color: rgba(23, 27, 42, 0.95);
    border-radius: 12px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(73, 160, 255, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.4s ease;
    transform: translateY(20px);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(73, 160, 255, 0.2);
    background: linear-gradient(to right, rgba(20, 24, 38, 0.7), rgba(30, 36, 58, 0.7));
}

.detail-header h2 {
    margin: 0;
    color: #fff;
    font-size: 1.6rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.detail-header h2::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 20px;
    background: linear-gradient(to bottom, #49a0ff, #5f6cff);
    border-radius: 4px;
}

.close-overlay-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    transition: all 0.2s ease;
}

.close-overlay-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.detail-content {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(85vh - 60px);
    scrollbar-width: thin;
    scrollbar-color: rgba(73, 160, 255, 0.5) rgba(20, 24, 38, 0.3);
}

.detail-content::-webkit-scrollbar {
    width: 8px;
}

.detail-content::-webkit-scrollbar-track {
    background: rgba(20, 24, 38, 0.3);
    border-radius: 4px;
}

.detail-content::-webkit-scrollbar-thumb {
    background-color: rgba(73, 160, 255, 0.5);
    border-radius: 4px;
}

.work-profile {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    background-color: rgba(20, 24, 38, 0.4);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(73, 160, 255, 0.15);
}

.profile-avatar {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(73, 160, 255, 0.3);
    box-shadow: 0 0 15px rgba(73, 160, 255, 0.3);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info {
    flex-grow: 1;
}

.profile-info h2 {
    margin: 0 0 10px 0;
    color: #fff;
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.work-description {
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    line-height: 1.6;
}

.section-title {
    color: #fff;
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0 0 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i {
    color: #49a0ff;
}

.title-line {
    flex-grow: 1;
    height: 1px;
    background: linear-gradient(to right, rgba(73, 160, 255, 0.7), rgba(73, 160, 255, 0));
    margin-left: 10px;
}

.first-messages-section, .detailed-description-section {
    margin-bottom: 25px;
    padding: 15px;
    border-radius: 8px;
    background-color: rgba(20, 24, 38, 0.5);
    border: 1px solid rgba(73, 160, 255, 0.15);
}

.first-messages-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.first-message-item {
    background: rgba(30, 36, 58, 0.7);
    border: 1px solid rgba(73, 160, 255, 0.2);
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.first-message-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(to right, #49a0ff, #5f6cff);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.first-message-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 7px 14px rgba(0, 0, 0, 0.3);
    border-color: rgba(73, 160, 255, 0.4);
}

.first-message-item:hover::before {
    transform: scaleX(1);
}

.first-message-content {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 10px;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    max-height: none;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
    display: block;
}

.first-message-icon {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(73, 160, 255, 0.8);
    font-size: 0.85rem;
}

.first-message-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
}

.detailed-description {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
    line-height: 1.7;
}

.detailed-description p {
    margin-bottom: 15px;
}
.detailed-description h3 {
    margin: 20px 0 10px;
    color: #49a0ff;
    font-weight: 600;
    font-size: 1.1rem;
}
.detailed-description ul, .detailed-description ol {
    margin-bottom: 15px;
    padding-left: 20px;
}
.detailed-description li {
    margin-bottom: 5px;
}
.detailed-description a {
    color: #49a0ff;
    text-decoration: none;
    transition: color 0.2s ease;
}
.detailed-description a:hover {
    color: #5f6cff;
    text-decoration: underline;
}
.detailed-description img {
    max-width: 100%;
    border-radius: 8px;
    margin: 15px 0;
}
.detailed-description blockquote {
    border-left: 3px solid #49a0ff;
    padding-left: 15px;
    margin-left: 0;
    color: rgba(255, 255, 255, 0.75);
    font-style: italic;
}
.detailed-description .loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
}
.detailed-description .loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(73, 160, 255, 0.3);
    border-top-color: #49a0ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    .work-detail-container {
        width: 95%;
        max-height: 80vh;
    }

    .work-profile {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }

    .profile-avatar {
        width: 80px;
        height: 80px;
    }

    .profile-info h2 {
        font-size: 1.5rem;
    }

    .first-messages-container {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .section-title {
        font-size: 1.1rem;
    }
}

.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.empty-chat-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
}

.empty-chat-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    color: #49a0ff;
    animation: pulse-empty-chat 2s infinite ease-in-out; /* 重命名 */
}

@keyframes pulse-empty-chat { /* 重命名 */
    0% { opacity: 0.5; transform: scale(0.95); }
    50% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 0.5; transform: scale(0.95); }
}

.empty-chat-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.empty-chat-text {
    font-size: 1rem;
    margin-bottom: 25px;
    max-width: 450px;
    line-height: 1.6;
}

.view-details-btn {
    background: linear-gradient(to right, #49a0ff, #5f6cff);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.view-details-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(73, 160, 255, 0.3);
}

.view-details-btn:active {
    transform: translateY(-1px);
}

.ai-settings-section {
    margin-bottom: 25px;
    padding: 15px;
    border-radius: 8px;
    background-color: rgba(20, 24, 38, 0.5);
    border: 1px solid rgba(73, 160, 255, 0.15);
}

.ai-settings-textarea {
    width: 100%;
    min-height: 180px;
    background: rgba(15, 20, 30, 0.8);
    color: var(--text-light);
    border: 1px solid rgba(73, 160, 255, 0.3);
    border-radius: 8px;
    padding: 12px;
    resize: vertical;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 10px;
}

.ai-settings-actions {
    display: flex;
    justify-content: flex-end;
}

.save-settings-btn {
    background: rgba(73, 160, 255, 0.2);
    color: var(--primary-light);
    border: 1px solid rgba(73, 160, 255, 0.3);
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.save-settings-btn:hover {
    background: rgba(73, 160, 255, 0.3);
    transform: translateY(-2px);
}

.save-settings-btn i {
    font-size: 1rem;
}

.save-feedback {
    color: #4ade80;
    font-size: 0.85rem;
    margin-right: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.save-feedback.show {
    opacity: 1;
}

.model-info-tip {
    background-color: rgba(15, 20, 30, 0.7);
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    border-left: 3px solid rgba(73, 160, 255, 0.5);
}

.model-info-tip i {
    color: rgba(73, 160, 255, 0.8);
    font-size: 1rem;
    margin-top: 2px;
}

.model-info-tip span {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.9rem;
    line-height: 1.5;
    flex: 1;
}

.styled-select option {
    background-color: #1a1a2e;
    color: #ffffff;
    padding: 8px 12px;
}

.styled-select option:checked,
.styled-select option:selected {
    background-color: rgba(73, 160, 255, 0.3);
}

.styled-select option:hover {
    background-color: rgba(73, 160, 255, 0.2);
}

.styled-select {
    background-color: rgba(15, 20, 30, 0.8);
    color: #ffffff;
    border: 1px solid rgba(73, 160, 255, 0.3);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.95rem;
    appearance: none;
    cursor: pointer;
}

select {
    background-color: rgba(15, 20, 30, 0.8) !important;
    color: #ffffff !important;
}

select option {
    background-color: #1a1a2e !important;
    color: #ffffff !important;
    padding: 8px 12px;
}

select option:checked,
select option:selected {
    background-color: rgba(73, 160, 255, 0.3) !important;
}

.iframe-container {
    position: relative;
    width: 100%;
    min-height: 200px;
    margin-bottom: 15px;
}

.detailed-description-iframe {
    width: 100%;
    min-height: 200px;
    border: none;
    background-color: transparent;
    border-radius: 8px;
    overflow: hidden;
    transition: height 0.3s ease;
}

.iframe-container .loading-indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: rgba(20, 24, 38, 0.5);
    z-index: 2;
}

.import-progress {
    padding: 20px 0;
    text-align: center;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background-color: rgba(73, 160, 255, 0.2);
    border-radius: 4px;
    margin-bottom: 15px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(to right, #49a0ff, #7e4dff);
    border-radius: 4px;
    transition: width 0.3s ease;
}

#importProgressStatus {
    font-size: 0.9rem;
    color: var(--text-gray);
}

.import-info {
    background: rgba(15, 20, 30, 0.8);
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    border: 1px solid rgba(73, 160, 255, 0.3);
}

.info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.info-label {
    color: var(--text-gray);
    font-size: 0.9rem;
}

.info-value {
    color: var(--primary-light);
    font-weight: 500;
    font-size: 0.9rem;
}

.import-warning {
    color: var(--accent-color);
    font-size: 0.85rem;
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(255, 107, 107, 0.3);
    padding: 8px;
    border-radius: 6px;
    background: rgba(255, 107, 107, 0.1);
}

.import-warning-title {
    color: var(--danger-color);
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 15px;
    text-align: center;
}

.import-warning-title strong {
    color: var(--danger-color);
    font-weight: 700;
    border-bottom: 1px solid var(--danger-color);
}

.import-warning::before {
    content: '\f071';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
}

.setting-item-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-label {
    margin-right: 10px;
    color: #c0c8d8;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #3c3c4c;
    -webkit-transition: .4s;
    transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
}

input:checked + .slider {
  background-color: #4CAF50;
}

input:focus + .slider {
  box-shadow: 0 0 1px #4CAF50;
}

input:checked + .slider:before {
  -webkit-transform: translateX(24px);
  -ms-transform: translateX(24px);
  transform: translateX(24px);
}

.slider.round {
  border-radius: 26px;
}

.slider.round:before {
  border-radius: 50%;
}
.triggers-list-container {
    max-height: 200px;
    overflow-y: auto;
    background-color: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 10px;
    font-size: 0.9em;
}

.triggers-list-container .trigger-item {
    background-color: rgba(255, 255, 255, 0.05);
    border-left: 3px solid #4CAF50;
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 3px;
    word-break: break-all;
}

.triggers-list-container .trigger-item strong {
    color: #87CEFA;
    font-weight: 600;
}

.triggers-list-container .trigger-item .system-preview {
    font-size: 0.9em;
    color: #b0c4de;
    margin-top: 4px;
    display: block;
    white-space: pre-wrap;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
}


.triggers-list-container .no-learned-triggers {
    color: #777;
    text-align: center;
    padding: 15px 0;
}

.image-viewer-modal {
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 300;
}

.image-viewer-container {
  margin: auto;
  display: block;
  width: 80%;
  max-width: 900px;
  max-height: 85vh;
  position: relative;
}

.close-image-viewer {
  position: absolute;
  top: -30px;
  right: 0;
  color: #f1f1f1;
  font-size: 35px;
  font-weight: bold;
  cursor: pointer;
  z-index: 301;
}

.image-viewer-content {
  width: auto;
  max-width: 100%;
  max-height: 85vh;
  margin: auto;
  display: block;
  border-radius: 8px;
}

.image-caption {
  margin: 10px auto;
  display: block;
  width: 80%;
  max-width: 900px;
  text-align: center;
  color: #ccc;
  padding: 10px 0;
  height: 40px;
}

.chat-image {
  cursor: pointer;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.chat-image:hover {
  transform: scale(1.03);
}

.standalone-image {
  display: block;
  margin: 10px auto;
}

.inline-image {
  vertical-align: middle;
  margin: 0 5px;
}

.modal.trigger-detail-modal .modal-content {
  max-width: 650px;
  background: linear-gradient(140deg, #1a1e2f, #10121c);
  border: 1px solid rgba(80, 90, 120, 0.4);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4),
              inset 0 1px 1px rgba(255, 255, 255, 0.03);
}

.modal.trigger-detail-modal .modal-header {
  background: rgba(255, 255, 255, 0.04);
  padding: 12px 20px;
  border-bottom: 1px solid rgba(80, 90, 120, 0.3);
}

.modal.trigger-detail-modal .modal-header h3 {
  font-size: 1.15rem;
  color: #c8d0e0;
  font-weight: 500;
}

.modal.trigger-detail-modal .modal-header h3 i {
  color: #6c90c8;
  margin-right: 10px;
}

.modal.trigger-detail-modal .modal-body {
  padding: 20px 22px;
  max-height: 60vh;
  overflow-y: auto;
}

.trigger-system-content {
  font-size: 0.95rem;
  line-height: 1.65;
  color: #b0b8c8;
  white-space: pre-wrap;
  word-break: break-word;
  background-color: rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  padding: 15px;
  border: 1px solid rgba(80, 90, 120, 0.2);
}

.trigger-system-content p {
    margin: 0;
}


.modal.trigger-detail-modal .modal-footer {
  background: rgba(0, 0, 0, 0.1);
  padding: 12px 20px;
  border-top: 1px solid rgba(80, 90, 120, 0.3);
}

.triggers-list-container .trigger-item {
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.triggers-list-container .trigger-item:hover {
    background-color: rgba(73, 160, 255, 0.1);
}

.triggers-list-container .trigger-item:active {
    background-color: rgba(73, 160, 255, 0.15);
    transform: scale(0.98);
}

.modal.trigger-detail-modal .modal-footer .danger-btn {
  background-color: #6e2a2a;
  color: #ffc6c6;
  border: 1px solid #8c3f3f;
}

.modal.trigger-detail-modal .modal-footer .danger-btn:hover {
  background-color: #8c3f3f;
  color: #ffffff;
}

/* --- 新增：触发词详情编辑模式样式 --- */

/* 隐藏类，用于JS控制显示/隐藏 */
.hidden {
    display: none !important;
}

/* 编辑模式下的标题输入框样式 */
.trigger-title-input {
    flex-grow: 1; /* 占据剩余空间 */
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--primary-color);
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--text-light);
    font-size: 1.1rem;
    font-weight: 500;
    margin-right: 15px; /* 与关闭按钮保持距离 */
    outline: none;
    transition: all 0.2s ease;
}

.trigger-title-input:focus {
    background: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 8px rgba(73, 160, 255, 0.3);
}

/* 编辑模式下的 system 指令文本域样式 */
.trigger-system-textarea {
    width: 100%;
    min-height: 250px; /* 提供足够的编辑空间 */
    resize: vertical; /* 允许用户纵向调整大小 */
    font-size: 0.95rem;
    line-height: 1.65;
    color: #b0b8c8;
    background-color: rgba(0, 0, 0, 0.25);
    border-radius: 6px;
    padding: 15px;
    border: 1px solid var(--primary-color);
    outline: none;
    transition: all 0.2s ease;
}

.trigger-system-textarea:focus {
    background-color: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 8px rgba(73, 160, 255, 0.3);
}

/* 确保底部按钮组布局正确 */
#triggerDisplayActions, #triggerEditActions {
    display: flex;
    justify-content: flex-end; /* 右对齐 */
    gap: 12px; /* 按钮间距 */
    width: 100%;
}

/* --- 新增：高级设定区域标题与按钮布局 --- */
.advanced-setting-group-header {
    display: flex;
    justify-content: space-between; /* 两端对齐 */
    align-items: center; /* 垂直居中 */
    margin-bottom: 15px; /* 与下方描述文字的间距 */
}

.advanced-setting-group-header h4 {
    margin-bottom: 0; /* 移除 h4 原有的下外边距 */
}

/* --- 新增：“全部删除”按钮样式 --- */
.delete-all-triggers-btn {
    background-color: rgba(255, 107, 107, 0.15);
    color: #ff9a9a;
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 5px;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.delete-all-triggers-btn:hover {
    background-color: rgba(255, 107, 107, 0.3);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.2);
}

.delete-all-triggers-btn:active {
    transform: translateY(0);
}

/* --- 新增：作品详情悬浮窗内的模型选择区域样式 --- */
.model-selection-section {
    margin-bottom: 25px; /* 与其他 section 保持一致的下边距 */
    padding: 15px;
    border-radius: 8px;
    background-color: rgba(20, 24, 38, 0.5); /* 与其他 section 背景色一致 */
    border: 1px solid rgba(73, 160, 255, 0.15); /* 与其他 section 边框一致 */
}

/* 模型选择器容器的样式 */
.model-select-container {
    width: 100%;
    position: relative; /* 用于放置伪元素箭头 */
}

/* 确保详情页里的 select 样式也应用上 */
.model-select-container .styled-select {
    width: 100%;
}

/* 为选择器容器添加下拉箭头 */
.model-select-container::after {
    content: '\f107'; /* Font Awesome 下拉箭头图标 */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none; /* 确保箭头不会干扰点击 */
}

/* ======================================= */
/* --- AI设定悬浮窗 V3.0 - 全新科幻风设计 --- */
/* ======================================= */

/* 模态框背景 */
.modal.modal-settings-v3 {
  background: rgba(10, 10, 26, 0.7);
  backdrop-filter: blur(8px) saturate(150%);
}

/* 内容容器 - 核心样式 */
.modal-content-v3 {
  width: 90%;
  max-width: 900px;
  height: 80vh;
  max-height: 700px;
  background: linear-gradient(145deg, rgba(20, 24, 38, 0.95), rgba(16, 16, 30, 0.95));
  border-radius: 16px;
  border: 1px solid rgba(73, 160, 255, 0.3);
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.6), 
              inset 0 0 30px rgba(73, 160, 255, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transform: scale(0.95) translateY(20px);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease;
}

.modal.show .modal-content-v3 {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* 装饰性元素：边角 + 辉光 */
.corner-v3 {
    position: absolute;
    width: 25px;
    height: 25px;
    border: 2px solid var(--primary-color);
    filter: drop-shadow(0 0 4px var(--primary-color));
    opacity: 0.8;
}
.corner-v3.top-left { top: -2px; left: -2px; border-right: none; border-bottom: none; border-radius: 16px 0 0 0; }
.corner-v3.top-right { top: -2px; right: -2px; border-left: none; border-bottom: none; border-radius: 0 16px 0 0; }
.corner-v3.bottom-left { bottom: -2px; left: -2px; border-right: none; border-top: none; border-radius: 0 0 0 16px; }
.corner-v3.bottom-right { bottom: -2px; right: -2px; border-left: none; border-top: none; border-radius: 0 0 16px 0; }
.modal-glow {
    position: absolute;
    inset: -1px;
    border-radius: 16px;
    background: radial-gradient(circle at 50% 0%, rgba(73, 160, 255, 0.2), transparent 40%);
    pointer-events: none;
    animation: rotateGlow 15s linear infinite;
}

/* 头部 */
.modal-header-v3 {
  padding: 16px 25px;
  border-bottom: 1px solid rgba(73, 160, 255, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  background: rgba(0,0,0,0.2);
}
.modal-header-v3 h3 {
  color: #fff;
  font-size: 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  text-shadow: 0 0 8px var(--primary-light);
}

/* 主体 */
.modal-body-v3 {
  display: flex;
  flex-grow: 1;
  overflow: hidden;
}

/* 左侧Tab导航 */
.modal-sidebar-v3 {
  width: 160px;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.2);
  border-right: 1px solid rgba(73, 160, 255, 0.2);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-tab-v3 {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 25px;
  color: var(--text-gray);
  font-size: 1rem;
  border-left: 4px solid transparent;
  transition: all 0.2s ease;
  position: relative;
}
.sidebar-tab-v3:hover {
  background: linear-gradient(to right, rgba(73, 160, 255, 0.1), transparent);
  color: var(--text-light);
}
.sidebar-tab-v3.active {
  background: linear-gradient(to right, rgba(73, 160, 255, 0.15), transparent);
  color: #fff;
  font-weight: 600;
  border-left-color: var(--primary-color);
  text-shadow: 0 0 5px var(--primary-color);
}
.sidebar-tab-v3.active::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to top, transparent, var(--primary-color), transparent);
}

/* 右侧内容区 */
.modal-main-content-v3 {
  flex-grow: 1;
  display: flex;
  flex-direction: column; /* 让内容和添加按钮上下排列 */
  padding: 20px 25px;
  overflow-y: hidden; /* 父容器不滚动 */
}
.modal-tab-content-v3 {
  display: none;
  flex-direction: column;
  height: 100%;
}
.modal-tab-content-v3.active {
  display: flex;
}
.content-header-v3 {
  margin-bottom: 20px;
  flex-shrink: 0;
}
.content-header-v3 h4 {
  color: var(--primary-light);
  margin-bottom: 8px;
  font-size: 1.1rem;
}
.content-header-v3 p {
  color: var(--text-gray);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* 设定/触发词的滚动容器 */
.settings-container-v3 {
  flex-grow: 1; /* 占据剩余空间 */
  overflow-y: auto; /* 容器内部滚动 */
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding-right: 10px; /* 为滚动条留出空间 */
  margin-right: -10px; /* 抵消padding */
  contain: layout paint style;
  will-change: transform;
}
/* 添加新条目按钮 */
.add-new-item-btn-v3 {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  background: rgba(73, 160, 255, 0.1);
  border: 1px dashed rgba(73, 160, 255, 0.3);
  color: var(--primary-light);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  margin-top: 20px; /* 与滚动区保持距离 */
  flex-shrink: 0;
}
.add-new-item-btn-v3:hover {
  background: rgba(73, 160, 255, 0.2);
  border-style: solid;
}

/* 卡片式设计：设定区块和触发规则 */
.setting-block-card, .trigger-rule-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 15px;
  position: relative;
  transition: all 0.2s ease;
}
.setting-block-card:hover, .trigger-rule-card:hover {
  border-color: rgba(73, 160, 255, 0.4);
  box-shadow: 0 0 15px rgba(73, 160, 255, 0.1);
}
.delete-card-btn { /* 通用删除按钮 */
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    border: none;
    transition: all 0.2s ease;
}
.delete-card-btn:hover {
    background: var(--danger-color);
    color: white;
    transform: scale(1.1);
}

/* 世界书卡片内部样式 */
.setting-block-card textarea {
  width: 100%;
  min-height: 120px;
  background: transparent;
  color: var(--text-light);
  border: none;
  padding: 0;
  resize: vertical;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* --- 触发词卡片内部样式 V3.0 --- */
.trigger-rule-card .trigger-item-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 15px;
    padding-right: 35px; /* <--- 新增：在右侧增加内边距，防止按钮重叠 */
}

.trigger-rule-card .trigger-item-header label {
    flex-shrink: 0;
    padding-top: 8px;
    font-size: 0.9rem;
    color: var(--text-gray);
}
.trigger-rule-card .trigger-words-container {
    flex-grow: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 8px;
}
.trigger-rule-card .trigger-word-item {
    display: flex;
    align-items: center;
    background-color: rgba(73, 160, 255, 0.1);
    border-radius: 15px;
    padding: 4px 4px 4px 10px;
    transition: all 0.2s ease;
}
.trigger-rule-card .trigger-word-input {
    background: transparent;
    border: none;
    color: var(--text-light);
    outline: none;
    width: 120px;
    font-size: 0.9rem;
}
.trigger-rule-card .delete-trigger-word-btn {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-muted);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    margin-left: 5px;
    transition: all 0.2s ease;
}
.trigger-rule-card .delete-trigger-word-btn:hover {
    background: var(--danger-color);
    color: white;
    transform: scale(1.1);
}
.trigger-rule-card .add-trigger-word-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: rgba(73, 160, 255, 0.15);
    border: 1px solid rgba(73, 160, 255, 0.3);
    color: var(--primary-light);
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 2px;
}
.trigger-rule-card .add-trigger-word-btn:hover {
    background-color: rgba(73, 160, 255, 0.25);
    transform: rotate(90deg);
}

.trigger-rule-card .trigger-item-textarea {
    width: 100%;
    min-height: 80px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 10px;
    color: var(--text-light);
    resize: vertical;
    font-size: 0.95rem;
    line-height: 1.5;
}

.trigger-rule-card .trigger-options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 固定为两列 */
    gap: 10px 20px; /* 行间距 10px, 列间距 20px */
    margin-top: 15px;
}
.trigger-rule-card .trigger-option-item {
    display: flex;
    align-items: center;
    gap: 10px;
}
.trigger-rule-card .trigger-option-item label {
    font-size: 0.9rem;
    color: var(--text-gray);
    flex-shrink: 0;
}
.trigger-rule-card .trigger-option-item select,
.trigger-rule-card .trigger-option-item input[type="number"] {
    width: 100%;
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 8px;
    color: var(--text-light);
}

/* 底部 */
.modal-footer-v3 {
  padding: 16px 25px;
  border-top: 1px solid rgba(73, 160, 255, 0.2);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-shrink: 0;
  background: rgba(0,0,0,0.2);
}
.modal-btn-v3 {
  padding: 9px 20px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}
.modal-btn-v3.cancel-btn {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-gray);
}
.modal-btn-v3.cancel-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text-light);
}
.modal-btn-v3.save-btn {
  background: var(--primary-color);
  color: white;
  box-shadow: 0 0 12px rgba(73, 160, 255, 0.4);
}
.modal-btn-v3.save-btn:hover {
  background: var(--primary-dark);
  box-shadow: 0 0 18px rgba(73, 160, 255, 0.6);
  transform: translateY(-1px);
}

/* 修复JS动态添加的按钮类名 */
#aiSettingsContainer .delete-setting-btn,
#customTriggersContainer .delete-trigger-btn {
    /* 使用通用卡片删除按钮样式 */
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    border: none;
    transition: all 0.2s ease;
}
#aiSettingsContainer .delete-setting-btn:hover,
#customTriggersContainer .delete-trigger-btn:hover {
    background: var(--danger-color);
    color: white;
    transform: scale(1.1);
}
#aiSettingsContainer .setting-block {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    position: relative;
    transition: all 0.2s ease;
}
#aiSettingsContainer .setting-block:hover {
    border-color: rgba(73, 160, 255, 0.4);
    box-shadow: 0 0 15px rgba(73, 160, 255, 0.1);
}
#aiSettingsContainer .setting-block textarea {
    width: 100%;
    min-height: 120px;
    background: transparent;
    color: var(--text-light);
    border: none;
    padding: 0;
    resize: vertical;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* =====================================
   Kido神秘小开关悬浮窗 - V2.0 卡片式布局
===================================== */
.switch-list {
  display: flex;
  flex-direction: column;
  gap: 16px; /* 卡片之间的间距 */
}

/* 开关卡片整体样式 */
.switch-card {
  display: flex;
  align-items: flex-start; /* 顶部对齐 */
  gap: 15px;
  background: linear-gradient(145deg, rgba(42, 42, 62, 0.5), rgba(30, 30, 50, 0.5));
  border: 1px solid rgba(73, 160, 255, 0.2);
  border-radius: 12px;
  padding: 18px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.switch-card:hover {
  transform: translateY(-3px);
  border-color: rgba(73, 160, 255, 0.4);
  box-shadow: 0 8px 25px rgba(73, 160, 255, 0.15);
}

/* 左侧图标区域 */
.switch-card-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(73, 160, 255, 0.15);
  color: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-top: 2px;
  border: 1px solid rgba(73, 160, 255, 0.2);
}

/* 右侧内容区域 */
.switch-card-content {
  flex-grow: 1;
}

/* 标题和开关的容器 */
.switch-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

/* 标题文本 */
.switch-label {
  font-size: 1.05rem; /* 字体稍大 */
  font-weight: 600; /* 加粗 */
  color: var(--text-light);
  cursor: pointer;
}

/* 描述文本 */
.switch-description {
  font-size: 0.9rem;
  color: var(--text-gray);
  line-height: 1.5;
  padding-right: 10px; /* 避免文字和滚动条太近 */
}

/* 复用现有的开关样式，我们之前已经定义好了 .switch 和 .slider，这里不需要改 */
/* ===========================
   新增：侧边栏积分显示样式 (V3.0 极简版)
=========================== */

/* 让侧边栏的页脚区域flex-shrink为0，确保它不会被压缩 */
.nav-sidebar-footer {
    padding: 15px 20px; /* 调整内边距 */
    flex-shrink: 0; /* 防止被挤压 */
    margin-top: auto; /* 【关键】让它自动推到flex容器的底部 */
}

/* 积分卡片的核心样式 */
.sidebar-balance {
    padding: 10px 15px; /* 【缩小】内边距，让卡片更小 */
    text-align: center; /* 【居中】文本 */

    /* 外观设计 */
    border-radius: 10px; /* 【缩小】圆角半径 */
    background: linear-gradient(135deg, rgba(73, 160, 255, 0.1), rgba(126, 77, 255, 0.1));
    border: 1px solid rgba(73, 160, 255, 0.2);
    backdrop-filter: blur(8px);
    box-shadow: inset 0 0 10px rgba(73, 160, 255, 0.1); /* 改为内发光效果 */
    transition: all 0.3s ease;
}

.sidebar-balance:hover {
    border-color: rgba(73, 160, 255, 0.4);
    box-shadow: inset 0 0 15px rgba(73, 160, 255, 0.2), 0 0 10px rgba(73, 160, 255, 0.1);
}

/* 信息区域的wrapper，现在没用了，但可以加个样式以防万一 */
.balance-info {
    /* 无需特定样式，父级已处理居中 */
}

/* “积分余额”标签的样式 */
.balance-label {
    font-size: 0.65rem; /* 【缩小】字体 */
    color: var(--text-gray);
    margin-bottom: 3px;
    display: block; /* 确保它独占一行 */
    text-transform: uppercase; /* 字母大写，更有设计感 */
    letter-spacing: 1px; /* 增加字母间距 */
}

/* 积分数值的样式 */
.balance-value {
    font-size: 1.15rem; /* 【缩小】字体 */
    font-weight: 600;
    color: var(--text-light);
    font-family: 'Consolas', 'Courier New', monospace;
    letter-spacing: 0.5px;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
}

/* ===========================
   新增：导出选项悬浮窗样式
=========================== */

.export-options-container {
    display: flex;
    flex-direction: column;
    gap: 15px; /* 卡片之间的间距 */
    margin-top: 10px;
}

.export-option-card {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.export-option-card:hover {
    background: rgba(73, 160, 255, 0.1);
    border-color: rgba(73, 160, 255, 0.4);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.export-option-icon {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(73, 160, 255, 0.15), rgba(126, 77, 255, 0.15));
    color: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border: 1px solid rgba(73, 160, 255, 0.2);
}

.export-option-info h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 8px;
}

.export-option-info p {
    font-size: 0.9rem;
    color: var(--text-gray);
    line-height: 1.5;
}

/* =================================== */
/* --- AI设定悬浮窗加载器样式 --- */
/* =================================== */

.settings-loader {
    display: flex; /* 默认显示 */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-grow: 1; /* 占据父容器的剩余空间 */
    color: var(--text-gray);
    transition: opacity 0.3s ease;
    opacity: 1;
}

.settings-loader .loading-spinner {
    width: 36px;
    height: 36px;
    border-width: 4px;
    margin-bottom: 15px;
}

.settings-loader p {
    font-size: 0.95rem;
}

/* 当加载器需要隐藏时 */
.settings-loader.hidden {
    display: none;
    opacity: 0;
}
/* ========================================= */
/* --- 优化：输入框编辑时临时禁用昂贵样式 --- */
/* ========================================= */

.modal-content-v3.is-editing-textarea {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.6) !important; /* 可以保留一个简单的阴影 */

  /* 过渡效果，让效果的切换不那么生硬 */
  transition: backdrop-filter 0.2s ease, -webkit-backdrop-filter 0.2s ease;
}
/* ===========================
   新增：滚动到底部按钮
=========================== */
.scroll-to-bottom-btn {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 50; /* 让它在聊天气泡之上，但在侧边栏之下 */
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(26, 26, 46, 0.8);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  color: white;
  border: 1px solid rgba(73, 160, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  
  /* 默认隐藏状态 */
  opacity: 0;
  transform: translateY(15px);
  pointer-events: none; /* 隐藏时不可点击 */
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.scroll-to-bottom-btn:hover {
  background: rgba(73, 160, 255, 0.2);
  transform: scale(1.1); /* 鼠标悬停时轻微放大 */
}

/* 当按钮需要显示时，添加 .show 类 */
.scroll-to-bottom-btn.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto; /* 显示时可点击 */
}

/* ===========================
   新增：发送按钮加载状态
=========================== */
.send-btn.sending {
  background: var(--primary-dark); /* 发送时按钮颜色可以变深一些 */
  cursor: wait; /* 鼠标指针变为等待状态 */
  transform: scale(1); /* 取消悬停时的放大效果 */
}

.send-btn.sending i.fa-spinner {
  font-size: 1.2rem; /* 让加载图标稍微大一点，更显眼 */
}
