/* ===== 全局变量 ===== */
:root {
  --primary-color: #8a2500; /* 朱砂红 */
  --secondary-color: #d4af37; /* 金色 */
  --zhen-color: #2a5caa; /* 甄嬛党蓝 */
  --hua-color: #c3272b; /* 华妃党红 */
  --queen-color: #8b4513; /* 皇后党棕 */
  --bg-color: rgba(255, 255, 255, 0.85);
  --shadow-color: rgba(0, 0, 0, 0.15);
}

/* ===== 全局 body 样式（含宣纸背景）===== */
body {
  font-family: "KaiTi", "STKaiti", "SimSun", serif;
  color: #333;
  margin: 0;
  padding: 20px;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  background-image: url('../images/xuanzhi.png');
  background-size: cover;
  background-attachment: fixed;
  background-color: #f5f0e6; /* 兜底色 */
}

/* ===== ECharts Tooltip 修复 ===== */
.echarts-tooltip-custom,
div[style*="position: absolute;"][style*="pointer-events: none;"],
[class*="tooltip"] {
  max-width: 300px !important;
  word-wrap: break-word !important;
  white-space: normal !important;
  overflow-wrap: break-word !important;
  max-height: 200px;
  overflow-y: auto;
  z-index: 9000 !important;
  padding: 8px 12px !important;
  box-sizing: border-box !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

/* ===== 主容器 ===== */
.main-container {
  position: relative;
  max-width: 1600px;
  width: 95%;
  margin: 2rem auto;
  padding: 2.5rem 3rem;
  background: var(--bg-color);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-radius: 24px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  border: 2px solid rgba(212, 175, 55, 0.4);
  z-index: 10;
}

/* ===== 标题美化 ===== */
h1 {
  font-size: 3.5rem;
  color: var(--primary-color);
  text-align: center;
  margin: 1rem 0 2rem;
  font-weight: bold;
  letter-spacing: 10px;
  text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
  position: relative;
  padding-bottom: 20px;
}

h1::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--secondary-color), transparent);
}

/* ===== 搜索栏 ===== */
.search-container {
  position: relative;
  margin-bottom: 1.5rem;
}

.search-container input {
  width: 100%;
  padding: 12px 20px 12px 50px;
  border: 2px solid var(--secondary-color);
  border-radius: 50px;
  font-size: 1.1rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 12px var(--shadow-color);
  transition: all 0.3s ease;
}

.search-container input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.3);
  border-color: var(--primary-color);
}

.search-container i {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--secondary-color);
  font-size: 1.2rem;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border-radius: 10px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}

.search-result-item {
  padding: 12px 20px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  transition: background 0.2s;
}

.search-result-item:hover {
  background: #f8f9fa;
}

/* ===== 控制面板 ===== */
.control-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 2rem;
  padding: 20px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 16px;
  box-shadow: 0 4px 12px var(--shadow-color);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.control-group label {
  font-weight: bold;
  color: var(--primary-color);
  margin-bottom: 5px;
}

/* ===== 时间轴滑块 ===== */
.timeline-slider {
  width: 100%;
  height: 8px;
  -webkit-appearance: none;
  background: linear-gradient(90deg, #4CAF50, #FFC107, #2196F3, #9C27B0);
  border-radius: 4px;
  outline: none;
  margin: 20px 0;
}

.timeline-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.timeline-marks {
  display: flex;
  justify-content: space-between;
  padding: 0 10px;
  margin-top: 10px;
}

.timeline-mark {
  text-align: center;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 8px;
  transition: all 0.3s;
}

.timeline-mark.active {
  background: var(--primary-color);
  color: white;
  transform: scale(1.1);
}

/* ===== 剧情事件面板 ===== */
.events-panel {
  margin-top: 2rem;
  padding: 20px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  box-shadow: 0 4px 12px var(--shadow-color);
}

.events-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.event-card {
  background: white;
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 3px 10px var(--shadow-color);
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
  border-left: 4px solid var(--primary-color);
}

.event-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.event-card.active {
  background: linear-gradient(135deg, #f8f3e6, #f0e6d6);
  border-color: var(--secondary-color);
}

/* ===== 统计面板 ===== */
.stats-panel {
  display: flex;
  justify-content: center;
  gap: 30px;
  padding: 15px 30px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), rgba(138, 37, 0, 0.1));
  border-radius: 12px;
  margin-bottom: 2rem;
  font-size: 1.1rem;
  color: #333;
  border: 1px solid rgba(212, 175, 55, 0.3);
}

.stats-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.stats-value {
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--primary-color);
}

/* ===== 图表容器 ===== */
#chart {
  width: 100%;
  height: 75vh;
  min-height: 600px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.1);
  margin: 1rem 0;
  border: 2px solid rgba(212, 175, 55, 0.2);
}

/* ===== 按钮组 ===== */
.button-group {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 1.5rem 0;
}

.btn {
  padding: 10px 24px;
  border-radius: 50px;
  font-weight: 500;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.btn-outline-primary {
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-outline-primary:hover {
  background: var(--primary-color);
  color: white;
  transform: translateY(-2px);
}

.btn-outline-secondary {
  color: #666;
  border-color: #ddd;
}

.btn-outline-secondary:hover {
  background: #666;
  color: white;
  transform: translateY(-2px);
}

/* ===== 弹窗美化 ===== */
.modal-content {
  background: linear-gradient(135deg, #fff9f0, #fff5e6);
  border: 3px solid var(--secondary-color);
  border-radius: 20px;
  overflow: hidden;
}

.modal-header {
  background: linear-gradient(90deg, var(--primary-color), #b84f38);
  color: white;
  border-bottom: none;
  padding: 1.5rem;
}

.modal-title {
  font-size: 1.8rem;
  font-weight: bold;
}

.modal-body {
  padding: 2rem;
}

.character-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

#modalAvatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--secondary-color);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

#modalDesc {
  font-size: 1.1rem;
  line-height: 1.7;
  color: #333;
  text-align: center;
}



.vertical-quote .quote-col {
  position: absolute;
  top: 0;
  left: 0;
  width: 1em;
}

.vertical-quote .quote-col > div {
  display: block;
  width: 1em;
  text-align: center;
  margin: 0 auto;
  transform: translateX(-50%);
}
/* ===== 花瓣特效 ===== */
.petal {
  position: fixed;
  width: 15px;
  height: 15px;
  background: linear-gradient(135deg, #ff99cc, #ff6699);
  border-radius: 50% 0 50% 50%;
  pointer-events: none;
  opacity: 0.7;
  z-index: 1;
  filter: blur(1px);
}

/* ===== 响应式设计 ===== */
@media (max-width: 1200px) {
  .main-container {
    padding: 2rem;
  }
  h1 {
    font-size: 2.8rem;
    letter-spacing: 6px;
  }
}

@media (max-width: 768px) {
  body {
    padding: 10px;
  }
  .main-container {
    padding: 1.5rem;
    width: 100%;
  }
  h1 {
    font-size: 2rem;
    letter-spacing: 3px;
  }
  #chart {
    height: 60vh;
    min-height: 400px;
  }
  .control-panel {
    grid-template-columns: 1fr;
  }
  .stats-panel {
    flex-direction: column;
    gap: 15px;
  }
}

@media (max-width: 576px) {
  h1 {
    font-size: 1.8rem;
  }
  .main-container {
    padding: 1rem;
  }
  #chart {
    height: 50vh;
    min-height: 300px;
  }
}

/* ===== 滚动条美化 ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.5);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 175, 55, 0.7);
}

/* ===== 加载动画 ===== */
.loading-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(212, 175, 55, 0.3);
  border-radius: 50%;
  border-top-color: #d4af37;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== 时间线事件（Modal 内）===== */
.timeline {
  position: relative;
  padding-left: 30px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, #8a2500, #d4af37);
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
  padding-left: 20px;
}

.timeline-marker {
  position: absolute;
  left: 7px;
  top: 5px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #8a2500;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.timeline-content {
  background: white;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-left: 3px solid #d4af37;
  transition: transform 0.3s;
  cursor: pointer;
}

.timeline-content:hover {
  transform: translateX(5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
/* ===== 古风竖排台词 —— 纯净动态版 ===== */
#vertical-quote-container {
  position: fixed;
  top: 180px;
  left: 40px;
  z-index: 9999;
  pointer-events: none;
  font-family: "KaiTi", "STKaiti", "SimSun", serif;
}

#vertical-quote-container .quote-col {
  position: absolute;
  top: 0;
  width: 2.6em;
}

#vertical-quote-container .quote-col > div {
  font-size: 2.4rem;
  color: #8a2500; /* 朱砂红 */
  text-align: center;
  line-height: 1.3;
  height: 1.3em;
  margin: 0 auto;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}