/* ================= 全局样式 (遵循配色要求) ================= */
:root {
  --bg-color: #f7f3e5; /* 米白 */
  --orange: #f48d45; /* 橙 */
  --yellow: #f4bb6e; /* 黄 */
  --light-purple: #acb6f3; /* 浅紫 */
  --dark-purple: #8985cf; /* 深紫 */
  --text-main: #333;
  --text-gray: #666;
}

/* @font-face {
  font-family: 'Alibaba PuHuiTi';
  src: url('./alibaba-puhuiti.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
} */

body {
  background-color: var(--bg-color);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  /* font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica,
    Arial, sans-serif; */
  /* font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Microsoft YaHei",
    Arial, sans-serif; */
  /* font-family: "AlibabaPuHuiTi", "Alibaba PuHuiTi", "Microsoft YaHei", Arial, sans-serif; 使用阿里巴巴普惠体 */
  color: var(--text-main);
  margin: 0;
  padding: 0;
  line-height: 1.8;
  overflow-x: hidden;
}

/* 文章容器 */
.article-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 60px 20px;
}

h1 {
  font-size: 42px;
  font-weight: bold;
  color: var(--orange);
  text-align: center;
  margin-bottom: 60px;
  letter-spacing: -1px;
}

h2 {
  font-size: 28px;
  font-weight: bold;
  color: var(--text-main);
  margin-top: 80px;
  margin-bottom: 30px;
  padding-bottom: 10px;
  border-bottom: 4px solid var(--light-purple);
  display: inline-block;
}

p {
  font-size: 18px;
  margin-bottom: 24px;
  text-align: justify;
}

.highlight {
  background: linear-gradient(180deg, transparent 60%, var(--light-purple) 60%);
  font-weight: bold;
}

.text-center {
  text-align: center;
}

.text-bold {
  font-weight: bold;
}

.text-larger {
  font-size: 20px;
}

img {
  display: block;
  outline: none;
  max-width: 100%;
}

/* ================= 插入1：搜索演示 ================= */
.search-window {
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(137, 133, 207, 0.1);
  margin: 40px auto 60px;
  text-align: center;
  position: relative;
}

.search-window * {
  box-sizing: border-box;
}

/* 百度Logo样式 */
.baidu-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
}

.baidu-logo img {
  width: 260px;
  height: auto;
  max-height: 130px;
}

/* 搜索框区域 */
.search-container {
  position: relative;
  width: 100%;
  margin-bottom: 30px;
}

/* 搜索框包装器 - 用于光标定位 */
.search-box-wrapper {
  position: relative;
  width: 100%;
}

/* 搜索框样式 */
.search-box {
  width: 100%;
  padding: 14px 18px;
  font-size: 16px;
  border: 2px solid #ccc;
  border-radius: 24px;
  outline: none;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  background-color: white;
  position: relative;
  z-index: 1;
  display: block;
  box-sizing: border-box;
}

.search-box:focus {
  border-color: #4e6ef2;
  box-shadow: 0 2px 12px rgba(78, 110, 242, 0.3);
}

/* 光标闪烁效果 */
.cursor {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 20px;
  width: 2px;
  background-color: #4e6ef2;
  animation: blink 1s infinite;
  pointer-events: none;
  z-index: 2;
  display: none; /* 默认隐藏 */
}

/* 搜索按钮 */
.search-button {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background-color: #4e6ef2;
  color: white;
  border: none;
  border-radius: 16px;
  padding: 8px 20px;
  font-size: 15px;
  cursor: pointer;
  transition: background-color 0.3s;
  z-index: 3;
}

.search-button:hover {
  background-color: #3a56d8;
}

/* 光标闪烁动画 */
@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

/* 自动补全容器 */
.autocomplete-container {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  margin-top: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
  overflow: hidden;
}

/* 修改：移除hover和focus的自动显示，改为通过类控制 */
.autocomplete-container.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* 补全项列表 */
.autocomplete-list {
  list-style: none;
}

.autocomplete-item {
  padding: 14px 20px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  opacity: 0;
  transform: translateY(10px);
}

.autocomplete-item.show {
  opacity: 1;
  transform: translateY(0);
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover {
  background-color: #f8f9fa;
}

/* 放大镜图标样式 */
.search-icon {
  margin-right: 12px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 使用SVG放大镜图标 */
.search-icon::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23aaa'%3E%3Cpath d='M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  filter: brightness(0) saturate(100%) invert(60%) sepia(0%) saturate(0%)
    hue-rotate(180deg) brightness(90%) contrast(90%);
}

/* 搜索文本样式 */
.autocomplete-text {
  font-size: 15px;
  color: #333;
  flex-grow: 1;
}

/* 高亮"为什么女人"文字 */
.highlight-text {
  color: #ff0000;
  font-weight: 500;
}

/* 提示文本 */
.hint-text {
  color: #666;
  font-size: 14px;
  text-align: center;
  margin-top: 20px;
  padding: 10px;
  background-color: rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

/* 动画效果 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.4s ease forwards;
}

/* 自动打字效果 */
@keyframes typewriter {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes fadeInItem {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ================= 插入2：流程图 ================= */

/* ================= 插入3 & 4：柱状图容器 ================= */
.bar-window {
  /* background: white; */
  /* padding: 40px 20px; */
  /* border-radius: 20px; */
  /* box-shadow: 0 10px 30px rgba(137, 133, 207, 0.1); */
  margin: 20px auto 60px;
  /* max-width: 700px; */
  /* text-align: center; */
  position: relative;
}

.bar-window * {
  box-sizing: border-box;
}

.description-highlight {
  color: #8985cf; /* 使用指定的紫色 */
  font-weight: bold;
}

.result-line {
  display: block; /* 使"结果如下："单独占一行 */
  margin-top: 10px; /* 与上文保持距离 */
  font-weight: 600; /* 稍微加粗强调 */
}

/* NBI图表样式 - 无背景 */
.chart-section {
  padding: 0;
  margin: 0;
  background-color: transparent;
  margin-left: -20px; /* 向左移动整个图表区域 */
}

.chart-title {
  text-align: center;
  font-size: 24px;
  font-weight: bold;
  color: #333;
  margin-bottom: 8px;
  margin-left: 20px; /* 补偿标题的移动，使其居中 */
  font-family: "AlibabaPuHuiTi", "Microsoft YaHei", Arial, sans-serif; /* 图表标题也使用相同字体 */
}

.chart-subtitle {
  text-align: center;
  font-size: 16px;
  color: #666;
  margin-bottom: 30px;
  font-family: "AlibabaPuHuiTi", "Microsoft YaHei", Arial, sans-serif;
}

.bar-window .chart-container {
  width: 100%;
  height: 680px;
  margin: 0 auto;
  position: relative;
}

#barWindowMain {
  width: 100%;
  height: 100%;
}

/* 悬浮窗样式 */
.tooltip-custom {
  position: absolute;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 15px;
  font-size: 14px;
  line-height: 1.6;
  z-index: 9999;
  max-width: 350px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  border: 1px solid #eee;
  font-family: "AlibabaPuHuiTi", "Microsoft YaHei", Arial, sans-serif; /* 悬浮窗使用相同字体 */
}

.tooltip-custom.show {
  opacity: 1;
}

.tooltip-gender {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 8px;
  font-family: "AlibabaPuHuiTi", "Microsoft YaHei", Arial, sans-serif;
}

.tooltip-gender.male {
  background-color: #8985cf;
  color: white;
}

.tooltip-gender.female {
  background-color: #f4bb6e;
  color: white;
}

.tooltip-content {
  color: #333;
  margin-bottom: 8px;
  font-weight: 500;
  line-height: 1.4;
  font-family: "AlibabaPuHuiTi", "Microsoft YaHei", Arial, sans-serif;
}

.tooltip-value {
  color: #ff6b6b;
  font-weight: bold;
  font-size: 15px;
  font-family: "AlibabaPuHuiTi", "Microsoft YaHei", Arial, sans-serif;
}

.legend-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 15px;
  padding: 12px;
  font-family: "AlibabaPuHuiTi", "Microsoft YaHei", Arial, sans-serif; /* 图例使用相同字体 */
}

.legend-items {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-color {
  width: 18px;
  height: 18px;
  border-radius: 4px;
}

.legend-text {
  font-size: 14px;
  color: #333;
  font-family: "AlibabaPuHuiTi", "Microsoft YaHei", Arial, sans-serif;
}

.legend-male {
  background-color: #8985cf;
}

.legend-female {
  background-color: #f4bb6e;
}

.legend-hint {
  font-size: 13px;
  color: #666;
  text-align: center;
  font-style: italic;
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px dashed #ddd;
  width: 100%;
  font-family: "AlibabaPuHuiTi", "Microsoft YaHei", Arial, sans-serif;
}

/* ECharts图表字体设置 */
.echarts-tooltip {
  font-family: "AlibabaPuHuiTi", "Microsoft YaHei", Arial, sans-serif !important;
}

/* ================= 插入5：气泡图样式 (源自 5气泡图.txt) ================= */
.bubble-window {
  position: relative;
  height: 700px;
}

.bubble-window * {
  box-sizing: border-box;
}

#info-panel {
  position: absolute;
  top: 10px;
  left: 20px;
  z-index: 1000;
  pointer-events: none;
  max-width: 400px;
}

.info-label {
  font-size: 14px;
  color: #888;
  margin-bottom: 4px;
}

.info-content {
  font-size: 18px;
  font-weight: bold;
  color: #333;
  margin-bottom: 15px;
  text-shadow: 1px 1px 0px rgba(255, 255, 255, 0.8);
  line-height: 1.4;
}

.nbi-value {
  /* --- 3. 即使是数字也优先使用普惠体 --- */
  /* font-family: 'AlibabaPuHuiTi', 'Alibaba PuHuiTi', monospace; */
  color: #555;
  font-weight: bold;
  font-size: 20px;
}

.bubble-window .chart-container {
  width: 100%;
  height: 100%;
}

#bubbleWindowMain {
  width: 100%;
  height: 100%;
}

#loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #666;
  font-size: 16px;
}

#back-hint {
  position: absolute;
  bottom: 30px;
  width: 100%;
  text-align: center;
  color: #aaa;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 100;
}

/* 图注样式 */
#legend-caption {
  position: absolute;
  bottom: 15px;
  width: 100%;
  text-align: center;
  color: #ccc; /* 浅灰色 */
  font-size: 12px;
  /* 小字 */
  opacity: 1;
  /* 默认显示 */
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 99;
  line-height: 1.6; /* 增加行高以适应换行 */
}
/* ================= 插入6：地图样式 (源自 6地图.zip/index.css) ================= */
.chinamap-window {
  position: relative;
}

.d3-x {
  position: relative;
  text-align: center;
  flex: 1;
  min-width: 400px;
}

.charts {
  /* display: flex; */
  /* flex-wrap: wrap; */
  column-gap: 4px;
}

#control-panel {
  margin-bottom: 20px;
}

select {
  padding: 8px 12px;
  font-size: 16px;
}
.map-popup h4 {
  margin: 10px 0;
}
.map-popup p {
  margin: 6px 0;
}

/* ================= 参考论文样式 ================= */
.refs {
  margin-top: 60px;
}

.refs li::marker {
  color: var(--dark-purple);
}

/* ================= 手机端样式 ================= */
@media (max-width: 768px) {
  .article-container {
    padding: 36px 16px;
  }

  h1 {
    font-size: 30px;
    line-height: 1.35;
    margin-bottom: 40px;
  }

  h2 {
    font-size: 24px;
    margin-top: 56px;
  }

  p {
    font-size: 16px;
  }

  .baidu-logo img {
    width: 190px;
  }

  .search-box {
    padding-right: 100px;
  }

  .search-button {
    right: 6px;
    padding: 8px 14px;
  }

  /* 柱状图 */
  .bar-window .chart-container {
    height: 500px;
  }

  /* 气泡图 */
  .bubble-window .chart-container {
    height: 500px;
  }

  /* 高亮 */
  .highlight {
    background: linear-gradient(
      180deg,
      transparent 90%,
      var(--light-purple) 90%
    );
  }

  /* 搜索 */
  .autocomplete-list {
    padding-left: 6px;
  }
  .autocomplete-item {
    padding: 6px;
  }

  .d3-x {
    min-width: 0;
    width: 100%;
  }
}
