/* ==========================================================================
   生日惊喜网页设计系统 (Aesthetic Styling & Animations)
   ========================================================================== */

/* 核心变量定义：精致配色、字体与间距 */
:root {
  --primary-color: #ff4b72;       /* 生日暖粉红 */
  --primary-glow: rgba(255, 75, 114, 0.4);
  --secondary-color: #fe2c55;     /* 经典抖音红 */
  --accent-color: #ffd700;        /* 皇家金 (皇冠与礼物) */
  --bg-color: #0b0b0f;            /* 极深太空灰背景 */
  --card-bg: rgba(25, 25, 35, 0.65); /* 半透明玻璃背景 */
  --text-primary: #ffffff;
  --text-secondary: #b0b0bc;
  --border-glass: rgba(255, 255, 255, 0.12);
  --font-display: 'Outfit', 'Noto Sans SC', sans-serif;
}

/* 基础重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  font-family: var(--font-display);
  background-color: var(--bg-color);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ==========================================================================
   环境氛围层 (Ambient Background)
   ========================================================================== */
.ambient-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 30% 20%, #3e1b30 0%, #110e1a 60%, #050409 100%);
  z-index: 1;
  opacity: 0.8;
}

/* ==========================================================================
   设备外壳与主容器 (App Container)
   ========================================================================== */
.app-container {
  position: relative;
  width: 100%;
  height: 100dvh;
  background-color: #000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 2;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 桌面端/大屏幕自适应 - 转换为精致的手机框架 */
@media (min-width: 500px) and (min-height: 600px) {
  .app-container {
    width: 390px;
    height: 844px; /* iPhone 13/14 黄金比例 */
    border-radius: 40px;
    border: 10px solid #252429;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7),
                0 0 0 1px rgba(255, 255, 255, 0.05),
                0 0 30px var(--primary-glow);
  }
  
  /* PC端显示华丽的投影背景 */
  body::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    filter: blur(50px);
    z-index: 1;
    pointer-events: none;
    opacity: 0.5;
  }
}

/* ==========================================================================
   顶部状态栏 (App Header)
   ========================================================================== */
.app-header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 60px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, transparent 100%);
  z-index: 10;
  color: rgba(255, 255, 255, 0.9);
}

.header-center {
  display: flex;
  gap: 20px;
}

.nav-item {
  font-size: 16px;
  font-weight: 500;
  position: relative;
  padding: 5px 0;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.3s;
}

.nav-item.active {
  opacity: 1;
  font-weight: 700;
}

.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 3px;
  background-color: var(--primary-color);
  border-radius: 2px;
}

.header-left, .header-right {
  font-size: 20px;
  cursor: pointer;
  opacity: 0.8;
  transition: transform 0.2s;
}

.header-left:hover, .header-right:hover {
  transform: scale(1.1);
}

/* ==========================================================================
   视频播放区域 (Video Container)
   ========================================================================== */
.video-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  background-color: #020202;
}

#mainVideo {
  width: 100%;
  height: 100%;
  object-fit: cover; /* 竖屏剪裁铺满 */
  display: block;
}

/* 粒子背景画布 - 视频加载失败或未放入时的酷炫备用动画 */
#fallbackCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  display: none; /* JS中会根据加载状态动态切换 */
  background: radial-gradient(circle at center, #1b0a1c 0%, #030107 100%);
}

.play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1.5);
  font-size: 40px;
  color: rgba(255, 255, 255, 0.8);
  width: 80px;
  height: 80px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 4;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.play-overlay.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ==========================================================================
   右侧交互按钮 (Action Sidebar)
   ========================================================================== */
.action-sidebar {
  position: absolute;
  right: 12px;
  bottom: 110px; /* 避开底部导航栏和文字 */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  z-index: 8;
}

.sidebar-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.btn-icon {
  width: 48px;
  height: 48px;
  background: rgba(20, 20, 30, 0.5);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 22px;
  color: var(--text-primary);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.3s;
}

.sidebar-btn:hover .btn-icon {
  transform: scale(1.12);
  background: rgba(20, 20, 30, 0.8);
}

.btn-count {
  font-size: 12px;
  font-weight: 600;
  margin-top: 5px;
  color: var(--text-primary);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* 点赞激活状态 */
.sidebar-btn.liked .love-icon {
  color: var(--secondary-color);
  animation: heartPop 0.4s ease-out;
  background: rgba(254, 44, 85, 0.15);
  border-color: rgba(254, 44, 85, 0.3);
}

/* 头像专有样式 */
.profile-wrapper {
  position: relative;
  margin-bottom: 8px;
}

.profile-pic {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  animation: rotateBorder 8s linear infinite; /* 头像光圈旋转 */
}

.profile-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: #1e1b29;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--primary-color);
  font-size: 20px;
  overflow: hidden;
  border: 2px solid #000;
}

/* 头像头顶皇冠 */
.crown-icon {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%) rotate(-10deg);
  color: var(--accent-color);
  font-size: 18px;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.5));
  z-index: 2;
  animation: floatCrown 3s ease-in-out infinite;
}

/* 头像加号关注 */
.follow-plus {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 18px;
  background-color: var(--secondary-color);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #fff;
  font-size: 10px;
  border: 1.5px solid #000;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
  z-index: 2;
}

/* 生日礼物彩蛋按钮，闪耀的呼吸效果 */
.gift-btn-wrapper {
  margin-top: 10px;
}

.gift-box {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
  color: #fff;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.4), inset 0 2px 5px rgba(255,255,255,0.3);
  animation: giftPulse 2s infinite alternate;
}

.gift-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-color);
  margin-top: 5px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* ==========================================================================
   底部信息和弹幕面板 (Info Footer)
   ========================================================================== */
.info-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 7;
  padding: 16px 16px 0 16px;
  background: linear-gradient(to top, 
    rgba(0, 0, 0, 0.95) 0%, 
    rgba(0, 0, 0, 0.75) 45%, 
    rgba(0, 0, 0, 0.3) 75%, 
    transparent 100%);
  pointer-events: none; /* 穿透点击以便切换视频 */
}

.author-info {
  pointer-events: auto;
}

.author-info h3 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.video-desc {
  font-size: 13.5px;
  color: #e2e2e8;
  line-height: 1.4;
  margin-bottom: 12px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* 模拟神评论/弹幕滚动区 */
.comments-feed-container {
  width: 78%; /* 避开右侧 sidebar */
  height: 110px;
  overflow: hidden;
  position: relative;
  margin-bottom: 56px; /* 避开下方 Tab 导航栏 */
  mask-image: linear-gradient(to top, rgba(0,0,0,1) 60%, rgba(0,0,0,0) 100%);
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,1) 60%, rgba(0,0,0,0) 100%);
  pointer-events: auto;
}

.comments-feed {
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: flex-end;
  height: 100%;
}

.comment-item {
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-left: 3px solid var(--primary-color);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  color: #f0f0f5;
  width: fit-content;
  max-width: 100%;
  word-break: break-all;
  animation: commentSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
  display: flex;
  gap: 6px;
  align-items: center;
}

.comment-user {
  color: var(--accent-color);
  font-weight: 600;
}

.comment-text {
  color: #fff;
}

/* 底部虚拟导航栏 */
.footer-nav {
  display: flex;
  height: 48px;
  border-top: 0.5px solid rgba(255, 255, 255, 0.1);
  margin-left: -16px;
  margin-right: -16px;
  background-color: #000000;
  pointer-events: auto;
}

.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #888;
  font-size: 11px;
  cursor: pointer;
  transition: color 0.2s;
}

.nav-tab i {
  font-size: 18px;
  margin-bottom: 2px;
}

.nav-tab:hover, .nav-tab.active {
  color: #fff;
}

.create-btn {
  justify-content: center;
}

.create-btn i {
  width: 40px;
  height: 26px;
  background: linear-gradient(to right, #00f2fe, #fe2c55);
  color: #000;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 14px;
  box-shadow: 0 0 10px rgba(255,255,255,0.15);
}

/* ==========================================================================
   弹窗与卡片 (Modals - Glassmorphism)
   ========================================================================== */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 5, 10, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* 开屏卡片 */
.welcome-card {
  width: 85%;
  max-width: 320px;
  background: var(--card-bg);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  padding: 30px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5), inset 0 0 20px rgba(255,255,255,0.05);
  transform: translateY(30px);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .welcome-card {
  transform: translateY(0);
}

.card-glow {
  position: absolute;
  top: -50px;
  left: -50px;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  filter: blur(20px);
  pointer-events: none;
}

.crown-top {
  font-size: 38px;
  color: var(--accent-color);
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 8px var(--primary-glow));
  animation: floatCrown 2.5s ease-in-out infinite;
}

.welcome-card h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(to right, #fff 30%, #ff8cbf 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.birthday-greet {
  font-size: 14px;
  color: var(--primary-color);
  font-weight: 600;
  margin-bottom: 20px;
}

.card-message {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 26px;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
  border-radius: 12px;
  border: 1.5px dashed rgba(255, 255, 255, 0.08);
}

.start-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  border: none;
  border-radius: 14px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(254, 44, 85, 0.4);
  transition: all 0.3s;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 25px rgba(254, 44, 85, 0.6);
}

/* 惊喜贺卡/长信纸模态框 */
.letter-card {
  width: 88%;
  max-width: 340px;
  height: 75vh;
  max-height: 600px;
  background: rgba(18, 18, 26, 0.95);
  border: 1px solid var(--border-glass);
  border-radius: 28px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 25px 55px rgba(0,0,0,0.6);
  transform: scale(0.9);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .letter-card {
  transform: scale(1);
}

.close-btn {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 28px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s;
}

.close-btn:hover {
  color: #fff;
}

.letter-header {
  text-align: center;
  margin-bottom: 16px;
}

.letter-icon {
  font-size: 32px;
  color: var(--primary-color);
  margin-bottom: 8px;
}

.letter-header h2 {
  font-size: 18px;
  font-weight: 700;
}

.letter-content {
  flex: 1;
  overflow-y: auto;
  font-size: 13.5px;
  color: #e2e2e8;
  line-height: 1.7;
  padding-right: 8px;
  margin-bottom: 16px;
  white-space: pre-wrap; /* 保持换行格式 */
}

/* 定制炫酷滚动条 */
.letter-content::-webkit-scrollbar {
  width: 4px;
}

.letter-content::-webkit-scrollbar-thumb {
  background: var(--border-glass);
  border-radius: 2px;
}

.letter-footer {
  text-align: center;
}

.letter-footer p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  font-style: italic;
}

.ok-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
  border: none;
  border-radius: 12px;
  color: #000;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 5px 15px rgba(255, 140, 0, 0.4);
  transition: transform 0.2s;
}

.ok-btn:hover {
  transform: translateY(-1px);
}

/* ==========================================================================
   飘散的爱心动效 (Floating Hearts Effects)
   ========================================================================== */
.heart-effect-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
}

.floating-heart {
  position: absolute;
  color: var(--secondary-color);
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: floatHeart 1.2s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.3));
}

/* ==========================================================================
   手势提示 (Swipe Hint)
   ========================================================================== */
.swipe-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  pointer-events: none;
  animation: fadeOutHint 4s forwards;
}

.mouse-icon {
  font-size: 24px;
  margin-bottom: 8px;
  animation: bounceUpDown 1.5s infinite;
}

/* ==========================================================================
   动效与关键帧 (Keyframes)
   ========================================================================== */

/* 点赞按钮缩放动画 */
@keyframes heartPop {
  0% { transform: scale(1); }
  35% { transform: scale(1.4); }
  60% { transform: scale(0.9); }
  85% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* 飘散的爱心飞舞 */
@keyframes floatHeart {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3) rotate(0deg);
  }
  15% {
    opacity: 1;
    transform: translate(-50%, -80%) scale(1.2) rotate(var(--rot));
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--drift)), -220px) scale(0.7) rotate(calc(var(--rot) * 2.5));
  }
}

/* 评论弹幕向上滑出 */
@keyframes commentSlideUp {
  0% {
    opacity: 0;
    transform: translateY(25px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 头像外圈慢速旋转 */
@keyframes rotateBorder {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 皇冠微幅漂浮 */
@keyframes floatCrown {
  0%, 100% { transform: translateX(-50%) translateY(0) rotate(-10deg); }
  50% { transform: translateX(-50%) translateY(-4px) rotate(-8deg); }
}

/* 礼物盒呼吸起伏 */
@keyframes giftPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
  }
  100% {
    transform: scale(1.08);
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.7), 0 0 5px #ffd700;
  }
}

/* 上下缓动 */
@keyframes bounceUpDown {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* 手势提示渐渐淡出 */
@keyframes fadeOutHint {
  0% { opacity: 0; }
  15% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; pointer-events: none; visibility: hidden; }
}
