*{box-sizing:border-box}
html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#06130b}
body{font-family:Georgia,"Times New Roman",serif}

.scene{
 position:relative;width:100vw;height:100vh;overflow:hidden;isolation:isolate;
 background:#07170d;
}

/* Original forest image is retained, but the scene itself is now animated. */
.forest{
 position:absolute;inset:-4%;z-index:-10;
 background:url("forest.jpg") center/cover no-repeat;
 transform:scale(1.06);
 animation:camera 18s ease-in-out infinite alternate;
 will-change:transform;
}
.forest:after{
 content:"";position:absolute;inset:0;
 background:
 radial-gradient(ellipse at 50% 35%,rgba(224,236,163,.16),transparent 42%),
 linear-gradient(180deg,rgba(2,23,12,.05),rgba(0,8,4,.32));
}

.sun-rays{
 position:absolute;inset:-20%;z-index:1;pointer-events:none;
 opacity:.65;
 background:conic-gradient(from 250deg at 48% 2%,
 transparent 0deg,rgba(255,239,177,.10) 8deg,transparent 18deg,
 rgba(255,240,180,.07) 27deg,transparent 38deg,
 rgba(255,238,170,.06) 50deg,transparent 62deg);
 filter:blur(7px);
 animation:rays 11s ease-in-out infinite alternate;
 mix-blend-mode:screen;
}

.mist{
 position:absolute;width:75vw;height:14vh;border-radius:50%;
 background:rgba(225,243,216,.12);filter:blur(25px);
 z-index:2;pointer-events:none;mix-blend-mode:screen;
}
.mist1{left:-15vw;bottom:17%;animation:mist1 11s ease-in-out infinite alternate}
.mist2{right:-18vw;bottom:31%;opacity:.55;animation:mist2 15s ease-in-out infinite alternate}
.mist3{left:15vw;bottom:48%;opacity:.25;animation:mist3 19s ease-in-out infinite alternate}

.leaf-layer{position:absolute;inset:0;z-index:3;pointer-events:none;display:none}
.leaf-layer span{
 position:absolute;display:block;width:var(--w);height:var(--h);
 left:var(--x);top:var(--y);
 border-radius:100% 0 100% 0;
 background:linear-gradient(135deg,var(--c1),var(--c2));
 box-shadow:inset -2px -2px 5px rgba(0,0,0,.20);
 transform-origin:50% 90%;
 animation:sway var(--dur) ease-in-out var(--delay) infinite alternate;
 opacity:var(--op);
}
.leaf-layer span:after{
 content:"";position:absolute;left:48%;top:7%;width:1px;height:88%;
 background:rgba(225,245,181,.23);transform:rotate(3deg);
}
.layer-back{opacity:.58;filter:blur(1.2px)}
.layer-mid{opacity:.78}
.layer-front{opacity:.94}

.fireflies{position:absolute;inset:0;z-index:6;pointer-events:none}
.firefly{
 position:absolute;width:5px;height:5px;border-radius:50%;
 background:#fff3a5;box-shadow:0 0 10px 3px rgba(255,231,120,.7);
 animation:firefly var(--d) ease-in-out var(--delay) infinite;
}

/* =========================================================
   SMALL MULTICOLOUR EMOJI BUTTERFLIES
   ========================================================= */
.butterfly{
  position:absolute;
  z-index:7;
  width:24px;
  height:24px;
  pointer-events:none;
  font-size:24px;
  line-height:24px;
  will-change:left,top,transform;
  animation:flap .30s ease-in-out infinite alternate;
  filter:drop-shadow(0 2px 2px rgba(0,0,0,.30));
}

@keyframes flap{
  from{transform:scaleX(1) scaleY(1)}
  to{transform:scaleX(.58) scaleY(.94)}
}

@keyframes firefly{0%,100%{opacity:.08;transform:translate(0,0) scale(.7)}35%{opacity:1}60%{opacity:.35;transform:translate(30px,-35px) scale(1.2)}85%{opacity:.8;transform:translate(-20px,-70px)}}
@keyframes vine{from{transform:rotate(6deg) translateX(-4px)}to{transform:rotate(10deg) translateX(8px)}}
@keyframes cardIn{from{opacity:0;transform:translateY(40px) scale(.95);filter:blur(7px)}to{opacity:1;transform:none;filter:none}}
@keyframes cardFloat{from{transform:translateY(0)}to{transform:translateY(-9px)}}

@media(max-width:700px){
 .ai-card{padding:30px 20px;border-radius:20px}
 .vine{opacity:.7}
}


/* =========================================================
   FALLING LEAVES + NEW BACKGROUND LEAVES
   ========================================================= */

.falling-leaves,
.incoming-leaves{
  position:absolute;
  inset:0;
  overflow:hidden;
  pointer-events:none;
}

.falling-leaves{z-index:7}
.incoming-leaves{z-index:4;opacity:.88}

.falling-leaf,
.incoming-leaf{
  position:absolute;
  display:block;
  width:var(--size);
  height:calc(var(--size) * 1.55);
  border-radius:100% 0 100% 0;
  background:linear-gradient(135deg,var(--leaf-a),var(--leaf-b));
  box-shadow:
    inset -2px -2px 4px rgba(0,0,0,.18),
    0 2px 5px rgba(0,0,0,.12);
  transform-origin:50% 85%;
}

/* Fine central vein */
.falling-leaf::after,
.incoming-leaf::after{
  content:"";
  position:absolute;
  left:48%;
  top:8%;
  width:1px;
  height:86%;
  background:rgba(225,244,180,.30);
}

/* Falling leaf: zig-zag + rotation as it reaches the ground */
.falling-leaf{
  left:var(--start-x);
  top:-8%;
  opacity:var(--opacity);
  animation:
    leafFall var(--fall-time) linear var(--delay) infinite,
    leafSpin var(--spin-time) ease-in-out var(--delay) infinite alternate;
}

/* Background leaves continuously enter from the top */
.incoming-leaf{
  left:var(--start-x);
  top:-10%;
  opacity:var(--opacity);
  filter:blur(var(--blur));
  animation:
    backgroundLeafFall var(--fall-time) linear var(--delay) infinite,
    backgroundLeafSway var(--sway-time) ease-in-out var(--delay) infinite alternate;
}

@keyframes leafFall{
  0%{
    transform:translate3d(0,-12vh,0) rotate(0deg);
    opacity:0;
  }
  8%{opacity:var(--opacity)}
  25%{
    transform:translate3d(calc(var(--wind) * .35),25vh,0) rotate(100deg);
  }
  50%{
    transform:translate3d(calc(var(--wind) * -.45),52vh,0) rotate(210deg);
  }
  72%{
    transform:translate3d(calc(var(--wind) * .65),76vh,0) rotate(285deg);
  }
  90%{
    transform:translate3d(var(--wind),92vh,0) rotate(350deg);
    opacity:var(--opacity);
  }
  100%{
    transform:translate3d(calc(var(--wind) * .9),106vh,0) rotate(430deg);
    opacity:0;
  }
}

@keyframes leafSpin{
  0%{margin-left:-5px}
  50%{margin-left:8px}
  100%{margin-left:-9px}
}

@keyframes backgroundLeafFall{
  0%{
    transform:translate3d(0,-12vh,0) rotate(0deg) scale(.82);
    opacity:0;
  }
  10%{opacity:var(--opacity)}
  40%{
    transform:translate3d(calc(var(--wind) * .55),38vh,0)
               rotate(135deg) scale(.92);
  }
  75%{
    transform:translate3d(calc(var(--wind) * -.45),75vh,0)
               rotate(250deg) scale(1);
  }
  100%{
    transform:translate3d(var(--wind),110vh,0)
               rotate(380deg) scale(.9);
    opacity:0;
  }
}

@keyframes backgroundLeafSway{
  from{margin-left:-10px}
  to{margin-left:12px}
}


/* Large leaves are given a stronger sense of foreground depth. */
.falling-leaf.big{
  filter:drop-shadow(0 4px 5px rgba(0,0,0,.28));
  z-index:3;
}

.falling-leaf.medium{
  z-index:2;
}

.falling-leaf.small{
  z-index:1;
}


/* ==========================================================
   FLOWING WATER — lightweight CSS animation over the stream
   ========================================================== */
.water-flow{
  position:absolute;
  pointer-events:none;
  overflow:hidden;
  z-index:0;
  mix-blend-mode:screen;
}

/* Narrow stream in the middle of the forest, flowing toward us. */
.water-center{
  left:35%;
  top:50%;
  width:32%;
  height:32%;
  opacity:.58;
  clip-path:polygon(47% 0%,55% 0%,61% 18%,68% 38%,77% 58%,92% 78%,100% 100%,0% 100%,13% 78%,27% 60%,36% 40%,42% 18%);
}

/* Wider water visible at the bottom of the original image. */
.water-foreground{
  left:20%;
  top:69%;
  width:62%;
  height:31%;
  opacity:.72;
  clip-path:polygon(28% 0%,55% 0%,66% 12%,74% 28%,83% 48%,94% 72%,100% 100%,0% 100%,5% 74%,16% 51%,24% 30%);
}

.water-shimmer{
  position:absolute;
  inset:-35% -20%;
  /* Short, broken water streaks instead of long continuous lines. */
  background:
    linear-gradient(180 deg,
      transparent 0 18px,
      rgba(255,255,255,.17) 19px 21px,
      transparent 22px 58px
    ),
    linear-gradient(172deg,
      transparent 0 34px,
      rgba(177,225,222,.12) 35px 37px,
      transparent 38px 82px
    );
  background-size: 110px 62px, 145px 78px;
  background-repeat: repeat;
  transform:translate3d(0,-8%,0) scaleY(1.08);
  animation:waterFlowDown 5.5s linear infinite;
  filter:blur(.35px);
}

.water-center .water-shimmer{
  animation-duration:4.2s;
  opacity:.72;
}

.water-foreground .water-shimmer{
  animation-duration:3.6s;
  opacity:.82;
}

.water-ripples{
  position:absolute;
  inset:0;
}

.water-ripple{
  position:absolute;
  left:var(--x);
  top:var(--y);
  width:var(--w);
  height:var(--h);
  border-top:1px solid rgba(255,255,255,.34);
  border-bottom:1px solid rgba(145,210,207,.18);
  border-radius:50%;
  opacity:0;
  transform:scaleX(.72);
  animation:rippleFlow var(--duration) ease-in-out var(--delay) infinite;
  filter:blur(.25px);
}

@keyframes waterFlowDown{
  0%{transform:translate3d(0,-12%,0) scaleY(1.08)}
  100%{transform:translate3d(0,28%,0) scaleY(1.08)}
}

@keyframes rippleFlow{
  0%{opacity:0;transform:translateY(-8px) scaleX(.68)}
  12%{opacity:var(--opacity);}
  48%{opacity:var(--opacity);transform:translateY(12px) scaleX(1)}
  82%{opacity:.10;transform:translateY(30px) scaleX(1.12)}
  100%{opacity:0;transform:translateY(42px) scaleX(1.2)}
}

@media (prefers-reduced-motion:reduce){
  .water-shimmer,.water-ripple{animation:none}
}

/* Circular video - based on circle_4 */
.video-circle{
  width:400px;
  height:400px;
  border-radius:50%;
  overflow:hidden;
  position:absolute;
  top:50%;
  left:50%;
  transform:translate(-50%,-50%);
  z-index:10;
  border:5px solid #000000;
  outline:5px solid #000000;
  outline-offset:0;
  box-shadow:    
    0 0 15px 6px rgba(0,0,0,0.8),
    0 0 35px 15px rgba(0,0,0,0.6),
    0 0 70px 30px rgba(0,0,0,0.4);
}
.video-circle video{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
@media(max-width:700px){
  .video-circle{width:150px;height:150px;}
}

.export-btn {
    display: inline-block;
    margin: 15px 5px;
    padding: 12px 22px;
    border: none;
    border-radius: 8px;
    background: #222;
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

.export-btn:hover {
    background: #444;
}

.export-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
/* =========================================================
   SCROLLING CONTROLS
   ========================================================= */
html,body{height:auto;min-height:100%;overflow-x:hidden;overflow-y:auto}
body{background:#06130b;scrollbar-width:auto;scrollbar-color:#8eaa92 #101813}
body::-webkit-scrollbar{width:15px}
body::-webkit-scrollbar-track{background:#101813}
body::-webkit-scrollbar-thumb{background:#8eaa92;border-radius:10px;border:3px solid #101813}
.scene{height:100vh;min-height:700px}
.controls-page{position:relative;min-height:720px;background:linear-gradient(#07140d,#0b1e14);padding:45px 20px 80px;z-index:20}
.controls-wrapper{max-width:1100px;margin:0 auto;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:22px}
.control-card{background:rgba(12,27,20,.96);border:1px solid rgba(180,220,185,.22);border-radius:18px;padding:24px;box-shadow:0 12px 35px rgba(0,0,0,.35);color:#fff}
.control-card h2{margin:0 0 10px;font:700 23px Arial,sans-serif}
.help-text{margin:0 0 15px;color:#b9c9bf;font:14px Arial,sans-serif;line-height:1.5}
.big-select{width:100%;padding:13px 14px;border-radius:9px;border:1px solid #5e7465;background:#17251d;color:#fff;font-size:16px}
.status{margin-top:12px;padding:10px 12px;border-radius:8px;background:#112219;color:#bfe4c6;font:14px Arial,sans-serif}
.file-label{display:block;padding:12px;border-radius:9px;background:#17251d;font:15px Arial,sans-serif;margin-bottom:17px}
.file-label input{display:block;width:100%;margin-top:9px;color:#fff}
.small-label{display:block;margin-bottom:7px;color:#d9e7dd;font:14px Arial,sans-serif}
.control-row{margin:16px 0;font:15px Arial,sans-serif;color:#eef6f0}
.control-row input[type=range]{width:100%;margin-top:8px;cursor:pointer}
.button-row{display:flex;gap:8px;margin-top:20px}
.button-row button{flex:1;padding:11px 8px;border:0;border-radius:8px;background:#dce9df;color:#142219;font-weight:700;cursor:pointer}
.button-row button:hover{background:#fff}
.project-note{grid-column:1/-1;text-align:center;color:#aabdb0;font:14px Arial,sans-serif;padding:10px}
@media(max-width:800px){.controls-wrapper{grid-template-columns:1fr}.project-note{grid-column:auto}.scene{min-height:600px}.video-circle{max-width:90vw;max-height:90vw}}

/* Butterfly layer */
#butterflies{position:absolute;inset:0;z-index:7;pointer-events:none;overflow:hidden}
.butterfly{position:absolute;font-size:25px;line-height:25px;pointer-events:none;animation:butterflyFlap .35s ease-in-out infinite alternate;filter:drop-shadow(0 2px 2px rgba(0,0,0,.3))}
@keyframes butterflyFlap{from{transform:scaleX(1)}to{transform:scaleX(.55)}}


/* =========================================================
   ANIMATION MODE VISIBILITY
   Only the selected animation's effects are shown.
   ========================================================= */
.leaf-layer, #fireflies, #butterflies, #fallingLeaves, #incomingLeaves,
.mist, .sun-rays, .water-flow, .vine { display:none; }

.anim-full-jungle .leaf-layer,
.anim-full-jungle #fireflies,
.anim-full-jungle #butterflies,
.anim-full-jungle #fallingLeaves,
.anim-full-jungle #incomingLeaves,
.anim-full-jungle .mist,
.anim-full-jungle .sun-rays,
.anim-full-jungle .water-flow,
.anim-full-jungle .vine { display:block; }

/* =========================================================
   10 ANIMATION PRESETS
   ========================================================= */
@keyframes forestBreeze {
  0%,100% { transform: translate3d(0,0,0) scale(1); }
  50% { transform: translate3d(12px,-4px,0) scale(1.01); }
}
@keyframes forestSlowBreeze {
  0%,100% { transform: translateX(0); }
  50% { transform: translateX(5px); }
}
@keyframes forestMist {
  0%,100% { transform: translateX(-2%) scale(1); opacity:.18; }
  50% { transform: translateX(5%) scale(1.06); opacity:.45; }
}
@keyframes forestSun {
  0%,100% { opacity:.18; transform:scale(1); }
  50% { opacity:.48; transform:scale(1.08); }
}
@keyframes forestNight {
  0%,100% { filter:brightness(.72) saturate(.9); }
  50% { filter:brightness(.82) saturate(1.0); }
}

/* 1 - Full Jungle */
.anim-full-jungle .layer-back,.anim-full-jungle .layer-mid,.anim-full-jungle .layer-front { animation:forestBreeze 7s ease-in-out infinite; }
.anim-full-jungle #fallingLeaves,.anim-full-jungle #incomingLeaves { display:block !important; }
.anim-full-jungle #fireflies,.anim-full-jungle #butterflies,.anim-full-jungle .mist,.anim-full-jungle .sun-rays,.anim-full-jungle .water-flow,.anim-full-jungle .vine { display:block !important; }

/* 2 - Falling Leaves only */
.anim-falling-leaves #fallingLeaves,.anim-falling-leaves #incomingLeaves { display:block !important; }
.anim-falling-leaves .layer-back,.anim-falling-leaves .layer-mid,.anim-falling-leaves .layer-front { display:block; animation:forestSlowBreeze 9s ease-in-out infinite; }

/* 3 - Water & Mist only */
.anim-water-mist .mist,.anim-water-mist .water-flow { display:block !important; }
.anim-water-mist .mist { animation:forestMist 12s ease-in-out infinite; }

/* 4 - Fireflies only */
.anim-fireflies #fireflies { display:block !important; }

/* 5 - Butterflies ONLY */
.anim-butterflies #butterflies { display:block !important; }
.anim-butterflies .leaf-layer,
.anim-butterflies #fireflies,
.anim-butterflies #fallingLeaves,
.anim-butterflies #incomingLeaves,
.anim-butterflies .mist,
.anim-butterflies .sun-rays,
.anim-butterflies .water-flow,
.anim-butterflies .vine { display:none !important; }

/* 6 - Gentle Mist only */
.anim-gentle-mist .mist { display:block !important; animation:forestMist 12s ease-in-out infinite; }

/* 7 - Sun Rays only */
.anim-sun-rays .sun-rays { display:block !important; animation:forestSun 8s ease-in-out infinite; }

/* 8 - Gentle Breeze only */
.anim-gentle-breeze .layer-back,.anim-gentle-breeze .layer-mid,.anim-gentle-breeze .layer-front { display:block; animation:forestSlowBreeze 12s ease-in-out infinite; }

/* 9 - Deep Forest only */
.anim-deep-forest .layer-back { display:block; animation:forestSlowBreeze 15s ease-in-out infinite; transform:scale(1.02); }

/* 10 - Night Forest */
.anim-night-forest { animation:forestNight 10s ease-in-out infinite; }


/* =========================================================
   MOVABLE TEXT SQUARE
   ========================================================= */
.text-square{
  position:absolute; left:75%; top:50%; width:220px; height:220px;
  transform:translate(-50%,-50%); z-index:11; overflow:hidden;
  background:rgba(0,0,0,.80); border:4px solid #fff;
  box-shadow:0 0 18px rgba(0,0,0,.65);
  display:flex; align-items:center; justify-content:center;
  pointer-events:none;
}
.text-square-content{
  width:100%; height:100%; padding:14px;
  display:flex; align-items:center; justify-content:center;
  text-align:center; white-space:pre-wrap; overflow:hidden;
  color:#fff; font-family:Arial,sans-serif; font-size:28px;
  font-weight:400; font-style:normal; line-height:1.15;
  word-break:break-word;
}
.square-text-input{width:100%;padding:11px;border-radius:9px;border:1px solid #5e7465;background:#17251d;color:#fff;font:15px Arial,sans-serif;resize:vertical}
.square-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:10px}
.square-grid input[type=range]{width:100%}
.color-input{width:100%;height:44px;padding:3px;border-radius:8px;border:1px solid #5e7465;background:#17251d;cursor:pointer}
.square-buttons{display:flex;gap:8px;margin:15px 0;flex-wrap:wrap}
.square-buttons button,.secondary-btn{padding:10px 14px;border:0;border-radius:8px;background:#dce9df;color:#142219;font-weight:700;cursor:pointer}
.square-buttons button:hover,.secondary-btn:hover{background:#fff}
@media(max-width:800px){.square-grid{grid-template-columns:1fr}.text-square{max-width:70vw;max-height:70vw}}
