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

/* ===== 自定义字体：钉钉进步体 ===== */
@font-face {
  font-family: 'Alibaba PuHuiTi';
  /* 使用 jsDelivr 加载字体文件 */
  src: url('https://cdn.jsdelivr.net/npm/@alleyway-boop/fonts@1.0.0/fonts/AlibabaPuHuiTi-2-55-Regular.woff2') format('woff2'),
       url('https://cdn.jsdelivr.net/npm/@alleyway-boop/fonts@1.0.0/fonts/AlibabaPuHuiTi-2-55-Regular.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap; /* 优化加载性能 */
}
@font-face {
  font-family: 'DingTalk JinBuTi';
  /* 使用 jsDelivr 加载字体文件 */
  src: url('https://cdn.jsdelivr.net/npm/cn-fontsource-ding-talk-jin-bu-ti-regular@1.0.3/files/ding-talk-jin-bu-ti-regular-latin-400-normal.woff2') format('woff2'),
       url('https://cdn.jsdelivr.net/npm/cn-fontsource-ding-talk-jin-bu-ti-regular@1.0.3/files/ding-talk-jin-bu-ti-regular-latin-400-normal.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f0f2f5;
  color: #333;
  min-height: 100vh;
  padding: 20px;
}

/* ===== 控制面板 ===== */
.control-panel {
  background: #fff; border-radius: 16px; padding: 24px 28px;
  margin-bottom: 20px; box-shadow: 0 4px 20px rgba(0,0,0,.08);
  position: relative;
  overflow: hidden;
}
.control-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: #667EEA;
}

/* 标题栏容器 - 包含标题文字和折叠按钮 */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  position: relative;
  z-index: 10;
}

.panel-title {
  font-family: 'Alibaba PuHuiTi', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 18px; font-weight: 700; color: #2c3e50;
  display: flex; align-items: center; gap: 10px;
  letter-spacing: 1px;
  margin-bottom: 0; /* 移除底部边距，由容器控制 */
  line-height: 1.4;
  padding: 4px 0; /* 与按钮对齐 */
}
.panel-title::before {
  content: ''; width: 5px; height: 22px; background: #667EEA;
  border-radius: 3px;
  box-shadow: 0 2px 8px rgba(102,126,234,0.4);
}

/* 折叠按钮样式 */
.panel-toggle-btn {
  position: relative; /* 改为相对定位 */
  top: auto; right: auto;
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border: 1.5px solid #dee2e6;
  cursor: pointer;
  font-size: 14px;
  color: #495057;
  padding: 6px 14px;
  border-radius: 8px;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(0,0,0,.05);
}
.panel-toggle-btn:hover {
  background: #667EEA;
  color: #fff;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102,126,234,.25);
}
.panel-toggle-btn:active {
  transform: translateY(0);
}

.control-row {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end;
}
.ctrl-group { display: flex; flex-direction: column; gap: 6px; }
.ctrl-group label {
  font-size: 12px; color: #7f8c8d; font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.ctrl-group input, .ctrl-group select {
  border: 2px solid #e8ecef; border-radius: 10px;
  padding: 10px 14px; font-size: 13px; outline: none;
  transition: all .25s ease; background: #f8fafc;
  min-width: 190px;
  box-shadow: 0 2px 4px rgba(0,0,0,.02);
}
.ctrl-group input:hover, .ctrl-group select:hover {
  border-color: #c5d0e6;
  background: #fff;
}
.ctrl-group input:focus, .ctrl-group select:focus {
  border-color: #667eea; background: #fff;
  box-shadow: 0 0 0 3px rgba(102,126,234,.15), 0 4px 12px rgba(102,126,234,.1);
}

/* 查询按钮 */
.btn-query {
  height: 42px; padding: 0 32px; border: none; border-radius: 10px;
  background: #667EEA;
  color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .25s ease;
  white-space: nowrap;
  box-shadow: 0 4px 15px rgba(102,126,234,.35);
  letter-spacing: 1px;
}
.btn-query:hover {
  opacity: 1; transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102,126,234,.45);
}
.btn-query:active { transform: translateY(0); box-shadow: 0 2px 10px rgba(102,126,234,.3); }
.btn-query:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* 人员多选区 */
.member-select-area {
  margin-top: 16px; padding-top: 16px; border-top: 1px solid #eee;
}
.member-select-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.member-select-area label {
  font-size: 12px; color: #888; font-weight: 600;
}
.member-chips {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.member-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 15px; border-radius: 20px; font-size: 13px;
  cursor: pointer; user-select: none; transition: all .25s ease;
  border: 2px solid #e0e0e0; background: #fafbfc; color: #666;
  font-weight: 500;
}
.member-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0,0,0,.08);
}
.member-chip.selected {
  color: #fff; border-color: transparent;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.member-chip .chip-check {
  width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid currentColor;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; transition: background .2s;
}
.member-chip.selected .chip-check { background: rgba(255,255,255,.3); }

/* 快捷操作 */
.quick-actions {
  display: flex; gap: 10px;
}
.quick-btn {
  padding: 4px 14px; border: 1px solid #ddd; border-radius: 14px;
  background: #fff; font-size: 12px; color: #777; cursor: pointer;
  transition: all .2s;
}
.quick-btn:hover { border-color: #667eea; color: #667eea; }

/* ===== 卡片网格 ===== */
.container-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
@media (max-width: 1100px) { .container-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .container-grid { grid-template-columns: 1fr; } }

/* ===== 成员卡片 ===== */
.member-section {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,.07);
  animation: fadeIn .35s ease-out both;
  transition: transform .25s ease, box-shadow .25s ease;
}
.member-section:hover {
  transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,.12);
}
@keyframes fadeIn { from{opacity:0;transform:translateY(12px)} to{opacity:1;transform:none} }

/* 区块头部 */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  background: #667EEA;
  color: #fff;
  transition: background .3s ease;
}
.section-head.failed {
  background: linear-gradient(135deg, #e74c3c, #c0392b) !important;
}
.section-head .name {
  font-family: 'DingTalk JinBuTi', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 18px;
  letter-spacing: 3px;
}
.section-head .status {
  font-size: 13px;
  font-weight: 800;
  color: #db4e50;
  padding: 3px 12px;
  border-radius: 20px;
  background: rgb(255 255 255);
  white-space: nowrap;
}

/* 区块内容 */
.section-body { padding: 18px 20px; }

/* 礼物统计 */
.block-title {
  font-size: 12px; color: #aaa; text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 10px; font-weight: 600;
}
.gift-row {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px;
}
.gift-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; background: #f6f7fb; border-radius: 20px; font-size: 13px;
}
.gift-chip .gname { color: #666; }
.gift-chip .gnum { font-weight: 700; color: #444; }
.gift-chip .gvote { font-size: 11px; color: #667eea; font-weight: 600; }

/* 粉丝榜单 */
.fan-table-wrap {
  max-height: 220px; overflow-y: auto;
  border-radius: 10px; border: 1px solid #eee;
}
.fan-table-wrap::-webkit-scrollbar { width: 5px; }
.fan-table-wrap::-webkit-scrollbar-thumb { background: #ddd; border-radius: 5px; }
.fan-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.fan-table th {
  background: #fafbfc; padding: 9px 14px;
  text-align: left; font-weight: 600; color: #888;
  position: sticky; top: 0; z-index: 1;
}
.fan-table td {
  padding: 8px 14px; border-top: 1px solid #f2f2f2; color: #555;
}
.fan-table tr:hover td { background: #fafbfc; }
.fan-score { font-weight: 700; color: #667eea; }
.rank-num { width: 40px; text-align: center; font-weight: 600; color: #bbb; }
.rank-1 { color: #ffd700; }
.rank-2 { color: #c0c0c0; }
.rank-3 { color: #cd7f32; }

/* 加载 / 错误 / 空 */
.msg-box {
  text-align: center; padding: 30px 20px; color: #bbb; font-size: 14px;
}
.error-text { color: #e74c3c; }
.spinner {
  width: 32px; height: 32px; border: 3px solid #e8e8e8;
  border-top-color: #667eea; border-radius: 50%;
  animation: spin .6s linear infinite; margin: 0 auto 10px;
}
@keyframes spin { to{transform:rotate(360deg)} }

/* 空状态 */
.empty-hint {
  text-align: center; padding: 60px 20px; color: #ccc; font-size: 15px;
}
