/* ============================================================
   整合后 CSS · 全局美化 + 独立侧边栏（按钮触发，多实例支持）
   ============================================================ */

/* ---------- 1. 全局背景、文字、滚动条、选区、输入、按钮、链接 ---------- */
html, body {
  background-color: #08080a !important;
  color: #f0e6d2 !important;
}

body, article, main, .content, section,
.markdown-body, .post-content, .entry-content {
  background-color: #08080a !important;
  color: #f0e6d2 !important;
}

p, div, li, h1, h2, h3, h4, h5, h6, span, a:not(.special) {
  color: inherit !important;
}

::-webkit-scrollbar {
  width: 6px !important;
  height: 6px !important;
}
::-webkit-scrollbar-track {
  background: rgba(10, 14, 18, 0.6) !important;
  border-radius: 4px !important;
}
::-webkit-scrollbar-thumb {
  background: #1a6d9e !important;
  border-radius: 4px !important;
  box-shadow: 0 0 8px rgba(26, 109, 158, 0.6) !important;
}
::-webkit-scrollbar-thumb:hover {
  background: #3ba9d9 !important;
  box-shadow: 0 0 12px rgba(59, 169, 217, 0.8) !important;
}

::selection {
  background: #1a6d9e !important;
  color: #ffffff !important;
  text-shadow: none !important;
}

input[type="text"],
input[type="number"],
input[type="search"],
input[type="password"],
input[type="email"],
textarea,
select {
  background: rgba(10, 14, 18, 0.85) !important;
  border: 1px solid #1a6d9e !important;
  color: #e8f0f8 !important;
  padding: 8px 12px !important;
  border-radius: 6px !important;
  outline: none !important;
  font-family: inherit !important;
  transition: all 0.3s ease !important;
  box-shadow: 0 0 8px rgba(26, 109, 158, 0.5),
              inset 0 0 8px rgba(26, 109, 158, 0.2) !important;
  caret-color: #3ba9d9 !important;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #3ba9d9 !important;
  box-shadow: 0 0 20px rgba(59, 169, 217, 0.9),
              0 0 40px rgba(26, 109, 158, 0.6),
              inset 0 0 10px rgba(26, 109, 158, 0.4) !important;
  animation: input-glow-pulse 1.5s infinite alternate !important;
}

input::placeholder,
textarea::placeholder {
  color: #3ba9d9 !important;
  opacity: 0.65 !important;
  text-shadow: 0 0 8px rgba(59, 169, 217, 0.45) !important;
}

button,
input[type="button"],
input[type="submit"],
input[type="reset"],
.btn {
  background: linear-gradient(145deg, #0f1a24, #1a2d3d) !important;
  border: 1px solid #1a6d9e !important;
  color: #e8f0f8 !important;
  padding: 8px 20px !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  font-weight: bold !important;
  text-shadow: 0 0 5px rgba(26, 109, 158, 0.8) !important;
  box-shadow: 0 0 10px rgba(26, 109, 158, 0.5),
              inset 0 0 5px rgba(26, 109, 158, 0.3) !important;
  transition: all 0.3s ease !important;
  outline: none !important;
}

button:hover,
input[type="button"]:hover,
input[type="submit"]:hover,
input[type="reset"]:hover,
.btn:hover {
  background: linear-gradient(145deg, #1a2d3d, #26587a) !important;
  border-color: #3ba9d9 !important;
  box-shadow: 0 0 25px rgba(59, 169, 217, 0.9),
              0 0 45px rgba(26, 109, 158, 0.6),
              inset 0 0 10px rgba(26, 109, 158, 0.5) !important;
  color: #a0e7ff !important;
  text-shadow: 0 0 12px #1a6d9e !important;
}

button:active,
input[type="button"]:active,
input[type="submit"]:active,
input[type="reset"]:active,
.btn:active {
  transform: scale(0.97) !important;
  box-shadow: 0 0 15px rgba(26, 109, 158, 0.8),
              inset 0 0 15px rgba(26, 109, 158, 0.6) !important;
}

button svg,
input[type="button"] svg,
input[type="submit"] svg {
  stroke: #3ba9d9 !important;
  fill: none !important;
  filter: drop-shadow(0 0 6px rgba(59, 169, 217, 0.9)) !important;
}

a {
  color: #3ba9d9 !important;
  text-decoration: underline dotted rgba(59, 169, 217, 0.4) !important;
  transition: all 0.2s ease !important;
}

a:hover {
  color: #a0e7ff !important;
  text-shadow: 0 0 8px #3ba9d9 !important;
}

/* ---------- 2. 聊天气泡及装饰 ---------- */
.chat-container {
    background: #0a0e12;
    color: #e8f0f8;
}

.group.is-user > div:first-child,
.group.is-assistant > div:first-child {
  position: relative !important;
  z-index: 1 !important;
}

.group.is-user > div:first-child {
  background: #0f1a24 !important;
  border: 1px solid #1a6d9e !important;
  border-radius: 16px 4px 16px 16px !important;
  padding: 16px !important;
  color: #dce8f0 !important;
  box-shadow: 0 0 20px rgba(26, 109, 158, 0.25), inset 0 0 20px rgba(26, 109, 158, 0.12) !important;
}

.group.is-assistant > div:first-child {
  background: #0d161e !important;
  border: 1px solid #1a6d9e !important;
  border-radius: 4px 16px 16px 16px !important;
  padding: 16px !important;
  color: #f0e6d2 !important;
  box-shadow: 0 0 20px rgba(26, 109, 158, 0.25), inset 0 0 20px rgba(26, 109, 158, 0.12) !important;
}

.group.is-user > div:first-child::before,
.group.is-user > div:first-child::after,
.group.is-assistant > div:first-child::before,
.group.is-assistant > div:first-child::after {
  content: '' !important;
  position: absolute !important;
  width: 12px !important;
  height: 12px !important;
  border: 1.5px solid #3ba9d9 !important;
  opacity: 0.45 !important;
  pointer-events: none !important;
  z-index: 2 !important;
}

.group.is-user > div:first-child::before,
.group.is-assistant > div:first-child::before {
  top: -1px !important;
  left: -1px !important;
  border-right: none !important;
  border-bottom: none !important;
}

.group.is-user > div:first-child::after,
.group.is-assistant > div:first-child::after {
  bottom: -1px !important;
  right: -1px !important;
  border-left: none !important;
  border-top: none !important;
}

/* ---------- 3. 正文渲染、工具条、状态指示 ---------- */
.rili-markdown-renderer,
.rili-markdown-renderer * {
  color: #dce8f0 !important;
  caret-color: #3ba9d9 !important;
  text-shadow: 0 0 6px rgba(59, 169, 217, 0.15) !important;
}

.text-xs.font-mono.text-muted-foreground {
  color: #3ba9d9 !important;
  text-shadow: 0 0 8px rgba(59, 169, 217, 0.45) !important;
  border-top: 1px solid rgba(26, 109, 158, 0.2) !important;
  padding-top: 4px !important;
}

.text-xs.font-mono.text-muted-foreground .text-green-500 {
  color: #3ba9d9 !important;
  box-shadow: 0 0 12px #3ba9d9 !important;
  animation: camera-led-pulse 1.8s infinite !important;
}

.bg-muted.rounded.flex {
  background: rgba(10, 14, 18, 0.85) !important;
  border: 1px solid #1a6d9e !important;
  border-radius: 12px !important;
  box-shadow: 0 0 18px rgba(26, 109, 158, 0.25) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  padding: 6px 8px !important;
}

.bg-muted.rounded.flex button {
  background: #0f1a24 !important;
  border: 1px solid #1a6d9e !important;
  color: #3ba9d9 !important;
  border-radius: 8px !important;
  box-shadow: 0 0 10px rgba(26, 109, 158, 0.35) !important;
  transition: all 0.25s ease !important;
}

.bg-muted.rounded.flex button:hover {
  background: #1a2d3d !important;
  border-color: #3ba9d9 !important;
  box-shadow: 0 0 22px rgba(59, 169, 217, 0.6) !important;
}

.bg-muted.rounded.flex button svg {
  stroke: #3ba9d9 !important;
  fill: none !important;
  filter: drop-shadow(0 0 6px rgba(59, 169, 217, 0.8)) !important;
}

.group .md\:opacity-0 {
  opacity: 1 !important;
}

/* ---------- 4. 加载动画 ---------- */
.flex.gap-2.w-full.h-full.items-center.justify-center {
  position: relative !important;
  min-height: 60px !important;
  background: transparent !important;
}

.flex.gap-2.w-full.h-full.items-center.justify-center > span {
  display: none !important;
}

.flex.gap-2.w-full.h-full.items-center.justify-center::before {
  content: "✡" !important;
  font-size: 48px !important;
  color: #3ba9d9 !important;
  text-shadow: 0 0 30px rgba(59, 169, 217, 0.6) !important;
  animation: spin 2.5s linear infinite !important;
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) rotate(0deg);
  pointer-events: none !important;
  z-index: 2 !important;
}

/* ---------- 5. 进度条 ---------- */
progress,
[class*="progress"],
.cyber-progress {
  appearance: none !important;
  -webkit-appearance: none !important;
  width: 130px !important;
  height: 16px !important;
  border-radius: 8px !important;
  border: 1.5px solid #1a6d9e !important;
  background: rgba(0, 0, 0, 0.85) !important;
  vertical-align: middle !important;
  margin: 0 8px !important;
  overflow: hidden !important;
  box-shadow: inset 0 0 20px rgba(26, 109, 158, 0.25),
              0 0 14px rgba(26, 109, 158, 0.5) !important;
  position: relative !important;
}

progress::-webkit-progress-bar {
  background: rgba(0, 0, 0, 0.85) !important;
  border-radius: 8px !important;
}

progress::-webkit-progress-value {
  border-radius: 8px !important;
  background-size: 200% 100% !important;
  animation: progress-shine 2.2s linear infinite !important;
}

progress::-moz-progress-bar {
  border-radius: 8px !important;
  background-size: 200% 100% !important;
}

progress:nth-of-type(1)::-webkit-progress-value {
  background-image: linear-gradient(90deg, #16a085, #2ecc71, #16a085) !important;
}
progress:nth-of-type(1)::-moz-progress-bar {
  background: linear-gradient(90deg, #16a085, #2ecc71) !important;
}

progress:nth-of-type(2)::-webkit-progress-value {
  background-image: linear-gradient(90deg, #2471a3, #3498db, #2471a3) !important;
}
progress:nth-of-type(2)::-moz-progress-bar {
  background: linear-gradient(90deg, #2471a3, #3498db) !important;
}

progress:nth-of-type(3)::-webkit-progress-value {
  background-image: linear-gradient(90deg, #f2a7b6, #ffd6de, #f2a7b6) !important;
}
progress:nth-of-type(3)::-moz-progress-bar {
  background: linear-gradient(90deg, #f2a7b6, #ffd6de) !important;
}

progress:nth-of-type(4)::-webkit-progress-value {
  background-image: linear-gradient(90deg, #c0392b, #e74c3c, #c0392b) !important;
}
progress:nth-of-type(4)::-moz-progress-bar {
  background: linear-gradient(90deg, #c0392b, #e74c3c) !important;
}

progress:nth-of-type(5)::-webkit-progress-value {
  background-image: linear-gradient(90deg, #d63384, #ff69b4, #d63384) !important;
}
progress:nth-of-type(5)::-moz-progress-bar {
  background: linear-gradient(90deg, #d63384, #ff69b4) !important;
}

progress:nth-of-type(6)::-webkit-progress-value {
  background-image: linear-gradient(90deg, #7d3c98, #9b59b6, #7d3c98) !important;
}
progress:nth-of-type(6)::-moz-progress-bar {
  background: linear-gradient(90deg, #7d3c98, #9b59b6) !important;
}

/* ---------- 6. 折叠面板 ---------- */
details,
.cyber-details {
  background: rgba(10, 14, 18, 0.85) !important;
  backdrop-filter: blur(16px) saturate(1.6) !important;
  -webkit-backdrop-filter: blur(16px) saturate(1.6) !important;
  border: 1.5px solid #1a6d9e !important;
  border-radius: 14px !important;
  box-shadow: 0 0 25px rgba(26, 109, 158, 0.7),
              inset 0 0 20px rgba(26, 109, 158, 0.15) !important;
  padding: 20px 22px !important;
  margin-top: 20px !important;
  color: #f0e6d2 !important;
  position: relative !important;
  overflow: visible !important;
  transition: box-shadow 0.3s ease !important;
}

details:hover,
.cyber-details:hover {
  box-shadow: 0 0 40px rgba(59, 169, 217, 1),
              inset 0 0 25px rgba(26, 109, 158, 0.3) !important;
}

details::before,
details::after {
  content: '' !important;
  position: absolute !important;
  width: 16px !important;
  height: 16px !important;
  border: 2px solid #3ba9d9 !important;
  opacity: 0.7 !important;
  pointer-events: none !important;
  z-index: 2 !important;
}

details::before {
  top: -1px !important;
  left: -1px !important;
  border-right: none !important;
  border-bottom: none !important;
  border-radius: 4px 0 0 0 !important;
  box-shadow: -3px -3px 14px rgba(59, 169, 217, 0.5) !important;
}

details::after {
  bottom: -1px !important;
  right: -1px !important;
  border-left: none !important;
  border-top: none !important;
  border-radius: 0 0 4px 0 !important;
  box-shadow: 3px 3px 14px rgba(59, 169, 217, 0.5) !important;
}

summary {
  color: #3ba9d9 !important;
  font-size: 1.1em !important;
  font-weight: bold !important;
  text-shadow: 0 0 8px rgba(59, 169, 217, 0.9),
               0 0 20px rgba(26, 109, 158, 0.6) !important;
  padding: 12px 20px !important;
  background: linear-gradient(145deg, #0b1a26, #172d3d) !important;
  border-radius: 10px !important;
  margin: -18px -18px 15px -18px !important;
  list-style: none !important;
  outline: none !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
  position: relative !important;
  overflow: hidden !important;
}

summary::after {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: -100% !important;
  width: 100% !important;
  height: 100% !important;
  background: linear-gradient(90deg, transparent, rgba(59, 169, 217, 0.2), transparent) !important;
  animation: summary-sweep 3s infinite !important;
}

summary::-webkit-details-marker {
  display: none !important;
}

summary::before {
  content: "✧" !important;
  color: #3ba9d9 !important;
  margin-right: 14px !important;
  font-size: 1em !important;
  transition: transform 0.35s ease !important;
  filter: drop-shadow(0 0 5px #3ba9d9) !important;
}

details[open] summary::before {
  transform: rotate(90deg) !important;
}

summary:hover {
  background: linear-gradient(145deg, #172d3d, #26587a) !important;
  color: #5ec8f0 !important;
  text-shadow: 0 0 12px #1a6d9e !important;
}

details > :where(p, div, ul, ol, dl, blockquote, pre, h1, h2, h3, h4, h5, h6, table) {
  color: #f0e6d2 !important;
  padding: 10px 0 !important;
  margin-left: 12px !important;
  border-left: 3px solid transparent !important;
  padding-left: 15px !important;
  transition: all 0.25s ease !important;
}

details > :where(p, div, ul, ol, dl, blockquote, pre, h1, h2, h3, h4, h5, h6, table):hover {
  background-color: rgba(26, 109, 158, 0.15) !important;
  border-left: 3px solid #1a6d9e !important;
  box-shadow: 0 0 10px rgba(26, 109, 158, 0.4) !important;
}

details progress,
details button,
details input {
  border-left: none !important;
  padding-left: initial !important;
  margin-left: 0 !important;
}

/* ---------- 7. 通用 Tooltip（全局 <t> 和 <ti>） ---------- */
t {
  cursor: pointer !important;
  color: #5ec8f0 !important;
  font-weight: 700 !important;
  text-shadow: 0 0 8px rgba(94, 200, 240, 0.9), 0 0 16px rgba(59, 169, 217, 0.6) !important;
  text-decoration: underline dotted #5ec8f0 !important;
  text-underline-offset: 3px !important;
  position: relative !important;
  display: inline-block !important;
  outline: none !important;
  user-select: none !important;
  z-index: 99 !important;
}

t:hover {
  color: #a0e7ff !important;
  text-shadow: 0 0 12px #5ec8f0, 0 0 24px #3ba9d9 !important;
  text-decoration-color: #a0e7ff !important;
  z-index: 1001 !important;
  outline: 2px solid #3ba9d9 !important;
  outline-offset: 2px !important;
}

ti {
  display: none !important;
  position: absolute !important;
  bottom: calc(100% + 14px) !important;
  left: 0 !important;
  background: linear-gradient(145deg, #0b1a26, #172d3d) !important;
  border: 1.5px solid #1a6d9e !important;
  border-radius: 10px !important;
  box-shadow: 0 0 18px rgba(26, 109, 158, 0.9),
              inset 0 0 10px rgba(26, 109, 158, 0.4) !important;
  padding: 10px 16px !important;
  color: #e8f0f8 !important;
  font-size: 13px !important;
  line-height: 1.4 !important;
  width: 220px !important;
  max-width: 90vw !important;
  white-space: normal !important;
  word-wrap: break-word !important;
  z-index: 1000 !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  text-align: left !important;
  pointer-events: auto !important;
}

ti::before {
  content: '' !important;
  position: absolute !important;
  top: -1px !important;
  left: -1px !important;
  width: 10px !important;
  height: 10px !important;
  border: 1.5px solid #3ba9d9 !important;
  border-right: none !important;
  border-bottom: none !important;
  border-radius: 3px 0 0 0 !important;
  opacity: 0.5 !important;
}

ti::after {
  content: '' !important;
  position: absolute !important;
  top: 100% !important;
  left: 16px !important;
  border-width: 7px !important;
  border-style: solid !important;
  border-color: #1a6d9e transparent transparent transparent !important;
}

t:hover > ti,
t:active > ti,
t:focus > ti {
  display: block !important;
}

/* ---------- 8. 独立侧边栏（按钮触发，多实例支持，防回弹优化） ---------- */
.sidebar-unit {
  position: relative;
}

/* 触发按钮（悬浮球 - 强制圆形） */
.sidebar-unit .sidebar-toggle-button {
  position: fixed;
  top: 15vh;
  right: 20px;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  aspect-ratio: 1 / 1;               /* 强制 1:1 宽高比 */
  min-width: 48px;
  min-height: 48px;
  background: rgba(10, 14, 18, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid #1a6d9e;
  border-radius: 50% !important;      /* 强制正圆 */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #3ba9d9;
  cursor: pointer;
  z-index: 10001;
  box-shadow: 0 0 25px rgba(26, 109, 158, 0.3);
  transition: all 0.3s ease;
  user-select: none;
  outline: none;
  padding: 0;                         /* 清除默认内边距 */
  line-height: 1;
  box-sizing: border-box;
}

.sidebar-unit .sidebar-toggle-button:hover,
.sidebar-unit .sidebar-toggle-button:focus {
  background: rgba(26, 109, 158, 0.25);
  border-color: #3ba9d9;
  box-shadow: 0 0 40px rgba(26, 109, 158, 0.5);
  transform: translateY(-50%) scale(1.08);
}

/* 侧边栏容器 */
.sidebar-unit .sidebar-container {
  position: fixed;
  top: 15vh;
  right: -320px;
  transform: translateY(-50%);
  width: 280px;
  max-width: 85vw;
  max-height: 70vh;
  overflow-y: auto;
  background: rgba(10, 14, 18, 0.95);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border-left: 2px solid #1a6d9e;
  border-radius: 16px 0 0 16px;
  box-shadow: -4px 0 50px rgba(26, 109, 158, 0.25);
  padding: 20px 18px;
  z-index: 10000;
  transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  color: #e8f0f8;
  font-family: 'Segoe UI', 'PingFang SC', sans-serif;
  box-sizing: border-box;
}

/* 侧边栏打开状态 - 增强防回弹 */
.sidebar-unit .sidebar-toggle-button:focus + .sidebar-container,
.sidebar-unit .sidebar-toggle-button:focus-within + .sidebar-container,
.sidebar-unit .sidebar-container.active,
.sidebar-unit .sidebar-container:focus-within {
  right: 0;
}

/* 当侧边栏内部获得焦点时，保持按钮高亮 */
.sidebar-unit .sidebar-container:focus-within + .sidebar-toggle-button,
.sidebar-unit .sidebar-toggle-button:focus {
  background: rgba(26, 109, 158, 0.25);
  border-color: #3ba9d9;
  box-shadow: 0 0 40px rgba(26, 109, 158, 0.5);
}

/* 角标装饰 */
.sidebar-unit .sidebar-container::before,
.sidebar-unit .sidebar-container::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid #3ba9d9;
  opacity: 0.5;
  pointer-events: none;
  transition: opacity 0.4s, box-shadow 0.4s;
  z-index: 10;
}

.sidebar-unit .sidebar-container::before {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
  border-radius: 4px 0 0 0;
  box-shadow: -3px -3px 14px rgba(59, 169, 217, 0.25);
}

.sidebar-unit .sidebar-container::after {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
  border-radius: 0 0 4px 0;
  box-shadow: 3px 3px 14px rgba(59, 169, 217, 0.25);
}

.sidebar-unit .sidebar-container:hover::before,
.sidebar-unit .sidebar-container:hover::after {
  opacity: 1;
  box-shadow: 0 0 30px rgba(59, 169, 217, 0.6);
}

/* 滚动条 */
.sidebar-unit .sidebar-container::-webkit-scrollbar {
  width: 4px;
}
.sidebar-unit .sidebar-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
}
.sidebar-unit .sidebar-container::-webkit-scrollbar-thumb {
  background: #1a6d9e;
  border-radius: 4px;
}

/* 侧边栏标题 */
.sidebar-unit .sidebar-title {
  font-size: 1.15em;
  font-weight: 700;
  color: #3ba9d9;
  text-shadow: 0 0 20px rgba(26, 109, 158, 0.5);
  letter-spacing: 1.5px;
  padding-bottom: 12px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(59, 169, 217, 0.15);
  text-align: center;
  font-family: 'SF Mono', 'Fira Code', monospace;
  position: relative;
}

.sidebar-unit .sidebar-title::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 20%;
  width: 60%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #3ba9d9, transparent);
}

/* 内部通用区块 */
.sidebar-unit .profile-section {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(26, 109, 158, 0.3);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 20px;
  position: relative;
}

.sidebar-unit .profile-section::before,
.sidebar-unit .profile-section::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1.5px solid #3ba9d9;
  opacity: 0.35;
  pointer-events: none;
}

.sidebar-unit .profile-section::before {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
  border-radius: 3px 0 0 0;
}

.sidebar-unit .profile-section::after {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
  border-radius: 0 0 3px 0;
}

.sidebar-unit .profile-section > info {
  display: block;
  font-size: 1em;
  font-weight: 600;
  color: #3ba9d9;
  text-shadow: 0 0 12px rgba(26, 109, 158, 0.3);
  padding-bottom: 6px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(59, 169, 217, 0.1);
}

.sidebar-unit .item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-unit .item-entry {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(26, 109, 158, 0.12);
  border-radius: 10px;
  padding: 10px 12px;
  transition: all 0.25s ease;
}

.sidebar-unit .item-entry:hover {
  background: rgba(0, 0, 0, 0.45);
  border-color: #3ba9d9;
  transform: translateX(3px);
}

/* 监控信息 */
.sidebar-unit .monitor-info {
  color: #dce8f0;
  font-size: 13.5px;
  line-height: 1.7;
  letter-spacing: 0.3px;
  -webkit-font-smoothing: antialiased;
}

.sidebar-unit .monitor-info p {
  margin: 2px 0;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
}

.sidebar-unit .monitor-info b {
  color: #5ec8f0;
  font-weight: 700;
  margin-right: 4px;
  min-width: 40px;
  font-size: 13px;
  text-shadow: 0 0 6px rgba(94, 200, 240, 0.5);
}

.sidebar-unit .monitor-info p:last-child {
  margin-top: 3px;
  padding-left: 10px;
  border-left: 2px solid rgba(94, 200, 240, 0.4);
  color: #d0e4f0;
  font-style: normal;
  font-size: 13px;
  line-height: 1.6;
}

/* 商品 T / Ti 工具提示 - 增强交互，防止侧边栏回弹 */
.sidebar-unit .item-entry T {
  display: inline-block;
  position: relative;
  cursor: pointer;
  color: #5ec8f0;
  font-weight: 700;
  font-size: 13px;
  padding: 2px 0;
  text-decoration: underline dotted #5ec8f0;
  text-underline-offset: 3px;
  text-shadow: 0 0 8px rgba(94, 200, 240, 0.9);
  border-bottom: none;
}

.sidebar-unit .item-entry T:hover {
  color: #a0e7ff;
  text-shadow: 0 0 12px #5ec8f0;
  text-decoration-color: #a0e7ff;
}

.sidebar-unit .item-entry T Ti {
  display: none;
  position: absolute;
  bottom: calc(100% + 12px);
  left: 0;
  background: linear-gradient(160deg, #0d1f2d, #1a3345);
  border: 1.5px solid #5ec8f0;
  border-radius: 10px;
  padding: 10px 14px;
  color: #f0f8ff;
  font-size: 13px;
  line-height: 1.6;
  width: 200px;
  max-width: 70vw;
  white-space: normal;
  word-wrap: break-word;
  z-index: 10002;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 0 30px rgba(94, 200, 240, 0.6);
  pointer-events: auto;               /* 关键：允许 Tooltip 交互，防止侧边栏关闭 */
  cursor: default;
}

.sidebar-unit .item-entry T Ti::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  width: 10px;
  height: 10px;
  border: 1.5px solid #5ec8f0;
  border-right: none;
  border-bottom: none;
  border-radius: 3px 0 0 0;
  opacity: 0.5;
  pointer-events: none;
}

.sidebar-unit .item-entry T Ti::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 16px;
  border-width: 6px;
  border-style: solid;
  border-color: #5ec8f0 transparent transparent transparent;
  pointer-events: none;
}

.sidebar-unit .item-entry T:hover Ti,
.sidebar-unit .item-entry T:focus-within Ti {
  display: block;
}

/* 响应式调整 */
@media (max-width: 640px) {
  .sidebar-unit .sidebar-toggle-button {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    font-size: 20px;
    right: 12px;
    top: 12vh;
    border-radius: 50% !important;    /* 移动端也保持圆形 */
  }
  .sidebar-unit .sidebar-container {
    width: 80vw;
    right: -80vw;
    padding: 14px 12px;
    top: 12vh;
  }
  .sidebar-unit .item-entry T Ti {
    width: 160px;
    font-size: 12px;
  }
}

/* ---------- 9. 关键帧（整合） ---------- */
@keyframes progress-shine {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes summary-sweep {
  0% { left: -100%; }
  100% { left: 100%; }
}

@keyframes input-glow-pulse {
  from {
    box-shadow: 0 0 15px rgba(26, 109, 158, 0.7),
                0 0 30px rgba(26, 109, 158, 0.5),
                inset 0 0 5px rgba(26, 109, 158, 0.3);
  }
  to {
    box-shadow: 0 0 25px rgba(59, 169, 217, 1),
                0 0 50px rgba(26, 109, 158, 0.8),
                inset 0 0 12px rgba(26, 109, 158, 0.5);
  }
}

@keyframes spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes camera-led-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}
/* ============================================================
   进度条颜色修正补丁
   根据 data-profile 区分用户档案与角色档案，正确匹配进度条颜色
   ============================================================ */

/* 用户档案：生命值（绿色）、精力值（蓝色） */
details[data-profile="user"] progress:nth-of-type(1)::-webkit-progress-value {
  background-image: linear-gradient(90deg, #16a085, #2ecc71, #16a085) !important;
}
details[data-profile="user"] progress:nth-of-type(1)::-moz-progress-bar {
  background: linear-gradient(90deg, #16a085, #2ecc71) !important;
}

details[data-profile="user"] progress:nth-of-type(2)::-webkit-progress-value {
  background-image: linear-gradient(90deg, #2471a3, #3498db, #2471a3) !important;
}
details[data-profile="user"] progress:nth-of-type(2)::-moz-progress-bar {
  background: linear-gradient(90deg, #2471a3, #3498db) !important;
}

/* 角色档案：好感度（淡粉）、警惕值（红色）、顺从度（粉红）、堕落值（紫色） */
details[data-profile="char"] progress:nth-of-type(1)::-webkit-progress-value {
  background-image: linear-gradient(90deg, #f2a7b6, #ffd6de, #f2a7b6) !important;
}
details[data-profile="char"] progress:nth-of-type(1)::-moz-progress-bar {
  background: linear-gradient(90deg, #f2a7b6, #ffd6de) !important;
}

details[data-profile="char"] progress:nth-of-type(2)::-webkit-progress-value {
  background-image: linear-gradient(90deg, #c0392b, #e74c3c, #c0392b) !important;
}
details[data-profile="char"] progress:nth-of-type(2)::-moz-progress-bar {
  background: linear-gradient(90deg, #c0392b, #e74c3c) !important;
}

details[data-profile="char"] progress:nth-of-type(3)::-webkit-progress-value {
  background-image: linear-gradient(90deg, #d63384, #ff69b4, #d63384) !important;
}
details[data-profile="char"] progress:nth-of-type(3)::-moz-progress-bar {
  background: linear-gradient(90deg, #d63384, #ff69b4) !important;
}

details[data-profile="char"] progress:nth-of-type(4)::-webkit-progress-value {
  background-image: linear-gradient(90deg, #7d3c98, #9b59b6, #7d3c98) !important;
}
details[data-profile="char"] progress:nth-of-type(4)::-moz-progress-bar {
  background: linear-gradient(90deg, #7d3c98, #9b59b6) !important;
}