/* ============================================
   LOVE TREE — Magical romantic scene
   ============================================ */

.screen--love-tree {
  padding: 0;
  overflow: hidden;
  background: #050208;
}

.screen--love-tree.screen--active {
  z-index: 5;
}

/* Hide global bg layers when on love tree */
body.on-love-tree .bg-gradient,
body.on-love-tree .bg-orbs,
body.on-love-tree #starfield,
body.on-love-tree #floating-hearts,
body.on-love-tree .hero-bg {
  opacity: 0 !important;
  transition: opacity 1s ease;
}

body.on-love-tree .progress-bar-wrap,
body.on-love-tree .page-counter,
body.on-love-tree .mini-player {
  opacity: 0.4;
}

/* Canvas layers */
.lt-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#lt-sky { z-index: 1; }
#lt-particles { z-index: 2; }

/* Fog */
.lt-fog {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background: radial-gradient(ellipse at 50% 100%, rgba(255, 107, 157, 0.06) 0%, transparent 60%);
  animation: ltFogDrift 20s ease-in-out infinite alternate;
}

.lt-fog--2 {
  animation-delay: -10s;
  background: radial-gradient(ellipse at 30% 80%, rgba(100, 50, 120, 0.08) 0%, transparent 50%);
}

@keyframes ltFogDrift {
  0% { transform: translateX(-3%) scale(1); opacity: 0.5; }
  100% { transform: translateX(3%) scale(1.05); opacity: 0.8; }
}

/* Main scene — camera zoom container */
.lt-scene {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  transform-origin: center 70%;
  will-change: transform;
}

/* Moon */
.lt-moon {
  position: absolute;
  top: 8%;
  right: 12%;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff8f0, #ffe4d0 40%, rgba(255, 220, 200, 0.3) 70%);
  box-shadow:
    0 0 40px rgba(255, 220, 200, 0.4),
    0 0 80px rgba(255, 200, 180, 0.2);
  opacity: 0;
}

/* Intro text */
.lt-intro {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 380px;
  text-align: center;
  z-index: 20;
}

.lt-intro-line {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  font-style: italic;
  color: rgba(255, 220, 230, 0.9);
  text-shadow: 0 0 30px rgba(255, 107, 157, 0.5);
  min-height: 2.5em;
  line-height: 1.6;
}

/* Tree container */
.lt-tree-wrap {
  position: relative;
  width: min(92vw, 420px);
  height: min(58dvh, 480px);
  margin-bottom: 2rem;
  transform-origin: center bottom;
}

.lt-tree-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 20px rgba(255, 107, 157, 0.3));
}

.lt-tree-wrap.lt-wind .lt-branches {
  animation: ltWindSway 6s ease-in-out infinite;
  transform-origin: 200px 420px;
}

@keyframes ltWindSway {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(0.8deg); }
  75% { transform: rotate(-0.6deg); }
}

/* Interactive layers */
.lt-hearts-layer,
.lt-fruits-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.lt-hearts-layer { z-index: 10; }
.lt-fruits-layer { z-index: 11; }

/* Glowing tap hearts */
.lt-heart-node {
  position: absolute;
  width: 36px;
  height: 36px;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  opacity: 0;
  -webkit-tap-highlight-color: transparent;
}

.lt-heart-node::before {
  content: '♥';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 22px;
  color: var(--pink-neon);
  filter: drop-shadow(0 0 12px rgba(255, 107, 157, 0.9));
  animation: ltHeartPulse 2s ease-in-out infinite;
}

.lt-heart-node.opened::before {
  color: #fff;
  filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.8));
}

.lt-heart-node.growth-new::before {
  animation: ltHeartAppear 0.8s var(--ease-out-expo) forwards, ltHeartPulse 2s ease-in-out 0.8s infinite;
}

@keyframes ltHeartPulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.15); opacity: 1; }
}

@keyframes ltHeartAppear {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Memory fruits — glowing photo bubbles */
.lt-fruit {
  position: absolute;
  width: 52px;
  height: 52px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid rgba(255, 107, 157, 0.6);
  box-shadow:
    0 0 20px rgba(255, 107, 157, 0.5),
    inset 0 0 15px rgba(255, 255, 255, 0.1);
  overflow: hidden;
  cursor: pointer;
  pointer-events: auto;
  opacity: 0;
  background: rgba(255, 107, 157, 0.15);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: ltFruitFloat 4s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
}

.lt-fruit img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lt-fruit:nth-child(2) { animation-delay: -1.3s; }
.lt-fruit:nth-child(3) { animation-delay: -2.6s; }

@keyframes ltFruitFloat {
  0%, 100% { transform: translate(-50%, -50%) translateY(0); }
  50% { transform: translate(-50%, -50%) translateY(-6px); }
}

/* Floating hearts around tree */
.lt-float-hearts {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.lt-tiny-heart {
  position: absolute;
  font-size: 10px;
  color: rgba(255, 107, 157, 0.5);
  animation: ltTinyFloat var(--dur, 8s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  filter: drop-shadow(0 0 4px rgba(255, 107, 157, 0.6));
}

@keyframes ltTinyFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.3; }
  50% { transform: translateY(-20px) rotate(15deg); opacity: 0.7; }
}

/* Message popup */
.lt-popup {
  position: absolute;
  top: 12%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  max-width: 85%;
  padding: 1rem 1.5rem;
  background: rgba(26, 10, 18, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 107, 157, 0.35);
  border-radius: 16px;
  z-index: 25;
  box-shadow: 0 0 40px rgba(255, 107, 157, 0.3);
  transition: opacity 0.4s ease, transform 0.4s var(--ease-out-expo);
}

.lt-popup:not(.hidden) {
  transform: translateX(-50%) translateY(0);
}

.lt-popup.hidden {
  opacity: 0;
  pointer-events: none;
}

.lt-popup-text {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-style: italic;
  text-align: center;
  color: var(--white-soft);
  line-height: 1.5;
}

/* Bench + letter area */
.lt-bench-area {
  position: absolute;
  bottom: calc(4.5rem + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: min(92vw, 400px);
  z-index: 15;
  opacity: 0;
}

.lt-bench {
  width: 120px;
  height: 8px;
  background: linear-gradient(90deg, transparent, rgba(255, 107, 157, 0.4), transparent);
  border-radius: 4px;
  margin: 0 auto 0.5rem;
  box-shadow: 0 0 20px rgba(255, 107, 157, 0.3);
}

.lt-bench::before,
.lt-bench::after {
  content: '';
  position: absolute;
  bottom: 0;
  width: 6px;
  height: 20px;
  background: rgba(255, 107, 157, 0.3);
  border-radius: 2px;
}

.lt-bench-area .lt-bench {
  position: relative;
}

.lt-letter {
  max-height: 28dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.25rem;
  text-align: left;
  border-color: rgba(255, 107, 157, 0.2);
}

.lt-letter-text {
  font-family: var(--font-display);
  font-size: 0.95rem;
  line-height: 1.85;
  color: var(--white-muted);
  white-space: pre-wrap;
}

.lt-letter-text .lt-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--pink-neon);
  animation: ltBlink 0.8s step-end infinite;
  vertical-align: text-bottom;
  margin-left: 2px;
}

@keyframes ltBlink {
  50% { opacity: 0; }
}

/* Fruit expanded modal */
.lt-fruit-modal {
  position: fixed;
  inset: 0;
  z-index: 10002;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(5, 2, 8, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.lt-fruit-modal.show {
  opacity: 1;
  pointer-events: auto;
}

.lt-fruit-modal img {
  max-width: 85%;
  max-height: 55dvh;
  object-fit: contain;
  border-radius: 16px;
  border: 2px solid rgba(255, 107, 157, 0.4);
  box-shadow: 0 0 60px rgba(255, 107, 157, 0.4);
}

.lt-fruit-modal-quote {
  margin-top: 1.25rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-style: italic;
  text-align: center;
  color: var(--white-soft);
  max-width: 320px;
}

.lt-fruit-modal-close {
  position: absolute;
  top: calc(1rem + var(--safe-top));
  right: 1rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: white;
  font-size: 1.1rem;
  cursor: pointer;
}

/* Finale overlay */
.lt-finale {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  background: radial-gradient(ellipse at center, rgba(255, 51, 102, 0.15) 0%, rgba(5, 2, 8, 0.7) 70%);
  pointer-events: none;
}

.lt-finale.hidden {
  opacity: 0;
}

.lt-finale-line {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 5.5vw, 2.2rem);
  font-weight: 600;
  text-align: center;
  color: var(--white-soft);
  text-shadow: 0 0 40px rgba(255, 107, 157, 0.6);
  padding: 0 1.5rem;
  line-height: 1.4;
}

.lt-finale-line.accent {
  background: linear-gradient(135deg, #fff, var(--pink-soft), var(--red-glow));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: clamp(1.6rem, 6vw, 2.6rem);
}

/* Hint */
.lt-hint {
  position: absolute;
  bottom: calc(1rem + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: rgba(255, 107, 157, 0.6);
  z-index: 20;
  letter-spacing: 0.05em;
  animation: ltHintPulse 2.5s ease-in-out infinite;
}

.lt-hint.hidden { display: none; }

@keyframes ltHintPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* Tree growth brightness states */
.lt-tree-wrap.growth-1 { filter: drop-shadow(0 0 25px rgba(255, 107, 157, 0.35)); }
.lt-tree-wrap.growth-2 { filter: drop-shadow(0 0 35px rgba(255, 107, 157, 0.45)); }
.lt-tree-wrap.growth-3 { filter: drop-shadow(0 0 50px rgba(255, 107, 157, 0.55)); }
.lt-tree-wrap.growth-max { filter: drop-shadow(0 0 70px rgba(255, 51, 102, 0.65)); }

/* Finale tree state */
.lt-tree-wrap.lt-finale-active .lt-giant-heart {
  opacity: 1 !important;
}

.lt-tree-wrap.lt-finale-active .lt-leaves path {
  fill: rgba(255, 140, 170, 0.95);
}

/* Mobile */
@media (max-width: 480px) {
  .lt-tree-wrap {
    height: 52dvh;
    margin-bottom: 1rem;
  }

  .lt-heart-node {
    width: 42px;
    height: 42px;
  }

  .lt-heart-node::before {
    font-size: 26px;
  }

  .lt-fruit {
    width: 48px;
    height: 48px;
  }

  .lt-moon {
    width: 44px;
    height: 44px;
    top: 6%;
    right: 8%;
  }

  .lt-bench-area {
    bottom: calc(5rem + var(--safe-bottom));
  }

  .lt-letter {
    max-height: 22dvh;
  }
}

@media (max-height: 600px) {
  .lt-tree-wrap {
    height: 45dvh;
  }

  .lt-intro {
    top: 12%;
  }

  .lt-bench-area {
    display: none;
  }
}
