/**
 * 🧧 春节喜庆装饰样式
 * 
 * 包含：灯笼、飘落物、横幅、装饰条等
 */

/* ===== 控制按钮 ===== */
.sf-toggle-btn {
  z-index: 9999;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #FFD700;
  background: linear-gradient(135deg, #FF0000 0%, #CC0000 100%);
  color: white;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(255, 0, 0, 0.4), 0 0 20px rgba(255, 215, 0, 0.3);
  animation: sf-btn-glow 2s ease-in-out infinite;
  outline: none;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.sf-toggle-btn:hover {
  box-shadow: 0 6px 24px rgba(255, 0, 0, 0.5), 0 0 30px rgba(255, 215, 0, 0.5);
}

.sf-toggle-btn.sf-dragging {
  animation: none;
  box-shadow: 0 8px 32px rgba(255, 0, 0, 0.6), 0 0 40px rgba(255, 215, 0, 0.6);
  transform: scale(1.1);
}

@keyframes sf-btn-glow {
  0%, 100% { box-shadow: 0 4px 16px rgba(255, 0, 0, 0.4), 0 0 20px rgba(255, 215, 0, 0.3); }
  50% { box-shadow: 0 4px 20px rgba(255, 0, 0, 0.6), 0 0 30px rgba(255, 215, 0, 0.5); }
}

/* ===== 新春祝福横幅 ===== */
.sf-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9998;
  display: flex;
  justify-content: center;
  pointer-events: auto;
  cursor: pointer;
  animation: sf-banner-slide-in 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.sf-banner-content {
  background: linear-gradient(135deg, #B22222 0%, #DC143C 30%, #FF0000 50%, #DC143C 70%, #B22222 100%);
  color: #FFD700;
  padding: 10px 40px;
  border-radius: 0 0 20px 20px;
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 8px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 
    0 4px 20px rgba(178, 34, 34, 0.5),
    0 0 40px rgba(255, 215, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 215, 0, 0.4);
  border-top: none;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  animation: sf-banner-glow 3s ease-in-out infinite;
}

.sf-banner-icon {
  font-size: 24px;
  animation: sf-banner-icon-bounce 1s ease-in-out infinite alternate;
}

.sf-banner-text {
  font-family: 'STKaiti', 'KaiTi', 'SimSun', serif;
}

@keyframes sf-banner-slide-in {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes sf-banner-glow {
  0%, 100% { box-shadow: 0 4px 20px rgba(178, 34, 34, 0.5), 0 0 40px rgba(255, 215, 0, 0.2); }
  50% { box-shadow: 0 4px 30px rgba(178, 34, 34, 0.7), 0 0 60px rgba(255, 215, 0, 0.4); }
}

@keyframes sf-banner-icon-bounce {
  from { transform: translateY(0) rotate(-5deg); }
  to { transform: translateY(-4px) rotate(5deg); }
}

/* ===== 灯笼组 ===== */
.sf-lantern-group {
  position: fixed;
  top: 0;
  z-index: 9990;
  display: flex;
  gap: 20px;
  pointer-events: none;
}

/* 灯笼位置靠中间 */
.sf-lantern-left {
  left: calc(50% - 500px);
}

.sf-lantern-right {
  right: calc(50% - 500px);
}

/* ===== 灯笼本体 ===== */
.sf-lantern {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: sf-lantern-swing 3s ease-in-out infinite;
  transform-origin: top center;
}

.sf-lantern-1 { animation-delay: 0s; }
.sf-lantern-2 { animation-delay: 0.5s; }
.sf-lantern-3 { animation-delay: 0.3s; }
.sf-lantern-4 { animation-delay: 0.8s; }

/* 灯笼线 */
.sf-lantern-line {
  width: 2px;
  height: 30px;
  background: linear-gradient(to bottom, #FFD700, #DAA520);
}

/* 灯笼主体容器 */
.sf-lantern-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  filter: drop-shadow(0 4px 12px rgba(255, 0, 0, 0.5));
}

/* 灯笼顶部装饰 */
.sf-lantern-top {
  width: 24px;
  height: 8px;
  background: linear-gradient(to bottom, #FFD700, #DAA520);
  border-radius: 3px 3px 0 0;
}

/* 灯笼中间部分（主体） */
.sf-lantern-middle {
  width: 44px;
  height: 52px;
  background: radial-gradient(ellipse at center, #FF4500 0%, #FF0000 40%, #CC0000 70%, #B22222 100%);
  border-radius: 50% / 55%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 
    inset 0 0 15px rgba(255, 200, 0, 0.4),
    0 0 20px rgba(255, 69, 0, 0.6);
  animation: sf-lantern-glow 2s ease-in-out infinite;
}

.sf-lantern-middle span {
  color: #FFD700;
  font-size: 18px;
  font-weight: bold;
  font-family: 'STKaiti', 'KaiTi', 'SimSun', serif;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.8);
}

/* 灯笼文字淡入淡出过渡 */
.sf-lantern-char {
  transition: opacity 0.5s ease, transform 0.5s ease;
  display: inline-block;
}

.sf-char-fade-in {
  opacity: 1;
  transform: scale(1);
}

.sf-char-fade-out {
  opacity: 0;
  transform: scale(0.6);
}

/* 灯笼底部装饰 */
.sf-lantern-bottom {
  width: 24px;
  height: 8px;
  background: linear-gradient(to top, #FFD700, #DAA520);
  border-radius: 0 0 3px 3px;
}

/* 灯笼穗子 */
.sf-lantern-tassel {
  width: 2px;
  height: 20px;
  background: linear-gradient(to bottom, #FFD700, #FF6347);
  position: relative;
  animation: sf-tassel-swing 2s ease-in-out infinite;
}

.sf-lantern-tassel::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 10px;
  background: linear-gradient(to bottom, #FFD700, #FF4500);
  border-radius: 0 0 50% 50%;
}

/* 灯笼动画 */
@keyframes sf-lantern-swing {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

@keyframes sf-lantern-glow {
  0%, 100% { 
    box-shadow: inset 0 0 15px rgba(255, 200, 0, 0.4), 0 0 20px rgba(255, 69, 0, 0.6); 
  }
  50% { 
    box-shadow: inset 0 0 25px rgba(255, 200, 0, 0.6), 0 0 35px rgba(255, 69, 0, 0.8); 
  }
}

@keyframes sf-tassel-swing {
  0%, 100% { transform: rotate(3deg); }
  50% { transform: rotate(-3deg); }
}

/* ===== 灯笼可点击交互 ===== */
.sf-lantern-clickable {
  pointer-events: auto;
  cursor: pointer;
}

.sf-lantern-clickable:hover .sf-lantern-middle {
  box-shadow:
    inset 0 0 30px rgba(255, 200, 0, 0.7),
    0 0 40px rgba(255, 69, 0, 0.9);
  transform: scale(1.1);
  transition: all 0.3s ease;
}

.sf-lantern-clickable:active .sf-lantern-middle {
  transform: scale(0.95);
}


/* ===== 飘落装饰物 ===== */
.sf-falling-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9985;
  overflow: hidden;
}

.sf-falling-item {
  position: absolute;
  top: -40px;
  animation: sf-fall linear forwards;
  opacity: 0.8;
  will-change: transform;
}

@keyframes sf-fall {
  0% {
    transform: translateY(0) rotate(0deg) translateX(0);
    opacity: 0;
  }
  5% {
    opacity: 0.8;
  }
  100% {
    transform: translateY(calc(100vh + 60px)) rotate(720deg) translateX(50px);
    opacity: 0;
  }
}

/* ===== 顶部装饰红线 ===== */
.sf-top-border {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    #FFD700 0%,
    #FF0000 15%,
    #FFD700 30%,
    #FF0000 45%,
    #FFD700 50%,
    #FF0000 55%,
    #FFD700 70%,
    #FF0000 85%,
    #FFD700 100%
  );
  background-size: 200% 100%;
  animation: sf-border-flow 4s linear infinite;
  z-index: 9995;
  box-shadow: 0 2px 8px rgba(255, 0, 0, 0.3);
}

@keyframes sf-border-flow {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

/* ===== 移动端适配 ===== */
@media (max-width: 768px) {
  /* 灯笼缩小并调整位置 */
  .sf-lantern-left {
    left: calc(50% - 160px);
  }

  .sf-lantern-right {
    right: calc(50% - 160px);
  }

  .sf-lantern-middle {
    width: 32px;
    height: 38px;
  }

  .sf-lantern-middle span {
    font-size: 14px;
  }

  .sf-lantern-top,
  .sf-lantern-bottom {
    width: 18px;
    height: 6px;
  }

  .sf-lantern-line {
    height: 20px;
  }

  .sf-lantern-tassel {
    height: 14px;
  }

  .sf-lantern-group {
    gap: 4px;
  }

  /* 横幅缩小 */
  .sf-banner-content {
    padding: 8px 20px;
    font-size: 16px;
    letter-spacing: 4px;
    gap: 8px;
  }

  .sf-banner-icon {
    font-size: 18px;
  }

  /* 控制按钮调整 */
  .sf-toggle-btn {
    width: 38px;
    height: 38px;
    font-size: 18px;
  }

  /* 减少飘落物 */
  .sf-falling-item:nth-child(n+8) {
    display: none;
  }
}

/* 更小屏幕 */
@media (max-width: 576px) {
  .sf-lantern-left {
    left: calc(50% - 100px);
  }

  .sf-lantern-right {
    right: calc(50% - 100px);
  }
}

/* ===== 减少动画偏好 ===== */
@media (prefers-reduced-motion: reduce) {
  .sf-lantern {
    animation: none;
  }
  .sf-falling-item {
    display: none;
  }
  .sf-banner {
    animation: none;
  }
  .sf-lantern-middle {
    animation: none;
  }
  .sf-lantern-tassel {
    animation: none;
  }
  .sf-top-border {
    animation: none;
  }
  .sf-toggle-btn {
    animation: none;
  }
}
