body {
  margin: 0;
  height: 100vh;
  background: #1a1a1a;
  overflow: hidden;
  position: relative;
}

.memorial-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 2;
  display: flex; /* 新增：使用Flexbox布局 */
  flex-direction: column; /* 新增：垂直排列子元素 */
  align-items: center; /* 新增：水平居中子元素 */
  justify-content: center; /* 新增：垂直居中子元素 */
}

.portrait {
  width: 400px;  /* 增加宽度 */
  height: 300px;  /* 降低高度 */
  border: 3px solid #8b0000;
  border-radius: 5px;
  filter: sepia(0.5) contrast(1.2);
  box-shadow: 0 0 30px rgba(139, 0, 0, 0.5);
  object-fit: cover;  /* 新增图片裁剪方式 */
  aspect-ratio: 4/3;  /* 固定宽高比 */
}

.glowing-title {
  color: #8b0000;
  text-shadow: 0 0 10px #ff0000;
  animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

.interaction-area {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  z-index: 2;
  position: relative;
}

.action-btn {
  background-color: #444; /* 深灰色背景 */
  color: #eee; /* 浅灰色文字 */
  border: 1px solid #666;
  padding: 10px 20px;
  font-size: 16px;
  cursor: pointer;
  border-radius: 5px;
  transition: background-color 0.3s, border-color 0.3s;
}

.action-btn:hover {
  background-color: #666;
  border-color: #888;
}

.count {
  color: #fff;
  font-size: 18px;
  font-weight: bold;
}


/* 新增水平移动动画 */
@keyframes horizontalMove {
  0% { transform: translateX(0); }
  100% { transform: translateX(calc(100vw - 50px)); }
}

.horizontal-flower {
  animation: 
    fadeOutUp 1.5s forwards,
    horizontalMove 4s 1.5s forwards; /* 1.5秒后开始水平移动 */
  bottom: 0;
  top: auto !important;
  transform: translateY(0) !important;
}

/* 调整花朵初始位置 */
.falling-element {
  position: absolute;
  top: -50px;
  font-size: 24px;
  pointer-events: none;
  z-index: 1;
}


/* 新增奠花样式 */
.mourning-flower {
  /* 确保以下属性存在 */
  animation: marquee 8s linear infinite;
  opacity: 1 !important;
  z-index: 9999;
  font-size: 60px;
}

@keyframes marquee {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100vw); }
}
@keyframes marquee {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}


/* 正确写法 */
.mourning-flower {
  animation: marquee 8s linear infinite;
}


/* 移动窗口样式 */
.moving-window {
  position: fixed;
  width: 300px;
  background-color: #000;
  border: 2px solid #ff0000;
  border-radius: 5px;
  box-shadow: 0 0 15px rgba(255, 0, 0, 0.7);
  z-index: 1; /* 低于遗照 */
  animation: diagonalMove 15s linear infinite, colorChange 2s infinite alternate;
  pointer-events: auto;
  transition: opacity 0.3s ease, transform 0.2s ease;
  cursor: pointer; /* 添加手型光标，提示可点击 */
}

.moving-window:hover {
  transform: scale(1.05); /* 悬停时略微放大 */
  box-shadow: 0 0 20px rgba(255, 0, 0, 0.9); /* 增强阴影效果 */
}

/* 当窗口与遗照重叠时应用的样式 */
.moving-window.overlap {
  opacity: 0.3; /* 当重叠时变得半透明 */
}

.window-header, .window-footer {
  display: flex;
  justify-content: space-between;
  padding: 5px;
  background-color: #0000ff;
}

.window-content {
  padding: 10px;
  text-align: center;
  font-size: 24px;
  font-weight: bold;
}

.window-content p {
  margin: 10px 0;
  animation: textColorChange 2s infinite alternate;
}

.close-btn {
  background-color: #0000ff;
  color: white;
  border: none;
  padding: 5px 10px;
  cursor: pointer;
  border-radius: 3px;
}

.close-btn:hover {
  background-color: #0000aa;
}

/* 对角线移动动画 - 修改为避开中央区域 */
@keyframes diagonalMove {
  0% {
    top: 0;
    left: 0;
  }
  25% {
    top: calc(100vh - 200px);
    left: calc(100vw - 300px);
  }
  50% {
    top: 0;
    left: calc(100vw - 300px);
  }
  75% {
    top: calc(100vh - 200px);
    left: 0;
  }
  100% {
    top: 0;
    left: 0;
  }
}

/* 文字颜色变化动画 */
@keyframes textColorChange {
  0% { color: #0000ff; } /* 蓝色 */
  100% { color: #ffff00; } /* 黄色 */
}
