:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-color: #3b82f6;
  --up-color: #ef4444; /* 中国股市红涨绿跌 */
  --down-color: #22c55e;
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Outfit", sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Background Effects */
.glass-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  background:
    radial-gradient(
      circle at 15% 50%,
      rgba(59, 130, 246, 0.15) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 85% 30%,
      rgba(239, 68, 68, 0.1) 0%,
      transparent 50%
    );
  filter: blur(80px);
}

.container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 2rem;
}

.header {
  text-align: center;
  margin-bottom: 3rem;
  animation: fadeInDown 0.8s ease-out;
}

.header h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -1px;
}

.gradient-text {
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header p {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  margin-left: 0.5rem;
  vertical-align: middle;
  transition:
    opacity 0.3s,
    transform 0.3s;
  opacity: 0.7;
}
.icon-btn:hover {
  opacity: 1;
  transform: scale(1.1);
}

.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 1.5rem 1.3rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.overview-panel {
  display: flex;
  justify-content: space-around;
  margin-bottom: 2rem;
  animation: fadeIn 1s ease-out;
}

.overview-item {
  text-align: center;
}

.overview-item .label {
  /* display: block; */
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
}

.overview-item h2 {
  font-size: 2.5rem;
  font-weight: 600;
  transition:
    color 0.3s,
    filter 0.3s;
}

.privacy-hidden {
  filter: blur(8px);
  user-select: none;
}

.add-section {
  margin-bottom: 2rem;
  animation: fadeIn 1.2s ease-out;
}

.toolbar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.5rem;
}

.input-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  width: 100%;
}

.action-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 0.8rem 1.2rem;
  font-size: 1rem;
  font-family: "Outfit", sans-serif;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.3);
}

.input-group input {
  flex: 1;
  min-width: 200px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: "Outfit", sans-serif;
  transition: all 0.3s;
  outline: none;
}

.input-group input:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.glow-btn {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.glow-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
}

.error-msg {
  color: var(--up-color);
  margin-top: 0.5rem;
  font-size: 0.9rem;
  display: none;
}

.fund-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

@media (max-width: 600px) {
  .fund-list {
    grid-template-columns: 1fr;
  }
}

/* --- 列表模式排版覆盖 --- */
.fund-list.list-mode {
  grid-template-columns: 1fr;
}
.fund-list.list-mode .fund-card {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  padding-right: 4rem; /* 为绝对定位的删除按钮留出空间 */
}
.fund-list.list-mode .delete-btn {
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
}
.fund-list.list-mode .fund-header {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
  flex: 0 0 340px; /* 锁死左侧栏的列宽，避免被长短不一的名字撑破变形 */
  width: 340px;
  display: flex;
  align-items: center;
}
.fund-list.list-mode .fund-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
}
.fund-list.list-mode .fund-title > div {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.fund-list.list-mode .fund-body {
  display: flex;
  gap: 1rem;
  flex: 1;
  justify-content: flex-end;
  align-items: center;
}
.fund-list.list-mode .data-item {
  flex: 1; /* 强制等分网格，形成完美的列对齐表格 */
  align-items: flex-end;
}
.fund-list.list-mode .update-time {
  position: static;
  margin-top: 0;
  margin-left: 0;
  flex-shrink: 0;
}

/* 移动端高度压缩字号与间距，强制恢复横向单行列表模式 */
@media (max-width: 900px) {
  .fund-list {
    gap: 0.8rem; /* 减小卡片之间的整体缝隙 */
  }
  .fund-list.list-mode .fund-card {
    flex-direction: row;
    align-items: center;
    padding: 0.8rem 0.5rem;
    gap: 0.3rem;
  }
  .fund-list.list-mode .delete-btn {
    top: 50%;
    right: 0.5rem;
    transform: translateY(-50%);
  }
  .fund-list.list-mode .fund-header {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
    flex: 0 0 28%; /* 再次缩小名字列占比，留给数字展示 */
    width: 28%;
    align-items: flex-start;
  }
  .fund-list.list-mode .fund-title {
    align-items: flex-start;
  }
  .fund-list.list-mode .fund-title > div {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
  }
  .fund-list.list-mode .fund-name {
    font-size: 0.65rem; /* 将名字再进一步缩放 */
    line-height: 1.25;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* 基金名字太长则折成两行断流 */
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .fund-list.list-mode .fund-code {
    display: none !important; /* 隐藏基金代码 */
  }
  .fund-list.list-mode .updated-badge {
    display: none !important; /* 空间拮据，隐去更新徽章 */
  }
  .fund-list.list-mode .update-time {
    display: block !important; /* 恢复估值时间的区域显示 */
    font-size: 0.5rem; /* 字号极其微缩 */
    margin-top: 0.2rem;
    color: var(--text-secondary);
    text-align: left;
  }
  .fund-list.list-mode .time-label {
    display: none !important; /* 只隐去“估值时间：”这几个字 */
  }
  .fund-list.list-mode .time-in-card {
    display: none !important; /* 屏蔽卡片底部的多余时间DOM，保留 title 内部的那一个 */
  }
  .fund-list.list-mode .est-val-col,
  .fund-list.list-mode .data-item:nth-child(3) {
    display: none !important; /* 纯CSS双保险藏起预估净值列，腾出横向空间 */
  }
  .fund-list.list-mode .fund-body {
    display: flex;
    flex: 1;
    gap: 0.2rem; /* 恢复宽度平分后可以减小生硬的固定间距 */
    justify-content: flex-end;
    padding-right: 1.2rem; /* 给右边绝对定位的删除按钮留出专属空间 */
  }
  .fund-list.list-mode .data-item {
    flex: 1; /* 恢复平分剩余空间的设定，将原本挤在右侧的内容拉宽分散 */
    align-items: flex-end; /* 维持内部的每一列都在自己领地里向右对齐 */
  }
  .fund-list.list-mode .label {
    font-size: 0.52rem; /* 标题表头极小化 */
    white-space: nowrap;
    margin-bottom: 0.1rem;
    color: var(--text-secondary);
    height: 20px;
    display: flex;
    align-items: center;
  }
  .fund-list.list-mode .value {
    font-size: 0.76rem; /* 数字进调大 */
    white-space: nowrap;
    justify-content: flex-end; /* 让里面包裹的内联flex内容彻底靠右 */
    width: 100%;
    text-align: right;
    line-height: 1.2;
  }
  .fund-list.list-mode .edit-btn svg {
    width: 12px;
    height: 12px;
  }
}

.fund-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 1.5rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  animation: slideUp 0.5s forwards;
  opacity: 0;
}

.fund-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.2);
}

.fund-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 0.8rem;
}

.fund-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.fund-name {
  font-size: 1.05rem;
  font-weight: 600;
}

.updated-badge {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.15); /* 微弱的翡翠绿背景 */
  color: #10b981; /* 柔和翠绿字色 */
  border: 1px solid rgba(16, 185, 129, 0.3);
  backdrop-filter: blur(4px);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.1);
  letter-spacing: 0.5px;
}

.fund-code {
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

.delete-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.2rem;
  transition: color 0.3s;
  padding: 4px;
}

.delete-btn:hover {
  color: #ef4444;
}

.edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.5;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem;
}

.edit-btn:hover {
  opacity: 1;
  transform: scale(1.1);
}

.fund-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.data-item {
  display: flex;
  flex-direction: column;
}

.data-item .label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

.data-item .value {
  font-size: 1.1rem;
  font-weight: 500;
}

.profit-up {
  color: var(--up-color);
}
.profit-down {
  color: var(--down-color);
}
.profit-neutral {
  color: var(--text-primary);
}

.update-time {
  margin-top: 1rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: right;
}

/* 极简模式对应的隐藏与调整 */
.compact-mode .fund-code,
.compact-mode .data-item:nth-child(1),
.compact-mode .data-item:nth-child(4) {
  display: none !important;
}

.compact-mode .fund-body {
  grid-template-columns: 1fr 1fr;
  align-items: center;
}

.compact-mode .fund-card {
  padding: 1rem 1.5rem;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  width: 90%;
  max-width: 450px;
  text-align: center;
  transform: translateY(-20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}

.modal-title {
  font-size: 1.5rem;
  margin-bottom: 0.8rem;
}

.modal-desc {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 1rem;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-btn {
  padding: 1rem;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: all 0.3s;
}

.btn-primary {
  background: var(--accent-color);
  color: white;
}

.btn-primary:hover {
  background: #2563eb;
  transform: translateY(-2px);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.3);
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* --- 分组 Tabs 样式 --- */
.group-tabs::-webkit-scrollbar {
  height: 4px;
}
.group-tabs::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 4px;
}
.group-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  padding: 0.5rem 0.5rem;
  border-radius: 0;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.group-tab:hover {
  background: transparent;
  color: var(--text-primary);
}
.group-tab.active {
  background: transparent;
  color: var(--text-primary);
  border-bottom-color: var(--accent-color);
  font-weight: 500;
}

/* --- “添加分组”专用强视觉样式 --- */
#add-group-btn {
  border: 1px dashed rgba(255, 255, 255, 0.3) !important; /* 虚线框，暗示点击添加 */
  background: rgba(255, 255, 255, 0.05) !important; /* 常驻的微弱底色 */
  border-radius: 8px;
  padding: 0.3rem 0.8rem; /* 增加内缩进撑开方形按钮质感 */
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  color: var(--accent-color); /* 蓝色提示文字 */
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#add-group-btn:hover {
  background: rgba(59, 130, 246, 0.15) !important; /* 悬浮时较强的蓝色高亮 */
  border-color: rgba(59, 130, 246, 0.5) !important; /* 边框变蓝发光 */
  opacity: 1 !important;
  transform: translateY(-2px) scale(1.05) !important; /* 略微上浮放大带来反馈感 */
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}
.group-tab .delete-group-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  border-radius: 50%;
  aspect-ratio: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.2rem;
  opacity: 0.5;
  transition: all 0.2s;
  padding: 2px;
}
.group-tab .delete-group-btn:hover {
  color: #ef4444;
  opacity: 1;
}
.group-tab .edit-group-icon:hover {
  color: var(--primary-color);
  opacity: 1;
}
.edit-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
}
.edit-btn:hover {
  color: var(--primary-color);
  background: rgba(59, 130, 246, 0.1);
}

/* 显示/隐藏两种预生成的估值时间DOM */
.fund-card .time-in-title {
  display: none;
}
.fund-card .time-in-card {
  display: block;
}
.fund-list.list-mode .time-in-title {
  display: block;
}
.fund-list.list-mode .time-in-card {
  display: none;
}

/* ========================================= */
/* --- 移动端 H5 响应式适配方案 (max-width: 768px) --- */
/* ========================================= */
@media screen and (max-width: 768px) {
  html {
    /* 
      iPhone 375px 基准下的动态缩放:
      375px 时 = 16px (16 / 3.75 = 4.266vw) 
      下潜极限：12px
      上限封顶：16px (避免平版尺寸字体过大)
    */
    font-size: clamp(12px, 4.266vw, 16px) !important;
  }

  .glass-panel {
    margin-bottom: 1.2rem !important; /* 统一压缩移动端各大面板之间的垂直间距 */
  }

  .container {
    padding: 1rem; /* 减小整页内边距 */
  }

  .header {
    margin-bottom: 2rem;
  }

  .header h1 {
    font-size: clamp(2rem, 8vw, 2.5rem); /* 标题动态缩放 */
  }

  .header p {
    font-size: 0.8rem;
  }

  /* 顶部总览双栏改为紧凑排列 */
  .overview-panel {
    flex-direction: row; /* 保持左右两列或上下均可，这里保持左右但缩小字号 */
    padding: 1rem;
    gap: 1rem;
    align-items: center;
  }

  .overview-item h2 {
    font-size: clamp(1.5rem, 6vw, 2rem);
    white-space: nowrap; /* 防止金额换行 */
  }

  .overview-item .label {
    font-size: 0.8rem;
    justify-content: center;
  }

  /* 分组标签页 */
  .group-tabs-container {
    padding: 0.6rem 1rem !important; /* 覆盖内联样式 */
    margin-bottom: 1.5rem !important;
    flex-direction: column; /* 空间不足时，控制台换行 */
    align-items: flex-start !important;
    gap: 1rem;
  }

  .group-tabs {
    width: 100%;
    padding-bottom: 0.4rem !important;
  }

  /* 控制台输入区域 */
  .toolbar {
    gap: 1rem;
  }

  .input-group {
    flex-direction: column; /* 手机端输入框上下排列占据整宽 */
    gap: 0.8rem;
  }

  .input-group input {
    width: 100%;
    min-width: unset;
  }

  .action-group {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 手机端一行三个 */
    gap: 0.5rem;
  }

  .secondary-btn {
    padding: 0.6rem 0.4rem !important; /* 减小字体撑开空间的内边距，一行三个比较挤 */
    font-size: 0.75rem !important; /* 字号再缩一点点，防止溢出或换行 */
    justify-content: center; /* 居中文字和图标 */
    flex-direction: column; /* 手机端可以把图标和文字上下排布以更省空间 */
    gap: 0.2rem;
  }

  .glow-btn {
    width: 100%; /* 添加按钮撑满 */
  }

  /* 原生 Modal 其他弹窗强化移动端适配 */
  .modal-content {
    width: 80%; /* 根据用户要求修改为80% */
    max-width: 320px; /* 移动端防过宽 */
    padding: 1.5rem 1.2rem;
  }
  .modal-title {
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
  }
  .modal-desc {
    font-size: 0.8rem;
    margin-bottom: 1.5rem;
  }
  .modal-actions {
    gap: 0.8rem;
  }

  .modal-actions[style*="flex-direction: row"] {
    flex-direction: column !important; /* 强制底部双按钮在小屏幕垂直堆叠，避免文字挤压 */
  }

  .modal-actions .modal-btn {
    width: 100%;
    padding: 0.8rem;
    font-size: 0.85rem;
  }

  /* 调整基础卡片内边距 */
  .fund-card {
    padding: 1.2rem;
  }

  .fund-header {
    margin-bottom: 0.8rem;
    padding-bottom: 0.6rem;
  }

  .fund-name {
    font-size: 1rem;
  }

  .data-item .label {
    height: 24px;
    display: flex;
    align-items: center;
  }

  .data-item .value {
    font-size: 1.15rem;
  }

  .update-time {
    margin-top: 0.8rem;
  }

  /* --- 补充极简模式 / 列表模式在手机端的细节 --- */
  .fund-list.list-mode .fund-card {
    padding: 1rem;
  }
  .fund-list.list-mode .data-item {
    align-items: flex-end; /* 改为居中，原为 flex-start */
  }
  /* ------------------------------- */
  /* - 移动端专属交互：抽屉与弹窗 - */
  /* ------------------------------- */
  /* 汉堡按钮保持在绝对左侧竖直居中，主标题整体居中 */
  .header {
    position: relative;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .mobile-only-btn {
    display: inline-block;
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    z-index: 100;
  }

  /* --- 分组抽屉 (Drawer) --- */
  .drawer-overlay {
    display: block; /* 激活时通过 opacity 显示 */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 900;
    opacity: 0;
    pointer-events: none; /* 默认不阻挡点击 */
    transition: opacity 0.3s;
  }
  .drawer-overlay.active {
    opacity: 1;
    pointer-events: auto; /* 打开时阻挡全屏点击 */
  }

  .mobile-drawer-title {
    display: block;
    width: 100%;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0rem;
    color: var(--text-primary);
  }

  .group-tabs-container {
    position: fixed !important;
    top: 0 !important;
    left: -100% !important; /* 默认飞到左侧屏幕外 */
    width: 80% !important; /* 抽屉宽度 */
    height: 100vh !important;
    margin: 0 !important;
    border-radius: 0 20px 20px 0 !important;
    z-index: 901;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    overflow-y: auto;

    /* 修正抽屉内元素竖向排列 */
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    padding: 1.5rem 1.5rem 1.5rem !important; /* 顶部留空给关闭区域 */
  }
  .group-tabs-container.drawer-open {
    left: 0 !important; /* 滑出 */
  }
  .group-tabs {
    flex-direction: column !important; /* 竖向列表 */
    width: 100% !important;
    overflow: visible !important; /* 防止被截断 */
  }
  .group-tab {
    width: 100% !important;
    padding: 1rem 0.5rem !important;
    font-size: 1.1rem !important;
  }

  /* --- 添加基金 (Center Modal) --- */
  .sheet-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 900;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
  }
  .sheet-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  .add-section {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) scale(0.95);
    width: 80% !important;
    max-width: 400px;
    margin: 0 !important;
    border-radius: 20px !important;
    z-index: 901 !important;
    padding: 2rem 1.5rem !important;
    opacity: 0;
    visibility: hidden; /* 隐藏未激活状态，防止刷新时出现过渡渲染闪烁 */
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
  }
  .add-section.sheet-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
  }

  /* FAB 悬浮按钮 */
  .mobile-fab {
    display: flex;
    position: fixed;
    bottom: 2rem;
    right: 1.5rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    z-index: 800;
    cursor: pointer;
    transition: transform 0.2s;
  }
  .mobile-fab:active {
    transform: scale(0.9);
  }
}

/* 在大屏幕 PC 上，强制隐藏为移动端设计的所有特有控制按钮及遮罩层 */
@media screen and (min-width: 769px) {
  .mobile-only-btn,
  .mobile-fab,
  .drawer-overlay,
  .sheet-overlay,
  .mobile-drawer-title {
    display: none !important;
  }
}

/* --- 趋势图弹窗专用样式 --- */
.chart-modal-content {
  max-width: 650px;
  padding: 1.5rem 1rem;
}

.chart-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0 0.5rem;
}

#chart-fund-name {
  margin: 0;
  font-size: 1.1rem;
  text-align: left;
}

#close-chart-btn {
  font-size: 1.5rem;
  line-height: 1;
}

.chart-tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 0.5rem;
  justify-content: center;
}

.chart-tab-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}

.chart-tab-btn:hover {
  color: var(--text-primary);
}

.chart-tab-btn.active {
  color: var(--accent-color);
  font-weight: 600;
}

.chart-tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: -0.5rem;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent-color);
  box-shadow: 0 0 10px var(--accent-color);
}

.chart-pane {
  display: none;
  animation: fadeIn 0.4s ease-out;
}

.chart-pane.active {
  display: block;
}

.dimension-selector {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.dimension-selector .dim-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  padding: 0.3rem 0.8rem;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s;
}

.dimension-selector .dim-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.dimension-selector .dim-btn.active {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

/* 适配移动端弹窗高度及细节 */
@media screen and (max-width: 768px) {
  #chart-modal .chart-modal-content {
    width: 92%;
    padding: 1rem 0.6rem; /* 减小内边距 */
  }

  .chart-modal-header {
    margin-bottom: 0.6rem;
  }

  #chart-fund-name {
    font-size: 1rem; /* 字体适度缩小 */
  }

  .chart-tabs {
    margin-bottom: 1rem;
  }

  .chart-tab-btn {
    font-size: 0.9rem; /* 缩小 Tab 文字 */
    padding: 0.3rem 0.5rem;
  }

  /* 适度调低移动端分时图和历史图容器的高度 */
  #intraday-echart,
  #history-echart {
    height: 220px !important; /* 缩小高度 */
  }

  .dimension-selector {
    gap: 0.3rem;
    margin-top: 0.6rem;
  }

  .dimension-selector .dim-btn {
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem; /* 缩小按钮文字 */
  }
}
