/* ════════════════════════════════════
   SCREEN 1 — The Lily
════════════════════════════════════ */
.lily-wrap {
  position: relative;
  width: 280px;
  height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lily-glow {
  position: absolute;
  width: 240px;
  height: 240px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -52%) scale(0.85);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(240,150,80,0.22) 0%, rgba(240,60,120,0.18) 35%, transparent 70%);
  opacity: 0;
  animation: glowBreath 3s ease-in-out infinite;
  animation-delay: 2.5s;
  pointer-events: none;
}
@keyframes glowBreath {
  0%, 100% { opacity: 0.2; transform: translate(-50%, -52%) scale(0.85); }
  50%       { opacity: 0.8; transform: translate(-50%, -52%) scale(1.15); }
}

.lily-svg {
  width: 220px;
  height: 300px;
  animation: lilyReveal 1.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
  filter: drop-shadow(0 0 22px rgba(240,100,160,0.45)) drop-shadow(0 0 8px rgba(240,190,60,0.2));
}
@keyframes lilyReveal {
  0%   { opacity: 0; transform: scale(0.1); }
  100% { opacity: 1; transform: scale(1); }
}

.petal {
  transform-box: fill-box;
  transform-origin: center bottom;
  opacity: 0;
  animation: petalBloom 0.9s cubic-bezier(0.34, 1.5, 0.64, 1) forwards;
}
.outer.p1 { animation-delay: 0.9s; }
.outer.p2 { animation-delay: 1.1s; }
.outer.p3 { animation-delay: 1.3s; }
.inner.p4 { animation-delay: 1.05s; }
.inner.p5 { animation-delay: 1.25s; }
.inner.p6 { animation-delay: 1.45s; }
@keyframes petalBloom {
  0%   { opacity: 0; transform: scaleY(0); }
  60%  { opacity: 1; transform: scaleY(1.08); }
  100% { opacity: 1; transform: scaleY(1); }
}

.stamen { opacity: 0; animation: fadeIn 0.9s ease forwards 2.0s; }

.orbit-wrap {
  position: absolute;
  width: 0; height: 0;
  top: 50%; left: 50%;
  margin-top: -52px;
  pointer-events: none;
  opacity: 0;
  animation: fadeIn 0.8s ease forwards 3.0s;
}
.orbit-star {
  position: absolute;
  width: 8px; height: 8px;
  font-size: 10px;
  color: #e03040;
  text-shadow: 0 0 6px rgba(220,30,50,0.95);
  top: -4px;
  left: -4px;
}
.os1 { animation: orbit 5s linear infinite; }
.os2 { animation: orbit 5s linear infinite; animation-delay: -1.25s; }
.os3 { animation: orbit 5s linear infinite; animation-delay: -2.5s; }
.os4 { animation: orbit 5s linear infinite; animation-delay: -3.75s; }
@keyframes orbit {
  from { transform: rotate(0deg)   translateX(76px) rotate(0deg); }
  to   { transform: rotate(360deg) translateX(76px) rotate(-360deg); }
}

.spark {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: sparkFly 1.1s ease-out forwards;
  opacity: 0;
}
@keyframes sparkFly {
  0%   { opacity: 1; transform: translate(0, 0) scale(1.2); }
  100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(0); }
}

.hint {
  margin-top: 48px;
  font-family: 'Raleway', sans-serif;
  font-size: 12px;
  letter-spacing: 6px;
  color: #f0c060;
  text-transform: uppercase;
  opacity: 0;
  cursor: pointer;
  animation: fadeIn 1s ease forwards 3.0s, hintPulse 2.4s ease-in-out infinite 3.6s;
}


/* ════════════════════════════════════
   SCREEN 2 — Opening Text
════════════════════════════════════ */
#screen2-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 580px;
  width: 100%;
  transition: opacity 0.9s ease;
}

.sparkle-star-svg {
  width: 40px; height: 40px;
  margin-bottom: 8px;
  animation: spinStar 6s linear infinite;
}
@keyframes spinStar {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

#screen2 p {
  font-family: 'Raleway', sans-serif;
  font-size: clamp(22px, 3vw, 30px);
  font-style: italic;
  font-weight: 400;
  line-height: 1.8;
  color: #fdf5e8;
  opacity: 0;
}
#screen2 p:has(.word) {
  opacity: 1;
}
#screen2 p .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
#screen2 p .word.visible {
  opacity: 1;
  transform: translateY(0);
}


/* ════════════════════════════════════
   SCREEN 2b — Bridge Text
════════════════════════════════════ */
#screen2b-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 580px;
  width: 100%;
  transition: opacity 0.9s ease;
}

#screen2b p {
  font-family: 'Raleway', sans-serif;
  font-size: clamp(22px, 3vw, 30px);
  font-style: italic;
  font-weight: 400;
  line-height: 1.8;
  color: #fdf5e8;
  opacity: 0;
}
#screen2b p:has(.word) { opacity: 1; }
#screen2b p .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
#screen2b p .word.visible {
  opacity: 1;
  transform: translateY(0);
}


/* ════════════════════════════════════
   SCREEN 3 — Gallery
════════════════════════════════════ */
#screen3-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 820px;
  width: 100%;
  padding: 0 20px;
}

#screen3 h2 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(18px, 2.4vw, 26px);
  font-style: italic;
  font-weight: 400;
  color: #f0c060;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.gallery {
  position: relative;
  width: 100%;
  height: clamp(260px, calc(100vh - 160px), 520px);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 8px 36px rgba(200,150,60,0.18), 0 2px 10px rgba(0,0,0,0.55);
}
.gallery-item {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.9s ease;
}
.gallery-item.visible {
  opacity: 1;
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}


/* ════════════════════════════════════
   SCREEN 4 — The Question
════════════════════════════════════ */
#screen4-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 700px;
  width: 100%;
}

#screen4 h2 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(32px, 5vw, 54px);
  font-style: italic;
  font-weight: 400;
  line-height: 1.45;
  color: #fdf5e8;
  animation: breatheText 3.5s ease-in-out infinite;
  opacity: 0;
}
#screen4 h2:has(.word) {
  opacity: 1;
}
#screen4 .answer-buttons,
#screen4 .subtle-note {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
#screen4 .answer-buttons.visible,
#screen4 .subtle-note.visible {
  opacity: 1;
  transform: translateY(0);
}
#screen4 h2 .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
#screen4 h2 .word.visible {
  opacity: 1;
  transform: translateY(0);
}


/* ════════════════════════════════════
   SCREEN 5 — ДА: Звездите се наредиха
════════════════════════════════════ */
#screen5 { overflow: hidden; }

#stars-canvas {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
}

#screen5-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 600px;
  width: 100%;
  opacity: 0;
  transition: opacity 1.6s ease;
}
#screen5-inner.visible {
  opacity: 1;
}

#screen5-inner .star-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(13px, 1.6vw, 17px);
  font-style: italic;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: #f0c060;
  opacity: 0.7;
  margin-bottom: 28px;
}

#screen5-inner .star-message {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(22px, 3.2vw, 34px);
  font-style: italic;
  font-weight: 300;
  line-height: 1.9;
  color: #fdf5e8;
  text-align: center;
  text-shadow: 0 0 30px rgba(240,192,60,0.25);
}

#screen5-inner .star-message em {
  color: #f0c060;
  font-style: normal;
}


/* ════════════════════════════════════
   SCREEN 6 — НЕ: Shatter
════════════════════════════════════ */
#s6-aftermath {
  position: absolute;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(22px, 3.2vw, 36px);
  font-style: italic;
  font-weight: 300;
  color: rgba(220, 160, 170, 0.9);
  letter-spacing: 2px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
}
#s6-aftermath.visible {
  animation: fadeIn 2s ease forwards;
}

/* Sword slash line */
.sword-slash {
  position: absolute;
  width: 420px;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255,240,200,0.4) 15%,
    rgba(255,255,255,1) 42%,
    rgba(210,240,255,1) 50%,
    rgba(255,255,255,0.9) 58%,
    rgba(255,240,200,0.3) 85%,
    transparent 100%);
  box-shadow: 0 0 10px 3px rgba(200,230,255,0.8), 0 0 28px 8px rgba(180,210,255,0.3);
  transform: rotate(-8deg) translateX(-110%);
  pointer-events: none;
  z-index: 20;
  animation: swordSwipe 0.11s cubic-bezier(0.05, 0, 0.25, 1) forwards;
}
@keyframes swordSwipe {
  0%   { transform: rotate(-8deg) translateX(-110%); opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: rotate(-8deg) translateX(110%);  opacity: 0; }
}

/* Cut text halves — split by slash then drift apart and fade */
.s6-text-top {
  position: absolute;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(22px, 3.2vw, 36px);
  font-style: italic;
  font-weight: 300;
  color: rgba(220, 160, 170, 0.9);
  letter-spacing: 2px;
  clip-path: polygon(0 0, 100% 0, 106% 46%, -6% 54%);
  animation: slashHalfTop 1.9s ease-out forwards;
}
.s6-text-bottom {
  position: absolute;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(22px, 3.2vw, 36px);
  font-style: italic;
  font-weight: 300;
  color: rgba(220, 160, 170, 0.9);
  letter-spacing: 2px;
  clip-path: polygon(-6% 54%, 106% 46%, 100% 100%, 0 100%);
  animation: slashHalfBottom 1.9s ease-out forwards;
}
@keyframes slashHalfTop {
  0%   { opacity: 1; transform: translate(0, 0) rotate(0deg); }
  20%  { opacity: 0.9; }
  100% { opacity: 0;   transform: translate(-22px, -18px) rotate(-4deg); }
}
@keyframes slashHalfBottom {
  0%   { opacity: 1; transform: translate(0, 0) rotate(0deg); }
  20%  { opacity: 0.9; }
  100% { opacity: 0;   transform: translate(22px, 18px) rotate(4deg); }
}

/* Comeback message */
#s6-comeback {
  position: absolute;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(18px, 2.4vw, 26px);
  font-style: italic;
  font-weight: 300;
  color: rgba(240, 200, 100, 0.95);
  text-align: center;
  line-height: 1.7;
  max-width: 560px;
  padding: 0 20px;
  opacity: 0;
  pointer-events: none;
}
#s6-comeback.visible {
  animation: fadeIn 2.2s ease forwards;
}
#fall-lily-svg {
  width: 400px;
  height: 400px;
  filter: drop-shadow(0 0 38px rgba(200,60,180,0.55)) drop-shadow(0 0 14px rgba(240,190,60,0.25));
  transition: opacity 0.05s ease, filter 0.6s ease, transform 0.6s ease;
}

/* Pre-crack flower tremble */
@keyframes s6Tremble {
  0%,100% { transform: translate(0,0) rotate(0deg); }
  15%     { transform: translate(-2px,-1px) rotate(-0.3deg); }
  30%     { transform: translate(2px, 1px) rotate( 0.3deg); }
  45%     { transform: translate(-1px, 2px) rotate(-0.2deg); }
  60%     { transform: translate(1px,-2px) rotate( 0.2deg); }
  75%     { transform: translate(-2px, 1px) rotate(-0.1deg); }
}

/* Full violent screen shake */
@keyframes screenShake {
  0%,100% { transform: translate(0,0) rotate(0deg) scale(1); }
  5%      { transform: translate(-14px,-8px) rotate(-0.8deg) scale(1.01); }
  12%     { transform: translate(13px, 9px) rotate( 0.7deg) scale(0.99); }
  19%     { transform: translate(-11px, 10px) rotate(-0.6deg) scale(1.01); }
  26%     { transform: translate(12px,-10px) rotate( 0.6deg) scale(0.99); }
  33%     { transform: translate(-10px, 7px) rotate(-0.5deg); }
  41%     { transform: translate(9px,-8px) rotate( 0.4deg); }
  50%     { transform: translate(-7px, 5px) rotate(-0.3deg); }
  60%     { transform: translate(6px,-4px) rotate( 0.2deg); }
  72%     { transform: translate(-4px, 3px) rotate(-0.15deg); }
  84%     { transform: translate(3px,-2px) rotate( 0.1deg); }
  93%     { transform: translate(-1px, 1px); }
}

/* Impact shockwave ring */
@keyframes svgRingExpand {
  0%   { opacity: 1; transform: scale(1); stroke-width: 3; }
  100% { opacity: 0; transform: scale(11); stroke-width: 0.5; }
}

/* Post-explosion afterglow */
@keyframes shardAfterGlow {
  0%   { opacity: 0.7; transform: scale(0.1); }
  40%  { opacity: 0.5; }
  100% { opacity: 0;   transform: scale(2.8); }
}

/* Flash overlay — crimson */
#s6-flash {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255,30,30,0.95) 0%, rgba(180,0,60,0.92) 55%, rgba(80,0,20,0.88) 100%);
  z-index: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.06s ease;
}
#s6-flash.on  { opacity: 0.88; transition: opacity 0.04s ease; }
#s6-flash.off { opacity: 0;    transition: opacity 0.3s ease; }

/* After-glow ripple element */
.s6-afterglow {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 590;
  background: radial-gradient(circle, rgba(200,0,60,0.55) 0%, rgba(140,0,40,0.3) 45%, transparent 70%);
  animation: shardAfterGlow 1.1s cubic-bezier(0.2,0,0.6,1) forwards;
}

/* Flying shards */
.shard {
  position: fixed;
  pointer-events: none;
  z-index: 600;
  animation: shardFly var(--dur) cubic-bezier(0.12, 0, 0.38, 1) forwards;
}
@keyframes shardFly {
  0%   { opacity: 1; transform: translate(-50%,-50%) rotate(0deg) scale(1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty)))
                                rotate(var(--rot)) scale(var(--sf)); }
}


/* ════════════════════════════════════
   LILY BLOOM TRANSITION OVERLAY
════════════════════════════════════ */
#lily-transition {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0e0814;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.7s ease;
}
#lily-transition.active   { opacity: 1; pointer-events: all; }
#lily-transition.fade-out { opacity: 0; transition: opacity 2.4s ease; }

/* Top-down lily SVG */
.td-lily-svg {
  width: 260px;
  height: 260px;
  opacity: 0;
  filter: drop-shadow(0 0 40px rgba(240,80,150,0.75)) drop-shadow(0 0 16px rgba(240,190,60,0.45));
  animation: none !important;
}
#lily-transition.blooming .td-lily-svg {
  animation: lilyReveal 0.95s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
}

/* Top-down petals — start closed (scaleY 0 from base = center of flower) */
.td-petal {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  opacity: 0;
  transform: scaleY(0);
}
#lily-transition.blooming .td-petal {
  animation: petalBloom 0.72s cubic-bezier(0.34, 1.5, 0.64, 1) forwards;
}
#lily-transition.blooming g:nth-child(1) .td-petal { animation-delay: 0.42s; }
#lily-transition.blooming g:nth-child(2) .td-petal { animation-delay: 0.62s; }
#lily-transition.blooming g:nth-child(3) .td-petal { animation-delay: 0.82s; }
#lily-transition.blooming g:nth-child(4) .td-petal { animation-delay: 0.52s; }
#lily-transition.blooming g:nth-child(5) .td-petal { animation-delay: 0.72s; }
#lily-transition.blooming g:nth-child(6) .td-petal { animation-delay: 0.92s; }

/* Center stamen cluster */
.td-center { opacity: 0; }
#lily-transition.blooming .td-center {
  animation: fadeIn 0.6s ease forwards;
  animation-delay: 1.4s;
}

/* ── Rush petals (fly toward viewer, fill screen) ── */
.rush-petal {
  position: fixed;
  left: 50%;
  top: 50%;
  border-radius: 50% 0 50% 0;
  pointer-events: none;
  z-index: 900;
  animation: petalRush var(--dur) cubic-bezier(0.12, 0, 0.39, 0) forwards;
}
@keyframes petalRush {
  0%   {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.015) rotate(0deg);
  }
  5%   { opacity: 1; }
  70%  { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty)))
               scale(var(--scale)) rotate(var(--rot));
  }
}
