/* 基础变量 */
:root {
  --primary-blue: #8AC4FF;
  --primary-pink: #FF7AA2;
  --bg-color: #F5F9FF; /* 浅蓝背景 */
  --card-bg: rgba(255, 255, 255, 0.6);
  --text-color: #4A5568;
  --shadow: 6px 6px 12px rgba(174,190,205,0.2),
           -6px -6px 12px rgba(255,255,255,0.8);
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Microsoft YaHei', sans-serif;
  color: var(--text-color);
}

.background-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url(../image/留言背景.jpg) no-repeat center center fixed;
  background-size: cover;
  opacity: 0.95;
  z-index: -1;
  filter: blur(1px);
}

.comments-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 20px;
}

.barrage-area {
  flex: 1;
  position: relative;
  overflow: hidden; /* 隐藏超出部分的弹幕 */
}

.comments-list {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%); /* 将评论列表居中显示 */
  width: 100%;
  height: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 20px;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-width: 800px;
  margin: 0 auto;
}

.comment {
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  color: var(--text-color);
  max-width: 300px;
  width: 100%;
}

.control-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}

.comment-form {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 400px;
  width: 100%;
  margin-bottom: 20px;
}

#commentInput {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

#submitComment {
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: var(--primary-blue);
  color: white;
  cursor: pointer;
  transition: background 0.3s;
}

#submitComment:hover {
  background: var(--primary-pink);
}

.buttons {
  display: flex;
  gap: 20px;
}

#toggleCommentForm, #toggleCommentDisplay {
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: var(--primary-blue);
  color: white;
  cursor: pointer;
  transition: background 0.3s;
}

#toggleCommentForm:hover, #toggleCommentDisplay:hover {
  background: var(--primary-pink);
}

@media (max-width: 768px) {
  .comments-container {
    padding: 10px;
  }

  .comments-list {
    padding: 10px;
  }

  .comment-form {
    padding: 10px;
  }
}

/* 弹幕动画 */
@keyframes barrage {
  from {
    transform: translateX(120%); /* 从右屏幕外开始 */
  }
  to {
    transform: translateX(-120%); /* 移动到左屏幕外 */
  }
}

/* 静态评论列表样式 */
.static-comments {
  max-height: 400px; /* 固定高度 */
  overflow-y: auto; /* 垂直滚动 */
  padding: 20px;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}

.static-comment {
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  color: var(--text-color);
  margin-bottom: 10px;
}

.reply-box {
  display: none;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  color: var(--text-color);
  margin-top: 10px;
}

.reply-list {
  margin-bottom: 10px;
}

.reply-item {
  padding: 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  color: var(--text-color);
  margin-bottom: 5px;
}

.reply-item p {
  margin: 0;
}

.reply-item span {
  font-size: 0.8em;
  color: #888;
}

.reply-box input {
  padding: 5px;
  border: none;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.reply-box button {
  padding: 5px;
  border: none;
  border-radius: 5px;
  background: var(--primary-blue);
  color: white;
  cursor: pointer;
  transition: background 0.3s;
}

.reply-box button:hover {
  background: var(--primary-pink);
}