/* * 1. Global & Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  overscroll-behavior: none; /* 스크롤 튕김(바운스) 방지 */
}

body {
  background: linear-gradient(to bottom, #0f2027 0%, #203a43 50%, #2c5364 100%);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo",
    "Noto Sans KR", sans-serif;
  color: #333;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

/* * 2. Intro Overlay */
.intro-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0f2027;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: opacity 1s ease-out;
}

.intro-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.intro-content {
  text-align: center;
  color: white;
  padding: clamp(12px, 4vw, 24px);
  animation: float 3s ease-in-out infinite;
}

.intro-icon {
  font-size: clamp(2rem, 6vw, 3rem);
  margin-bottom: clamp(16px, 4vw, 24px);
  opacity: 0.9;
}

.intro-text {
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 40px;
  opacity: 0.8;
  font-weight: 300;
}

.start-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: white;
  padding: 16px 40px;
  font-size: 1.1rem;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s;
  backdrop-filter: blur(5px);
  font-family: inherit;
}

.start-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* * 3. Snow Effect */
#snowContainer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.snowflake {
  position: absolute;
  top: -50px;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
  pointer-events: none;
  animation: fall linear infinite;
  z-index: 1;
}

@keyframes fall {
  to {
    transform: translateY(110vh) rotate(360deg);
  }
}

/* * 4. Hero Section */
.tree-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px;
  position: relative;
  z-index: 2;
}

.hero-card {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  border-radius: 24px;
  padding: 48px 32px;
  max-width: 720px;
  width: 100%;
  text-align: center;
  opacity: 0;
  transform: translateY(30px);
  transition: all 1.5s ease-out;
}

.hero-card.show {
  opacity: 1;
  transform: translateY(0);
}

.tree-image {
  width: 100%;
  height: auto;
  border-radius: 12px;
  margin-bottom: 32px;
  filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.4));
}

h1 {
  color: white;
  font-size: 3rem;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  word-break: keep-all;
}

.sub-text {
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.1rem;
  font-weight: 300;
  margin-top: 8px;
}

.scroll-hint {
  margin-top: 40px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  animation: bounce 2.5s infinite;
  text-transform: uppercase;
}

@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

/* * 5. Content Section (Papers & Photos) */
.papers-section {
  padding: 60px 20px 0px; /* 하단 패딩 제거하고 별도 섹션 사용 */
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 2;
}

.card {
  background-color: #fffdf7;
  background-image: radial-gradient(#d0c9c0 1px, transparent 0);
  background-size: 20px 20px;
  width: 100%;
  max-width: 680px;
  min-height: 55vh;
  padding: 48px 40px;
  margin-bottom: 15vh;
  border-radius: 16px;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.15),
    inset 0 0 40px rgba(139, 69, 19, 0.03);
  opacity: 0;
  transform: translateY(60px) scale(0.95);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.photo-frame {
  background-color: #ffffff;
  width: 100%;
  max-width: 500px;
  padding: 16px 16px 60px 16px;
  margin-bottom: 15vh;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
  transform: rotate(-2deg);
  opacity: 0;
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
}

.photo-frame:nth-of-type(even) {
  transform: rotate(2deg);
}
.photo-frame img {
  width: 100%;
  height: auto;
  display: block;
  filter: sepia(20%) contrast(1.05);
}

/* Animation Classes */
.card.visible,
.photo-frame.visible {
  opacity: 1;
}
.photo-frame.visible {
  transform: rotate(-2deg) scale(1) translateY(0);
}
.photo-frame.visible:nth-of-type(even) {
  transform: rotate(2deg) scale(1) translateY(0);
}
.card.visible {
  transform: translateY(0) scale(1);
}

.contents {
  font-size: 1.2rem;
  line-height: 1.9;
  color: #4a4a4a;
  font-family: "KoPub Batang", serif;
  margin-bottom: 40px;
  white-space: pre-wrap;
  word-break: break-all;
}

.name-wrapper {
  text-align: right;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding-top: 20px;
}

.name {
  display: inline-block;
  font-size: 1.4rem;
  font-weight: 700;
  color: #9e2a2b;
  font-family: serif;
}

.name::before {
  content: "From. ";
  font-size: 0.7em;
  color: #888;
  font-weight: 400;
  margin-right: 4px;
}

/* * 6. Final Special Card (NEW) */
.final-section {
  padding: 0 20px 150px;
  display: flex;
  justify-content: center;
  z-index: 2;
  position: relative;
}

.final-card {
  background: linear-gradient(145deg, #1a1a1a, #0d0d0d); /* 고급스러운 블랙 */
  border: 1px solid rgba(255, 215, 0, 0.2); /* 금색 테두리 */
  color: #ece9e6;
  width: 100%;
  max-width: 720px;
  padding: 80px 40px;
  text-align: center;
  border-radius: 16px;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.5),
    0 0 30px rgba(255, 215, 0, 0.05); /* 은은한 금빛 광채 */

  opacity: 0;
  transform: translateY(40px);
  transition: all 1.2s ease-out;
}

.final-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.final-icon {
  font-size: 3rem;
  margin-bottom: 30px;
  filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
}

.final-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 40px;
  color: #e5c100; /* Gold Color */
  font-family: serif;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.final-text {
  font-size: 1.15rem;
  line-height: 2.2;
  color: rgba(255, 255, 255, 0.9);
  font-family: "KoPub Batang", serif;
  margin-bottom: 60px;
}

.final-sign {
  border-top: 1px solid rgba(255, 215, 0, 0.2);
  display: inline-block;
  padding-top: 24px;
  font-size: 1.1rem;
  color: #e5c100;
  font-family: serif;
  letter-spacing: 0.05em;
}

/* * 7. Music Control */
.music-control {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 1000;
  transition: transform 0.3s ease;
}
.music-control:hover {
  transform: scale(1.1);
}
.music-control svg {
  width: 24px;
  height: 24px;
  fill: white;
}

/* * 8. Responsive */
@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }
  .hero-card {
    padding: 32px 20px;
  }
  .card {
    padding: 32px 24px;
    min-height: 50vh;
    margin-bottom: 10vh;
  }
  .photo-frame {
    padding: 12px 12px 40px 12px;
    margin-bottom: 10vh;
  }
  .contents {
    font-size: 1.05rem;
  }

  .final-card {
    padding: 60px 24px;
  }
  .final-title {
    font-size: 1.6rem;
  }
  .final-text {
    font-size: 1.05rem;
  }
}

/* Timer Style */
.timer-section {
  text-align: center;
  padding: 60px 20px 0;
  color: rgba(255, 255, 255, 0.9);
  animation: fadeIn 2s ease-out;
  position: relative;
  z-index: 2;
}
.timer-label {
  font-size: 1rem;
  opacity: 0.8;
  margin-bottom: 8px;
}
.timer-count {
  font-size: 3rem;
  font-weight: 700;
  color: #ffd700; /* 금색 포인트 */
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
  margin-bottom: 8px;
  font-family: serif;
}
.timer-date {
  font-size: 0.9rem;
  opacity: 0.6;
  letter-spacing: 0.05em;
}

/* 모닥불 영역 스타일 */
.campfire-footer {
  position: relative;
  height: 300px;
  background: linear-gradient(to top, #0a0a0a 0%, transparent 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 40px;
  z-index: 5;
  overflow: hidden;
  margin-top: -100px; /* 자연스럽게 겹치도록 */
}

.campfire-wrapper {
  position: relative;
  width: 100px;
  height: 100px;
  margin-bottom: 20px;
}

/* 1. 광원 효과 */
.fire-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200px;
  height: 200px;
  background: radial-gradient(
    circle,
    rgba(255, 100, 0, 0.4) 0%,
    transparent 70%
  );
  animation: glowPulse 4s infinite alternate;
  filter: blur(20px);
}

/* 2. 장작 */
.logs {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 20px;
}
.log {
  position: absolute;
  bottom: 0;
  width: 60px;
  height: 15px;
  background: #4a3b2a;
  border-radius: 10px;
}
.log.left {
  left: 10px;
  transform: rotate(15deg);
}
.log.right {
  right: 10px;
  transform: rotate(-15deg);
}

/* 3. 불꽃 애니메이션 */
.flames {
  position: absolute;
  bottom: 15px;
  left: 20px;
  width: 60px;
  height: 60px;
}
.flame {
  position: absolute;
  bottom: 0;
  border-radius: 50% 50% 20% 20%;
  transform-origin: bottom center;
  filter: blur(2px);
}
.flame.one {
  left: 10px;
  width: 40px;
  height: 40px;
  background: rgba(255, 69, 0, 0.7); /* Red-Orange */
  animation: burn 1s infinite alternate ease-in-out;
}
.flame.two {
  left: 20px;
  width: 30px;
  height: 50px;
  background: rgba(255, 140, 0, 0.6); /* Dark Orange */
  animation: burn 1.5s infinite alternate ease-in-out 0.2s;
}
.flame.three {
  left: 15px;
  width: 30px;
  height: 30px;
  background: rgba(255, 215, 0, 0.5); /* Gold */
  animation: burn 2s infinite alternate ease-in-out 0.4s;
}

/* 4. 불티(Embers) */
.ember {
  position: absolute;
  bottom: 40px;
  left: 50%;
  width: 4px;
  height: 4px;
  background: #ffcc00;
  border-radius: 50%;
  box-shadow: 0 0 10px #ff4500;
  pointer-events: none;
  animation: rise var(--duration) linear forwards;
  opacity: 0;
}

.footer-text {
  font-family: serif;
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.9rem;
  margin-top: 10px;
  letter-spacing: 0.1em;
}

/* 애니메이션 키프레임 */
@keyframes glowPulse {
  0% {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(0.9);
  }
  100% {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(1.1);
  }
}
@keyframes burn {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.1) translateY(-5px);
    opacity: 0.4;
  }
}
@keyframes rise {
  0% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--drift)), -150px) scale(0);
  }
}

/* --- [NEW] 1. Aurora Background --- */
.aurora-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1; /* 눈(z-index:10)보다 뒤, 배경보다 앞 */
  background:
    radial-gradient(
      circle at 50% 100%,
      rgba(0, 255, 127, 0.1),
      transparent 60%
    ),
    radial-gradient(circle at 80% 20%, rgba(0, 191, 255, 0.15), transparent 50%);
  filter: blur(60px);
  animation: auroraMove 15s infinite alternate ease-in-out;
  pointer-events: none;
}

@keyframes auroraMove {
  0% {
    transform: scale(1) translate(0, 0);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.1) translate(-20px, 10px);
    opacity: 0.9;
  }
}

/* --- [NEW] 2. Scroll Progress Bar --- */
.scroll-progress-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  z-index: 10000;
}

.scroll-progress-bar {
  height: 100%;
  background: #ffd700; /* Gold */
  width: 0%;
  transition: width 0.1s;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.7);
}

/* --- [NEW] 3. Floating Action Buttons (Mobile UX) --- */
.floating-actions {
  position: fixed;
  bottom: 100px; /* 음악 버튼 위에 배치 */
  right: 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 999;
}

.float-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  display: flex; /* Top버튼은 처음에 숨김 처리 등은 JS로 제어 */
  justify-content: center;
  align-items: center;
}

.float-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.top-btn {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

.top-btn.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* 모바일 대응: 버튼들이 겹치지 않게 */
@media (max-width: 768px) {
  .floating-actions {
    bottom: 100px;
    right: 20px;
  }
  .music-control {
    right: 20px;
    bottom: 30px;
  }
}
