/* pages.css */

/* 页面容器（全屏背景） */
.page-container {
  width: 100%;
  min-height: 100vh;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  padding: 10px 10px 40px;
}

/* 1. 顶部条：左音乐 + 右登录（不悬浮） */
.login-area {
  position: relative;
  z-index: 999;

  display: flex;
  align-items: center;
  justify-content: space-between; /* ✅ 左边音乐，右边登录区 */
  gap: 12px;

  margin: 10px 10px 12px;
}

/* 左侧音乐按钮 */
.music-btn{
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(240, 230, 210, 0.35);
  background: rgba(45, 50, 70, 0.85);
  color: #f0e6d2;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-size: 16px;
}

.music-btn.is-playing{
  border-color: rgba(240, 230, 210, 0.75);
}

/* 右侧登录容器（包住“立即登录/已登录”） */
.login-right{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

/* ✅ 修复：立即登录按钮“变黑边框无背景”的问题 */
.login-btn {
  padding: 8px 16px;
  background-color: rgba(45, 50, 70, 0.9); /* ✅ 更稳定的深色背景 */
  color: #f0e6d2;
  border: 1px solid rgba(74, 80, 104, 0.9);
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
}

.logged-in {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #f0e6d2;
}

.nickname {
  font-size: 14px;
  color: #f0e6d2;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  padding: 6px 12px;
  background-color: rgba(45, 50, 70, 0.35);
  color: #f0e6d2;
  border: 1px solid rgba(74, 80, 104, 0.9);
  border-radius: 12px;
  cursor: pointer;
  font-size: 12px;
}

/* 2. 信封介绍区样式 */
.envelope-section {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 40px;
}

.envelope-box {
  width: 90%;
  max-width: 400px;
  padding: 30px 20px;
  /* background-size: contain; */
  background-repeat: no-repeat;
  background-position: center;
  text-align: center;
  border-radius: 12px;
}

.intro-content {
  margin-bottom: 30px;
  padding: 0 10px;
}

.btn-group {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.action-btn {
  padding: 10px 24px;
  background-color: #3a3f58;
  color: #f0e6d2;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s;
}

.action-btn:hover {
  background-color: #4a5068;
}

/* 3. 公开心愿区样式 */
.public-wish-section {
  width: 100%;
}

.section-title {
  text-align: center;
  color: #f0e6d2;
  font-size: 18px;
  margin-bottom: 10px;
}

/* =========================================================
   ✅ 横向时间轴（年份按钮：整体居中）
   ========================================================= */

.timeline-wrapper{
  width: 100%;
  overflow: hidden;
  margin-bottom: 10px;

  /* ✅ 关键：让内部时间轴在“内容不足一屏”时居中 */
  display: flex;
  justify-content: center;
}

.timeline{
  /* ✅ 改为 flex（不要 inline-flex），配合 wrapper flex 居中更稳定 */
  display: flex;
  align-items: center;
  gap: 0;
  padding: 14px 0;
  white-space: nowrap;

  /* ✅ 宽度按内容撑开，才能在 wrapper 里居中 */
  width: max-content;

  transition: transform 0.35s ease;
  will-change: transform;
}

/* 椭圆按钮 */
.timeline-item{
  position: relative;
  flex: 0 0 auto;

  padding: 8px 18px;
  margin: 0 14px;
  border-radius: 999px;

  background: rgba(45, 50, 70, 0.35);
  border: 1px solid rgba(240, 230, 210, 0.35);

  color: #f0e6d2;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;

  transition:
    background var(--ui-anim-duration) ease,
    border-color var(--ui-anim-duration) ease,
    transform var(--ui-anim-duration) ease,
    opacity var(--ui-anim-duration) ease;

  opacity: 0.85;
}

/* 中间连接线 */
.timeline-item::before,
.timeline-item::after{
  content: "";
  position: absolute;
  top: 50%;
  width: 14px;
  height: 2px;
  background: rgba(240, 230, 210, 0.35);
  transform: translateY(-50%);
}

.timeline-item::before{ left: -14px; }
.timeline-item::after{ right: -14px; }

.timeline-item:first-child::before{ display: none; }
.timeline-item:last-child::after{ display: none; }

/* 选中态 */
.timeline-item.active{
  opacity: 1;
  color: #ffffff;
  background: rgba(240, 230, 210, 0.12);
  border-color: rgba(240, 230, 210, 0.75);
  transform: scale(1.05);
}

.timeline-item.active::before,
.timeline-item.active::after{
  background: rgba(240, 230, 210, 0.75);
}

/* 心愿列表样式 */
.wish-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 10px 10px 40px;

  position: relative;
  overflow: hidden;
}

/* ✅ 公开心愿列表：左右滑动切换动画 */
.wish-list.anim-out-left { animation: pubOutLeft var(--ui-anim-duration) ease both; }
.wish-list.anim-out-right { animation: pubOutRight var(--ui-anim-duration) ease both; }
.wish-list.anim-in-left { animation: pubInLeft var(--ui-anim-duration) ease both; }
.wish-list.anim-in-right { animation: pubInRight var(--ui-anim-duration) ease both; }

@keyframes pubOutLeft { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(-18px); } }
@keyframes pubOutRight { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(18px); } }
@keyframes pubInLeft { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pubInRight { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: translateX(0); } }

.wish-item {
  padding: 20px;
  background-color: rgba(45, 50, 70, 0.8);
  border-radius: 12px;
}

.wish-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.wish-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.wish-nickname {
  font-size: 14px;
  color: #f0e6d2;
}

.wish-time {
  font-size: 12px;
  color: #999;
  margin-left: auto;
}

.wish-content {
  font-size: 14px;
  color: #f5f5f5;
  line-height: 1.6;
  margin-bottom: 10px;
}

.wish-reply, .wish-comment {
  font-size: 14px;
  color: #ccc;
  margin-top: 8px;
  padding-left: 10px;
  border-left: 2px solid #4a5068;
}

/* 写心愿按钮呼吸效果 */
.action-btn#writeBtn{
  transform-origin: center;
}

/* 用 class 控制启停，避免影响首次渲染 */
.action-btn#writeBtn.attention{
  animation: wishPulse 1.1s ease-in-out 0s 2; /* 每次触发做2次呼吸 */
}

@keyframes wishPulse{
  0%   { transform: scale(1); }
  50%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* 活动统计行 */
.wish-count-line{
  margin: 0;                  /* 不要负值 */
  text-align: center;
  font-size: 14px;
  color: rgba(240, 230, 210, 0.92);
}

#wishCountNum{
  font-weight: 700;
  color: #ffffff;
  padding: 0 2px;
}

/* 4. 底部二维码区 */
.footer-section{
  width: 100%;
  margin-top: 30px;
  padding: 18px 10px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.footer-qrcode{
  width: 110px;
  height: 110px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(45, 50, 70, 0.75);
  border: 1px solid rgba(240, 230, 210, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-qrcode img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.footer-text{
  font-size: 14px;
  color: rgba(240, 230, 210, 0.75);
}
.wish-item.just-added{
  outline: 1px solid rgba(240, 230, 210, 0.75);
  box-shadow: 0 0 0 3px rgba(240, 230, 210, 0.12);
  animation: justAddedFlash 1.2s ease;
}

@keyframes justAddedFlash{
  0%   { transform: scale(1); }
  35%  { transform: scale(1.01); }
  100% { transform: scale(1); }
}
/* =========================
   顶部弹幕（B站风格简化版）
   ========================= */
.danmaku-bar{
  margin: 0;                  /* 不要负值 */
  height: 140px;
  position: relative;
  z-index: 10;
  overflow: hidden;
  border-radius: 12px;
  pointer-events: none;
}

.danmaku-stage{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* 单条弹幕 */
.danmaku-item{
  position: absolute;
  left: 100%;
  white-space: nowrap;

  font-size: 14px;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 999px;

  color: rgba(255,255,255,0.96);
  background: rgba(0,0,0,0.28);
  border: 1px solid rgba(240, 230, 210, 0.18);
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);

  will-change: transform;
}

/* 昵称强调一下（可选） */
.danmaku-item .dm-name{
  color: rgba(240, 230, 210, 0.95);
  margin-right: 6px;
}
.top-extra{
  margin: 40px 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  justify-content: flex-start;
}

/* 播放中：按钮绕中心旋转 */
.music-btn.is-playing{
  animation: musicSpin 1.6s linear infinite;
}

@keyframes musicSpin{
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* 如果你不想影响按钮原本的布局/尺寸，可加这一句更稳 */
.music-btn{
  transform-origin: center;
}
/* =============== PC端：强制按手机端宽度显示 =============== */
@media (min-width: 768px) {
  /* 背景仍然铺满浏览器 */
  body {
    background-color: #12141d;
  }

  /* 页面主体像“手机屏幕”一样居中 */
  .page-container {
    max-width: 430px;          /* 你想要的“手机宽度”，可改 390/414/480 */
    margin: 0 auto;            /* 居中 */
    padding-left: 12px;
    padding-right: 12px;

    /* 可选：让它看起来更像一个手机卡片 */
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.45);
  }
}
