/* ===== 全局背景：宣纸纹理 ===== */
body {
  font-family: "KaiTi", "STKaiti", "SimSun", serif;
  background-image: url('../images/xuanzhi.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  color: #333;
  position: relative;
  overflow-x: hidden;
}

/* ===== 毛玻璃主容器：更宽但不撑满屏幕 ===== */
.main-container {
  position: relative;
  max-width: 1500px;           /* 变宽：从 1000px → 1300px（适合大多数桌面）*/
  width: 92%;                  /* 在小屏上也能自适应，不贴边 */
  margin: 0rem auto;         /* 居中 + 上下间距 */
  padding: 2rem 2.2rem;        /* 稍微加大内边距，更舒展 */
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 20px;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(212, 175, 55, 0.35);
}

/* ===== 标题：纯红色（朱砂红）===== */
h1 {
  font-size: 3.2rem;
  color: rgb(138, 37, 0);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  letter-spacing: 8px;
  margin: 1rem auto 1.5rem;
  text-align: center;
  font-weight: bold;
}

/* ===== 按钮组居中 ===== */
.button-group {
  text-align: center;
  margin-bottom: 1.5rem;
}
.button-group .form-select,
.button-group .btn {
  display: inline-block;
  width: auto;
  margin: 0 0.6rem;
  max-width: 200px;
}

/* ===== 图表容器 ===== */
#chart {
  width: 100% !important;
  height: 76vh !important;
  border: none;
  background: transparent;
  margin: 0 auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  border-radius: 12px;
}
/* ===== 微雨特效：细雨如丝 ===== */
.raindrop {
  position: fixed;
  top: -20px;
  width: 1.2px; /* 极细 */
  background: rgba(255, 255, 255, 0.5); /* 白色半透明 */
  border-radius: 0; /* 直线 */
  pointer-events: none;
  z-index: 5; /* 低于花瓣（z-index:10），高于背景 */
  animation: fallRain linear infinite;
}

@keyframes fallRain {
  to {
    transform: translateY(100vh);
  }
}
/* ===== 经典台词浮层 ===== */
.quote-overlay {
  position: fixed;
  top: 22%;
  left: 70%;
  transform: translateX(-50%);
  font-family: "KaiTi", "STKaiti", serif;
  font-size: 1.8rem;
  color: #b84f38;
  text-align: center;
  opacity: 0.92;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.4);
  z-index: 999;
  max-width: 80%;
  line-height: 1.5;
  pointer-events: none;
}

/* ===== 古风三列交错竖排 ===== */
.vertical-quote {
  position: absolute;
  left: 10%;       /* 距离左侧留白 */
  top: 8%;        /* 上方留白 */
  font-family: "KaiTi", "STKaiti", "SimSun", serif;
  color: #840b05;
  z-index: 100;
  pointer-events: none;
  line-height: 1;
}

.vertical-quote .col {
  position: absolute;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  white-space: nowrap;
  font-size: 2.2rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

/* 第一列：最右边，起始位置为 top: 0 */
.vertical-quote .col-1 {
  top: 0;
  left: 0;
}

/* 第二列：第一个字“那”与“郎”底部对齐
   “郎”是第一列第2个字 → 偏移 = (2 - 1) * 字高 = 1 * 2.2rem */
.vertical-quote .col-2 {
  top: calc(1 * 2.2rem);   /* 下移 2.2rem */
  left: 2.8rem;            /* 向左错开 */
}

/* 第三列：第一个字“你”与“花”底部对齐
   “花”是第二列第4个字 → 偏移 = (4 - 1) * 2.2rem = 6.6rem
   再加上第二列自身的 top 偏移 2.2rem → 总偏移 = 2.2 + 6.6 = 8.8rem */
.vertical-quote .col-3 {
  top: calc((1 + 3) * 2.2rem); /* = 4 * 2.2rem = 8.8rem */
  left: 5.6rem;                /* 再向左错开 */
}
/* 小印章样式（可选） */
.vertical-quote::before {
  content: "·";
  position: absolute;
  left: -40px;
  top: 0;
  font-size: 1.2rem;
  color: #b84f38;
  opacity: 0.7;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== 杏花微雨特效 ===== */

.petal {
  position: fixed;
  top: -20px;
  left: 0;
  width: 12px;
  height: 12px;
  background: linear-gradient(135deg, #ff9999, #ff6699);
  border-radius: 50% 50% 50% 0;
  pointer-events: none; /* 不阻挡点击 */
  opacity: 0.85;
  z-index: 10; /* 关键：高于主容器（默认 z-index: 0），低于弹窗（modal z-index ≈ 1000+）*/
  animation: fall linear forwards;
}

@keyframes fall {
  0%, 10% {
    transform: translateY(0) translateX(0) rotate(0);
    opacity: 0.85;
  }
  100% {
    transform: 
      translateY(100vh) 
      translateX(calc(var(--drift, 0) * 100px)) 
      rotate(720deg);
    opacity: 0;
  }
}

/* ===== 弹窗美化 ===== */
.modal-content {
  background-image: url('../images/xuanzhi.png');
  background-size: cover;
  border: 2px solid #d4af37;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}
.modal-header {
  background: rgba(212, 175, 55, 0.2);
  border-bottom: 1px solid #d4af37;
}
.modal-title {
  font-size: 1.6rem;
  font-weight: bold;
  color: #8b4513;
}
.modal-body img {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border: 3px solid #d4af37;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}
.modal-body p {
  font-size: 1.25rem;
  line-height: 1.6;
  color: #333;
  margin-top: 1rem;
  padding: 0 10px;
}

/* ===== 响应式适配 ===== */
@media (max-width: 768px) {
  .quote-overlay {
    font-size: 1.4rem;
    top: 20%;
  }
  h1 {
    font-size: 2.2rem;
  }
  .main-container {
    margin: 1rem;
    padding: 1.2rem;
  }
  #chart {
    height: 70vh !important;
  }
  .modal-body img {
    width: 100px;
    height: 100px;
  }
}